iotAR小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

1 lines
166 KiB

var VPASSDK=function(t){var e={};function i(o){if(e[o])return e[o].exports;var s=e[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(o,s,function(e){return t[e]}.bind(null,s));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=39)}([function(t,e,i){var o=t.exports,s=i(17);o.LongBits=i(11),o.Long=i(32),o.pool=i(33),o.float=i(34),o.asPromise=i(35),o.EventEmitter=i(36),o.path=i(37),o.base64=i(18),o.utf8=i(8),o.compareFieldsById=function(t,e){return t.id-e.id},o.toArray=function(t){if(t){for(var e=Object.keys(t),i=new Array(e.length),o=0;o<e.length;)i[o]=t[e[o++]];return i}return[]},o.toObject=function(t){for(var e={},i=0;i<t.length;){var o=t[i++],s=t[i++];void 0!==s&&(e[o]=s)}return e},o.isString=function(t){return"string"==typeof t||t instanceof String};o.isReserved=function(t){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(t)},o.isObject=function(t){return t&&"object"==typeof t},o.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,o.oneOfGetter=function(t){for(var e={},i=0;i<t.length;++i)e[t[i]]=1;return function(){for(var t=Object.keys(this),i=t.length-1;i>-1;--i)if(1===e[t[i]]&&void 0!==this[t[i]]&&null!==this[t[i]])return t[i]}},o.oneOfSetter=function(t){return function(e){for(var i=0;i<t.length;++i)t[i]!==e&&delete this[t[i]]}},o.merge=function(t,e,i){for(var o=Object.keys(e),s=0;s<o.length;++s)void 0!==t[o[s]]&&i||(t[o[s]]=e[o[s]]);return t},o.decorateType=function(t,e){if(t.$type)return e&&t.$type.name!==e&&(o.decorateRoot.remove(t.$type),t.$type.name=e,o.decorateRoot.add(t.$type)),t.$type;Type||(Type=i(3));var s=new Type(e||t.name);return o.decorateRoot.add(s),s.ctor=t,Object.defineProperty(t,"$type",{value:s,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:s,enumerable:!1}),s},o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.longToHash=function(t){return t?o.LongBits.from(t).toHash():o.LongBits.zeroHash},o.copy=function(t){if("object"!=typeof t)return t;var e={};for(var i in t)e[i]=t[i];return e},o.deepCopy=function t(e){if("object"!=typeof e)return e;var i={};for(var o in e)i[o]=t(e[o]);return i},o.ProtocolError=function(t){function e(t,i){if(!(this instanceof e))return new e(t,i);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&merge(this,i)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e},o.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},o.Buffer=null,o.newBuffer=function(t){return"number"==typeof t?new o.Array(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},o.stringToBytes=function(t){var e,i,o=[];e=t.length;for(var s=0;s<e;s++)(i=t.charCodeAt(s))>=65536&&i<=1114111?(o.push(i>>18&7|240),o.push(i>>12&63|128),o.push(i>>6&63|128),o.push(63&i|128)):i>=2048&&i<=65535?(o.push(i>>12&15|224),o.push(i>>6&63|128),o.push(63&i|128)):i>=128&&i<=2047?(o.push(i>>6&31|192),o.push(63&i|128)):o.push(255&i);return o},o.byteToString=function(t){if("string"==typeof t)return t;for(var e="",i=t,o=0;o<i.length;o++){var s=i[o].toString(2),n=s.match(/^1+?(?=0)/);if(n&&8==s.length){for(var r=n[0].length,a=i[o].toString(2).slice(7-r),l=1;l<r;l++)a+=i[l+o].toString(2).slice(2);e+=String.fromCharCode(parseInt(a,2)),o+=r-1}else e+=String.fromCharCode(i[o])}return e},o.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(i(9)))}})},function(t,e,i){t.exports=n;var o=i(4);((n.prototype=Object.create(o.prototype)).constructor=n).className="Enum";var s=i(6);function n(t,e,i,s,n){if(o.call(this,t,i),e&&"object"!=typeof e)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=s,this.comments=n||{},this.reserved=void 0,e)for(var r=Object.keys(e),a=0;a<r.length;++a)"number"==typeof e[r[a]]&&(this.valuesById[this.values[r[a]]=e[r[a]]]=r[a])}n.fromJSON=function(t,e){var i=new n(t,e.values,e.options,e.comment,e.comments);return i.reserved=e.reserved,i},n.prototype.toJSON=function(t){var e=!!t&&Boolean(t.keepComments);return util.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",e?this.comment:void 0,"comments",e?this.comments:void 0])},n.prototype.add=function(t,e,i){if(!util.isString(t))throw TypeError("name must be a string");if(!util.isInteger(e))throw TypeError("id must be an integer");if(void 0!==this.values[t])throw Error("duplicate name '"+t+"' in "+this);if(this.isReservedId(e))throw Error("id "+e+" is reserved in "+this);if(this.isReservedName(t))throw Error("name '"+t+"' is reserved in "+this);if(void 0!==this.valuesById[e]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+e+" in "+this);this.values[t]=e}else this.valuesById[this.values[t]=e]=t;return this.comments[t]=i||null,this},n.prototype.remove=function(t){if(!util.isString(t))throw TypeError("name must be a string");var e=this.values[t];if(null==e)throw Error("name '"+t+"' does not exist in "+this);return delete this.valuesById[e],delete this.values[t],delete this.comments[t],this},n.prototype.isReservedId=function(t){return s.isReservedId(this.reserved,t)},n.prototype.isReservedName=function(t){return s.isReservedName(this.reserved,t)}},function(t,e,i){t.exports=h;var o,s,n,r,a=i(4);((h.prototype=Object.create(a.prototype)).constructor=h).className="Field";var l=/^required|optional|repeated$/;function h(t,e,i,o,r,h,c){if(n.isObject(o)?(c=r,h=o,o=r=void 0):n.isObject(r)&&(c=h,h=r,r=void 0),a.call(this,t,h),!n.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!n.isString(i))throw TypeError("type must be a string");if(void 0!==o&&!l.test(o=o.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==r&&!n.isString(r))throw TypeError("extend must be a string");this.rule=o&&"optional"!==o?o:void 0,this.type=i,this.id=e,this.extend=r||void 0,this.required="required"===o,this.optional=!this.required,this.repeated="repeated"===o,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!n.Long&&void 0!==s.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=c}h.fromJSON=function(t,e){return new h(t,e.id,e.type,e.rule,e.extend,e.options,e.comment)},Object.defineProperty(h.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),h.prototype.setOption=function(t,e,i){return"packed"===t&&(this._packed=null),a.prototype.setOption.call(this,t,e,i)},h.prototype.toJSON=function(t){var e=!!t&&Boolean(t.keepComments);return n.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])},h.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof r?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=n.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var t;n.utf8.write(this.typeDefault,t=n.newBuffer(n.utf8.length(this.typeDefault)),0),this.typeDefault=t}return this.map?this.defaultValue=n.emptyObject:this.repeated?this.defaultValue=n.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof r&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this)},h.d=function(t,e,i,o){return"function"==typeof e?e=n.decorateType(e).name:e&&"object"==typeof e&&(e=n.decorateEnum(e).name),function(s,r){n.decorateType(s.constructor).add(new h(r,t,e,i,{default:o}))}},h._configure=function(){r=i(3),o=i(1),s=i(5),n=i(0)}},function(t,e,i){t.exports=v;var o,s,n,r,a,l,h,c,d,f,u,p,y,m,g=i(6);function v(t,e){g.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function w(t){return t._fieldsById=t._fieldsArray=t._oneofsArray=null,delete t.encode,delete t.decode,delete t.verify,t}((v.prototype=Object.create(g.prototype)).constructor=v).className="Type",Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var i=this.fields[t[e]],o=i.id;if(this._fieldsById[o])throw Error("duplicate id "+o+" in "+this);this._fieldsById[o]=i}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=h.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=h.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this))},set:function(t){var e=t.prototype;e instanceof n||((t.prototype=new n).constructor=t,h.merge(t.prototype,e)),t.$type=t.prototype.$type=this,h.merge(t,n,!0),h.merge(t.prototype,n,!0),this._ctor=t;for(var i=0;i<this.fieldsArray.length;++i)this._fieldsArray[i].resolve();var o={};for(i=0;i<this.oneofsArray.length;++i){var s=this._oneofsArray[i].resolve().name,r=function(t){for(var e={},i=0;i<t.length;++i)e[t[i]]=0;return{setter:function(i){if(!(t.indexOf(i)<0)){e[i]=1;for(var o=0;o<t.length;++o)t[o]!==i&&delete this[t[o]]}},getter:function(){for(var t=Object.keys(this),i=t.length-1;i>-1;--i)if(1===e[t[i]]&&void 0!==this[t[i]]&&null!==this[t[i]])return t[i]}}}(this._oneofsArray[i].oneof);o[s]={get:r.getter,set:r.setter}}i&&Object.defineProperties(t.prototype,o)}}}),v.generateConstructor=function(t){return function(e){for(var i,o=0;o<t.fieldsArray.length;o++)(i=t._fieldsArray[o]).map?this[i.name]={}:i.repeated&&(this[i.name]=[]);if(e)for(var s=Object.keys(e),n=0;n<s.length;++n)null!=e[s[n]]&&(this[s[n]]=e[s[n]])}},v.fromJSON=function(t,e){var i=new v(t,e.options);i.extensions=e.extensions,i.reserved=e.reserved;for(var n=Object.keys(e.fields),a=0;a<n.length;++a)i.add((void 0!==e.fields[n[a]].keyType?m.fromJSON:s.fromJSON)(n[a],e.fields[n[a]]));if(e.oneofs)for(n=Object.keys(e.oneofs),a=0;a<n.length;++a)i.add(r.fromJSON(n[a],e.oneofs[n[a]]));if(e.nested)for(n=Object.keys(e.nested),a=0;a<n.length;++a){var l=e.nested[n[a]];i.add((void 0!==l.id?s.fromJSON:void 0!==l.fields?v.fromJSON:void 0!==l.values?o.fromJSON:void 0!==l.methods?u.fromJSON:g.fromJSON)(n[a],l))}return e.extensions&&e.extensions.length&&(i.extensions=e.extensions),e.reserved&&e.reserved.length&&(i.reserved=e.reserved),e.group&&(i.group=!0),e.comment&&(i.comment=e.comment),i},v.prototype.toJSON=function(t){var e=g.prototype.toJSON.call(this,t),i=!!t&&Boolean(t.keepComments);return{options:e&&e.options||void 0,oneofs:g.arrayToJSON(this.oneofsArray,t),fields:g.arrayToJSON(this.fieldsArray.filter((function(t){return!t.declaringField})),t)||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:e&&e.nested||void 0,comment:i?this.comment:void 0}},v.prototype.resolveAll=function(){for(var t=this.fieldsArray,e=0;e<t.length;)t[e++].resolve();var i=this.oneofsArray;for(e=0;e<i.length;)i[e++].resolve();return g.prototype.resolveAll.call(this)},v.prototype.get=function(t){return this.fields[t]||this.oneofs&&this.oneofs[t]||this.nested&&this.nested[t]||null},v.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof s&&void 0===t.extend){if(this._fieldsById&&this._fieldsById[t.id])throw Error("duplicate id "+t.id+" in "+this);if(this.isReservedId(t.id))throw Error("id "+t.id+" is reserved in "+this);if(this.isReservedName(t.name))throw Error("name '"+t.name+"' is reserved in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),w(this)}return t instanceof r?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),w(this)):g.prototype.add.call(this,t)},v.prototype.remove=function(t){if(t instanceof s&&void 0===t.extend){if(!this.fields||this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.parent=null,t.onRemove(this),w(this)}if(t instanceof r){if(!this.oneofs||this.oneofs[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.oneofs[t.name],t.parent=null,t.onRemove(this),w(this)}return g.prototype.remove.call(this,t)},v.prototype.isReservedId=function(t){return g.isReservedId(this.reserved,t)},v.prototype.isReservedName=function(t){return g.isReservedName(this.reserved,t)},v.prototype.create=function(t){return new this.ctor(t)},v.prototype.setup=function(){for(var t=this.fullName,e=[],i=0;i<this.fieldsArray.length;++i)e.push(this._fieldsArray[i].resolve().resolvedType);this.encode=d(this)({Writer:a,types:e,util:h}),this.decode=f(this)({Reader:l,types:e,util:h}),this.verify=c(this)({types:e,util:h}),this.fromObject=y.fromObject(this)({types:e,util:h}),this.toObject=y.toObject(this)({types:e,util:h});var o=p[t];if(o){var s=Object.create(this);s.fromObject=this.fromObject,this.fromObject=o.fromObject.bind(s),s.toObject=this.toObject,this.toObject=o.toObject.bind(s)}return this},v.prototype.encode=function(t,e){return this.setup().encode(t,e)},v.prototype.encodeDelimited=function(t,e){return this.encode(t,e&&e.len?e.fork():e).ldelim()},v.prototype.decode=function(t,e){return this.setup().decode(t,e)},v.prototype.decodeDelimited=function(t){return t instanceof l||(t=l.create(t)),this.decode(t,t.uint32())},v.prototype.verify=function(t){return this.setup().verify(t)},v.prototype.fromObject=function(t){return this.setup().fromObject(t)},v.prototype.toObject=function(t,e){return this.setup().toObject(t,e)},v.d=function(t){return function(e){h.decorateType(e,t)}},v._configure=function(){o=i(1),s=i(2),n=i(14),r=i(7),a=i(16),l=i(23),h=i(0),c=i(24),d=i(25),f=i(26),u=i(10),p=i(27),y=i(28),m=i(12)}},function(t,e,i){"use strict";var o,s;function n(t,e){if(!o.isString(t))throw TypeError("name must be a string");if(e&&!o.isObject(e))throw TypeError("options must be an object");this.options=e,this.name=t,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}t.exports=n,n.className="ReflectionObject",Object.defineProperties(n.prototype,{root:{get:function(){for(var t=this;null!==t.parent;)t=t.parent;return t}},fullName:{get:function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}}),n.prototype.toJSON=function(){throw Error()},n.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var e=t.root;e instanceof s&&e._handleAdd(this)},n.prototype.onRemove=function(t){var e=t.root;e instanceof s&&e._handleRemove(this),this.parent=null,this.resolved=!1},n.prototype.resolve=function(){return this.resolved||this.root instanceof s&&(this.resolved=!0),this},n.prototype.getOption=function(t){if(this.options)return this.options[t]},n.prototype.setOption=function(t,e,i){return i&&this.options&&void 0!==this.options[t]||((this.options||(this.options={}))[t]=e),this},n.prototype.setOptions=function(t,e){if(t)for(var i=Object.keys(t),o=0;o<i.length;++o)this.setOption(i[o],t[i[o]],e);return this},n.prototype.toString=function(){var t=this.constructor.className,e=this.fullName;return e.length?t+" "+e:t},n._configure=function(t){s=i(9),o=i(0)}},function(t,e,i){"use strict";var o=t.exports,s=i(0),n=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function r(t,e){var i=0,o={};for(e|=0;i<t.length;)o[n[i+e]]=t[i++];return o}o.basic=r([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=r([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),o.long=r([0,0,0,1,1],7),o.mapKey=r([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=r([1,5,0,0,0,5,5,0,0,0,1,1,0]),o._configure=function(){s=i(0)}},function(t,e,i){t.exports=c;var o,s,n,r,a,l=i(4);function h(t,e){if(t&&t.length){for(var i={},o=0;o<t.length;++o)i[t[o].name]=t[o].toJSON(e);return i}}function c(t,e){l.call(this,t,e),this.nested=void 0,this._nestedArray=null}function d(t){return t._nestedArray=null,t}((c.prototype=Object.create(l.prototype)).constructor=c).className="Namespace",c.fromJSON=function(t,e){return new c(t,e.options).addJSON(e.nested)},c.arrayToJSON=h,c.isReservedId=function(t,e){if(t)for(var i=0;i<t.length;++i)if("string"!=typeof t[i]&&t[i][0]<=e&&t[i][1]>=e)return!0;return!1},c.isReservedName=function(t,e){if(t)for(var i=0;i<t.length;++i)if(t[i]===e)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=n.toArray(this.nested))}}),c.prototype.toJSON=function(t){return n.toObject(["options",this.options,"nested",h(this.nestedArray,t)])},c.prototype.addJSON=function(t){if(t)for(var e,i=Object.keys(t),n=0;n<i.length;++n)e=t[i[n]],this.add((void 0!==e.fields?r.fromJSON:void 0!==e.values?o.fromJSON:void 0!==e.methods?a.fromJSON:void 0!==e.id?s.fromJSON:c.fromJSON)(i[n],e));return this},c.prototype.get=function(t){return this.nested&&this.nested[t]||null},c.prototype.getEnum=function(t){if(this.nested&&this.nested[t]instanceof o)return this.nested[t].values;throw Error("no such enum: "+t)},c.prototype.add=function(t){if(!(t instanceof s&&void 0!==t.extend||t instanceof r||t instanceof o||t instanceof a||t instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var e=this.get(t.name);if(e){if(!(e instanceof c&&t instanceof c)||e instanceof r||e instanceof a)throw Error("duplicate name '"+t.name+"' in "+this);for(var i=e.nestedArray,n=0;n<i.length;++n)t.add(i[n]);this.remove(e),this.nested||(this.nested={}),t.setOptions(e.options,!0)}}else this.nested={};return this.nested[t.name]=t,t.onAdd(this),d(this)},c.prototype.remove=function(t){if(!(t instanceof l))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),d(this)},c.prototype.define=function(t,e){if(n.isString(t))t=t.split(".");else if(!Array.isArray(t))throw TypeError("illegal path");if(t&&t.length&&""===t[0])throw Error("path must be relative");for(var i=this;t.length>0;){var o=t.shift();if(i.nested&&i.nested[o]){if(!((i=i.nested[o])instanceof c))throw Error("path conflicts with non-namespace objects")}else i.add(i=new c(o))}return e&&i.addJSON(e),i},c.prototype.resolveAll=function(){for(var t=this.nestedArray,e=0;e<t.length;)t[e]instanceof c?t[e++].resolveAll():t[e++].resolve();return this.resolve()},c.prototype.lookup=function(t,e,i){if("boolean"==typeof e?(i=e,e=void 0):e&&!Array.isArray(e)&&(e=[e]),n.isString(t)&&t.length){if("."===t)return this.root;t=t.split(".")}else if(!t.length)return this;if(""===t[0])return this.root.lookup(t.slice(1),e);var o=this.get(t[0]);if(o){if(1===t.length){if(!e||e.indexOf(o.constructor)>-1)return o}else if(o instanceof c&&(o=o.lookup(t.slice(1),e,!0)))return o}else for(var s=0;s<this.nestedArray.length;++s)if(this._nestedArray[s]instanceof c&&(o=this._nestedArray[s].lookup(t,e,!0)))return o;return null===this.parent||i?null:this.parent.lookup(t,e)},c.prototype.lookupType=function(t){var e=this.lookup(t,[r]);if(!e)throw Error("no such type: "+t);return e},c.prototype.lookupEnum=function(t){var e=this.lookup(t,[o]);if(!e)throw Error("no such Enum '"+t+"' in "+this);return e},c.prototype.lookupTypeOrEnum=function(t){var e=this.lookup(t,[r,o]);if(!e)throw Error("no such Type or Enum '"+t+"' in "+this);return e},c.prototype.lookupService=function(t){var e=this.lookup(t,[a]);if(!e)throw Error("no such Service '"+t+"' in "+this);return e},c._configure=function(){o=i(1),s=i(2),n=i(0),r=i(3),a=i(10)}},function(t,e,i){t.exports=r;var o,s,n=i(4);function r(t,e,i,o){if(Array.isArray(e)||(i=e,e=void 0),n.call(this,t,i),void 0!==e&&!Array.isArray(e))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=o}function a(t){if(t.parent)for(var e=0;e<t.fieldsArray.length;++e)t.fieldsArray[e].parent||t.parent.add(t.fieldsArray[e])}((r.prototype=Object.create(n.prototype)).constructor=r).className="OneOf",r.fromJSON=function(t,e){return new r(t,e.oneof,e.options,e.comment)},r.prototype.toJSON=function(t){var e=!!t&&Boolean(t.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",e?this.comment:void 0])},r.prototype.add=function(t){if(!(t instanceof o))throw TypeError("field must be a Field");return t.parent&&t.parent!==this.parent&&t.parent.remove(t),this.oneof.push(t.name),this.fieldsArray.push(t),t.partOf=this,a(this),this},r.prototype.remove=function(t){if(!(t instanceof o))throw TypeError("field must be a Field");var e=this.fieldsArray.indexOf(t);if(e<0)throw Error(t+" is not a member of "+this);return this.fieldsArray.splice(e,1),(e=this.oneof.indexOf(t.name))>-1&&this.oneof.splice(e,1),t.partOf=null,this},r.prototype.onAdd=function(t){n.prototype.onAdd.call(this,t);for(var e=0;e<this.oneof.length;++e){var i=t.get(this.oneof[e]);i&&!i.partOf&&(i.partOf=this,this.fieldsArray.push(i))}a(this)},r.prototype.onRemove=function(t){for(var e,i=0;i<this.fieldsArray.length;++i)(e=this.fieldsArray[i]).parent&&e.parent.remove(e);n.prototype.onRemove.call(this,t)},r.d=function(){for(var t=new Array(arguments.length),e=0;e<arguments.length;)t[e]=arguments[e++];return function(e,i){s.decorateType(e.constructor).add(new r(i,t)),Object.defineProperty(e,i,{get:s.oneOfGetter(t),set:s.oneOfSetter(t)})}},r._configure=function(){o=i(2),s=i(0)}},function(t,e,i){"use strict";var o=t.exports;o.length=function(t){for(var e=0,i=0,o=0;o<t.length;++o)(i=t.charCodeAt(o))<128?e+=1:i<2048?e+=2:55296==(64512&i)&&56320==(64512&t.charCodeAt(o+1))?(++o,e+=4):e+=3;return e},o.read=function(t,e,i){if(i-e<1)return"";for(var o,s=null,n=[],r=0;e<i;)(o=t[e++])<128?n[r++]=o:o>191&&o<224?n[r++]=(31&o)<<6|63&t[e++]:o>239&&o<365?(o=((7&o)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,n[r++]=55296+(o>>10),n[r++]=56320+(1023&o)):n[r++]=(15&o)<<12|(63&t[e++])<<6|63&t[e++],r>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,n)),r=0);return s?(r&&s.push(String.fromCharCode.apply(String,n.slice(0,r))),s.join("")):String.fromCharCode.apply(String,n.slice(0,r))},o.write=function(t,e,i){for(var o,s,n=i,r=0;r<t.length;++r)(o=t.charCodeAt(r))<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=63&o|128):55296==(64512&o)&&56320==(64512&(s=t.charCodeAt(r+1)))?(o=65536+((1023&o)<<10)+(1023&s),++r,e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=63&o|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=63&o|128);return i-n}},function(t,e,i){t.exports=d;var o=i(6);((d.prototype=Object.create(o.prototype)).constructor=d).className="Root";var s,n,r,a=i(2),l=i(1),h=i(7),c=i(0);function d(t){o.call(this,"",t),this.deferred=[],this.files=[],this.names=[]}function f(){}d.fromJSON=function(t,e){return t="string"==typeof t?JSON.parse(t):t,e||(e=new d),t.options&&e.setOptions(t.options),e.addJSON(t.nested)},d.prototype.resolvePath=c.path.resolve,d.prototype.parseFromPbString=function t(e,i,o){"function"==typeof i&&(o=i,i=void 0);var s=this;if(!o)return c.asPromise(t,s,e,i);var a=null;if("string"==typeof e)a=JSON.parse(e);else{if("object"!=typeof e)return void console.log("pb格式转化失败");a=e}function l(t,e){if(o){var i=o;o=null,i(t,e)}}function h(t,e){try{if(c.isString(e)&&"{"===e.charAt(0)&&(e=JSON.parse(e)),c.isString(e)){n.filename=t;var o,r=n(e,s,i),a=0;if(r.imports)for(;a<r.imports.length;++a)d(o=r.imports[a]);if(r.weakImports){for(a=0;a<r.weakImports.length;++a)o=r.weakImports[a];d(o)}}else s.setOptions(e.options).addJSON(e.nested)}catch(t){l(t)}l(null,s)}function d(t){s.names.indexOf(t)>-1||(s.names.push(t),t in r&&h(t,r[t]))}h(a.name,a.pbJsonStr)},d.prototype.load=function t(e,i,o){"function"==typeof i&&(o=i,i=void 0);var s=this;if(!o)return c.asPromise(t,s,e,i);var a=o===f;function l(t,e){if(o){var i=o;if(o=null,a)throw t;i(t,e)}}function h(t,e){try{if(c.isString(e)&&"{"===e.charAt(0)&&(e=JSON.parse(e)),c.isString(e)){n.filename=t;var o,r=n(e,s,i),h=0;if(r.imports)for(;h<r.imports.length;++h)(o=s.resolvePath(t,r.imports[h]))&&d(o);if(r.weakImports)for(h=0;h<r.weakImports.length;++h)(o=s.resolvePath(t,r.weakImports[h]))&&d(o,!0)}else s.setOptions(e.options).addJSON(e.nested)}catch(t){l(t)}a||u||l(null,s)}function d(t,e){var i=t.lastIndexOf("google/protobuf/");if(i>-1){var n=t.substring(i);n in r&&(t=n)}if(!(s.files.indexOf(t)>-1))if(s.files.push(t),t in r)a?h(t,r[t]):(++u,setTimeout((function(){--u,h(t,r[t])})));else if(a){var d;try{d=c.fs.readFileSync(t).toString("utf8")}catch(t){return void(e||l(t))}h(t,d)}else++u,c.fetch(t,(function(i,n){--u,o&&(i?e?u||l(null,s):l(i):h(t,n))}))}var u=0;c.isString(e)&&(e=[e]);for(var p,y=0;y<e.length;++y)(p=s.resolvePath("",e[y]))&&d(p);if(a)return s;u||l(null,s)},d.prototype.loadSync=function(t,e){if(!c.isNode)throw Error("not supported");return this.load(t,e,f)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(t){return"'extend "+t.extend+"' in "+t.parent.fullName})).join(", "));return o.prototype.resolveAll.call(this)};var u=/^[A-Z]/;function p(t,e){var i=e.parent.lookup(e.extend);if(i){var o=new a(e.fullName,e.id,e.type,e.rule,void 0,e.options);return o.declaringField=e,e.extensionField=o,i.add(o),!0}return!1}d.prototype._handleAdd=function(t){if(t instanceof a)void 0===t.extend||t.extensionField||p(0,t)||this.deferred.push(t);else if(t instanceof l)u.test(t.name)&&(t.parent[t.name]=t.values);else if(!(t instanceof h)){if(t instanceof s)for(var e=0;e<this.deferred.length;)p(0,this.deferred[e])?this.deferred.splice(e,1):++e;for(var i=0;i<t.nestedArray.length;++i)this._handleAdd(t._nestedArray[i]);u.test(t.name)&&(t.parent[t.name]=t)}},d.prototype._handleRemove=function(t){if(t instanceof a){if(void 0!==t.extend)if(t.extensionField)t.extensionField.parent.remove(t.extensionField),t.extensionField=null;else{var e=this.deferred.indexOf(t);e>-1&&this.deferred.splice(e,1)}}else if(t instanceof l)u.test(t.name)&&delete t.parent[t.name];else if(t instanceof o){for(var i=0;i<t.nestedArray.length;++i)this._handleRemove(t._nestedArray[i]);u.test(t.name)&&delete t.parent[t.name]}},d._configure=function(){s=i(3),n=i(19),r=i(22),a=i(2),l=i(1),h=i(7),c=i(0)}},function(t,e,i){"use strict";t.exports=a;var o,s,n,r=i(6);function a(t,e){r.call(this,t,e),this.methods={},this._methodsArray=null}function l(t){return t._methodsArray=null,t}((a.prototype=Object.create(r.prototype)).constructor=a).className="Service",a.fromJSON=function(t,e){var i=new a(t,e.options);if(e.methods)for(var s=Object.keys(e.methods),n=0;n<s.length;++n)i.add(o.fromJSON(s[n],e.methods[s[n]]));return e.nested&&i.addJSON(e.nested),i.comment=e.comment,i},a.prototype.toJSON=function(t){var e=r.prototype.toJSON.call(this,t),i=!!t&&Boolean(t.keepComments);return s.toObject(["options",e&&e.options||void 0,"methods",r.arrayToJSON(this.methodsArray,t)||{},"nested",e&&e.nested||void 0,"comment",i?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(t){return this.methods[t]||r.prototype.get.call(this,t)},a.prototype.resolveAll=function(){for(var t=this.methodsArray,e=0;e<t.length;++e)t[e].resolve();return r.prototype.resolve.call(this)},a.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);return t instanceof o?(this.methods[t.name]=t,t.parent=this,l(this)):r.prototype.add.call(this,t)},a.prototype.remove=function(t){if(t instanceof o){if(this.methods[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.methods[t.name],t.parent=null,l(this)}return r.prototype.remove.call(this,t)},a.prototype.create=function(t,e,i){for(var o,r=new n.Service(t,e,i),a=0;a<this.methodsArray.length;++a){var l=s.lcFirst((o=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");r[l]=s.codegen(["r","c"],s.isReserved(l)?l+"_":l)("return this.rpcCall(m,q,s,r,c)")({m:o,q:o.resolvedRequestType.ctor,s:o.resolvedResponseType.ctor})}return r},a._configure=function(){o=i(13),s=i(0),n=i(21)}},function(t,e){function i(t,e){this.lo=t>>>0,this.hi=e>>>0}t.exports=i;var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var e=t<0;e&&(t=-t);var s=t>>>0,n=(t-s)/4294967296>>>0;return e&&(n=~n>>>0,s=~s>>>0,++s>4294967295&&(s=0,++n>4294967295&&(n=0))),new i(s,n)},i.from=function(t){return"number"==typeof t?i.fromNumber(t):"string"==typeof t||t instanceof String?i.fromNumber(parseInt(t,10)):t.low||t.high?new i(t.low>>>0,t.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,i=~this.hi>>>0;return e||(i=i+1>>>0),-(e+4294967296*i)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(t){return{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var n=String.prototype.charCodeAt;i.fromHash=function(t){return t===s?o:new i((n.call(t,0)|n.call(t,1)<<8|n.call(t,2)<<16|n.call(t,3)<<24)>>>0,(n.call(t,4)|n.call(t,5)<<8|n.call(t,6)<<16|n.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}},function(t,e,i){t.exports=r;var o,s,n=i(2);function r(t,e,i,o,r,a){if(n.call(this,t,e,o,void 0,void 0,r,a),!s.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}((r.prototype=Object.create(n.prototype)).constructor=r).className="MapField",r.fromJSON=function(t,e){return new r(t,e.id,e.keyType,e.type,e.options,e.comment)},r.prototype.toJSON=function(t){var e=!!t&&Boolean(t.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])},r.prototype.resolve=function(){if(this.resolved)return this;if(void 0===o.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},r.d=function(t,e,i){return"function"==typeof i?i=s.decorateType(i).name:i&&"object"==typeof i&&(i=s.decorateEnum(i).name),function(o,n){s.decorateType(o.constructor).add(new r(n,t,e,i))}},r._configure=function(){o=i(5),s=i(0)}},function(t,e,i){"use strict";t.exports=n;var o,s=i(4);function n(t,e,i,n,r,a,l,h){if(o.isObject(r)?(l=r,r=a=void 0):o.isObject(a)&&(l=a,a=void 0),void 0!==e&&!o.isString(e))throw TypeError("type must be a string");if(!o.isString(i))throw TypeError("requestType must be a string");if(!o.isString(n))throw TypeError("responseType must be a string");s.call(this,t,l),this.type=e||"rpc",this.requestType=i,this.requestStream=!!r||void 0,this.responseType=n,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=h}((n.prototype=Object.create(s.prototype)).constructor=n).className="Method",n.fromJSON=function(t,e){return new n(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options,e.comment)},n.prototype.toJSON=function(t){var e=!!t&&Boolean(t.keepComments);return o.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",e?this.comment:void 0])},n.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),s.prototype.resolve.call(this))},n._configure=function(){o=i(0)}},function(t,e,i){"use strict";var o;function s(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)this[e[i]]=t[e[i]]}t.exports=s,s.create=function(t){return this.$type.create(t)},s.encode=function(t,e){return arguments.length?1==arguments.length?this.$type.encode(arguments[0]):this.$type.encode(arguments[0],arguments[1]):this.$type.encode(this)},s.encodeDelimited=function(t,e){return this.$type.encodeDelimited(t,e)},s.decode=function(t){return this.$type.decode(t)},s.decodeDelimited=function(t){return this.$type.decodeDelimited(t)},s.verify=function(t){return this.$type.verify(t)},s.fromObject=function(t){return this.$type.fromObject(t)},s.toObject=function(t,e){return t=t||this,this.$type.toObject(t,e)},s.prototype.toJSON=function(){return this.$type.toObject(this,o.toJSONOptions)},s.set=function(t,e){s[t]=e},s.get=function(t){return s[t]},s._configure=function(){o=i(0)}},function(t,e,i){var o;!function(s){"use strict";function n(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function r(t,e,i,o,s,r){return n((a=n(n(e,t),n(o,r)))<<(l=s)|a>>>32-l,i);var a,l}function a(t,e,i,o,s,n,a){return r(e&i|~e&o,t,e,s,n,a)}function l(t,e,i,o,s,n,a){return r(e&o|i&~o,t,e,s,n,a)}function h(t,e,i,o,s,n,a){return r(e^i^o,t,e,s,n,a)}function c(t,e,i,o,s,n,a){return r(i^(e|~o),t,e,s,n,a)}function d(t,e){var i,o,s,r,d;t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var f=1732584193,u=-271733879,p=-1732584194,y=271733878;for(i=0;i<t.length;i+=16)o=f,s=u,r=p,d=y,f=a(f,u,p,y,t[i],7,-680876936),y=a(y,f,u,p,t[i+1],12,-389564586),p=a(p,y,f,u,t[i+2],17,606105819),u=a(u,p,y,f,t[i+3],22,-1044525330),f=a(f,u,p,y,t[i+4],7,-176418897),y=a(y,f,u,p,t[i+5],12,1200080426),p=a(p,y,f,u,t[i+6],17,-1473231341),u=a(u,p,y,f,t[i+7],22,-45705983),f=a(f,u,p,y,t[i+8],7,1770035416),y=a(y,f,u,p,t[i+9],12,-1958414417),p=a(p,y,f,u,t[i+10],17,-42063),u=a(u,p,y,f,t[i+11],22,-1990404162),f=a(f,u,p,y,t[i+12],7,1804603682),y=a(y,f,u,p,t[i+13],12,-40341101),p=a(p,y,f,u,t[i+14],17,-1502002290),f=l(f,u=a(u,p,y,f,t[i+15],22,1236535329),p,y,t[i+1],5,-165796510),y=l(y,f,u,p,t[i+6],9,-1069501632),p=l(p,y,f,u,t[i+11],14,643717713),u=l(u,p,y,f,t[i],20,-373897302),f=l(f,u,p,y,t[i+5],5,-701558691),y=l(y,f,u,p,t[i+10],9,38016083),p=l(p,y,f,u,t[i+15],14,-660478335),u=l(u,p,y,f,t[i+4],20,-405537848),f=l(f,u,p,y,t[i+9],5,568446438),y=l(y,f,u,p,t[i+14],9,-1019803690),p=l(p,y,f,u,t[i+3],14,-187363961),u=l(u,p,y,f,t[i+8],20,1163531501),f=l(f,u,p,y,t[i+13],5,-1444681467),y=l(y,f,u,p,t[i+2],9,-51403784),p=l(p,y,f,u,t[i+7],14,1735328473),f=h(f,u=l(u,p,y,f,t[i+12],20,-1926607734),p,y,t[i+5],4,-378558),y=h(y,f,u,p,t[i+8],11,-2022574463),p=h(p,y,f,u,t[i+11],16,1839030562),u=h(u,p,y,f,t[i+14],23,-35309556),f=h(f,u,p,y,t[i+1],4,-1530992060),y=h(y,f,u,p,t[i+4],11,1272893353),p=h(p,y,f,u,t[i+7],16,-155497632),u=h(u,p,y,f,t[i+10],23,-1094730640),f=h(f,u,p,y,t[i+13],4,681279174),y=h(y,f,u,p,t[i],11,-358537222),p=h(p,y,f,u,t[i+3],16,-722521979),u=h(u,p,y,f,t[i+6],23,76029189),f=h(f,u,p,y,t[i+9],4,-640364487),y=h(y,f,u,p,t[i+12],11,-421815835),p=h(p,y,f,u,t[i+15],16,530742520),f=c(f,u=h(u,p,y,f,t[i+2],23,-995338651),p,y,t[i],6,-198630844),y=c(y,f,u,p,t[i+7],10,1126891415),p=c(p,y,f,u,t[i+14],15,-1416354905),u=c(u,p,y,f,t[i+5],21,-57434055),f=c(f,u,p,y,t[i+12],6,1700485571),y=c(y,f,u,p,t[i+3],10,-1894986606),p=c(p,y,f,u,t[i+10],15,-1051523),u=c(u,p,y,f,t[i+1],21,-2054922799),f=c(f,u,p,y,t[i+8],6,1873313359),y=c(y,f,u,p,t[i+15],10,-30611744),p=c(p,y,f,u,t[i+6],15,-1560198380),u=c(u,p,y,f,t[i+13],21,1309151649),f=c(f,u,p,y,t[i+4],6,-145523070),y=c(y,f,u,p,t[i+11],10,-1120210379),p=c(p,y,f,u,t[i+2],15,718787259),u=c(u,p,y,f,t[i+9],21,-343485551),f=n(f,o),u=n(u,s),p=n(p,r),y=n(y,d);return[f,u,p,y]}function f(t){var e,i="",o=32*t.length;for(e=0;e<o;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function u(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var o=8*t.length;for(e=0;e<o;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function p(t){var e,i,o="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),o+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e);return o}function y(t){return unescape(encodeURIComponent(t))}function m(t){return function(t){return f(d(u(t),8*t.length))}(y(t))}function g(t,e){return function(t,e){var i,o,s=u(t),n=[],r=[];for(n[15]=r[15]=void 0,s.length>16&&(s=d(s,8*t.length)),i=0;i<16;i+=1)n[i]=909522486^s[i],r[i]=1549556828^s[i];return o=d(n.concat(u(e)),512+8*e.length),f(d(r.concat(o),640))}(y(t),y(e))}function v(t,e,i){return e?i?g(e,t):p(g(e,t)):i?m(t):p(m(t))}void 0===(o=function(){return v}.call(e,i,e,t))||(t.exports=o)}()},function(t,e,i){t.exports=h;var o,s=i(0),n=i(8);function r(t,e,i){this.fn=t,this.len=e,this.next=void 0,this.val=i}function a(){}function l(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function h(){this.len=0,this.head=new r(a,0,0),this.tail=this.head,this.states=null}function c(t,e,i){e[i]=255&t}function d(t,e){this.len=t,this.next=void 0,this.val=e}function f(t,e,i){for(;t.hi;)e[i++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[i++]=127&t.lo|128,t.lo=t.lo>>>7;e[i++]=t.lo}function u(t,e,i){e[i]=255&t,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}h.create=s.Buffer?function(){return(h.create=function(){return new(void 0)})()}:function(){return new h},h.alloc=function(t){return new s.Array(t)},s.Array!==Array&&(h.alloc=s.pool(h.alloc,s.Array.prototype.subarray)),h.prototype._push=function(t,e,i){return this.tail=this.tail.next=new r(t,e,i),this.len+=e,this},d.prototype=Object.create(r.prototype),d.prototype.fn=function(t,e,i){for(;t>127;)e[i++]=127&t|128,t>>>=7;e[i]=t},h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new d((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},h.prototype.int32=function(t){return t<0?this._push(f,10,o.fromNumber(t)):this.uint32(t)},h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},h.prototype.uint64=function(t){var e=o.from(t);return this._push(f,e.length(),e)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(t){var e=o.from(t).zzEncode();return this._push(f,e.length(),e)},h.prototype.bool=function(t){return this._push(c,1,t?1:0)},h.prototype.fixed32=function(t){return this._push(u,4,t>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(t){var e=o.from(t);return this._push(u,4,e.lo)._push(u,4,e.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(t){return this._push(s.float.writeFloatLE,4,t)},h.prototype.double=function(t){return this._push(s.float.writeDoubleLE,8,t)};var p=s.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var o=0;o<t.length;++o)e[i+o]=t[o]};h.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(c,1,0);if(s.isString(t)){var i=h.alloc(e=n.length(t));n.write(t,i,0),t=i}return this.uint32(e)._push(p,e,t)},h.prototype.string=function(t){var e=n.length(t);return e?this.uint32(e)._push(n.write,e,t):this._push(c,1,0)},h.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new r(a,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new r(a,0,0),this.len=0),this},h.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this},h.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e},h._configure=function(){o=i(11),i(18),n=i(8)}},function(t,e){t.exports={}},function(t,e,i){"use strict";var o=t.exports;o.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&"="===t.charAt(e);)++i;return Math.ceil(3*t.length)/4-i};for(var s=new Array(64),n=new Array(123),r=0;r<64;)n[s[r]=r<26?r+65:r<52?r+71:r<62?r-4:r-59|43]=r++;o.encode=function(t,e,i){for(var o,n=null,r=[],a=0,l=0;e<i;){var h=t[e++];switch(l){case 0:r[a++]=s[h>>2],o=(3&h)<<4,l=1;break;case 1:r[a++]=s[o|h>>4],o=(15&h)<<2,l=2;break;case 2:r[a++]=s[o|h>>6],r[a++]=s[63&h],l=0}a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,r)),a=0)}return l&&(r[a++]=s[o],r[a++]=61,1===l&&(r[a++]=61)),n?(a&&n.push(String.fromCharCode.apply(String,r.slice(0,a))),n.join("")):String.fromCharCode.apply(String,r.slice(0,a))};o.decode=function(t,e,i){for(var o,s=i,r=0,a=0;a<t.length;){var l=t.charCodeAt(a++);if(61===l&&r>1)break;if(void 0===(l=n[l]))throw Error("invalid encoding");switch(r){case 0:o=l,r=1;break;case 1:e[i++]=o<<2|(48&l)>>4,o=l,r=2;break;case 2:e[i++]=(15&o)<<4|(60&l)>>2,o=l,r=3;break;case 3:e[i++]=(3&o)<<6|l,r=0}}if(1===r)throw Error("invalid encoding");return i-s},o.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},function(t,e,i){"use strict";var o,s,n,r,a,l,h,c,d,f,u;t.exports=T,T.filename=null,T.defaults={keepCase:!1};var p=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,m=/^0[x][0-9a-fA-F]+$/,g=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,w=/^-?0[0-7]+$/,b=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,_=/^[a-zA-Z_][a-zA-Z_0-9]*$/,x=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,P=/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/;function T(t,e,i){e instanceof s||(i=e,e=new s),i||(i=T.defaults);var A,M,C,S,E,O=o(t,i.alternateCommentMode||!1),I=O.next,k=O.push,R=O.peek,D=O.skip,L=O.cmnt,N=!0,V=!1,F=e,B=i.keepCase?function(t){return t}:u.camelCase;function j(t,e,i){var o=T.filename;return i||(T.filename=null),Error("illegal "+(e||"token")+" '"+t+"' ("+(o?o+", ":"")+"line "+O.line+")")}function W(){var t,e=[];do{if('"'!==(t=I())&&"'"!==t)throw j(t);e.push(I()),D(t),t=R()}while('"'===t||"'"===t);return e.join("")}function z(t){var e=I();switch(e){case"'":case'"':return k(e),W();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(t,e){var i=1;"-"===t.charAt(0)&&(i=-1,t=t.substring(1));switch(t){case"inf":case"INF":case"Inf":return i*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(t))return i*parseInt(t,10);if(m.test(t))return i*parseInt(t,16);if(v.test(t))return i*parseInt(t,8);if(b.test(t))return i*parseFloat(t);throw j(t,"number",e)}(e,!0)}catch(i){if(t&&x.test(e))return e;throw j(e,"value")}}function U(t,e){var i,o;do{!e||'"'!==(i=R())&&"'"!==i?t.push([o=H(I()),D("to",!0)?H(I()):o]):t.push(W())}while(D(",",!0));D(";")}function H(t,e){switch(t){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!e&&"-"===t.charAt(0))throw j(t,"id");if(y.test(t))return parseInt(t,10);if(g.test(t))return parseInt(t,16);if(w.test(t))return parseInt(t,8);throw j(t,"id")}function q(){if(void 0!==A)throw j("package");if(A=I(),!x.test(A))throw j(A,"name");F=F.define(A),D(";")}function J(){var t,e=R();switch(e){case"weak":t=C||(C=[]),I();break;case"public":I();default:t=M||(M=[])}e=W(),D(";"),t.push(e)}function X(){if(D("="),S=W(),!(V="proto3"===S)&&"proto2"!==S)throw j(S,"syntax");D(";")}function $(t,e){switch(e){case"option":return Y(t,e),D(";"),!0;case"message":return function(t,e){if(!_.test(e=I()))throw j(e,"type name");var i=new n(e);Z(i,(function(t){if(!$(i,t))switch(t){case"map":!function(t){D("<");var e=I();if(void 0===f.mapKey[e])throw j(e,"type");D(",");var i=I();if(!x.test(i))throw j(i,"type");D(">");var o=I();if(!_.test(o))throw j(o,"name");D("=");var s=new a(B(o),H(I()),e,i);Z(s,(function(t){if("option"!==t)throw j(t);Y(s,t),D(";")}),(function(){tt(s)})),t.add(s)}(i);break;case"required":case"optional":case"repeated":G(i,t);break;case"oneof":!function(t,e){if(!_.test(e=I()))throw j(e,"name");var i=new l(B(e));Z(i,(function(t){"option"===t?(Y(i,t),D(";")):(k(t),G(i,"optional"))})),t.add(i)}(i,t);break;case"extensions":U(i.extensions||(i.extensions=[]));break;case"reserved":U(i.reserved||(i.reserved=[]),!0);break;default:if(!V||!x.test(t))throw j(t);k(t),G(i,"optional")}})),t.add(i)}(t,e),!0;case"enum":return function(t,e){if(!_.test(e=I()))throw j(e,"name");var i=new h(e);Z(i,(function(t){switch(t){case"option":Y(i,t),D(";");break;case"reserved":U(i.reserved||(i.reserved=[]),!0);break;default:!function(t,e){if(!_.test(e))throw j(e,"name");D("=");var i=H(I(),!0),o={};Z(o,(function(t){if("option"!==t)throw j(t);Y(o,t),D(";")}),(function(){tt(o)})),t.add(e,i,o.comment)}(i,t)}})),t.add(i)}(t,e),!0;case"service":return function(t,e){if(!_.test(e=I()))throw j(e,"service name");var i=new c(e);Z(i,(function(t){if(!$(i,t)){if("rpc"!==t)throw j(t);!function(t,e){var i=e;if(!_.test(e=I()))throw j(e,"name");var o,s,n,r,a=e;D("("),D("stream",!0)&&(s=!0);if(!x.test(e=I()))throw j(e);o=e,D(")"),D("returns"),D("("),D("stream",!0)&&(r=!0);if(!x.test(e=I()))throw j(e);n=e,D(")");var l=new d(a,i,o,n,s,r);Z(l,(function(t){if("option"!==t)throw j(t);Y(l,t),D(";")})),t.add(l)}(i,t)}})),t.add(i)}(t,e),!0;case"extend":return function(t,e){if(!x.test(e=I()))throw j(e,"reference");var i=e;Z(null,(function(e){switch(e){case"required":case"repeated":case"optional":G(t,e,i);break;default:if(!V||!x.test(e))throw j(e);k(e),G(t,"optional",i)}}))}(t,e),!0}return!1}function Z(t,e,i){var o=O.line;if(t&&(t.comment=L(),t.filename=T.filename),D("{",!0)){for(var s;"}"!==(s=I());)e(s);D(";",!0)}else i&&i(),D(";"),t&&"string"!=typeof t.comment&&(t.comment=L(o))}function G(t,e,i){var o=I();if("group"!==o){if(!x.test(o))throw j(o,"type");var s=I();if(!_.test(s))throw j(s,"name");s=B(s),D("=");var a=new r(s,H(I()),o,e,i);Z(a,(function(t){if("option"!==t)throw j(t);Y(a,t),D(";")}),(function(){tt(a)})),t.add(a),V||!a.repeated||void 0===f.packed[o]&&void 0!==f.basic[o]||a.setOption("packed",!1,!0)}else!function(t,e){var i=I();if(!_.test(i))throw j(i,"name");var o=u.lcFirst(i);i===o&&(i=u.ucFirst(i));D("=");var s=H(I()),a=new n(i);a.group=!0;var l=new r(o,s,i,e);l.filename=T.filename,Z(a,(function(t){switch(t){case"option":Y(a,t),D(";");break;case"required":case"optional":case"repeated":G(a,t);break;default:throw j(t)}})),t.add(a).add(l)}(t,e)}function Y(t,e){var i=D("(",!0);if(!x.test(e=I()))throw j(e,"name");var o=e;i&&(D(")"),o="("+o+")",e=R(),P.test(e)&&(o+=e,I())),D("="),K(t,o)}function K(t,e){if(D("{",!0))do{if(!_.test(E=I()))throw j(E,"name");"{"===R()?K(t,e+"."+E):(D(":"),"{"===R()?K(t,e+"."+E):Q(t,e+"."+E,z(!0)))}while(!D("}",!0));else Q(t,e,z(!0))}function Q(t,e,i){t.setOption&&t.setOption(e,i)}function tt(t){if(D("[",!0)){do{Y(t,"option")}while(D(",",!0));D("]")}return t}for(;null!==(E=I());)switch(E){case"package":if(!N)throw j(E);q();break;case"import":if(!N)throw j(E);J();break;case"syntax":if(!N)throw j(E);X();break;case"option":if(!N)throw j(E);Y(F,E),D(";");break;default:if($(F,E)){N=!1;continue}throw j(E)}return T.filename=null,{package:A,imports:M,weakImports:C,syntax:S,root:e}}T._configure=function(){o=i(20),s=i(9),n=i(3),r=i(2),a=i(12),l=i(7),h=i(1),c=i(10),d=i(13),f=i(5),u=i(0)}},function(t,e){t.exports=f;var i=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,s=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,n=/^ *[*/]+ */,r=/^\s*\*?\/*/,a=/\n/g,l=/\s/,h=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function d(t){return t.replace(h,(function(t,e){switch(e){case"\\":case"":return e;default:return c[e]||""}}))}function f(t,e){t=t.toString();var h=0,c=t.length,f=1,u=null,p=null,y=0,m=!1,g=[],v=null;function w(t){return Error("illegal "+t+" (line "+f+")")}function b(e){return t.charAt(e)}function _(i,o){u=t.charAt(i++),y=f,m=!1;var s,l=i-(e?2:3);do{if(--l<0||"\n"===(s=t.charAt(l))){m=!0;break}}while(" "===s||"\t"===s);for(var h=t.substring(i,o).split(a),c=0;c<h.length;++c)h[c]=h[c].replace(e?r:n,"").trim();p=h.join("\n").trim()}function x(e){var i=P(e),o=t.substring(e,i);return/^\s*\/{1,2}/.test(o)}function P(t){for(var e=t;e<c&&"\n"!==b(e);)e++;return e}function T(){if(g.length>0)return g.shift();if(v)return function(){var e="'"===v?s:o;e.lastIndex=h-1;var i=e.exec(t);if(!i)throw w("string");return h=e.lastIndex,A(v),v=null,d(i[1])}();var n,r,a,u,p;do{if(h===c)return null;for(n=!1;l.test(a=b(h));)if("\n"===a&&++f,++h===c)return null;if("/"===b(h)){if(++h===c)throw w("comment");if("/"===b(h))if(e){if(u=h,p=!1,x(h)){p=!0;do{if((h=P(h))===c)break;h++}while(x(h))}else h=Math.min(c,P(h)+1);p&&_(u,h),f++,n=!0}else{for(p="/"===b(u=h+1);"\n"!==b(++h);)if(h===c)return null;++h,p&&_(u,h-1),++f,n=!0}else{if("*"!==(a=b(h)))return"/";u=h+1,p=e||"*"===b(u);do{if("\n"===a&&++f,++h===c)throw w("comment");r=a,a=b(h)}while("*"!==r||"/"!==a);++h,p&&_(u,h-2),n=!0}}}while(n);var y=h;if(i.lastIndex=0,!i.test(b(y++)))for(;y<c&&!i.test(b(y));)++y;var m=t.substring(h,h=y);return'"'!==m&&"'"!==m||(v=m),m}function A(t){g.push(t)}function M(){if(!g.length){var t=T();if(null===t)return null;A(t)}return g[0]}return Object.defineProperty({next:T,peek:M,push:A,skip:function(t,e){var i=M();if(i===t)return T(),!0;if(!e)throw w("token '"+i+"', '"+t+"' expected");return!1},cmnt:function(t){var i=null;return void 0===t?y===f-1&&(e||"*"===u||m)&&(i=p):(y<t&&M(),y!==t||m||!e&&"/"!==u||(i=p)),i}},"line",{get:function(){return f}})}f.unescape=d},function(t,e,i){"use strict";t.exports=s;var o=i(0);function s(t,e,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");o.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(i)}(s.prototype=Object.create(o.EventEmitter.prototype)).constructor=s,s.prototype.rpcCall=function t(e,i,s,n,r){if(!n)throw TypeError("request must be specified");var a=this;if(!r)return o.asPromise(t,a,e,i,s,n);if(a.rpcImpl)try{return a.rpcImpl(e,i[a.requestDelimited?"encodeDelimited":"encode"](n).finish(),(function(t,i){if(t)return a.emit("error",t,e),r(t);if(null!==i){if(!(i instanceof s))try{i=s[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(t){return a.emit("error",t,e),r(t)}return a.emit("data",i,e),r(null,i)}a.end(!0)}))}catch(t){return a.emit("error",t,e),void setTimeout((function(){r(t)}),0)}else setTimeout((function(){r(Error("already ended"))}),0)},s.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(t,e){t.exports=s;var i,o=/\/|\./;function s(t,e){o.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),s[t]=e}s("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),s("duration",{Duration:i={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),s("timestamp",{Timestamp:i}),s("empty",{Empty:{fields:{}}}),s("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),s("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),s("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),s.get=function(t){return s[t]||null}},function(t,e,i){t.exports=a;var o,s,n=i(0);function r(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function a(t){this.buf=t,this.pos=0,this.len=t.length}var l,h="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new a(t);if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return new a(new Uint8Array(t));throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new a(t);throw Error("illegal buffer")};function c(){var t=new o(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw r(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw r(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function d(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw r(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}a.create=n.Buffer?function(t){return(a.create=function(t){return n.Buffer.isBuffer(t)?new(void 0)(t):h(t)})(t)}:h,a.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,a.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,r(this,10);return l}),a.prototype.int32=function(){return 0|this.uint32()},a.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},a.prototype.bool=function(){return 0!==this.uint32()},a.prototype.fixed32=function(){if(this.pos+4>this.len)throw r(this,4);return d(this.buf,this.pos+=4)},a.prototype.sfixed32=function(){if(this.pos+4>this.len)throw r(this,4);return 0|d(this.buf,this.pos+=4)},a.prototype.float=function(){if(this.pos+4>this.len)throw r(this,4);var t=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},a.prototype.double=function(){if(this.pos+8>this.len)throw r(this,4);var t=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},a.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw r(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,i):e===i?new this.buf.constructor(0):this._slice.call(this.buf,e,i)},a.prototype.string=function(){var t=this.bytes();return s.read(t,0,t.length)},a.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw r(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw r(this)}while(128&this.buf[this.pos++]);return this},a.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4==(t=7&this.uint32()))break;this.skipType(t)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},a._configure=function(){o=i(11),s=i(8);var t=n.Long?"toLong":"toNumber";n.merge(a.prototype,{int64:function(){return c.call(this)[t](!1)},uint64:function(){return c.call(this)[t](!0)},sint64:function(){return c.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},function(t,e,i){var o,s;function n(t,e){return t.name+": "+e+(t.repeated&&"array"!==e?"[]":t.map&&"object"!==e?"{k:"+t.keyType+"}":"")+" expected"}function r(t,e,i,r){var a=r.types;if(t.resolvedType)if(t.resolvedType instanceof o){if(Object.keys(t.resolvedType.values).indexOf(i)<0)return n(t,"enum value")}else{var l=a[e].verify(i);if(l)return t.name+"."+l}else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!s.isInteger(i))return n(t,"integer");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!(s.isInteger(i)||i&&s.isInteger(i.low)&&s.isInteger(i.high)))return n(t,"integer|Long");break;case"float":case"double":if("number"!=typeof i)return n(t,"number");break;case"bool":if("boolean"!=typeof i)return n(t,"boolean");break;case"string":if(!s.isString(i))return n(t,"string");break;case"bytes":if(!(i&&"number"==typeof i.length||s.isString(i)))return n(t,"buffer")}}function a(t,e){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!s.key32Re.test(e))return n(t,"integer key");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!s.key64Re.test(e))return n(t,"integer|Long key");break;case"bool":if(!s.key2Re.test(e))return n(t,"boolean key")}}function l(t){return function(e){return function(i){var o;if("object"!=typeof i||null===i)return"object expected";var l,h={};t.oneofsArray.length&&(l={});for(var c=0;c<t.fieldsArray.length;++c){var d,f=t._fieldsArray[c].resolve(),u=i[f.name];if(!f.optional||null!=u&&i.hasOwnProperty(f.name))if(f.map){if(!s.isObject(u))return n(f,"object");var p=Object.keys(u);for(d=0;d<p.length;++d){if(o=a(f,p[d]))return o;if(o=r(f,c,u[p[d]],e))return o}}else if(f.repeated){if(!Array.isArray(u))return n(f,"array");for(d=0;d<u.length;++d)if(o=r(f,c,u[d],e))return o}else{if(f.partOf){var y=f.partOf.name;if(1===h[f.partOf.name]&&1===l[y])return f.partOf.name+": multiple values";l[y]=1}if(o=r(f,c,u,e))return o}}}}}t.exports=l,l._configure=function(){o=i(1),s=i(0)}},function(t,e,i){var o,s;function n(t){return function(e){var i=e.Writer,n=e.types,r=e.util;return function(e,a){a=a||i.create();for(var l=t.fieldsArray.slice().sort(r.compareFieldsById),h=0;h<l.length;h++){var c=l[h],d=t._fieldsArray.indexOf(c),f=c.resolvedType instanceof o?"uint32":c.type,u=s.basic[f],p=e[c.name];if(c.resolvedType instanceof o&&"string"==typeof p&&(p=n[d].values[p]),c.map){if(null!=p&&e.hasOwnProperty(c.name))for(var y=Object.keys(p),m=0;m<y.length;++m)a.uint32((c.id<<3|2)>>>0).fork().uint32(8|s.mapKey[c.keyType])[c.keyType](y[m]),void 0===u?n[d].encode(p[y[m]],a.uint32(18).fork()).ldelim().ldelim():a.uint32(16|u)[f](p[y[m]]).ldelim()}else if(c.repeated){if(p&&p.length)if(c.packed&&void 0!==s.packed[f]){a.uint32((c.id<<3|2)>>>0).fork();for(var g=0;g<p.length;g++)a[f](p[g]);a.ldelim()}else for(var v=0;v<p.length;v++)void 0===u?c.resolvedType.group?n[d].encode(p[v],a.uint32((c.id<<3|3)>>>0)).uint32((c.id<<3|4)>>>0):n[d].encode(p[v],a.uint32((c.id<<3|2)>>>0).fork()).ldelim():a.uint32((c.id<<3|u)>>>0)[f](p[v])}else(!c.optional||null!=p&&e.hasOwnProperty(c.name))&&(c.optional||null!=p&&e.hasOwnProperty(c.name)||console.warn("注意啦!!!很大概率会报错 类型:",e.$type?e.$type.name:"不晓得","没有设置对应的属性:",c.name,"检查是不是proto文件属性设置为了required"),void 0===u?c.resolvedType.group?n[d].encode(p,a.uint32((c.id<<3|3)>>>0)).uint32((c.id<<3|4)>>>0):n[d].encode(p,a.uint32((c.id<<3|2)>>>0).fork()).ldelim():a.uint32((c.id<<3|u)>>>0)[f](p))}return a}}}t.exports=n,n._configure=function(){o=i(1),s=i(5)}},function(t,e,i){var o,s,n;function r(t){return"missing required '"+t.name+"'"}function a(t){return function(e){var i=e.Reader,a=e.types,l=e.util;return function(e,h){e instanceof i||(e=i.create(e));for(var c,d=void 0===h?e.len:e.pos+h,f=new this.ctor;e.pos<d;){var u=e.uint32();if(t.group&&4==(7&u))break;for(var p=u>>>3,y=0,m=!1;y<t.fieldsArray.length;++y){var g=t._fieldsArray[y].resolve(),v=g.name,w=g.resolvedType instanceof o?"int32":g.type;if(p==g.id){if(m=!0,g.map)e.skip().pos++,f[v]===l.emptyObject&&(f[v]={}),c=e[g.keyType](),e.pos++,null!=s.long[g.keyType]?null==s.basic[w]?f[v]["object"==typeof c?l.longToHash(c):c]=a[y].decode(e,e.uint32()):f[v]["object"==typeof c?l.longToHash(c):c]=e[w]():null==s.basic[w]?f[v]=a[y].decode(e,e.uint32()):f[v]=e[w]();else if(g.repeated)if(f[v]&&f[v].length||(f[v]=[]),null!=s.packed[w]&&2==(7&u))for(var b=e.uint32()+e.pos;e.pos<b;)f[v].push(e[w]());else null==s.basic[w]?g.resolvedType.group?f[v].push(a[y].decode(e)):f[v].push(a[y].decode(e,e.uint32())):f[v].push(e[w]());else null==s.basic[w]?g.resolvedType.group?f[v]=a[y].decode(e):f[v]=a[y].decode(e,e.uint32()):f[v]=e[w]();break}}m||e.skipType(7&u)}for(y=0;y<t._fieldsArray.length;++y){var _=t._fieldsArray[y];if(_.required&&!f.hasOwnProperty(_.name))throw n.ProtocolError(r(_),{instance:f})}return f}}}t.exports=a,a._configure=function(){o=i(1),s=i(5),n=i(0)}},function(t,e,i){var o,s=e;s[".google.protobuf.Any"]={fromObject:function(t){if(t&&t["@type"]){var e=this.lookup(t["@type"]);if(e){var i="."===t["@type"].charAt(0)?t["@type"].substr(1):t["@type"];return this.create({type_url:"/"+i,value:e.encode(e.fromObject(t)).finish()})}}return this.fromObject(t)},toObject:function(t,e){if(e&&e.json&&t.type_url&&t.value){var i=t.type_url.substring(t.type_url.lastIndexOf("/")+1),s=this.lookup(i);s&&(t=s.decode(t.value))}if(!(t instanceof this.ctor)&&t instanceof o){var n=t.$type.toObject(t,e);return n["@type"]=t.$type.fullName,n}return this.toObject(t,e)}},s._configure=function(){o=i(14)}},function(t,e,i){var o,s,n=t.exports;function r(t,e,i,n){var r=n.m,a=n.d,l=n.types,h=n.ksi,c=void 0!==h;if(t.resolvedType)if(t.resolvedType instanceof o){for(var d=c?a[i][h]:a[i],f=t.resolvedType.values,u=Object.keys(f),p=0;p<u.length;p++)if(!(t.repeated&&f[u[p]]===t.typeDefault||u[p]!=d&&f[u[p]]!=d)){c?r[i][h]=f[u[p]]:r[i]=f[u[p]];break}}else{if("object"!=typeof(c?a[i][h]:a[i]))throw TypeError(t.fullName+": object expected");c?r[i][h]=l[e].fromObject(a[i][h]):r[i]=l[e].fromObject(a[i])}else{var y=!1;switch(t.type){case"double":case"float":c?r[i][h]=Number(a[i][h]):r[i]=Number(a[i]);break;case"uint32":case"fixed32":c?r[i][h]=a[i][h]>>>0:r[i]=a[i]>>>0;break;case"int32":case"sint32":case"sfixed32":c?r[i][h]=0|a[i][h]:r[i]=0|a[i];break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s.Long?c?r[i][h]=s.Long.fromValue(a[i][h]).unsigned=y:r[i]=s.Long.fromValue(a[i]).unsigned=y:"string"==typeof(c?a[i][h]:a[i])?c?r[i][h]=parseInt(a[i][h],10):r[i]=parseInt(a[i],10):"number"==typeof(c?a[i][h]:a[i])?c?r[i][h]=a[i][h]:r[i]=a[i]:"object"==typeof(c?a[i][h]:a[i])&&(c?r[i][h]=new s.LongBits(a[i][h].low>>>0,a[i][h].high>>>0).toNumber(y):r[i]=new s.LongBits(a[i].low>>>0,a[i].high>>>0).toNumber(y));break;case"bytes":"string"==typeof(c?a[i][h]:a[i])?c?s.base64.decode(a[i][h],r[i][h]=s.newBuffer(s.base64.length(a[i][h])),0):s.base64.decode(a[i],r[i]=s.newBuffer(s.base64.length(a[i])),0):(c?a[i][h]:a[i]).length&&(c?r[i][h]=a[i][h]:r[i]=a[i]);break;case"string":c?r[i][h]=String(a[i][h]):r[i]=String(a[i]);break;case"bool":c?r[i][h]=Boolean(a[i][h]):r[i]=Boolean(a[i])}}}function a(t,e,i,n){var r=n.m,a=n.d,l=n.types,h=n.ksi,c=n.o,d=void 0!==h;if(t.resolvedType)t.resolvedType instanceof o?d?a[i][h]=c.enums===String?l[e].values[r[i][h]]:r[i][h]:a[i]=c.enums===String?l[e].values[r[i]]:r[i]:d?a[i][h]=l[e].toObject(r[i][h],c):a[i]=l[e].toObject(r[i],c);else{var f=!1;switch(t.type){case"double":case"float":d?a[i][h]=c.json&&!isFinite(r[i][h])?String(r[i][h]):r[i][h]:a[i]=c.json&&!isFinite(r[i])?String(r[i]):r[i];break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":"number"==typeof r[i][h]?d?a[i][h]=c.longs===String?String(r[i][h]):r[i][h]:a[i]=c.longs===String?String(r[i]):r[i]:d?a[i][h]=c.longs===String?s.Long.prototype.toString.call(r[i][h]):c.longs===Number?new s.LongBits(r[i][h].low>>>0,r[i][h].high>>>0).toNumber(f):r[i][h]:a[i]=c.longs===String?s.Long.prototype.toString.call(r[i]):c.longs===Number?new s.LongBits(r[i].low>>>0,r[i].high>>>0).toNumber(f):r[i];break;case"bytes":d?a[i][h]=c.bytes===String?s.base64.encode(r[i][h],0,r[i][h].length):c.bytes===Array?Array.prototype.slice.call(r[i][h]):r[i][h]:a[i]=c.bytes===String?s.base64.encode(r[i],0,r[i].length):c.bytes===Array?Array.prototype.slice.call(r[i]):r[i];break;default:d?a[i][h]=r[i][h]:a[i]=r[i]}}}n._configure=function(){o=i(1),s=i(0)},n.fromObject=function(t){var e=t.fieldsArray;return function(t){return function(i){if(i instanceof this.ctor)return i;if(!e.length)return new this.ctor;for(var n=new this.ctor,a=0;a<e.length;++a){var l,h=e[a].resolve(),c=h.name;if(h.map){if(i[c]){if("object"!=typeof i[c])throw TypeError(h.fullName+": object expected");n[c]={}}var d=Object.keys(i[c]);for(l=0;l<d.length;++l)r(h,a,c,s.merge(s.copy(t),{m:n,d:i,ksi:d[l]}))}else if(h.repeated){if(i[c]){if(!Array.isArray(i[c]))throw TypeError(h.fullName+": array expected");for(n[c]=[],l=0;l<i[c].length;++l)r(h,a,c,s.merge(s.copy(t),{m:n,d:i,ksi:l}))}}else(h.resolvedType instanceof o||null!=i[c])&&r(h,a,c,s.merge(s.copy(t),{m:n,d:i}))}return n}}},n.toObject=function(t){var e=t.fieldsArray.slice().sort(s.compareFieldsById);return function(i){return e.length?function(n,r){r=r||{};for(var l,h,c={},d=[],f=[],u=[],p=0;p<e.length;++p)e[p].partOf||(e[p].resolve().repeated?d:e[p].map?f:u).push(e[p]);if(d.length&&(r.arrays||r.defaults))for(p=0;p<d.length;++p)c[d[p].name]=[];if(f.length&&(r.objects||r.defaults))for(p=0;p<f.length;++p)c[f[p].name]={};if(u.length&&r.defaults)for(p=0;p<u.length;++p)if(h=(l=u[p]).name,l.resolvedType instanceof o)c[h]=r.enums=String?l.resolvedType.valuesById[l.typeDefault]:l.typeDefault;else if(l.long)if(s.Long){var y=new s.Long(l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned);c[h]=r.longs===String?y.toString():r.longs===Number?y.toNumber():y}else c[h]=r.longs===String?l.typeDefault.toString():l.typeDefault.toNumber();else l.bytes?c[h]=r.bytes===String?String.fromCharCode.apply(String,l.typeDefault):Array.prototype.slice.call(l.typeDefault).join("*..*").split("*..*"):c[h]=l.typeDefault;var m=!1;for(p=0;p<e.length;++p){h=(l=e[p]).name;var g,v,w=t._fieldsArray.indexOf(l);if(l.map){if(m||(m=!0),n[h]&&(g=Object.keys(n[h]).length))for(c[h]={},v=0;v<g.length;++v)a(l,w,h,s.merge(s.copy(i),{m:n,d:c,ksi:g[v],o:r}))}else if(l.repeated){if(n[h]&&n[h].length)for(c[h]=[],v=0;v<n[h].length;++v)a(l,w,h,s.merge(s.copy(i),{m:n,d:c,ksi:v,o:r}))}else null!=n[h]&&n.hasOwnProperty(h)&&a(l,w,h,s.merge(s.copy(i),{m:n,d:c,o:r})),l.partOf&&r.oneofs&&(c[l.partOf.name]=h)}return c}:function(){return{}}}}},function(t,e){var i=function(){function t(t){return parseInt(t)===t}function e(e){if(!t(e.length))return!1;for(var i=0;i<e.length;i++)if(!t(e[i])||e[i]<0||e[i]>255)return!1;return!0}return{toBytes:function(i){var o=[],s=0;for(i=encodeURI(i);s<i.length;){var n=i.charCodeAt(s++);37===n?(o.push(parseInt(i.substr(s,2),16)),s+=2):o.push(n)}return function(i,o){if(i.buffer&&"Uint8Array"===i.name)return o&&(i=i.slice?i.slice():Array.prototype.slice.call(i)),i;if(Array.isArray(i)){if(!e(i))throw new Error("Array contains invalid value: "+i);return new Uint8Array(i)}if(t(i.length)&&e(i))return new Uint8Array(i);throw new Error("unsupported array-like object")}(o)},fromBytes:function(t){for(var e="",i=0;i<t.length;){var o=t[i],s=0;o>>>7==0?(e+=String.fromCharCode(t[i]),i+=1):252==(252&o)?(s=(3&t[i])<<30,s|=(63&t[i+1])<<24,s|=(63&t[i+2])<<18,s|=(63&t[i+3])<<12,s|=(63&t[i+4])<<6,s|=63&t[i+5],e+=String.fromCodePoint(s),i+=6):248==(248&o)?(s=(7&t[i])<<24,s|=(63&t[i+1])<<18,s|=(63&t[i+2])<<12,s|=(63&t[i+3])<<6,s|=63&t[i+4],e+=String.fromCodePoint(s),i+=5):240==(240&o)?(s=(15&t[i])<<18,s|=(63&t[i+1])<<12,s|=(63&t[i+2])<<6,s|=63&t[i+3],e+=String.fromCodePoint(s),i+=4):224==(224&o)?(s=(31&t[i])<<12,s|=(63&t[i+1])<<6,s|=63&t[i+2],e+=String.fromCharCode(s),i+=3):192==(192&o)?(s=(63&t[i])<<6,s|=63&t[i+1],e+=String.fromCharCode(s),i+=2):(e+=String.fromCharCode(t[i]),i+=1)}return e}}}();t.exports=i},function(t,e){var i=function(){const t={width:720,height:1280,intrinstics:[1110.828383,0,360,0,1111.21832,640,0,0,1],undistorts:[1e-5,0,0,0,0]},e={width:720,height:960,intrinstics:[720,0,360,0,720,480,0,0,1],undistorts:[0,0,0,0,0]},i={width:288,height:352,intrinstics:[594.25994,0,237.531106,0,594.825983,313.414084,0,0,1],undistorts:[.184825,-.433983,-.003168,-.010542,0]};function o(t,e){const i=[],o=[];for(var s=0;s<t.intrinstics.length;s++)i[s]=t.intrinstics[s]*e;for(s=0;s<t.undistorts.length;s++)o[s]=t.undistorts[s];return{intrinstics:i,undistorts:o}}return{getCameraParam:function(s,n){const r=s/n;var a=t.width/t.height;if(Math.abs(r-a)<.03){let e=o(t,s/t.width);return e.intrinstics[e.intrinstics.length-1]=1,e}var l=e.width/e.height;if(Math.abs(r-l)<.03){let t=o(e,s/e.width);return t.intrinstics[t.intrinstics.length-1]=1,t}var h=i.width/i.height;if(Math.abs(r-h)<.03){let t=o(i,s/i.width);return t.intrinstics[t.intrinstics.length-1]=1,t}if(0!==s&&0!==n){var c={};c.width=s,c.height=n;let e=0,i=0,o=0,r=0;return s>n?(e=1200*s/1280,i=e):(e=1200*n/1280,i=e),o=s/2,r=n/2,c.intrinstics=[e,0,o,0,i,r,0,0,1],c.undistorts=t.undistorts,c}return{intrinstics:[],undistorts:[]}}}}();t.exports=i},function(t,e,i){t.exports=function(){var t={};function e(e,i,o){return"function"==typeof i?(o=i,i=new t.Root):i||(i=new t.Root),i.load(e,o)}function o(e,i){return i||(i=new t.Root),i.loadSync(e)}function s(e,i,o){return"function"==typeof i?(o=i,i=new t.Root):i||(i=new t.Root),i.parseFromPbString(e,o)}function n(){t.converter._configure(),t.decoder._configure(),t.encoder._configure(),t.Field._configure(),t.MapField._configure(),t.Message._configure(),t.Namespace._configure(),t.Method._configure(),t.ReflectionObject._configure(),t.OneOf._configure(),t.parse._configure(),t.Reader._configure(),t.Root._configure(),t.Service._configure(),t.verifier._configure(),t.Type._configure(),t.types._configure(),t.wrappers._configure(),t.Writer._configure()}if(t.build="minimal",t.Writer=i(16),t.encoder=i(25),t.Reader=i(23),t.util=i(0),t.rpc=i(21),t.roots=i(17),t.verifier=i(24),t.tokenize=i(20),t.parse=i(19),t.common=i(22),t.ReflectionObject=i(4),t.Namespace=i(6),t.Root=i(9),t.Enum=i(1),t.Type=i(3),t.Field=i(2),t.OneOf=i(7),t.MapField=i(12),t.Service=i(10),t.Method=i(13),t.converter=i(28),t.decoder=i(26),t.Message=i(14),t.wrappers=i(27),t.types=i(5),t.util=i(0),t.configure=n,t.load=e,t.loadSync=o,t.parseFromPbString=s,n(),arguments&&arguments.length)for(var r=0;r<arguments.length;r++){var a=arguments[r];if(a.hasOwnProperty("exports"))return void(a.exports=t)}return t}()},function(t,e){t.exports=o;var i=null;try{i=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function o(t,e,i){this.low=0|t,this.high=0|e,this.unsigned=!!i}function s(t){return!0===(t&&t.__isLong__)}o.prototype.__isLong__,Object.defineProperty(o.prototype,"__isLong__",{value:!0}),o.isLong=s;var n={},r={};function a(t,e){var i,o,s;return e?(s=0<=(t>>>=0)&&t<256)&&(o=r[t])?o:(i=h(t,(0|t)<0?-1:0,!0),s&&(r[t]=i),i):(s=-128<=(t|=0)&&t<128)&&(o=n[t])?o:(i=h(t,t<0?-1:0,!1),s&&(n[t]=i),i)}function l(t,e){if(isNaN(t))return e?v:g;if(e){if(t<0)return v;if(t>=p)return P}else{if(t<=-y)return T;if(t+1>=y)return x}return t<0?l(-t,e).neg():h(t%u|0,t/u|0,e)}function h(t,e,i){return new o(t,e,i)}o.fromInt=a,o.fromNumber=l,o.fromBits=h;var c=Math.pow;function d(t,e,i){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return g;if("number"==typeof e?(i=e,e=!1):e=!!e,(i=i||10)<2||36<i)throw RangeError("radix");var o;if((o=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return d(t.substring(1),e,i).neg();for(var s=l(c(i,8)),n=g,r=0;r<t.length;r+=8){var a=Math.min(8,t.length-r),h=parseInt(t.substring(r,r+a),i);if(a<8){var f=l(c(i,a));n=n.mul(f).add(l(h))}else n=(n=n.mul(s)).add(l(h))}return n.unsigned=e,n}function f(t,e){return"number"==typeof t?l(t,e):"string"==typeof t?d(t,e):h(t.low,t.high,"boolean"==typeof e?e:t.unsigned)}o.fromString=d,o.fromValue=f;var u=4294967296,p=u*u,y=p/2,m=a(1<<24),g=a(0);o.ZERO=g;var v=a(0,!0);o.UZERO=v;var w=a(1);o.ONE=w;var b=a(1,!0);o.UONE=b;var _=a(-1);o.NEG_ONE=_;var x=h(-1,2147483647,!1);o.MAX_VALUE=x;var P=h(-1,-1,!0);o.MAX_UNSIGNED_VALUE=P;var T=h(0,-2147483648,!1);o.MIN_VALUE=T;var A=o.prototype;A.toInt=function(){return this.unsigned?this.low>>>0:this.low},A.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},A.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var e=l(t),i=this.div(e),o=i.mul(e).sub(this);return i.toString(t)+o.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var s=l(c(t,6),this.unsigned),n=this,r="";;){var a=n.div(s),h=(n.sub(a.mul(s)).toInt()>>>0).toString(t);if((n=a).isZero())return h+r;for(;h.length<6;)h="0"+h;r=""+h+r}},A.getHighBits=function(){return this.high},A.getHighBitsUnsigned=function(){return this.high>>>0},A.getLowBits=function(){return this.low},A.getLowBitsUnsigned=function(){return this.low>>>0},A.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},A.isZero=function(){return 0===this.high&&0===this.low},A.eqz=A.isZero,A.isNegative=function(){return!this.unsigned&&this.high<0},A.isPositive=function(){return this.unsigned||this.high>=0},A.isOdd=function(){return 1==(1&this.low)},A.isEven=function(){return 0==(1&this.low)},A.equals=function(t){return s(t)||(t=f(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},A.eq=A.equals,A.notEquals=function(t){return!this.eq(t)},A.neq=A.notEquals,A.ne=A.notEquals,A.lessThan=function(t){return this.comp(t)<0},A.lt=A.lessThan,A.lessThanOrEqual=function(t){return this.comp(t)<=0},A.lte=A.lessThanOrEqual,A.le=A.lessThanOrEqual,A.greaterThan=function(t){return this.comp(t)>0},A.gt=A.greaterThan,A.greaterThanOrEqual=function(t){return this.comp(t)>=0},A.gte=A.greaterThanOrEqual,A.ge=A.greaterThanOrEqual,A.compare=function(t){if(s(t)||(t=f(t)),this.eq(t))return 0;var e=this.isNegative(),i=t.isNegative();return e&&!i?-1:!e&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},A.comp=A.compare,A.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(w)},A.neg=A.negate,A.add=function(t){s(t)||(t=f(t));var e=this.high>>>16,i=65535&this.high,o=this.low>>>16,n=65535&this.low,r=t.high>>>16,a=65535&t.high,l=t.low>>>16,c=0,d=0,u=0,p=0;return u+=(p+=n+(65535&t.low))>>>16,d+=(u+=o+l)>>>16,c+=(d+=i+a)>>>16,c+=e+r,h((u&=65535)<<16|(p&=65535),(c&=65535)<<16|(d&=65535),this.unsigned)},A.subtract=function(t){return s(t)||(t=f(t)),this.add(t.neg())},A.sub=A.subtract,A.multiply=function(t){if(this.isZero())return g;if(s(t)||(t=f(t)),i)return h(i.mul(this.low,this.high,t.low,t.high),i.get_high(),this.unsigned);if(t.isZero())return g;if(this.eq(T))return t.isOdd()?T:g;if(t.eq(T))return this.isOdd()?T:g;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(m)&&t.lt(m))return l(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,o=65535&this.high,n=this.low>>>16,r=65535&this.low,a=t.high>>>16,c=65535&t.high,d=t.low>>>16,u=65535&t.low,p=0,y=0,v=0,w=0;return v+=(w+=r*u)>>>16,y+=(v+=n*u)>>>16,v&=65535,y+=(v+=r*d)>>>16,p+=(y+=o*u)>>>16,y&=65535,p+=(y+=n*d)>>>16,y&=65535,p+=(y+=r*c)>>>16,p+=e*u+o*d+n*c+r*a,h((v&=65535)<<16|(w&=65535),(p&=65535)<<16|(y&=65535),this.unsigned)},A.mul=A.multiply,A.divide=function(t){if(s(t)||(t=f(t)),t.isZero())throw Error("division by zero");var e,o,n;if(i)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?h((this.unsigned?i.div_u:i.div_s)(this.low,this.high,t.low,t.high),i.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:g;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return v;if(t.gt(this.shru(1)))return b;n=v}else{if(this.eq(T))return t.eq(w)||t.eq(_)?T:t.eq(T)?w:(e=this.shr(1).div(t).shl(1)).eq(g)?t.isNegative()?w:_:(o=this.sub(t.mul(e)),n=e.add(o.div(t)));if(t.eq(T))return this.unsigned?v:g;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();n=g}for(o=this;o.gte(t);){e=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var r=Math.ceil(Math.log(e)/Math.LN2),a=r<=48?1:c(2,r-48),d=l(e),u=d.mul(t);u.isNegative()||u.gt(o);)u=(d=l(e-=a,this.unsigned)).mul(t);d.isZero()&&(d=w),n=n.add(d),o=o.sub(u)}return n},A.div=A.divide,A.modulo=function(t){return s(t)||(t=f(t)),i?h((this.unsigned?i.rem_u:i.rem_s)(this.low,this.high,t.low,t.high),i.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},A.mod=A.modulo,A.rem=A.modulo,A.not=function(){return h(~this.low,~this.high,this.unsigned)},A.and=function(t){return s(t)||(t=f(t)),h(this.low&t.low,this.high&t.high,this.unsigned)},A.or=function(t){return s(t)||(t=f(t)),h(this.low|t.low,this.high|t.high,this.unsigned)},A.xor=function(t){return s(t)||(t=f(t)),h(this.low^t.low,this.high^t.high,this.unsigned)},A.shiftLeft=function(t){return s(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?h(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):h(0,this.low<<t-32,this.unsigned)},A.shl=A.shiftLeft,A.shiftRight=function(t){return s(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?h(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):h(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},A.shr=A.shiftRight,A.shiftRightUnsigned=function(t){if(s(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?h(this.low>>>t|e<<32-t,e>>>t,this.unsigned):h(32===t?e:e>>>t-32,0,this.unsigned)},A.shru=A.shiftRightUnsigned,A.shr_u=A.shiftRightUnsigned,A.toSigned=function(){return this.unsigned?h(this.low,this.high,!1):this},A.toUnsigned=function(){return this.unsigned?this:h(this.low,this.high,!0)},A.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},A.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},A.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},o.fromBytes=function(t,e,i){return i?o.fromBytesLE(t,e):o.fromBytesBE(t,e)},o.fromBytesLE=function(t,e){return new o(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},o.fromBytesBE=function(t,e){return new o(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},function(t,e){t.exports=function(t,e,i){var o=i||8192,s=o>>>1,n=null,r=o;return function(i){if(i<1||i>s)return t(i);r+i>o&&(n=t(o),r=0);var a=e.call(n,r,r+=i);return 7&r&&(r=1+(7|r)),a}}},function(t,e){function i(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),i=new Uint8Array(e.buffer),o=128===i[3];function s(t,o,s){e[0]=t,o[s]=i[0],o[s+1]=i[1],o[s+2]=i[2],o[s+3]=i[3]}function n(t,o,s){e[0]=t,o[s]=i[3],o[s+1]=i[2],o[s+2]=i[1],o[s+3]=i[0]}function r(t,o){return i[0]=t[o],i[1]=t[o+1],i[2]=t[o+2],i[3]=t[o+3],e[0]}function a(t,o){return i[3]=t[o],i[2]=t[o+1],i[1]=t[o+2],i[0]=t[o+3],e[0]}t.writeFloatLE=o?s:n,t.writeFloatBE=o?n:s,t.readFloatLE=o?r:a,t.readFloatBE=o?a:r}():function(){function e(t,e,i,o){var s=e<0?1:0;if(s&&(e=-e),0===e)t(1/e>0?0:2147483648,i,o);else if(isNaN(e))t(2143289344,i,o);else if(e>34028234663852886e22)t((s<<31|2139095040)>>>0,i,o);else if(e<11754943508222875e-54)t((s<<31|Math.round(e/1401298464324817e-60))>>>0,i,o);else{var n=Math.floor(Math.log(e)/Math.LN2);t((s<<31|n+127<<23|8388607&Math.round(e*Math.pow(2,-n)*8388608))>>>0,i,o)}}function i(t,e,i){var o=t(e,i),s=2*(o>>31)+1,n=o>>>23&255,r=8388607&o;return 255===n?r?NaN:s*(1/0):0===n?1401298464324817e-60*s*r:s*Math.pow(2,n-150)*(r+8388608)}t.writeFloatLE=e.bind(null,o),t.writeFloatBE=e.bind(null,s),t.readFloatLE=i.bind(null,n),t.readFloatBE=i.bind(null,r)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),i=new Uint8Array(e.buffer),o=128===i[7];function s(t,o,s){e[0]=t,o[s]=i[0],o[s+1]=i[1],o[s+2]=i[2],o[s+3]=i[3],o[s+4]=i[4],o[s+5]=i[5],o[s+6]=i[6],o[s+7]=i[7]}function n(t,o,s){e[0]=t,o[s]=i[7],o[s+1]=i[6],o[s+2]=i[5],o[s+3]=i[4],o[s+4]=i[3],o[s+5]=i[2],o[s+6]=i[1],o[s+7]=i[0]}function r(t,o){return i[0]=t[o],i[1]=t[o+1],i[2]=t[o+2],i[3]=t[o+3],i[4]=t[o+4],i[5]=t[o+5],i[6]=t[o+6],i[7]=t[o+7],e[0]}function a(t,o){return i[7]=t[o],i[6]=t[o+1],i[5]=t[o+2],i[4]=t[o+3],i[3]=t[o+4],i[2]=t[o+5],i[1]=t[o+6],i[0]=t[o+7],e[0]}t.writeDoubleLE=o?s:n,t.writeDoubleBE=o?n:s,t.readDoubleLE=o?r:a,t.readDoubleBE=o?a:r}():function(){function e(t,e,i,o,s,n){var r=o<0?1:0;if(r&&(o=-o),0===o)t(0,s,n+e),t(1/o>0?0:2147483648,s,n+i);else if(isNaN(o))t(0,s,n+e),t(2146959360,s,n+i);else if(o>17976931348623157e292)t(0,s,n+e),t((r<<31|2146435072)>>>0,s,n+i);else{var a;if(o<22250738585072014e-324)t((a=o/5e-324)>>>0,s,n+e),t((r<<31|a/4294967296)>>>0,s,n+i);else{var l=Math.floor(Math.log(o)/Math.LN2);1024===l&&(l=1023),t(4503599627370496*(a=o*Math.pow(2,-l))>>>0,s,n+e),t((r<<31|l+1023<<20|1048576*a&1048575)>>>0,s,n+i)}}}function i(t,e,i,o,s){var n=t(o,s+e),r=t(o,s+i),a=2*(r>>31)+1,l=r>>>20&2047,h=4294967296*(1048575&r)+n;return 2047===l?h?NaN:a*(1/0):0===l?5e-324*a*h:a*Math.pow(2,l-1075)*(h+4503599627370496)}t.writeDoubleLE=e.bind(null,o,0,4),t.writeDoubleBE=e.bind(null,s,4,0),t.readDoubleLE=i.bind(null,n,0,4),t.readDoubleBE=i.bind(null,r,4,0)}(),t}function o(t,e,i){e[i]=255&t,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}function s(t,e,i){e[i]=t>>>24,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function n(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function r(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.exports=i(i)},function(t,e,i){"use strict";t.exports=function(t,e){var i=new Array(arguments.length-1),o=0,s=2,n=!0;for(;s<arguments.length;)i[o++]=arguments[s++];return new Promise((function(s,r){i[o]=function(t){if(n)if(n=!1,t)r(t);else{for(var e=new Array(arguments.length-1),i=0;i<e.length;)e[i++]=arguments[i];s.apply(null,e)}};try{t.apply(e||null,i)}catch(t){n&&(n=!1,r(t))}}))}},function(t,e,i){"use strict";function o(){this._listeners={}}t.exports=o,o.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this},o.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var i=this._listeners[t],o=0;o<i.length;)i[o].fn===e?i.splice(o,1):++o;return this},o.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var i=[],o=1;o<arguments.length;)i.push(arguments[o++]);for(o=0;o<e.length;)e[o].fn.apply(e[o++].ctx,i)}return this}},function(t,e){var i=t.exports,o=i.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},s=i.normalize=function(t){var e=(t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),i=o(t),s="";i&&(s=e.shift()+"/");for(var n=0;n<e.length;)".."===e[n]?n>0&&".."!==e[n-1]?e.splice(--n,2):i?e.splice(n,1):++n:"."===e[n]?e.splice(n,1):++n;return s+e.join("/")};i.resolve=function(t,e,i){return i||(e=s(e)),o(e)?e:(i||(t=s(t)),(t=t.replace(/(?:\/|^)[^/]+$/,"")).length?s(t+"/"+e):e)}},function(t,e){t.exports={nested:{bdarvps:{nested:{BdarVector12f:{fields:{f1:{type:"float",id:1},f2:{type:"float",id:2},f3:{type:"float",id:3},f4:{type:"float",id:4},f5:{type:"float",id:5},f6:{type:"float",id:6},f7:{type:"float",id:7},f8:{type:"float",id:8},f9:{type:"float",id:9},f10:{type:"float",id:10},f11:{type:"float",id:11},f12:{type:"float",id:12}}},BdarVector9f:{fields:{f1:{type:"float",id:1},f2:{type:"float",id:2},f3:{type:"float",id:3},f4:{type:"float",id:4},f5:{type:"float",id:5},f6:{type:"float",id:6},f7:{type:"float",id:7},f8:{type:"float",id:8},f9:{type:"float",id:9}}},BdarVector5f:{fields:{f1:{type:"float",id:1},f2:{type:"float",id:2},f3:{type:"float",id:3},f4:{type:"float",id:4},f5:{type:"float",id:5}}},BdarVector4f:{fields:{f1:{type:"float",id:1},f2:{type:"float",id:2},f3:{type:"float",id:3},f4:{type:"float",id:4}}},BdarVector3f:{fields:{x:{type:"float",id:1},y:{type:"float",id:2},z:{type:"float",id:3}}},BdarVector2f:{fields:{x:{type:"float",id:1},y:{type:"float",id:2}}},BdarVector2d:{fields:{x:{type:"double",id:1},y:{type:"double",id:2}}},BdarVector3d:{fields:{x:{type:"double",id:1},y:{type:"double",id:2},z:{type:"double",id:3}}},BdarTrackerData:{fields:{pose:{type:"BdarVector12f",id:1},poseOrig:{type:"BdarVector12f",id:2},timestamp:{type:"bytes",id:3},frameId:{type:"int32",id:4},status:{type:"int32",id:5},magnet:{rule:"repeated",type:"double",id:6}}},BdarLocalizerData:{fields:{pose:{type:"BdarVector12f",id:1},timestamp:{type:"bytes",id:2},frameId:{type:"int32",id:3},consistent:{type:"int32",id:4}}},BdarTrackerOptimizeData:{fields:{sampleRate:{type:"int32",id:1},trackerData:{rule:"repeated",type:"BdarTrackerData",id:2},localizerData:{rule:"repeated",type:"BdarLocalizerData",id:3}}},BdarPosePrior:{fields:{type:{type:"int32",id:1},prior:{type:"BdarVector12f",id:2},priorAccuracy:{type:"float",id:3},priorConfidence:{type:"float",id:4}}},BdarOCRPrior:{fields:{status:{type:"bytes",id:1},roiCoordinate:{type:"BdarVector4f",id:2}}},BdarVPSRequestData:{fields:{methodType:{type:"int32",id:1},trackerType:{type:"int32",id:2},phoneType:{type:"bytes",id:3},userId:{type:"bytes",id:4},frameId:{type:"int32",id:5},timestamp:{type:"bytes",id:6},trackerStatus:{type:"bool",id:7},trackerPose:{type:"BdarVector12f",id:8},pointIndices:{rule:"repeated",type:"int32",id:9},points_2d:{rule:"repeated",type:"BdarVector2f",id:10},points_3d:{rule:"repeated",type:"BdarVector3f",id:11},cameraIntrinsics:{type:"BdarVector9f",id:12},cameraDistort:{type:"BdarVector5f",id:13},gps:{type:"BdarVector3d",id:14},gravityDirection:{type:"BdarVector3f",id:15},imu:{type:"BdarVector12f",id:16},frame:{type:"bytes",id:17},frameWidth:{type:"int32",id:18},frameHeight:{type:"int32",id:19},frameChannels:{type:"int32",id:20},frameCompressType:{type:"int32",id:21},requestCorrespondence:{type:"bool",id:22},sessionId:{type:"bytes",id:23},version:{type:"bytes",id:24},sceneType:{type:"int32",id:25},trackerOptimizeData:{type:"BdarTrackerOptimizeData",id:26},posePriors:{rule:"repeated",type:"BdarPosePrior",id:27},floorId:{type:"bytes",id:28},bdarOCRPrior:{type:"BdarOCRPrior",id:29}}},BdarMapInfo:{fields:{mapTag:{type:"bytes",id:1},mapQueryConfidence:{type:"float",id:2}}},BdarClientResult:{fields:{buildingId:{type:"bytes",id:1},floorId:{type:"bytes",id:2},locationPoint:{type:"BdarVector2d",id:3},locationTransform:{type:"BdarVector12f",id:4}}},BdarCoupledPose:{fields:{pose:{type:"BdarVector12f",id:1},trackerPose:{type:"BdarVector12f",id:2},timestamp:{type:"bytes",id:3},frameId:{type:"int32",id:4}}},BdarCoupleResult:{fields:{status:{type:"int32",id:1},coupledPose:{rule:"repeated",type:"BdarCoupledPose",id:2},scale:{type:"float",id:3},transform:{type:"BdarVector12f",id:4}}},BdarVPSResponseData:{fields:{userId:{type:"bytes",id:1},frameId:{type:"int32",id:2},timestamp:{type:"bytes",id:3},trackerPose:{type:"BdarVector12f",id:4},imu:{type:"BdarVector12f",id:5},vpsStatus:{type:"bool",id:6},vpsPose:{type:"BdarVector12f",id:7},scale:{type:"float",id:8},points_2d:{rule:"repeated",type:"BdarVector2f",id:9},points_3d:{rule:"repeated",type:"BdarVector3f",id:10},vpsPosition:{type:"BdarVector3d",id:11},version:{type:"bytes",id:12},vpsPoseAccuracy:{type:"float",id:13},vpsPoseConfidence:{type:"float",id:14},sceneType:{type:"int32",id:15},trackerType:{type:"int32",id:16},mapInfo:{type:"BdarMapInfo",id:17},clientResult:{type:"BdarClientResult",id:18},session:{type:"bytes",id:19},trackerOptimizeData:{type:"BdarTrackerOptimizeData",id:20},coupleResult:{type:"BdarCoupleResult",id:21},vpsStatusMsg:{type:"int32",id:22}}},BdarVPSResponseDataList:{fields:{data:{rule:"repeated",type:"BdarVPSResponseData",id:1}}},LocationResponse:{fields:{errCode:{type:"int32",id:1},errMsg:{type:"string",id:2},data:{type:"bytes",id:3}}},SubBdarVPSRequestData:{fields:{sessionId:{type:"bytes",id:23}}},TrackFrameResp:{fields:{errCode:{type:"int32",id:1},errMsg:{type:"string",id:2},data:{type:"bytes",id:3}}},TrackFrameResp2:{fields:{errCode:{type:"int32",id:1},errMsg:{type:"string",id:2},data:{type:"string",id:3}}}}}}}},function(t,e,i){"use strict";function o(t){return{data:function(t){const e=new t.constructor(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),e}(t.data),width:t.width,height:t.height}}i.r(e),i.d(e,"SDKWrapper",(function(){return Pt}));const s=i(29),n=i(15);function r(t){return s.toBytes(t)}function a(t){for(var e={},i=0,o=t.length;i<o;i++)e["f"+(i+1)]=t[i];return e}function l(t){return s.fromBytes(t)}function h(t){let e=[];for(var i in t)e.push(i);e.sort();let o="";for(var s in e)o+=t[e[s]];return o+="313d1d593314c7bff96422b0f29432d9c50a",n(o).toUpperCase()}function c(t){let e=[];for(var i in t)e.push(i);e.sort();let o="";for(var s in e)o+=t[e[s]];return o+="51ff398068a743ca89c09cfe03c31a20",n(o).toUpperCase()}class d{constructor(t){this.configJson=t,this.haveMapTransform=!1,this.haveGeoMapTransform=!1,this.startTime=0,this.transform_matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.scale=1,this.geo_map_transform_matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.locSuccess=!1}set_map_transform(t,e){this.transform_matrix=t,this.scale=e,this.haveMapTransform=!0}set_geo_map_transform(t){this.geo_map_transform_matrix=t,this.haveGeoMapTransform=!0}stepFunc(t,e,i,o){let s=Math.pow(t,2)+Math.pow(e,2)+Math.pow(i,2);if(o&&o.calculate_step_count){let t=(new Date).getTime(),e=9.8*Math.sqrt(s);o.calculate_step_count(e,t);var n=o.get_final_step_count(),r=o.get_step_length();o.get_step_count_cover_vpas();var a=o.get_vpas_success_count(),l=o.get_distance_vpas(),h=o.get_distance_step_odometry(),c=o.get_calibrate_step_length_scale(),d=o.get_reloc_distance_to_last(),f=o.get_vpas_reloc_jump_count()}let u={};return void 0===n&&(n=0),void 0===a&&(a=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===r&&(r=0),void 0===h&&(h=0),void 0===l&&(l=0),void 0===c&&(c=0),u.step=n,u.stepLength=r,u.stepLengthScale=c,u.vpasCount=a,u.relocDistanceToLast=d,u.vpasJumpCount=f,u.vpasDistance=l,u.distanceStepOdometry=h,u}odometryFunc(t,e,i,o){if(o&&o.set_device_platform){o.odometry(t,e,i);let s=[];for(let t=0;t<12;t++)s.push(o.get_odometry_pose(t));return s}}odometryFusionFunc(t,e){if(e){e.odometry_ekf(t);let i=[];for(let t=0;t<12;t++)i.push(e.get_odometry_pose(t));return i}}locationOnceSuccessFun(t,e){let i=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],s=[0,0,0],n=null,r=null,l=null,h=null,c=null,d=0;t.track_frame(1);let f=[],u=[],p=[-1,-1,0];for(let e=0;e<12;e++)f.push(t.get_fusion_pose(e)),u.push(t.get_fusion_pose(e));u[10]*=-1;let y=3;if(t.get_vpas_translation_from_geo)for(let e=0;e<3;e++)p[e]=t.get_vpas_translation_from_geo(e);if(-1!==p[0]&&-1!==p[1]){for(let t=0;t<u.length;t++)u[t]=0;u[0]=p[0],u[1]=p[1],y=1}let m=a(u);for(let t=0;t<3;t++)i[t]=f[t];i[4]=f[3],i[5]=f[4],i[6]=f[5],i[8]=f[6],i[9]=f[7],i[10]=f[8],s[0]=f[9],s[1]=f[10],s[2]=f[11],t.transform_translation_gl_to_map_coordinate(f[9],f[10],f[11]);for(let e=0;e<12;e++)f[e]=t.get_map_transform_matrix(e);for(let t=0;t<3;t++)o[t]=f[t];o[4]=f[3],o[5]=f[4],o[6]=f[5],o[8]=f[6],o[9]=f[7],o[10]=f[8],n=e.handleCameraPose(i,s,o,this.locSuccess),this.locSuccess=!1,r=n[0],l=n[1].x,h=n[2],d=n[3];let g=[];for(let e=0;e<2;e++)g[e]=t.get_transform_map_coordinate(e);let v=n[5],w=[];if(void 0!==v)for(let e=0;e<v.length;e++){let i=v[e];t.transform_translation_gl_to_map_coordinate(i[0],i[1],i[2]);let o=[];for(let e=0;e<2;e++)o[e]=t.get_transform_map_coordinate(e);w.push(o)}let b={locX:g[0],locY:g[1],posePriors:m,priorConfidence:1,priorType:y,odometry_translationOne:s[0],odometry_translationTwo:s[1],remainingWayPointsLoc:w};return null!==n&&(b.distance=r,b.orientation=l,b.distanceToNextPoint=h,b.type=d),void 0!==n[4]&&0===n[4]?(c=0,b.yaw=c):void 0!==n[4]&&1===n[4]?(c=1,b.yaw=c):void 0!==n[4]&&2===n[4]&&(c=2,b.yaw=c),i.length=0,o.length=0,f.length=0,u.length=0,p.length=0,b}getProtoDefault(t){let e=[];return e.push(t.f1),e.push(t.f2),e.push(t.f3),e.push(t.f4),e.push(t.f5),e.push(t.f6),e.push(t.f7),e.push(t.f8),e.push(t.f9),e.push(t.f10),e.push(t.f11),e.push(t.f12),e}locationSuccessEvery(t,e){if(this.haveMapTransform){for(let e=0;e<12;e++)t.set_map_transform_matrix(this.scale,this.transform_matrix[e],e);this.haveMapTransform=!1}if(this.haveGeoMapTransform){for(let e=0;e<12;e++)t.set_geo_to_vpas_transform_matrix(1,this.geo_map_transform_matrix[e],e);this.haveGeoMapTransform=!1}let i=this.getProtoDefault(e.vpsPose);for(let e=0;e<i.length;e++)t.set_vpas_pose(i[e],e);let o=this.getProtoDefault(e.trackerPose);for(let e=0;e<o.length;e++)t.set_last_step_odometry_pose(o[e],e);t.transform_vpas_pose_to_world();let s=t.get_vpas_pose_c2w(9),n=t.get_vpas_pose_c2w(10),r=t.get_vpas_pose_c2w(11);if(0!==t.track_frame(1))return null;let a=[0,0,0],l=[];for(let e=0;e<12;e++)l.push(t.get_fusion_pose(e));a[0]=l[9],a[1]=l[10],a[2]=l[11],t.transform_translation_gl_to_map_coordinate(l[9],l[10],l[11]);let h=[];for(let e=0;e<2;e++)h[e]=t.get_transform_map_coordinate(e);t.transform_translation_gl_to_map_coordinate(s,n,r);let c=[];for(let e=0;e<2;e++)c[e]=t.get_transform_map_coordinate(e);let d={locX:h[0],locY:h[1],vpasX:s,vpasY:n,vpasLocX:c[0],vpasLocY:c[1]};return a.length=0,this.locSuccess=!0,d}}const f=i(30);let u,p,y=i(31),m=i(38),g=y.Root.fromJSON(m),v=g.lookup("bdarvps.BdarVector12f"),w=g.lookup("bdarvps.BdarVector9f"),b=g.lookup("bdarvps.BdarVector5f"),_=g.lookup("bdarvps.BdarVector3d"),x=g.lookup("bdarvps.BdarVector3f"),P=g.lookup("bdarvps.BdarVector4f"),T=g.lookup("bdarvps.BdarVPSRequestData"),A=g.lookup("bdarvps.BdarVPSResponseDataList"),M=g.lookup("bdarvps.LocationResponse"),C=(wx.getFileSystemManager(),"default_user"),S=0,E=null;function O(t,e,i,o,s,n="default_user"){if(C=n,null!==t){E=t;let o=f.getCameraParam(i.pixelWidth,i.pixelHeight),n=function(t,e,i){let o=t.getContext("2d"),s=o.createImageData(e.width,e.height);s.data.set(new Uint8ClampedArray(e.data)),o.putImageData(s,0,0);let n=t.toDataURL("image/jpeg",.5).substr(23);const r=wx.base64ToArrayBuffer(n);void 0!==i.onSaveImg&&i.onSaveImg(r);return new Uint8Array(r)}(e,{width:i.pixelWidth,height:i.pixelHeight,data:i.pixels},s),c=3,d=2;void 0===i.acc&&(i.acc=[0,0,0]),S=++S;let u={sampleRate:1,trackerData:[{pose:v.create(a(i.odometry)),poseOrig:v.create(a(i.odometry)),timestamp:r((new Date).getTime()),frameId:S,status:1,magnet:{x:0,y:0,z:0}}],localizerData:[]},p={status:r(i.ocrStatus),roiCoordinate:P.create(a(i.ocrCoordinate))},y={methodType:1,trackerType:1,phoneType:r(i.phonetype),userId:r(C),frameId:S,timestamp:r(String((new Date).getTime())),posePriors:i.posePriors,trackerOptimizeData:u,trackerStatus:!0,trackerPose:v.create(a(i.odometry)),cameraIntrinsics:w.create(a(o.intrinstics)),cameraDistort:b.create(a(o.undistorts)),gps:_.create({x:i.lat,y:i.lng,z:1}),gravityDirection:x.create((l=i.acc,h={},h.x=l[0],h.y=l[1],3===l.length&&(h.z=l[2]),h)),imu:v.create(a([1,0,0,0,1,0,0,0,1,0,0,0])),frame:n,frameWidth:i.pixelWidth,frameHeight:i.pixelHeight,frameChannels:c,frameCompressType:d,requestCorrespondence:!1,sessionId:r(t),version:r("mini_6.0.0"),sceneType:2,bdarOCRPrior:p,floorId:r(i.floorId.toUpperCase())};return T.encode(T.create(y)).finish().slice().buffer}var l,h}let I,k=!1;class R{constructor(t){this._configData=t}createSession(t){u=t;let e,i,o=(new Date).getTime();return this._configData.map.forEach(e=>{e.floor_id===t.floor_id&&(i=e)}),this.baseURL=this._configData.interface.baseURL,console.log("createSession-this.baseURL",this.baseURL),{task:new Promise((t,s)=>{e=wx.request({url:this.baseURL+this._configData.interface.sessionInterface,method:"POST",data:{app_id:i.app_id,poi_id:i.poi_id,map_id:i.map_id,timestamp:o,sign:h({app_id:i.app_id,poi_id:i.poi_id,map_id:i.map_id,timestamp:o})},headers:{"Content-Type":"application/json; charset=UTF-8",Connection:"keep-alive"},success:e=>{0===e.data.err_code&&(console.log("createSssion",e),k=!1,p=e.data.data.session_id,t(e))},fail(t){s({msg:"创建session请求失败",data:t})}})}),taskController:e}}sendTrackframe(t){let e;return this.baseURL=this._configData.interface.baseURL,{trackframe:new Promise((i,o)=>{e=wx.request({url:this.baseURL+this._configData.interface.trackFrameInterface,method:"POST",data:t,headers:{"Content-Type":"multipart/protobuf",Connection:"keep-alive"},dataType:"protobuf",responseType:"arraybuffer",success:t=>{let e=function(t,e,i){let o=M.decode(t.data);if(0===o.errCode&&o.data){return A.decode(o.data)}i||e.onError({type:10004,msg:o.errMsg+" err_code:"+o.errCode})}(t,u,k);if(void 0===e)return{undefined:void 0,undefined:void 0};let o={};e.data.map(t=>{t.clientResult&&(o.floor=t.clientResult.floorId?l(t.clientResult.floorId):"",o.buildingId=t.clientResult.buildingId?l(t.clientResult.buildingId):"",o.locPoint=t.clientResult.locationPoint),t.session&&(o.session=l(t.session)),t.mapInfo&&t.mapInfo.mapTag&&(o.mapTag=l(t.mapInfo.mapTag)),o.vpsStatusMsg=t.vpsStatusMsg,!0===t.vpsStatus?(o.vpsStatus=t.vpsStatus,o.vpsPose=t.vpsPose,o.trackerPose=t.trackerPose,i(o)):(o.vpsStatus=!1,i(o))})},fail:t=>{o(t),console.log(t)}})}),trackframeController:e}}destroylocatesession(){this.baseURL=this._configData.interface.baseURL,console.log("destroylocatesession-this.baseURL",this.baseURL);let t,e=(new Date).getTime();if(void 0!==p){return{destroy:new Promise((i,o)=>{t=wx.request({url:this.baseURL+this._configData.interface.destroySessionInterface,method:"POST",data:{session_id:p,timestamp:e,app_id:0,sign:h({session_id:p,timestamp:e,app_id:0})},headers:{"Content-Type":"application/json; charset=UTF-8",Connection:"keep-alive"},success:t=>{console.log("destroylocatesession",t.data),0!==t.data.err_code?(u.onError({type:10006,msg:t.data.err_msg}),console.log(t.data.err_msg)):i(t.data),p=void 0},fail:t=>{o({msg:"销毁session请求失败",data:t}),p=void 0}})}),destroyController:t}}}getMapPoi(t){let e,i=((new Date).getTime()/1e3).toFixed();return{getPoi:new Promise((o,s)=>{e=wx.request({url:this._configData.interface.getMapPoiBaseUrl+this._configData.interface.getMapPoiInterface,method:"POST",data:{case_id:t,timestamp:Number(i),sign:c({case_id:t,timestamp:Number(i)})},headers:{"Content-Type":"application/json; charset=UTF-8",Connection:"keep-alive"},success:t=>{o(t)},fail(t){s({msg:"获取poi数据失败",data:t})}})}),getPoiController:e}}}function D(t,e){let i=e.x-t.x,o=e.y-t.y;return 0===i&&0===o?0:Math.atan2(o,i)-Math.PI/2}function L(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}let N,V,F=null,B=0,j=!1,W=!1,z=!1,U=!1,H=!1,q=null,J=0,X="",$={f1:0,f2:0,f3:0,f4:0},Z=[],G=0,Y=0,K=0,Q=0;const tt=i(15);class et{constructor(t,e,i,o,s){this.renderer=e,this._configData=t,this.option=i,void 0===I&&this.initWXwasm(),this.cContex=wx.createCameraContext(),this.initSystemInfo(),this.initGyroscope(),this.initDevice(),this.initAccelerometer(),this.allSuccessProxy=o,this.initCamera(o,s),this.algorithm=new d,this.severInterface=new R(this._configData),this.isPark=!1,this.hasIndoorLoc=!1,this.ak="",this.minTimeQueryServer=1e3,this.haveReceiveSessionMsg=!0,this.haveTrackFrame=!1,this.minDistanceToFinalThreshold=this._configData.minTriggerDistance.final,this.minDistanceToTransferThreshold=this._configData.minTriggerDistance.transfer,this.btDataPath=null,this.startTime=0,this.geo_map_transform_matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.with_bt_but_not_work=!1,this.userId="default_user"}forEachMap(){let t=this;t._configData.map.forEach(e=>{e.floor_id===t.locationOption.floor_id&&(console.log("item.ak =",e.ak),""===e.ak||void 0===e.ak?t.locationOption.onBluetoothAndScanStatus({type:100,msg:"只开启ocr扫描"}):(t.ak=e.ak,console.log("需要打开蓝牙 ak = ",t.ak),wx.getSetting({success(e){e.authSetting["scope.bluetooth"]?(wx.openBluetoothAdapter({success:e=>{t.locationOption.onBluetoothAndScanStatus({type:1,msg:"蓝牙已打开"}),t.getWxBtLocation()},fail:e=>{console.log("打开蓝牙错误:",e),t.locationOption.onBluetoothAndScanStatus({type:99,msg:"提示打开蓝牙"})}}),wx.onBluetoothAdapterStateChange((function(e){t.locationOption.onBluetoothAndScanStatus({type:e.available,msg:"打开蓝牙"})}))):wx.authorize({scope:"scope.bluetooth",success(){wx.openBluetoothAdapter({success:e=>{t.locationOption.onBluetoothAndScanStatus({type:1,msg:"蓝牙已打开"}),t.getWxBtLocation()},fail:e=>{console.log("打开蓝牙错误:",e),t.locationOption.onBluetoothAndScanStatus({type:99,msg:"提示打开蓝牙"})}}),wx.onBluetoothAdapterStateChange((function(e){t.locationOption.onBluetoothAndScanStatus({type:e.available,msg:"打开蓝牙"})}))}})}})))})}initSystemInfo(){let t;wx.getSystemInfo({success:e=>{this.phonetype=e.system,console.log("phonetype = ",this.phonetype),t=e.platform}}),"ios"===t&&(B=1),function(t){let e=t.getAccountInfoSync().miniProgram.appId;e=tt(e+"*-#-$--%%%=216").toUpperCase();for(let t=0;t<e.length;t++){let i=e[t].charCodeAt();J+=i}}(wx)}setAlgoParam(){I.enable_vpas_reloc_jump_filter(1),I.set_open_vpas_step_length(1),I.set_reloc_threshold(2),I.set_bt_opti_distance(15)}initWXwasm(){let t=this;WXWebAssembly.instantiate("/wasm/module_basic.wasm",{}).then(e=>{I=e.instance.exports;I.constructor();t.setAlgoParam(),console.log("WXWebAssembly-初始化成功");I.add_test()},t=>{console.log("WXWebAssembly-初始化失败",t)})}initGyroscope(){wx.startGyroscope({interval:"game"}),wx.onGyroscopeChange(t=>{let e=1e6*(new Date).getTime();void 0!==I&&I.process_gyro(t.x,t.y,t.z,e)})}stopGyroscope(){wx.stopGyroscope({success:t=>{},fail:t=>{}})}initAccelerometer(){wx.startAccelerometer({interval:"game"}),wx.onAccelerometerChange(t=>{{let e=1e6*(new Date).getTime();void 0!==I&&I.process_acc(9.8*t.x,9.8*t.y,9.8*t.z,e)}let e=this.algorithm.stepFunc(t.x,t.y,t.z,I);e.acc=[(9.8*t.x).toFixed(2),(9.8*t.y).toFixed(2),(9.8*t.z).toFixed(2)],void 0!==this.orientation?e.orientation=[this.orientation[0].toFixed(2),this.orientation[1].toFixed(2),this.orientation[2].toFixed(2)]:e.orientation=[0,0,0],this.acc=[9.8*t.x,9.8*t.y,9.8*t.z],this.locationOption.onStep(e),void 0!==this.locationOption.onSaveAcc&&this.locationOption.onSaveAcc(this.acc)})}stopAccelerometer(){wx.stopAccelerometer({success:t=>{console.log("success = ",t)},fail:t=>{console.log("fail = ",t)}})}initDevice(){wx.startDeviceMotionListening({interval:"game"}),wx.onDeviceMotionChange(t=>{{let t=1e6*(new Date).getTime();F=this.algorithm.odometryFusionFunc(t,I)}this.orientation=[t.alpha,t.beta,t.gamma],Math.abs(t.beta)<45&&this.allSuccessProxy.firstTrackFrameSuccess&&void 0!==this.locationOption&&this.locationOption.onError({type:10010,msg:"手机姿态异常"})})}stopDevice(){wx.stopDeviceMotionListening({success:t=>{console.log("success = ",t)},fail:t=>{console.log("fail = ",t)}})}setLoactionData(t,e){this.locationOption=t,e.map.forEach(e=>{if(e.floor_id===t.floor_id){if(this.ak=e.ak,this.algorithm.set_map_transform(e.transform_matrix,e.scale),void 0!==e.geo_map_transform_matrix&&(this.geo_map_transform_matrix=e.geo_map_transform_matrix,this.algorithm.set_geo_map_transform(e.geo_map_transform_matrix)),void 0!==I)for(let t=0;t<12;t++)I.set_geo_to_vpas_transform_matrix(1,this.geo_map_transform_matrix[t],t);0===e.is_park||void 0===e.is_park?(this.isPark=!1,X=""):(this.isPark=!0,X=e.is_ocr)}}),this.startLocation=!0}setCanvasData(t){this._canvas=t}setGlCanvas(t){this.gl_canvas=t}initCamera(t,e){let i,s;V=(new Date).getTime(),N=V;let n=!1,r=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],l=[-1,-1,0],h=3;i=this.cContex.onCameraFrame(t=>{if(n||void 0!==this._canvas&&(this._canvas.width=t.width,this._canvas.height=t.height,n=!0),n){let i=o(t);if(0===$.f1&&0===$.f2&&0===$.f3&&0===$.f4&&this.isPark){console.log("canvas size = ",this.gl_canvas.width/3,this.gl_canvas.height/3,i.width,i.height);let t=this.gl_canvas.width/3*4/5,e=this.gl_canvas.height/3*1/10,o=(this.gl_canvas.height/3-e)/2,s=(this.gl_canvas.width/3-t)/2;$=function(t,e,i,o,s,n,r,a){let l=t-(s-r)/2,h=e-(n-a)/2;return[l,h,i+l,o+h]}(s,o,t,e,this.gl_canvas.width/3,this.gl_canvas.height/3,i.width,i.height)}if(null!==F&&!0===this.startLocation&&void 0!==this._canvas){null===q&&this.haveReceiveSessionMsg&&(this.severInterface.createSession(this.locationOption).task.then(t=>{0===t.data.err_code?q=t.data.data.session_id:(this.locationOption.onError({type:10003,msg:t.data.msg}),console.log(t.data.msg)),this.haveReceiveSessionMsg=!0}),this.haveReceiveSessionMsg=!1);let t=(new Date).getTime(),o=t-V,n=t-N;if(null!==q&&this.haveReceiveSessionMsg){let t={};if(o>this.minTimeQueryServer&&!H&&!this.haveTrackFrame&&void 0!==this.acc){if(this.haveTrackFrame=!0,""!==this.ak&&void 0!==this.ak){if(I.get_vpas_translation_from_geo)for(let t=0;t<3;t++)l[t]=I.get_vpas_translation_from_geo(t);if(-1!==l[0]&&-1!==l[1]&&l[0]!==Number.NaN&&l[1]!==Number.NaN&&"<NaN>"!==l[0]&&"<NaN>"!==l[1]){r[0]=l[0],r[1]=l[1],h=1;let t={type:h,prior:null,priorAccuracy:10,priorConfidence:0},e=a(r),i=1;t.prior=e,t.priorConfidence=i,Z[0]=t,this.with_bt_but_not_work=!1}else this.with_bt_but_not_work=!0,this.haveTrackFrame=!1}if(void 0!==this.renderer.priorCrossFloor&&!this.allSuccessProxy.firstTrackFrameSuccess){I.transform_map_coodinate_to_translation(this.renderer.priorCrossFloor[0],this.renderer.priorCrossFloor[1]);let t=[];for(let e=0;e<2;e++)t[e]=I.get_transform_vpas_translation(e);r[0]=t[0],r[1]=t[1],h=1;let e={type:h,prior:null,priorAccuracy:10,priorConfidence:0},i=a(r),o=1;e.prior=i,e.priorConfidence=o,Z[0]=e}s={pixels:i.data,pixelWidth:i.width,pixelHeight:i.height,phonetype:this.phonetype,lng:void 0,lat:void 0,posePriors:Z,odometry:F,ocrStatus:X,ocrCoordinate:$,acc:this.acc,deviceOrientation:this.orientation,floorId:this.locationOption.floor_id};let o=O(q,this._canvas,s,0,this.locationOption,this.userId);if(o!=={}&&!this.with_bt_but_not_work){let i=this.severInterface.sendTrackframe(o).trackframe;if(void 0===i)return void(this.haveTrackFrame=!1);V=(new Date).getTime(),Q+=1,i.then(i=>{if(this.haveTrackFrame=!1,!0===i.vpsStatus&&this.startLocation){X="",t.vpsStatus=i.vpsStatus,t.vpsPose=i.vpsPose,t.trackerPose=i.trackerPose;let o=this.algorithm.locationSuccessEvery(I,t);if(null===o)j=!1;else{N=(new Date).getTime(),j=!0,i.locX=o.locX,i.locY=o.locY,i.vpasX=o.vpasX,i.vpasY=o.vpasY,G=o.vpasX,Y=o.vpasY,this.allSuccessProxy.firstTrackFrameSuccess||(Object.assign(e,i,{wasmFunction:I}),this.allSuccessProxy.firstTrackFrameSuccess=!0,this.minTimeQueryServer=this._configData.minTimeQueryServer),K+=1;let t={locStatus:!0,locX:o.locX,locY:o.locY};this.locationOption.onLocateEvent(t)}}else{let t={locStatus:!1};this.locationOption.onLocateEvent(t)}-1===i.vpsStatusMsg&&(console.log("无效的车位号"),this.locationOption.onError({type:10009,msg:"无效的车位号"})),(!1===i.vpsStatus&&!1===this.allSuccessProxy.firstTrackFrameSuccess||!1===j)&&(n>5e3&&!1===W&&(this.locationOption.onError({type:10005,msg:"首帧定位超时5s"}),W=!0),n>8e3&&!1===z&&(this.locationOption.onError({type:10007,msg:"首帧定位超时8s"}),z=!0))}),this.haveTrackFrame=!1}}}}if(U&&this.allSuccessProxy.firstTrackFrameSuccess&&!H){let t=this.algorithm.locationOnceSuccessFun(I,this.renderer);if(null===t)return;let e={type:t.priorType,prior:null,priorAccuracy:10,priorConfidence:0};e.prior=t.posePriors,e.priorConfidence=t.priorConfidence,Z[0]=e,t.vpasX=G,t.vpasY=Y,this.locationOption.distanceOfNextPoint(t.distanceToNextPoint),this.locationOption.onEverySuccess(t),7===t.type?t.distance<this.minDistanceToFinalThreshold&&this.locationOption.onArrive({type:t.type}):t.distanceToNextPoint<this.minDistanceToTransferThreshold&&this.locationOption.onArrive({type:t.type}),0===t.yaw?this.locationOption.onYaw({type:0,msg:"左偏"}):1===t.yaw?this.locationOption.onYaw({type:1,msg:"右偏"}):2===t.yaw&&this.locationOption.onYaw({type:2,msg:"不偏"})}}}),i.start()}startARTrue(t){U=t}updateBluetoothLocation(t,e){if(!1!==this.startLocation&&void 0!==I){if(0===I.get_geo_to_vpas_transform_matrix(0)&&0===I.get_geo_to_vpas_transform_matrix(1))for(let t=0;t<12;t++)I.set_geo_to_vpas_transform_matrix(1,this.geo_map_transform_matrix[t],t);I.calculate_geo_to_vpas_translation(t,e)}}setUserId(t){this.userId=t}resetARTrue(t){H&&(this.initGyroscope(),this.initDevice(),this.initAccelerometer()),H=t,q=null,V=(new Date).getTime(),N=(new Date).getTime(),this.minTimeQueryServer=1e3,W=!1,z=!1}stopARTrue(t){W=!0,z=!0,U=!1,H=t,this.allSuccessProxy.firstTrackFrameSuccess=!1,this.startLocation=!1,Z=[],K=0,Q=0,this.stopAccelerometer(),this.stopDevice(),this.ak="",this.with_bt_but_not_work=!1}release(t){I.reset()}getWxBtLocation(){}stopBtMapLocation(){}createSaveBtDataFile(){let t=(new Date).getTime();this.btDataPath=wx.env.USER_DATA_PATH+"/"+t+".txt";wx.getFileSystemManager().open({filePath:this.btDataPath,flag:"a+",success(t){console.log(t)}}),console.log("文件路径",this.btDataPath)}saveBtdata(){if(null===this.btDataPath)return;let t=(new Date).getTime()+" \n";wx.getFileSystemManager().appendFile({filePath:this.btDataPath,data:t,success:function(t){console.log("文件路径",this.btDataPath),console.log("保存文档",t)}})}saveBtDataBtn(){let t=(new Date).getTime(),e=wx.env.USER_DATA_PATH+"/"+t+".txt";const i=wx.getFileSystemManager();i.open({filePath:e,flag:"a+",success(t){console.log(t)}}),console.log("蓝牙定位数据文件路径",e);let o=(new Date).getTime()+" \n";i.writeFile({filePath:e,data:o,success(t){console.log("我是查找",t)},fail(t){console.error(t)}})}}class it{constructor(t,e){this.sp=t,this.ep=e}length(){return this.ep.distanceTo(this.sp)}direction(){return this.ep.clone().sub(this.sp).setLength(1)}}class ot{constructor(t){this.segments=new Array;for(let e=0;e<t.length-1;e++)this.segments.push(new it(t[e],t[e+1]))}sampling(t){let e=new Array;e.push(this.segments[0].sp.clone());let i=0,o=0,s=t,n=e[0].clone(),r=!1;for(;!1===r;){let a=this.segments[i].length()-o;if(a>=s){let r=n.add(this.segments[i].direction().multiplyScalar(s));e.push(r),n=r.clone(),o+=s,s=t}else s-=a,n=this.segments[i].ep.clone(),i+=1,o=0;i>=this.segments.length&&(r=!0)}return e}}class st{constructor(t,e,i,o,s,n){this.THREE=t,this.scene=e,this.camera=i,this.onResLoaded=o,this.onScreenModelInfo=s.onScreenArrow,this.onScreenModel=void 0,this.loadArrowModel(n),this.position=new t.Vector3(0,-.05,-.25)}loadArrowModel(t){let e=this.THREE,i=this.onScreenModelInfo.arrowURL.split("/"),o=i[i.length-1],s=this.onScreenModelInfo.arrowURL.replace(o,""),n=this.onScreenModelInfo.arrowPosition,r=this.onScreenModelInfo.arrowRotation,a=this.onScreenModelInfo.arrowScale;const l=(new e.GLTFLoader).setPath(s);let h=this;l.load(o,(function(e){h.onScreenModel=e.scene,h.onScreenModel.position.set(n[0],n[1],n[2]),h.onScreenModel.scale.set(a[0],a[1],a[2]),h.onScreenModel.visible=!1,h.onScreenModel.rotateX(r[0]),h.onResLoaded(),console.log("Arrow on screen (3 dof) has loaded"),h.camera.add(h.onScreenModel),t.hasOnScreenArrowLoaded=!0}))}setScreenArrowPosition(t){this.position=t}reset(t){void 0!==this.onScreenModel&&(this.onScreenModel.visible=!1,t&&(this.camera.remove(this.onScreenModel),this.onScreenModel=void 0))}release(){void 0!==this.onScreenModel&&(this.onScreenModel.visible=!1,this.camera.remove(this.onScreenModel),this.onScreenModel=void 0)}hide(){void 0!==this.onScreenModel&&(this.onScreenModel.visible=!1)}update(t){void 0!==this.onScreenModel?(this.onScreenModel.visible=!0,this.onScreenModel.position.set(this.position.x,this.position.y,this.position.z),this.onScreenModel.quaternion.x=t.x,this.onScreenModel.quaternion.y=t.y,this.onScreenModel.quaternion.z=t.z,this.onScreenModel.quaternion.w=t.w,this.onScreenModel.rotateZ(Math.PI)):console.log("this.onScreenModel === undefined")}}class nt{constructor(t,e,i,o,s,n){this.THREE=t,this.scene=e,this.camera=i,this.onResLoaded=o,this.arrowRenderMode=2,this.arrowInfo=s.arrow,this.finalInfo=s.final,this.onScreenArrowCtrl=new st(t,e,i,o,s,n),this.arrows=[],this.allFinalWayPointsModel=[],this.loadArrowModel(n),this.loadFinalModel(0,0,0),this.inited=!1,this.oneMaterial=new t.MeshStandardMaterial({color:350973}),this.twoMaterial=new t.MeshStandardMaterial({color:41120}),this.allModels=[],this.allModelsStatus=[1,1,1,1,1,1],this.frameCount=0,this.intervalCount=15,this.showArrowCount=6,this.lastWayPointPosition=void 0,this.speed=s.arrow.arrowMoveSpeed,this.time=[],this.localWayPoints=[],this.destination=[],this.positionKF=null,this.mixer=null,this.clipAction=null,this.clip=null,this.clock=new t.Clock,this.moveArrow=null,this.localNextPoint=[30,0,0],this.localNextNextPoint=[0,20,0],this.localNextNextNextPoint=[0,0,0],this.newLocalNextPoint=[0,0,0],this.newLocalNextNextPoint=[0,0,0],this.cameraPosition=[0,0,0],this.moveStart=!0,this.totalTime=0,this.totalCountTime=0,this.moveArrowRenderMode=!0,this.moveArrowShowDistance=s.arrow.showDistance,this.finalShowDistance=s.final.showDistance,this.startTime=0,this.intervalTime=0,this.lastRadians=0,this.lostUpdateTime=0,this.segmentNum=2,this.locationOption=null,this.timeOut=this.arrowInfo.downloadTimeout}setScreenArrowPosition(t){void 0!==this.onScreenArrowCtrl&&this.onScreenArrowCtrl.setScreenArrowPosition(t)}loadFinalModel(t,e,i){let o=this.THREE,s=this.finalInfo.URL.split("/"),n=s[s.length-1],r=this.finalInfo.URL.replace(n,""),a=this.finalInfo.rotation,l=this.finalInfo.scale;const h=(new o.GLTFLoader).setPath(r);let c=this;h.load(n,(function(o){let s=o.scene;s.position.set(t,e,i),s.scale.set(l[0],l[1],l[2]),s.rotateX(a[0]),s.visible=!1,c.allFinalWayPointsModel.push(s),c.scene.add(s)}))}loadArrowModel(t){let e=this.THREE,i=this.arrowInfo.arrowURL.split("/"),o=i[i.length-1],s=this.arrowInfo.arrowURL.replace(o,""),n=this.arrowInfo.arrowPosition,r=this.arrowInfo.arrowRotation,a=(new e.GLTFLoader).setPath(s),l=this;a.load(o,(function(e){l.arrow_prototype=e.scene,l.arrow_prototype.position.set(n[0],n[1],n[2]),l.arrow_prototype.visible=!1,l.arrow_prototype.rotateX(r[0]),l.onResLoaded(),t.hasNavigationArrowLoaded=!0,console.log("Moving arrow has loaded")}))}setMoveArrow(){if(void 0===this.arrow_prototype)return;let t=this.arrow_prototype.clone();t.scale.set(100,100,100),t.rotateZ(Math.PI/2),t.rotateX(-Math.PI/2),t.visible=!1,this.moveArrow=t.clone(),this.moveArrow.position.set(0,0,0),1!==this.arrowRenderMode&&this.scene.add(this.moveArrow)}setArrow(t){let e=this.arrow_prototype.clone();e.position.set(t.x,t.y,t.z),e.scale.set(this.arrowInfo.arrowScale[0],this.arrowInfo.arrowScale[1],this.arrowInfo.arrowScale[2]),e.rotateZ(this.arrowInfo.arrowRotation[2]),e.rotateX(this.arrowInfo.arrowRotation[0]),e.rotateY(this.arrowInfo.arrowRotation[1]),e.visible=!1,this.arrows.push(e),this.moveArrow=e.clone(),this.moveArrow.position.set(this.arrowInfo.arrowPosition),1!==this.arrowRenderMode&&(this.scene.add(e),this.scene.add(this.moveArrow))}setArrowRenderMode(t){this.arrowRenderMode=t,console.log("this.arrowRenderMode = ",this.arrowRenderMode),0===this.arrowRenderMode&&void 0!==this.onScreenArrowCtrl&&this.onScreenArrowCtrl.reset()}updateRoute(t,e,i){this.lastWayPointPosition=t[t.length-1].clone(),t.push(e),this.locationOption=i;let o=(new Date).getTime(),s=0;for(;void 0===this.arrow_prototype;){if(this.locationOption.onResourceLoaded({status:-1}),(new Date).getTime()-o>=this.timeOut&&(this.loadArrowModel(),o=(new Date).getTime(),s+=1),2===s)return this.locationOption.onResourceLoaded({status:-2}),void console.log("load arrow model time is out")}this.locationOption.onResourceLoaded({status:0}),void 0!==this.allFinalWayPointsModel[0]&&(this.allFinalWayPointsModel[0].position.set(e.x,e.y,e.z-0),this.scene.add(this.allFinalWayPointsModel[0]));let n=new ot(t).sampling(1);this.arrows.length=0;for(let t=0;t<n.length;t++){let e=n[t];this.setArrow(e)}if(!this.moveArrowRenderMode)for(let t=0;t<this.arrows.length;t++){let i=this.arrows[t],o=this.arrows[0];t===this.arrows.length-1?i.lookAt(e):(o=this.arrows[t+1],i.lookAt(o.position.x+.01,o.position.y,o.position.z)),i.rotateY(Math.PI),i.rotateZ(Math.PI/2)}this.inited=!0}calculateNaviArrowOrientation(t,e,i){let o=this.THREE,s=new o.Vector3(1,0,0),n=0,r=Number.MAX_VALUE;for(let e=0;e<this.arrows.length-1;e++){let i=t.x-this.arrows[e].position.x,o=t.y-this.arrows[e].position.y,s=t.z-this.arrows[e].position.z,a=Math.pow(i,2)+Math.pow(o,2)+Math.pow(s,2);a<r&&(r=a,n=e)}n===this.arrows.length-1&&(n-=1);let a=new o.Vector3(-t.x+e.x,-t.y+e.y,0),l=new o.Vector3;l.crossVectors(s,a);let h=s.angleTo(a);return l.z<0&&(h*=-1),[h-Math.PI/2,n]}animateArrows(){this.frameCount++;for(let t=0;t<this.allModels.length;++t){if(this.frameCount>=t*this.intervalCount&&this.frameCount<(t+1)*this.intervalCount)for(let e=0;e<this.allModelsStatus.length;++e)this.allModelsStatus[e]=e===t?0:1;this.frameCount===this.allModels.length*this.intervalCount&&(this.frameCount=0)}let t=this;for(let e=0;e<this.allModels.length;++e){let i=0;void 0!==this.allModels[e]&&this.allModels[e].traverse((function(o){o.isSkinnedMesh&&(o.castShadow=!0),o.isMesh&&(1===i&&(0===t.allModelsStatus[e]?o.material=t.oneMaterial:o.material=t.twoMaterial),i++)}))}}reset(t){for(let e=0;e<this.allFinalWayPointsModel.length;e++){let i=this.allFinalWayPointsModel[e];this.scene.remove(i),t&&(i=void 0)}for(let e=0;e<this.arrows.length;e++){let i=this.arrows[e];this.scene.remove(i),t&&(i=void 0)}this.arrows.length=0,this.allModels.length=0,this.allModelsStatus.length=0,this.allModels=[],this.allModelsStatus=[],this.scene.remove(this.moveArrow),t&&(null!==this.moveArrow&&(this.moveArrow=null),this.allFinalWayPointsModel[0]=void 0,this.allFinalWayPointsModel.length=0),void 0!==this.onScreenArrowCtrl&&this.onScreenArrowCtrl.reset(t),this.oneMaterial.dispose(),this.twoMaterial.dispose(),this.lastRadians=0,t&&(this.clock&&(this.clock=null),this.positionKF&&(this.positionKF=null),this.mixer&&(this.mixer=null),this.clip&&(this.clip=null),this.clipAction&&(this.clipAction=null))}hideFinalModel(){for(let t=0;t<this.allFinalWayPointsModel.length;t++){const e=this.allFinalWayPointsModel[t];e.visible=!1,this.scene.remove(e)}}hideMoveArrowModel(){this.moveArrow.visible=!1,this.scene.remove(this.moveArrow)}waypointOrientation(t,e,i){let o=this.THREE,s=new o.Vector3,n=new o.Vector3;s.subVectors(t,i),n.subVectors(e,t),s.normalize(),n.normalize();let r=s.dot(n)/(s.length()*n.length());return r>1&&(r=1),Math.acos(r)}getFootOfPerpendicular(t,e,i){let o=this.THREE;const s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];if(Math.abs(s)<1e-8&&Math.abs(n)<1e-8&&Math.abs(r)<1e-8)return e;let a=(t.x-e[0])*(e[0]-i[0])+(t.y-e[1])*(e[1]-i[1])+(t.z-e[2])*(e[2]-i[2]);return a/=Math.pow(s,2)+Math.pow(n,2)+Math.pow(r,2),new o.Vector3(e[0]+a*s,e[1]+a*n,e[2]+a*r)}decidePointBetweenTwo(t,e,i){if(void 0===t||void 0===e||void 0===i)return!1;let o=this.getFootOfPerpendicular(t,e,i),s=new this.THREE.Vector3(e[0],e[1],e[2]),n=new this.THREE.Vector3(i[0],i[1],i[2]);this.distanceCameraToFootPoint=L(o,t),this.segmentLength=L(s,n),this.footPointToFirstPointDistance=L(s,o);let r=new this.THREE.Vector3;r.subVectors(s,o);let a=new this.THREE.Vector3;a.subVectors(n,o);let l=r.dot(a)/(r.length()*a.length());l>1&&(l=1),l<-1&&(l=-1);let h=180*Math.acos(l)/Math.PI;return!(h>=0&&h<90)}update(t,e,i,o,s,n,r,a){if(0===s.length)return console.error("Error:::remainingWayPoints length is 0!"),[void 0,void 0,void 0,void 0];n||r||(this.isAlmostArrive=3===o||4===o||5===o||6===o||7===o||8===o||9===o),0===this.startTime||(this.intervalTime=(new Date).getTime()-this.startTime),this.startTime=(new Date).getTime();let l=this.THREE;if(!this.inited)return[0,void 0,void 0,void 0];if(this.moveArrowRenderMode){if(null!==this.moveArrow&&this.moveStart&&void 0!==this.clock){this.totalCountTime=0,this.moveArrow.visible=!0,this.time=[0],this.localWayPoints=[];let e=Math.sqrt(Math.pow(t.x-s[0][0],2)+Math.pow(t.y-s[0][1],2)),i=0,o=0,n=0,r=0;if(this.localWayPoints.push([t.x,t.y,0]),e>this.moveArrowShowDistance){let e=s[0][0]-t.x,i=s[0][1]-t.y,o=Math.sqrt(e*e+i*i);this.localWayPoints.push([t.x+this.moveArrowShowDistance*e/o,t.y+this.moveArrowShowDistance*i/o,0]),this.time.push(this.moveArrowShowDistance/this.speed),this.totalTime=this.time[1]}else{for(r=1,o=e,this.localWayPoints.push(s[0]),this.time.push(e/this.speed),this.totalTime=this.time[1];o<this.moveArrowShowDistance&&!(r>s.length-1);)i=Math.sqrt(Math.pow(s[r][0]-s[r-1][0],2)+Math.pow(s[r][1]-s[r-1][1],2)),o+=i,this.localWayPoints.push(s[r]),this.time.push(this.time[r]+i/this.speed),r++;if(o>=this.moveArrowShowDistance){n=this.moveArrowShowDistance-o+i;let t=s[r-1][0]-s[r-2][0],e=s[r-1][1]-s[r-2][1],a=Math.sqrt(t*t+e*e);this.localWayPoints[r][0]=this.localWayPoints[r-1][0]+n*t/a,this.localWayPoints[r][1]=this.localWayPoints[r-1][1]+n*e/a,this.time[r]=this.time[r-1]+n/this.speed,this.totalTime=this.time[r]}else r>1&&(this.localWayPoints.push(s[r-1]),i=Math.sqrt(Math.pow(s[r-1][0]-s[r-2][0],2)+Math.pow(s[r-1][1]-s[r-2][1],2)),this.time.push(this.time[r-1]+i/this.speed),this.totalTime=this.time[r])}let a=[];for(let t=0;t<this.localWayPoints.length;t++)a.push(this.localWayPoints[t][0],this.localWayPoints[t][1],this.localWayPoints[t][2]);this.positionKF=new l.VectorKeyframeTrack(".position",this.time,a),this.clip=new l.AnimationClip("Action",-1,[this.positionKF]),this.mixer=new l.AnimationMixer(this.moveArrow),this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.play(),this.moveStart=!1}if(void 0!==this.clock){0===this.intervalTime?this.totalCountTime+=.033:this.totalCountTime+=this.intervalTime/1e3;let t=new l.Vector3;if(this.totalCountTime>=this.totalTime&&(this.clipAction.stop(),this.mixer.uncacheAction(this.clipAction,this.moveArrow),this.positionKF,this.clip=null,this.moveArrow.position.set(this.camera.position),this.moveStart=!0,this.localWayPoints[1][0]+=1e-7,this.localWayPoints[1][2]=0,t.fromArray(this.localWayPoints),this.moveArrow.lookAt(t),this.moveArrow.rotateX(this.arrowInfo.arrowRotation[0]),this.moveArrow.rotateY(this.arrowInfo.arrowRotation[1]),this.moveArrow.rotateZ(this.arrowInfo.arrowRotation[2])),this.totalCountTime>=this.time[this.time.length-2]&&this.totalCountTime<this.totalTime&&(this.localWayPoints[this.localWayPoints.length-1][0]+=1e-7,this.localWayPoints[this.localWayPoints.length-1][2]=0,t.fromArray(this.localWayPoints[this.localWayPoints.length-1]),this.moveArrow.lookAt(t),this.moveArrow.rotateX(this.arrowInfo.arrowRotation[0]),this.moveArrow.rotateY(this.arrowInfo.arrowRotation[1]),this.moveArrow.rotateZ(this.arrowInfo.arrowRotation[2])),this.localWayPoints.length>3)for(let e=1;e<this.time.length-2;e++)this.totalCountTime>=this.time[e]&&this.totalCountTime<this.time[e+1]&&(this.localWayPoints[e+2][0]+=1e-7,this.localWayPoints[e+2][2]=0,t.fromArray(this.localWayPoints[e+1]),this.moveArrow.lookAt(t),this.moveArrow.rotateX(this.arrowInfo.arrowRotation[0]),this.moveArrow.rotateY(this.arrowInfo.arrowRotation[1]),this.moveArrow.rotateZ(this.arrowInfo.arrowRotation[2]));this.totalCountTime<this.time[1]&&(this.localWayPoints[1][0]+=1e-7,this.localWayPoints[1][2]=0,t.fromArray(this.localWayPoints[1]),this.moveArrow.lookAt(t),this.moveArrow.rotateX(this.arrowInfo.arrowRotation[0]),this.moveArrow.rotateY(this.arrowInfo.arrowRotation[1]),this.moveArrow.rotateZ(this.arrowInfo.arrowRotation[2])),this.mixer&&this.mixer.update(this.clock.getDelta())}}let h=new l.Euler;h.setFromRotationMatrix(e,"ZYX");let c=new l.Vector3(1,0,0),d=new l.Vector3(0,0,-1);c.applyAxisAngle(d,h.z);let f=0,u=0,p=new l.Euler;this.localWayPoints.length>1&&(p.x=this.localWayPoints[this.localWayPoints.length-1][0],p.y=this.localWayPoints[this.localWayPoints.length-1][1]);let y=this.calculateNaviArrowOrientation(t,p,c);f=y[1],u=y[0];let m=new l.Euler(Math.PI/2,u,0,"XYZ"),g=new l.Matrix4,v=new l.Matrix4;v.makeRotationFromEuler(m),g=(new l.Matrix4).getInverse(e),g.multiply(v);let w=new l.Euler;if(w.setFromRotationMatrix(g),0!==this.arrowRenderMode){let t=new l.Quaternion;t.setFromRotationMatrix(g),this.onScreenArrowCtrl.update(t)}if(!this.moveArrowRenderMode&&(f<this.arrows.length-this.showArrowCount&&i>this.finalShowDistance||7!==o)){for(let t=0;t<this.showArrowCount;t++)this.arrows[f+t].visible=!0,this.allModels[t]=this.arrows[f+t];for(let t=0;t<this.arrows.length;t++)t!==f&&t!==f+1&&t!==f+2&&t!==f+3&&t!==f+4&&t!==f+5&&(this.arrows[t].visible=!1)}return 7===o&&i<this.finalShowDistance&&void 0!==this.allFinalWayPointsModel[0]&&(Math.abs(this.allFinalWayPointsModel[0].position.x-this.lastWayPointPosition.x)<1e-7&&Math.abs(this.allFinalWayPointsModel[0].position.y-this.lastWayPointPosition.y)<1e-7||(void 0!==a&&(this.allFinalWayPointsModel[0].position.x=a.x,this.allFinalWayPointsModel[0].position.y=a.y),this.allFinalWayPointsModel[0].visible=!0,this.allFinalWayPointsModel[0].rotation.y=D(this.allFinalWayPointsModel[0].position,t))),h=null,c=null,d=null,p=null,m=null,v=null,[new this.THREE.Vector3(0,0,0),g,57.3*w.y,this.moveStart]}}class rt{constructor(t,e,i){this.THREE=t,this.scene=e,this.configInfo=i,this.panelInfo=this.configInfo.panel,this.panelColor=this.panelInfo.panelColor,this.textColor=this.panelInfo.textColor,this.opacity=this.panelInfo.opacity,this.textMesh=void 0,this.panel=void 0,this.font=void 0,this.loadPanelModel(),this.loadTextFont(),this.last_message=0}loadPanelModel(){let t=this.THREE;const e=(new t.GLTFLoader).setPath("https://ar-fm.cdn.bcebos.com/home_3d_model/vpas_applet/panel/");let i=this;e.load("panel.gltf",(function(e){let o=e.scene;o.scale.set(50,50,50),o.rotateX(-Math.PI/2),o.visible=!1;let s=new t.MeshStandardMaterial({color:i.panelColor});s.opacity=i.opacity,s.transparent=!0,o.traverse(t=>{t.isMesh&&(t.material=s)}),i.panel=o}))}loadTextFont(){let t=this.THREE,e=this;(new t.FontLoader).load("https://ar-fm.cdn.bcebos.com/home_3d_model/vpas_applet/font/PingFang_SC_Regular_Regular.json",(function(t){e.font=t}))}reset(t){void 0!==this.textMesh&&(this.scene.remove(this.textMesh),t&&(this.textMesh=void 0)),void 0!==this.panel&&(this.scene.remove(this.panel),t&&(this.panel=void 0)),void 0!==this.font&&t&&(this.font=void 0)}createText(t,e,i){let o=this.THREE;if(void 0!==this.panel&&(this.panel.visible=!0),t!==this.last_message){void 0!==this.textMesh&&(this.scene.remove(this.textMesh),this.textMesh.geometry.dispose(),this.textMesh.material.dispose(),this.textMesh=void 0);let e=new o.MeshBasicMaterial({color:this.textColor,transparent:!0,opacity:1,side:o.DoubleSide}),i=this.font.generateShapes(t+"米",.15),s=new o.ShapeBufferGeometry(i);s.computeBoundingBox(),this.textMesh=new o.Mesh(s,e),this.textMesh.rotation.x=-Math.PI/2,this.textMesh.rotation.y=0,this.textMesh.add(this.panel),this.scene.add(this.textMesh),this.last_message=t,s.center()}this.textMesh.position.set(e.x,e.y,e.z-1.7),void 0!==this.textMesh&&void 0!==this.panel&&(this.textMesh.rotation.y=-D(this.textMesh.position,i),this.panel.rotation.x=-1*Math.PI/180,this.panel.position.set(0,0,-.1))}loadTextModel(t,e,i){void 0!==this.font&&this.createText(t,e,i)}hideTextModel(){void 0!==this.textMesh&&(this.textMesh.visible=!1),void 0!==this.panel&&(this.panel.visible=!1)}setVisible(t){void 0!==this.textMesh&&(this.textMesh.visible=t)}}class at{constructor(t,e,i,o,s,n,r,a){this.THREE=t,this.scene=e,this.configInfo=r,this.isShow=a,this.turnLeftAngleThreshold=this.configInfo.turnLeft.angleThreshold,this.turnRightAngleThreshold=this.configInfo.turnRight.angleThreshold,this.showDistance=15,n?(this.location=new t.Vector3(s.x,s.y,s.z),this.postLocation=new t.Vector3(i.x,i.y,i.z),this.preLocation=new t.Vector3(o.x,o.y,o.z)):(this.location=new t.Vector3(i.x,i.y,i.z),this.postLocation=new t.Vector3(s.x,s.y,s.z),this.preLocation=new t.Vector3(o.x,o.y,o.z)),this.isAppended=n,this.isLeftArrow=!1,this.model=void 0,this.angle=0,this.angleThreshold=15,this.isAppended&&(this.angleThreshold=10),this.isNormalArrow=!1,this.isLeft()?this.angle>this.turnLeftAngleThreshold?(this.loadModelLeft(),this.isLeftArrow=!0):this.isNormalArrow=!0:this.angle>this.turnRightAngleThreshold?(this.loadModelRight(),this.isLeftArrow=!1):this.isNormalArrow=!0,this.arTextCtrl=new rt(t,e,r),this.distance=Number.MAX_VALUE}reset(t){void 0!==this.model&&(this.scene.remove(this.model),t&&(this.model=void 0)),void 0!==this.arTextCtrl&&(this.arTextCtrl.reset(),t&&(this.arTextCtrl=void 0))}loadModelLeft(){let t=this.THREE;this.showDistance=this.configInfo.turnLeft.showDistance;let e=this.configInfo.turnLeft.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.turnLeft.scale,r=this.configInfo.turnLeft.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("zuo.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateX(r[0]),i.rotateY(r[1]),i.rotateZ(r[2]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}loadModelRight(){let t=this.THREE;this.showDistance=this.configInfo.turnRight.showDistance;let e=this.configInfo.turnRight.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.turnRight.scale,r=this.configInfo.turnRight.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("you.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}isLeft(){let t=this.THREE,e=new t.Vector3,i=new t.Vector3;this.isAppended?(e.subVectors(this.location,this.preLocation),i.subVectors(this.postLocation,this.preLocation)):(e.subVectors(this.location,this.preLocation),i.subVectors(this.postLocation,this.location)),e.normalize(),i.normalize();let o=new t.Vector3;o.crossVectors(e,i);let s=e.dot(i)/(e.length()*i.length());s>1?s=1:s<-1&&(s=-1),this.angle=180*Math.acos(s)/Math.PI;let n=!1;return n=this.isAppended?o.z>0:o.z<0,n}setVisible(t){void 0!==this.model&&(t&&this.distance<this.showDistance?this.model.visible=!0:this.model.visible=!1),void 0!==this.arTextCtrl&&this.arTextCtrl.setVisible(t)}update(t){if(void 0===this.model)return[Number.MAX_VALUE,0,this.location];let e=new this.THREE.Vector3;if(e.subVectors(this.location,t),e.z=0,this.distance=e.length(),this.distance>this.showDistance)this.model.visible=!1,this.arTextCtrl.hideTextModel();else{this.model.visible=!0;let e=Math.round(this.distance);this.arTextCtrl.loadTextModel(e,this.location,t)}return this.model.position.set(this.location.x,this.location.y,-1.5),this.model.rotation.z=D(this.model.position,t),e=null,[this.distance,this.isLeftArrow,this.location]}}class lt{constructor(t,e,i,o,s){this.THREE=t,this.scene=e,this.isUp=o,this.configInfo=s,this.showDistance=15,this.location=new t.Vector3(i.x,i.y,i.z),this.model=null,this.isUp?this.loadModelUp():this.loadModelDown(),console.log("Load EscalatorCtrl"),this.arTextCtrl=new rt(t,e,s),this.distance=Number.MAX_VALUE}reset(t){null!==this.model&&(this.scene.remove(this.model),t&&(this.model=null)),void 0!==this.arTextCtrl&&(this.arTextCtrl.reset(),t&&(this.arTextCtrl=void 0))}setVisible(t){null!==this.model&&(t&&this.distance<this.showDistance?this.model.visible=!0:this.model.visible=!1),void 0!==this.arTextCtrl&&this.arTextCtrl.setVisible(t)}loadModelUp(){let t=this.THREE;this.showDistance=this.configInfo.escalatorUp.showDistance;let e=this.configInfo.escalatorUp.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.escalatorUp.scale,r=this.configInfo.escalatorUp.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("shang2.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}loadModelDown(){let t=this.THREE;this.showDistance=this.configInfo.escalatorDown.showDistance;let e=this.configInfo.escalatorDown.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.escalatorDown.scale,r=this.configInfo.escalatorDown.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("shang2.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}update(t){if(null==this.model)return[Number.MAX_VALUE,0,this.location];let e=new this.THREE.Vector3;if(e.subVectors(this.location,t),e.z=0,this.distance=e.length(),this.distance>this.showDistance)this.model.visible=!1,this.arTextCtrl.hideTextModel();else{this.model.visible=!0;let e=Math.round(this.distance);this.arTextCtrl.loadTextModel(e,this.location,t)}return this.model.position.set(this.location.x,this.location.y,-1.5),this.model.rotation.z=D(this.model.position,t),e=null,[this.distance,this.isUp,this.location]}}class ht{constructor(t,e,i,o,s){this.THREE=t,this.scene=e,this.isUp=o,this.configInfo=s,this.showDistance=15,this.location=new t.Vector3(i.x,i.y,i.z),this.model=null,this.isUp?this.loadModelUp():this.loadModelDown(),console.log("Load ElevatorCtrl"),this.arTextCtrl=new rt(t,e,s),this.distance=Number.MAX_VALUE}reset(t){null!==this.model&&(this.scene.remove(this.model),t&&(this.model=null)),void 0!==this.arTextCtrl&&(this.arTextCtrl.reset(),t&&(this.arTextCtrl=void 0))}setVisible(t){null!==this.model&&(t&&this.distance<this.showDistance?this.model.visible=!0:this.model.visible=!1),void 0!==this.arTextCtrl&&this.arTextCtrl.setVisible(t)}loadModelUp(){let t=this.THREE;this.showDistance=this.configInfo.elevatorUp.showDistance;let e=this.configInfo.elevatorUp.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.elevatorUp.scale,r=this.configInfo.elevatorUp.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("zhiti.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}loadModelDown(){let t=this.THREE;this.showDistance=this.configInfo.elevatorDown.showDistance;let e=this.configInfo.elevatorDown.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.elevatorDown.scale,r=this.configInfo.elevatorDown.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){console.log("zhiti.gltf loaded");let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}update(t){if(null==this.model)return[Number.MAX_VALUE,0,this.location];let e=new this.THREE.Vector3;if(e.subVectors(this.location,t),e.z=0,this.distance=e.length(),this.distance>this.showDistance)this.model.visible=!1,this.arTextCtrl.hideTextModel();else{this.model.visible=!0;let e=Math.round(this.distance);this.arTextCtrl.loadTextModel(e,this.location,t)}return this.model.position.set(this.location.x,this.location.y,-1.5),this.model.rotation.z=D(this.model.position,t),e=null,[this.distance,this.isUp,this.location]}}let ct=1,dt=1;class ft{constructor(t,e,i,o,s){this.THREE=t,this.scene=e,this.camera=i,this.name=null,this.res_type=0,this.res_url=null,this.position=[0,0,0],this.orientation=[0,0,0],this.scale=1,this.event_type=0,this.event_url=null,this.showing=1,this.rotate_type=1,this.poiModel=null,this.box=null,this.eventCallBack=o,this.configInfo=s,this.rayCaster=new t.Raycaster,this.touchPoint=[0,0]}updateData(t,e,i,o,s,n,r,a,l,h){this.THREE;this.name=t,this.res_type="img"===e?0:1,this.res_url=i,console.log("this.res_type = ",this.res_type),this.position=JSON.parse(o),this.orientation=""===s?[0,0,0]:JSON.parse(s),this.event_type=r,this.event_url=a,this.showing=l,this.rotate_type=h,this.scale=n;let c=this,d=this.res_url.split("://");"http"===d[0]&&(this.res_url=d[0]+"s://"+d[1]),0===this.res_type?wx.getImageInfo({src:this.res_url,success(t){ct=t.width,dt=t.height,c.createPoiContent(c.poiModel)}}):c.createPoiContent(c.poiModel)}createPoiContent(t){let e=this.THREE;switch(this.res_type){case 0:let t=(new e.TextureLoader).load(this.res_url),i=(new e.TextureLoader).load(this.res_url);i.center=new e.Vector2(.5,.5),i.rotation=Math.PI,i.flipY=!1;let o=[new e.MeshBasicMaterial({map:t,side:e.FrontSide}),new e.MeshBasicMaterial({map:i,side:e.BackSide})],s=new e.PlaneGeometry(1,dt/ct);for(let t=0,e=s.faces.length;t<e;t++){let e=s.faces[t].clone();e.materialIndex=1,s.faces.push(e),s.faceVertexUvs[0].push(s.faceVertexUvs[0][t].slice(0))}let n=new e.Mesh(s,o);n.name="poi"+this.name,this.poiModel=n.clone(),this.poiModel.visible=!1;let r=new e.Vector3;r.fromArray(this.position),this.poiModel.position.set(r.x,r.y,r.z);let a=new e.Vector3;a.fromArray(this.orientation),this.poiModel.rotation.set(a.x,a.y,a.z),this.poiModel.rotation.x=-Math.PI/2,this.poiModel.scale.set(this.scale,this.scale,this.scale),this.scene.add(this.poiModel);break;case 1:let l=this;(new e.GLTFLoader).load(l.res_url,(function(t){let i=t.scene;i.name="poi"+l.name,l.poiModel=i.clone(),l.poiModel.visible=!1;let o=new e.Vector3;o.fromArray(l.position),l.poiModel.position.set(o.x,o.y,o.z);let s=new e.Vector3;s.fromArray(l.orientation),l.poiModel.rotation.set(s.x,s.y,s.z),l.poiModel.rotation.x=Math.PI/2,l.poiModel.rotation.y=Math.PI,l.poiModel.rotation.z=Math.PI,l.poiModel.scale.set(50*l.scale,50*l.scale,50*l.scale);let n=new e.CubeGeometry(6,6,6);n.center(),l.box=new e.Mesh(n,new e.MeshBasicMaterial({color:16711680,wireframe:!1,opacity:0,transparent:!0})),l.box.name=i.name,l.box.position.set(o.x,o.y,o.z-3),l.box.rotation.set(s.x,s.y,s.z),l.box.rotation.x=Math.PI/2,l.box.rotation.y=Math.PI,l.box.rotation.z=Math.PI,l.scene.add(l.box),l.scene.add(l.poiModel)}))}}show(){null!==this.poiModel&&(this.poiModel.visible=!0,null!==this.box&&(this.box.visible=!0))}hide(){null!==this.poiModel&&(this.poiModel.visible=!1,null!==this.box&&(this.box.visible=!1))}processTouch(t){this.rayCaster=t;let e=this.rayCaster.intersectObjects(this.scene.children,!0);if(e.length>0){if(this.intersected=e[0].object,this.intersected.name==="poi"+this.name){let t={};t.poiName=this.name,t.eventType=this.event_type,t.eventUrl=this.event_url,this.eventCallBack.onPoiEvent(t)}}else this.intersected=null}update(){if(null===this.poiModel)return;if(!this.showing&&null!==this.poiModel)return this.poiModel.visible=!1,void(null!==this.box&&(this.box.visible=!1));if(L(this.poiModel.position,this.camera.position)>this.configInfo.mapPoi.showDistance)return this.poiModel.visible=!1,void(null!==this.box&&(this.box.visible=!1));switch(this.poiModel.visible=!0,null!==this.box&&(this.box.visible=!0),this.rotate_type){case 1:this.poiModel.rotateY(.1);break;case 2:this.poiModel.rotation.y=-D(this.poiModel.position,this.camera.position),null!==this.box&&(this.box.rotation.y=-D(this.box.position,this.camera.position))}}}class ut{constructor(t,e,i,o,s){this.THREE=t,this.scene=e,this.isParkToMall=o,this.configInfo=s,this.showDistance=15,this.location=new t.Vector3(i.x,i.y,i.z),this.model=null,this.isParkToMall?this.loadPark():this.loadMall(),this.arTextCtrl=new rt(t,e,s),this.distance=Number.MAX_VALUE}reset(t){null!==this.model&&(this.scene.remove(this.model),t&&(this.model=null)),void 0!==this.arTextCtrl&&(this.arTextCtrl.reset(),t&&(this.arTextCtrl=void 0))}setVisible(t){null!==this.model&&(t&&this.distance<this.showDistance?this.model.visible=!0:this.model.visible=!1),void 0!==this.arTextCtrl&&this.arTextCtrl.setVisible(t)}loadMall(){let t=this.THREE;this.showDistance=this.configInfo.mallToPark.showDistance;let e=this.configInfo.mallToPark.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.mallToPark.scale,r=this.configInfo.mallToPark.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}loadPark(){let t=this.THREE;this.showDistance=this.configInfo.parkToMall.showDistance;let e=this.configInfo.parkToMall.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.parkToMall.scale,r=this.configInfo.parkToMall.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}update(t){if(null==this.model)return[Number.MAX_VALUE,0,this.location];let e=new this.THREE.Vector3;if(e.subVectors(this.location,t),e.z=0,this.distance=e.length(),this.distance>this.showDistance)this.model.visible=!1,this.arTextCtrl.hideTextModel();else{this.model.visible=!0;let e=Math.round(this.distance);this.arTextCtrl.loadTextModel(e,this.location,t)}return this.model.position.set(this.location.x,this.location.y,-1.5),this.model.rotation.z=D(this.model.position,t),[this.distance,this.isParkToMall,this.location]}}class pt{constructor(t,e,i,o,s){this.THREE=t,this.scene=e,this.isStepLadderUp=o,this.configInfo=s,this.showDistance=15,this.location=new t.Vector3(i.x,i.y,i.z),this.model=null,this.isStepLadderUp?this.loadStepLadderUp():this.loadStepLadderDown(),this.arTextCtrl=new rt(t,e,s),this.distance=Number.MAX_VALUE}reset(t){null!==this.model&&(this.scene.remove(this.model),t&&(this.model=null)),void 0!==this.arTextCtrl&&(this.arTextCtrl.reset(),t&&(this.arTextCtrl=void 0))}setVisible(t){null!==this.model&&(t&&this.distance<this.showDistance?this.model.visible=!0:this.model.visible=!1),void 0!==this.arTextCtrl&&this.arTextCtrl.setVisible(t)}loadStepLadderUp(){let t=this.THREE;this.showDistance=this.configInfo.stepLadderUp.showDistance;let e=this.configInfo.stepLadderUp.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.stepLadderUp.scale,r=this.configInfo.stepLadderUp.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}loadStepLadderDown(){let t=this.THREE;this.showDistance=this.configInfo.stepLadderDown.showDistance;let e=this.configInfo.stepLadderDown.URL,i=e.split("/"),o=i[i.length-1],s=e.replace(o,""),n=this.configInfo.stepLadderDown.scale,r=this.configInfo.stepLadderDown.rotation;const a=(new t.GLTFLoader).setPath(s);let l=this;a.load(o,(function(e){let i=e.scene;i.scale.set(n[0],n[1],n[2]),i.visible=!0,i.rotateZ(r[2]),i.rotateX(r[0]),i.rotateY(r[1]),l.m_model=i;let o=new t.Object3D;o.add(i),l.model=o,l.model.position.set(l.location.x,l.location.y,-1.5),l.scene.add(l.model),l.model.visible=!1}))}update(t){if(null==this.model)return[Number.MAX_VALUE,0,this.location];let e=new this.THREE.Vector3;if(e.subVectors(this.location,t),e.z=0,this.distance=e.length(),this.distance>this.showDistance)this.model.visible=!1,this.arTextCtrl.hideTextModel();else{this.model.visible=!0;let e=Math.round(this.distance);this.arTextCtrl.loadTextModel(e,this.location,t)}return this.model.position.set(this.location.x,this.location.y,-1.5),this.model.rotation.z=D(this.model.position,t),[this.distance,this.isStepLadderUp,this.location]}}class yt{constructor(t,e,i){this.THREE=t,this.scene=e,this.location=new t.Vector3(i.x,i.y,i.z),this.distance=Number.MAX_VALUE}reset(){}setVisible(){}update(t){let e=new this.THREE.Vector3;return e.subVectors(this.location,t),e.z=0,this.distance=e.length(),[this.distance,0,this.location]}}let mt,gt,vt,wt;class bt{constructor(t,e,i,o,s){this.THREE=t,this.canvas=e,this.onResLoaded=i,this.configInfo=o,this.minCoverPointDistance=this.configInfo.interaction.minCoverPointDistance,this.renderer=null,this.camera=null,this.scene=null,this.initScene(this.THREE,this.canvas),this.arrowCtrl=new nt(t,this.scene,this.camera,i,this.configInfo,s),this.textCtrl=new rt(t,this.scene,this.configInfo,this.camera,i),this.wayPointCtrls=[],this.wayPointCtrlsClone=[],this.wayPointCtrlsStatus=[],this.driftAwayDistanceThreshold=5,this.driftAwayAngleThreshold=60,this.driftAwayAngle=0,this.nextLocation=void 0,this.nextNextLocation=void 0,this.final=void 0,this.finalClone=void 0,this.type=-1,this.way_point_index=0,this.min_distance=Number.MAX_VALUE,this.next_point_distance=Number.MAX_VALUE,this.allMapPois=[],this.touchPoint=[0,0],this.rayCaster=new t.Raycaster,this.naviData=void 0,this.haveFoundNextPoint=!1,this.cameraToLstFootPointDistance=Number.MAX_VALUE,this.distanceCameraToFootPoint=0,this.segmentLength=0,this.footPointToFirstPointDistance=0,this.nextPointIsFinal=!1,this.threshold_to_next_point=5,this.wayPointIndex=[],this.wayPointindexClone=[],this.nextIsFinal=!1,this.nextIsTransfer=!1,this.lastNextPoint=[0,0,0],this.lostUpdateTime=0,this.testLastNextPoint=void 0,this.newLocalWayPoints=[],this.localWayPoints=[],this.isInited=!1}screenCoordinate(t){if(this.touchPoint[0]=t.x/(this.canvas.width/2)*2-1,this.touchPoint[1]=-t.y/(this.canvas.height/2)*2+1,this.THREE){let t=new this.THREE.Vector3(this.touchPoint[0],this.touchPoint[1],.5).unproject(this.camera);this.rayCaster.set(this.camera.position,t.sub(this.camera.position).normalize());for(let t=0;t<this.allMapPois.length;t++){this.allMapPois[t].processTouch(this.rayCaster)}}}setPoiList(t,e){void 0!==t&&this.arrangePoiDatasWithJson(t,e),null!==mt&&null!==gt&&(this.scene.add(mt),this.scene.add(gt))}renderWebGL(){this.renderer&&this.renderer.render(this.scene,this.camera)}arrangePoiDatasWithJson(t,e){let i=this;for(let o=0;o<t.length;o++){const s=t[o];let n=new ft(i.THREE,i.scene,i.camera,e,this.configInfo);""!==s.resource_type&&""!==s.resource_url&&""!==s.name&&(n.updateData(s.name,s.resource_type,s.resource_url,s.position,s.orientation,s.scale,s.event_type,s.event_url,s.showing,s.rotate_type),i.allMapPois.push(n))}}arrangePoiDatas(t){let e=this;this.getJson("http://ar-fm.bj.bcebos.com/content-dev/upload/zip/20210923/1632389949866974000_map_poi.json",(function(i){console.log("get res data = ",i),console.log("pois = ",i.pois);for(let o=0;o<i.pois.length-1;o++){const s=i.pois[o];console.log("poi "+o+" = ",s);let n=new ft(e.THREE,e.scene,e.camera,t,this.configInfo);n.updateData(s.name,s.resource_type,s.resource_url,s.position,s.orientation,s.scale,s.event_type,s.event_url,s.showing,s.rotate_type),e.allMapPois.push(n)}}))}initScene(t,e){let i=e.width/e.height,o=1;if(.75>i){o=640*i/640}else{o=480/(480/i)}this.camera=new t.PerspectiveCamera(62,o,.01,1e3),this.scene=new t.Scene,this.renderer=new t.WebGLRenderer({canvas:e,antialias:!0,alpha:!0}),this.renderer.gammaOutput=!0,this.renderer.gammaFactor=2.2,this.renderer.setSize(2*e.width,2*e.height,!1),this.scene.add(this.camera);let s=new t.Color("#FFFFFF");mt=new t.DirectionalLight(s),mt.position.set(1.1,3.1,-12.94),mt.intensity=.7,this.scene.add(mt);let n=new t.Color("#FFFFFF");gt=new t.AmbientLight(n),gt.position.set(0,0,0),gt.intensity=.9,this.scene.add(gt)}getJson(t,e){wx.request({url:t,header:{"content-type":"application/json"},success:t=>{console.log(t.data),e(t.data)},fail:t=>{console.log("error message = ",t.data)}})}generateOtherRoute(t,e,i,o,s,n){this.THREE;for(let r=s;r<n;r++){let a=t[r],l=new at(this.THREE,this.scene,o,i,a,!0);if(!l.isNormalArrow){if(this.wayPointCtrls[r-1]=l,this.wayPointIndex.splice(e+1,0,r),i=a,o=t[r+1],!((n-=s=r+2)>3))break;this.generateOtherRoute(t,e,i,o,s,n)}}}updateOnScreenArrowPosition(t){this.arrowCtrl.setScreenArrowPosition(t)}drawRoute(t,e,i,o,s){let n=this.THREE;this.naviData=t,this.arrowCtrl.setArrowRenderMode(o.ArrowRenderMode.mode);let r=o.ThreeDofArrowPosition.position;this.arrowCtrl.setScreenArrowPosition(new n.Vector3(r[0],r[1],r[2])),this.final=new n.Vector3(0,0,0),1===o.InputCoordinateMode.mode?(this.final=e,this.finalClone=new n.Vector3(this.final.x,this.final.y,this.final.z)):(i.transform_map_coodinate_to_translation(e.x,e.y),this.final.x=i.get_transform_vpas_translation(0),this.final.y=i.get_transform_vpas_translation(1),this.finalClone=new n.Vector3(this.final.x,this.final.y,this.final.z));let a=[],l=[];for(let e=0;e<t.length;e++){const s=t[e];if(1===o.InputCoordinateMode.mode)a.push(new n.Vector3(s.x.toFixed(6),s.y.toFixed(6),0));else{i.transform_map_coodinate_to_translation(s.x,s.y);for(let t=0;t<2;t++)l[t]=i.get_transform_vpas_translation(t).toFixed(6);a.push(new n.Vector3(l[0],l[1],0))}}this.arrowCtrl.updateRoute(a,this.final,s);for(let t=0;t<this.wayPointCtrls.length;t++){this.wayPointCtrls[t].reset(),this.wayPointCtrlsClone[t].reset()}this.wayPointCtrls.length=0,this.wayPointCtrlsClone.length=0,this.wayPointCtrlsStatus.length=0,this.wayPointIndex.length=0,this.wayPointindexClone.length=0,this.wayPointCtrls=[],this.wayPointCtrlsClone=[],this.wayPointCtrlsStatus=[],this.wayPointIndex=[],this.wayPointindexClone=[],this.wayPointIndex.push(0),this.wayPointindexClone.push(0);for(let e=0;e<t.length;e++){const s=t[e];let r=null;if(1===o.InputCoordinateMode.mode)r=new n.Vector3(s.x,s.y,0);else{i.transform_map_coodinate_to_translation(s.x,s.y);for(let t=0;t<2;t++)l[t]=i.get_transform_vpas_translation(t);r=new n.Vector3(l[0],l[1],0)}if(1===s.pointType&&e>0){let s,a=null,h=null,c=t[e-1];if(s=e===t.length-1?this.final:t[e+1],1===o.InputCoordinateMode.mode)a=new n.Vector3(c.x,c.y,0),h=new n.Vector3(s.x,s.y,0);else{i.transform_map_coodinate_to_translation(c.x,c.y);for(let t=0;t<2;t++)l[t]=i.get_transform_vpas_translation(t);if(a=new n.Vector3(l[0],l[1],0),e===t.length-1)h=new n.Vector3(s.x,s.y,0);else{i.transform_map_coodinate_to_translation(s.x,s.y);for(let t=0;t<2;t++)l[t]=i.get_transform_vpas_translation(t);h=new n.Vector3(l[0],l[1],0)}}let d=new at(this.THREE,this.scene,r,a,h,!1,this.configInfo),f=new at(this.THREE,this.scene,r,a,h,!1,this.configInfo);if(d.isNormalArrow){let t=new yt(this.THREE,this.scene,r),e=new yt(this.THREE,this.scene,r);this.wayPointCtrls.push(t),this.wayPointCtrlsClone.push(e)}else this.wayPointCtrls.push(d),this.wayPointCtrlsClone.push(f),this.wayPointIndex.push(this.wayPointCtrls.length-1),this.wayPointindexClone.push(e)}let a,h,c=!0,d=!0;switch(s.pointType){case 4:c=!0,a=new lt(this.THREE,this.scene,r,c,this.configInfo),h=new lt(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 5:c=!1,a=new lt(this.THREE,this.scene,r,c,this.configInfo),h=new lt(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 2:c=!0,a=new ht(this.THREE,this.scene,r,c,this.configInfo),h=new ht(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 3:c=!1,a=new ht(this.THREE,this.scene,r,c,this.configInfo),h=new ht(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 7:d=!1,a=new ut(this.THREE,this.scene,r,d,this.configInfo),h=new ut(this.THREE,this.scene,r,d,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 8:d=!0,a=new ut(this.THREE,this.scene,r,d,this.configInfo),h=new ut(this.THREE,this.scene,r,d,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 9:c=!0,a=new pt(this.THREE,this.scene,r,c,this.configInfo),h=new pt(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1);break;case 10:c=!1,a=new pt(this.THREE,this.scene,r,c,this.configInfo),h=new pt(this.THREE,this.scene,r,c,this.configInfo),this.wayPointCtrls.push(a),this.wayPointCtrlsClone.push(h),this.wayPointIndex.push(this.wayPointCtrls.length-1)}}for(let t=0;t<this.wayPointCtrls.length;t++)this.wayPointCtrlsStatus[t]=0}reset(t){void 0!==this.scene&&this.scene.dispose(),void 0!==this.arrowCtrl&&(this.arrowCtrl.reset(t),t&&(this.arrowCtrl=void 0)),void 0!==this.textCtrl&&(this.textCtrl.reset(t),t&&(this.textCtrl=void 0));for(let e=0;e<this.wayPointCtrls.length;e++){let i=this.wayPointCtrls[e];i.reset(t);let o=this.wayPointCtrlsClone[e];o.reset(t),t&&(i=void 0,o=void 0),this.wayPointCtrlsStatus[e]=0}this.haveFoundNextPoint=!1,this.cameraToLstFootPointDistance=Number.MAX_VALUE,this.wayPointIndex.length=0,this.wayPointindexClone.length=0,this.wayPointCtrls.length=0,this.wayPointCtrlsClone.length=0,this.wayPointCtrlsStatus.length=0,this.way_point_index=0,this.nextIsFinal=!1,this.nextIsTransfer=!1,t&&(this.nextLocation=void 0,this.nextNextLocation=void 0,this.final=void 0,this.finalClone=void 0,this.naviData=void 0,this.rayCaster=null,this.priorCrossFloor=void 0),this.isInited=!1}dispose(){this.scene&&(this.scene.dispose(),this.scene=null),this.renderer&&(this.renderer.dispose(),this.renderer=null),this.camera&&(this.camera=null),this.THREE&&(this.THREE=null),this.canvas&&(this.canvas=null)}driftAway(t,e,i){let o=this.THREE,s=t.clone();s.z=0;let n=s.distanceTo(i),r=new o.Vector3(0,0,-1);r.applyQuaternion(this.camera.quaternion);let a=new o.Vector3;a.subVectors(i,s);let l=a.dot(r)/(a.length()*r.length());if(this.driftAwayAngle=Math.acos(l),180*this.driftAwayAngle/Math.PI>this.driftAwayAngleThreshold&&n>this.driftAwayDistanceThreshold){let t=new o.Vector3;if(t.crossVectors(r,a),t.z<0){return 0}return 1}return 2}getFootOfPerpendicular(t,e,i){let o=this.THREE;const s=e.x-i.x,n=e.y-i.y,r=e.z-i.z;if(Math.abs(s)<1e-8&&Math.abs(n)<1e-8&&Math.abs(r)<1e-8)return e;let a=(t.x-e.x)*(e.x-i.x)+(t.y-e.y)*(e.y-i.y)+(t.z-e.z)*(e.z-i.z);return a/=Math.pow(s,2)+Math.pow(n,2)+Math.pow(r,2),new o.Vector3(e.x+a*s,e.y+a*n,e.z+a*r)}decidePointBetweenTwo(t,e,i){if(void 0===t||void 0===e||void 0===i)return[!1,[0,0,0]];let o=this.getFootOfPerpendicular(t,e,i);this.distanceCameraToFootPoint=L(o,t),this.segmentLength=L(e,i),this.footPointToFirstPointDistance=L(e,o);let s=new this.THREE.Vector3;s.subVectors(e,o);let n=new this.THREE.Vector3;n.subVectors(i,o);let r=s.dot(n)/(s.length()*n.length());r>1&&(r=1),r<-1&&(r=-1);let a=180*Math.acos(r)/Math.PI;return a>=0&&a<90?[!1,o]:[!0,o]}updateNewLocalWayPoints(t,e,i){let o,s=this.THREE,n=[0,0,0];if(o=0===this.way_point_index?this.decidePointBetweenTwo(this.camera.position,new s.Vector3(t[0][0],t[0][1],t[0][2]),new s.Vector3(t[1][0],t[1][1],t[1][2])):this.decidePointBetweenTwo(this.camera.position,this.wayPointCtrls[this.way_point_index-1].location,this.wayPointCtrls[this.way_point_index].location),n=o[1],!i){for(let i=0;i<t.length;i++){let o=[0,0,0],s=[0,0,0],r=0,a=0;0===i?(o=t[i][0]-n.x,s=t[i][1]-n.y,r=Math.sqrt(o*o+s*s),a=Math.sqrt(Math.pow(n.x-t[i][0],2)+Math.pow(n.y-t[i][1],2)),e.push([this.camera.position.x+a*o/r,this.camera.position.y+a*s/r,t[i][2]])):(o=t[i][0]-t[i-1][0],s=t[i][1]-t[i-1][1],r=Math.sqrt(o*o+s*s),a=Math.sqrt(Math.pow(t[i-1][0]-t[i][0],2)+Math.pow(t[i-1][1]-t[i][1],2)),e.push([e[i-1][0]+a*o/r,e[i-1][1]+a*s/r,t[i][2]]))}Math.abs(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x)<1e-7&&Math.abs(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y)<1e-7||(this.finalClone=new s.Vector3(e[e.length-1][0],e[e.length-1][1],this.final.z))}return n}handleCameraPose(t,e,i,o){let s=this.THREE,n=t,r=e,a=new s.Matrix4;a.elements=n;let l=new s.Quaternion;l.setFromRotationMatrix(a);let h=new s.Matrix4;h.elements=i,h.transpose();let c=new s.Euler;this.camera.quaternion.x=l.x,this.camera.quaternion.y=l.y,this.camera.quaternion.z=l.z,this.camera.quaternion.w=l.w,this.camera.position.set(r[0],r[1],-1.5);let d=r[0],f=r[1],u=(r[2],0);if(0===this.wayPointCtrls.length||this.way_point_index===this.wayPointCtrls.length-1||1===this.wayPointIndex.length)u=Math.sqrt(Math.pow(this.final.x-d,2)+Math.pow(this.final.y-f,2));else{u=Math.sqrt(Math.pow(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x,2)+Math.pow(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y,2));for(let t=this.way_point_index;t<this.wayPointCtrls.length;t++)t===this.way_point_index?u+=Math.sqrt(Math.pow(this.wayPointCtrls[t].location.x-d,2)+Math.pow(this.wayPointCtrls[t].location.y-f,2)):u+=Math.sqrt(Math.pow(this.wayPointCtrls[t-1].location.x-this.wayPointCtrls[t].location.x,2)+Math.pow(this.wayPointCtrls[t-1].location.y-this.wayPointCtrls[t].location.y,2))}let p=Number.MAX_VALUE;if(7!==this.type&&!this.haveFoundNextPoint&&this.wayPointCtrls.length>0&&this.wayPointIndex.length>1){for(let t=0;t<this.wayPointCtrls.length;t++){let e=this.wayPointCtrlsClone[t];if(!(e instanceof yt)){let i=e.update(this.camera.position),o=this.wayPointCtrlsStatus[t];if(e.setVisible(!0),1===o)continue;i[0]<p&&(p=i[0]),e instanceof at?i[0]<this.min_distance&&(this.min_distance=i[0],this.type=i[1]?1:2,this.nextLocation=i[2],this.way_point_index=t):e instanceof ht?i[0]<this.min_distance&&(this.min_distance=i[0],this.type=i[1]?3:4,this.nextLocation=i[2],this.way_point_index=t):e instanceof lt?i[0]<this.min_distance&&(this.min_distance=i[0],this.type=i[1]?5:6,this.nextLocation=i[2],this.way_point_index=t):e instanceof ut?i[0]<this.min_distance&&(this.min_distance=i[0],this.type=i[1]?9:8,this.nextLocation=i[2],this.way_point_index=t):e instanceof pt&&i[0]<this.min_distance&&(this.min_distance=i[0],this.type=i[1]?10:11,this.nextLocation=i[2],this.way_point_index=t),this.next_point_distance=this.min_distance,this.way_point_index=0;break}}if(this.nextLocation=this.wayPointCtrls[0].location,p>this.min_distance&&(this.min_distance=p,this.next_point_distance=p),this.min_distance===Number.MAX_VALUE||this.next_point_distance===Number.MAX_VALUE)return this.type=-1,[u,c,this.next_point_distance,this.type,2,this.newLocalWayPoints]}let y=[0,0,0],m=[0,0,0],g=0;if(this.localWayPoints=[],this.wayPointCtrls.length>0){for(let t=this.way_point_index;t<this.wayPointCtrls.length;t++)this.localWayPoints.push([this.wayPointCtrls[t].location.x,this.wayPointCtrls[t].location.y,this.wayPointCtrls[t].location.z]);if(Math.abs(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x)<1e-7&&Math.abs(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y)<1e-7||this.localWayPoints.push([this.final.x,this.final.y,this.final.z]),this.localWayPoints.length>1){y=this.updateNewLocalWayPoints(this.localWayPoints,this.newLocalWayPoints,this.isInited),this.isInited=!0;let t=this.localWayPoints[0][0]-y.x,e=this.localWayPoints[0][1]-y.y,i=Math.sqrt(t*t+e*e),o=Math.sqrt(Math.pow(y.x-this.localWayPoints[0][0],2)+Math.pow(y.y-this.localWayPoints[0][1],2));if(m[0]=this.camera.position.x+o*t/i,m[1]=this.camera.position.y+o*e/i,g=Math.sqrt(Math.pow(this.camera.position.x-m[0],2)+Math.pow(this.camera.position.y-m[1],2)),this.min_distance=g,this.min_distance<this.minCoverPointDistance){if(this.haveFoundNextPoint=!0,void 0!==this.wayPointCtrls[this.way_point_index]&&this.wayPointCtrls[this.way_point_index].setVisible(!1),void 0!==this.wayPointCtrlsClone[this.way_point_index]&&this.wayPointCtrlsClone[this.way_point_index].setVisible(!1),this.way_point_index<this.wayPointCtrls.length-1){this.way_point_index+=1,this.localWayPoints=[],this.newLocalWayPoints=[];for(let t=this.way_point_index;t<this.wayPointCtrls.length;t++)this.localWayPoints.push([this.wayPointCtrls[t].location.x,this.wayPointCtrls[t].location.y,this.wayPointCtrls[t].location.z]);Math.abs(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x)<1e-7&&Math.abs(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y)<1e-7||this.localWayPoints.push([this.final.x,this.final.y,this.final.z])}else if(this.wayPointCtrlsStatus[this.wayPointCtrls.length-1]=1,Math.abs(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x)<1e-7&&Math.abs(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y)<1e-7);else{this.nextIsFinal=!0,this.nextIsTransfer=!1,this.localWayPoints=[],this.newLocalWayPoints=[];for(let t=this.way_point_index;t<this.wayPointCtrls.length;t++)this.localWayPoints.push([this.wayPointCtrls[t].location.x,this.wayPointCtrls[t].location.y,this.wayPointCtrls[t].location.z]);let t;this.localWayPoints.push([this.final.x,this.final.y,this.final.z]),t=this.decidePointBetweenTwo(this.camera.position,this.wayPointCtrls[this.way_point_index].location,this.final),y=t[1];for(let t=0;t<this.localWayPoints.length;t++){let e=[0,0,0],i=[0,0,0],o=0,s=0;0===t?(e=this.localWayPoints[t][0]-y.x,i=this.localWayPoints[t][1]-y.y,o=Math.sqrt(e*e+i*i),s=Math.sqrt(Math.pow(y.x-this.localWayPoints[t][0],2)+Math.pow(y.y-this.localWayPoints[t][1],2)),this.newLocalWayPoints.push([this.camera.position.x+s*e/o,this.camera.position.y+s*i/o,this.localWayPoints[t][2]])):(e=this.localWayPoints[t][0]-this.localWayPoints[t-1][0],i=this.localWayPoints[t][1]-this.localWayPoints[t-1][1],o=Math.sqrt(e*e+i*i),s=Math.sqrt(Math.pow(this.localWayPoints[t-1][0]-this.localWayPoints[t][0],2)+Math.pow(this.localWayPoints[t-1][1]-this.localWayPoints[t][1],2)),this.newLocalWayPoints.push([this.newLocalWayPoints[t-1][0]+s*e/o,this.newLocalWayPoints[t-1][1]+s*i/o,this.localWayPoints[t][2]]))}this.finalClone=new s.Vector3(this.newLocalWayPoints[1][0],this.newLocalWayPoints[1][1],this.final.z)}for(let t=0;t<this.way_point_index;t++)this.wayPointCtrlsStatus[t]=1}}else this.newLocalWayPoints=this.localWayPoints,this.wayPointCtrlsClone[this.wayPointCtrlsClone.length-1].location.x=this.newLocalWayPoints[0][0],this.wayPointCtrlsClone[this.wayPointCtrlsClone.length-1].location.y=this.newLocalWayPoints[0][1]}else this.localWayPoints.push([this.final.x,this.final.y,this.final.z]),this.newLocalWayPoints.push([this.final.x,this.final.y,this.final.z]);if(this.haveFoundNextPoint&&1!==this.wayPointCtrlsStatus[this.way_point_index]&&0!==this.wayPointCtrls.length){this.nextIsFinal&&(this.way_point_index=this.wayPointIndex.length-1);let t=this.wayPointCtrlsClone[this.way_point_index].update(this.camera.position);this.min_distance=t[0],this.nextLocation=t[2];for(let t=1;t<this.wayPointIndex.length;t++)if(this.way_point_index<=this.wayPointIndex[t]){let e=this.wayPointCtrlsClone[this.wayPointIndex[t]],i=e.update(this.camera.position);this.next_point_distance=i[0],e instanceof at?this.type=i[1]?1:2:e instanceof ht?this.type=i[1]?3:4:e instanceof lt?this.type=i[1]?5:6:e instanceof ut?this.type=i[1]?9:8:e instanceof pt&&(this.type=i[1]?10:11);break}}0===this.wayPointCtrls.length||1===this.wayPointIndex.length?((this.way_point_index===this.wayPointCtrls.length-1||this.nextIsFinal)&&(this.min_distance=u,this.nextLocation=this.final),this.next_point_distance=u,this.type=7):(this.way_point_index>this.wayPointIndex[this.wayPointIndex.length-1]||this.nextIsFinal)&&(Math.abs(this.final.x-this.wayPointCtrls[this.wayPointCtrls.length-1].location.x)<1e-7&&Math.abs(this.final.y-this.wayPointCtrls[this.wayPointCtrls.length-1].location.y)<1e-7?(this.arrowCtrl.hideFinalModel(),this.arrowCtrl.hideMoveArrowModel()):(this.next_point_distance=u,this.type=7,this.way_point_index===this.wayPointCtrls.length-1&&(this.min_distance=u,this.nextLocation=this.finalClone),void 0!==this.wayPointCtrls[this.way_point_index]&&this.wayPointCtrls[this.way_point_index].setVisible(!1),void 0!==this.wayPointCtrlsClone[this.way_point_index]&&this.wayPointCtrlsClone[this.way_point_index].setVisible(!1)));let v=this.arrowCtrl.update(this.camera.position,a,u,this.type,this.localWayPoints,this.nextIsFinal,this.nextIsTransfer,this.final);v[0];if(void 0!==v[1]){let t=(new s.Matrix4).getInverse(v[1]);h.multiply(t),c.setFromRotationMatrix(h,"XYZ")}let w=0,b=v[2];w=Math.abs(b)>20&&b<0?1:Math.abs(b)>20&&b>0?0:2;for(let t=0;t<this.allMapPois.length;t++){this.allMapPois[t].update()}return a=null,l=null,h=null,[u,c,this.next_point_distance,this.type,w,this.localWayPoints]}}let _t=!1,xt=!1;class Pt{constructor(t){this._configData=t,this.intervalId=void 0}initAR(t,e,i){this.THREE=e,this.rgba2JpegCanvas=t.rgba2JpegCanvas,this.allSuccessProxy=Mt.call(this),this.firstTrackFrameSuccessResponseData={},this.initRender(e,i,this.allSuccessProxy),this.platform=new et(this._configData,this.renderer,t,this.allSuccessProxy,this.firstTrackFrameSuccessResponseData),wt=this.platform,wt.setGlCanvas(i),At(this.rgba2JpegCanvas),this.severInterface=new R(this._configData)}saveBtDataBtn(){wt.saveBtDataBtn()}initARWithoutObject(t){this.option=t,this.rgba2JpegCanvas=t.rgba2JpegCanvas,At(this.rgba2JpegCanvas)}initRender(t,e,i){let o=new bt(t,e,Tt,this._configData,i);this.renderer=o,this.intervalId=setInterval((function(){o.renderWebGL()}),33.3)}updateOnScreenArrowPosition(t){void 0!==this.renderer&&this.renderer.updateOnScreenArrowPosition(t)}updateRenderer(){(void 0)(()=>{this.updateRenderer()}),this.renderer.renderWebGL()}requestVPASLocation(t){this.locationOption=t,function(t){wx.getNetworkType({success(e){t.onNetWork({type:e.networkType,msg:"获取网络类型"})},fail(e){t.onError({type:10008,msg:"监听网络信号失败"})}}),wx.onNetworkStatusChange((function(e){e.isConnected?t.onNetWork({type:e.networkType,msg:"监听到网络状态发生变化"}):t.onError({type:10008,msg:"监听网络信号失败"})}))}(t),this.platform.setLoactionData(t,this._configData),this.resetARNavigationAgain(),this.requestGetPOi(t)}updateBluetoothLocation(t,e){this.platform.updateBluetoothLocation(t,e)}setUserId(t){this.platform.setUserId(t)}get2DPosition(){}getScreenCoordinate(t){this.renderer.screenCoordinate(t)}requestGetPOi(t){this._configData.map.forEach(e=>{if(e.floor_id===t.floor_id&&void 0!==e.case_id&&""!==e.case_id){this.severInterface.getMapPoi(Number(e.case_id)).getPoi.then(e=>{this.renderer.setPoiList(e.data.data.pois,t)})}})}setNavigationData(t,e,i,o){this.renderer.drawRoute(t,e,i,this._configData,o)}startARNavigation(){_t=!0,this.platform.startARTrue(_t)}resetARNavigationAgain(){xt=!1,this.platform.resetARTrue(xt)}resetRender(){this.renderer.reset(),void 0!==this.intervalId&&clearInterval(this.intervalId)}releaseRender(){this.renderer&&this.renderer.dispose()}finishARNavigation(t){_t=!1,xt=!0,void 0!==this.platform&&(this.platform.stopARTrue(xt),this.platform.release(t)),void 0!==this.severInterface&&this.severInterface.destroylocatesession(),void 0!==this.renderer&&this.renderer.reset(t)}}function Tt(){}function At(t){wx.createSelectorQuery().select(t).fields({node:!0}).exec(t=>{const e=t[0].node;vt=e,wt.setCanvasData(vt)})}function Mt(){let t=this;return new Proxy({firstTrackFrameSuccess:!1,hasNavigationArrowLoaded:!1,hasOnScreenArrowLoaded:!1},{set:function(e,i,o,s){return(!0===e.firstTrackFrameSuccess&&!0===e.hasOnScreenArrowLoaded&&"hasNavigationArrowLoaded"===i&&!0===o||!0===e.hasNavigationArrowLoaded&&!0===e.hasOnScreenArrowLoaded&&"firstTrackFrameSuccess"===i&&!0===o||!0===e.hasNavigationArrowLoaded&&!0===e.hasOnScreenArrowLoaded&&"hasOnScreenArrowLoaded"===i&&!0===o)&&t.locationOption.onFirstSuccess(t.firstTrackFrameSuccessResponseData),Reflect.set(e,i,o,s)}})}}]);void 0===VPASSDK&&console.error("esm-webpack-plugin: nothing exported!");const _VPASSDK$SDKWrapper=VPASSDK.SDKWrapper;export{_VPASSDK$SDKWrapper as SDKWrapper};