123456789101112131415161718 |
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).KanKan=t(e.THREE)}(this,(function(e){"use strict";function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=t(e);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){C(r,i,o,a,s,"next",e)}function s(e){C(r,i,o,a,s,"throw",e)}a(void 0)}))}}var S=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof v?t:v,r=Object.create(o.prototype),a=new k(i||[]);return r._invoke=function(e,t,n){var i=h;return function(o,r){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===o)throw r;return R()}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=u(e,t,n);if("normal"===l.type){if(i=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=f,n.method="throw",n.arg=l.arg)}}}(e,n,a),r}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function v(){}function g(){}function A(){}var y={};l(y,r,(function(){return this}));var E=Object.getPrototypeOf,w=E&&E(E(P([])));w&&w!==n&&i.call(w,r)&&(y=w);var b=A.prototype=v.prototype=Object.create(y);function C(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(o,r,a,s){var l=u(e[o],e,r);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;this._invoke=function(e,i){function r(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(r,r):r()}}function I(e,n){var i=e.iterator[n.method];if(i===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var r=o.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function P(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){for(;++o<e.length;)if(i.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:R}}function R(){return{value:t,done:!0}}return g.prototype=A,l(b,"constructor",A),l(A,"constructor",g),g.displayName=l(A,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,A):(e.__proto__=A,l(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},C(x.prototype),l(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,i,o,r){void 0===r&&(r=Promise);var a=new x(c(t,n,i,o),r);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(b),l(b,s,"Generator"),l(b,r,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=P,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(B),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(i,o){return s.type="throw",s.arg=e,n.next=i,o&&(n.method="next",n.arg=t),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),B(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;B(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:P(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function L(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}function H(e){return function(e){if(Array.isArray(e))return D(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function V(e,t,n){return(V=Q()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&p(o,n.prototype),o}).apply(null,arguments)}var _=[],U=[];function z(e,t){if(e&&"undefined"!=typeof document){var n,i=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,r="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=_.indexOf(r);-1===a&&(a=_.push(r)-1,U[a]={}),n=U[a]&&U[a][i]?U[a][i]:U[a][i]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var a="prepend"===i?"afterbegin":"beforeend";return r.insertAdjacentElement(a,e),e}}z(":root {\n --main-color: #00c8af;\n --font-color: #999;\n}\n\n[x-cloak] {\n display: none !important;\n}\n\n*,\n::before,\n::after {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n -webkit-tap-highlight-color: rgba(255, 255, 255, 0);\n text-rendering: optimizeLegibility !important;\n -webkit-font-smoothing: antialiased !important;\n}\n\n.kankan-app {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n background-color: #292929;\n}\n\n.kankan-app .player {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n overflow: hidden;\n outline: none;\n border: none;\n}\n\n.kankan-app .player[name='copy'] {\n display: none;\n}\n\n.kankan-app .player-mark {\n display: none;\n cursor: grab;\n position: absolute;\n left: calc(50% - 56px);\n top: calc(50% - 56px);\n z-index: 999;\n width: 102px;\n height: 102px;\n}\n\n.kankan-app__split .player {\n cursor: crosshair;\n}\n\n.kankan-app__split .player[name='main'] {\n width: calc(50% - 1px);\n}\n\n.kankan-app__split .player[name='copy'] {\n width: calc(50% - 1px);\n display: block;\n left: auto;\n right: 0;\n}\n\n.kankan-app__split .player-mark {\n display: block;\n}\n\n.kankan-app__split [xui_tags] div {\n display: none !important;\n}\n\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='main'] {\n width: 100%;\n height: calc(50% - 1px);\n}\n\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='copy'] {\n width: 100%;\n height: calc(50% - 1px);\n display: block;\n top: 50%;\n left: auto;\n right: 0;\n}\n\n.kankan-app__slide-right {\n will-change: transform;\n transition: all 0.2s ease-in-out;\n}\n\n.kankan-app__slide-right-enter {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n\n.kankan-app__slide-right-leave {\n opacity: 0;\n transform: translate3d(100%, 0, 0);\n}\n\n/* plugins */\n.kankan-plugins input {\n padding: 0 5px;\n width: 100%;\n height: 34px;\n background: rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n outline: none;\n color: #fff;\n}\n\n.kankan-plugins input:focus {\n border: 1px solid var(--main-color);\n}\n\n.kankan-plugins button {\n cursor: pointer;\n width: 100%;\n height: 34px;\n outline: none;\n border-radius: 4px;\n font-size: 14px;\n background: none !important;\n transition: all 0.3s ease;\n color: var(--main-color);\n border: 1px solid var(--main-color);\n}\n\n/* xui */\n.kankan-app_combox {\n cursor: pointer;\n position: relative;\n background: #323233;\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n outline: none;\n color: #fff;\n height: 34px;\n width: 100%;\n}\n\n.kankan-app_combox .inner-icon {\n cursor: pointer;\n font-size: 12px;\n position: absolute;\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--font-color);\n}\n\n.kankan-app_combox .inner-text {\n display: flex;\n align-items: center;\n padding: 0 5px;\n height: 100%;\n}\n\n.kankan-app_combox .inner-list {\n position: absolute;\n left: 0px;\n right: 0px;\n top: 100%;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: #323233;\n z-index: 1000;\n}\n\n.kankan-app_combox .inner-list>div {\n height: 34px;\n display: flex;\n align-items: center;\n padding: 0 5px;\n}\n\n.kankan-app_combox .inner-list>div:hover {\n color: var(--main-color);\n}",{});var j={"common.about":"约","common.meter":"米","cad.input":"请输入名称","model.enter":"入户门"},W={num:null,dom:null,env:"production",version:"4.10.6",lang:"zh",langs:{},view:!0,mobile:!1,deploy:"",region:"",server:"",resource:"https://4dkk.4dage.com/",showSDKInfo:!0,useShortcutKeys:!1,useStatistics:!0,useAuth:!1,antialias:!0,link:{onAction:null,target:"self"},model:{name:""},scene:{quality:null,markerURL:null,markerOpacity:null,pathEndColor:null,floorlogoId:null},camera:{lookLimitUp:null,lookLimitDown:null},vr:{markerHeight:null},tag:{showIn:null},getServerURL(e){return this.server+e},getResourceURL(e){return this.resource+e},getResourceImageURL(e){return this.getResourceURL("scene_view_data/".concat(this.num,"/images/").concat(e))},getResourceDataURL(e){return this.getResourceURL("scene_view_data/".concat(this.num,"/data/").concat(e))},i18n(e){return this.langs[this.lang]&&this.langs[this.lang][e]?this.langs[this.lang][e]:(this.langs.zh||(this.langs.zh=j),this.langs.zh[e]||"")},isLoadTags:!0};if(W.showSDKInfo)if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var q=["\n %c %c 4DKanKan SDK "+W.version+" - https://www.4dkankan.com/ \n","background: #1fe4dc; padding:5px 0;","color: #000; background: #1fe4dc; padding:5px 0;"];console.log.apply(console,q)}else console&&console.log("4DKanKan SDK "+W.version+" - https://www.4dkankan.com/");function J(e,t,n){for(var i=[],o=0;o<e.length;o+=1)void 0!==e&&(null!==e[o]&&"object"==typeof e[o]?i[o]=n({},e[o]):i[o]=e[o]);for(var r=0;r<t.length;r+=1)void 0!==t[r]&&(null!==t[r]&&"object"==typeof t[r]?i[r]=n(e[r],t[r]):i[r]=t[r]);return i}function Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=t.shift(),o=0;o<t.length;o+=1){var r=t[o];if(null!==i&&null!==r&&void 0!==i&&void 0!==r){if("object"==typeof i&&"object"==typeof r)if(i instanceof Array&&r instanceof Array)i=J(i,r,Y);else for(var a=Object.keys(r),s=0;s<a.length;s+=1){var l=a[s];"__proto__"!==l&&("object"==typeof r[l]&&null!==r[l]?i[l]=Y(i[l],r[l]):void 0!==r[l]&&(i[l]=r[l]))}}else null!=r&&(i=r instanceof Array?J([],r,Y):r)}return i}function Z(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var X=0;function K(e){return"__private_"+X+++"_"+e}var ee=K("plugins"),te=function(){function e(t){o(this,e),Object.defineProperty(this,ee,{writable:!0,value:{}}),this.app=t}return u(e,[{key:"add",value:function(){var e=k(S.mark((function e(t,n){var i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t(this.app,n),e.abrupt("return",new Promise((function(e,t){i.then&&i.then((function(n){return n.$name?o[n.$name]?e(o[n.$name]):(n.$html&&(n.$scope?n.$scope.insertAdjacentHTML("beforeend",n.$html):o.app.$plugins.insertAdjacentHTML("beforeend",n.$html),delete n.$html),o[n.$name]=n,n.$load&&(n.$load(),delete n.$load),void e(n)):t("require a plugin name")}))})));case 2:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"get",value:function(e){return Z(this,ee)[ee][e]}}]),e}(),ne=K("components"),ie=function(){function e(t){o(this,e),Object.defineProperty(this,ne,{writable:!0,value:void 0}),this.app=t,Z(this,ne)[ne]={}}return u(e,[{key:"add",value:function(e,t){-1==["store","resource"].indexOf(e)?Z(this,ne)[ne][e]=t:this.app[e]=t}},{key:"get",value:function(e){return Z(this,ne)[ne][e]}}]),e}(),oe=location.origin,re=(document.currentScript||{}).src,ae=function(){if(!re){try{({}).b()}catch(n){var e=n.stack||n.sourceURL||n.stacktrace,t=/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e);t&&(re=t[0])}}var n=re.split("/");return n.pop(),re=n.join("/")+"/",function(){return re}}();function se(e,t,n){return new Promise((function(i,o){var r=function(e){var t=document.createElement("script");return t.async=!0,e.indexOf(oe+"/")&&(t.crossOrigin="anonymous"),t.src=e,t}(e+(n?"?v=".concat(n):""));r.addEventListener("error",(function(){console.error("load:"+e+" error"),o()})),r.addEventListener("load",(function(){document.head.removeChild(r),i(t)})),document.head.appendChild(r)}))}window.addEventListener("error",(function(e){}));var le=function(){function e(t){o(this,e),this.app=t}return u(e,[{key:"toast",value:function(e){this.app.emit("gui.toast",e)}},{key:"alert",value:function(e){this.app.emit("gui.alert",e)}},{key:"confirm",value:function(e){this.app.emit("gui.confirm",e)}}]),e}();function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(i=n.next()).done)&&(r.push(i.value),!t||r.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return r}}(e,t)||L(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ue,he={getBaseLog:(e,t)=>Math.log(t)/Math.log(e),convertVisionVector:function(e){return new THREE.Vector3(e.x,e.z,-e.y)},invertVisionVector:function(e){return new THREE.Vector3(e.x,-e.z,e.y)},convertVisionQuaternion:function(e){return new THREE.Quaternion(e.x,e.z,-e.y,e.w).multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)))},invertVisionQuaternion:function(e){var t=e.clone().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(-90)));return new THREE.Quaternion(t.x,-t.z,t.y,t.w)},convertWorkshopVector:function(e){return new THREE.Vector3(-e.x,e.y,e.z)},convertWorkshopQuaternion:function(e){return new THREE.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new THREE.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},convertWorkshopPanoramaQuaternion:function(e){return new THREE.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(270)))},convertWorkshopOrthoZoom:function(e,t){return-1===e?-1:e*(t.clientHeight/t.clientHeight)},getVec2Angle:function(e,t){return Math.acos(THREE.MathUtils.clamp(this.getVec2Cos(e,t),-1,1))},getVec2Cos:function(e,t){return e.dot(t)/e.length()/t.length()},closeTo:function(e,t,n){return null!=n?Math.abs(e-t)<n:Math.abs(e-t)<1e-6},toPrecision:function(e,t){var n=function(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n};if(e instanceof Array){for(var i=0;i<e.length;i++)e[i]=n(e[i],t);return e}if(e instanceof Object){for(var i in e)e[i]=n(e[i],t);return e}return n(e,t)},isEmptyQuaternion:function(e){return 0===Math.abs(e.x)&&0===Math.abs(e.y)&&0===Math.abs(e.z)&&0===Math.abs(e.w)},projectPositionToCanvas:function(e,t,n,i){(n=n||new THREE.Vector3).copy(e);var o=.5*i.clientWidth,r=.5*i.clientHeight;return n.project(t),n.x=n.x*o+o,n.y=-n.y*r+r,n},convertScreenPositionToNDC:function(e,t,i,o){return(i=i||new n.Vector2).x=e/o.clientWidth*2-1,i.y=-t/o.clientHeight*2+1,i},handelPadding:(ue=new Map,function(e,t,n){var i,o=ue.get(n);return o&&n.clientWidth==o.width&&n.clientHeight==o.height&&(i=o.pad),i||(i={x:this.getOffset("left",n),y:this.getOffset("top",n)},ue.set(n,{width:n.clientWidth,height:n.clientHeight,pad:i})),{x:e-i.x,y:t-i.y}}),getOffset:function(e,t,n){var i="left"==e?t.offsetLeft:t.offsetTop;for(n||(n=document.body);(t=t.offsetParent)&&t!=n;)i+="left"==e?t.offsetLeft:t.offsetTop;return i},constrainedTurn:function(e){var t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<-Math.PI?t+=2*Math.PI:t},getFOVDotThreshold:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))},transform2DForwardVectorByCubeFace:function(e,t,n,i){switch(e){case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:n.set(1,t.y,t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:n.set(-1,t.y,-t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:n.set(-t.x,1,-t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:n.set(-t.x,-1,t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:n.set(-t.x,t.y,1);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:n.set(t.x,t.y,-1)}i&&n.normalize()},getFootPoint:function(e,t,n,i){var o=e.clone().sub(t),r=t.clone().sub(n),a=r.length(),s=o.dot(r)/a,l=t.clone().add(r.multiplyScalar(s/a));return i&&l.clone().sub(t).dot(l.clone().sub(n))>0&&(l=l.distanceTo(t)<l.distanceTo(n)?t.clone():n.clone()),l},getCenterOfGravityPoint:function(e){for(var t=0,n=0,i=0,o=1;o<=e.length;o++){var r=e[o%e.length].x,a=e[o%e.length].y,s=e[o-1].x,l=e[o-1].y,c=(r*l-a*s)/2;t+=c,n+=c*(r+s)/3,i+=c*(a+l)/3}return{x:n/=t,y:i/=t}},getBound:function(e){for(var t=new THREE.Box2,n=0,i=e.length;n<i;n++)t.expandByPoint(e[n]);return t},isPointInArea:function(e,t,n){var i=this.getBound(e);if(t.x<i.min.x||t.x>i.max.x||t.y<i.min.y||t.y>i.max.y)return!1;for(var o=!1,r=t.x,a=t.y,s=0,l=e.length-1;s<e.length;l=s++){var c=e[s].x,u=e[s].y,h=e[l].x,d=e[l].y;if((c-r)*(d-a)==(c-r)*(u-a)&&r>=Math.min(c,h)&&r<=Math.max(c,h)&&a>=Math.min(u,d)&&a<=Math.max(u,d))return!!n;u>a!=d>a&&r<(h-c)*(a-u)/(d-u)+c&&(o=!o)}return o},getArea:function(e){for(var t=e.length,n=0,i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return-.5*n},isInBetween:function(e,t,n,i){return e<=t&&t<=n||n<=t&&t<=e||this.closeTo(e,t,i)||this.closeTo(t,n,i)},ifPointAtLineBound:function(e,t,n){return he.isInBetween(t[0].x,e.x,t[1].x,n)&&he.isInBetween(t[0].y,e.y,t[1].y,n)},isLineIntersect:function(e,t,n){var i=e[1].y-e[0].y,o=e[0].x-e[1].x,r=i*e[0].x+o*e[0].y,a=t[1].y-t[0].y,s=t[0].x-t[1].x,l=a*t[0].x+s*t[0].y,c=i*s-a*o;if(0==c)return!1;var u=(s*r-o*l)/c,h=(i*l-a*r)/c;return n||he.ifPointAtLineBound({x:u,y:h},e)&&he.ifPointAtLineBound({x:u,y:h},t)?{x:u,y:h}:void 0},getNormal:function(e){var t,n,i=e.points[1].x-e.points[0].x,o=e.points[1].y-e.points[0].y;if(0!=o)n=-i*(t=1)/o;else{if(0==i)return console.log("两个点一样"),null;t=-o*(n=1)/i}var r=new THREE.Vector3(t,0,n),a=new THREE.Vector3(i,0,o);return r.cross(a).y>0&&(t*=-1,n*=-1),new THREE.Vector2(t,n).normalize()},getQuaBetween2Vector:function(e,t,n){var i=e.angleTo(t),o=e.clone().cross(t).normalize();return 0==o.length()?(new THREE.Quaternion).setFromAxisAngle(n,i):(new THREE.Quaternion).setFromAxisAngle(o,i)},getScaleForConstantSize:function(){var e,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Vector3;return function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a.width2d)e=a.width2d;else{var s;if(s="OrthographicCamera"==a.camera.type?(a.camera.right-a.camera.left)/a.camera.zoom/3:a.position.distanceTo(a.camera.position),null==a.nearBound&&null!=a.farBound||null!=a.nearBound&&null==a.farBound)return null==a.farBound&&s<a.nearBound?a.scale*s/a.nearBound:null==a.nearBound&&s>a.farBound?a.scale*s/a.farBound:a.scale;e=a.maxSize-(a.maxSize-a.minSize)*THREE.MathUtils.smoothstep(s,a.nearBound,a.farBound)}t.copy(a.position).project(a.camera),n.set(a.dom.clientWidth/2,a.dom.clientHeight/2,1).multiply(t),i.set(e/2,0,0).add(n),o.set(2/a.dom.clientWidth,2/a.dom.clientHeight,1).multiply(i),r.copy(o).unproject(a.camera);var l=r.distanceTo(a.position);return l}}(),getCrossPointAtRect:function(e,t,n,i,o,r){var a,s,l=(t.x-e.x)/(t.y-e.y);return((s=function(t){return 1/l*(t-e.x)+e.y}(a=t.x>=e.x?n+o:o))<r||s>r+i)&&(a=function(t){return l*(t-e.y)+e.x}(s=s<r?r:r+i)),new THREE.Vector2(a,s)},getDirFromUV:function(e){e.x%=1,e.x<0&&(e.x+=1);var t,n=Math.cos(e.y*Math.PI),i=2*Math.PI*e.x-Math.PI;t=-Math.PI/2<=i&&i<Math.PI/2?1:-1;var o=Math.tan(i),r=Math.sqrt((1-n*n)/(1+o*o)),a=o*r;return r*t<0&&(r*=-1,a*=-1),a*=-1,new THREE.Vector3(a,n,r)},getUVfromDir:function(e){return(e=e.clone()).x*=-1,{x:Math.atan2(e.x,e.z)/(2*Math.PI)+.5,y:Math.acos(e.y)/Math.PI}},crossRight:function(e,t){var n=t.elements,i=new THREE.Vector3;return i.x=n[0]*e.x+n[1]*e.y+n[2]*e.z+n[3],i.y=n[4]*e.x+n[5]*e.y+n[6]*e.z+n[7],i.z=n[8]*e.x+n[9]*e.y+n[10]*e.z+n[11],i},getNormalDir:function(e,t,n){var i=e.clone().sub(n.position);if(t)var o=n.rot90Matrix.clone();else o=n.matrixWorld.clone();return(i=this.crossRight(i,o)).normalize(),i},getDirByLonLat:function(e,t){var n=new THREE.Vector3,i=THREE.MathUtils.degToRad(90-t),o=THREE.MathUtils.degToRad(e);return n.x=Math.sin(i)*Math.cos(o),n.y=Math.cos(i),n.z=Math.sin(i)*Math.sin(o),n},getLineIntersect2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null!=e.A)var t=e.A,n=e.B,i=e.p1||(new THREE.Vector3).addVctors(t,e.dir0),o=e.p2||(new THREE.Vector3).addVctors(n,e.dir1),r=e.dir0||(new THREE.Vector3).subVectors(i,t),a=e.dir1||(new THREE.Vector3).subVectors(o,n);if(t.equals(n))return{pos3d:i.clone()};var s=r.clone().cross(a),l=he.getQuaBetween2Vector(s,new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0)),c=[t,n,i,o].map((function(e){return e.clone().applyQuaternion(l)})),u=he.isLineIntersect([{x:c[0].x,y:c[0].z},{x:c[2].x,y:c[2].z}],[{x:c[1].x,y:c[1].z},{x:c[3].x,y:c[3].z}],!0),h=l.clone().invert(),d=new THREE.Vector3(u.x,0,u.y),p=d.clone().setY(c[0].y),f=d.clone().setY(c[1].y);return p.applyQuaternion(h),f.applyQuaternion(h),{pos3d:d=(new THREE.Vector3).addVectors(p,f).multiplyScalar(.5),mid1:p,mid2:f}},getLineIntersect(e){if(null!=(e=e||{}).A)var t=e.A,n=e.B,i=e.p1,o=e.p2;if(t.equals(n))return{pos3d:i.clone()};var r=i.clone().sub(t).normalize(),a=o.clone().sub(n).normalize();r.angleTo(a);return function(){var e,r=i.x-t.x,a=i.y-t.y,s=i.z-t.z,l=o.x-n.x,c=o.y-n.y,u=o.z-n.z,h=t.x-n.x,d=t.y-n.y,p=t.z-n.z,f=r*r+a*a+s*s,m=r*l+a*c+s*u,v=l*l+c*c+u*u,g=r*h+a*d+s*p,A=l*h+c*d+u*p,y=f*v-m*m,E=y,w=y,b=0,C=0,x=function(t){e=(1==t?i:o).clone()}.bind(this);if(he.closeTo(y,0))b=0,E=1,C=A,w=v;else if(C=f*A-m*g,(b=m*A-v*g)<0)return x(1),{pos3d:e,behind:!0};if(C<0)return x(2),{pos3d:e,behind:!0};var I=0,T=0;I=he.closeTo(b,0)?0:b/E,T=he.closeTo(C,0)?0:C/w;var B=new THREE.Vector3(t.x+I*r,t.y+I*a,t.z+I*s),k=new THREE.Vector3(n.x+T*l,n.y+T*c,n.z+T*u);return{pos3d:B.clone().add(k).multiplyScalar(.5),mid1:B,mid2:k}}()},getShapeGeo:function(e,t){var n=new THREE.Shape;n.moveTo(e[0].x,e[0].y);for(var i=1,o=e.length;i<o;i++)n.lineTo(e[i].x,e[i].y);return t&&t.forEach((function(e){var t=new THREE.Path;t.moveTo(e[0].x,e[0].y);for(var i=1,o=e.length;i<o;i++)t.lineTo(e[i].x,e[i].y);n.holes.push(t)})),new THREE.ShapeBufferGeometry(n)},getUnPosPlaneGeo:function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([0,0,1,0,1,1,0,1]),n=new THREE.BufferGeometry;return n.setIndex(new THREE.BufferAttribute(e,1)),n.setAttribute("uv",new THREE.BufferAttribute(t,2)),function(){return n}}(),getPlaneGeo:function(e,t,n,i){var o=this.getUnPosPlaneGeo().clone(),r=new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z,n.x,n.y,n.z,i.x,i.y,i.z]);return o.setAttribute("position",new THREE.BufferAttribute(r,3)),o.computeVertexNormals(),o.computeBoundingSphere(),o},drawPlane:function(e,t,n,i,o){return new THREE.Mesh(this.getPlaneGeo(e,t,n,i),o)},movePlane:function(e,t,n,i,o){var r=new Float32Array([t.x,t.y,t.z,n.x,n.y,n.z,i.x,i.y,i.z,o.x,o.y,o.z]);e.geometry.setAttribute("position",new THREE.BufferAttribute(r,3)),e.geometry.computeBoundingSphere()},getAngle(e,t,n){var i=e.angleTo(t);return e.clone().cross(t)[n]<0&&(i*=-1),i},linearClamp:(e,t,n,i,o)=>i+(o-i)*((e=THREE.MathUtils.clamp(e,t,n))-t)/(n-t),isInsideFrustum(e,t){var n=new THREE.Matrix4;n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);var i=new THREE.Frustum;return i.setFromProjectionMatrix(n),e instanceof THREE.Sphere?i.intersectsSphere(e):i.intersectsBox(e)},getStandardYaw:(e,t)=>(Math.abs(e-t)>Math.PI&&(e>t?e-=2*Math.PI:t-=2*Math.PI),[e,t])},de={getEaseOut:function(e){var t;return(e=Math.round(e))<2?(e=Math.PI/2,t=de.easeOutSine):t=function(t,n,i,o){return e>2&&console.log(e),-i/Math.pow(-o,e)*Math.pow(t-o,e)+i},{k:e,easeFun:t}},linearTween:function(e,t,n,i){return n*e/i+t},easeInQuad:function(e,t,n,i){return n*(e/=i)*e+t},easeOutQuad:function(e,t,n,i){return-n*(e/=i)*(e-2)+t},easeInOutQuad:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,i){return n*(e/=i)*e*e+t},easeOutCubic:function(e,t,n,i){return e/=i,n*(--e*e*e+1)+t},easeInOutCubic:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,n,i){return n*(e/=i)*e*e*e+t},easeOutQuart:function(e,t,n,i){return e/=i,-n*(--e*e*e*e-1)+t},easeInOutQuart:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,n,i){return n*(e/=i)*e*e*e*e+t},easeOutQuint:function(e,t,n,i){return e/=i,n*(--e*e*e*e*e+1)+t},easeInOutQuint:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,n,i){return-n*Math.cos(e/i*(Math.PI/2))+n+t},easeOutSine:function(e,t,n,i){return n*Math.sin(e/i*(Math.PI/2))+t},easeInOutSine:function(e,t,n,i){return-n/2*(Math.cos(Math.PI*e/i)-1)+t},easeInExpo:function(e,t,n,i){return n*Math.pow(2,10*(e/i-1))+t},easeOutExpo:function(e,t,n,i){return n*(1-Math.pow(2,-10*e/i))+t},easeInOutExpo:function(e,t,n,i){return(e/=i/2)<1?n/2*Math.pow(2,10*(e-1))+t:(e--,n/2*(2-Math.pow(2,-10*e))+t)},easeInCirc:function(e,t,n,i){return e/=i,-n*(Math.sqrt(1-e*e)-1)+t},easeOutCirc:function(e,t,n,i){return e/=i,e--,n*Math.sqrt(1-e*e)+t},easeInOutCirc:function(e,t,n,i){return(e/=i/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:(e-=2,n/2*(Math.sqrt(1-e*e)+1)+t)},easeInElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)+t)},easeOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*i-o)*(2*Math.PI)/r)+n+t)},easeInOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:2==(e/=i/2)?t+n:(r||(r=i*(.3*1.5)),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*.5+n+t)},easeInBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*(e/=i)*e*((o+1)*e-o)+t},easeOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*((e=e/i-1)*e*((o+1)*e+o)+1)+t},easeInOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),(e/=i/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},easeOutBounce:function(e,t,n,i){return(e/=i)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInBounce:function(e,t,n,i){return n-de.easeOutBounce(i-e,0,n,i)+t},easeInOutBounce:function(e,t,n,i){return e<i/2?.5*de.easeInBounce(2*e,0,n,i)+t:.5*de.easeOutBounce(x,2*e-i,0,n,i)+.5*n+t}},pe={globalDone:null,funcs:[],counter:0,uniqueID:0,start(e,t,n,i,o,r,a,s){var l=!(arguments.length>8&&void 0!==arguments[8])||arguments[8];return i=i||0,this.funcs.push({func:e,current:-i*Math.abs(t),duration:(1-Math.max(i,0))*Math.abs(t),done:n,easing:o||de.linearTween,cycling:t<0,running:!0,debug:i<0,name:r||"T"+this.counter,id:void 0===a?this.counter:a,paused:!1,cancelFun:s,updateCount:0,ignoreFirstFrame:l}),e(0,16),this.counter+=1,e},trigger(e){var t=void 0===e.delayRatio?0:e.delayRatio,n=e.func||function(){},i=void 0===e.duration?0:e.duration;void 0!==e.cycling&&e.cycling&&(i=-Math.abs(i));var o=e.done||null,r=e.easing||de.linearTween,a=e.name||"R"+this.counter,s=void 0===e.id?this.counter:e.id;return this.start(n,i,o,t,r,a,s)},setTimeout(e,t,n){var i=void 0===n?this.counter:n;return this.trigger({done:e,duration:void 0===t?0:t,name:"O"+this.counter,id:i})},pause(){this.paused=!0},resume(){this.paused=!1},update(e){this.funcs.forEach((function(t){if(!(0==t.updateCount++&&t.ignoreFirstFrame||t.paused||(t.current+=1e3*e,t.current<0)))if(t.current>=t.duration&&!t.cycling){var n=t.easing(1,0,1,1);t.func(n,1e3*e),t.done&&t.done(),t.running=!1}else{var i=t.easing(t.current%t.duration/t.duration,0,1,1);(t.func(i,1e3*e)||!1)&&(t.done&&t.done(),t.running=!1)}}));var t=this.funcs.length;this.funcs=this.funcs.filter((function(e){return e.running}));var n=this.funcs.length;if(t>0&&0===n&&this.globalDone){var i=this.globalDone;this.globalDone=null,i()}},adjustSpeed(e,t){for(var n=this.getById(e),i=0;i<n.length;i++){var o=n[i];o.duration/=t,o.current/=t}},getById(e){return this.funcs.filter((function(t){return e===t.id}))},get(e){for(var t=0;t<this.funcs.length;t+=1)if(this.funcs[t].func===e)return this.funcs[t];return null},isRunning(e){var t=this.get(e);return null!==t&&t.running},countActive(){for(var e=0,t=0;t<this.funcs.length;t+=1)e+=this.funcs[t].running;return e},listActive(){for(var e=[],t=0;t<this.funcs.length;t+=1)this.funcs[t].running&&e.push(this.funcs[t].name);return e},done(e){this.globalDone=e},cancelById:function(e,t){var n=void 0===e?0:e;this.funcs=this.funcs.filter((function(e){var i=e.id==n;return i&&t&&e.cancelFun&&e.cancelFun(),!i}))},cancel(e){this.funcs=this.funcs.filter((function(t){return t.func!==e}))},getUniqueId(){return this.uniqueID-=1,this.uniqueID}};function fe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var ve,ge=0,Ae={delayOneFrame(e){window.setTimeout(e,1)},normalizeUrl:e=>e.replace("https://","http://"),domainFromUrl(e){var t=/^([^:]*:\/\/)?(www\.)?([^\/]+)/.exec(e);return t?t[3]:e},average(e,t){if(0===e.length)return null;for(var n=0,i=0,o=0;o<e.length;o++){n+=t?e[o][t]:e[o],i++}return n/i},countUnique(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1+(t[e[n]]||0);return Object.keys(t).length},averageVectors(e,t){var n=new THREE.Vector3;if(0===e.length)return n;for(var i=0,o=0;o<e.length;o++){var r=t?e[o][t]:e[o];n.add(r),i++}return n.divideScalar(i)},equalLists(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},lowerMedian:(e,t)=>0===e.length?null:(t=t||2,e.sort((function(e,t){return e-t})),e[Math.floor(e.length/t)]),stableSort:(e,t)=>e.map((function(e,t){return{value:e,index:t}})).sort((function(e,n){var i=t(e.value,n.value);return 0!==i?i:e.index-n.index})).map((function(e){return e.value})),sortByScore:function(e,t,n){var i=t?Ae.filterAll(e,t):e;return 0===i.length?[]:i=i.map((function(e){var t=n.map((function(t){return t(e)}));return{item:e,scores:t,score:t.reduce((function(e,t){return e+t}),0)}})).sort((function(e,t){return t.score-e.score}))},filterAll:(e,t)=>e.filter((function(e){return t.every((function(t){return t(e)}))})),formatDate:e=>[e.getFullYear(),e.getMonth()+1,e.getDate()].join("-"),formatDatetime:e=>[e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes()].join("-"),randomString(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t},uint8ToBase64(e,t){t&&"number"==typeof t||(t=8192);for(var n=[],i=0;i<e.length;i+=t)n.push(String.fromCharCode.apply(null,e.subarray(i,i+t)));return btoa(n.join(""))},uuid4:function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},nth:e=>1===(e%=10)?e+"st":2===e?e+"nd":3===e?e+"rd":e+"th",extendObject:(e,t)=>(Object.keys(t).forEach((function(n){e[n]=t[n]})),e),deepExtend:function e(t){t=t||{};for(var n=1;n<arguments.length;n++){var i=arguments[n];if(i)for(var o in i)i.hasOwnProperty(o)&&("object"==typeof i[o]?t[o]=e(t[o],i[o]):t[o]=i[o])}return t},inherit(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},extend(e,t){for(var n in t.prototype)e.prototype[n]=t.prototype[n]},extendObject(e,t){if(t instanceof Object)return Object.keys(t).forEach((function(n){e[n]=t[n]})),e},_textureCache:{},loadTextureFromCache(e){return this._textureCache[e]||(this._textureCache[e]=ye(e)),this._textureCache[e]},extend(e,t){for(var n in t.prototype)e.prototype[n]=t.prototype[n]},valueFromHash(e,t){var n=new RegExp("[#&?]"+e+"=([^#&?]*)").exec(window.location.href);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):window.decodeURIComponent(i)},deepFreeze(e){var t=this;return Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(n){!e.hasOwnProperty(n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||t.deepFreeze(e[n])})),e},defaultValue(e){if(null!=e&&"object"==typeof e)return Array.isArray(e)?[]:{}},randomUnique:()=>crypto.getRandomValues(new Uint32Array(1))[0],debounce(e,t){var n=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?function(){var n=this,i=Date.now();if(i-ge>=t){for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];e.apply(n,r),ge=i}}:function(){for(var i=arguments.length,o=new Array(i),r=0;r<i;r++)o[r]=arguments[r];n&&clearTimeout(n);var a=this;n=setTimeout((function(){e.apply(a,o)}),t)}},getMixedSet:function(e,t){return e.filter((function(e){return t.includes(e)}))},getUnionSet:function(e,t){return e.concat(t.filter((function(t){return!e.includes(t)})))},getDifferenceSet:function(e,t){var n=e.filter((function(e){return!t.includes(e)})),i=t.filter((function(t){return!e.includes(t)}));return n.concat(i)},getDifferenceSetMuti:function(e){var t=[];return e.forEach((function(e){e.forEach((function(e){var n=t.indexOf(e);n>-1?t.splice(n,1):t.push(e)}))})),t},pushToGroupAuto:function(e,t,n,i){var o=function(e,t){return e==t||n&&n(e,t)},r=t.filter((function(t){return t.find((function(n){return(o(n,e[0])||o(n,e[1]))&&(!i||i(t))}))}));if(r.length)if(e.forEach((function(e){r[0].includes(e)||r[0].push(e)})),r.length>1){var a=[];a.relationships=[e.slice()],r.forEach((function(e){var n=Ae.getUnionSet(a.relationships,e.relationships);(a=Ae.getUnionSet(a,e)).relationships=n,t.splice(t.indexOf(e),1)})),t.push(a)}else r[0].relationships.push(e.slice());else e.relationships=[e.slice()],t.push(e)},disconnectGroup:function(e,t,n){var i=t.slice();return e.forEach((function(e){var i,o=t.find((function(t){var o=t.relationships.find((function(t){return e.every((function(e){return t.some((function(t){return function(e,t){return e==t||n&&n(e,t)}(t,e)}))}))}));if(o)return i=o,!0}));if(o){t.splice(t.indexOf(o),1),o.relationships.splice(o.relationships.indexOf(i),1);var r=[];o.relationships.forEach((function(e){Ae.pushToGroupAuto(e,r,n)})),t.push.apply(t,r)}})),{newGroups:t.filter((function(e){return!i.includes(e)}))}},removeFromGroup:function(e,t,n,i){if(t.relationships.filter((function(t){return!t.some((function(t){return e.some((function(e){return function(e,t){return e==t||i&&i(e,t)}(t,e)}))}))})).length!=t.relationships){n.splice(n.indexOf(t),1);var o=[];return t.relationships.forEach((function(e){Ae.pushToGroupAuto(e,o,i)})),n.push.apply(n,o),{newGroups:o}}},getMAXCUBETEXTURESIZE:function(){try{var e=document.createElement("canvas"),t=e.getContext("webgl");return t||(t=e.getContext("experimental-webgl")),t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE)}catch(e){return 0}}},ye=((ve=new THREE.TextureLoader).setCrossOrigin("Anonymous"),ve.crossOrigin=!0,function(e,t,n,i){var o=ve.load(e,t,n,i);return o.magFilter=o.minFilter=THREE.LinearFilter,o.needsUpadte=!0,o});Ae.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})},Ae.dataURLtoFile=function(e,t){for(var n=e.split(","),i=n[0].match(/:(.*?);/)[1],o=atob(n[1]),r=o.length,a=new Uint8Array(r);r--;)a[r]=o.charCodeAt(r);return new File([a],t,{type:i})},Ae.saveFile=function(e,t,n){var i=document.createElementNS("http://www.w3.org/1999/xhtml","a");i.href=e,i.download=t;var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(o),n&&n()},Ae.PrefixPng="data:image/png;base64,",Ae.getBlobSrc=function(e,t){var n=Ae.dataURLtoBlob((t?Ae.PrefixPng:"")+e);return window.URL.createObjectURL(n)},Ae.replaceAll=function(e,t,n){var i=new RegExp(t,"g");return e.replace(i,n)},Ae.randomWord=function(e,t,n){var i="",o=t,r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];e&&(o=Math.round(Math.random()*(n-t))+t);for(var a=0;a<o;a++){i+=r[Math.round(Math.random()*(r.length-1))]}return i},Ae.getRandomSid=function(){var e=Ae.randomWord(!0,5,7),t=(new Date).getTime()+"",n=t.length;return e+(t=t.substring(n-8,n-5)+t.substring(n-3,n))},Ae.getTime=function(e){var t="",n=parseInt(e/60);return n<10&&(t+="0"),t+=n,1==(e=parseInt(e%60)+"").length&&(e="0"+e),t=t+":"+e},Ae.CloneJson=function(e){var t=JSON.stringify(e);return JSON.parse(t)},Ae.CloneObject=function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0;if(i.includes(THREE.Object3D)||i.push(THREE.Object3D),o||(o=function(){}),!e||"number"==typeof e||"string"==typeof e||e instanceof Function||i.some((function(t){return e instanceof t}))||o(e))return e;if(e instanceof Array)return e.map((function(e){return n.CloneObject(e,t,i,o)}));if(e.clone instanceof Function)return e.clone();var r={};for(var a in e)e[a]instanceof Object&&!t?r[a]=this.CloneObject(e[a],t,i,o):r[a]=e[a];return r},Ae.CloneClassObject=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.ignoreList,i=void 0===n?[]:n,o=t.simpleCopyList,r=void 0===o?[]:o,a=new e.constructor;return this.CopyClassObject(a,e,{ignoreList:i,simpleCopyList:r}),a},Ae.CopyClassObject=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.ignoreList,o=void 0===i?[]:i,r=n.simpleCopyList,a=void 0===r?[]:r;for(var s in t){if(s in t.__proto__)break;o.includes(s)||(a.includes(s)?e[s]=t[s]:e[s]=this.CloneObject(t[s],!1,a))}},Ae.ifSame=function(e,t){if(e==t)return!0;if(!e||!t)return!1;if(e.constructor!=t.constructor)return!1;if(e instanceof Array){if(e.length!=t.length)return!1;for(var n=t.slice(0),i=function(t){if(null==(r=n.find((function(n){return ifSame(e[t],n)})))&&!n.includes(r)&&!e.includes(r))return{v:!1};var i=n.indexOf(r);n.splice(i,1)},o=0;o<e.length;o++){var r,a=i(o);if("object"==typeof a)return a.v}return!0}if(e.equals instanceof Function)return e.equals(t);if("number"==typeof e||"string"==typeof e)return!(!isNaN(e)||!isNaN(t))||e==t;if("object"==typeof e){var s=Object.keys(e),l=Object.keys(t);if(!ifSame(s,l))return!1;for(var c in e){if(!ifSame(e[c],t[c]))return!1}return!0}console.log("isSame出现例外")},Ae.canvasToImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/jpeg",o=arguments.length>4?arguments[4]:void 0,r=e.toDataURL(i,t);return n&&this.saveTex(r,i,o),r};var Ee,we=function(e){return"image/"+(e=e.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]};Ae.saveTex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg",n=arguments.length>2?arguments[2]:void 0;return function(n){e=e.replace(we(t),"image/octet-stream");n=n||"4dage_"+(new Date).getTime()+("png"==t?".png":".jpg");Ae.saveFile(e,n)}(n)},Ae.imgAddLabel=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement("canvas"),o=i.getContext("2d");o.canvas.width=e.width,o.canvas.height=e.height,o.drawImage(e,0,0,e.width,e.height);var r=e.width*n.widthRatioToImg,a=r*t.height/t.width;!n.leftRatioToImg&&n.rightRatioToImg&&(n.leftRatioToImg=1-n.rightRatioToImg-n.widthRatioToImg),!n.topRatioToImg&&n.bottomRatioToImg&&(n.topRatioToImg=1-n.bottomRatioToImg-a/e.height);var s=e.width*n.leftRatioToImg,l=e.height*n.topRatioToImg;return o.globalAlpha=null!=n.opacity?n.opacity:1,o.drawImage(t,s,l,r,a),Ae.canvasToImg(i)},Ae.pixelsArrayToDataUrl=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.7,o=document.createElement("canvas");o.width=t,o.height=n;var r=o.getContext("2d");e=new e.constructor(e);for(var a=4*t,s=0;s<parseInt(n/2);s++){var l=n-s-1,c=e.slice(s*a,s*a+a),u=e.slice(l*a,l*a+a);e.set(u,s*a),e.set(c,l*a)}var h=r.createImageData(t,n);h.data.set(e),r.putImageData(h,0,0);var d=o.toDataURL(i);return d},Ae.renderTargetToDataUrl=function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.7,r=t*n,a=new Uint8Array(4*r);i.readRenderTargetPixels(e,0,0,t,n,a);var s=this.pixelsArrayToDataUrl(a,t,n,o);return s},Ae.screenPass=new function(){this.screenScene=new THREE.Scene,this.screenQuad=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2,1)),this.screenQuad.material.depthTest=!0,this.screenQuad.material.depthWrite=!0,this.screenQuad.material.transparent=!0,this.screenScene.add(this.screenQuad),this.camera=new THREE.Camera,this.render=function(e,t,n){if(this.screenQuad.material=t,void 0===n)e.render(this.screenScene,this.camera);else{var i=e.getRenderTarget();e.setRenderTarget(n),e.clear(),e.render(this.screenScene,this.camera),e.setRenderTarget(i)}}},Ae.renderTex=function(e,t,n){var i=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.LinearMipmapLinearFilter,generateMipmaps:!0,format:THREE.RGBAFormat});return this.screenPass.render(t,e,i),i.texture},Ae.updateVisible=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0;e.unvisibleReasons||(e.unvisibleReasons=[]),e.visibleReasons||(e.visibleReasons=[]);var r,a=function(){e.unvisibleReasons=e.unvisibleReasons.sort((function(e,t){return t.level-e.level})),e.visibleReasons=e.visibleReasons.sort((function(e,t){return t.level-e.level}));var n=(e.visibleReasons[0]?e.visibleReasons[0].level:-1)>=(e.unvisibleReasons[0]?e.unvisibleReasons[0].level:-1);e.visible!=n&&(e.visible=n,e.dispatchEvent({type:"isVisible",visible:n,reason:t}))};n?((r=e.unvisibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(o="cancel",e.unvisibleReasons.splice(r,1)),"add"==o&&(e.visibleReasons.some((function(e){return e.reason==t}))||e.visibleReasons.push({reason:t,level:i}))):((r=e.visibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(o="cancel",e.visibleReasons.splice(r,1)),"cancel"!=o&&(e.unvisibleReasons.some((function(e){return e.reason==t}))||e.unvisibleReasons.push({reason:t,level:i})));a()},Ae.getObjVisiByReason=function(e,t){return!!e.visible||(!e.unvisibleReasons||!e.unvisibleReasons.some((function(e){return e.reason==t})))},Ae.setCameraLayers=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e.layers.disableAll(),t.concat(n).forEach((function(t){var n=Potree.config.renderLayers[t];null!=n?e.layers.enable(n):console.error("setCameraLayer没找到layer!")}))},Ae.setObjectLayers=function(e,t){var n=Potree.config.renderLayers[t];null!=n?e.traverse((function(e){e.layers.set(n)})):console.error("setCameraLayer没找到layer!")},Ae.intervalTool={list:[],isWaiting:function(e,t,n){var i=this,o=this.list.find((function(t){return t.name==e}));if(o)o.requestUpdate=!0;else{var r=t();o={name:e},this.list.push(o),setTimeout((function(){var a=i.list.indexOf(o);i.list.splice(a,1),(o.requestUpdate||r)&&i.isWaiting(e,t,n)}),n)}}},Ae.batchHandling={lists:[],getSlice:function(e,t,n){var i=n.stopWhenAllUsed,o=n.minCount,r=void 0===o?5:o,a=n.maxCount,s=void 0===a?100:a,l=n.durBound1,c=n.durBound2,u=n.maxUseCount;if(0==t.length||!(u=null==u?Ae.getBestCount({name:e,minCount:r,maxCount:s,durBound1:l,durBound2:c,ifLog:!1}):u))return{list:[]};this.lists[e]||(this.lists[e]={list:[]});var h=this.lists[e].list.filter((function(e){return t.some((function(t){return e.item==t}))}));this.lists[e].list=h,t.forEach((function(e){h.some((function(t){return t.item==e}))||h.push({item:e,count:0})}));var d=h.filter((function(e){return 0==e.count})),p=[];if(d.slice(0,u).forEach((function(e){p.push(e.item),e.count++})),d.length>u);else{if(!i){var f=Math.min(t.length,u)-p.length;h.slice(0,f).forEach((function(e){p.push(e.item),e.count++}))}h.forEach((function(e){return e.count--}))}return{list:p}},addSliceListen(e){var t=e.getList,n=e.callback,i=e.minCount,o=e.maxCount;e.durBound1,e.durBound2,e.maxHistory;var r,a,s=e.player;s.on("update",(function(e){if(!s.flying){var l,c=t(),u=!s.lastFrameChanged,h=s.lastFrameChanged||!a;h?(l=c,r=null):(r||(r=Ae.getDifferenceSet(c,a)),l=r);var d=Ae.batchHandling.getSlice("ifVideoInsight",l,{stopWhenAllUsed:u,minCount:i,maxCount:o,durBound1:3,durBound2:13,maxHistory:3}).list;d.forEach(n),h||(r=Ae.getDifferenceSet(r,d)),a=d}}))}},Ae.getBestCount=(Ee={},function(e){var t,n=e.name,i=e.minCount,o=void 0===i?1:i,r=e.maxCount,a=void 0===r?6:r,s=e.durBound1,l=void 0===s?1:s,c=e.durBound2,u=void 0===c?4:c,h=e.ifLog,d=e.maxHistory,p=performance.getEntriesByName("loop-start");if(p.length){var f=performance.now()-p[p.length-1].startTime;t=Math.round(he.linearClamp(f,l,u,a,o)),d&&(Ee[n]||(Ee[n]=[]),0==t&&Ee[n].length>d-1&&!Ee[n].some((function(e){return e>0}))&&(t=1),Ee[n].push(t),Ee[n].length>d&&Ee[n].splice(0,1)),h&&console.log(n,t," ,dur:",f.toFixed(3))}else t=a;return t}),Ae.timeMeasuring={reportTimings:!1,collection:{},registerCollect(e,t){this.collection[e]=t,t.measures=[],t.sum=0},addTimeMark:function(e,t,n){var i=this.collection[e],o=performance.now(),r=i&&(i.measures.length<i.minCount||o-i.lastAddTime>i.refreshTime);if(r||this.reportTimings){if("end"==t&&0==performance.getEntriesByName(e+"-start").length)return;if(performance.mark(e+"-"+t),"end"==t){var a=performance.measure(e,e+"-start",e+"-end");if(!a)return;n&&console.log(e,"耗时",a.duration.toFixed(3)),r&&(i.measures.length>=i.minCount&&(i.measures=[],i.sum=0),i.measures.push(a.duration),i.sum+=a.duration,i.mean=i.sum/i.measures.length,i.measures.sort((function(e,t){return e-t})),i.median=i.measures[parseInt(i.measures.length/2)],i.lastAddTime=o,i.measures.length,i.minCount)}}},report:function(e){if(this.toggle||(this.toggle=e),e-this.toggle>1e3){if(this.reportTimings){var t,n=performance.getEntriesByType("measure"),i=new Set,o=fe(n);try{for(o.s();!(t=o.n()).done;){var r=t.value;i.add(r.name)}}catch(e){o.e(e)}finally{o.f()}var a,s=new Map,l=fe(i);try{for(l.s();!(a=l.n()).done;){var c=a.value;s.set(c,{measures:[],sum:0,n:0,min:1/0,max:-1/0})}}catch(e){l.e(e)}finally{l.f()}var u,h=fe(n);try{for(h.s();!(u=h.n()).done;){var d=u.value,p=s.get(d.name);p.measures.push(d),p.sum+=d.duration,p.n++,p.min=Math.min(p.min,d.duration),p.max=Math.max(p.max,d.duration)}}catch(e){h.e(e)}finally{h.f()}var f,m=fe(s);try{for(m.s();!(f=m.n()).done;){var v=ce(f.value,2),g=(v[0],v[1]);g.mean=g.sum/g.n,g.measures.sort((function(e,t){return e.duration-t.duration})),1===g.n?g.median=g.measures[0].duration:g.n>1&&(g.median=g.measures[parseInt(g.n/2)].duration)}}catch(e){m.e(e)}finally{m.f()}var A=Array.from(i).reduce((function(e,t){return Math.max(e,t.length)}),0)+5,y=" ".concat("NAME".padEnd(A)," |")+" ".concat("MIN".padStart(5)," |")+" ".concat("MEDIAN".padStart(5)," |")+" ".concat("MAX".padStart(5)," |")+" ".concat("AVE".padStart(5)," |")+" ".concat("SAMPLES".padStart(4)," \n");y+=" ".concat("-".repeat(y.length),"\n");var E,w=fe(i=Array.from(i).sort());try{for(w.s();!(E=w.n()).done;){var b=E.value,C=s.get(b),x=C.min.toFixed(2),I=C.median.toFixed(2),T=C.max.toFixed(2),B=C.n,k=C.mean.toFixed(2);y+=" ".concat(b.padEnd(A)," |")+" ".concat(x.padStart(5)," |")+" ".concat(I.padStart(5)," |")+" ".concat(T.padStart(5)," |")+" ".concat(k.padStart(5)," |")+" ".concat(B.toString().padStart(4),"\n")}}catch(e){w.e(e)}finally{w.f()}y+="\n",console.log(y)}performance.clearMarks(),performance.clearMeasures(),this.toggle=e}}},Ae.isVideoPlayed=function(e){return!e.paused&&!isNaN(e.duration)},Ae.GifTexDeal={animateObjects:[],animateTexs:[],addAnimation:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{delay:0},o=arguments.length>3?arguments[3]:void 0,r=this.animateTexs.find((function(t){return t.texture==e}));r?n=r:(n={texture:e,info:i},this.animateTexs.push(n),this.setRepeart(n));var a={animation:n,owner:t,id:o};return this.animateObjects.push(a),a},remove:function(e){var t=this.animateObjects.indexOf(e);if(t>-1){if(this.animateObjects.splice(t,1),!this.animateObjects.find((function(t){return t.animation==e.animation}))){var n=this.animateTexs.indexOf(e.animation);this.animateTexs.splice(n,1),e.animation.texture.repeat.set(1,1)}this.stop(e)}},setRepeart:function(e){e.texture.repeat.set(1/e.info.cellXcount,1/e.info.cellYcount)},start:function(e){var t=this;if(e&&!e.started&&(e.started=!0,!e.animation.started)){e.animation.started=!0;var n=e.animation.info,i=n.cellXcount*n.cellYcount-(n.voidCount||0);if(!(i<=1)){e.startCallback&&e.startCallback();var o=n.duration+n.delay,r=n.delay/o;pe.start((function(t){var o=Math.floor((i-1)*t),r=o%n.cellXcount,a=n.cellYcount-Math.floor(o/n.cellXcount)-1;e.animation.texture.offset.x=r/n.cellXcount,e.animation.texture.offset.y=a/n.cellYcount}),o,(function(){e.started=!1,e.animation.started=!1,n.waitNextLoop=setTimeout((function(){t.start(e)}),n.waitNextTime||0)}),r,null,e.id,"gif_"+e.animation.texture.id)}}},stop:function(e){e&&e.started&&(e.started=!1,this.animateObjects.find((function(t){return t.animation==e.animation&&t.started}))||(pe.cancelById("gif_"+e.animation.texture.id),e.animation.texture.offset.set(0,0),e.animation.started=!1,clearTimeout(e.animation.info.waitNextLoop)))}},Ae.getNestedValue=function(e,t){var n,i=e,o=fe(t.split("."));try{for(o.s();!(n=o.n()).done;){var r=n.value;if(void 0===(i=Array.isArray(i)&&!isNaN(parseInt(r))?i[parseInt(r)]:i[r]))return}}catch(e){o.e(e)}finally{o.f()}return i},Ae.watch=function(e,t,n){var i=n;Object.defineProperty(e,t,{get:function(){return i},set:function(e){console.warn("watch:",t,e),i=e}})},Ae.realVisible=function(e){for(var t,n=!0,i=e;i;){if(!1===i.visible){n=!1;break}t=i,i=i.parent}return!n||t instanceof THREE.Scene||(n=!1),n},Ae.isChildOf=function(e,t){for(var n;n&&n!=t;)n=n.curParent;if(n)return!0};var be=function(e){Ae.extend(e,EventEmitter)},Ce={mobileVersion(e,t){var n=window.navigator.userAgent.match(e);return n=n?n[1].split(t):[],{major:parseInt(n[0])||0,minor:parseInt(n[1])||0,patch:parseInt(n[2])||0}},isFullscreen:()=>document.fullscreenElement||document.mozFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,supportsFullscreen:()=>document.fullscreenEnabled||document.mozFullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled,isPointerLocked:()=>document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement,requestFullscreen(e,t){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen&&e.msRequestFullscreen(),t&&$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",Ce.requestPointerLock)},requestPointerLock(){var e;if(document.fullscreenElement)e=document.fullscreenElement();else if(document.mozFullscreenElement)e=document.mozFullscreenElement();else if(document.mozFullScreenElement)e=document.mozFullScreenElement();else{if(!document.webkitFullscreenElement)return;e=document.webkitFullscreenElement()}e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock(),$(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",this)},exitPointerLock(){document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()},exitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},details(){var e=navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");return e?{name:e[1],version:parseInt(e[2]),platform:navigator.platform}:{}},is(e){return this.details()&&this.details().name===e},inIframe:()=>window.parent!==window,aspectRatio(){var e=window.innerWidth/window.innerHeight;return isFinite(e)?e:0},userAgent:()=>window.navigator.userAgent,isMobile(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isLandscape(){return this.isMobile&&this.aspectRatio()>1},isSmallScreen:()=>screen.width/window.devicePixelRatio<240,detectWeixin:function(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},detectWeixinMiniProgram:function(){return window.navigator.userAgent.match("miniProgram")},detectIE:()=>-1!==window.navigator.userAgent.indexOf("MSIE ")||!!navigator.userAgent.match(/Trident.*rv\:11\./),detectSafari(){return-1!==window.navigator.userAgent.indexOf("Safari")&&!this.detectChrome()},detectFirefox:()=>-1!==window.navigator.userAgent.indexOf("Firefox"),detectChrome(){return-1!==window.navigator.userAgent.indexOf("Chrome")&&!this.detectOpera()},detectOpera:()=>-1!==window.navigator.userAgent.indexOf("OPR"),detectIOS(){return this.detectIPhone()||this.detectIPad()||this.detectIPod()},detectIPad(){var e=window.navigator.userAgent;return/iPad/.test(e)},detectIPod(){var e=window.navigator.userAgent;return/iPod/.test(e)},detectIPhone(){var e=window.navigator.userAgent;return/iPhone/.test(e)},detectAndroid:()=>-1!==window.navigator.userAgent.indexOf("Android"),detectAndroidMobile(){var e=window.navigator.userAgent;return this.detectAndroid()&&-1!==e.indexOf("Mobile")},detectSamsungNative(){var e=window.navigator.userAgent;return-1!==e.indexOf("SM-G900H")||-1!==e.indexOf("GT-I9500")||-1!==e.indexOf("SM-N900")},detectSamsungS6:()=>-1!==window.navigator.userAgent.indexOf("SM-G92"),detectHUAWEI5X:()=>-1!==window.navigator.userAgent.indexOf("KIW-TL00H"),detectWebVR:()=>!(!window.navigator.getVRDisplays||!window.VRDisplay),getVRDisplay(){var e=this;return new Promise((function(t,n){e.detectWebVR()?navigator.getVRDisplays().then((function(e){e.length>=1?t(e[0]):n(null)})).catch((function(){return n(null)})):n(null)}))},iosVersion(){if(!this.detectIOS())throw new DeviceMismatchException("Did not detect an iDevice");return this.mobileVersion(/((?:\d+\_?){1,3}) like Mac OS/,"_")},androidVersion(){if(!this.detectAndroid())throw new DeviceMismatchException("Did not detect an Android based device");return this.mobileVersion(/Android ((?:\d+\.?){1,3})/,".")},valueFromCookie(e,t){var n=new RegExp(e+"=([0-9a-f]+)(; ?|$)").exec(document.cookie);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):i},valueFromHash(e,t){var n=new RegExp("[#&?]"+e+"=([^#&?]*)").exec(window.location.href);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):window.decodeURIComponent(i)},valueFromUrl(e){return this.urlHasValue(e,!0)},urlHasValue:function(e,t){var n=window.location.search.substr(1).split("&");if(t){for(var i=0;i<n.length;i++){var o=n[i].split("=");if(2===o.length&&o[0]===e)return o[1]}return""}for(var r=0;r<n.length;r++){if(n[r].split("=")[0]==e)return!0}return!1}},xe={green:new THREE.Color("#15FFE2"),yellow:new THREE.Color("#F6FE14"),lightGreen:new THREE.Color("#09e1c0"),newBlue:new THREE.Color("#00c8ae"),altBlue:new THREE.Color(47355),tagDefault:new THREE.Color(223357),classicBlue:new THREE.Color(53759),mpYellow:new THREE.Color(16502016),mpOrange:new THREE.Color(16428055),mpBlue:new THREE.Color(12096),mpLtGrey:new THREE.Color(13751252),mpDkGrey:new THREE.Color(10000019),mpRed:new THREE.Color(12525854),mpOrangeDesat:new THREE.Color(16764529),mpBlueDesat:new THREE.Color(4034734),mpRedDesat:new THREE.Color(14705505),white:new THREE.Color(16777215),black:new THREE.Color(0),_desat(e,t){var n=t||.3,i=(new THREE.Color).copy(e).getHSL(e);return(new THREE.Color).setHSL(i.h,i.s*(1-n),i.l)},_darken(e,t){var n=t||.2,i=e.getHSL(e);return(new THREE.Color).setHSL(i.h,i.s,i.l*(1-n))}},Ie="black",Te="std",Be="walk";Math.sign=function(e){return e<0?-1:1};var ke={signedUrlDefaultExpireTime:24e4,signedUrlCheckInterval:1e4,signedUrlRefreshBuffer:15e3,dollhouseFOV:Ce.isMobile()?90:70,dollhouseNear:1,dollhouseFar:5e3,insideFOV:Ce.isMobile()?90:70,insideFOVMax:120,insideNear:.1,insideFar:5e3,insideLookSpeed:.12,insideLookLimitUp:"sds"==Ce.valueFromUrl("ai")?50:Ce.isMobile()?15:25,insideLookLimitDown:"sds"==Ce.valueFromUrl("ai")?-50:Ce.isMobile()?-15:-25,orthoNear:1,orthoFar:5e3,orthoBase:10,narrowLandscapeHeight:290,reallyNarrowLandscapeHeight:250,visionTilingStartDate:new Date("8/26/2016"),visionTilingStartVersion:"1.1.407.13667",windowHeightHighQualityThreshold:900,tourStepDelayDefault:3500,tourStepDelaySlideShow:5e3,workshopApsect:9/16,highQualityMaxZoom:2,ultraHighQualityMaxZoom:3},Pe=1,Re=1,Me=2,Se=2,De=5,Fe=6,Le=7,He=9,Qe=9,Oe=10,Ve=11,_e=13,Ue=14,Ne=14,ze=20,Ge={visions:2,debug:!1,version:"2.23.8-0-g24ec69e",skyboxRadius:2500,job:"dacf7dfa24ae47fab8fcebfe4dc41ab9",preTexture:"_50k_texture_jpg_high1",format:"_50k.dam",skyboxRadius:2500,modelBoundsPadding:5,showNeighbors:!1,useWheel:Ce.valueFromHash("wh",!0),crossOrigin:"anonymous",fancierTransition:!1,wireframe:!1,skyboxWireframe:!1,modelAlpha:1,highlightPanoSelection:!1,showSweeps:!0,showSkyboxes:!1,showMesh:!0,showFloors:!1,showFloorDuration:300,showFloorDelay:300,hideFloorDuration:300,hideFloorDelay:0,reticuleOpacityTransitionTime:250,reticuleColor:xe.newBlue,markerOpacityTransitionTime:500,guiAnimationSpeed:250,highlightAnimationDuration:500,modelComponentLoadSpinnerDelay:150,captureErrors:!1,maxMobileTextures:6,minimalMemoryMode:Ce.valueFromHash("m3",Ce.isMobile()),startupFlyinDelay:3e3,vrEnabled:!1,overlay:{width:1,height:.5,depth:.04},dollhouseDefault:{minDistance:15,maxDistance:50,minPolarAngle:THREE.MathUtils.degToRad(10),maxPolarAngle:THREE.MathUtils.degToRad(90)},hideReticuleTimeout:1e3,analytics:{inactivityThreshold:30,sessionTrackingRate:.15,maxTrackedErrors:20,sessionDurationPingFrequency:10,sessionDurationTimeout:15},flydown:{movementEasing:"easeInOutQuad",movementDelay:.001,rotationEasing:"easeInOutQuad",rotationDelay:.5,modelTextureDelay:.75,skyboxDelay:.75},transition:{flySpeed:.0043,flyTime:650,flytimeMaxDistanceThreshold:10,flytimeDistanceMultiplier:120,maxRotSpeed:1.2,aimTime:1500,aimSlowFactor:1.5,blur:.8,movementEasing:"easeOutSine",blendEasing:"easeInOutQuad",fastForwardFactor:Ce.valueFromHash("mfis",3)},show360Views:{enabled:!0,transitionTime:1e3},quickstart:{enabled:1,animation:1400,showTextDelay:500,fadeOutDelay:3e3,fovChange:10},appConfig:{webvr_version:null,segment_key:null,embedly_key:null,branch_key:null,keen_write_key:null,keen_project_id:null},input:{longTapThreshold:200,moveToleranceNDC:.08,touchMoveThreshold:25},labels:{enabled:!1,hideUntilStart:!0,fadeInDuration:250,fadeInDelay:250,fadeOutDuration:250,fadeOutDelay:0,zoomHideThreshhold:{mobile:Ce.isSmallScreen()?.45:.6,desktop:2},zoomTruncateThreshhold:{mobile:Ce.isSmallScreen()?.35:.45,desktop:.85},minLengthForTruncate:16,truncateLength:12,truncateSuffix:"..."},tags:{enabled:Ce.valueFromHash("mt",1),startup:{hideUntilStart:!0,fadeInDuration:500,fadeInDelay:100},visibility:{anyDistance:!0,visibleDistance:8,cameraClearance:.1,alphaTestLevel:.05,hideViaFloor:!0,hideOffScreenDisc:!1,hideOffScreenObject:!1},disc:{opacity:1,disabledOpacity:.5,scale:{nearBound:1.5,farBound:4.8,linkFarBound:!1,linkPercent:40,maxSize:80,minSize:40,baseViewportSize:800,responsiveness:100}},pole:{enabled:!0,height:.5,width:2,opacity:.5,color:"white"},navigate:{nearestPano:!0,lineOfSight:!0,reactivate:!0,aimAt:"disc",tiltTolerance:25,rotateSpeedFactor:.6}},view360:{circleDisToCenter:2.4,visibleDisAtView:15},boundExpandLength:1.5,path:{color:xe.newBlue,colorUp:xe._desat(xe.newBlue,.5),colorDown:xe._darken(xe.newBlue,.35),opacity:.5,style:"ribbon",height:.025,ribbonWidth:.24,outsideHeight:.5,waypointRadius:.5,waypointIndoorRadius:.24,waypointPulse:1e3,typ:Ie,meshFree:Ce.valueFromHash("mf",1),mapGuides:Ce.valueFromHash("guides",!0),fadeInTime:400,fadeOutTime:300},warp:{nearPanoDist:.1,matchCam:!1,blur:.33,fastTime:1500,teleportTime:1500,outsideTime:2e3,lookAheadMax:.3,lookAheadDist:2.5,softPushDist:.37,softPushEnd:.3,softBendAngle:8,softBendTilt:4,softBendEnd:.3,doBurns:Ce.valueFromHash("kb",!0),burnsAngle:35,minBurnsAngle:35,minDownAngle:-35,maxTurnPerSec:280,maxAimPerSec:35,minRotation:12,maxAimRotation:33.2,turnFriction:.2,flySpeed:.01,minWarpTime:1200,warpInterruptionRedirectTime:500,tourStepDelay:Ce.valueFromHash("st",0),walkDelay:0,walkMaxDist:50,walkMinDist:.8,walkSlideShowThreshhold:3e3,walkExtraPanosDistance:.4,timePerMeter:800,motionLeadTime:500,movementEasing:"easeInOutQuad",blendEasing:"easeInOutQuad",showBunny:!1,loop:Ce.valueFromHash("lp",!1),auto:Ce.valueFromHash("ts",-1),eOrder:"YXZ",stepFactor:.25,brakeStrength:2,minBrakeAngle:.1,maxBrakeAngle:1.8,climbEffort:4},rotationFriction:Ce.isMobile()?.08:.05,rotationAccelerationInside:4.5,rotationAccelerationOutside:.15,rotationAfterMoveMultiplierX:Ce.isMobile()?120:40,rotationAfterMoveMultiplierY:40,rotationAfterMoveHistoryCount:5,panFriction:.09,panAccelerationOutside:60,zoomNearLimit:.1,zoomFarLimit:10,navigation:{panoScores:!1,mouseDirection:!0,filterStrictness:.75,angleFactor:-30,directionFactor:10,distanceFactor:-1,optionalityFactor:3},sdkInit:!1,secretPanelWord:[38,38,40,40,37,39,37,39,66,65],console:Ce.valueFromHash("console",!1),noMeshFloorPositionOffset:new THREE.Vector3(0,-1.2,0),panoramaNeighbourMaxDistance:5,panoFloorClickRadius:.35,showScreenshotLocations:!1,showAxis:!1,showNeighbourRaycasts:!1,colorMarkerOnLoad:!1,colorMarkerByFloor:!1,tiling:{panoPreRenderRepeatDelay:2500,panoPreRenderDelay:500,preRenderTourPanos:Ce.valueFromHash("tileprerender",0),tilingFlagNames:["usetiles","tiles"],maxNavPanoQuality:Ce.valueFromHash("maxtileq",null),maxZoomPanoQuality:Ce.valueFromHash("maxztileq",null),overlayStyle:Ce.valueFromHash("tileoverlay",0),uploadIntervalDelay:Ce.valueFromHash("tileupdelay",10),initialIntervalDelay:Ce.valueFromHash("itiledelay",0),maxNonBaseUploadsPerFrame:Ce.valueFromHash("maxnbtpf",2),maxBaseUploadsPerFrame:Ce.valueFromHash("maxbtpf",6),customCompression:Ce.valueFromHash("tilecustcomp",0),mobileHighQualityOverride:!1,allowUltraHighResolution:!0},zoom:{enabled:!0,forceOff:Ce.valueFromHash("nozoom",0),overridemax:Ce.valueFromHash("maxzoom",null),overridemin:Ce.valueFromHash("minzoom",null),max:ke.highQualityMaxZoom,min:1,transitionStyle:Ce.valueFromHash("zoomtrans",1),activationThreshold:1.1,restoreTime:500,zoomToDefaultWhenToPano:!0},profiling:{enabled:Ce.valueFromHash("mem",!1)}};(Ge=Ae.deepExtend(Ge,ke,{insideFOV:Ce.valueFromHash("fov",ke.insideFOV),insideFOVMax:Ce.valueFromHash("fovmax",ke.insideFOVMax),panorama:{transitionTime:1e3,modelAlpha:0,modelAlphaDelay:Ge.flydown.modelTextureDelay,modelAlphaLength:1,skyboxOpacity:1,skyboxOpacityDelay:Ge.flydown.skyboxDelay,skyboxOpacityLength:.9,fovLength:1,fovDelay:0,cameraMatrixDuration:.8,cameraMatrixDelay:0,cameraMatrixEase:de.easeInCubic,reticuleOpacity:1,markerOpacity:.3,markerOpacityOnHover:1},dollhouse:{transitionTime:1e3,modelAlpha:1,modelAlphaDelay:0,modelAlphaLength:1-Ge.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-Ge.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.8,cameraMatrixDelay:.3,cameraMatrixEase:de.easeInQuint,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0},floorplan:{transitionTime:1e3,modelAlpha:1,modelAlphaDelay:0,modelAlphaLength:1-Ge.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-Ge.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.5,cameraMatrixDelay:0,cameraMatrixEase:de.easeOutQuint,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0,cameraHeight:50},transitioning:{reticuleOpacity:0,markerOpacity:.3,markerOpacityOnHover:1},"floorplan-dollhouse":{rotationDelay:0,rotationDuration:1,cameraMatrixEase:de.easeInQuint},"floorplan-panorama":{rotationDelay:.5,rotationDuration:1},"dollhouse-panorama":{rotationDelay:.5,rotationDuration:1},"dollhouse-floorplan":{rotationDelay:0,rotationDuration:1,cameraMatrixDuration:1.05,cameraMatrixDelay:.5},"panorama-dollhouse":{rotationDelay:0,rotationDuration:.5,cameraMatrixEase:de.easeInOutQuad},"panorama-floorplan":{transitionTime:1500,rotationDelay:0,rotationDuration:.5},floorMat:{"stardard-hide":{opacity:.2,brightness:.12,mixRatio:.7,depthTest:!0,renderOrder:Oe},"stardard-show":{opacity:1,brightness:0,mixRatio:0,depthTest:!0,renderOrder:Re},"hasPlane-normal":{opacity:.024,brightness:.6,mixRatio:1,depthTest:!0,renderOrder:Oe},"hasPlane-curFloor":{opacity:1,brightness:.1,mixRatio:.98,depthTest:!0,renderOrder:Re}}})).path.meshFree&&(Ge.path.typ=Be),Ge.zoom.max=Ge.zoom.overridemax||Ge.zoom.max,Ge.zoom.min=Ge.zoom.overridemin||Ge.zoom.min,Ge.HorizontalBlurShader=new THREE.ShaderPass(THREE.HorizontalBlurShader),Ge.VerticalBlurShader=new THREE.ShaderPass(THREE.VerticalBlurShader),Ge.VerticalBlurShader.renderToScreen,Ge.aspect=window.innerWidth/window.innerHeight,isNaN(ke.aspect)&&(ke.aspect=1),Ge.planeBufferGeometry=new THREE.PlaneBufferGeometry(.4,.4,1,1),Ge.freeze=Object.freeze({FlyToPano:pe.getUniqueId(),FlyToNewMode:pe.getUniqueId(),FlyToSameMode:pe.getUniqueId(),FlyToViewFloor:pe.getUniqueId(),LookTransition:pe.getUniqueId(),ZoomTransition:pe.getUniqueId(),LookRotationForPlay:pe.getUniqueId(),wallLineShine:pe.getUniqueId(),spotShine:pe.getUniqueId(),rulerShine:pe.getUniqueId(),outsideFocus:pe.getUniqueId(),shopCircle:pe.getUniqueId()});var je,We,qe,Je=Ge,Ye=ae(),Ze={};function Xe(e,t){if(void 0!==Ze[e]&&console.warn("Identifier component.".concat(e," has already been declared")),"function"!=typeof t)throw TypeError("argument component not a function");Ze[e]=t}var Ke=be((qe=We=function(){function e(t){o(this,e),this.uid=e.uid++,this.env=e.env,this.version=e.version,this.dom=null,this.$plugins=null,this.core=new ie(this),this.config=e.config(t,{}),this.Plugins=new te(this),this.gui=new le(this),null!=this.config.vr.markerHeight&&(Je.vrMarkerHeight=this.config.vr.markerHeight),null!=this.config.scene.markerOpacity&&(Je.panorama.markerOpacity=this.config.scene.markerOpacity),null!=this.config.scene.pathEndColor&&(Je.path.color=this.config.scene.pathEndColor)}return u(e,[{key:"withConfig",value:function(e){this.config=Y(this.config,e||{})}},{key:"withDom",value:function(){if(!this.dom){var e="string"==typeof this.config.dom?document.querySelector(this.config.dom):this.config.dom;if(!e)throw new Error("options.dom must be require");var t=document.createElement("div");t.className="kankan-app";var n=document.createElement("div");n.id="kankan-plugins__".concat(this.uid),n.className="kankan-plugins",n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",n.style.zIndex=10;var i=document.createElement("div");i.className="player",i.setAttribute("name","main");var o=document.createElement("div");o.className="player",o.setAttribute("name","copy");var r=document.createElement("div");r.className="player-mark",r.style.backgroundImage="url(".concat(this.resource.base("images/tag_pointer.png"),")"),i.appendChild(r),o.appendChild(r.cloneNode()),t.appendChild(n),t.appendChild(i),t.appendChild(o),e.appendChild(t),this.dom=t,this.$plugins=n}}},{key:"withComponent",value:function(e){var t=Ze[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];this.core.add(e,V(n,o))}else console.warn("component[".concat(e,"] not a function"))}},{key:"withNewComponent",value:function(e){var t=Ze[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];return V(n,o)}console.warn("component[".concat(e,"] not a function"))}}],[{key:"root",value:function(e){return Ye+e}},{key:"config",value:function(e,t){if("object"!=typeof e)return W;for(var n in t&&(t=Object.assign(t,W)),e)-1==["env","version"].indexOf(n)&&void 0!==W[n]&&(t&&(t[n]=e[n]),W[n]=e[n]);return t||W}}]),e}(),We.uid=1,We.env=W.env,We.version=W.version,We.Config=W,je=qe))||je,$e={};$e.RADIANS_PER_DEGREE=Math.PI/180,$e.DEGREES_PER_RADIAN=180/Math.PI,$e.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},$e.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("MathLight.Matrix4: the constructor no longer reads arguments. use .set() instead.")},$e.Matrix4.prototype={identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},applyToVector3:function(e){var t=e.x,n=e.y,i=e.z,o=this.elements;return e.x=o[0]*t+o[4]*n+o[8]*i+o[12],e.y=o[1]*t+o[5]*n+o[9]*i+o[13],e.z=o[2]*t+o[6]*n+o[10]*i+o[14],this},getInverse:function(e,t){var n=this.elements,i=e.elements,o=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],A=i[14],y=i[15],E=p*A*h-g*f*h+g*u*m-c*A*m-p*u*y+c*f*y,w=v*f*h-d*A*h-v*u*m+l*A*m+d*u*y-l*f*y,b=d*g*h-v*p*h+v*c*m-l*g*m-d*c*y+l*p*y,C=v*p*u-d*g*u-v*c*f+l*g*f+d*c*A-l*p*A,x=o*E+r*w+a*b+s*C;if(0===x){var I="MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(I);return console.warn(I),this.identity()}var T=1/x;return n[0]=E*T,n[1]=(g*f*s-p*A*s-g*a*m+r*A*m+p*a*y-r*f*y)*T,n[2]=(c*A*s-g*u*s+g*a*h-r*A*h-c*a*y+r*u*y)*T,n[3]=(p*u*s-c*f*s-p*a*h+r*f*h+c*a*m-r*u*m)*T,n[4]=w*T,n[5]=(d*A*s-v*f*s+v*a*m-o*A*m-d*a*y+o*f*y)*T,n[6]=(v*u*s-l*A*s-v*a*h+o*A*h+l*a*y-o*u*y)*T,n[7]=(l*f*s-d*u*s+d*a*h-o*f*h-l*a*m+o*u*m)*T,n[8]=b*T,n[9]=(v*p*s-d*g*s-v*r*m+o*g*m+d*r*y-o*p*y)*T,n[10]=(l*g*s-v*c*s+v*r*h-o*g*h-l*r*y+o*c*y)*T,n[11]=(d*c*s-l*p*s-d*r*h+o*p*h+l*r*m-o*c*m)*T,n[12]=C*T,n[13]=(d*g*a-v*p*a+v*r*f-o*g*f-d*r*A+o*p*A)*T,n[14]=(v*c*a-l*g*a-v*r*u+o*g*u+l*r*A-o*c*A)*T,n[15]=(l*p*a-d*c*a+d*r*u-o*p*u-l*r*f+o*c*f)*T,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,o=e.z,r=e.w,a=n+n,s=i+i,l=o+o,c=n*a,u=n*s,h=n*l,d=i*s,p=i*l,f=o*l,m=r*a,v=r*s,g=r*l;return t[0]=1-(d+f),t[4]=u-g,t[8]=h+v,t[1]=u+g,t[5]=1-(c+f),t[9]=p-m,t[2]=h-v,t[6]=p+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},$e.Quaternion=function(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1},$e.Quaternion.prototype={get x(){return this._x},set x(e){this._x=e},get y(){return this._y},set y(e){this._y=e},get z(){return this._z},set z(e){this._z=e},get w(){return this._w},set w(e){this._w=e},copy:function(e){this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w},inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this},setFromUnitVectors:function(){var e,t;return function(n,i){return void 0===e&&(e=new $e.Vector3),(t=$e.dot(n,i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?$e.setVector(e,-n.y,n.x,0):$e.setVector(e,0,-n.z,n.y)):$e.cross(n,i,e),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),multiply:function(e){return this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,o=e._z,r=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+r*a+i*l-o*s,this._y=i*c+r*s+o*a-n*l,this._z=o*c+r*l+n*s-i*a,this._w=r*c-n*a-i*s-o*l,this}},$e.convertWorkshopVector=function(e){return new $e.Vector3(-e.x,e.y,e.z)},$e.convertWorkshopQuaternion=function(e){return new $e.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new $e.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},$e.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e/16*(window.innerWidth/window.innerHeight)/ke.workshopApsect},$e.convertWorkshopPanoramaQuaternion=function(e){return new $e.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new $e.Quaternion).setFromAxisAngle(new $e.Vector3(0,1,0),270*$e.RADIANS_PER_DEGREE))},$e.normalize=function(e){var t=e.x*e.x+e.y*e.y+e.z*e.z,n=Math.sqrt(t);e.x/=n,e.y/=n,e.z/=n},$e.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},$e.cross=function(e,t,n){var i=e.x,o=e.y,r=e.z;n.x=o*t.z-r*t.y,n.y=r*t.x-i*t.z,n.z=i*t.y-o*t.x},$e.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},$e.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},$e.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},$e.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},$e.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,o=t.z,r=e.x,a=e.y,s=e.z,l=e.w,c=l*n+a*o-s*i,u=l*i+s*n-r*o,h=l*o+r*i-a*n,d=-r*n-a*i-s*o;t.x=c*l+d*-r+u*-s-h*-a,t.y=u*l+d*-a+h*-r-c*-s,t.z=h*l+d*-s+c*-a-u*-r},$e.angleBetweenVectors=function(e,t){return Math.acos($e.dot(e,t))},$e.closeTo=function(e,t,n){var i=Math.pow(10,-(n||4)),o=Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i&&Math.abs(e.z-t.z)<i;return e.w?o&&Math.abs(e.w-t.w)<i:o};var et=new THREE.Raycaster,tt={getPos2d:function(e,t,n,i){n=n||t.camera,i=i||t.domElement;var o,r,a=e.clone().project(n);o=(a.x+1)/2*i.clientWidth,r=(1-(a.y+1)/2)*i.clientHeight;var s=o<=i.clientWidth&&o>=0&&r<=i.clientHeight&&r>=0;return{pos:new THREE.Vector2(o,r),vector:a,trueSide:a.z<1,inSight:s}},ifShelter:function(e,t,n,i,o){n||(n=this.getPos2d(e,t)),i=i||t.camera;var r=new THREE.Vector3(n.x,n.y,-1).unproject(i),a=e.clone().sub(r).normalize();et.set(r,a);var s=null==o?t.model.colliders:t.model.floors.index[o].collider.children,l=et.intersectObjects(s),c=e.distanceTo(r);if(l&&l.length)for(var u=0;u<l.length;u++)if(l[u].distance<c)return!0},getPosAtPlane:function(e,t,n){var i=e,o=t.mouse,r=new THREE.Vector3(o.x,o.y,-1).unproject(t.camera);if(null!=n.y){var a=n.y;if("floorplan"==t.mode)var s=e.x,l=e.z;else{if(a<t.camera.position.y&&r.y<=i.y)return null;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");s=((p=(r.y-a)/(i.y-a))*i.x-r.x)/(p-1),l=(p*i.z-r.z)/(p-1)}}else{var c=n.normalVec,u=n.pullPos;if(0!=c.y)return void console.log("N.y != 0");if(r.z==i.z)return void console.log("O.z==A.z?");if(0!=c.z&&0!=c.x){var h=c.x*(i.x-r.x)+c.y*(i.y-r.y)+c.z*(i.z-r.z);if(0==h)return void console.log("分母为0?? return;");var d=-(c.x*r.x+c.y*r.y+c.z*r.z-(u.x*c.x+u.y*c.y+u.z*c.z))/h;s=d*(i.x-r.x)+r.x,a=d*(i.y-r.y)+r.y,l=d*(i.z-r.z)+r.z}else if(0==c.x){l=u.z;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.z==l)return void console.log("一样3??");s=((p=(r.z-l)/(i.z-l))*i.x-r.x)/(p-1),a=(p*i.y-r.y)/(p-1)}else if(0==c.z){s=u.x;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.x==s)return void console.log("一样3??");var p;a=((p=(r.x-s)/(i.x-s))*i.y-r.y)/(p-1),l=(p*i.z-r.z)/(p-1)}}return new THREE.Vector3(s,a,l)},getMouseIntersect:function(e,t,n){var i=new THREE.Raycaster;e.updateMatrixWorld();var o=new THREE.Vector3(n.x,n.y,-1).unproject(e),r=new THREE.Vector3(n.x,n.y,1).unproject(e).sub(o).normalize();i.set(o,r),t.forEach((function(e){i.layers.enable(he.getBaseLog(2,e.layers.mask))}));var a=i.intersectObjects(t);if(0===a.length)return null;var s=a.find((function(e){return!0===e.object.visible}));return s||null},ifIntersectChunks:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.clone().sub(e).normalize(),r=i.InfinityLen?1/0:e.distanceTo(t)+(i.extLen||0);if(0!=r){var a=new THREE.Raycaster(e.clone(),o,0,r),s=i.meshes||[];0==s.length&&(s=n.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),s));var l=a.intersectObjects(s);if(l&&l.length)return l;if(i.throughWidth){var c=he.getNormal({points:[{x:e.x,y:e.z},{x:t.x,y:t.z}]});c.multiplyScalar(i.throughWidth);var u=new THREE.Vector3(c.x,0,c.y),h=e.clone().add(u);a.set(h,o);var d=a.intersectObjects(i.meshes||n.colliders);if(a.set(e.clone().add(u.negate()),o),d&&d.length)return d;var p=a.intersectObjects(i.meshes||n.colliders);if(p&&p.length)return p}return null}},getVisiblePano:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],o=e.clone(),r=n.panos||t.panos.list;return r.forEach((function(e){if(e.isAligned()){var r=e.position.clone(),a=r.distanceTo(o);if(!(null!=n.maxDis&&a>n.maxDis)){var s=new THREE.Raycaster(r.clone(),o.clone().sub(r).normalize(),0,a-(n.tolerance||0)).intersectObjects(n.model||t.colliders,!0);s&&s.length||i.push(e)}}})),i},raycastToFindFloor:function(){var e=[new THREE.Vector3(0,-1,0),new THREE.Vector3(1,-1,0),new THREE.Vector3(0,-1,1),new THREE.Vector3(-1,-1,0),new THREE.Vector3(0,-1,-1),new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,-1)];return function(t,n){var i=[],o=[],r=[];for(var a in t.model.floors.list){var s=t.model.floors.list[a];n.y>=s.boundingBox.min.y&&n.y<=s.boundingBox.max.y&&(i.push(s),o.push.apply(o,H(s.collider.children)))}if(1==i.length)return i[0];if(i.length>1){for(var l=0;l<e.length;l++){var c=new THREE.Raycaster(n.clone(),e[l].clone()).intersectObjects(o);c.length&&function(){var e=c[0].object.parent.floor,t=r.find((function(t){return t.floor==e}));t?t.len++:r.push({floor:e,len:1})}()}return r.sort((function(e,t){t.len,e.len})),r[0]||(r=[],i.forEach((function(e){var t=e.boundingBox,i=[new THREE.Vector3(t.min.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.max.z),new THREE.Vector3(t.min.x,t.min.y,t.max.z),new THREE.Vector3(t.min.x,t.max.y,t.min.z),new THREE.Vector3(t.max.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.min.z),new THREE.Vector3(t.min.x,t.max.y,t.max.z),new THREE.Vector3(t.max.x,t.min.y,t.max.z)],o=0;i.forEach((function(e){return o+=e.distanceTo(n)})),r.push({floor:e,dis:o})})),r.sort((function(e,t){e.dis,t.dis}))),r[0].floor}return n.y<t.model.floors.list[0].center.y?(i=t.model.floors.list.sort((function(e,t){return e.boundingBox.min.y-t.boundingBox.min.y})))[0]:(i=t.model.floors.list.sort((function(e,t){return t.boundingBox.max.y-e.boundingBox.max.y})))[0]}}(),getQuaByAim:function(e,t){return(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,-1),e.clone().sub(t).normalize())},getAimByQua:function(e,t){return new THREE.Vector3(0,0,-1).applyQuaternion(e).add(t)}},nt={info(){var e;(e=console).log.apply(e,arguments)},debug(){var e;(e=console).debug.apply(e,arguments)},error(){var e;(e=console).error.apply(e,arguments)},warn(){var e;(e=console).warn.apply(e,arguments)},time(e){console.time(e)},timeEnd(e){console.timeEnd(e)},message(e){alert(e)}},it=0,ot=1,rt=2,at=3,st=4,lt=function(){this.actionSequence=[],this.actionSequenceInProgress=!1};lt.prototype.reset=function(e){this.actionSequenceInProgress=!1,this.actionSequence.length=0},lt.prototype.addZoomAction=function(){var e=null,t=null,n=!1,i=function(){e=null,this.actionSequence.length>0&&(this.actionSequence[0].start,this.actionSequence[this.actionSequence.length-1].end),this.reset()};return function(o,r,a){if(o!==r){n||(i=i.bind(this),n=!0),e&&(window.clearTimeout(e),e=null),a===t&&this.actionSequenceInProgress||(this.reset(),t=a),this.actionSequenceInProgress=!0;var s={start:o,end:r};this.actionSequence.push(s),e=window.setTimeout(i,150)}}}();var ct={UP:1,DOWN:-1,LEFT:"L",RIGHT:"R",FORWARD:"F",BACK:"B",reverse:{},opposite:function(e){return this.reverse[e.toString()]}};ct.reverse[ct.UP]=ct.DOWN,ct.reverse[ct.DOWN]=ct.UP,ct.reverse[ct.LEFT]=ct.RIGHT,ct.reverse[ct.RIGHT]=ct.LEFT,ct.reverse[ct.FORWARD]=ct.BACK,ct.reverse[ct.BACK]=ct.FORWARD;var ut=function(){function e(){o(this,e),this.events=[],this.valid=!1}return u(e,[{key:"push",value:function(e,t){this.events.push({direction:e,pano:t}),this.valid=!0}},{key:"pop",value:function(e){var t=this.events.pop();return this.events.length<1&&(this.valid=!1),t}},{key:"peek",value:function(){return this.events.length?this.events[this.events.length-1]:{direction:null,pano:null}}},{key:"invalidate",value:function(){this.events=[],this.valid=!1}},{key:"reversePano",value:function(e){if(!this.valid)return null;var t=this.peek();return ct.opposite(e)===t.direction?(this.pop(),t.pano):null}}]),e}(),ht={PANORAMA:"panorama",DOLLHOUSE:"dollhouse",FLOORPLAN:"floorplan",TRANSITIONING:"transitioning"};function dt(e){return"[object Array]"===Object.prototype.toString.call(e)}function pt(e,t){if(dt(e))for(var n=0;n<e.length;n++)t(e[n]);else t(e)}function ft(e){var t="pending",n=[],i=[],o=[],r=null,a={done:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(dt(arguments[e]))for(var i=arguments[e],o=0;o<i.length;o++)"resolved"===t&&i[o].apply(this,r),n.push(i[o]);else"resolved"===t&&arguments[e].apply(this,r),n.push(arguments[e]);return this},fail:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(dt(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},always:function(){return this.done.apply(this,arguments).fail.apply(this,arguments)},progress:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(dt(arguments[e]))for(var n=arguments[e],i=0;i<n.length;i++)"pending"===t&&o.push(n[i]);else"pending"===t&&o.push(arguments[e]);return this},then:function(e,t,n){return ft((function(n){pt(e,(function(e){"function"==typeof e?s.done((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.resolve(t)})):s.done(n.resolve)})),pt(t,(function(e){"function"==typeof e?s.fail((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.reject(t)})):s.fail(n.reject)}))})).promise()},catch:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(dt(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},promise:function(e){if(null==e)return a;for(var t in a)e[t]=a[t];return e},state:function(){return t},debug:function(){console.log("[debug]",n,i,t)},isRejected:function(){return"rejected"===t},isResolved:function(){return"resolved"===t},pipe:function(e,t,n){return ft((function(n){pt(e,(function(e){"function"==typeof e?s.done((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.resolve(t)})):s.done(n.resolve)})),pt(t,(function(e){"function"==typeof e?s.fail((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.reject(t)})):s.fail(n.reject)}))})).promise()}},s={resolveWith:function(e){if("pending"===t){t="resolved";for(var i=r=arguments.length>1?arguments[1]:[],o=0;o<n.length;o++)n[o].apply(e,i)}return this},rejectWith:function(e){if("pending"===t){t="rejected";for(var n=r=arguments.length>1?arguments[1]:[],o=0;o<i.length;o++)i[o].apply(e,n)}return this},notifyWith:function(e){if("pending"===t)for(var n=r=arguments.length>1?arguments[1]:[],i=0;i<o.length;i++)o[i].apply(e,n);return this},resolve:function(){return this.resolveWith(this,arguments)},reject:function(){return this.rejectWith(this,arguments)},notify:function(){return this.notifyWith(this,arguments)}},l=a.promise(s);return e&&e.apply(l,[l]),l}ht.toInt=function(e){switch(e){case this.PANORAMA:return 1;case this.DOLLHOUSE:return 2;case this.FLOORPLAN:return 3;case this.TRANSITIONING:return-1}throw new Error("未知模式: "+c)},ht.fromInt=function(e){switch(e){case"1":case 1:return this.PANORAMA;case"2":case 2:return this.DOLLHOUSE;case"3":case 3:return this.FLOORPLAN}throw new Error("未知模式: "+c)},ft.when=function(){if(arguments.length<2){var e=arguments.length?arguments[0]:void 0;return e&&"function"==typeof e.isResolved&&"function"==typeof e.isRejected?e.promise():ft().resolve(e).promise()}return function(e){for(var t=ft(),n=e.length,i=0,o=new Array(n),r=0;r<e.length;r++)!function(r){var a=null;e[r].done?e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})):(a=e[r],e[r]=new Deferred,e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})).resolve(a))}(r);return t.promise()}(arguments)};var mt=ft;function vt(){return new ft}var gt=function(){function e(t,n){o(this,e),this.version=1,this.cache=null,this.expires=0,this.projectNum=t,this.app=n}return u(e,[{key:"validate",value:function(e){return"catalog.json"in e&&Object.keys(e).length>0}},{key:"update",value:function(e){return this.cache=e,this.expires=Date.now()+constants.signedUrlDefaultExpireTime,vt.when()}},{key:"get",value:function(e){return this.app.resource.getViewImagesURL(e)}}]),e}();function At(e,t,n){return(At="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=w(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}var yt=function(){function e(){if(o(this,e),this.list=[],this.index={},Object.defineProperty(this,"length",{get:function(){return this.list.length}}),"function"!=typeof this.getIndex)throw new Error("IndexedCollection.getIndex not implemented in subclass.")}return u(e,[{key:"forEach",value:function(e){this.list.forEach(e)}},{key:"add",value:function(e){this.list.push(e),this.index[this.getIndex(e)]=e}},{key:"extend",value:function(e){for(var t=0;t<e.length;t++)this.add(e[t])}},{key:"get",value:function(e){return this.index[e]}},{key:"first",value:function(){return this.list[0]}},{key:"last",value:function(){return this.list[this.list.length-1]}},{key:"reIndex",value:function(){this.index={};var e=this;this.forEach((function(t){e.index[e.getIndex(t)]=t}))}},{key:"filter",value:function(e){var t=this.list.filter(e);return this.reIndex(),t}},{key:"reduce",value:function(e,t){return this.list.reduce(e,t)}},{key:"sort",value:function(e){return this.list.sort(e)}},{key:"indexOf",value:function(e){for(var t=0;t<this.list.length;++t)if(this.list[t]===e)return t;return-1}},{key:"clone",value:function(){var e=new this.constructor;return e.extend(this.list),e}}]),e}(),Et=function(){function e(t){o(this,e),this.chunksize=t||10,this.chunks={},this.boundingBoxes={},this.children=[],this.offset=new THREE.Vector3(0,.5,0),this.material=new THREE.MeshBasicMaterial({color:16777215*Math.random(),side:THREE.DoubleSide})}return u(e,[{key:"add",value:function(e){var t,n,i,o,r,a,s,l,c,u,h=e.attributes;h?(t=h.position.array,n=void 0!==e.index?e.index.array:void 0):t=e.vertices;var d=new THREE.Vector3;if(n)for(i=0,o=n.length;i<o;i+=3){var p=3*n[i],f=3*n[i+1],m=3*n[i+2];r=(t[p]+t[f]+t[m])/3,a=(t[p+1]+t[f+1]+t[m+1])/3,s=(t[p+2]+t[f+2]+t[m+2])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[p],t[p+1],t[p+2],t[f],t[f+1],t[f+2],t[m],t[m+1],t[m+2]),c.expandByPoint(d.set(t[p],t[p+1],t[p+2])),c.expandByPoint(d.set(t[f],t[f+1],t[f+2])),c.expandByPoint(d.set(t[m],t[m+1],t[m+2]))}else for(i=0,o=t.length;i<o;i+=9)r=(t[i]+t[i+3]+t[i+6])/3,a=(t[i+1]+t[i+4]+t[i+7])/3,s=(t[i+2]+t[i+5]+t[i+8])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[i],t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6],t[i+7],t[i+8]),c.expandByPoint(d.set(t[i],t[i+1],t[i+2])),c.expandByPoint(d.set(t[i+3],t[i+4],t[i+5])),c.expandByPoint(d.set(t[i+6],t[i+7],t[i+8]))}},{key:"build",value:function(){var e=new THREE.Object3D;for(var t in e.material=this.material,e.name="colliderGroup",this.chunks){var n=this.chunks[t],i=new THREE.BufferGeometry;i.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),i.boundingBox=this.boundingBoxes[t];var o=new THREE.Mesh(i,this.material);o.material.visible=!1,o.name="collider",e.add(o),this.chunks[t]=[]}return e}}]),e}();function wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var bt=function(e){f(n,THREE.Object3D);var t=wt(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).model=e,a.floorIndex=i,a.name=r||"楼层"+(i+1),a.panos=[],a.chunksDam=[],a.tiles=[],a.colliderBuilder=new Et(3),a.collider=null,a.center=null,a.boundingBox=new THREE.Box3,a.size=null,a.hidden=!1,a.display=!0,a.conservativeBoundingBox=new THREE.Box3,a.debugColor=16777215*Math.random(),a.transition=null,a.entryArrow=[],a.views=[],a}return u(n,[{key:"chunks",get:function(){if(this.chunksDam.length)return this.chunksDam;var e=[];return this.tiles.forEach((function(t){t.traverse((function(t){t.isChunk&&e.push(t)}))})),e}},{key:"enter",value:function(e){this.model.setFloor(this,e)}},{key:"show",value:function(){var e=this,t=this.model.$app.core.get("Player");this.hidden=!1;var n=this.model.$app.core.get("PanoVideoRenderer").canShowMarker();"panorama"==t.modeTran.split("-")[1]||t.locked||n&&this.panos.forEach((function(e){return e.hasVideo&&e.hasNeighbor()&&(e.marker.material.opacity=1)})),setTimeout((function(){"floorplan"==t.mode&&e.model.floorplanCadImg.showCadPlane(),e.setMaterial(),t.labelManager&&t.labelManager.show(e.floorIndex),t.OverlayManager&&t.OverlayManager.show(e.floorIndex,!0),t.GLTFEditor&&t.GLTFEditor.show(e.floorIndex,!0),e.model.$app.Camera.monitor.control.showAll(e.floorIndex)}),1)}},{key:"hide",value:function(){var e=this;this.hidden=!0,this.setMaterial(),this.panos.forEach((function(e){return e.hasVideo&&(e.marker.material.opacity=0)}));var t=this.model.$app.core.get("Player");setTimeout((function(){t.labelManager&&t.labelManager.hide(e.floorIndex),t.OverlayManager&&t.OverlayManager.hide(e.floorIndex),t.GLTFEditor&&t.GLTFEditor.hide(e.floorIndex),e.model.$app.Camera.monitor.control.hideAll(e.floorIndex)}),1)}},{key:"toggle",value:function(e){void 0===e&&(e=this.hidden),e?this.show():this.hide()}},{key:"addChunk",value:function(e){this.add(e),this.chunksDam.push(e),this.boundingBox.union(e.geometry.boundingBox);var t=new THREE.Vector3;this.boundingBox.getSize(t),this.size=t,this.colliderBuilder.add(e.geometry),e.floor=this}},{key:"addTile",value:function(e){var t=this;e.floorIndex=this.floorIndex,this.tiles.push(e),this.add(e),e.modified="",e.traverse((function(e){if(e.isChunk){e.setMode(t.model.mode,t.model.$app.core.get("Player").modeTran),t.setMaterial(e),t.boundingBox.union(e.geometry.boundingBox);var n=new THREE.Vector3;t.boundingBox.getSize(n),t.size=n,t.colliderBuilder&&t.colliderBuilder.add(e.geometry)}}))}},{key:"removeTile",value:function(e){this.tiles=this.tiles.filter((function(t){return t!==e})),e.traverse((function(e){e.isChunk&&(e.geometry.dispose(),e.material.dispose(),e.material.uniforms.map.value&&e.material.uniforms.map.value.dispose())})),this.remove(e),e.modified="remove"}},{key:"addPano",value:function(e){this.panos.push(e),e.marker&&this.add(e.marker);var t=new THREE.Vector3(1,1,1),n=(new THREE.Box3).setFromCenterAndSize(e.position,t);this.boundingBox.union(n)}},{key:"removePano",value:function(e){var t=this.panos.indexOf(e);t>-1&&this.panos.splice(t,1)}},{key:"addView",value:function(e){this.views.push(e)}},{key:"removeView",value:function(e){var t=this.views.indexOf(e);t>-1&&this.views.splice(t,1)}},{key:"build",value:function(){this.collider=this.colliderBuilder.build(!0),this.collider.floor=this;var e=new THREE.Vector3;this.boundingBox.getCenter(e),this.center=e,this.conservativeBoundingBox.copy(this.boundingBox),this.conservativeBoundingBox.min.y=Ae.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.min.y})),5),this.conservativeBoundingBox.max.y=Ae.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.max.y})),5),this.colliderBuilder=null}},{key:"toShortString",value:function(){return Ae.nth(this.floorIndex+1)}},{key:"toString",value:function(){return this.name}},{key:"setMaterial",value:function(e){var t,n;if(e)t=this.matPropName,n=[e];else{var i="floorplan"==this.model.$app.core.get("Player").modeTran.split("-")[1]&&this.model.currentFloor.shouldShowPlane&&!this.model.currentFloor.imgLoadFailed&&this.model.$app.store.getValue("metadata").floorPlanUser;t=this.matPropName=i?this.hidden?"hasPlane-normal":"hasPlane-curFloor":this.hidden?"stardard-hide":"stardard-show",n=this.chunks}var o=Je.floorMat[t];n.forEach((function(e){for(var t in o)"renderOrder"==t?e.renderOrder=o[t]:"depthTest"==t||"depthWrite"==t||"transparent"==t?e.materialOutside[t]=o[t]:e.materialOutside.extraValues[t]=e.materialOutside.uniforms[t].value=o[t]}))}}]),n}();function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var xt=function(e){f(n,e);var t=Ct(n);function n(e){var i;return o(this,n),(i=t.call(this)).model=e,i.exploded=!1,i}return u(n,[{key:"add",value:function(e){At(w(n.prototype),"add",this).call(this,e),this.model.add(e)}},{key:"getIndex",value:function(e){return e.floorIndex}},{key:"build",value:function(){this.list.forEach((function(e){e.build()}))}},{key:"nextFloor",value:function(e,t){return this.index[e.floorIndex+t]||null}},{key:"getOrMakeFloor",value:function(e){var t=this.index[e];return t||(t=new bt(this.model,e),this.add(t)),t}},{key:"hide",value:function(){this.list.forEach((function(e){e.hide()}))}},{key:"show",value:function(){this.list.forEach((function(e){e.show()}))}},{key:"getFloorAtPoint",value:function(e){for(var t=null,n=1/0,i=0;i<this.list.length;i++){var o=this.list[i],r=o.distanceToPoint(e);(!t||n>r)&&(n=r,t=o)}return t}}]),n}(yt),It={vector:function(e,t,n){var i=e.clone();return t=t.clone(),function(o){e.set(i.x*(1-o)+t.x*o,i.y*(1-o)+t.y*o,i.z*(1-o)+t.z*o),n&&n(e,o)}},quaternion:function(e,t,n){var i=e.clone();return function(o){e.copy(i).slerp(t,o),n&&n(e,o)}},color:function(e,t,n){var i=e.clone();return function(o){e.copy(i).lerp(t,o),n&&n(e,o)}},property(e,t,n,i){var o=e[t];return function(r){e[t]=o*(1-r)+n*r,i&&i(e[t])}},uniform(e,t,n){var i=e.material.uniforms[t].value;return function(o){e.material.uniforms[t]&&(e.material.uniforms[t].value=i*(1-o)+n*o)}},matrix4(e,t){var n=e.clone();return function(i){for(var o=e.elements,r=n.elements,a=t.elements,s=0;s<16;s++)o[s]=r[s]*(1-i)+a[s]*i}},allUniforms(e,t,n){var i=e.map(function(e){return this.uniform(e,t,n)}.bind(this));return function(e){i.forEach((function(t){t(e)}))}}},Tt={PanoRenderComplete:"panorama.render.complete",TileRenderFailure:"panorama.tile.render.failed",TileRenderSuccess:"panorama.tile.render.success",TileUploadAttempted:"panorama.tile.upload.attempted",UploadAttemptedForAllTiles:"panorama.upload.attempted.all.tiles",ZoomLevelRenderStarted:"panorama.zoom.render.started"},Bt=0,kt=1,Pt=2,Rt=3,Mt=4,St={LoadComplete:"panorama.load.complete",LoadFailed:"panorama.load.failed",TileLoaded:"panorama.tile.loaded"},Dt=1,Ft=2,Lt=3,Ht=4,Qt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:"varying vec3 vWorldPosition;\n\nvoid main() {\n vWorldPosition = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",fragmentShader:"uniform samplerCube map;\nuniform float opacity;\n\nvarying vec3 vWorldPosition;\n\nvoid main() {\n vec4 color = textureCube( map, vec3( -vWorldPosition.x, vWorldPosition.yz ) );\n gl_FragColor = vec4(color.rgb, opacity);\n}\n"},Ot={uniforms:{panoPosition:{type:"v3",value:new THREE.Vector3}},vertexShader:"varying vec4 worldPosition;\n\nvoid main() {\n\n worldPosition = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"uniform vec3 panoPosition;\nvarying vec4 worldPosition;\n\nvoid main() {\n\n float depth = distance(worldPosition.xyz, panoPosition);\n float color = 1.0 - depth / 10.0;\n gl_FragColor = vec4(color, color, color, 1.0);\n\n}\n"},Vt={Common:"\n \n uniform vec4 iMouse;\n uniform vec2 iResolution;\n uniform sampler2D iChannel0; // bufferArray\n uniform sampler2D iChannel1; // 全景图\n uniform int iBrushType; // 笔刷类型(马赛克、高斯模糊、橡皮)\n uniform float iBrushSize;\n uniform float iAngle;\n uniform float iPitch;\n \n \n const float MAX_TRACE_DISTANCE = 3.0; // max trace distance\n const float INTERSECTION_PRECISION = 0.001; // precision of the intersection\n const int NUM_OF_TRACE_STEPS = 100;\n \n const float PI = 3.145;\n \n vec3 spCenter = vec3( 0.0 , 0.0 , -0.8 ); // 画笔中心偏移\n float spRad = 1.; // 值越大, 半径越小\n \n // camera视角变换矩阵,pitch绕x轴,roll绕z轴,angle绕y轴\n mat3 calcLookAtMatrix( in float angle, in float roll, in float pitch )\n {\n vec3 angleVec = vec3( cos(angle), sqrt(cos(angle)*cos(angle) + sin(angle)*sin(angle)) * tan(pitch), sin(angle) );\n vec3 rollVec = vec3( sin(roll), cos(roll), 0.0 );\n \n vec3 ww = normalize( angleVec );\n vec3 uu = normalize( cross(ww, rollVec) );\n vec3 vv = normalize( cross(ww, uu));\n return mat3( uu, vv, ww );\n }\n \n float posMap( vec3 pos ){\n return length(pos - spCenter) - spRad;\n }\n \n float calcIntersection( in vec3 spCenter, in vec3 rayDirec ){\n float h = INTERSECTION_PRECISION*2.0;\n float trace = 0.0;\n \n for( int i=0; i< NUM_OF_TRACE_STEPS ; i++ ){\n if( h < INTERSECTION_PRECISION || trace > MAX_TRACE_DISTANCE ) break;\n h = posMap( spCenter + rayDirec * trace );\n trace += h;\n }\n \n if( trace < MAX_TRACE_DISTANCE ) \n return trace;\n else \n return -1.0;\n }\n \n vec3 calcPoint(vec2 screenPoint, float angle, float pitch) {\n \n mat3 camMat = calcLookAtMatrix(angle, 0.0, pitch);\n vec3 rayDirec = normalize( camMat * vec3(screenPoint.xy, 1.4) ); // create view ray. 2.0 is the lens length\n \n float trace = calcIntersection(spCenter, rayDirec);\n vec3 point = spCenter + rayDirec * trace;\n return point;\n }\n \n // 抗锯齿 原理:给边缘一个透明渐变\n // edge0 向内渐变范围,edge1 向外渐变范围,x 和中心的距离\n float smootherstep(float edge0, float edge1, float x) {\n float t = (x - edge0)/(edge1 - edge0);\n float t1 = t*t*t*(t*(t*6. - 15.) + 10.);\n return clamp(t1, 0.0, 1.0);\n }\n //新版高斯模糊算法\n float weight(float t, float log2radius, float gamma)\n {\n return exp(-gamma * pow(log2radius - t, 2.0));\n }\n vec4 sample_blured(vec2 uv, float radius, float gamma) {\n vec4 pix = vec4(0.0);\n float norm = 0.0;\n for(float i = 0.0; i < 10.0; i += 0.5)\n {\n float k = weight(i, log2(radius), gamma);\n pix += k*texture2D(iChannel1, uv, i); \n norm += k;\n }\n return pix * pow(norm, -0.95);\n }\n\n \n // modelPaint有两个作用:根据鼠标位置显示笔刷、根据鼠标位置涂抹 (通过iIsBrush区分)\n vec4 modelPaint(vec2 uv, int iIsBrush)\n {\n vec2 mouse = (-iResolution.xy + 2.0*iMouse.xy)/iResolution.y;\n \n float hAngle = (uv.x * 2.0 + 0.5) * -PI * 0.9989; // uv在全景图边界处会有些许的错位,乘上0.9989则正常\n float vAngle = uv.y * PI;\n vec3 n = normalize( vec3(\n sin(vAngle) * sin(hAngle),\n -cos(vAngle),\n sin(vAngle) * cos(hAngle)\n ));\n vec3 wPos = spCenter + n * spRad; // 将uv坐标映射到三维上 \n vec3 point = calcPoint(mouse, iAngle, iPitch); // 将鼠标位置映射到三维上 \n\n float brushSize = iBrushSize / 100.; // 笔刷大小\n if(iIsBrush == 0) brushSize += 0.005; // 补偿黑边\n vec4 col;\n // 限制在brushSize范围内 && (按下鼠标 || 显示笔刷)\n if( length( point - wPos ) < brushSize && (iMouse.z > 0.0 || iIsBrush == 1))\n {\n // 涂抹\n if(iMouse.z > 0.0) {\n if(iBrushType == 2) {\n // 马赛克\n float mosaicAccuracy = 2. * iResolution.x / 1024.; // 马赛克精度\n vec2 pixelSize = mosaicAccuracy / iResolution.xy;\n vec2 fixedUV = uv + pixelSize;\n vec2 pxUV = floor(fixedUV/pixelSize)*pixelSize;\n col = texture2D(iChannel1, pxUV);\n } \n else if(iBrushType == 1) {\n // 旧版高斯模糊 在apple端会出现奇怪的边缘bug,原因不明,需要将出现bug的边缘进行裁剪。且在ios端模糊后rgb值偏高\n // const float Directions = 16.0;\n // const float Quality =5.0;\n // float Size = 20.0; // 模糊度\n // vec2 Radius = Size/iResolution.xy;\n // col = texture2D(iChannel1, uv);\n \n // for( float d=0.0; d < PI*2.; d += PI*2./Directions) {\n // for(float i = 1.0/Quality; i <= 1.0; i += 1.0/Quality) {\n //疑似texture2D方法中的uv参数不为原始uv就会出现边缘bug\n // col += texture2D(iChannel1, uv + vec2(cos(d), sin(d)) * Radius * i);\n // }\n // }\n // col /= (Quality * Directions - 16.0);\n\n //新版高斯模糊算法\n float strong = 0.45;\n float blur_radius = 50.0 * strong;\n col = sample_blured(uv, blur_radius, 0.5);\n // 对全景贴图进行模糊处理后全景贴图之间的接缝会较为明显,需要对全景贴图接缝进行处理\n float handlepixel = 10.0; //处理宽度\n if (uv.x > 0.0 && uv.x < handlepixel / iResolution.x) {\n float newuvx = 1.0 - uv.x;\n vec3 mixColor = sample_blured(vec2(newuvx, uv.y), blur_radius, 0.5).rgb;\n col.rgb = col.rgb * (uv.x * iResolution.x / handlepixel) + mixColor * (1.0-uv.x * iResolution.x / handlepixel);\n }\n //模糊处理后因为采样原因较原图有所提亮,需将rgb总体调低\n col.rgb *=0.95;\n } \n else {\n // 橡皮\n col = vec4(texture2D(iChannel0, uv).rgb, 0.);\n }\n\n // 边缘渐变\n // 这个shader在涂抹贴图和全景图的衔接处会存在黑边,原因不明。目前通过给黑边一个很小的透明度来规避这个问题。\n // 如果想显示黑边的话,注释掉去黑边的那行代码,然后把newAlpha改成1.。\n if(iBrushType != 0) {\n // 橡皮以外\n // float newAlpha = 1.;\n float newAlpha = min(max(1.-length(point-wPos)/brushSize, 0.) * 2., 1.); // 从内到外渐变消失\n if(length(point-wPos) - brushSize < 0. && length(point-wPos) - brushSize > -0.005){// 0.005去黑边\n if (texture2D(iChannel0, uv).a != 0.0) { //修复边缘bug\n col = texture2D(iChannel0, uv);\n col.a = 0.01;\n }\n newAlpha = 0.01;\n }\n col.a = newAlpha > texture2D(iChannel0, uv).a ? newAlpha : texture2D(iChannel0, uv).a; // 高alpha覆盖低alpha\n } else {\n // 橡皮柔软度\n float newAlpha = min(max(length(point-wPos)/brushSize-0.5, 0.) * (1./0.5), 1.); // 从外到内渐变消失\n if(length(point-wPos) - brushSize*.5 < 0.005 && length(point-wPos) - brushSize*.5 > 0.) newAlpha = 0.01; // 0.005去黑边\n col.a = newAlpha < texture2D(iChannel0, uv).a ? newAlpha : texture2D(iChannel0, uv).a; // 低alpha覆盖高alpha\n }\n }\n \n // 显示笔刷\n if(iIsBrush == 1) {\n if(iBrushType != 0) {\n col = vec4(1., 1., 1., 0.4); // 其他笔刷白色半透明\n } else {\n col = vec4(1., 1., 1., 0.); // 橡皮笔刷完全透明\n }\n\n // 笔刷边缘\n float ratio = 0.93; // 非边缘占brushSize的比率\n if(length(point-wPos)/brushSize > ratio) col = vec4(.9, .9, .9, 1.);\n // 外边缘抗锯齿\n float m0 = smootherstep(brushSize-0.002, brushSize+0.002, length(point - wPos));\n col = mix(col, vec4(0.), m0);\n if(length(point - wPos) <= brushSize*ratio+0.002) {\n // 内边缘抗锯齿\n float m1 = smootherstep(brushSize*ratio-0.002, brushSize*ratio+0.002, length(point - wPos));\n col = mix(col, vec4(.9, .9, .9, 1.), m1);\n }\n }\n \n } else if(iIsBrush == 0) {\n // brushSize范围外显示已有的涂抹 bufferTexture\n col = texture2D(iChannel0, uv);\n }\n \n return col;\n }\n \n ",Buffer:"\n \n varying vec2 vUv;\n \n void main()\n {\n vec2 uv = vUv;\n gl_FragColor = modelPaint(uv, 0);\n }\n "},_t={uniforms:{minOpa:{type:"f",value:.14},minDistance:{type:"f",value:2.5},maxDistance:{type:"f",value:4},map:{type:"t",value:null},repeatInfoMap:{type:"t",value:null},modelAlpha:{type:"f",value:Je.modelAlpha},baseColor:{type:"v3",value:new THREE.Color(1,1,1)},opacity:{type:"f",value:1},progress:{type:"f",value:0},blackout:{type:"i",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new THREE.Vector3},pano0Matrix:{type:"m4",value:new THREE.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new THREE.Vector3},pano1Matrix:{type:"m4",value:new THREE.Matrix4},videoReady:{type:"",value:0},videoTexture:{type:"t",value:null},exposure:{type:"f",value:1},parameters:{type:"m4",value:(new THREE.Matrix4).set(4608,3456,8192,4096,1.95985,1.34,1739,2285,-.00173905,274835e-10,-.0340487,0,1235,954,2112,1584)},clipRect:{type:"v4",value:new THREE.Vector4(.1,.1,.5,.5)},blendFov:{type:"f",value:5},bFlag:{type:"i",value:1},paint1Map:{type:"t",value:null},paint0Map:{type:"t",value:null},iShowBrush:{type:"i",value:0},iMouse:{type:"v4",value:new THREE.Vector4},iResolution:{type:"v2",value:new THREE.Vector2},iChannel0:{type:"t",value:null},iChannel1:{type:"t",value:null},iBrushType:{type:"i",value:1},iBrushSize:{type:"f",value:null},iAngle:{type:"f",value:null},iPitch:{type:"f",value:null},filterBase0:{type:"v3",value:new THREE.Vector3(0,0,0)},filterTemperature0:{type:"f",value:0},filterBase1:{type:"v3",value:new THREE.Vector3(0,0,0)},filterTemperature1:{type:"f",value:0}},vertexShader:"\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n #if defined(checkDistance)\n varying vec3 world_Position; \n #endif\n\n varying vec2 vUv;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n \n void main() {\n \n vUv = uv;\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n #if defined(checkDistance)\n world_Position = worldPosition.xyz; \n #endif\n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ",fragmentShader:"\n #ifdef HasPaint"+Vt.Common+"\n #endif\n\n #define PI 3.141592653 \n\n // #define Not_Cube_0 1\n // #define Not_Cube_1 1\n \n const vec4 BLACK=vec4(0.0,0.0,0.0,1.0);\n const vec4 GREY2=vec4(0.5,0.5,0.5,1.0); \n const vec4 GREY=vec4(0.23,0.23,0.23,1.0); //cadImg greyArea to cover model\n \n uniform sampler2D map;\n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int blackout;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n uniform int bFlag;\n uniform vec3 baseColor;\n \n uniform sampler2D paint1Map;\n uniform sampler2D paint0Map;\n uniform int iShowBrush;\n\n uniform vec3 filterBase0;\n uniform float filterTemperature0;\n uniform vec3 filterBase1;\n uniform float filterTemperature1;\n \n #if defined(HasVideo)\n uniform int videoReady;\n uniform sampler2D videoTexture;\n uniform float exposure;\n uniform mat4 parameters;\n uniform float blendFov;\n #endif\n \n //split Not_Cube defines\n #if defined(Not_Cube_0) \n uniform sampler2D pano0Map;\n #else\n uniform samplerCube pano0Map;\n #endif\n \n #if defined(Not_Cube_1) \n uniform sampler2D pano1Map;\n #else\n uniform samplerCube pano1Map;\n #endif\n \n \n \n \n \n #if defined(RepeatUV) \n uniform sampler2D repeatInfoMap;\n #endif\n \n \n varying vec2 vUv;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n #if defined(checkDistance)\n varying vec3 world_Position; \n #endif\n\n \n uniform vec4 clipRect;\n \n\n float linearStep( float start, float end, float value ) {\n\n return clamp( (value - start) / (end - start), 0.0, 1.0 );\n }\n\n vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5; //经度角度\n float ty=acos(direction.y)/PI; //纬度角度\n\n return vec2(tx,ty);\n }\n\n // 从LinearEncoding转到sRGBEncoding\n // 参考:https://www.zhangxinxu.com/wordpress/2017/12/linear-rgb-srgb-js-convert/\n vec3 linearToSrgb(vec3 col){\n return mix(col*12.92, 1.055 * pow(col, vec3(0.41667)) - 0.055, step(0.0031308, col));\n }\n \n #if defined(HasVideo)\n\n #if (HasVideo == 8)\n \n float f42( float phi_undistorted )\n {\n return - 0.0497*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted\n + 0.2548*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted\n - 0.4303*phi_undistorted*phi_undistorted*phi_undistorted\n - 0.016 *phi_undistorted*phi_undistorted \n + 1.0068*phi_undistorted - 0.0004;\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float vm = parameters[0][0];\n float vb = parameters[1][0];\n float vy = parameters[2][0];\n float oh = parameters[3][0];\n\n float wa = parameters[0][1];\n float qa = parameters[1][1];\n float cx = parameters[2][1];\n float cy = parameters[3][1];\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa * 1000.0 / qa;\n \n float ptIn_x = dc.x * vy;\n float ptIn_y = (1.0 - dc.y) * oh;\n \n float ptOut_x, ptOut_y;\n \n float size = vy > oh ? vy : oh;\n \n float camx, camy;\n \n camx = (ptIn_x - vy / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n \n float lon, lat;\n \n lon = camx * 2.0 * 3.1415926;\n lat = camy * 2.0 * 3.1415926;\n \n float zq, zw, zr;\n \n zq = 0.33 * tx + cos(lat) * sin(lon);\n zw = 0.33 * ty - sin(lat);\n zr = 0.33 * tz + cos(lat) * cos(lon); \n \n \n float theta = atan(-zw, zq);\n \n float al = atan( sqrt(zq * zq + zw * zw), zr);\n \n float x12, x13;\n \n float wea = f42(al);\n float r = focal_final * tan(wea);\n \n x12 = cx + r * cos(theta);\n x13 = cy - r * sin(theta);\n \n ptOut_x = x13 / vm;\n ptOut_y = x12 / vb;\n \n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n\n #if VideoMapping == 1\n samplerCoord = uv2CameraCoord(samplerCoord);\n #endif\n\n vec2 samplerCoord_final;\n\n if(bFlag==0)\n {\n samplerCoord_final.x = samplerCoord.y;\n samplerCoord_final.y = 1.0 - samplerCoord.x;\n }\n else\n {\n samplerCoord_final.x = samplerCoord.x;\n samplerCoord_final.y = samplerCoord.y; \n }\n \n // 球幕视频翻转\n return texture2D(texture, samplerCoord_final);\n // return texture2D(texture, samplerCoord);\n \n }\n\n float smoothRect( vec4 clipRect, vec2 mixWidth, vec2 uv )\n {\n float x = clipRect.x < clipRect.z ? \n \n step( clipRect.x, uv.x ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) *\n step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x ):\n \n step( clipRect.x, uv.x ) * step( uv.x, 1.0 ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) + \n step( 0.0, uv.x ) * step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x );\n \n \n float y = step( clipRect.y, uv.y ) * linearStep( clipRect.y, clipRect.y + mixWidth.y, uv.y ) // from\n * step( uv.y, clipRect.w ) * linearStep( clipRect.w, clipRect.w - mixWidth.y, uv.y ); // to \n \n \n return x * y;\n }\n \n vec3 satEnhance( vec3 inputColor, float sat )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n \n float Y = 0.257 * R + 0.564 * G + 0.098 * B + 16.0;\n float Cb = -0.148 * R - 0.291 * G + 0.439 * B + 128.0;\n float Cr = 0.439 * R - 0.368 * G - 0.071 * B + 128.0;\n\n Cr = sat * (Cr - 128.0) + 128.0;\n Cb = sat * (Cb - 128.0) + 128.0; \n \n float newB = 1.164*(Y-16.0)+2.017*(Cb-128.0);\n float newR = 1.164*(Y-16.0)+1.596*(Cr-128.0);\n float newG = 1.164*(Y-16.0)-0.392*(Cb-128.0)-0.813*(Cr-128.0);\n \n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n \n return vec3(newR, newG, newB); \n }\n\n\n #elif (HasVideo == 2)\n\n float f42( float phi )\n {\n return (-2.08836240e-05) * pow(phi, 9.0)\n + (-2.20461427e-04) * pow(phi, 8.0) \n + (-8.04183603e-03) * pow(phi, 7.0) \n + (3.95783387e-02) * pow(phi, 6.0)\n + (-6.51361598e-02) * pow(phi, 5.0)\n + (3.16523167e-02) * pow(phi, 4.0)\n + (-1.35220728e-02) * pow(phi, 3.0) \n + (3.86472740e-03) * pow(phi, 2.0)\n + (9.99717594e-01) * pow(phi, 1.0) \n + (3.98472625e-06) * pow(phi, 0.0);\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float iw = parameters[0][0]; //inputWidth\n float ih = parameters[1][0]; //inputHeight\n float ow = parameters[2][0]; //outputWidth\n float oh = parameters[3][0]; //outputHeight\n\n float wa = parameters[0][1]; //focal\n float qa = parameters[1][1]; //pixel\n float cx = parameters[2][1]; //cx\n float cy = parameters[3][1]; //cy\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa * 1000.0 / qa;\n \n float ptIn_x = dc.x * ow;\n float ptIn_y = dc.y * oh;\n\n float ptOut_x, ptOut_y;\n \n float size = ow > oh ? ow : oh;\n\n float camx, camy;\n\n camx = (ptIn_x - ow / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n\n float lon, lat;\n\n lon = camx * 2.0 * 3.1415926;\n lat = -1.0 * camy * 2.0 * 3.1415926;\n\n float sphx, sphy, sphz;\n\n sphx = cos(lat) * sin(lon);\n sphy = -sin(lat);\n sphz = cos(lat) * cos(lon);\n\n float theta = atan(-sphy, sphx);\n\n float phi_undistorted = atan( sqrt(sphx * sphx + sphy * sphy), sphz);\n\n float phi_distorted = f42(phi_undistorted);\n float r = focal_final * phi_distorted;\n\n float du = cx + r * cos(theta);\n float dv = cy - r * sin(theta);\n \n ptOut_x = (du - 508.0) / 1984.0;\n ptOut_y = 1.0 - (dv - 508.0) / 1984.0;\n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n \n \n return texture2D(texture, samplerCoord);\n \n }\n\n #elif (HasVideo == 3)\n \n float f42( float phi )\n {\n return (-1.47485770e-02) * pow(phi, 9.0)\n + (9.72111981e-02) * pow(phi, 8.0) \n + (-2.48315153e-01) * pow(phi, 7.0) \n + (3.20998529e-01) * pow(phi, 6.0)\n + (-2.46321067e-01) * pow(phi, 5.0)\n + (9.53838280e-02) * pow(phi, 4.0)\n + (-4.29416319e-02) * pow(phi, 3.0) \n + (1.84551397e-03) * pow(phi, 2.0)\n + (9.99948738e-01) * pow(phi, 1.0) \n + (5.00118946e-07) * pow(phi, 0.0);;\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float vm = parameters[0][0];\n float vb = parameters[1][0];\n float vy = parameters[2][0];\n float oh = parameters[3][0];\n\n float wa = parameters[0][1];\n float qa = parameters[1][1];\n float cx = parameters[2][1];\n float cy = parameters[3][1];\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa;\n \n float ptIn_x = dc.x * vy;\n float ptIn_y = (1.0 - dc.y) * oh;\n \n float ptOut_x, ptOut_y;\n \n float size = vy > oh ? vy : oh;\n \n float camx, camy;\n \n camx = (ptIn_x - vy / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n \n float lon, lat;\n \n lon = camx * 2.0 * 3.1415926;\n lat = camy * 2.0 * 3.1415926;\n \n float sphx, sphy, sphz;\n \n sphx = cos(lat) * sin(lon);\n sphy = - sin(lat);\n sphz = cos(lat) * cos(lon); \n\n\n //apply rz to video stitch\n\n float r00 = cos(tz);\n float r01 = -1.0 * sin(tz);\n float r02 = 0.0;\n\n float r10 = sin(tz);\n float r11 = cos(tz);\n float r12 = 0.0;\n\n float r20 = 0.0;\n float r21 = 0.0;\n float r22 = 1.0;\n\n float zq, zw, zr;\n\n zq = r00*sphx + r01*sphy + r02*sphz;\n zw = r10*sphx + r11*sphy + r12*sphz;\n zr = r20*sphx + r21*sphy + r22*sphz;\n\n\n float theta = atan(-zw, zq);\n \n float al = atan( sqrt(zq * zq + zw * zw), zr);\n \n float x12, x13;\n \n float wea = f42(al);\n float r = focal_final * (wea);\n \n x12 = cx + r * cos(theta);\n x13 = cy - r * sin(theta);\n \n ptOut_x = x13 / vm;\n ptOut_y = x12 / vb;\n \n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n\n #if VideoMapping == 1\n samplerCoord = uv2CameraCoord(samplerCoord);\n #endif\n \n samplerCoord.x = 1.0 - samplerCoord.x;\n samplerCoord.y = 1.0 - samplerCoord.y;\n\n vec2 samplerCoord_final;\n\n if(bFlag==0)\n {\n samplerCoord_final.x = 1.0 - samplerCoord.y;\n samplerCoord_final.y = samplerCoord.x;\n }\n else\n {\n samplerCoord_final.x = samplerCoord.x;\n samplerCoord_final.y = samplerCoord.y; \n }\n\n return texture2D(texture, samplerCoord_final);\n // return texture2D(texture, samplerCoord);\n }\n\n float smoothRect( vec4 clipRect, vec2 mixWidth, vec2 uv )\n {\n float x = clipRect.x < clipRect.z ? \n \n step( clipRect.x, uv.x ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) *\n step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x ):\n \n step( clipRect.x, uv.x ) * step( uv.x, 1.0 ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) + \n step( 0.0, uv.x ) * step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x );\n \n \n float y = step( clipRect.y, uv.y ) * linearStep( clipRect.y, clipRect.y + mixWidth.y, uv.y ) // from\n * step( uv.y, clipRect.w ) * linearStep( clipRect.w, clipRect.w - mixWidth.y, uv.y ); // to \n \n \n return x * y;\n }\n\n vec3 satEnhance( vec3 inputColor, float sat )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n \n float Y = 0.257 * R + 0.564 * G + 0.098 * B + 16.0;\n float Cb = -0.148 * R - 0.291 * G + 0.439 * B + 128.0;\n float Cr = 0.439 * R - 0.368 * G - 0.071 * B + 128.0;\n\n Cr = sat * (Cr - 128.0) + 128.0;\n Cb = sat * (Cb - 128.0) + 128.0; \n \n float newB = 1.164*(Y-16.0)+2.017*(Cb-128.0);\n float newR = 1.164*(Y-16.0)+1.596*(Cr-128.0);\n float newG = 1.164*(Y-16.0)-0.392*(Cb-128.0)-0.813*(Cr-128.0);\n \n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n \n return vec3(newR, newG, newB); \n }\n\n vec3 conAdjust( vec3 inputColor, float alpha )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n\n float newB = alpha * (B - 0.5) + 0.5;\n float newG = alpha * (G - 0.5) + 0.5;\n float newR = alpha * (R - 0.5) + 0.5;\n\n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n\n return vec3(newR, newG, newB); \n }\n\n\n #endif\n\n \n\n #endif\n\n\n #if defined(RepeatUV) \n float getUV(float num, float cellSize, float mul){ \n float index = floor(num / cellSize); //第index隔间\n float start = index * cellSize; //区间起始\n float delta = num - start; //相比起始的增量\n float delta_mul = delta * mul; //放大后的增量 \n delta_mul = delta_mul - cellSize * floor(delta_mul / cellSize); //求余。 最终需要的增加量,但是不能超过该区间,所以多出来的要缩减,repeat\n \n return start + delta_mul;\n }\n float round(float num){\n float intPart = floor(num);\n if(num - intPart < 0.5)return intPart;\n else return intPart+1.0;\n } \n #endif\n\n ////////////////////////////////////////////////////////////////\n // 使用HasPaint、hasFilter的原因:减少需要运行的shader代码,优化gpu\n\n // 涂抹\n #ifdef HasPaint\n // 将涂抹贴图贴到全景图上 colorFromPano:全景图,paintMap:涂抹贴图\n vec4 paint(vec4 colorFromPano, sampler2D paintMap, vec3 vWorldPosition) {\n // uv修正\n vec2 sphereUv = getSamplerCoord(vWorldPosition.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n if(sphereUv.x < 0.) sphereUv.x += 1.;\n \n vec4 colBuffer = texture2D(paintMap, sphereUv);\n\n return vec4(colBuffer.rgb * colBuffer.a + colorFromPano.rgb * (1. - colBuffer.a), 1.);\n }\n #endif\n\n ////////////////////////////////////////////////////////////////\n // 滤镜(算法来自shadertoy)\n #ifdef hasFilter\n // 调整亮度[-1, 1]\n vec4 colorBrightness(vec4 color, float brightness) {\n brightness = clamp(brightness, -1., 1.);\n if(brightness < 0.) brightness = brightness/2.;\n return color * (brightness + 1.);\n }\n\n // 调整对比度[-1, 1]\n vec4 colorContrast(vec4 color, float contrast) {\n contrast = clamp(contrast, -1., 1.);\n // return mix(color, vec4(1.0) / (vec4(1.0) + exp(-(color * 10.0 - 5.0))), -contrast);\n return mix(color, smoothstep(0.0, 1.0, color), contrast);\n }\n\n // 调整饱和度[-1, 1]\n vec4 colorSaturation(vec4 color, float saturation) {\n saturation = clamp(saturation, -1., 1.);\n vec3 weights = vec3(0.2125, 0.7154, 0.0721);\n float luminance = dot(color.rgb, weights);\n return mix(vec4(luminance), color, saturation + 1.);\n }\n\n vec3 colorTemperatureToRGB(const in float temperature){\n mat3 m = (temperature <= 6500.0) ? \n mat3(vec3(0.0, -2902.1955373783176, -8257.7997278925690),\n vec3(0.0, 1669.5803561666639, 2575.2827530017594),\n vec3(1.0, 1.3302673723350029, 1.8993753891711275)) : \n mat3(vec3(1745.0425298314172, 1216.6168361476490, -8257.7997278925690),\n vec3(-2666.3474220535695, -2173.1012343082230, 2575.2827530017594),\n vec3(0.55995389139931482, 0.70381203140554553, 1.8993753891711275)); \n return mix(clamp(vec3(m[0] / (vec3(clamp(temperature, 4000.0, 9000.0)) + m[1]) + m[2]), vec3(0.0), vec3(1.0)), vec3(1.0), smoothstep(4000.0, 0.0, temperature));\n }\n // 调整色温[-1, 1]\n vec4 colorTemperature(vec4 color, float temperature) {\n temperature = clamp(temperature, -1., 1.);\n const float LuminancePreservationFactor = 1.0;\n float temperatureFactor;\n float temperatureStrength;\n if(temperature > 0.) {\n temperatureFactor = 4000.0;\n temperatureStrength = mix(0., 1.5, abs(temperature));\n } else {\n temperatureFactor = 9000.0;\n temperatureStrength = mix(0., 2.3, abs(temperature));\n }\n vec3 inColor = color.rgb;\n vec3 outColor = mix(inColor, inColor * colorTemperatureToRGB(temperatureFactor), temperatureStrength); \n // WithQuickAndDirtyLuminancePreservation\n outColor *= mix(1.0, dot(inColor, vec3(0.2126, 0.7152, 0.0722)) / max(dot(outColor, vec3(0.2126, 0.7152, 0.0722)), 1e-5), LuminancePreservationFactor); \n return vec4(outColor, color.a);\n }\n\n // 把滤镜效果融入全景图 colorFromPano:全景图,filterBase:亮度(x)、对比度(y)、饱和度(z),filterTemperature:色温\n vec4 filter(vec4 colorFromPano, vec3 filterBase, float filterTemperature) {\n colorFromPano = colorBrightness(colorFromPano, filterBase.x);\n colorFromPano = colorContrast(colorFromPano, filterBase.y);\n colorFromPano = colorSaturation(colorFromPano, filterBase.z);\n colorFromPano = colorTemperature(colorFromPano, filterTemperature);\n return colorFromPano;\n }\n #endif\n\n\n \n \n void main()\n {\n \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n #if defined(usePanoMap0)\n //即progress < 1.0 通常是1 \n #if (defined(Not_Cube_0) || defined(HasVideo)) \n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz); \n #endif \n \n \n #if defined(Not_Cube_0)\n colorFromPano0=texture2D(pano0Map,samplerCoord0); \n #else\n colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz); \n #endif\n #endif \n \n \n #if (defined(Not_Cube_1) || defined(HasVideo)) \n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n #endif \n \n\n #ifdef BasePanoMap\n //普通贴图当做全景图\n vec4 colorFromPano1 = texture2D(map, vUv);\n #ifdef HasVideo\n samplerCoord1.x -= 0.25; \n #endif\n #else \n #if defined(Not_Cube_1)\n vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); \n #else\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz); \n #ifdef HasVideo\n samplerCoord1.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n #endif\n #endif\n #endif\n\n\n #ifdef HasPaint\n // 涂抹图层(目前涂抹图层要先于球幕视频图层执行,所以会被球幕视频挡住)\n colorFromPano0 = paint(colorFromPano0, paint0Map, vWorldPosition0);\n colorFromPano1 = paint(colorFromPano1, paint1Map, vWorldPosition1);\n #endif\n\n \n // 球幕视频\n #if defined(HasVideo)\n\n vec4 colorFromVideo = vec4(0.0,0.0,0.0,0.0);\n \n #if HasVideo == 8\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n colorFromVideo.rgb *= exposure;\n\n vec2 transitionSize = 80.0 / vec2( 4096.0, 2048.0 );\n\n \n #if VideoMapping == 0\n float alpha = linearStep(0.3, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.66, 0.7, samplerCoord1.x);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alpha * float(videoReady));\n #elif VideoMapping == 1\n\n \n float rect = smoothRect( vec4(\n 0.4166, 0.2833,\n 0.5833, 0.7133\n ), vec2( blendFov / 360.0, blendFov / 180.0 ), samplerCoord1 );\n\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0));\n \n #elif VideoMapping == 2\n\n samplerCoord1 = fract(samplerCoord1);\n\n vec2 clipUV = vec2(\n clipRect.x < clipRect.z ? linearStep( clipRect.x, clipRect.z, samplerCoord1.x ) : linearStep( clipRect.x, clipRect.z + 1.0, samplerCoord1.x < clipRect.z ? samplerCoord1.x + 1.0 : samplerCoord1.x ),\n linearStep( clipRect.y, clipRect.w, samplerCoord1.y )\n );\n clipUV.y = 1.0- clipUV.y;\n\n colorFromVideo = texture2D( videoTexture, clipUV );\n float rect = smoothRect( clipRect, vec2(0.02,0.02), samplerCoord1 );\n\n \n colorFromPano1 = mix( colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0) );\n\n #endif\n\n #elif HasVideo == 2\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n float alphaX = linearStep( 0.31, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.65, 0.67, samplerCoord1.x);\n float alphaY = linearStep( 0.15, 0.17, 1.0 - samplerCoord1.y) * 1.0 - linearStep(0.82, 0.84, 1.0 - samplerCoord1.y);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alphaX * alphaY * float(videoReady) * max(0.0,progress*2.0-1.0));\t\n\n #elif HasVideo == 3\n\n float cx = parameters[2][1]; //cx\n float cy = parameters[3][1]; //cy\n\n float diffx = (cx - 1824.0) / 16416.0;\n float diffy = (cy - 2736.0) / 7576.0;\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n colorFromVideo.rgb *= exposure;\n \n\n vec2 transitionSize = 80.0 / vec2( 4096.0, 2048.0 );\n\n \n #if VideoMapping == 0\n float alpha = linearStep(0.3, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.66, 0.7, samplerCoord1.x);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alpha * float(videoReady));\n #elif VideoMapping == 1\n \n float rect = smoothRect( vec4(\n 0.4277-diffx, 0.28-diffy,\n 0.572-diffx, 0.72-diffy\n ), vec2( blendFov / 360.0, blendFov / 180.0 ), samplerCoord1 );\n\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0));\n \n #elif VideoMapping == 2\n\n samplerCoord1 = fract(samplerCoord1);\n\n vec2 clipUV = vec2(\n clipRect.x < clipRect.z ? linearStep( clipRect.x, clipRect.z, samplerCoord1.x ) : linearStep( clipRect.x, clipRect.z + 1.0, samplerCoord1.x < clipRect.z ? samplerCoord1.x + 1.0 : samplerCoord1.x ),\n linearStep( clipRect.y, clipRect.w, samplerCoord1.y )\n );\n clipUV.y = 1.0- clipUV.y;\n\n colorFromVideo = texture2D( videoTexture, clipUV );\n\n \n float rect = smoothRect( clipRect, vec2(0.02,0.02), samplerCoord1 );\n\n \n colorFromPano1 = mix( colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0) );\n\n #endif\n\n #endif\n\n #endif\n\n\n #ifdef hasFilter\n // 滤镜\n colorFromPano0 = filter(colorFromPano0, filterBase0, filterTemperature0);\n colorFromPano1 = filter(colorFromPano1, filterBase1, filterTemperature1);\n #endif\n\n\n\n\n // 合并colorFromPano0和colorFromPano1\n vec4 color; \n \n if(blackout==0)\n { \n #if defined(usePanoMap0) \n color=mix(colorFromPano0,colorFromPano1,progress);\n #else\n color = colorFromPano1;\n #endif \n \n }\n else if(blackout==1)\n {\n color=mix(colorFromPano0,BLACK,min(1.0,progress*2.0));\n color=mix(color,colorFromPano1,max(0.0,progress*2.0-1.0));\n }\n else if(blackout==2)\n {\n color=mix(colorFromPano0,BLACK,progress);\n }\n else if(blackout==3)\n {\n color=mix(BLACK,colorFromPano1,max(0.0,progress*2.0-1.0));\n }\n \n \n \n vec2 uv = vUv;\n \n #if defined(RepeatUV) \n \n vec4 infoColor = texture2D(repeatInfoMap, vUv); \n float mul = round(infoColor.r * 255.0 / 5.0) + round(infoColor.g * 255.0 / 5.0) / 10.0; \n \n if(mul>0.0 && mul != 1.0){\n float cellCount = 8.0; \n \n float cellSize = 1.0 / cellCount;\n float dir = round(infoColor.b * 255.0 / 5.0);\n if (dir == 0.0) {\n uv.x = getUV(uv.x, cellSize, mul) ;\n }else if (dir == 1.0) {\n uv.y = getUV(uv.y, cellSize, mul) ; \n }else{\n uv.x = getUV(uv.x, cellSize, mul) ;\n uv.y = getUV(uv.y, cellSize, mul) ;\n } \n }\n \n #endif\n \n \n #if defined(useModelMap) \n // 合并color和modelColor\n vec4 colorFromTexture = texture2D(map,uv);\n #ifdef Is3dTiles\n // 3dtiles贴图需要用linearToSrgb转到Srgb色彩空间\n colorFromTexture = vec4(linearToSrgb(colorFromTexture.rgb), colorFromTexture.a);\n #endif\n color = mix(color, colorFromTexture, modelAlpha); \n #endif\n\n\n\n float whiteness = 1.0-smoothstep(0.1, 1.0, opacity); \n color = mix(color, GREY, whiteness ); \n \n float opa = opacity;\n #if defined(checkDistance)\n vec3 cameraPos = mix(pano0Position, pano1Position, progress);\n float dis = distance(cameraPos, world_Position);\n float disOpa=minOpa;\n if(dis < minDistance)\n {\n disOpa=1.0;\n }\n else if(dis<maxDistance)\n {\n float k=(minOpa-1.0)/(maxDistance-minDistance);\n disOpa=k*dis+1.0-k*minDistance;\n } \n float whiteness2 = 1.0-smoothstep(0.1,0.2,disOpa); \n color = mix(color, GREY2, whiteness2); \n opa *= disOpa;\n \n #endif\n \n\n\n #ifdef HasPaint\n // 笔刷\n if(iShowBrush == 1) {\n vec2 sphereUv = getSamplerCoord(vWorldPosition1.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n if(sphereUv.x < 0.) sphereUv.x += 1.;\n vec4 brushBuffer = modelPaint(sphereUv, 1);\n if(brushBuffer.a > 0.) {\n color = vec4(brushBuffer.rgb * brushBuffer.a + color.rgb * (1. - brushBuffer.a), 1.);\n } \n }\n #endif\n \n\n\n\n gl_FragColor = vec4(color.rgb * baseColor, opa);\n \n \n \n }\n ",fragmentBufferShader:Vt.Common+Vt.Buffer},Ut={uniforms:{map:{type:"t",value:null},modelAlpha:{type:"f",value:Je.modelAlpha},depthmapRatio:{type:"f",value:0},opacity:{type:"f",value:1},progress:{type:"f",value:0},considerOcclusion:{type:"i",value:Je.fancierTransition},highlightPanoSelection:{type:"i",value:0},useThirdPano:{type:"i",value:Je.useThirdPano},pano0Map:{type:"t",value:null},pano0Depth:{type:"t",value:null},pano0Position:{type:"v3",value:new THREE.Vector3},pano0Matrix:{type:"m4",value:new THREE.Matrix4},pano0Weight:{type:"f",value:Je.transition.pano0Weight},pano1Map:{type:"t",value:null},pano1Depth:{type:"t",value:null},pano1Position:{type:"v3",value:new THREE.Vector3},pano1Matrix:{type:"m4",value:new THREE.Matrix4},pano1Weight:{type:"f",value:Je.transition.pano1Weight},pano2Map:{type:"t",value:null},pano2Depth:{type:"t",value:null},pano2Position:{type:"v3",value:new THREE.Vector3},pano2Matrix:{type:"m4",value:new THREE.Matrix4},pano2Weight:{type:"f",value:Je.transition.pano2Weight}},vertexShader:"uniform vec3 pano0Position;\nuniform mat4 pano0Matrix;\n\nuniform vec3 pano1Position;\nuniform mat4 pano1Matrix;\n\nuniform vec3 pano2Position;\nuniform mat4 pano2Matrix;\n\nvarying vec2 vUv;\nvarying vec3 vWorldPosition0;\nvarying vec3 vWorldPosition1;\nvarying vec3 vWorldPosition2;\n\nvarying vec4 worldPosition;\n\nvoid main() {\n\n vUv = uv;\n worldPosition = modelMatrix * vec4(position, 1.0);\n\n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n\n vec3 positionLocalToPanoCenter2 = worldPosition.xyz - pano2Position;\n vWorldPosition2 = (vec4(positionLocalToPanoCenter2, 2.0) * pano2Matrix).xyz;\n vWorldPosition2.x *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float depthmapRatio;\nuniform float modelAlpha;\nuniform float opacity;\nuniform float progress;\nuniform int considerOcclusion;\nuniform int highlightPanoSelection;\nuniform int useThirdPano;\n\nuniform vec3 pano0Position;\nuniform samplerCube pano0Map;\nuniform samplerCube pano0Depth;\nuniform float pano0Weight;\n\nuniform vec3 pano1Position;\nuniform samplerCube pano1Map;\nuniform samplerCube pano1Depth;\nuniform float pano1Weight;\n\nuniform vec3 pano2Position;\nuniform samplerCube pano2Map;\nuniform samplerCube pano2Depth;\nuniform float pano2Weight;\n\nvarying vec2 vUv;\nvarying vec3 vWorldPosition0;\nvarying vec3 vWorldPosition1;\nvarying vec3 vWorldPosition2;\n\nvarying vec4 worldPosition;\n\nvoid main() {\n\n vec4 depthFromPano0 = textureCube( pano0Depth, vWorldPosition0.xyz );\n vec4 depthFromPano1 = textureCube( pano1Depth, vWorldPosition1.xyz );\n vec4 depthFromPano2 = textureCube( pano2Depth, vWorldPosition2.xyz );\n\n vec4 colorFromPano0 = textureCube( pano0Map, vWorldPosition0.xyz );\n vec4 colorFromPano1 = textureCube( pano1Map, vWorldPosition1.xyz );\n vec4 colorFromPano2 = textureCube( pano2Map, vWorldPosition2.xyz );\n\n float distanceToPano0 = distance(worldPosition.xyz, pano0Position);\n float distanceToPano1 = distance(worldPosition.xyz, pano1Position);\n float distanceToPano2 = distance(worldPosition.xyz, pano2Position);\n\n float cameraToPano0 = distance(cameraPosition.xyz, pano0Position);\n float cameraToPano1 = distance(cameraPosition.xyz, pano1Position);\n float cameraToPano2 = distance(cameraPosition.xyz, pano2Position);\n\n float contributionFromPano0 = cameraToPano0 == 0.0 ? 1000.0 : pano0Weight / cameraToPano0;\n float contributionFromPano1 = cameraToPano1 == 0.0 ? 1000.0 : pano1Weight / cameraToPano1;\n float contributionFromPano2 = cameraToPano2 == 0.0 ? 1000.0 : pano2Weight / cameraToPano2;\n\n contributionFromPano0 *= 1.0 / distanceToPano0;\n contributionFromPano1 *= 1.0 / distanceToPano1;\n contributionFromPano2 *= 1.0 / distanceToPano2;\n\n if(considerOcclusion == 1) {\n bool occludedFromPano0 = distanceToPano0 / 10.0 > 1.01 - depthFromPano0.x;\n bool occludedFromPano1 = distanceToPano1 / 10.0 > 1.01 - depthFromPano1.x;\n bool occludedFromPano2 = distanceToPano2 / 10.0 > 1.01 - depthFromPano2.x;\n\n if(occludedFromPano0){contributionFromPano0 *= 0.1;}\n if(occludedFromPano1){contributionFromPano1 *= 0.1;}\n if(occludedFromPano2){contributionFromPano2 *= 0.1;}\n //if(occludedFromPano0 && occludedFromPano1 && !occludedFromPano2) { contributionFromPano2 += 0.5; }\n }\n\n float contributionSum = contributionFromPano0 + contributionFromPano1 + contributionFromPano2;\n contributionFromPano0 /= contributionSum;\n contributionFromPano1 /= contributionSum;\n contributionFromPano2 /= contributionSum;\n\n vec4 colorFromPanos = colorFromPano0 * contributionFromPano0;\n colorFromPanos += colorFromPano1 * contributionFromPano1;\n colorFromPanos += colorFromPano2 * contributionFromPano2;\n\n vec4 depthFromPanos = depthFromPano0 * contributionFromPano0;\n depthFromPanos += depthFromPano1 * contributionFromPano1;\n depthFromPanos += depthFromPano2 * contributionFromPano2;\n\n vec4 colorFromTexture = texture2D( map, vUv );\n colorFromPanos = mix(colorFromPanos, colorFromTexture, modelAlpha);\n\n if(highlightPanoSelection == 1) {\n colorFromPanos.r = contributionFromPano0;\n colorFromPanos.g = contributionFromPano1;\n colorFromPanos.b = contributionFromPano2;\n }\n\n gl_FragColor = vec4(mix(colorFromPanos, depthFromPanos, depthmapRatio).rgb, opacity);\n\n}\n"},Nt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},brightness:{type:"f",value:.23},mixRatio:{type:"f",value:.3},clipBoxType:{type:"a",value:null},clipBoxPoints:{type:"a",value:null}},vertexShader:"\n varying vec2 vUv;\n #ifdef HasClip //裁剪模块\n varying vec3 vPosition;\n #endif\n\n void main() {\n vUv = uv;\n #ifdef HasClip\n vPosition = position;\n #endif\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform float opacity;\n varying vec2 vUv;\n uniform float brightness;\n uniform float mixRatio;\n\n #ifdef HasClip //裁剪模块\n varying vec3 vPosition;\n uniform vec3 clipBoxPoints[40]; //4个vec3为一组(一个立方体)\n uniform int clipBoxType[10];//判断裁剪类型并记录有效数据 0为clipInside 1为clipOutSide -1为无效数据\n #endif\n \n \n //vec4 grey = vec4(0.23, 0.23, 0.23, 1.0); //cadImg greyArea to cover model, base color\n \n vec4 grey = vec4(brightness, brightness, brightness, 1.0); \n \n // 从LinearEncoding转到sRGBEncoding\n vec3 linearToSrgb(vec3 col){\n return mix(col*12.92, 1.055 * pow(col, vec3(0.41667)) - 0.055, step(0.0031308, col));\n }\n #ifdef HasClip\n float inBox(vec3 P, vec3 C, vec3 G, vec3 O, vec3 A){\n return step(0.0,(sign(dot(O-A, P-A)) \n +sign(dot(A-O, P-O)) \n +sign(dot(P-O, C-O)) \n +sign(dot(O-C, P-C)) \n +sign(dot(G-O, P-O)) \n +sign(dot(P-G, O-G))\n - 5.0));\n }\n #endif\n \n void main() {\n vec2 uv = vUv; \n vec4 colorFromTexture = texture2D( map, uv ); \n #ifdef Is3dTiles\n // 3dtiles贴图需要用linearToSrgb转到Srgb色彩空间\n colorFromTexture = vec4(linearToSrgb(colorFromTexture.rgb), colorFromTexture.a);\n #endif\n #ifdef HasClip\n float isClip = 0.0; //isClip用于标记是否需要裁剪, >0 将会被discard\n for(int i = 0; i < 10; i++) {\n if(clipBoxType[i] == -1) { //无效数据\n break;\n } else if (clipBoxType[i] == 0) { //insideBox\n if (inBox(vPosition, clipBoxPoints[i*4], clipBoxPoints[i*4+1], clipBoxPoints[i*4+2], clipBoxPoints[i*4+3]) == 1.0) discard;\n } else if (clipBoxType[i] == 1) { //outsideBox\n isClip != -1.0 && inBox(vPosition, clipBoxPoints[i*4], clipBoxPoints[i*4+1], clipBoxPoints[i*4+2], clipBoxPoints[i*4+3]) == 0.0 ? isClip = 1.0 : isClip = -1.0;\n }\n }\n if(isClip > 0.0) discard;\n #endif\n colorFromTexture = mix(colorFromTexture, grey, mixRatio ); \n gl_FragColor = vec4(colorFromTexture.rgb, opacity);\n }\n "},zt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},color:{type:"c",value:new THREE.Color(Je.path.color)}},vertexShader:"varying vec2 vUv;\nvarying vec3 vN;\nvarying vec4 vP;\n\nvoid main() {\n\n vUv = uv;\n vN= normalMatrix * normal;\n vP = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * vP;\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUv;\nuniform vec3 color;\nvarying vec3 vN; // show-1182\nvarying vec4 vP; // show-1182\n\nvoid main() {\n\t// TODO add scroll-in and pulsing behaviors\n\tvec3 vNn = normalize(vN);\n\tvec3 vPn = normalize(vP.xyz);\n\tfloat f = pow(1.0-abs(dot(vNn,vPn)),0.2);\n vec4 colorFromTexture = texture2D( map, vUv );\n colorFromTexture.a *= f;\n gl_FragColor = vec4((color.rgb*colorFromTexture.rgb),\n \t\t\t\t\t\t(opacity*colorFromTexture.a));\n}\n"},Gt={uniforms:{radius:{type:"f",value:0}},vertexShader:"varying vec4 worldPosition;\n\nvoid main() {\n\n worldPosition = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"varying vec4 worldPosition;\nuniform float radius;\n\nvoid main() {\n\n vec4 topColor = vec4(0.094, 0.102, 0.11, 1.0);\n vec4 bottomColor = vec4(0.2, 0.216, 0.235, 1.0);\n float normalizedHeight = (worldPosition.y + radius) / (radius * 2.0);\n float ratio = smoothstep(0.0, 0.5, normalizedHeight);\n gl_FragColor = mix(bottomColor, topColor, ratio);\n\n}\n"},jt={uniforms:{opacity:{type:"f",value:0},color:{type:"c",value:new THREE.Color},bg:{type:"t",value:null},mask:{type:"t",value:null}},vertexShader:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"uniform float opacity;\nuniform vec3 color;\nuniform sampler2D bg;\nuniform sampler2D mask;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 maskColor = texture2D(mask, vUv);\n vec4 bgColor = texture2D(bg, vUv);\n vec3 mappedColor = mix(bgColor.rgb, color, maskColor.a);\n gl_FragColor = vec4(mappedColor, bgColor.a * opacity);\n}\n"},Wt={uniforms:{uTime:{value:0},opacity:{value:1},dark:{type:"i",value:0},openning:{type:"f",value:0},uColor:{value:(new THREE.Color).setRGB(0,.7843137254901961,.6862745098039216)}},vertexShader:"\n\n uniform float uTime;\n uniform float openning;\n\n varying vec2 vUv;\n \n\n vec3 scalePos( vec3 pos ) {\n\n float s = 1.0 + 0.3 * abs( sin(uTime) ) ;\n\n pos.x *= s;\n pos.y *= s;\n pos.z *= s;\n\n return pos;\n }\n\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( scalePos( position ), 1.0);\n }\n\n ",fragmentShader:"\n \n uniform float uTime;\n uniform vec3 uColor;\n uniform float opacity;\n uniform int dark;\n \n varying vec2 vUv;\n \n vec4 circle( vec2 position, vec2 center, float radius )\n {\n vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0 );\n\n vec4 color = mix( backgroundColor, vec4(uColor, 1.0 ), smoothstep( radius + 0.05, radius, length( position - center )) );\n \n return color;\n }\n\n\n vec4 ring( vec2 position, vec2 center, vec2 radius )\n {\n \n float len = length( position - center );\n\n float alpha = smoothstep( radius.x - 0.03, radius.x + 0.01, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n\n return mix( vec4( 0.0 ), vec4( 1.0 ), alpha);\n }\n\n\n\n void main() {\n\n\n vec2 uv = vUv * 2.0 - 1.0;\n\n //uv *= (0.85 + abs( sin(uTime) * 0.5 ));\n\n \n vec4 mainColor = vec4( 0.0 );\n mainColor += circle( uv, vec2(0.0), 0.4 );\n mainColor += ring( uv, vec2(0.0), vec2(0.3, 0.35));\n\n \n float r = (uv.x * uv.x + uv.y * uv.y) * 4.0;\n \n float intensity = sin( r - uTime * 2.5 );\n float alpha = 1.0 - 0.25* r;\n\n intensity = intensity * step(r, 3.5 ) * step(1.0, r);\t\n intensity = smoothstep( 0.9, 1.0, intensity );\n\n mainColor += vec4( vec3(intensity), intensity * alpha);\n \n \n \n gl_FragColor = vec4(mainColor.rgb, mainColor.a * opacity);\n \n }\n "},qt={uniforms:{opacity:{type:"f",value:1},dark:{type:"i",value:0},map:{type:"t",value:null},uTime:{value:0},openning:{type:"f",value:0}},vertexShader:"\n\n uniform float openning;\n uniform float uTime;\n\n varying vec2 vUv;\n\n vec3 scalePos( vec3 pos ) {\n\n float s = cos(openning * 3.1415926*0.28) * (1.0 + 0.3 * abs( sin(uTime)) * step( openning, 0.5 ) );\n\n pos.x *= s;\n pos.y *= s;\n pos.z *= s;\n\n return pos;\n }\n\n \n \n void main() \n {\n vUv = uv;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( scalePos(position), 1.0);\n }\n \n ",fragmentShader:"\n\n uniform float opacity;\n uniform int dark;\n uniform float uTime;\n uniform sampler2D map;\n uniform float openning;\n \n varying vec2 vUv;\n \n\n vec4 circle( vec2 position, vec2 center, float radius, vec4 color )\n {\n vec4 backgroundColor = vec4( 0.0 );\n \n float alpha = smoothstep( radius + 0.03, radius - 0.03, length( position - center ));\n\n return mix( backgroundColor, color, alpha );\n }\n\n vec4 ring( vec2 position, vec2 center, vec2 radius, vec4 color )\n {\n vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0);\n \n float len = length( position - center );\n \n float alpha = smoothstep( radius.x - 0.03, radius.x + 0.03, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n \n return mix( backgroundColor, color, alpha);\n }\n\n void main() {\n\n vec2 uv = vUv;\n\n vec4 color = texture2D(map, uv);\n \n if(dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n {\n color.rgb *= 0.9;\n }\n\n\n vec2 coord = uv * 2.0 - 1.0;\n vec4 opennedColor = vec4(0.0);\n\n opennedColor += circle( coord, vec2(0.0), 0.25, vec4(1.0, 1.0, 1.0, 0.5) );\n opennedColor += circle( coord, vec2(0.0), 0.5, vec4(1.0, 1.0, 1.0, 0.3) );\n\n color = mix( color, opennedColor, openning );\n \n gl_FragColor = vec4(color.rgb, color.a * opacity);\n }\n\n "},Jt={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},map0:{type:"t",value:null},map1:{type:"t",value:null},map2:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:"\n\n // uniform float openning;\n // uniform float uTime;\n\n varying vec2 vUv;\n\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);\n }\n \n ",fragmentShader:"\n\n // uniform float opacity;\n // uniform int dark;\n // uniform float uTime;\n // uniform sampler2D map;\n // uniform float openning;\n \n // varying vec2 vUv;\n \n\n // vec4 circle( vec2 position, vec2 center, float radius, vec4 color )\n // {\n // vec4 backgroundColor = vec4( 0.0 );\n \n // float alpha = smoothstep( radius + 0.03, radius - 0.03, length( position - center ));\n\n // return mix( backgroundColor, color, alpha );\n // }\n\n // vec4 ring( vec2 position, vec2 center, vec2 radius, vec4 color )\n // {\n // vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0);\n \n // float len = length( position - center );\n \n // float alpha = smoothstep( radius.x - 0.03, radius.x + 0.03, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n \n // return mix( backgroundColor, color, alpha);\n // }\n\n // void main() {\n\n // vec2 uv = vUv;\n\n // vec4 color = texture2D(map, uv);\n \n // if(dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n // {\n // color.rgb *= 0.9;\n // }\n\n\n // vec2 coord = uv * 2.0 - 1.0;\n // vec4 opennedColor = vec4(0.0);\n\n // opennedColor += circle( coord, vec2(0.0), 0.25, vec4(1.0, 1.0, 1.0, 0.5) );\n // opennedColor += circle( coord, vec2(0.0), 0.5, vec4(1.0, 1.0, 1.0, 0.3) );\n\n // color = mix( color, opennedColor, openning );\n \n // gl_FragColor = vec4(color.rgb, color.a * opacity);\n // //gl_FragColor = vec4( 0.86, 0.078, 0.2353, 1.0);\n // }\n\n //xst add\n //从min1-max1缩放到min2-max2,value本来是min1-max1范围内的,相应的返回对应的值\n float linearClamp(float value, float min1,float max1,float min2,float max2){\n return min2 + (value - min1) * (max2 - min2)/(max1 - min1);\n }\n\n /* vec4 ring( vec2 position, vec2 center, float minRadius, float maxRadius, vec4 color, vec4 backgroundColor)\n {\n float len = length( position - center );\n if(len>minRadius && len < maxRadius){\n return color;\n }\n else{\n return backgroundColor;\n }\n } */\n\n \n\n /* bool sameside(vec2 uv, vec3 A, vec3 B, vec3 C) //permet d'indiquer de quel coté d'une ligne on se trouve (0 ou 1)\n {\n vec3 u = vec3(uv.x,uv.y,0.0);\n vec3 valuexy = cross(B-A,C-A);\n vec3 valuexz = cross(B-A,u-A);\n \n if(dot(valuexy,valuexz)>=0.){return true;}\n else{return false;} \n }\n \n bool inTriangle(vec2 uv,vec3 v[3]) // permet d'indiquer si on se trouve bien a l'intérieur d'un triangle (3 ligne)\n {\n if(sameside(uv,v[0],v[1],v[2]) && sameside(uv,v[1],v[2],v[0]) && sameside(uv,v[2],v[0],v[1])){return true;}\n else{return false;}\n \n } */\n\n \n\n //放大,从radius放大到maxRadius\n /* vec2 zoomUV2(vec2 vuv,float radius,float maxRadius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n\n float step = maxRadius/radius;\n if(len < radius ){\n return vec2(0.5 + dis.x/step,0.5 + dis.y/step);\n }\n else{\n return vuv; \n }\n } */\n\n uniform float bigCircleProgress;\n uniform sampler2D map;\n varying vec2 vUv;\n \n \n vec4 noRepeat(sampler2D sampler, vec2 uv){\t\t\t\t\t \n vec4 color;\n if(uv.x<0.0) \t color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.x>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y<0.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\t\n else color = texture2D(sampler, uv);\n return color ;\t\t\n }\n //缩小,把maxRadius缩小到radius\n vec2 zoomInUV(vec2 vuv,float radius,float maxRadius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n \n float step = radius/maxRadius;\n if(len < maxRadius ){\n return vec2(0.5 + dis.x/step,0.5 + dis.y/step);\n }\n else{\n return vuv; \n }\n }\n \n float circle(vec2 vuv, float radius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n float w = abs(len - radius);\n \n if(w < 0.015 ){//画圈圈,有效的\n return 2.0; \n }else if(w < 0.03){\n return 1.0 - (w-0.015) / (0.03-0.015); //边缘模糊抗锯齿\n }else if(len<radius){\n return -1.0;\n }else if(len>radius){\n return -2.0;\n }\n }\n \n \n void main() {\n\n vec2 uv = vUv;\n\n float sTime = 0.26;\n float mTime = 0.48;\n float eTime = 0.8;\n\n\n float mTime2 = 0.57; \n\n float lineWidth = 0.02;\n float outerRadius = 0.4;\n float extendRadius = 0.5;\n float outerRadius2;\n \n vec2 center = vec2(0.5);\n \n //float innerRadius = 0.3; //三角形所在半径\n\n\n\n\n //贴图缩小\n \n\n float flag;\n //开始的时候是静止的\n if(bigCircleProgress<sTime){\n flag = circle( uv, outerRadius); \n }else{\n //圈圈放大\n if(bigCircleProgress<mTime){\n \n outerRadius2 = outerRadius + smoothstep(0.0, mTime-sTime, bigCircleProgress-sTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n //outerRadius2 = outerRadius + linearClamp(bigCircleProgress-sTime, 0.0, mTime-sTime,0.0, extendRadius - outerRadius - lineWidth);\n //flag = circle( uv, outerRadius + linearClamp(bigCircleProgress-sTime, 0.0, mTime-sTime,0.0, extendRadius - outerRadius - lineWidth));\n flag = circle( uv, outerRadius2); \n }\n //圈圈缩小\n else if(bigCircleProgress<eTime){ \n \n outerRadius2 = extendRadius - lineWidth - smoothstep(0.0, eTime-mTime, bigCircleProgress-mTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n //outerRadius2 = extendRadius - lineWidth - linearClamp(bigCircleProgress-mTime, 0.0, eTime-mTime, 0.0, extendRadius - outerRadius - lineWidth);\n flag = circle( uv, outerRadius2); \n \n if(bigCircleProgress<mTime2){ \n outerRadius = outerRadius + smoothstep(0.0, mTime2-mTime, bigCircleProgress-mTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n }else{\n outerRadius = extendRadius - lineWidth - smoothstep(0.0, eTime-mTime2, bigCircleProgress-mTime2 ) * (extendRadius - outerRadius - lineWidth) ;\n }\n \n } \n else{//恢复正常\n flag = circle( uv, outerRadius); \n } \n }\n \n \n\n if(flag == 2.0){//在圈圈上\n gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n }else if(flag == -2.0){//大于圈圈的\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);\n }else if(flag<=1.0 && flag>=0.0){ //圈边缘模糊抗锯齿\n gl_FragColor = vec4(1.0, 1.0, 1.0, flag);\n }else if(flag == -1.0){//圈内 \n vec2 zoomuv = zoomInUV(uv, outerRadius,extendRadius);\n gl_FragColor = noRepeat(map, zoomuv); \n } \n }\n\n "},Yt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},pulse:{type:"f",value:1},nearFade:{type:"v2",value:new THREE.Vector2(2*Je.insideNear,2*Je.path.waypointIndoorRadius)},color:{type:"c",value:new THREE.Color("#fff")}},vertexShader:"varying vec2 vUv;\nvarying vec4 vPointView;\n\nvoid main() {\n\n vUv = uv;\n vPointView = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * vPointView;\n\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float opacity;\nuniform float pulse; // another opacity, with a different clock\nuniform vec2 nearFade;\nvarying vec2 vUv;\nvarying vec4 vPointView;\nuniform vec3 color;\n\nvoid main() {\n\t// TODO add scroll-in and pulsing behaviors\n\tfloat depthFade = min(1.0, (abs(vPointView.z)-nearFade.x)/(nearFade.y-nearFade.x));\n vec4 colorFromTexture = texture2D( map, vUv );\t\t// we only use the alpha!\n gl_FragColor = vec4(color.rgb,\n \t\t\t\t\t\t(pulse*opacity*colorFromTexture.a * depthFade));\n}\n"},Zt={uniforms:{opacity:{type:"f",value:1},pano1Map:{type:"t",value:null},pano1Matrix:{type:"m4",value:new THREE.Matrix4}},vertexShader:"uniform mat4 pano1Matrix;varying vec3 vWorldPosition;void main(){vWorldPosition=(vec4(position,1.0)*pano1Matrix).xyz;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fragmentShader:"uniform float opacity;varying vec3 vWorldPosition;\n#define PI 3.141592653 \n\n#if defined(Not_Cube)\nuniform sampler2D pano1Map;vec4 texCubemapWith2D(sampler2D t,vec3 dir){dir=normalize(dir);float tx=atan(dir.x,dir.z)/(PI*2.0)+0.5;float ty=acos(dir.y)/PI;vec4 color=texture2D(t,vec2(tx,ty));return color;}\n#else\nuniform samplerCube pano1Map;\n#endif\nvoid main(){\n#if defined(Not_Cube)\nvec4 colorFromPanos=texCubemapWith2D(pano1Map,vec3(-1.0*vWorldPosition.x,vWorldPosition.yz));\n#else\nvec4 colorFromPanos=textureCube(pano1Map,vec3(-1.0*vWorldPosition.x,vWorldPosition.yz));\n#endif\ngl_FragColor=vec4(colorFromPanos.rgb,opacity);}"},Xt={uniforms:{uColor:{type:"vec4",value:null},uTime:{type:"f",value:0}},vertexShader:"\n \n varying vec2 vUv;\n \n void main() \n {\n vUv = uv;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\n ",fragmentShader:"\n \n #define PI2 6.2831852 \n\n uniform vec4 uColor;\n uniform float uTime;\n\n varying vec2 vUv;\n\n float lerp( float a, float b, float alpha ) \n {\n return a + (b -a ) * alpha;\n }\n\n vec4 ring( vec2 uv, vec2 radius )\n {\n float len = length( uv );\n float angle = atan( uv.y, uv.x );\n float opacity = 0.7;\n \n float progress = fract( uTime / 4000.0 );\n\n float step1 = step( 0.0, progress );\n float step2 = step( 0.25, progress );\n float step3 = step( 0.75, progress );\n\n float progressStep1 = smoothstep( 0.0, 0.25, progress );\n float progressStep2 = smoothstep( 0.25, 1.0, progress );\n \n radius *= progressStep1 * step1;\n opacity *= (1.0 - smoothstep( 0.7, 1.0, progress ));\n\n float alpha = smoothstep( radius.x - 0.01, radius.x, len ) - smoothstep( radius.y, radius.y + 0.01, len );\n \n float speed = step2 * ( progressStep2 * 20.0 );\n\n float period = floor(30.0 - 29.0 * progressStep2);\n \n float interval = lerp( 0.0, 0.012, 1.0- progressStep2 );\n \n float dashed = smoothstep( interval * period, interval * period, fract( period * angle / PI2 + speed ) )\n - smoothstep( 1.0 - interval * period, 1.0 - interval * period , fract( period * angle / PI2 + speed ) );\n \n alpha *= dashed;\n \n return mix( vec4(0.0), vec4(1.0, 1.0, 1.0, opacity), alpha );\n }\n\n\n void main()\n {\n\n vec2 uv = vUv * 2.0 - 1.0;\n\n vec4 mainColor = vec4(0);\n\n mainColor += ring(uv, vec2(0.2, 0.22));\t\t\n \n gl_FragColor = mainColor;\n }\n "},Kt={uniforms:{opacity:{type:"f",value:1},dark:{type:"i",value:0},map:{type:"t",value:null},position:{value:new THREE.Vector3(0,0,0)}},vertexShader:"\n\n varying vec2 vUv;\n\n\n void main() \n {\n vUv = uv;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0);\n\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n scale *= mvPosition.z * 0.5;\n\n vec2 alignedPosition = position.xy * scale;\n\n mvPosition.xy += alignedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n\n }\n ",fragmentShader:"\n \n uniform float opacity;\n uniform int dark;\n uniform sampler2D map;\n \n \n varying vec2 vUv;\n \n void main()\n {\n\n vec4 color = texture2D(map, vUv); \n\n if( dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n {\n color.rgb *= 0.9;\n } \n\n gl_FragColor = vec4(color.rgb, color.a * opacity);\n }\n \n "},$t={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:" \n varying vec2 vUv; \n /* vec2 Scale(vec2 vuv, float scale){\n scale = 1.0/scale; \n vuv.x=(uv.x-0.5) * scale + 0.5; \n vuv.y=(uv.y-0.5) * scale + 0.5 ; \n return vuv ; \t\t\t\t\t \t\t\n } */\t\n\n void main(){ \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ",fragmentShader:"\n \n uniform sampler2D map;\n uniform float opacity; \n uniform float bigCircleProgress;\n uniform float smallCircleProgress;\n vec4 noRepeat(sampler2D sampler, vec2 uv){\t\t\t\t\t \n vec4 color;\n if(uv.x<0.0) \t color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.x>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y<0.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\t\n else color = texture2D(sampler, uv);\n return color ;\t\t\n }\n vec4 mixColor(vec4 downColor,vec4 upColor){\n return vec4(upColor.rgb * upColor.a + (1.0 - upColor.a) * downColor.rgb, upColor.a+downColor.a);//下层的分量通过上层的a来决定,暂时这么设置\n /* vec4 sum = downColor + upColor; \n if(sum.a == 0.0){\n \treturn sum;\n }\n float upPct = upColor.a / sum.a;\n float downPct = downColor.a / sum.a; \n return vec4(upColor.rgb * upPct + downColor.rgb * downPct , sum.a ); */\n }\n\n float drawMinCircle(vec2 vuv, float minR){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n float w = abs(len - minR);\n \n if(w < 0.01 ){//画圈圈,有效的\n return 1.0; \n }else if(w < 0.03){\n return 1.0 - (w-0.01) / (0.03-0.01); //边缘模糊抗锯齿\n }else if(len < minR){\n return 2.0; //圈圈内的情况\n }else{\n return 0.0; //透明 ,不考虑\n }\n }\n \n float drawCircle(vec2 vuv, float maxR,float minR){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n if(abs(len - maxR) < 0.04 ){//画圈圈,有效的\n return len; \n }\n else if(len < maxR && len > minR){\n return 1.0; //minR到maxR之间的区域\n }\n else{\n return 2.0; //透明 ,不考虑\n }\n }\n \n vec2 Scale(vec2 vuv, float scale){\n scale = 1.0/scale; \n vec2 uv;\n uv.x=(vuv.x-0.5) * scale + 0.5; \n uv.y=(vuv.y-0.5) * scale + 0.5 ; \n return uv ; \t\t\t\t\t \t\t\n }\t\n \n varying vec2 vUv; varying vec2 vUv1; varying vec2 vUv2; \n void main(){ \n //xst添加\n \n float vtime2 = 0.08; //收缩结束时间\n float vtime22 = 0.24; //开始扩散时间\n float vtime32 = 0.51; //结束扩散时间\n float vtime3 = 0.56; //开始渐变出外圈的时间\n float vtime4 = 1.0; //结束时间\n \n float minRadius = 0.32 ; //内圈外围的半径\n float progress1 = bigCircleProgress - vtime22; //外圈进度,bigCircleProgress:0-1\n float progress2 = smallCircleProgress - vtime22; //内圈进度,smallCircleProgress:-0.2-1.5\n \n vec2 dis = vUv - vec2(0.5);\n float len = length(dis);\n \n if(bigCircleProgress>vtime3 || len < minRadius){//静止 \n gl_FragColor = noRepeat(map, vUv); \n if(bigCircleProgress > vtime3 && bigCircleProgress < vtime4 && len > minRadius){ //结尾逐渐显示外圈\n gl_FragColor.a *= (bigCircleProgress - vtime3) / (vtime4 - vtime3);\n }\n }else if(bigCircleProgress<vtime2 ){ //开始缩小外圈 \n float progress = bigCircleProgress / vtime2 ; \n float minScale = 0.7; float maxScale = 1.0;\n vec2 uv = Scale(vUv, maxScale*(1.0-progress)+minScale*progress);\n \n vec4 color = noRepeat(map, uv); \n /* if( color.a != 0.0){//变淡\n color.a = color.a * (1.0 - progress * 1.0/vtime2);\n } */\n float w = abs(len - minRadius); //交界处抗锯齿过渡\n if(w < 0.04){\n color.a *= w / 0.04;\n } \n gl_FragColor = color; \n }else if(bigCircleProgress>vtime22 && bigCircleProgress < vtime32){//扩大波纹\n \n float maxRadius = minRadius + 0.58*progress1; //大一些,先扩大,progress1的范围:0-0.5\n float midRadius = minRadius + 0.58*progress2; //小一些,后扩大,progress2的范围:-0.2-1.5,比progress1多了点,这一点要在后面处理掉\n \n float value = drawMinCircle(vUv, minRadius);\n if(value == 0.0){ //圈圈外\n value = drawCircle(vUv, midRadius,minRadius); //1.0表示midRadius到minRadius之间的区域,2.0表示其他区域,其他值表示midRadius上的\n if(value == 1.0){ //内圈和最里面的圈圈中间,透明\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); \n }\n else if(value != 2.0){ //内圈附近,需要渐变\n gl_FragColor = vec4( 1.0, 1.0, 1.0, ((value - midRadius) * 20.0+0.2) * (bigCircleProgress - vtime32) / (vtime22 - vtime32)); \n \n }\n else { //内圈的外部\n value = drawCircle(vUv, maxRadius,midRadius); \n if(value == 1.0){ //中间透明\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); \n }\n else if(value != 2.0){ //外圈附近,需要渐变\n gl_FragColor = vec4( 1.0, 1.0, 1.0, ((value - maxRadius) * 20.0+0.2) * (bigCircleProgress - vtime32) / (vtime22 - vtime32)); \n }\n else{ \n gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); //透明\n }\n }\n \n }\n /* else if(value == 1.0){\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0); //白色\n }\n else if(value == 2.0){\n gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); //圈圈内透明\n }\n else{//渐变模糊,抗锯齿\n gl_FragColor = vec4( 1.0, 1.0, 1.0, value); \n } */\n\n /* //处理多于progress1的部分\n if(progress2 > vtime2){\n vec4 color = noRepeat(map, vUv);\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * (progress2-vtime2)*2.0;\n } */\n }\n gl_FragColor.a *= opacity;\n }\n \n "},en={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},map0:{type:"t",value:null},map1:{type:"t",value:null},map2:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:"\n\n varying vec2 vUv;\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\n ",fragmentShader:"\n \n uniform float bigCircleProgress;\n varying vec2 vUv;\n\n //从min1-max1缩放到min2-max2,value本来是min1-max1范围内的,相应的返回对应的值\n float linearClamp(float value, float min1,float max1,float min2,float max2){\n return min2 + (value - min1) * (max2 - min2)/(max1 - min1);\n }\n\n void main()\n {\n // if(vUv.y > 0.3){\n // gl_FragColor = vec4( 0.86, 0.078, 0.2353, 1.0);\n // } \n // else{\n // gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n // }\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n //gl_FragColor = vec4( vPoint.x, vPoint.y, vPoint.z, 1.0);\n \n float vtime = 0.2; //持续时间 但不一定是秒\n float step = 1.0/vtime;\n float len = 0.5;\n\n if(bigCircleProgress<vtime){\n if(vUv.y < bigCircleProgress*step ){\n float v = linearClamp(vUv.y, bigCircleProgress*step - len,bigCircleProgress*step,0.0,1.0);\n gl_FragColor = vec4( 1.0, 1.0, 1.0, v);\n //if(bigCircleProgress*step > len && vUv.y < bigCircleProgress*step - len){\n if(vUv.y < bigCircleProgress*step - len){\n gl_FragColor.a = 0.0;\n }\n }\n } \n else{\n gl_FragColor.a = 0.0;\n }\n }\n "},tn={uniforms:{activeProgress:{type:"f",value:0},mapIn:{type:"t",value:null},mapOut:{type:"t",value:null},mapOut2:{type:"t",value:null},opacity:{type:"f",value:0},changeMap:{type:"i",value:0}},vertexShader:" \n varying vec2 vUv; \n void main() \n { \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec2 vUv; \n uniform sampler2D mapOut; \n uniform sampler2D mapOut2;\n uniform sampler2D mapIn; \n uniform float opacity;\n //uniform int isActive; \n \n uniform float activeProgress;\n \n uniform int changeMap; //是否有mapIn贴图,有的话就是中间要换成mapIn\n \n const float x1=0.2333, x2=0.76669, y1=0.388, y2=0.9333; \n const vec4 sumColor = vec4(1.24,1.24,1.24,2.0);//用于中心部分反转黑白的颜色\n \n \n \n vec4 getColor_default(vec4 mapColor, vec4 mapColor2, int where,vec2 vUvInside ,vec4 white){\n vec4 color;\n if(where == 1){\n color = vec4(1.0,1.0,1.0,mapColor.a);\n }else{\n\n if(changeMap == 1){ \n if(where == 2){\n vec4 color0 = texture2D(mapIn,vUvInside);\n if(mapColor2.r==1.0){color = color0;}\n else color = mix(white, color0, mapColor2.r);//平滑1的内边缘 \n } \n else color = mapColor;\n }else{ \n if(where == 2){ \n vec4 color0 = sumColor-mapColor; \n if(mapColor2.r==1.0){color = color0;}\n else{\n color = mix(white, color0, mapColor2.r);//平滑1的内边缘 \n float c = (color.x + color.y + color.z) / 3.0;//去红边,改为灰色 \n color = vec4(c,c,c,1.0); \n }\n } \n else color = mapColor; \n }\n } \n return color;\n }\n \n vec4 getColor_hovered(vec4 mapColor, vec4 mapColor2, int where,vec2 vUvInside ,vec4 green){\n vec4 color;\n if(changeMap == 1){\n if(where == 2){\n vec4 color0 = texture2D(mapIn,vUvInside);\n if(mapColor2.r==1.0){color = color0;}\n else color = mix(green, color0, mapColor2.r);//平滑内边缘 \n }\n else if(mapColor.a>0.0 && mapColor.a<1.0) color = green; //因为开启了抗锯齿,导致外边缘有点问题,所以自己绘制\n else color = mapColor;\n }else{ \n color = mapColor; \n }\n return color;\n }\n \n \n \n \n void main(){ \n \n vec4 mapColor = texture2D(mapOut,vUv);\n vec4 mapColor2 = texture2D(mapOut2,vUv);//用于分区的贴图 \n vec2 vUvInside = vec2((vUv.x-x1)/(x2-x1), (vUv.y-y1)/(y2-y1)); \n \n \n //绿色的 r=0 白色r=1\n //where: 0是透明外层, 1是绿环, 2是中间圆 \n //int where = mapColor2.a <= 0.0 ? 0 : (mapColor2.r <= 0.0 || mapColor2.a<1.0 ) ? 1 : 2; // 这个废弃是因为缩小时1外边缘的半透明会侵犯2区域,本该属于2的变为1,内边缘绘制成不透明白色锯齿。故而改为先选出2\n int where = mapColor2.a <= 0.0 ? 0 : (mapColor2.r >0.0 && mapColor2.a>0.5 ) ? 2 : 1; //2中包含1-2的过渡,因为要在2中平滑. 之所以2需要mapColor2.a>0.5是因为在左边缘多了一条奇怪r>0的竖线,为了去掉它提高了a阈值。\n \n \n \n vec4 green = vec4(0.0, 0.7843137, 0.6823529, mapColor.a);\n vec4 white = vec4(1.0, 1.0, 1.0, mapColor.a);\n \n \n if(activeProgress == 0.0){ //普通\n gl_FragColor = getColor_default( mapColor, mapColor2, where, vUvInside , white);\n \n }else if(activeProgress == 1.0){ \n gl_FragColor = getColor_hovered( mapColor, mapColor2, where, vUvInside , green); \n }else{\n vec4 color0 = getColor_default(mapColor, mapColor2, where, vUvInside , white);\n vec4 color1 = getColor_hovered(mapColor, mapColor2, where, vUvInside , green);\n \n gl_FragColor = mix(color0,color1,activeProgress);\n } \n \n gl_FragColor.a *= opacity; \n \n \n }\n "},nn={uniforms:{circleRadius:{type:"f",value:.815},progress:{type:"f",value:0},mapOut:{type:"t",value:null},mapIn:{type:"t",value:null},changeMap:{type:"i",value:0}},vertexShader:" \n varying vec2 vUv; \n \n void main() \n { \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec2 vUv; \n uniform float circleRadius;\n uniform float progress;\n uniform sampler2D mapOut; \n uniform sampler2D mapIn; \n uniform int changeMap;\n void main(){ \n vec4 mapColor = texture2D(mapOut,vUv);\n vec2 vUv2 = vec2(vUv.x*2.0-1.0,vUv.y*2.0-1.0);\n float d = vUv2.x*vUv2.x+vUv2.y*vUv2.y; \n if(progress > 0.0){ \n vec4 ringColorNew = vec4(0.0, 0.7943137, 0.6823529, 0.68);\n \n if(d>circleRadius && d<=1.0){\n gl_FragColor = mix(mapColor, ringColorNew, progress);\n }else{\n if(changeMap == 1 && d<=circleRadius){ \n vec4 colorFromTexture2 = texture2D(mapIn,vUv); \n gl_FragColor = mix(mapColor, colorFromTexture2, progress);\n }\n else{\n if(d<=circleRadius)gl_FragColor = mapColor;\n //else gl_FragColor = vec4(mapColor.xyz, min(1.0-progress,mapColor.a)); //如果不把自定义图显示成圆的话用这句\n else gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n }\n }else{\n if(d>1.0)gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n else gl_FragColor = mapColor;\n } \n \n \n }\n "},on={uniforms:{tDiffuse:{type:"t",value:null}},vertexShader:" \n //uniform mat4 panoMatrix; \n varying vec4 vWorldPosition;\n void main() \n { \n \n vWorldPosition = modelMatrix * vec4(position, 1.0);\n //vWorldPosition = (vec4(vWorldPosition, 1.0) * panoMatrix).xyz;\n vWorldPosition.x *= -1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec4 vWorldPosition;\n uniform sampler2D tDiffuse; \n \n #define PI 3.141592653 \n \n vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty);\n }\n \n void main() \n {\n vec2 samplerCoord = getSamplerCoord(vWorldPosition.xyz);\n gl_FragColor = texture2D(tDiffuse, samplerCoord);\n } \n \n "};function rn(e){return"precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"+e}function an(e){e.vertexShader&&(e.vertexShader="precision highp float;\nprecision highp int;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"+e.vertexShader),e.fragmentShader&&(e.fragmentShader=rn(e.fragmentShader),e==_t&&(e.fragmentBufferShader=rn(e.fragmentBufferShader)))}an(Qt),an(Ot),an(_t),an(Ut),an(Nt),an(zt),an(Gt),an(jt),an(Wt),an(qt),an(Jt),an(Yt),an(Zt),an(Xt),an(Kt),an($t),an(en),an(tn),an(nn),an(on);var sn={cube:Qt,customDepth:Ot,model:_t,modelDebug:Ut,modelOutside:Nt,ribbon:zt,skysphere:Gt,tagDisc:jt,tagDiscDefault:Wt,tagDiscCustom:qt,tagVideoMarker:Jt,waypoint:Yt,basicTextured:{uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"varying vec2 vUv;\nuniform float alpha;\nuniform sampler2D tDiffuse;\nvoid main() {\n vec4 texColor = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}"},copyCubeMap:{uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:"varying vec3 vWorldPos;\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}"},skybox:Zt,videoLoading:Xt,videoMakerWidget:Kt,videoPanoMarker:$t,videoStemLine:en,linkSpot:tn,linkSpotInside:nn,sphereRenderToCube:on},ln=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}},cn=Object.prototype.toString;function un(e){return"[object Array]"===cn.call(e)}function hn(e){return void 0===e}function dn(e){return null!==e&&"object"==typeof e}function pn(e){if("[object Object]"!==cn.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function fn(e){return"[object Function]"===cn.call(e)}function mn(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),un(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var vn={isArray:un,isArrayBuffer:function(e){return"[object ArrayBuffer]"===cn.call(e)},isBuffer:function(e){return null!==e&&!hn(e)&&null!==e.constructor&&!hn(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:dn,isPlainObject:pn,isUndefined:hn,isDate:function(e){return"[object Date]"===cn.call(e)},isFile:function(e){return"[object File]"===cn.call(e)},isBlob:function(e){return"[object Blob]"===cn.call(e)},isFunction:fn,isStream:function(e){return dn(e)&&fn(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:mn,merge:function e(){var t={};function n(n,i){pn(t[i])&&pn(n)?t[i]=e(t[i],n):pn(n)?t[i]=e({},n):un(n)?t[i]=n.slice():t[i]=n}for(var i=0,o=arguments.length;i<o;i++)mn(arguments[i],n);return t},extend:function(e,t,n){return mn(t,(function(t,i){e[i]=n&&"function"==typeof t?ln(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function gn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var An=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(vn.isURLSearchParams(t))i=t.toString();else{var o=[];vn.forEach(t,(function(e,t){null!=e&&(vn.isArray(e)?t+="[]":e=[e],vn.forEach(e,(function(e){vn.isDate(e)?e=e.toISOString():vn.isObject(e)&&(e=JSON.stringify(e)),o.push(gn(t)+"="+gn(e))})))})),i=o.join("&")}if(i){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e};function yn(){this.handlers=[]}yn.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},yn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},yn.prototype.forEach=function(e){vn.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var En=yn,wn=function(e,t,n){return vn.forEach(n,(function(n){e=n(e,t)})),e},bn=function(e){return!(!e||!e.__CANCEL__)},Cn=function(e,t){vn.forEach(e,(function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])}))},xn=function(e,t,n,i,o){return function(e,t,n,i,o){return e.config=t,n&&(e.code=n),e.request=i,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,i,o)},In=vn.isStandardBrowserEnv()?{write:function(e,t,n,i,o,r){var a=[];a.push(e+"="+encodeURIComponent(t)),vn.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),vn.isString(i)&&a.push("path="+i),vn.isString(o)&&a.push("domain="+o),!0===r&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Tn=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Bn=vn.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var i=e;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=vn.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},kn=function(e){return new Promise((function(t,n){var i=e.data,o=e.headers;vn.isFormData(i)&&delete o["Content-Type"];var r=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l=function(e,t){return e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}(e.baseURL,e.url);if(r.open(e.method.toUpperCase(),An(l,e.params,e.paramsSerializer),!0),r.timeout=e.timeout,r.onreadystatechange=function(){if(r&&4===r.readyState&&(0!==r.status||r.responseURL&&0===r.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in r?function(e){var t,n,i,o={};return e?(vn.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=vn.trim(e.substr(0,i)).toLowerCase(),n=vn.trim(e.substr(i+1)),t){if(o[t]&&Tn.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(r.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?r.response:r.responseText,status:r.status,statusText:r.statusText,headers:i,config:e,request:r};!function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(xn("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,o),r=null}},r.onabort=function(){r&&(n(xn("Request aborted",e,"ECONNABORTED",r)),r=null)},r.onerror=function(){n(xn("Network Error",e,null,r)),r=null},r.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(xn(t,e,"ECONNABORTED",r)),r=null},vn.isStandardBrowserEnv()){var c=(e.withCredentials||Bn(l))&&e.xsrfCookieName?In.read(e.xsrfCookieName):void 0;c&&(o[e.xsrfHeaderName]=c)}if("setRequestHeader"in r&&vn.forEach(o,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete o[t]:r.setRequestHeader(t,e)})),vn.isUndefined(e.withCredentials)||(r.withCredentials=!!e.withCredentials),e.responseType)try{r.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&r.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&r.upload&&r.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){r&&(r.abort(),n(e),r=null)})),i||(i=null),r.send(i)}))},Pn={"Content-Type":"application/x-www-form-urlencoded"};function Rn(e,t){!vn.isUndefined(e)&&vn.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Mn,Sn={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Mn=kn),Mn),transformRequest:[function(e,t){return Cn(t,"Accept"),Cn(t,"Content-Type"),vn.isFormData(e)||vn.isArrayBuffer(e)||vn.isBuffer(e)||vn.isStream(e)||vn.isFile(e)||vn.isBlob(e)?e:vn.isArrayBufferView(e)?e.buffer:vn.isURLSearchParams(e)?(Rn(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):vn.isObject(e)?(Rn(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};Sn.headers={common:{Accept:"application/json, text/plain, */*"}},vn.forEach(["delete","get","head"],(function(e){Sn.headers[e]={}})),vn.forEach(["post","put","patch"],(function(e){Sn.headers[e]=vn.merge(Pn)}));var Dn=Sn;function Fn(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ln=function(e){return Fn(e),e.headers=e.headers||{},e.data=wn(e.data,e.headers,e.transformRequest),e.headers=vn.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),vn.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Dn.adapter)(e).then((function(t){return Fn(e),t.data=wn(t.data,t.headers,e.transformResponse),t}),(function(t){return bn(t)||(Fn(e),t&&t.response&&(t.response.data=wn(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Hn=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],r=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return vn.isPlainObject(e)&&vn.isPlainObject(t)?vn.merge(e,t):vn.isPlainObject(t)?vn.merge({},t):vn.isArray(t)?t.slice():t}function l(i){vn.isUndefined(t[i])?vn.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(e[i],t[i])}vn.forEach(i,(function(e){vn.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),vn.forEach(o,l),vn.forEach(r,(function(i){vn.isUndefined(t[i])?vn.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(void 0,t[i])})),vn.forEach(a,(function(i){i in t?n[i]=s(e[i],t[i]):i in e&&(n[i]=s(void 0,e[i]))}));var c=i.concat(o).concat(r).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return vn.forEach(u,l),n};function Qn(e){this.defaults=e,this.interceptors={request:new En,response:new En}}Qn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Hn(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ln,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Qn.prototype.getUri=function(e){return e=Hn(this.defaults,e),An(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},vn.forEach(["delete","get","head","options"],(function(e){Qn.prototype[e]=function(t,n){return this.request(Hn(n||{},{method:e,url:t,data:(n||{}).data}))}})),vn.forEach(["post","put","patch"],(function(e){Qn.prototype[e]=function(t,n,i){return this.request(Hn(i||{},{method:e,url:t,data:n}))}}));var On=Qn;function Vn(e){this.message=e}Vn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Vn.prototype.__CANCEL__=!0;var _n=Vn;function Un(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new _n(e),t(n.reason))}))}Un.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Un.source=function(){var e;return{token:new Un((function(t){e=t})),cancel:e}};var Nn=Un;function zn(e){var t=new On(e),n=ln(On.prototype.request,t);return vn.extend(n,On.prototype,t),vn.extend(n,t),n}var Gn=zn(Dn);Gn.Axios=On,Gn.create=function(e){return zn(Hn(Gn.defaults,e))},Gn.Cancel=_n,Gn.CancelToken=Nn,Gn.isCancel=bn,Gn.all=function(e){return Promise.all(e)},Gn.spread=function(e){return function(t){return e.apply(null,t)}},Gn.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var jn=Gn,Wn=Gn;jn.default=Wn;var qn=jn,Jn=null,Yn=null,Zn=null;Promise.prototype.done=Promise.prototype.then,Promise.prototype.fail=Promise.prototype.catch,void 0===window.TextEncoder&&(window.TextEncoder=function(){function e(){o(this,e)}return u(e,[{key:"encode",value:function(e){return unescape(encodeURIComponent(e)).split("").map((function(e){return e.charCodeAt()}))}}]),e}(),window.TextDecoder=function(){function e(){o(this,e)}return u(e,[{key:"decode",value:function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}}]),e}());var Xn={retry(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return new Promise((function(i,o){e().then(i).catch((function(r){t<=1?o(r):setTimeout((function(){Xn.retry(e,t-1,n).then(i).catch(o)}),n)}))}))},get:(e,t)=>(t&&"object"==typeof t&&(-1==e.indexOf("?")?e+="?":e+="&",e+=new URLSearchParams(t).toString()),Jn.get(e)),getImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if("aws"==Yn.region&&-1!=e.indexOf("x-oss-process=image")){var n=e.split("?");e=n[0]+encodeURIComponent("?"+n[1].replace(/\//g,"@"))}return Xn.retry((function(){return new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.src=e,i.onload=function(){t(i)},i.onerror=function(){n("[".concat(e,"] load fail"))}}))}),t)},getText:e=>Jn.get(e,{responseType:"text"}),getBueffer:e=>Jn.get(e,{responseType:"arraybuffer"}),getBlob:e=>Jn.get(e,{responseType:"blob"}),post:(e,t)=>Jn.post(e,t),postFile(e,t){var n=new FormData,i=null;for(var o in t.onUploadProgress&&(i=t.onUploadProgress,delete t.onUploadProgress),t)if("files"===o&&t[o].length>0)for(var r=0;r<t[o].length;r++){var a=t[o][r];a instanceof File?n.append(o,a):a.file?a.filename?n.append(o,a.file,a.filename):n.append(o,a.file):console.warn("file is wong !",t)}else"file"==o||"filename"===o?"file"==o&&(t.filename?n.append("file",t[o],t.filename):n.append("file",t[o])):n.append(o,t[o]);return Jn.post(e,n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:i})}};var Kn=ae(),$n={data:{}};function ei(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}$n.load=function(e,t,n){var i=$n.data[e];return i?(t&&setTimeout((function(){t(i)}),1),i):(i=new THREE.Texture,Je.minimalMemoryMode&&(i.minFilter=THREE.LinearFilter,i.magFilter=THREE.LinearFilter,i.generateMipmaps=!1),i.sourceFile=e,$n.data[e]=i,Xn.getImage(e).then((function(e){i.image=e,i.needsUpdate=!0,t&&t(i)})).catch(n),i)},$n.loadWithoutUpdate=function(){var e=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=$n.data[t.split("?")[0]])){e.next=6;break}return n&&n(o),e.abrupt("return",o);case 6:return o=new THREE.Texture,Je.minimalMemoryMode&&(o.minFilter=THREE.LinearFilter,o.magFilter=THREE.LinearFilter,o.generateMipmaps=!1),o.sourceFile=t,$n.data[t.split("?")[0]]=o,e.next=12,Xn.getImage(t).then((function(e){o.image=e,o.needsUpdate=!0,n&&n(o)})).catch(i);case 12:return e.abrupt("return",o);case 13:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),$n.loadBase64=function(e,t){t=t||"png";var n=new THREE.Texture;return n.image=document.createElement("img"),n.image.setAttribute("src","data:image/"+t+";base64,"+e),Je.minimalMemoryMode&&(n.minFilter=THREE.LinearFilter,n.magFilter=THREE.LinearFilter,n.generateMipmaps=!1),n.needsUpdate=!0,n},$n.isLoaded=function(e){return!!$n.data[e]},$n.getImageURL=function(e){return e&&0===e.indexOf("http")?e:Kn+e};var ti={lineWidth:{value:1,type:"f"},resolution:{value:new THREE.Vector2(1,1),type:"v2"},dashScale:{value:1,type:"f"},dashSize:{value:1,type:"f"},gapSize:{value:1,type:"f"}},ni={uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,ti]),vertexShader:"#include <common>\n#include <color_pars_vertex>\n \n#include <logdepthbuf_pars_vertex>\n \nuniform float lineWidth;\nuniform vec2 resolution;\nattribute vec3 instanceStart;\nattribute vec3 instanceEnd;\nattribute vec3 instanceColorStart;\nattribute vec3 instanceColorEnd;\nvarying vec2 vUv;\n#ifdef USE_DASH\n\tuniform float dashScale;\n\tattribute float instanceDistanceStart;\n\tattribute float instanceDistanceEnd;\n\tvarying float vLineDistance;\n#endif\nvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\tfloat a = projectionMatrix[ 2 ][ 2 ]; \n\tfloat b = projectionMatrix[ 3 ][ 2 ]; \n\tfloat nearEstimate = - 0.5 * b / a;\n\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\tend.xyz = mix( start.xyz, end.xyz, alpha );\n}\nvoid main() {\n\t#ifdef USE_COLOR\n\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\t#endif\n\t#ifdef USE_DASH\n\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t#endif\n\tfloat aspect = resolution.x / resolution.y;\n\tvUv = uv;\n\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); \n\tif ( perspective ) {\n\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\t\t\ttrimSegment( start, end );\n\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\t\t\ttrimSegment( end, start );\n\t\t}\n\t}\n\tvec4 clipStart = projectionMatrix * start;\n\tvec4 clipEnd = projectionMatrix * end;\n\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\tvec2 dir = ndcEnd - ndcStart;\n\tdir.x *= aspect;\n\tdir = normalize( dir );\n\tvec2 offset = vec2( dir.y, - dir.x );\n\tdir.x /= aspect;\n\toffset.x /= aspect;\n\tif ( position.x < 0.0 ) offset *= - 1.0;\n\tif ( position.y < 0.0 ) {\n\t\toffset += - dir;\n\t} else if ( position.y > 1.0 ) {\n\t\toffset += dir;\n\t}\n\toffset *= lineWidth;\n\toffset /= resolution.y;\n\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\toffset *= clip.w;\n\tclip.xy += offset;\n\tgl_Position = clip;\n\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; \n\t#include <logdepthbuf_vertex>\n\t \n \n}\t",fragmentShader:"uniform vec3 diffuse;\n\tuniform float opacity;\n\t#ifdef USE_DASH\n\t\tuniform float dashSize;\n\t\tuniform float gapSize;\n\t#endif\n\tvarying float vLineDistance;\n\t#include <common>\n\t#include <color_pars_fragment>\n\t#include <fog_pars_fragment>\n\t#include <logdepthbuf_pars_fragment>\n\t \n\tvarying vec2 vUv;\n\tvoid main() {\n\t\t \n\t\t#ifdef USE_DASH\n\nif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; \n\nif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; \n\t\t#endif\n\t\tif ( abs( vUv.y ) > 1.0 ) {\n\nfloat a = vUv.x;\n\nfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\nfloat len2 = a * a + b * b;\n\nif ( len2 > 1.0 ) discard;\n\t\t}\n\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\t#include <logdepthbuf_fragment>\n\t\t#include <color_fragment>\n\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t#include <premultiplied_alpha_fragment>\n\t\t#include <tonemapping_fragment>\n\t\t#include <encodings_fragment>\n\t\t#include <fog_fragment>\n\t}"},ii=[],oi=function(e){f(n,THREE.ShaderMaterial);var t=ei(n);function n(e){var i;return o(this,n),i=t.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(ni.uniforms),vertexShader:ni.vertexShader,fragmentShader:ni.fragmentShader}),Object.defineProperties(h(i),{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}}}),i.isLineMaterial=!0,i.dashed=!1,i.setValues(e),ii.push(h(i)),i.addEventListener("dispose",(function(){var e=ii.indexOf(h(i));e>-1&&ii.splice(e,1)})),i}return u(n,[{key:"color",get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},{key:"lineWidth",get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},{key:"dashScale",get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},{key:"dashSize",get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},{key:"gapSize",get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},{key:"resolution",get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},{key:"dashed",get:function(){return"USE_DASH"in this.defines},set:function(e){e?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}},{key:"copy",value:function(e){return THREE.ShaderMaterial.prototype.copy.call(this,e),this.color.copy(e.color),this.lineWidth=e.lineWidth,this.resolution=e.resolution,this}}],[{key:"init",value:function(e){e.core.get("SceneRenderer").addComponent(this)}},{key:"setSize",value:function(e,t){ii.forEach((function(n){n.resolution=new THREE.Vector2(e,t)}))}}]),n}(),ri=function(e){f(n,THREE.InstancedBufferGeometry);var t=ei(n);function n(){var e,i,r;o(this,n),(e=t.call(this)).computeBoundingBox=(i=new THREE.Box3,function(){null===e.boundingBox&&(e.boundingBox=new THREE.Box3);var t=e.attributes.instanceStart,n=e.attributes.instanceEnd;void 0!==t&&void 0!==n&&(e.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(n),e.boundingBox.union(i))}),e.computeBoundingSphere=(r=new THREE.Vector3,function(){null===e.boundingSphere&&(e.boundingSphere=new THREE.Sphere),null===e.boundingBox&&e.computeBoundingBox();var t=e.attributes.instanceStart,n=e.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=e.boundingSphere.center;e.boundingBox.getCenter(i);for(var o=0,a=0,s=t.count;a<s;a++)r.fromBufferAttribute(t,a),o=Math.max(o,i.distanceToSquared(r)),r.fromBufferAttribute(n,a),o=Math.max(o,i.distanceToSquared(r));e.boundingSphere.radius=Math.sqrt(o),isNaN(e.boundingSphere.radius)&&console.error("LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",h(e))}}),e.type="LineSegmentsGeometry",new THREE.BufferGeometry;var a=new THREE.BufferAttribute(new Uint16Array([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),1);return e.setIndex(a),e.setAttribute("position",new THREE.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new THREE.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e.isLineSegmentsGeometry=!0,e}return u(n,[{key:"applyMatrix",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(e.applyToBufferAttribute(t),e.applyToBufferAttribute(n),t.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new THREE.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new THREE.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new THREE.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new THREE.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new THREE.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new THREE.InterleavedBufferAttribute(n,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new THREE.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegements",value:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"toJSON",value:function(){}},{key:"clone",value:function(){}},{key:"copy",value:function(e){return this}}]),n}(),ai=function(e){f(n,e);var t=ei(n);function n(){var e;return o(this,n),(e=t.call(this)).type="LineGeometry",e.isLineGeometry=!0,e}return u(n,[{key:"setPositions",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return At(w(n.prototype),"setPositions",this).call(this,i),this}},{key:"setColors",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return At(w(n.prototype),"setColors",this).call(this,i),this}},{key:"fromLine",value:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"copy",value:function(e){return this}}]),n}(ri),si=function(e){f(n,e);var t=ei(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).type="Fatline",r.isFatline=!0,r.geometry=void 0!==e?e:new ai,r.material=void 0!==i?i:new oi({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}(function(e){f(n,THREE.Mesh);var t=ei(n);function n(e,i){var r,a,s;return o(this,n),(r=t.call(this,e,i)).computeLineDistances=(a=new THREE.Vector3,s=new THREE.Vector3,function(){for(var e=r.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.data.count),o=0,l=0,c=t.data.count;o<c;o++,l+=2)a.fromBufferAttribute(t,o),s.fromBufferAttribute(n,o),i[l]=0===l?0:i[l-1],i[l+1]=i[l]+a.distanceTo(s);var u=new THREE.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new THREE.InterleavedBufferAttribute(u,1,0)),e.setAttribute("instanceDistanceEnd",new THREE.InterleavedBufferAttribute(u,1,1)),h(r)}),r.type="LineSegments2",r.isLineSegments2=!0,r.geometry=void 0!==e?e:new ri,r.material=void 0!==i?i:new oi({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}()),li=xe.lightGreen,ci=null,ui={createLine:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.mat)t=n.mat;else{var i={color:n.color||li,transparent:!n.dontAlwaysSeen,depthTest:!!n.dontAlwaysSeen};n.deshed&&(i.lineWidth=n.lineWidth||1,i.dashSize=n.dashSize||.1,i.gapSize=n.gapSize||.1),t=new THREE[n.deshed?"LineDashedMaterial":"LineBasicMaterial"](i)}var o=new THREE.LineSegments(new THREE.BufferGeometry,t);return o.renderOrder=n.renderOrder||4,this.moveLine(o,e),o},moveLine:function(e,t){if(0==t.length)return console.log(1);var n=[];t.forEach((function(e){return n.push(e.x,e.y,e.z)})),e.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),e.geometry.attributes.position.needsUpdate=!0,e.geometry.computeBoundingSphere(),e.material instanceof THREE.LineDashedMaterial&&e.computeLineDistances()},createFatLineMat:function(e){var t=Object.assign({},{lineWidth:5,color:16777215,transparent:!0,depthWrite:!1,depthTest:!1,dashSize:.1,gapSize:.1},e,{});return new oi(t)},createFatLine:function(e,t){var n=new ai;n.setColors(t.color||[1,1,1]);var i=t.material||this.createFatLineMat(t),o=new si(n,i);return o.scale.set(1,1,1),o.renderOrder=2,this.moveFatLine(o,e),o},moveFatLine:function(e,t){var n=e.geometry,i=[];t.forEach((function(e){return i.push(e.x,e.y,e.z)})),i.length>0?(n||(n=e.geometry=new ai),n.attributes.instanceEnd&&n.attributes.instanceEnd.data.array.length!=i.length&&(n.dispose(),n=new ai,e.geometry=n),n.setPositions(i),e.material.dashed&&e.computeLineDistances()):(n.dispose(),e.geometry=new ai)},createBoldLine:function(e,t,n){ci=n;var i=(t=t||{})&&t.cylinder,o=e[1].clone().sub(e[0]),r=function(){i.lastVector=o;var e=new THREE.Vector3(0,-1,0),t=e.clone().cross(o).normalize(),n=e.angleTo(o);i.quaternion.setFromAxisAngle(t,n)};if(t&&"init"==t.type){if((i=new THREE.Mesh).material=t.mat,0==o.length())return i;r()}if(0==o.length())return i;if("update"!=t.type){var a=e[0].clone().add(e[1]).multiplyScalar(.5);i.position.copy(a),i.lastVector&&"moveAndRotate"!=t.type?i.lastVector&&o.angleTo(i.lastVector)>0&&r():r()}var s=e[0].distanceTo(e[1]),l=t&&t.standPos||ci.position,c=W.isMobile?20:40,u=e[0].distanceTo(l),h=e[1].distanceTo(l),d=he.getFootPoint(l,e[0],e[1]);if(t.constantBold||"panorama"!=ci.mode)var p=[new THREE.Vector2(.1,s/2),new THREE.Vector2(.1,-s/2)];else if(d.clone().sub(e[0]).dot(d.clone().sub(e[1]))>0)p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(h/c,-s/2)];else{var f=d.distanceTo(l),m=d.distanceTo(e[0]);p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(f/c,s/2-m),new THREE.Vector2(h/c,-s/2)]}return i.geometry&&i.geometry.dispose(),i.geometry=new THREE.LatheBufferGeometry(p,4),i.renderOrder=2,i},updateBoldLine:function(e,t,n,i,o){this.createBoldLine(t,{type:n,cylinder:e,standPos:i,constantBold:o},ci)},Fatline:si,fatLineGeometry:ai};function hi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var di,pi,fi,mi,vi,gi,Ai,yi=new THREE.PlaneBufferGeometry(.4,.4,1,1),Ei=.5,wi=[],bi=function(){return fi||(fi=new Vi)},Ci=function(){return mi||(mi=new _i)},xi=function(){return vi||(vi=new Oi)},Ii=function(e){return gi||((gi=Ae.loadTextureFromCache($n.getImageURL(di.scene.markerURL||"images/marker.png"))).minFilter=THREE.LinearMipMapLinearFilter,gi.generateMipmaps=!0,gi.anisotropy=4),gi},Ti=function(e,t){var n=e.opacity;Object.defineProperty(e,"opacity",{get:function(){return n},set:function(i){e instanceof Oi&&(t=e.marker),n=i,Ae.updateVisible(t,"hideWhenZeroOpa",0!=i)}})},Bi=function(e){f(n,THREE.Mesh);var t=hi(n);function n(e){var i;o(this,n),i=t.call(this),pi=e.$app.core.get("Player"),i.pano=e,i.config=di=e.$app.config,i.geometry=yi,i.widget=null,i.material=new THREE.MeshBasicMaterial({map:Ii("normalMarker"),side:THREE.DoubleSide,opacity:0,transparent:!0,depthWrite:!1,depthTest:!1}),i.visible=!1,i.renderOrder=Se,i.name="marker",i.layers.set(kt),i.updateMatrixWorld(),i.initAnimate(),Je.colorMarkerOnLoad&&i.on("load",(function(){this.marker.material.color.set(65280)})),Ti(i.material,h(i));var r=i.visible;return Object.defineProperty(h(i),"visible",{get:function(){return r},set:function(t){e.flagSpot&&(t?e.flagSpot.show():e.flagSpot.hide()),r=t}}),i}return u(n,[{key:"updateStyle",value:function(e,t){var n=this.material.opacity;if("animate"==t){var i=xi();i.marker=this,this.material!=i&&(this.normalMaterial=this.material,this.material=i)}else this.normalMaterial&&(this.material=this.normalMaterial),"video"==t?this.setWidget(e,this.pano,t):(this.pano.oldFlagSpot=this.pano.flagSpot,this.pano.flagSpot=null,this.pano.oldFlagSpot&&this.pano.oldFlagSpot.hide());this.material.opacity=n}},{key:"setWidget",value:function(e,t,n){if("video"==n)if(t.oldFlagSpot)t.flagSpot=t.oldFlagSpot;else if(!t.flagSpot){var i=new Hi(e,"flagSpot___"+t.id,{position:t.position.clone(),state:"videoPanoFlag",sid:"flagSpot___"+t.id,style:"videoMarker",pano:t});i.style="videoMarker",i.createMarkLine({type:"flagSpot",stemLineLen:Ei,markerPos:this.position}).marker=this,i.rePos(i.markLine.groundPoint.clone().add(new THREE.Vector3(0,Ei,0))),wi.push(i),t.flagSpot=i,this.visible||i.hide()}}},{key:"initAnimate",value:function(){Ai||(pi.on("update",(function(){!function(){for(var e=0;e<ki.length;e++)ki[e].uniforms.progress.value=Pi,ki[e].uniforms.bigCircleProgress.value=Ri,ki[e].uniforms.smallCircleProgress.value=Si;wi.forEach((function(e){return e.update()})),Pi>1&&(Pi=0);Pi+=Di,Ri>1?Fi&&(Ri=0,Si=Mi):(Ri+=Di,Si+=Di)}()})),Ai=!0)}}]),n}(),ki=[],Pi=0,Ri=0,Mi=-.12,Si=Mi,Di=.0045,Fi=!0;var Li,Hi=function(e){f(n,EventEmitter);var t=hi(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).model=e,a.sid=i,a.floor=null,a.floors=[],a.position=(new THREE.Vector3).copy(r.position),a.content={},a.initContent(r),a.snapInfo=r.snapInfo,a.style=r.style||"default",a.color=(new THREE.Color).setRGB(0,.7843137254901961,.6862745098039216),r.color&&a.color.setStyle(r.color),a.styleImageURL=r.styleImageURL,a.hoverColor=xe._darken(a.content.color,.2),a.animTime=0,a.animated=!1,a.openning=0,a.openTransition=null,a.mode=ht.PANORAMA,a.obj3d=null,a.disc=null,a.discWorldPosition=null,a.discScale=.06,a.floorIndex=r.floorIndex,a.visibleTransition=null,a.hoveringDisc=!1,a.state=r.state,a.videoPano=r.pano,a.build(),a}return u(n,[{key:"initContent",value:function(e){this.content.description=e.description,this.content.label=e.label,this.content.link=e.link,this.content.outLink=e.outLink,this.content.color=(new THREE.Color).set(e.color||xe.tagDefault),this.content.fileName=e.fileName||{},this.content.fileSrc=e.fileSrc||{},this.content.media=e.media||[]}},{key:"getFloors",value:function(){var e=this;this.floors=[],this.visiblePanos&&this.visiblePanos.forEach((function(t){e.model.panos.index[t]&&(e.floors.includes(e.model.panos.index[t].floor)||e.floors.push(e.model.panos.index[t].floor))})),this.floor&&!this.floors.includes(this.floor)&&this.floors.push(this.floor)}},{key:"rePos",value:function(e){this.position.copy(e),this.obj3d.position.copy(e)}},{key:"createMarkLine",value:function(e){return this.markLine=new Qi({type:e.type,stemLineLen:e.stemLineLen,markerPos:e.markerPos,tag:this,model:this.model}),this.markLine}},{key:"build",value:function(){return this.floor=this.videoPano.floor,this.floorIndex=this.floor.floorIndex,this.floor&&(this.obj3d=this.buildObject3D(),this.floor.add(this.obj3d)),this.getFloors(),this}},{key:"buildObject3D",value:function(){var e=this,t=new THREE.Object3D;t.position.copy(this.position);var n=this.model.$app.config;this.animated=!0;var i=n.isMobile?new THREE.PlaneBufferGeometry(2.4,2.4):new THREE.PlaneBufferGeometry(1,1);return this.disc=new THREE.Mesh(i,Ci()),this.disc.layers.set(kt),this.disc.renderOrder=Se,pi.on("mode.changing",(function(t,n){e.disc.renderOrder="floorplan"!=n?Se:5})),this.disc.tag=this,this.disc.pano=this.videoPano,this.disc.name="disc",t.add(this.disc),t.name="tagGroup",t}},{key:"hide",value:function(e,t){this.hidden||(this.hidden=!0,this.markLine&&this.markLine.hide(),this.disc&&(this.disc.visible=!1))}},{key:"show",value:function(e,t){this.hidden&&(this.hidden=!1,this.markLine&&this.markLine.show(),this.disc&&(this.disc.visible=!0))}},{key:"update",value:function(){this.disc&&(this.discWorldPosition=this.disc.getWorldPosition(new THREE.Vector3),this.updateDisc())}},{key:"updateDisc",value:function(){var e=this.model.mode,t="floorplan"==this.model.player.mode?this.model.player.cameraControls.activeControl.camera:this.model.player.camera,i=Je.tags.visibility,o=Je.tags.disc.scale,r=e===ht.DOLLHOUSE||e===ht.FLOORPLAN?Je.tags.visibility.visibleDistance:t.position.distanceTo(this.discWorldPosition);if(this.obj3d.visible=0!==this.disc.material.opacity&&(i.anyDistance||r<=i.visibleDistance||e===ht.TRANSITIONING)&&(!i.hideViaFloor||this.tagVisibleOnCurrentFloor(e))&&(!i.hideOffScreenDisc||!this.offScreen(this.disc,t))&&(!i.hideOffScreenObject||!this.offScreen(this.obj3d,t)),this.obj3d.visible&&this.disc.visible){this.markLine.stemLine.rotation.y=-new THREE.Vector2(this.markLine.stemLine.position.x-t.position.x,this.markLine.stemLine.position.z-t.position.z).angle()+Math.PI/2,"floorplan"==this.model.$app.core.get("Player").modeTran.split("-")[1]?this.disc.quaternion.copy(t.quaternion):this.disc.lookAt(t.position);var a=he.getScaleForConstantSize({maxSize:o.maxSize,minSize:"videoPanoFlag"==this.state&&e!=ht.PANORAMA?30:o.minSize,nearBound:o.nearBound,farBound:o.farBound,camera:t,position:this.discWorldPosition,dom:this.model.$app.dom}),s=1+Je.tags.disc.scale.responsiveness/100*(n.viewportScale()-1);this.discScale=a*s;try{this.model.player.linkEditor.setTagVisible?this.discScale*=1.5:this.isMeasurePoint?this.discScale*=.9:this.model.$app.TagManager.editHandle&&this.model.$app.TagManager.editHandle.editing&&(this.discScale*=2.5)}catch(e){}this.disc.scale.set(2*this.discScale,2*this.discScale,2*this.discScale);var l=.95*this.discScale;this.markLine.stemLine.scale.y=(Ei-l)/Ei,this.markLine.stemLine.position.copy(this.markLine.stemLine.originPos),this.markLine.stemLine.position.y-=l/2}}},{key:"tagVisibleOnCurrentFloor",value:function(e){return!(e===ht.DOLLHOUSE||e===ht.FLOORPLAN)||this.model.allFloorsVisible||!!this.floors.find((function(e){return!e.hidden}))}}],[{key:"viewportScale",value:function(){var e=document.getElementsByClassName("player")[0];return n.viewportWidth===e.clientWidth&&n.viewportHeight===e.clientHeight||(n.viewportWidth=e.clientWidth,n.viewportHeight=e.clientHeight,n.currentViewportScale=Math.sqrt(Math.min(n.viewportWidth,n.viewportHeight)/Je.tags.disc.scale.baseViewportSize)),n.currentViewportScale}}]),n}(),Qi=function(){function e(t){o(this,e),this.tag=t.tag,this.groundPoint=t.groundPoint||t.markerPos,this.stemLine=new THREE.Mesh(new THREE.PlaneBufferGeometry(.006,t.stemLineLen),bi()),this.stemLine.position.copy(this.groundPoint.clone().add(new THREE.Vector3(0,t.stemLineLen/2,0))),this.stemLine.originPos=this.stemLine.position.clone(),this.stemLine.name="markGroup-stemLine",this.stemLine.layers.set(kt),this.stemLine.renderOrder=Se,this.tag.obj3d.parent.add(this.stemLine)}return u(e,[{key:"hide",value:function(){this.stemLine.visible=!1}},{key:"show",value:function(){this.stemLine.visible=!0}}]),e}(),Oi=function(e){f(n,THREE.RawShaderMaterial);var t=hi(n);function n(){var e;o(this,n),e=t.call(this);var i=THREE.UniformsUtils.clone(sn.videoPanoMarker.uniforms);return i.map.value=Ii("normalMarker"),i.opacity.value=1,e.vertexShader=sn.videoPanoMarker.vertexShader,e.fragmentShader=sn.videoPanoMarker.fragmentShader,e.uniforms=i,e.transparent=!0,e.depthTest=!1,Ti(h(e)),ki.push(h(e)),e}return n}(),Vi=function(e){f(n,THREE.RawShaderMaterial);var t=hi(n);function n(){var e;o(this,n),e=t.call(this);var i=THREE.UniformsUtils.clone(sn.videoStemLine.uniforms);return e.vertexShader=sn.videoStemLine.vertexShader,e.fragmentShader=sn.videoStemLine.fragmentShader,e.uniforms=i,e.transparent=!0,e.depthTest=!1,e.side=THREE.DoubleSide,ki.push(h(e)),e}return n}(),_i=function(e){f(n,THREE.MeshBasicMaterial);var t=hi(n);function n(){var e;o(this,n);var i=$n.load($n.getImageURL("images/videoTag.png"));return(e=t.call(this,{map:i,transparent:!0,depthTest:!1})).animation=Ae.GifTexDeal.addAnimation(i,h(e),{cellXcount:6,cellYcount:5,voidCount:0,loop:!0,duration:1200,delay:600,waitNextTime:1700},0),e.animation.startCallback=function(){Ri=0,Si=Mi},Fi=!1,Ae.GifTexDeal.start(e.animation),pi.on("mode.changing",(function(t,n){e.depthTest="floorplan"!=n&&"panorama"!=n})),e}return n}(),Ui=0,Ni=1,zi=2,Gi=3,ji=4,Wi=5,qi={};function Ji(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yi(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Zi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}qi.TILE_SIZE=512,qi.FACES_PER_PANO=6,qi.LocationOnTile={Center:0,UpperLeft:1,UpperRight:2,LowerRight:3,LowerLeft:4},qi.getTileVector=function(e,t,n,i,o,r,a,s){var l=e/t,c=t/e*2,u=c/2,h=i/l*2-1+u,d=(o=l-1-o)/l*2-1+u;switch(r=r||qi.LocationOnTile.Center){case qi.LocationOnTile.UpperLeft:h-=u,d+=u,h+=a*c;break;case qi.LocationOnTile.UpperRight:h+=u,d+=u,d-=a*c;break;case qi.LocationOnTile.LowerRight:h+=u,d-=u,h-=a*c;break;case qi.LocationOnTile.LowerLeft:h-=u,d-=u,d+=a*c;break;case qi.LocationOnTile.Center:}switch(n){case Ui:$e.setVector(s,-1,d,-h);break;case Ni:$e.setVector(s,1,d,h);break;case zi:$e.setVector(s,-h,1,-d);break;case Gi:$e.setVector(s,-h,-1,d);break;case ji:$e.setVector(s,-h,d,1);break;case Wi:$e.setVector(s,h,d,-1)}$e.normalize(s)},qi.getFaceForTile=function(e,t){var n=qi.TILE_SIZE;e<qi.TILE_SIZE&&(n=e);var i=Math.floor(e/n),o=i*i;return Math.floor(t/o)},qi.getTileLocation=function(e,t,n){var i=qi.TILE_SIZE;e<qi.TILE_SIZE&&(i=e);var o=qi.getFaceForTile(e,t),r=Math.floor(e/i),a=t-o*(r*r);return n.tileX=a%r,n.tileY=Math.floor(a/r),n.face=o,n.faceTileIndex=a,n},qi.getTileCountForSize=function(e){if(e<=qi.TILE_SIZE)return qi.FACES_PER_PANO;var t=Math.floor(e/qi.TILE_SIZE);return t*t*qi.FACES_PER_PANO},qi.getRelativeDirection=function(){var e=new $e.Matrix4,t=new $e.Quaternion;return function(n,i){t.copy(n),t.inverse(),e.makeRotationFromQuaternion(t),e.applyToVector3(i),$e.normalize(i)}}(),qi.matchingTilesInDirection=function(){var e=new $e.Vector3,t=new $e.Vector3(0,0,-1),n=new $e.Quaternion,i=function(e,t){e.push({face:t.face,faceTileIndex:t.faceTileIndex,tileX:t.tileX,tileY:t.tileY})},o=function(){var e={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(t,n,o){for(var r=qi.getTileCountForSize(t),a=0,s=0;s<r;s++)qi.getTileLocation(t,s,e),n&&!n(e)||(a++,o&&i(o,e));return a}}();return function(i,r,a,s,l,c){var u=r<qi.TILE_SIZE?r:qi.TILE_SIZE;if(!s&&!l)return o(r,null,c);var h=!!l;if(l=l||s,l=Math.max(0,Math.min(l,360)),s=Math.max(0,Math.min(s,360)),$e.copyVector(a,e),qi.getRelativeDirection(i.quaternion,e),h){n.setFromUnitVectors(e,t);return o(r,(function(e){return qi.isTileWithinFrustum(r,u,e.face,e.tileX,e.tileY,n,s,l)}),c)}return o(r,(function(t){return qi.isTileWithinFOV(r,u,t.face,t.tileX,t.tileY,e,s)}),c)}}(),qi.isTileWithinFrustum=function(){var e=new $e.Vector3;return function(t,n,i,o,r,a,s,l){for(var c=Math.tan(.5*l*$e.RADIANS_PER_DEGREE),u=-c,h=Math.tan(.5*s*$e.RADIANS_PER_DEGREE),d=-h,p=qi.mapFaceToCubemapFace(i),f=0,m=0,v=0,g=0,A=0,y=qi.LocationOnTile.Center;y<=qi.LocationOnTile.LowerLeft;y++)if(qi.getTileVector(t,n,p,o,r,y,0,e),$e.applyQuaternionToVector(a,e),e.z>=-1e-5);else{var E=-1/e.z,w=e.x*E,b=e.y*E;b>c?f++:b<u&&m++,w>h?v++:w<d&&g++,A++}return m!==A&&f!==A&&v!==A&&g!==A}}(),qi.isTileWithinFOV=function(){var e=new $e.Vector3,t=new $e.Vector3(0,1,0),n=new $e.Vector3(1,0,0);return function(i,o,r,a,s,l,c){var u=qi.mapFaceToCubemapFace(r);if($e.cross(l,t,n),qi.getTileVector(i,o,u,a,s,qi.LocationOnTile.Center,0,e),qi.isWithinFOV(e,l,c,null))return!0;for(var h=c/360,d=Math.floor(1/h),p=0,f=0;f<d;f++){for(var m=qi.LocationOnTile.UpperLeft;m<=qi.LocationOnTile.LowerLeft;m++)if(qi.getTileVector(i,o,u,a,s,m,p,e),qi.isWithinFOV(e,l,c,null))return!0;p+=h}return!1}}(),qi.isWithinFOV=function(){var e=new $e.Vector3,t=new $e.Vector3;return function(n,i,o,r){if($e.copyVector(n,t),r){$e.copyVector(r,e),$e.normalize(e);var a=$e.dot(e,n);e.x*=a,e.y*=a,e.z*=a,$e.subVector(t,e)}var s=o/2*$e.RADIANS_PER_DEGREE,l=Math.cos(s);return $e.dot(t,i)>=l}}(),qi.mapFaceToCubemapFace=function(){var e={0:zi,1:ji,2:Ui,3:Wi,4:Ni,5:Gi};return function(t){return e[t]}}();var Xi=new THREE.PlaneBufferGeometry(1,1,1,1),Ki=function(e){f(n,THREE.Object3D);var t=Zi(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,n),e=t.call(this);var r=new THREE.Texture;return e.root=i.root||h(e),e.sprite=new THREE.Mesh(Xi,new THREE.MeshBasicMaterial({map:r,color:16777215,transparent:!0,depthTest:!1,depthWrite:!1})),e.add(e.sprite),e.sprite.renderOrder=null!=i.renderOrder?i.renderOrder:2,e.fontWeight=null==i.fontWeight?"":i.fontWeight,e.rectBorderThick=i.rectBorderThick||0,e.textBorderThick=i.textBorderThick||0,e.fontface="Arial",e.fontsize=i.fontsize||16,e.textBorderColor=i.textBorderColor||{r:0,g:0,b:0,a:0},e.backgroundColor=i.backgroundColor||{r:255,g:255,b:255,a:1},e.textColor=i.textColor||{r:0,g:0,b:0,a:1},e.borderColor=i.borderColor||{r:0,g:0,b:0,a:0},e.borderRadius=null==i.borderRadius?6:i.borderRadius,e.margin=i.margin,e.textshadowColor=i.textshadowColor,null!=i.text&&e.setText(i.text),e.name=i.name,e.sizeInfo=i.sizeInfo,Li=i.player,e.addEventListener("dispose",e.dispose.bind(h(e))),e.fixOrient=i.fixOrient,e.events={updatePose:e.updatePose.bind(h(e))},i.player.on("update",e.events.updatePose),e.addEventListener("isVisible",(function(t){t.visible&&e.updatePose()})),e.updatePose(),e}return u(n,[{key:"updatePose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.lastFrameChanged,n=void 0===t||t;if(n&&(this.needsUpdate=!0),Ae.realVisible(this)&&this.needsUpdate){this.needsUpdate=!1;var i="floorplan"==Li.mode?Li.cameraControls.activeControl.camera:Li.camera;if(!this.fixOrient){var o=this.root.parent.getWorldQuaternion(new THREE.Quaternion);this.root.quaternion.multiplyQuaternions(o.invert(),i.quaternion)}if(this.sizeInfo){var r=he.getScaleForConstantSize({scale:this.sizeInfo.scale,maxSize:this.sizeInfo.maxSize,minSize:this.sizeInfo.minSize,nearBound:this.sizeInfo.nearBound,farBound:"floorplan"==Li.mode&&this.sizeInfo.farBoundPlan||this.sizeInfo.farBound,camera:i,position:this.root.getWorldPosition(new THREE.Vector3),dom:Li.domElement});this.scale.set(r,r,r)}}}},{key:"setText",value:function(e){this.text!==e&&(this.text=e instanceof Array?e:[e+""],this.updateTexture())}},{key:"setTextColor",value:function(e){this.textColor=e,this.updateTexture()}},{key:"setBorderColor",value:function(e){this.borderColor=e,this.updateTexture()}},{key:"setBackgroundColor",value:function(e){this.backgroundColor=e,this.updateTexture()}},{key:"setPos",value:function(e){this.position.copy(e),this.sprite.update()}},{key:"update",value:function(){this.sprite.update()}},{key:"setVisible",value:function(e){this.visible=e}},{key:"setUniforms",value:function(e,t){this.sprite.setUniforms(e,t)}},{key:"updateTexture",value:function(){var e=document.createElement("canvas"),t=e.getContext("2d");t.font=this.fontWeight+" "+this.fontsize+"px "+this.fontface;var n,i=0,o=[],r=Ji(this.text);try{for(r.s();!(n=r.n()).done;){var a=n.value,s=t.measureText(a),l=s.width;o.push(s),i=Math.max(i,l)}}catch(e){r.e(e)}finally{r.f()}var c=this.margin||new THREE.Vector2(this.fontsize,Math.max(.4*this.fontsize,10)),u=.5*(this.fontsize+c.y),h=2*c.x+i+2*this.rectBorderThick,d=2*c.y+this.fontsize*this.text.length+2*this.rectBorderThick+u*(this.text.length-1);t.canvas.width=h,t.canvas.height=d,t.font=this.fontWeight+" "+this.fontsize+"px "+this.fontface;var p=Math.max(1,Math.pow(this.fontsize/12,1.4));t.textBaseline="alphabetic",t.strokeStyle="rgba("+this.borderColor.r+","+this.borderColor.g+","+this.borderColor.b+","+this.borderColor.a+")",t.lineWidth=this.rectBorderThick,t.fillStyle="rgba("+this.backgroundColor.r+","+this.backgroundColor.g+","+this.backgroundColor.b+","+this.backgroundColor.a+")",this.roundRect(t,this.rectBorderThick/2,this.rectBorderThick/2,h-this.rectBorderThick,d-this.rectBorderThick,this.borderRadius),t.fillStyle="rgba("+this.textColor.r+","+this.textColor.g+","+this.textColor.b+","+this.textColor.a+")";for(var f=c.y,m=0;m<this.text.length;m++){f+=o[m].actualBoundingBoxAscent+p;var v=(i-o[m].width)/2,g=this.rectBorderThick+c.x+v;this.textBorderThick&&(t.strokeStyle="rgba("+this.textBorderColor.r+","+this.textBorderColor.g+","+this.textBorderColor.b+","+this.textBorderColor.a+")",t.lineWidth=this.textBorderThick,t.strokeText(this.text[m],g,f)),this.textshadowColor&&(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=this.textshadowColor,t.shadowBlur=12),t.fillText(this.text[m],g,f),f+=u}var A=new THREE.Texture(e);A.minFilter=THREE.LinearFilter,A.magFilter=THREE.LinearFilter,A.anisotropy=4,A.needsUpdate=!0,this.sprite.material.map&&this.sprite.material.map.dispose(),this.sprite.material.map=A,this.sprite.scale.set(.01*h,.01*d,1)}},{key:"roundRect",value:function(e,t,n,i,o,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+i-r,n),e.arcTo(t+i,n,t+i,n+r,r),e.lineTo(t+i,n+o-r),e.arcTo(t+i,n+o,t+i-r,n+o,r),e.lineTo(t+r,n+o),e.arcTo(t,n+o,t,n+o-r,r),e.lineTo(t,n+r),e.arcTo(t,n,t+r,n,r),e.closePath(),e.fill(),e.stroke()}},{key:"dispose",value:function(){this.sprite.material.map.dispose(),this.sprite.material.dispose(),this.parent&&this.parent.remove(this),this.sprite.dispatchEvent({type:"dispose"}),this._listeners=[],this.events.updatePos&&options.player.off("update",this.events.updatePose)}}]),n}(),$i={UP:new THREE.Vector3(0,1,0),DOWN:new THREE.Vector3(0,-1,0),LEFT:new THREE.Vector3(-1,0,0),RIGHT:new THREE.Vector3(1,0,0),FORWARD:new THREE.Vector3(0,0,-1),BACK:new THREE.Vector3(0,0,1),ZERO:new THREE.Vector3(0,0,0)};function eo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var to=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),-Math.PI/2),no={backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255,g:255,b:255,a:1},fixOrient:!0,renderOrder:Se,fontsize:30},io={backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:Se},oo=Ce.urlHasValue("panoLabel"),ro=function(e){f(n,EventEmitter);var t=eo(n);function n(e,i,r,a,s){var l,c,u,d,p;o(this,n),(l=t.call(this)).raycastToFindFloor=function(){var e=[new THREE.Vector3(0,-1,0),new THREE.Vector3(1,-1,0),new THREE.Vector3(0,-1,1),new THREE.Vector3(-1,-1,0),new THREE.Vector3(0,-1,-1),new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,-1)];return function(){for(var t=0;t<e.length;t++){var n=new THREE.Raycaster(this.position.clone(),e[t].clone()).intersectObjects(this.model.colliders);if(n.length)return n[0].object.parent.floor}return null}}(),l.findNeighourPanos=function(){return this.model.panos.setNeighbour(this.id,this.id,!1),this.model.panos.forEach(function(e){if(e!==this&&(!this.model.panos.neighbourMap[this.id]||void 0===this.model.panos.neighbourMap[this.id][e.id])){var t=this.position.distanceTo(e.position);if(t>Je.panoramaNeighbourMaxDistance)return this.model.panos.setNeighbour(this,e,!1),void n.raycastsSkipped++;var i=e.position.clone().sub(this.position).normalize(),o=new THREE.Raycaster(this.position,i.clone(),0,t).intersectObjects(this.model.colliders);n.raycastsDone++,this.model.panos.setNeighbour(this,e,0===o.length),Je.showNeighbourRaycasts&&(o.length?this.floor.model.add(new THREE.ArrowHelper(i,this.position,o[0].distance,16711680)):this.floor.model.add(new THREE.ArrowHelper(i,this.position,t,16777215,0,0)))}}.bind(this)),this.model.panos.neighbourMap[this.id]},l.enter=(c=null,function(){this.setZoomed(!1),this.emit(St.Enter,c,this),c=this,this.model.setHighMap(this),this.model.dispatchEvent({type:"panoEntered"})}),l.loadTiledPano=(u={},d={},p={},function(e,t,n,i,o,r){null!=i||(i=!0),null!=o||(o=!0);var a=this.getWaitDeferred(e),s=a.deferred,l=null,c=null;if(n&&("number"==typeof n?l=n:(l=n.hFov,c=n.vFov)),this.isLoaded(e))s.resolve(e);else{if(!a.active){a.active=!0;var h=this.id+":"+e;if(u[h]=u[h]||[],p[h]=null,n){var f=[],m=qi.matchingTilesInDirection(this,e,t,l,c,f);p[h]=f,u[h].forEach((function(e){var t=p[h].find((function(t){return e.faceTileIndex==t.faceTileIndex&&e.face==t.face}));t&&(t.loaded=!0)})),p[h].some((function(e){return!e.loaded}))||(s.resolve(e),this.resetWaitDeferred(e),p[h]=null),nt.info("Loading partial pano: "+this.id+" with "+m+" tiles")}d[this.id]||(d[this.id]=!0,this.on(St.LoadComplete,function(e,t){var n=this.getWaitDeferred(e).deferred;n&&"pending"===n.state()&&this.highestPartialTileRenderOpCompleted>=e&&(n.resolve(e,t),this.resetWaitDeferred(e))}.bind(this)),this.on(St.LoadFailed,function(e){var t=this.getWaitDeferred(e).deferred;t&&"pending"===t.state()&&this.highestPartialTileRenderOpCompleted>=e&&(t.reject(e),this.resetWaitDeferred(e))}.bind(this)),this.on(St.TileLoaded,function(e,t,n){var i=this.id+":"+e;u[i]=u[i]||[];var o=qi.getTileLocation(e,t,{}),r=o.faceTileIndex,a=o.face;u[i].push({faceTileIndex:r,face:a});var s=this.getWaitDeferred(e).deferred;if(s&&"pending"===s.state()&&(s.notify(e,t,n),p[i])){var l=p[i].find((function(e){return e.faceTileIndex==r&&e.face==a}));l&&(l.loaded=!0),p[i].some((function(e){return!e.loaded}))||(this.onPanoRendered(this.id,e,n,!0),s.resolve(e,n),this.resetWaitDeferred(e),p[i]=null)}}.bind(this)))}this.tileDownloader.clearForceQueue(),this.tileDownloader.forceQueueTilesForPano(this,e,t,l,c,r);var v=this.curTileQuality||this.qualityManager.getMaxNavPanoSize();this.tiledPanoRenderTarget=this.panoRenderer.activateTiledPano(this,v,i),this.panoRenderer.renderPanoTiles(this.id,t,o,null,v)}return s.promise()}),l.id=i,l.panoType=r.panoType,l.neighbourUUIDs=r.neighbours||[],l.neighbourPanos=null,l.floor=null,l.floorIndex=r.subgroup||0,l.failedLoadingAt=0,l.maxLoadRetries=4,l.origin=r.position.clone(),l.position=r.position.clone(),l.quaternion=r.quaternion.clone(),l.appId=r.index+1,l.$app=e,l.model=l.$app.core.get("Player").model,l.debugColor=(new THREE.Color).setHSL(.06+.53*Math.random(),.8+.2*Math.random(),.5+.2*Math.random()),l.floorPosition=r.puck?r.puck.clone():null,l.marker=null,l.noBlockPanos=[],l.blocks=[],l.seeMarkers=r.seeMarkers,l.tiled=null!=r.tiled?r.tiled:l.model.supportsTiles,l.isAligned()&&(l.marker=new Bi(h(l)));var f=(new THREE.Quaternion).multiplyQuaternions(l.quaternion,to),m=(new THREE.Matrix4).compose(l.position,f,new THREE.Vector3(1,1,1));return l.tiled?(l.rot90Matrix=m,l.matrixWorld=(new THREE.Matrix4).compose(l.position,l.quaternion,new THREE.Vector3(1,1,1))):(l.solidSkybox=new THREE.Texture([null,null,null,null,null,null]),l.solidSkybox.flipY=!1,Je.minimalMemoryMode&&(l.solidSkybox.minFilter=THREE.LinearFilter,l.solidSkybox.magFilter=THREE.LinearFilter,l.solidSkybox.generateMipmaps=!1),l.quaternion=f,l.matrixWorld=m),l.zoomed=!1,l.panoRenderer=null,l.qualityManager=null,l.tileDownloader=null,l.tiledPanoRenderTarget=null,l.resolutionPromise={},l.minimumTiledPanoLoaded=!1,l.highestPartialTileRenderOpCompleted=0,l.highestFullTileRenderOpCompleted=0,l.shouldRedrawOnBaseLoaded=!1,l.lockUntilRenderingComplete=!1,a?(l.hasVideo=!0,l.videoInfo=a):l.hasVideo=!1,l.panoVideo=!1,l.filterEffect={brightness:0,contrast:0,saturation:0,temperature:0},l}return u(n,[{key:"hasFilter",get:function(){var e=this.$app.FilterManager.filterTemp[this.id]||this.filterEffect,t=e.brightness,n=e.contrast,i=e.saturation,o=e.temperature;return 0!==t||0!==n||0!==i||0!==o}},{key:"exit",value:function(){this.tiled?(this.clearWaitDeferreds(),this.minimumTiledPanoLoaded=!1,this.tiledPanoRenderTarget=null,this.setZoomed(!1),this.panoRenderer.deactivateTiledPano(this),this.highestPartialTileRenderOpCompleted=0,this.highestFullTileRenderOpCompleted=0):(this.solidSkybox.dispose(),this.solidSkybox.loaded=!1,this.solidSkybox.version=0),this.emit("exit")}},{key:"hoverOn",value:function(e){0==Je[e].markerOpacityOnHover||this.$app.core.get("Player").locked||this.marker&&pe.start(It.property(this.marker.material,"opacity",Je[e].markerOpacityOnHover),250)}},{key:"hoverOff",value:function(e){0==Je[e].markerOpacity||this.$app.core.get("Player").locked||this.marker&&pe.start(It.property(this.marker.material,"opacity",Je[e].markerOpacity),250)}},{key:"build1",value:function(){this.floor=this.floor||this.model.floors.get(this.floorIndex)||this.raycastToFindFloor()||this.model.floors.list[0],this.floor.addPano(this),this.floorPosition=this.floorPosition||this.raycastFloorPosition(),this.neighbourPanos=this.neighbourPanos||this.findNeighourPanos(),Je.colorMarkerByFloor&&this.marker&&this.marker.material.color.set(this.floor.debugColor)}},{key:"build2",value:function(){var e=this;this.floorPosition=this.floorPosition||this.interpolateFloorPosition(),this.height=this.position.distanceTo(this.floorPosition),this.placeMarker(),this.isAligned()&&(this.$app.config.view||this.addLabel(),setTimeout((function(){oo&&e.addLabel2()}),1))}},{key:"placeMarker",value:function(){this.marker&&(this.marker.position.copy(this.floorPosition),this.marker.position.y+=.01,this.marker.lookAt(new THREE.Vector3(0,1,0).add(this.marker.position)))}},{key:"attachToPanoRenderer",value:function(e){this.panoRenderer=e,this.panoRenderer.on(Tt.TileRenderSuccess,this.onTileRendered.bind(this)),this.panoRenderer.on(Tt.PanoRenderComplete,this.onPanoRendered.bind(this)),this.panoRenderer.on(Tt.TileRenderFailure,this.onTileRenderFail.bind(this)),this.panoRenderer.on(Tt.UploadAttemptedForAllTiles,this.onUploadAttemptedForAllTiles.bind(this))}},{key:"updateMakerStyle",value:function(e){this.marker&&("animate"==e?this.marker.updateStyle(this.model,"animate",this):this.hasVideo&&this.panoVideoRenderer.ifEnable()||this.panoVideo?this.marker.updateStyle(this.model,"video",this):this.marker.updateStyle(this.model,"normal",this))}},{key:"createVrMarker",value:function(e,t){var n=this;this.isAligned()&&(this.vrMarker=new THREE.Sprite(new THREE.SpriteMaterial({transparent:!0,opacity:.75,map:e,depthTest:!1})),this.vrMarker.name="vrMarker",this.vrMarker.scale.set(.16,.16,1),this.vrMarker.boluoType="vr",this.vrMarker.position.copy(this.position),this.vrMarker.position.y-=.2,this.vrMarker.enabled=!0,this.vrMarker.visible=!1,this.vrMarker.renderOrder=Se,this.vrMarker.pano=this,this.model.vrMarkers.push(this.vrMarker),this.model.add(this.vrMarker),this.vrMarker.addEventListener("click",(function(){"portrait"!=window.VRScreenType&&t.flyToPano({pano:n})})))}},{key:"hasNeighbor",value:function(){var e=this;return this.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}},{key:"attachToPanoVideoRenderer",value:function(e){this.hasVideo&&(this.panoVideoRenderer=e,this.on(St.Enter,e.onVideoPanoramasEnter.bind(e)),this.on(St.Exit,e.onVideoPanoramasExit.bind(e)))}},{key:"getWaitDeferred",value:function(e){var t=this.resolutionPromise[this.id];t||(t={},this.resolutionPromise[this.id]=t);var n=t[e];return n||(n={deferred:vt(),active:!1},t[e]=n),n}},{key:"resetWaitDeferred",value:function(e){var t=this.getWaitDeferred(e);t.active=!1,t.deferred=vt()}},{key:"clearWaitDeferreds",value:function(){var e=this.resolutionPromise[this.id];for(var t in e||(e={},this.resolutionPromise[this.id]=e),e)if(e.hasOwnProperty(t)){var n=e[t];n.active=!1,n.deferred=vt()}}},{key:"onUploadAttemptedForAllTiles",value:function(e,t,n){e===this.id&&(t===this.qualityManager.getPanoSize(Dt)&&this.shouldRedrawOnBaseLoaded&&(this.shouldRedrawOnBaseLoaded=!1,this.panoRenderer.resetRenderStatus(this.id,!0,!1),this.panoRenderer.renderPanoTiles(this.id,null,!0,!0)))}},{key:"onTileRendered",value:function(e,t,n,i){e===this.id&&this.emit(St.TileLoaded,t,n,i)}},{key:"onPanoRendered",value:function(e,t,n,i){e===this.id&&(this.minimumTiledPanoLoaded=!0,this.updateSkyboxForZoomLevel(),t>this.highestPartialTileRenderOpCompleted&&(this.highestPartialTileRenderOpCompleted=t),!i&&t>this.highestFullTileRenderOpCompleted&&(this.highestFullTileRenderOpCompleted=t),this.emit("load",t),this.model.emit("load",this),this.emit(St.LoadComplete,t,n))}},{key:"setZoomed",value:function(e){this.zoomed=e,this.updateSkyboxForZoomLevel(),e?"1k"!=this.$app.core.get("QualityManager").navTileClass&&this.model.showHighMap():this.model.hideHighMap()}},{key:"ensureSkyboxReadyForRender",value:function(){this.tiled||(this.solidSkybox.loaded||(this.solidSkybox.needsUpdate=!0),this.solidSkybox.loaded=!0)}},{key:"updateSkyboxForZoomLevel",value:function(){this.minimumTiledPanoLoaded&&this.model.updateProjectedPanos(this)}},{key:"getSkyboxTexture",value:function(){return this.tiled?this.minimumTiledPanoLoaded?this.zoomed&&this.qualityManager.maxRenderTargetSize>this.qualityManager.maxNavPanoSize?this.panoRenderer.zoomRenderTarget.texture:this.tiledPanoRenderTarget&&this.tiledPanoRenderTarget.texture:null:this.solidSkybox}},{key:"onTileRenderFail",value:function(e,t,n){e===this.id&&this.emit(St.LoadFailed,t)}},{key:"isLoaded",value:function(e){return this.tiled?(e&&"string"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"),!!this.minimumTiledPanoLoaded&&(!e||this.highestFullTileRenderOpCompleted>=e)):(e&&"number"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a non-tiled pano uses high/low."),!!this.solidSkybox.high||e in this.solidSkybox)}},{key:"loadCube",value:function(e){if(this.isLoaded(e))return nt.info("Skipping load of pano, already loaded"),mt.when();this.emit("loading",e),this.model.emit("loading",this);var t=this.getCubemapUrls(this.id,e);if("360view"==this.panoType){var n=this.$app.core.get("Player");if(!n.viewLinkManager.views[this.id])return;var i=n.viewLinkManager.views[this.id].panoImgVersion;i&&(t+="&"+i)}return Xn.getImage(t).then(function(t){return this.solidSkybox[e]=t,this.solidSkybox.minFilter=THREE.LinearFilter,"high"!==e&&this.solidSkybox.high||(this.solidSkybox.image=this.solidSkybox[e],this.solidSkybox.low=null,console.log("loaded",this.id)),this.solidSkybox.dispose(),this.solidSkybox.needsUpdate=!0,this.emit("load",e),this.model.emit("load",this),this}.bind(this),function(){nt.error("Downloading cubemap for pano",this.id,"failed"),this.failedLoadingAt=Date.now()}.bind(this),(function(){console.log("load cubeTex 出现问题?")}))}},{key:"loadCubeImage",value:function(e){var t=vt(),n=new Image;return n.onerror=function(){t.reject()},n.onload=function(){t.resolve(n)},n.crossOrigin=THREE.ImageUtils.crossOrigin,n.src=e,t}},{key:"getCubemapUrls",value:function(e,t){return this.mapSrc?this.mapSrc:this.$app.resource.getViewImagesURL("pan/".concat(t,"/").concat(e,".jpg"))}},{key:"worldPosition",value:function(){return this.position}},{key:"isAligned",value:function(){return!this.panoType}},{key:"updateTileQuality",value:function(e){this.$app.core.get("Player");var t=this.qualityManager.getMaxNavPanoSize();this.curTileQuality=Math.min(e,t)}},{key:"getVideoFilter",value:function(e){var t,i,o,r=this;if(this.hasVideo&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(this.videoInfo.dir)o=this.videoInfo.dir.clone(),i=THREE.MathUtils.degToRad(this.videoInfo.hfov/2);else{var a=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180)),s=$i.FORWARD.clone().applyQuaternion(a.multiply(this.quaternion)).add(this.position);o=s.clone().sub(this.position),i=THREE.MathUtils.degToRad(32.5)}else this.panoVideo&&(o=this.panoVideo.dir.clone(),i=THREE.MathUtils.degToRad(this.panoVideo.hfov/2));return o&&(t="across"==e?function(e,t){var i=(new THREE.Vector3).subVectors(e,r.position).setY(0).normalize(),a=(new THREE.Vector3).subVectors(t,r.position).setY(0).normalize(),s=(new THREE.Vector3).addVectors(i,a).normalize(),l=i.angleTo(s),c=(new THREE.Vector3).addVectors(r.position,o);return n.filters.isInFanAngle(r.position,s,l)(c)}:n.filters.isInFanAngle(this.position,o,i)),t}},{key:"addLabel",value:function(){this.label=new Ki(Object.assign({player:this.$app.core.get("Player")},no,{text:this.appId}));var e=he.linearClamp(this.label.text.length,2,6,.4,.2);this.label.scale.set(e,e,e),this.marker.add(this.label)}},{key:"addLabel2",value:function(){this.removeLabel(),this.label2=new Ki(Object.assign({player:this.$app.core.get("Player"),sizeInfo:{minSize:50,maxSize:300,nearBound:.2,farBound:Math.max(20,this.model.size.length()/3),farBoundPlan:250}},io,{text:"".concat(this.id,"-f").concat(this.floorIndex)}));var e=this.floorPosition.clone();e.y+=.4,this.label2.position.copy(e),this.floor.add(this.label2)}},{key:"removeLabel",value:function(){this.label2&&(this.floor.remove(this.label2),this.label2.material.dispose(),this.label2=null)}}]),n}();function ao(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ro.raycastsSkipped=0,ro.raycastsDone=0,ro.filters={inDirection:function(e,t,n){return function(i){return i.position.clone().sub(e).normalize().dot(t)>n}},inFloorDirection:function(e,t,n){return function(i){return i.floorPosition.clone().sub(e).normalize().dot(t)>n}},inFloorDirection_2d:function(e,t,n){return function(i){var o=new THREE.Vector2(i.floorPosition.x,i.floorPosition.z),r=new THREE.Vector2(e.x,e.z);return o.sub(r).normalize().dot(new THREE.Vector2(t.x,t.z))>n}},inPanoDirection:function(e,t,n){return n=Je.navigation.panoScores?Je.navigation.filterStrictness:n,function(i){var o=i.floorPosition.clone().sub(e).normalize(),r=i.position.clone().sub(e).normalize();return o.dot(t)>n||r.dot(t)>n}},atFloor:function(e){return function(t){return!e||t.floor===e}},not:function(e){return function(t){return t!==e}},notIn:function(e){return function(t){return-1===e.indexOf(t)}},isLoaded:function(){return function(e){return e.isLoaded()}},isNotLoaded:function(){return function(e){return!e.isLoaded()}},isCloseEnoughTo:function(e,t){return function(n){return e.distanceTo(n.floorPosition)<t}},isClampDisSquaredTo:function(e,t,n){return function(i){var o=e.distanceToSquared(i.floorPosition);return o>t&&o<n}},hasMinimumHeightDifferenceTo:function(e,t){return function(n){return Math.abs(n.position.y-e.y)>t}},isNotBehindNormal:function(e,t){var n=new THREE.Vector3;return t=t.clone(),function(i){return n.copy(i.position).sub(e).normalize().dot(t)>0}},isNeighbourPanoTo:function(e){return function(t){return!e||!e.neighbourPanos||!!e.neighbourPanos[t.id]}},isNeighbourOfNeighbourTo:function(e){return function(t){return!!e.neighbourPanos[t.id]||e.neighbourUUIDs.some((function(n){var i=e.model.panos.get(n);return!!i&&i.neighbourPanos[t.id]}))}},isNotRecentlyFailed:function(e){return function(t){return Date.now()-t.failedLoadingAt>e}},isOnVisibleFloor:function(){return function(e){return!e.floor.hidden}},isPanoAligned:function(){return function(e){return e.isAligned()}},isInFanAngle:function(e,t,n){return function(i){var o=t.setY(0),r=i.clone().sub(e).setY(0);return o.angleTo(r)<=n}}},ro.sortFunctions={distanceToPoint:function(e){return function(t,n){return t.position.distanceTo(e)-n.position.distanceTo(e)}},floorDistanceToPoint:function(e){return function(t,n){return t.floorPosition.distanceTo(e)-n.floorPosition.distanceTo(e)}},choose:function(e){return function(t,n){return e.id===t.id?-1:e.id===n.id?1:0}}},ro.scoreFunctions={distance:function(e,t){return t=t||Je.navigation.distanceFactor,function(n){return e?e.position.distanceTo(n.position)*t:0}},distanceSquared:function(e,t){return t=t||Je.navigation.distanceFactor,function(n){return e?e.position.distanceToSquared(n.position)*t:0}},direction:function(e,t,n){return function(i){return i.position.clone().sub(e).normalize().dot(t)*(n||Je.navigation.directionFactor)}},directionFloor:function(e,t){return function(n){return n.floorPosition.clone().sub(e).normalize().dot(t)*Je.navigation.directionFactor}},angle:function(e,t){return function(n){return n.position.clone().sub(e).normalize().angleTo(t)*Je.navigation.angleFactor}},inFieldOfView:function(e,t){return function(n){return n.position.clone().sub(e).normalize().dot(t)>.75?10:-1}},optionality:function(e){return function(t){return t.neighbourUUIDs.filter((function(t){return!(t in e.neighbourUUIDs)&&t!==e.id})).length*Je.navigation.optionalityFactor}},penalizeHeightDifferenceUnder:function(e,t){return function(n){return e.y-n.position.y<t?-20:0}}};var so=function(e){f(n,e);var t=ao(n);function n(e){var i;return o(this,n),(i=t.call(this)).neighbourMap={},i.map=null,i.animatePanoId=null,e&&e.TourManager.player.then((function(e){e.on("play2",(function(){i.list.forEach((function(e){e.label&&Ae.updateVisible(e.label,"recordTour",!1)}))})),e.on("end",(function(){i.list.forEach((function(e){e.label&&Ae.updateVisible(e.label,"recordTour",!0)}))})),e.on("pause",(function(){i.list.forEach((function(e){e.label&&Ae.updateVisible(e.label,"recordTour",!0)}))}))})),i}return u(n,[{key:"getIndex",value:function(e){return e.id}},{key:"find",value:function(e,t){var n=Ae.filterAll(this.list,e);return 0===n.length?null:(t&&t.forEach((function(e){n=Ae.stableSort(n,e)})),n[0])}},{key:"lowestByScore",value:function(e,t,n){return this.findRankedByScore(0,e,t,n)}},{key:"findRankedByScore",value:function(e,t,n,i){i&&(i.candidates=null,i.pano=null),e||(e=0);var o=Ae.sortByScore(this.list,t,n);return!o||0===o.length||e>=o.length?null:(i&&(i.candidates=o,i.pano=o[e].item),o[e].item)}},{key:"getNeighbours",value:function(e){return this.neighbourMap[e.id]}},{key:"setNeighbour",value:function(e,t,n){return this.neighbourMap[e.id]||(this.neighbourMap[e.id]={}),this.neighbourMap[t.id]||(this.neighbourMap[t.id]={}),this.neighbourMap[e.id][e.id]=!0,this.neighbourMap[t.id][t.id]=!0,this.neighbourMap[e.id][t.id]=n,this.neighbourMap[t.id][e.id]=n,this.neighbourMap[e.id]}},{key:"findClosest",value:function(e,t){var n=[ro.filters.isPanoAligned()];return t&&n.push(ro.filters.inDirection(e,t,.75)),this.find(n,[ro.sortFunctions.distanceToPoint(e)])}},{key:"fadeMarkerOpacity",value:function(e,t,n){if(pe.cancelById("fadeMarkerOpacity"),this.list.findIndex((function(e){return e.marker}))<0)logger.info("marker findIndex<0");else{var i,o=function(e,n){e.member=e.member.filter((function(t){return t.marker&&t.marker.material.opacity!=e.toOp})),pe.trigger({func:function(t,n){e.member.forEach((function(n){var i=n.marker.oldOpacity,o=i+t*(e.toOp-i);n.marker&&(n.marker.material.opacity=o)}))}.bind(this),duration:null==t?Je.markerOpacityTransitionTime:t,name:"_fpm_"+n,id:"fadeMarkerOpacity"})};this.forEach((function(e){e.marker&&(e.marker.oldOpacity=e.marker.material.opacity)})),i=(e=null==e?Je.panorama.markerOpacity:e)>0&&n?n:[{member:this.list,toOp:e}];for(var r=0;r<i.length;r++)o(i[r],r)}}},{key:"closestPanoTowardPoint",value:function(e){var t=e.point,n=e.require||[],i={position:t},o=new THREE.Vector3,r=e.rank||[ro.scoreFunctions.distanceSquared(i,-2)];e.force;var a=e.getAll,s=e.angleTolerDecrease||2;n.push(ro.filters.isPanoAligned()),n.push((function(e){return e.hasNeighbor()})),n.push((function(e){o.copy(t).sub(e.position);var n=-THREE.MathUtils.radToDeg(Math.atan(o.y/Math.sqrt(o.x*o.x+o.z*o.z))),i=Je.insideFOV/2-s,r=Je.insideLookLimitDown-i,a=Je.insideLookLimitUp+i;return r<n&&n<a})),e.floor&&n.push(ro.filters.atFloor(e.floor));var l=Ae.sortByScore(this.list,n,r);return a?l:l&&l.length>0&&l[0].item}}]),n}(yt);function lo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var co=function(e){f(n,THREE.Mesh);var t=lo(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;o(this,n),e=e.clone().expandByVector(new THREE.Vector3(a,a,a));var s=new THREE.Vector3;e.getSize(s);var l=new THREE.BoxGeometry(s.x,s.y,s.z);l.computeBoundingBox(),r=t.call(this,l,i);var c=new THREE.Vector3;return e.getCenter(c),a&&(c.y+=a-.1),r.position.copy(c),r.frustumCulled=!1,r}return n}();function uo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ho=function(e){f(n,THREE.RawShaderMaterial);var t=uo(n);function n(e,i){var r;if(o(this,n),(e=e||{}).not_Cube){var a=e.defines||{};a.Not_Cube="",e.defines=a}i=i||"model";if((r=t.call(this,Ae.extendObject({fragmentShader:sn[i].fragmentShader,vertexShader:sn[i].vertexShader,uniforms:THREE.UniformsUtils.clone(sn[i].uniforms),name:"ModelTextureMaterial"},e))).uniforms.progress){var s=0;Object.defineProperty(r.uniforms.progress,"value",{get:function(){return s},set:function(e){e<1?"usePanoMap0"in r.defines||(r.defines.usePanoMap0="",r.needsUpdate=!0):"usePanoMap0"in r.defines&&(delete r.defines.usePanoMap0,r.needsUpdate=!0),s=e}})}return r}return u(n,[{key:"setProjectedPanos",value:function(e,t,n){var i=this;if("BasePanoMap"in this.defines||(n&&(this.uniforms.progress.value=0),e.ensureSkyboxReadyForRender(),t.ensureSkyboxReadyForRender(),this.updateTexDefines(e,t)),this.uniforms.pano0Map.value=e.getSkyboxTexture(),this.uniforms.pano0Position.value.copy(e.position),this.uniforms.pano0Matrix.value.copy(e.matrixWorld),this.uniforms.pano1Map.value=t.getSkyboxTexture(),this.uniforms.pano1Position.value.copy(t.position),this.uniforms.pano1Matrix.value.copy(t.matrixWorld),delete this.defines.HasVideo,t.hasVideo){this.uniforms.exposure.value=t.videoInfo.exposure||1,this.uniforms.blendFov.value=t.videoInfo.blendFov||5,t.videoInfo.clipRect&&this.uniforms.clipRect.value.set(t.videoInfo.clipRect.leftBottom.x,t.videoInfo.clipRect.leftBottom.y,t.videoInfo.clipRect.rightTop.x,t.videoInfo.clipRect.rightTop.y),this.defines.VideoMapping=t.videoInfo.mapping||0,this.defines.HasVideo=t.videoInfo.cameraType||8;var o=t.panoVideoRenderer.videoPlayer,r=o._resource?o._resource.get(t.id).video:o.instances.get(t.id).videoElement;0==r.readyState?r.addEventListener("resize",(function(e){i.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}),!1):this.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}t.hasFilter||e.hasFilter?this.defines.hasFilter=!0:delete this.defines.hasFilter,this.needsUpdate=!0}},{key:"updateTexDefines",value:function(e,t){var n=this,i=!1,o=function(e,t){e.tiled?null!=n.defines["Not_Cube_"+t]&&(delete n.defines["Not_Cube_"+t],i=!0):null==n.defines["Not_Cube_"+t]&&(n.defines["Not_Cube_"+t]="",i=!0)};o(e,0),o(t,1),i&&(this.needsUpdate=!0)}}]),n}();function po(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var fo=function(e){f(n,e);var t=po(n);function n(e,i){var r;o(this,n),nt.time("Computing a nice bounding cubemap");var a=new ho({side:THREE.BackSide,transparent:!0});return a.uniforms.modelAlpha.value=0,a.uniforms.opacity.value=1-Je.modelAlpha,(r=t.call(this,e,a,i)).renderOrder=Pe,nt.timeEnd("Computing a nice bounding cubemap"),r}return n}(co);function mo(){}mo.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t)for(var r=0,a=i.length;r<a;r++)i[r].fn!==t&&i[r].fn._!==t&&o.push(i[r]);return o.length?n[e]=o:delete n[e],this}};var vo=mo,go=mo;vo.TinyEmitter=go;var Ao={map:{type:"t",value:null},opacity:{type:"f",value:1},opaRadius:{type:"f",value:.2}},yo="\n varying vec2 vUv;\n void main() {\n vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",Eo="uniform sampler2D map; \n uniform float opacity;\n uniform float opaRadius;\n varying vec2 vUv; \n void main() {\n vec2 vUv2 = vec2(vUv.x*2.0 - 1.0, vUv.y*2.0 - 1.0); \n vec4 colorFromTexture = texture2D( map, vUv ); \n float opa = 1.0; \n float r = vUv2.x*vUv2.x + vUv2.y*vUv2.y; \n if(r > 1.0) opa = 0.0; \n else if(r < opaRadius)opa = 1.0; \n else{\t\n float a = -1.0 / ((opaRadius - 1.0)*(opaRadius - 1.0));\n float b = -2.0 * a * opaRadius;\t\n float c = 1.0 + a * opaRadius * opaRadius; \n opa = a * r*r + b * r + c; \n } \n gl_FragColor = vec4(colorFromTexture.rgb, opacity * colorFromTexture.a * opa );\n }\n ";function wo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var bo={floorLogo:{name:"floorLogoImg.png",geometry:new THREE.Vector4(2.5,2.5,1,1),size:100,position:new THREE.Vector3(0,-1.49,0),renderOrder:99}},Co=function(e){f(n,e);var t=wo(n);function n(e){var i,r;return o(this,n),(i=t.call(this)).changefloorLogoOpa=function(e){var t=0==e.index?this.firstLogo:this.secondLogo;pe.cancelById("flOpa_"+e.index),null!=e.from&&(t.material.opacity=e.from),e.dur?pe.start(It.property(t.material,"opacity",e.opa),e.dur||0,null,e.delay||0,de.easeInQuad,"changefloorLogoOpa","flOpa_"+e.index):t.material.opacity=e.opa},i.updateFloorlogo=(r=new THREE.Quaternion,function(e){var t,n;if(!this.fixDirection&&e&&this.ready&&((this.firstLogo.visible||0!=this.firstLogo.material.opacity||this.secondLogo.visible||0!=this.secondLogo.material.opacity)&&(n=!0),n)){var i,o=this.app.core.get("Player").camera.quaternion;if((i=$e.closeTo(o,r,5))||(r=o.clone()),!i){if(!t){var a=new THREE.Vector3(0,0,-1).applyQuaternion(e).setY(0),s=(new THREE.Matrix4).lookAt(a,new THREE.Vector3,new THREE.Vector3(0,1,0));t=(new THREE.Quaternion).setFromRotationMatrix(s);var l=new THREE.Quaternion(0,.7071067811865476,.7071067811865476,0);t.multiply(l)}this.firstLogo.quaternion.copy(t),this.secondLogo.quaternion.copy(t)}}}),i.setDir=function(e){this.fixDirection&&(this.firstLogo.rotation.z=THREE.MathUtils.degToRad(-e),this.secondLogo.rotation.z=THREE.MathUtils.degToRad(-e))},i.app=e,i.ready=!1,i.fixDirection=!1,i.firstLogo=new THREE.Mesh(new THREE.PlaneGeometry(2.5,2.5,1,1),new THREE.MeshBasicMaterial({transparent:!0,depthWrite:!1,depthTest:!1})),i.secondLogo=i.firstLogo.clone(),i.secondLogo.material=i.firstLogo.material.clone(),i}return u(n,[{key:"bindEvents",value:function(){}},{key:"createFloorLogo",value:function(){var e=this,t=this.getLogo(),n=t.url,i=t.size/100;Ae.updateVisible(this.firstLogo,"unready",!1),Ae.updateVisible(this.secondLogo,"unready",!1),this.setLogoMesh(this.firstLogo,i),this.setLogoMesh(this.secondLogo,i);var o=$n.load(n,(function(){var t=e.getTex(o);e.firstLogo.material.map=t,e.secondLogo.material.map=t,e.firstLogo.material.needsUpdate=!0,e.secondLogo.material.needsUpdate=!0,Ae.updateVisible(e.firstLogo,"unready",!0),Ae.updateVisible(e.secondLogo,"unready",!0),e.emit("ready"),e.ready=!0}))}},{key:"setLogoMesh",value:function(e,t){return e.name="floorlogo",e.scale.set(t,t,t),e.position.set(bo.floorLogo.position.x,bo.floorLogo.position.y,bo.floorLogo.position.z),e.lookAt(e.position.clone().add(new THREE.Vector3(0,1,0))),e.renderOrder=bo.floorLogo.renderOrder,e}},{key:"getTex",value:function(e){var t=THREE.UniformsUtils.clone(Ao);t.map.value=e;var n=new THREE.ShaderMaterial({fragmentShader:Eo,vertexShader:yo,uniforms:t,side:THREE.DoubleSide,transparent:!0,premultipliedAlpha:!0});n.needsUpdate=!0;var i=Ae.renderTex(n,this.app.core.get("SceneRenderer").renderer,{x:512,y:512});return n.dispose(),i.anisotropy=5,i}},{key:"getLogo",value:function(){var e=this.app.store.getValue("metadata"),t=this.app.config.scene.floorlogoId||e.floorLogo||"0";"zh"!=this.app.config.lang&&(t="en/"+t),"aws"==this.app.config.region&&(t="aws/"+t);var n=e.floorLogoSize||100;return{url:"user"===e.floorLogo?this.app.resource.getUserResourceURL(e.floorLogoFile):this.app.resource.getAppURL("images/floorlogos/".concat(t,".png")),size:n}}},{key:"changeFloorLogo",value:function(e){var t=this;if(this.ready){var n=this.firstLogo.material,i=function(e){n.map&&n.map.dispose();var i=t.getTex(e);t.firstLogo.material.map=i,t.secondLogo.material.map=i};if(e.url)$n.load(e.url,i);else if(e.id)$n.load(this.app.resource.getAppURL("images/floorlogos/".concat(e.id,".png")),i);else if(e.image){var o=new THREE.Texture(e.image);o.needsUpdate=!0,i(o)}if(e.size){var r=e.size/100;this.firstLogo.scale.set(r,r,r),this.secondLogo.scale.set(r,r,r)}}}}]),n}(vo);function xo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Io=THREE.BoxBufferGeometry,To=THREE.BufferGeometry,Bo=THREE.Color,ko=THREE.CylinderBufferGeometry,Po=THREE.DoubleSide,Ro=THREE.Euler,Mo=THREE.Float32BufferAttribute,So=THREE.Line;THREE.LineBasicMaterial;var Do=THREE.Matrix4,Fo=THREE.Mesh,Lo=THREE.MeshBasicMaterial,Ho=THREE.Object3D,Qo=THREE.OctahedronBufferGeometry,Oo=THREE.PlaneBufferGeometry,Vo=THREE.Quaternion;THREE.Raycaster;var _o,Uo,No,zo,Go,jo,Wo,qo=THREE.TorusBufferGeometry,Jo=new THREE.Raycaster,Yo=new THREE.Vector3,Zo=new THREE.Vector3,Xo=new THREE.Quaternion,Ko={X:new THREE.Vector3(1,0,0),Y:new THREE.Vector3(0,1,0),Z:new THREE.Vector3(0,0,1)},$o=new THREE.Vector3,er=new THREE.Vector3,tr=new THREE.Vector3,nr=new THREE.Vector3,ir=new THREE.Vector3,or=new THREE.Vector3,rr=0,ar=new THREE.Vector3,sr=new THREE.Quaternion,lr=new THREE.Vector3,cr=new THREE.Vector3,ur=new THREE.Quaternion,hr=new THREE.Quaternion,dr=new THREE.Vector3,pr=new THREE.Vector3,fr=new THREE.Quaternion,mr=new THREE.Vector3,vr=new THREE.Vector3,gr=new THREE.Quaternion,Ar=new THREE.Quaternion,yr=new THREE.Vector3,Er=new THREE.Vector3,wr=new THREE.Vector3,br=new THREE.Quaternion,Cr=new THREE.Vector3,xr=0,Ir=function(e){f(n,THREE.Object3D);var t=xo(n);function n(e,i,r){var a;return o(this,n),a=t.call(this),void 0===i&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),i=document),a.visible=!1,a.domElement=i,jo=new Tr(r),a.add(jo),Wo=new Lr(r),a.add(Wo),a.player=r.player,a.options=r,_o={type:"change"},Uo={type:"mouseDown"},zo={type:"mouseUp",mode:a.mode},No={type:"mousing"},Go={type:"objectChange"},a.defineProperty("camera",e),a.defineProperty("object",void 0),a.defineProperty("enabled",!0),a.defineProperty("axis",null),a.defineProperty("mode","translate"),a.defineProperty("translationSnap",null),a.defineProperty("rotationSnap",null),a.defineProperty("scaleSnap",null),a.defineProperty("space","world"),a.defineProperty("spaceForRotate",null),a.defineProperty("size",1),a.defineProperty("dragging",!1),a.defineProperty("showX",!0),a.defineProperty("showY",!0),a.defineProperty("showZ",!0),a.defineProperty("worldPosition",vr),a.defineProperty("worldPositionStart",pr),a.defineProperty("worldQuaternion",gr),a.defineProperty("worldQuaternionStart",fr),a.defineProperty("cameraPosition",ar),a.defineProperty("cameraQuaternion",sr),a.defineProperty("pointStart",$o),a.defineProperty("pointEnd",er),a.defineProperty("rotationAxis",nr),a.defineProperty("rotationAngle",rr),a.defineProperty("eye",Er),i.addEventListener("mousedown",a.onPointerDown.bind(h(a)),!1),i.addEventListener("touchstart",a.onPointerDown.bind(h(a)),!1),i.addEventListener("mousemove",a.onPointerHover.bind(h(a)),!1),i.addEventListener("touchmove",a.onPointerHover.bind(h(a)),!1),i.addEventListener("touchmove",a.onPointerMove.bind(h(a)),!1),window.addEventListener("mouseup",a.onPointerUp.bind(h(a)),!1),window.addEventListener("pointerup",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchend",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchcancel",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchleave",a.onPointerUp.bind(h(a)),!1),a.isTransformControls=!0,a}return u(n,[{key:"dispose",value:function(){domElement.removeEventListener("mousedown",this.onPointerDown.bind(this)),domElement.removeEventListener("touchstart",this.onPointerDown.bind(this)),domElement.removeEventListener("mousemove",this.onPointerHover.bind(this)),document.removeEventListener("mousemove",this.onPointerMove.bind(this)),domElement.removeEventListener("touchmove",this.onPointerHover.bind(this)),domElement.removeEventListener("touchmove",this.onPointerMove.bind(this)),window.removeEventListener("mouseup",this.onPointerUp.bind(this),!1),window.removeEventListener("pointerup",this.onPointerUp.bind(this),!1),domElement.removeEventListener("touchend",this.onPointerUp.bind(this)),domElement.removeEventListener("touchcancel",this.onPointerUp.bind(this)),domElement.removeEventListener("touchleave",this.onPointerUp.bind(this)),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,W.isTyping=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,W.isTyping=!1,this}},{key:"setSize",value:function(e,t){}},{key:"switchEditState",value:function(e){var t=JSON.stringify(this.options.scaleAxis);"overlay"==e?(this.options.NoScaleZ=!0,this.options.scaleAxis=["x","y"]):"panovideo"==e?(this.mode="scale",this.options.NoScaleZ=!0,this.options.scaleAxis=["x","y"]):("decoration"==e||"clipbox"==e)&&(this.options.NoScaleZ=!1,this.options.scaleAxis=["x","y","z"]),t!=JSON.stringify(this.options.scaleAxis)&&this.rebuildAxis("scale"),this.editState=e}},{key:"filterRotateAxis",value:function(e){var t=JSON.stringify(this.options.rotateAxis);this.options.rotateAxis=e,t!=JSON.stringify(this.options.rotateAxis)&&this.rebuildAxis("rotate")}},{key:"rebuildAxis",value:function(e){jo.gizmo[e].removeFromParent(),jo.picker[e].removeFromParent(),jo.gizmo[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),jo.picker[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}));var t=jo["update"+e.charAt(0).toUpperCase()+e.slice(1)](),n=t.gizmo,i=t.picker;jo.add(jo.gizmo[e]=jo.setupGizmo(n)),jo.add(jo.picker[e]=jo.setupGizmo(i)),jo.picker[e].visible=!1}},{key:"handleDragStart",value:function(){this.editState&&this.onPointerDown()}},{key:"handleDragging",value:function(){this.editState&&this.onPointerMove()}},{key:"handleDragEnd",value:function(){this.editState&&this.onPointerUp()}},{key:"defineProperty",value:function(e,t){var n=t;Object.defineProperty(this,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,Wo[e]=t,jo[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(_o))}}),this[e]=t,Wo[e]=t,jo[e]=t}},{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),this.object.parent.matrixWorld.decompose(cr,ur,dr),this.object.matrixWorld.decompose(vr,gr,yr),hr.copy(ur).invert(),Ar.copy(gr).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(ar,sr,lr),Er.copy(ar).sub(vr).normalize(),Ho.prototype.updateMatrixWorld.call(this)}},{key:"pointerHover",value:function(e){if(void 0!==this.object&&!0!==this.dragging&&(void 0===e.button||0===e.button)){var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Jo.set(t,this.player.getMouseDirection(e));var n=Jo.intersectObjects(jo.picker[this.mode].children,!0)[0]||!1;n?(this.axis=n.object.name,this.intersect=n.object,this.player.domElement.style.cursor="pointer"):(this.intersect=null,this.axis=null,this.player.domElement.style.cursor="")}}},{key:"pointerDown",value:function(e){if(!(void 0===this.object||!0===this.dragging||void 0!==e.button&&0!==e.button||0!==e.button&&void 0!==e.button||null===this.axis)){var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Jo.set(t,this.player.getMouseDirection(e));var n=Jo.intersectObjects([Wo],!0)[0]||!1;if(n){var i=this.space;if("scale"===this.mode?i="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(i="world"),"local"===i&&"rotate"===this.mode){var o=this.rotationSnap;"X"===this.axis&&o&&(this.object.rotation.x=Math.round(this.object.rotation.x/o)*o),"Y"===this.axis&&o&&(this.object.rotation.y=Math.round(this.object.rotation.y/o)*o),"Z"===this.axis&&o&&(this.object.rotation.z=Math.round(this.object.rotation.z/o)*o)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),wr.copy(this.object.position),br.copy(this.object.quaternion),Cr.copy(this.object.scale),this.object.matrixWorld.decompose(pr,fr,mr),$o.copy(n.point).sub(pr),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!1)}this.dragging=!0,Uo.mode=this.mode,this.dispatchEvent(Uo)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,i=this.object,o=this.space;if("scale"===n?o="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(o="world"),void 0!==i&&null!==t&&!1!==this.dragging&&(void 0===e.button||0===e.button)){var r=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Jo.set(r,this.player.getMouseDirection(e));var a=Jo.intersectObjects([Wo],!0)[0]||!1;if(!1!==a){if(er.copy(a.point).sub(pr),"translate"===n){if(tr.copy(er).sub($o),"local"===o&&"XYZ"!==t&&tr.applyQuaternion(Ar),-1===t.indexOf("X")&&(tr.x=0),-1===t.indexOf("Y")&&(tr.y=0),-1===t.indexOf("Z")&&(tr.z=0),"local"===o&&"XYZ"!==t?tr.applyQuaternion(br).divide(dr):tr.applyQuaternion(hr).divide(dr),i.overlayType){var s=i.floor.boundingBox.min.y-tr.y-wr.y;s>0&&s<.024&&(tr.y=i.floor.boundingBox.min.y-wr.y)}tr.y*=Math.sign(i.scale.y),tr.z*=Math.sign(i.scale.z),i.position.copy(tr).add(wr),this.translationSnap&&("local"===o&&(i.position.applyQuaternion(Xo.copy(br).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(br)),"world"===o&&(i.parent&&i.position.add(Yo.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Yo.setFromMatrixPosition(i.parent.matrixWorld))))}else if("scale"===n){if(-1!==t.search("XYZ")){var l=er.length()/$o.length();er.dot($o)<0&&(l*=-1),this.options.NoScaleZ?Zo.set(l,l,1):Zo.set(l,l,l)}else if(-1!==t.search("XY")){l=er.length()/$o.length();er.dot($o)<0&&(l*=-1),Zo.set(l,l,1)}else Yo.copy($o),Zo.copy(er),Yo.applyQuaternion(Ar),Zo.applyQuaternion(Ar),Zo.divide(Yo),-1===t.search("X")&&(Zo.x=1),-1===t.search("Y")&&(Zo.y=1),-1===t.search("Z")&&(Zo.z=1);if("overlay"==this.editState||"decoration"==this.editState){"overlay"==this.editState&&(Cr.x*=Je.overlay.width,Cr.y*=Je.overlay.height);var c,u=["x","y","z"],h={min:{v:1/0},max:{v:-1/0}};u.forEach((function(e){if(Zo[e]=Math.abs(Zo[e]),1!=Zo[e]){var t=Zo[e]*Cr[e];t<h.min.v?(h.min.axis=e,h.min.v=t):t>h.min.v&&(h.max.axis=e,h.max.v=t)}})),h.min.v<.1?c=.1/Cr[h.min.axis]:h.max.v>10&&(c=10/Cr[h.max.axis]),c&&u.forEach((function(e){1!=Zo[e]&&(Zo[e]=c)})),"overlay"==this.editState&&(Cr.x/=Je.overlay.width,Cr.y/=Je.overlay.height)}this.editState,i.scale.copy(Cr).multiply(Zo),this.scaleSnap&&(-1!==t.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap)),"overlay"==this.editState&&(i.width=Je.overlay.width*i.scale.x,i.height=Je.overlay.height*i.scale.y,this.player.EditOverlay.updateOverlayScaleDisplay())}else if("rotate"===n){if(tr.copy(er).sub($o),"floorplan"==this.player.mode)var d=this.player.cameraControls.cameras.floorplan,p=5/((d.right-d.left)/d.aspect);else p=5/vr.distanceTo(Yo.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(nr.copy(Er),rr=er.angleTo($o),ir.copy($o).normalize(),or.copy(er).normalize(),rr*=or.cross(ir).dot(Er)<0?1:-1):"XYZE"===t?(nr.copy(tr).cross(Er).normalize(),rr=tr.dot(Yo.copy(nr).cross(this.eye))*p):"X"!==t&&"Y"!==t&&"Z"!==t||(nr.copy(Ko[t]),Yo.copy(Ko[t]),"local"===o&&Yo.applyQuaternion(gr),rr=tr.dot(Yo.cross(Er).normalize())*p),this.rotationSnap&&(rr=Math.round(rr/this.rotationSnap)*this.rotationSnap),this.rotationAngle=rr;var f="local"===o;this.spaceForRotate&&("X"===t&&(f="local"===this.spaceForRotate.x),"Y"===t&&(f="local"===this.spaceForRotate.y),"Z"===t&&(f="local"===this.spaceForRotate.z)),f&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(br),i.quaternion.multiply(Xo.setFromAxisAngle(nr,rr)).normalize()):(nr.applyQuaternion(hr),i.quaternion.copy(Xo.setFromAxisAngle(nr,rr)),i.quaternion.multiply(br).normalize())}this.dispatchEvent(Object.assign(No,{mode:this.mode,state:this.editState,axis:t,angle:rr,deltaAngle:rr-xr})),this.dispatchEvent(_o),this.dispatchEvent(Go),xr=rr}}}},{key:"pointerUp",value:function(e){void 0!==this.object&&(this.dragging&&null!==this.axis&&(zo.mode=this.mode,this.dispatchEvent(zo)),this.dragging=!1,void 0===e.button&&(this.axis=null),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.pointerDragOn=!1,this.player.cameraControls.activeControl.enabled=!0),xr=0)}},{key:"getPointer",value:function(e){if(e){if(document.pointerLockElement)return{x:0,y:0,button:e.button};var t=e.changedTouches?e.changedTouches[0]:e,n=domElement.getBoundingClientRect();return{x:(t.clientX-n.left)/n.width*2-1,y:-(t.clientY-n.top)/n.height*2+1,button:e.button}}console.log("hhahhhahah")}},{key:"onPointerHover",value:function(e){this.enabled&&this.pointerHover(this.player.mouse)}},{key:"onPointerDown",value:function(e){this.enabled&&(this.pointerHover(this.player.mouse),this.pointerDown(this.player.mouse))}},{key:"onPointerMove",value:function(e){this.enabled&&this.dragging&&this.pointerMove(this.player.mouse)}},{key:"onPointerUp",value:function(e){this.enabled&&this.pointerUp(this.player.mouse)}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),n}(),Tr=function(e){f(n,THREE.Object3D);var t=xo(n);function n(e){var i;o(this,n),(i=t.call(this)).type="TransformControlsGizmo",i.options=e,i.player=e.player;var r=new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:Po,fog:!1}),a=new THREE.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1}),s=r.clone();s.opacity=.35;var l=r.clone();l.opacity=.1;var c=r.clone();c.color.set(16711680);var u=r.clone();u.color.set(65280);var h=r.clone();h.color.set(255);var d=r.clone();d.opacity=.75,d.color.set(15790320);var p=d.clone();p.color.set(16776960);var f=d.clone();f.color.set(65535);var m=d.clone();m.color.set(16711935),r.clone().color.set(16776960);var v=a.clone();v.color.set(16711680);var g=a.clone();g.color.set(65280);var A=a.clone();A.color.set(255),a.clone().color.set(65535),a.clone().color.set(16711935);var y=a.clone();y.color.set(16776960);var E=a.clone();E.color.set(7895160),y.clone().opacity=.25;var w=new ko(0,.07,.2,12,1,!1),b=new Io(.125,.125,.125),C=new To;C.setAttribute("position",new Mo([0,0,0,1,0,0],3));var x,I={"x+":[{x:0,y:0,z:0},{x:.5,y:0,z:0}],"x-":[{x:0,y:0,z:0},{x:-.5,y:0,z:0}],"y+":[{x:0,y:0,z:0},{x:0,y:.5,z:0}],"y-":[{x:0,y:0,z:0},{x:0,y:-.5,z:0}],"z+":[{x:0,y:0,z:0},{x:0,y:0,z:.5}],"z-":[{x:0,y:0,z:0},{x:0,y:0,z:-.5}]},T={},B={x:ui.createFatLineMat({lineWidth:3,color:16711680,depthTest:!1,opacity:.9}),y:ui.createFatLineMat({lineWidth:3,color:65280,depthTest:!1,opacity:.9}),z:ui.createFatLineMat({lineWidth:3,color:255,depthTest:!1,opacity:.9})},k=function(e,t){var n=I[e],i=B[t],o=ui.createFatLine(n,{material:i});return T[e]=o.geometry,o.renderOrder=4,o},P=function(e,t){for(var n=new To,i=[],o=0;o<=64*t;++o)i.push(0,Math.cos(o/32*Math.PI)*e,Math.sin(o/32*Math.PI)*e);return n.setAttribute("position",new Mo(i,3)),n},R={X:[[new Fo(w,c),[.5,0,0],[0,0,-Math.PI/2],null,"fwd"],[k("x+","x")]],Y:[[new Fo(w,u),[0,.5,0],null,null,"fwd"],[k("y+","y")]],Z:[[new Fo(w,h),[0,0,.5],[Math.PI/2,0,0],null,"fwd"],[k("z+","z")]]},M={X:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]]},S={START:[[new Fo(new Qo(.01,2),l),null,null,null,"helper"]],END:[[new Fo(new Qo(.01,2),l),null,null,null,"helper"]],DELTA:[[new So((x=new To,x.setAttribute("position",new Mo([0,0,0,1,1,1],3)),x),l),null,null,null,"helper"]],X:[[new So(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new So(C,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new So(C,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};i.updateRotate=function(){var t={X:[[new So(P(1,.5),v)],[new Fo(new Qo(.04,0),c),[0,0,.99],null,[1,3,1]]],Y:[[new So(P(1,.5),g),null,[0,0,-Math.PI/2]],[new Fo(new Qo(.04,0),u),[0,0,.99],null,[3,1,1]]],Z:[[new So(P(1,.5),A),null,[0,Math.PI/2,0]],[new Fo(new Qo(.04,0),h),[.99,0,0],null,[1,3,1]]],XYZE:[[new So(P(1,1),E),null,[0,Math.PI/2,0]]]},n={AXIS:[[new So(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},i={X:[[new Fo(new qo(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Fo(new qo(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Fo(new qo(1,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]]};return e.rotateAxis&&(e.rotateAxis.indexOf("x")<0&&(delete t.X,delete t.XYZE,delete i.X),e.rotateAxis.indexOf("y")<0&&(delete t.Y,delete t.XYZE,delete i.Y),e.rotateAxis.indexOf("z")<0&&(delete t.Z,delete t.XYZE,delete i.Z)),{gizmo:t,picker:i,helper:n}},i.updateScale=function(){var t={X:[[new Fo(b,c),[.5,0,0],[0,0,-Math.PI/2]],[k("x-","x")]],Y:[[new Fo(b,u),[0,.5,0]],[k("y-","y")]],Z:[[new Fo(b,h),[0,0,.5],[Math.PI/2,0,0]],[k("z-","z"),null,[0,-Math.PI/2,0],[.5,1,1]]],XY:[[new Fo(b,p),[.5,.5,0]]],YZ:[[new Fo(b,f),[0,.5,.5]]],XZ:[[new Fo(b,m),[.5,0,.5]]],XYZX:[[new Fo(new Io(.125,.125,.125),d.clone()),[.5,.5,.5]]]},n={X:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Fo(new ko(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]],XY:[[new Fo(b,s),[.5,.5,0]]],YZ:[[new Fo(b,s),[0,.5,.5]]],XZ:[[new Fo(b,s),[.5,0,.5]]],XYZX:[[new Fo(new Io(.2,.2,.2),s),[.5,.5,.5]]]};return e.scaleAxis&&(e.scaleAxis.indexOf("z")<0&&(delete t.Z,delete t.YZ,delete t.XZ,delete t.XYZX,delete n.Z,delete n.YZ,delete n.XZ,delete n.XYZX),e.scaleAxis.indexOf("x")>-1&&e.scaleAxis.indexOf("y")>-1&&e.scaleAxis.indexOf("z")>-1&&(delete t.XY,delete t.YZ,delete t.XZ,delete n.XY,delete n.YZ,delete n.XZ)),{gizmo:t,picker:n,helper:{X:[[new So(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new So(C,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new So(C,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]}}},i.setupGizmo=function(e){var t=new Ho;for(var n in e)for(var i=e[n].length;i--;){var o=e[n][i][0],r=e[n][i][1],a=e[n][i][2],s=e[n][i][3],l=e[n][i][4];if("Fatline"!=o.type&&(o=o.clone()),o.name=n,o.tag=l,r&&o.position.set(r[0],r[1],r[2]),a&&o.rotation.set(a[0],a[1],a[2]),s&&o.scale.set(s[0],s[1],s[2]),o.updateMatrix(),o.geometry.clone()){var c=o.geometry.clone();c.applyMatrix4(o.matrix),o.geometry=c}else o.geometry.applyMatrix4(o.matrix);o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),t.add(o)}return t};var D=new THREE.Vector3(0,0,0),F=new Ro,L=new THREE.Vector3(0,1,0),H=new THREE.Vector3(0,0,0),Q=new Do,O=new Vo,V=new Vo,_=new Vo,U=new THREE.Vector3(1,0,0),N=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,0,1);return i.gizmo={},i.picker={},i.helper={},i.add(i.gizmo.translate=i.setupGizmo(R)),i.add(i.gizmo.rotate=i.setupGizmo(i.updateRotate().gizmo)),i.add(i.gizmo.scale=i.setupGizmo(i.updateScale().gizmo)),i.add(i.picker.translate=i.setupGizmo(M)),i.add(i.picker.rotate=i.setupGizmo(i.updateRotate().picker)),i.add(i.picker.scale=i.setupGizmo(i.updateScale().picker)),i.add(i.helper.translate=i.setupGizmo(S)),i.add(i.helper.rotate=i.setupGizmo(i.updateRotate().helper)),i.add(i.helper.scale=i.setupGizmo(i.updateScale().helper)),i.picker.translate.visible=!1,i.picker.rotate.visible=!1,i.picker.scale.visible=!1,i.updateMatrixWorld=function(){var t=this.space;"scale"===this.mode&&(t="local");var n="local"===t?this.worldQuaternion:_;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var i=[];i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);var o=this.worldPosition.distanceTo(this.cameraPosition);if("transitioning"!=this.player.mode||"floorplan"!=this.player.modeTran.split("-")[0]&&"floorplan"!=this.player.modeTran.split("-")[1]){if("floorplan"==this.player.mode){o=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect}}else{var r,a=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect;o=Math.min(o,a)}for(var s=o*this.size/7,l=0;l<i.length;l++){var c=i[l];if(c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition),c.scale.set(1,1,1).multiplyScalar(s),"helper"!==c.tag){if(c.quaternion.copy(n),"translate"===this.mode||"scale"===this.mode){var u=.99;e.dontHideWhenFaceCamera||("X"!==c.name&&"XYZX"!==c.name||Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"Y"!==c.name&&"XYZY"!==c.name||Math.abs(L.copy(N).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"Z"!==c.name&&"XYZZ"!==c.name||Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XY"===c.name&&Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"YZ"===c.name&&Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XZ"===c.name&&Math.abs(L.copy(N).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1));var h=!1;L.copy(z).applyQuaternion(n).dot(this.eye)<0&&(h=!0),-1!==c.name.search("X")&&(L.copy(U).applyQuaternion(n).dot(this.eye)<0?("Fatline"==c.type?c.geometry=T["x-"]:c.scale.x*=-1,"world"==this.space?c.position.add(new THREE.Vector3(-.1,0,0)):this.parent.object&&c.position.add(new THREE.Vector3(-Math.abs(this.parent.object.width||.1)/2,0,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion))):("Fatline"==c.type&&(c.geometry=T["x+"]),"world"==this.space?c.position.add(new THREE.Vector3(.1,0,0)):this.parent.object&&c.position.add(new THREE.Vector3(Math.abs(this.parent.object.width||.1)/2,0,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion)))),-1!==c.name.search("Y")&&(L.copy(N).applyQuaternion(n).dot(this.eye)<0?("Fatline"==c.type?c.geometry=T["y-"]:c.scale.y*=-1,"world"==this.space?c.position.add(new THREE.Vector3(0,-.1,0)):this.parent.object&&c.position.add(new THREE.Vector3(0,-Math.abs(this.parent.object.height||.1)/2,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion))):("Fatline"==c.type&&(c.geometry=T["y+"]),"world"==this.space?c.position.add(new THREE.Vector3(0,.1,0)):this.parent.object&&c.position.add(new THREE.Vector3(0,Math.abs(this.parent.object.height||.1)/2,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion)))),-1!==c.name.search("Z")&&(h?("Fatline"==c.type?c.geometry=T["z-"]:c.scale.z*=-1,"world"==this.space&&c.position.add(new THREE.Vector3(0,0,-.1))):("Fatline"==c.type&&(c.geometry=T["z+"]),"world"==this.space?c.position.add(new THREE.Vector3(0,0,.1)):this.parent.object&&c.position.add(new THREE.Vector3(0,0,this.parent.object.depth||0).applyQuaternion(c.quaternion))))}else"rotate"===this.mode&&(V.copy(n),L.copy(this.eye).applyQuaternion(O.copy(n).invert()),-1!==c.name.search("E")&&c.quaternion.setFromRotationMatrix(Q.lookAt(this.eye,H,N)),"X"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.x?this.worldQuaternion:_,V.copy(n),L.copy(this.eye).applyQuaternion(O.copy(n).invert())),O.setFromAxisAngle(U,Math.atan2(-L.y,L.z)),O.multiplyQuaternions(V,O),c.quaternion.copy(O)),"Y"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.y?this.worldQuaternion:_,V.copy(n),L.copy(this.eye).applyQuaternion(O.copy(n).invert())),O.setFromAxisAngle(N,Math.atan2(L.x,L.z)),O.multiplyQuaternions(V,O),c.quaternion.copy(O)),"Z"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.z?this.worldQuaternion:_,V.copy(n),L.copy(this.eye).applyQuaternion(O.copy(n).invert())),O.setFromAxisAngle(z,Math.atan2(L.y,L.x)),O.multiplyQuaternions(V,O),c.quaternion.copy(O)));c.visible=c.visible&&(-1===c.name.indexOf("X")||this.showX),c.visible=c.visible&&(-1===c.name.indexOf("Y")||this.showY),c.visible=c.visible&&(-1===c.name.indexOf("Z")||this.showZ),c.visible=c.visible&&(-1===c.name.indexOf("E")||this.showX&&this.showY&&this.showZ),c.material._opacity=c.material._opacity||c.material.opacity,c.material._color=c.material._color||c.material.color.clone(),c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled?this.axis&&(c.name===this.axis||this.axis.split("").some((function(e){return c.name===e}))?(c.material.opacity=1,c.material.color.lerp(new Bo(1,1,1),.5)):(c.material.opacity*=.25,c.material.color.lerp(new Bo(1,1,1),.5))):(c.material.opacity*=.5,c.material.color.lerp(new Bo(1,1,1),.5))}else c.visible=!1,"AXIS"===c.name?(c.position.copy(this.worldPositionStart),c.visible=!!this.axis,"X"===this.axis&&(O.setFromEuler(F.set(0,0,0)),c.quaternion.copy(n).multiply(O),Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Y"===this.axis&&(O.setFromEuler(F.set(0,0,Math.PI/2)),c.quaternion.copy(n).multiply(O),Math.abs(L.copy(N).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Z"===this.axis&&(O.setFromEuler(F.set(0,Math.PI/2,0)),c.quaternion.copy(n).multiply(O),Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"XYZE"===this.axis&&(O.setFromEuler(F.set(0,Math.PI/2,0)),L.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(Q.lookAt(H,L,N)),c.quaternion.multiply(O),c.visible=this.dragging),"E"===this.axis&&(c.visible=!1)):"START"===c.name?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):"END"===c.name?(c.position.copy(this.worldPosition),c.visible=this.dragging):"DELTA"===c.name?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),D.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),D.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(D),c.visible=this.dragging):(c.quaternion.copy(n),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=-1!==this.axis.search(c.name)))}Ho.prototype.updateMatrixWorld.call(this)},i}return n}(),Br=new THREE.Vector3(1,0,0),kr=new THREE.Vector3(0,1,0),Pr=new THREE.Vector3(0,0,1),Rr=new THREE.Vector3,Mr=new THREE.Vector3,Sr=new THREE.Vector3,Dr=new THREE.Matrix4,Fr=new THREE.Quaternion,Lr=(Br=new THREE.Vector3(1,0,0),kr=new THREE.Vector3(0,1,0),Pr=new THREE.Vector3(0,0,1),Rr=new THREE.Vector3,Mr=new THREE.Vector3,Sr=new THREE.Vector3,Dr=new THREE.Matrix4,Fr=new THREE.Quaternion,function(e){f(n,THREE.Mesh);var t=xo(n);function n(e){var i;return o(this,n),(i=t.call(this,new Oo(1e4,1e4,2,2),new Lo({color:"#ff0000",visible:!1,wireframe:!1,side:Po,transparent:!0,opacity:.6}))).type="TransformControlsPlane",i}return u(n,[{key:"updateMatrixWorld",value:function(){var e=this.space;switch(this.parent.intersect?this.position.copy(this.parent.intersect.position):this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),Br.set(1,0,0).applyQuaternion("local"===e?this.worldQuaternion:Fr),kr.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:Fr),Pr.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:Fr),Sr.copy(kr),this.mode){case"translate":case"scale":switch(this.axis){case"X":Sr.copy(this.eye).cross(Br),Mr.copy(Br).cross(Sr);break;case"Y":Sr.copy(this.eye).cross(kr),Mr.copy(kr).cross(Sr);break;case"Z":Sr.copy(this.eye).cross(Pr),Mr.copy(Pr).cross(Sr);break;case"XY":Mr.copy(Pr);break;case"YZ":Mr.copy(Br);break;case"XZ":Sr.copy(Pr),Mr.copy(kr);break;case"XYZ":case"E":default:Mr.set(0,0,0)}break;case"rotate":default:Mr.set(0,0,0)}0===Mr.length()?this.quaternion.copy(this.cameraQuaternion):(Dr.lookAt(Rr.set(0,0,0),Mr,Sr),this.quaternion.setFromRotationMatrix(Dr)),Ho.prototype.updateMatrixWorld.call(this)}}]),n}()),Hr="move",Qr="rotate",Or="zoom",Vr="endRotation",_r="moveModel",Ur="mode.changed",Nr="mode.changing",zr="pano.chosen",Gr="closest.pano.changing",jr="flyin.finished",Wr="flying.started",qr="flying.ended",Jr="ready",Yr="start.inside",Zr="start.outside",Xr="view.changed",Kr="warp.interrupted.flyto",$r="input.start";new THREE.TextureLoader;var ea=new THREE.PlaneBufferGeometry(1,1),ta=function(){function e(t){o(this,e),this.app=t,this.config=this.app.config,this.show=!0,this.done=0,this.ready=!1,this.center=new THREE.Vector3,this.deferred=vt()}return u(e,[{key:"getCadInfo",value:function(e){var t=this.app.store.getValue("flooruser").cadInfo;if(t instanceof Array)if(1==this.model.floors.list.length)t=t[0];else{var n=t.find((function(t){return t.subgroup==e}));n||(n=t[e]),t=n}else if(!t)return null;return t}},{key:"changeCadVisible",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null!=t.show&&(this.show=t.show),this.model.floors.forEach((function(t){t.plane?t.plane.visible=!!e:console.warn("还没有创建plane")}))}},{key:"deleteCustomFloorTexture",value:function(e){console.log("deleteCustomFloorTexture!查看是否有问题",e);var t=this.model.floors.index[e];t.plane.visible=!1,t.plane.material.opacity=0,t.plane.material.map=null,t.plane.material.needsUpdate=!0}},{key:"updateCustomFloorTexture",value:function(e,t){console.log("updateCustomFloorTexture!",e),this.floorPlanImgUrls[e]=t,this.updateCadPlane(e)}},{key:"createCustomPlane",value:function(e,t){this.floorPlanImgUrls[e]=t,this.updateCadPlane(e)}},{key:"changeModelOpacity",value:function(){this.model.floors.list.forEach((function(e){return e.setMaterial()}))}},{key:"init",value:function(e){var t=this;this.player=this.app.core.get("Player"),this.model=e;var n=this.app.store.getValue("flooruser");n?this.getCadImgUrl(n):this.app.store.on("flooruser",(function(e){t.getCadImgUrl(e)})),this.player.on(Nr,(function(e,n,i,o){if(n==ht.FLOORPLAN){t.shouldShowPlane=!0,setTimeout((function(){t.shouldShowPlane&&t.showCadPlane()}),Math.min(1e3,o))}else t.shouldShowPlane=!1,t.hideCadPlane(),t.changeModelOpacity("hidePlane")})),this.ready=!0}},{key:"createCadAllPlanes",value:function(e){var t=this;if("image"==e.type)e.floors.forEach((function(e){t.createCustomPlane(e.subgroup,t.app.resource.getUserResourceURL(e.filename))})),this.ready=!0;else{if(!this.app.store.getValue("metadata").floorPlanUser)return this.ready=!0,void this.deferred.resolve();this.model.floors.forEach((function(e){t.createCadPlane(e.floorIndex)}))}}},{key:"createCadPlane",value:function(e){this.updateCadPlane(e)}},{key:"updateCadPlane",value:function(e){var t=this,n=0,i=this.floorPlanImgUrls[e],o=this.model.floors.index[e];if(console.log("开始加载floorplan_".concat(e,".png, imgUrl: ").concat(i)),i){var r=o.deferred=new vt;return n=this.player.modeTran&&"floorplan"==this.player.modeTran.split("-")[1]?1:0,$n.load(i,(function(a){if(a.image&&o.deferred==r){o.cadImg=a.image,o.shouldShowPlane?(a.needsUpdate=!0,console.warn("加载完毕floorplan_".concat(e,".png, ").concat(i))):(a.dispose(),console.error("dispose Tex"),a=null);var s=o.plane;if(s)s.material.map=a,s.material.needsUpdate=!0;else{var l=t.createCadPlaneMaterial(a,n);s=new THREE.Mesh(ea,l),o.shouldShowPlane||(s.visible=!1)}t.model.add(s),o.plane=s,t.setCadPlanePose(s,e),o.deferred=null,r.resolve(!0)}}),(function(n){o.deferred=null,o.imgLoadFailed=!0,r.resolve(!1),t.changeModelOpacity("hidePlane"),console.warn("没有floorplan_".concat(e,".png, ").concat(i))})),o.deferred}this.deleteCadPlane(o),o.imgLoadFailed=!0}},{key:"createCadPlaneMaterial",value:function(e,t){return new THREE.MeshBasicMaterial({map:e,opacity:t,transparent:!0,side:THREE.DoubleSide,depthTest:!1})}},{key:"getCadImgUrl",value:function(e){var t=this;this.floorPlanImgUrls=[],this.app.store.getValue("metadata").floorPlanUser&&this.model.floors.forEach((function(n){var i=n.floorIndex;if("image"==e.type){var o=e.floors.findIndex((function(e){return e.subgroup==i}));-1==o&&(o=i),t.floorPlanImgUrls[i]=t.app.resource.getUserResourceURL(e.floors[o].filename)}else t.floorPlanImgUrls[i]=t.app.resource.getUserResourceURL("floor-cad-".concat(i,".png"))}))}},{key:"setCadPlanePose",value:function(e,t){var n,i=this.model.floors.index[t].boundingBox,o=i.getCenter(this.center),r=i.getSize(new THREE.Vector3);if(e.rotation.x=-Math.PI/2,"image"!=this.app.store.getValue("flooruser").type&&(n=this.getCadInfo(t))&&n.bound){r.x=n.bound.right-n.bound.left,r.z=n.bound.bottom-n.bound.top,o.x=(n.bound.right+n.bound.left)/2,o.z=(n.bound.bottom+n.bound.top)/2;var a=this.app.store.getValue("metadata"),s=parseFloat(a.floorPlanAngle||0);e.rotation.z=s}e.renderOrder=Ve,e.name="floorplanImg",this.adjustModelForPlane(i,t,r,o,!1,n)}},{key:"adjustModelForPlane",value:function(e,t,n,i,o,r){var a=this.model.floors.index[t];if(o)a.plane.position.y=e.max.y+.1;else if(n=n||e.getSize(new THREE.Vector3),i=i||e.getCenter(new THREE.Vector3),r){var s=a.cadImg.width,l=a.cadImg.height,c=a.cadImgRatio=n.x/(s-r.left-r.right),u=c*s,h=c*l;this.width=u,this.height=h;var d=(r.left-r.right)/2*c,p=(r.top-r.bottom)/2*c;a.plane.position.set(i.x-d,e.max.y+.1,i.z-p),a.plane.scale.set(u,h,1)}else a.plane.scale.set(n.x,n.z,1),a.plane.position.copy(i).setY(e.max.y+.1)}},{key:"setVisibleForCadImg",value:function(){var e=this,t=0===this.app.store.getValue("metadata").controls.showBigMap;if(this.show&&!t)return this.ready?void((this.app.TagManager.showTagsVisible||this.app.ViewLinkEdit.markView||this.player.EditOverlay.isAdding||this.player.EditOverlay.editPlane||this.player.GLTFEditor.adding||this.player.GLTFEditor.selecting)&&this.hideCadPlane()):this.deferred.then((function(){return e.showCadPlane()}))}},{key:"showCadPlane",value:function(e){var t=this,n=0===this.app.store.getValue("metadata").controls.showBigMap;null==e&&(e=this.model.currentFloor.floorIndex);var i=this.model.floors.index[e];if(!this.show||n||this.app.TagManager.showTagsVisible||this.app.ViewLinkEdit.markView||this.player.EditOverlay.isAdding||this.player.EditOverlay.editPlane||this.player.GLTFEditor.adding||this.player.GLTFEditor.selecting||this.model.$app.Plugins.EditCAD&&this.model.$app.Plugins.EditCAD.display&&"image"==!this.app.store.getValue("flooruser").type)return i.shouldShowPlane=!1;if(!i.deferred){this.model.floors.list.length>1&&this.hideCadPlane({ignoreFloor:i}),i.shouldShowPlane=!0;var o=i.plane;if(!o&&!i.imgLoadFailed){var r=this.updateCadPlane(e);return r?r.then((function(){i.shouldShowPlane&&t.showCadPlane(e)})):this.changeModelOpacity()}this.changeModelOpacity(),o&&(o.material.opacity=1,o.visible=!0,o.material.map||(o.material.map=new THREE.Texture(i.cadImg),o.material.map.needsUpdate=!0,o.material.needsUpdate=!0))}}},{key:"hideCadPlane",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.ignoreFloor;if(!this.ready)return this.deferred.then((function(){return e.hideCadPlane()}));this.model.floors.forEach((function(e){n!=e&&(e.shouldShowPlane=!1,e.plane&&(e.plane.visible=!1,e.plane.material.map&&(e.plane.material.map.dispose(),e.plane.material.map=null,e.plane.material.needsUpdate=!0)))})),this.changeModelOpacity()}},{key:"displayCadPlane",value:function(e){this.setVisible(e),e?this.showCadPlane():this.hideCadPlane()}},{key:"deleteAllCadPlanes",value:function(){var e=this;this.model.floors.forEach(function(){var t=k(S.mark((function t(n){return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.deleteCadPlane(n);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"deleteCadPlane",value:function(e){e.plane&&(e.plane.geometry.dispose(),e.plane.material.map&&e.plane.material.map.dispose(),e.plane.material.dispose(),this.model.remove(e.plane),e.plane=null),e.cadImg=null,e.imgLoadFailed=!1}},{key:"updateAllCadPlanes",value:function(){var e=this,t=this.app.store.getValue("flooruser");this.getCadImgUrl(t),this.model.floors.forEach((function(t){e.deleteCadPlane(t)}))}},{key:"setModelOpacity",value:function(e){}},{key:"getVisible",value:function(){return this.show}},{key:"setVisible",value:function(e){this.show=e}}]),e}(),na={clampVFOV:function(e,t,n,i){return na.getHFOVFromVFOV(e,n,i)>t?na.getVFOVFromHFOV(t,n,i):e},getHFOVForCamera:function(e,t,n,i){return t||(n=(t=e.aspect)/e.aspect),na.getHFOVFromVFOV(e.fov,t,n,i)},getHFOVFromVFOV:function(e,t,n,i){var o=2*Math.atan(Math.tan(e*$e.RADIANS_PER_DEGREE/2)*(t/n));return i?o:o*$e.DEGREES_PER_RADIAN},getVFOVFromHFOV:function(e,t,n,i){var o=2*Math.atan(Math.tan(e*$e.RADIANS_PER_DEGREE/2)*(n/t));return i?o:o*$e.DEGREES_PER_RADIAN}};function ia(e,t){var n=this;this.sid=e.sid,this.showSid=e.showSid,this.text=e.text||"",this.state=e.state||"active",this.player=t,this.elem=document.createElement("div"),this.elem.className="ruler",this.elem.setAttribute("data-name",""),this.elem.style.display="none",this.elem.innerHTML='\n\t\t<div class="ruler-line">\n\t\t\t<em></em>\n\t\t\t<div class="ruler-label">\n\t\t\t\t<div class="ruler-label-point"></div>\n\t\t\t\t<span class="ruler-label-name">'.concat(this.text,"</span>\n\t\t\t</div>\n\t\t</div>\n\t"),this.setPoints(e.points),this.player.cornerRulers.push(this);var i=0;!function e(){document.querySelector(".widgets-rulers")?document.querySelector(".widgets-rulers").append(n.elem):i++<4&&setTimeout(e,500)}()}ia.prototype.setPoints=function(e){this.points&&this.points[0].equals(e[0])&&this.points[1].equals(e[1])||(this.points=e,this.updateText())},ia.prototype.updateText=function(){this.length=Math.round(100*this.points[0].distanceTo(this.points[1]))/100,this.text="约"+this.length+"米"+(this.showSid?" | "+this.sid:""),this.elem.querySelector(".ruler-label-name").innerText=this.text},ia.prototype.remove=function(){this.elem.remove()},ia.prototype.getCrossPoint=function(e,t){var n,i,o,r=this.player.domElement.clientWidth,a=this.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},ia.prototype.getPosInCrossPoint=function(e,t){var n=this.player.domElement.clientWidth,i=this.player.domElement.clientHeight;return he.getCrossPointAtRect(e,t,n,i,0,0)},ia.prototype.getPosAtSphere=function(e){this.fishPoints=[],this.points.forEach(function(t){var n=tt.getPosAtSphere(t.clone(),e);this.fishPoints.push(n)}.bind(this))};ia.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=tt.getPos2d(i,this.player);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},ia.prototype.update=function(){if("panorama"==this.player.mode&&"active"==this.state){var e=tt.getPos2d(this.points[0],this.player),t=tt.getPos2d(this.points[1],this.player);if(!e.trueSide||!t.trueSide){if(!e.trueSide&&!t.trueSide)return void(this.elem.style.display="none");var n=this.getPosInScreen({point:this.points[0],pos2d:e},{point:this.points[1],pos2d:t},0);if(!n)return void(this.elem.style.display="none");e=n.p1,t=n.p2}var i=e.pos,o=t.pos,r=i.distanceTo(o);if(0!=r){var a=Math.acos((i.x-o.x)/r);a%=360,a*=180/Math.PI;var s=i.clone().sub(o),l=new THREE.Vector3(s.x,s.y,0),c=new THREE.Vector3(1,0,0);a*=l.cross(c).z>0?1:-1;var u=this.elem.querySelector(".ruler-line");u.style.width=r+"px",u.style.left=t.pos.x+"px",u.style.top=t.pos.y+"px",u.style.transform="rotate("+-a+"deg)";var h,d,p=.5,f=this.player.domElement.clientWidth,m=this.player.domElement.clientHeight;if(e.inSight&&t.inSight)h=(i.x+o.x)/2;else{var v,g;v=e.inSight?i.clone():this.getCrossPoint(o,i),g=t.inSight?o.clone():this.getCrossPoint(i,o);var A=v.clone().add(g).multiplyScalar(.5);if(h=A.x,d=A.y,A.x>f||A.x<0||A.y>m||A.y<0)return void(this.elem.style.display="none");if(o.x==i.x){if(o.y==i.y)return void console.warn("pos1和2一样???");p=o.y<i.y?(d-o.y)/(i.y-o.y):(o.y-d)/(o.y-i.y)}else p=o.x<i.x?(h-o.x)/(i.x-o.x):(o.x-h)/(o.x-i.x);if(p<0||p>1)return void(this.elem.style.display="none")}this.elem.style.display="";var y=this.elem.querySelector(".ruler-label");"left"!=this.dir&&h<f/2||"right"==this.dir?y.classList.add("reverse"):y.classList.remove("reverse"),y.style.transform="rotate("+a+"deg)",y.style.left=100*p+"%"}else console.warn("ruler间距为0!")}else this.elem.style.display="none"};var oa,ra="scene-renderer-context-created",aa="after-render",sa=Ce.urlHasValue("pointLabel"),la=sa,ca={backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:50},ua=function(){function e(t){o(this,e),this.app=t,this.roomInfo={},this.rulerVisi=!1,this.version=2,this.cad=null,this.planeNeedAdjust=[],this.appType=null,this.showRulers=sa,this.updateList=[]}return u(e,[{key:"init",value:function(e){if(this.model=e,oa=this.app.core.get("Player"),Object.keys(this.roomInfo).length&&this.roomInfo[Object.keys(this.roomInfo)[0]].rooms.length)return!1;var t=this.app.store.getValue("metadata"),n=this.app.store.getValue("flooruser");return this.initRoomInfo(Ae.CloneJson(n)),t&&t.controls.showScale?(this.showRulers=!0,!0):void 0}},{key:"switchDisplay",value:function(e){this.showRulers=!!e,this.updateRulersVisi()}},{key:"initRoomInfo",value:function(e){var t=this;new THREE.MeshBasicMaterial({transparent:!0,wireframe:!0,opacity:.3,color:"#ff9999",depthTest:!1,side:THREE.DoubleSide});var n=new THREE.Object3D;this.model.add(n),n.visible=!1,this.cad=e,this.initFloorPlan(e);this.app.core.get("SceneRenderer").on(aa,(function(e){oa.lastFrameChanged&&(Ae.intervalTool.isWaiting("updateRulersVisi",(function(){t.updateRulersVisi()}),500),t.updateList.forEach((function(e){e.update()})))}))}},{key:"initFloorPlan",value:function(e){var t=this;Ae.timeMeasuring.addTimeMark("initFloorPlan","start"),e.floors.forEach((function(e,n){var i=oa.model.floors.index[n];if(i){var o=i.boundingBox.min.y,r=i.boundingBox.max.y;for(var a in e.bottom=o,e.top=r,e.points){var s=e.points[a],l=s.parent,c=t.getPos3dFrom2d(s,o),u=t.getPos3dFrom2d(s,r),h={point:s,horizons:[],verti:null};for(var d in h.verti=t.addRuler(c,u,"floor".concat(n,"-p").concat(a,"-verti")),l)if("null"!=d&&e.walls[d]){l[d];var p=e.walls[d].start==a?"end":"start",f=e.walls[d][p],m=t.getHorRuler(a,f,n,o);h.horizons.push(m)}else console.warn("该点有wall == null的walls",s);h.horizons=h.horizons.sort((function(e,t){return e.angle-t.angle})),s.pointRulerInfo=h,sa&&t.addLabel(s,c,i)}}else console.error("没找到floor",e)})),Ae.timeMeasuring.addTimeMark("initFloorPlan","end",!0)}},{key:"getHorRuler",value:function(e,t,n,i){e==t&&console.error("p1Id == p2Id");var o=e.split("Point")[1],r=t.split("Point")[1],a="f".concat(n,"-").concat(o,"-").concat(r,"-hor"),s="f".concat(n,"-").concat(r,"-").concat(o,"-hor"),l=oa.cornerRulers.find((function(e){return e.sid==a}));if(l)return{ruler:l,angle:l.angle};if(l=oa.cornerRulers.find((function(e){return e.sid==s})))return{ruler:l,angle:(l.angle+Math.PI)%(2*Math.PI)};var c=this.cad.floors[n],u=c.points[e],h=c.points[t];return(l=this.addRuler(this.getPos3dFrom2d(u,i),this.getPos3dFrom2d(h,i),a,la)).angle=(new THREE.Vector2).subVectors(h,u).angle(),l.pointIds=[e,t],{ruler:l,angle:l.angle}}},{key:"addRuler",value:function(e,t,n,i){return new ia({sid:n,points:[e,t],state:"unable",showSid:i},oa)}},{key:"addLabel",value:function(e,t,n){var i=new Ki(Object.assign({},ca,{text:e.vectorId.split("Point")[1],player:oa}));i.sprite.material.depthTest=!0;var o=t.clone();o.y+=.2,i.position.copy(o),n.add(i),ca.scale||(ca.scale=he.linearClamp(this.model.size.length(),10,500,.5,7));var r=ca.scale;i.scale.set(r,r,r)}},{key:"getPos3dFrom2d",value:function(e,t){return new THREE.Vector3(e.x,t,-e.y)}},{key:"getPos2dFrom3d",value:function(e){return new THREE.Vector2(e.x,-e.z)}},{key:"isShelter",value:function(e,t,n){var i,o=[t,n],r=[];return t.parent&&r.push.apply(r,H(Object.keys(t.parent))),n.parent&&r.push.apply(r,H(Object.keys(n.parent))),!!Object.values(e.walls).find((function(a){if(!r.some((function(e){return e==a.vectorId}))){var s=[e.points[a.start],e.points[a.end]];return(i=he.isLineIntersect(o,s))?he.closeTo(i.x,t.x,.01)&&he.closeTo(i.y,t.y,.01)||he.closeTo(i.x,n.x,.01)&&he.closeTo(i.y,n.y,.01)?void 0:i:void 0}}))}},{key:"ifPanoSeePoints",value:function(e){var t=this;Ae.timeMeasuring.addTimeMark("ifPanoSeePoints","start");var n=e.getVideoFilter();e.visibleRulerInfos=[];var i=this.getPos2dFrom3d(e.position),o=this.cad.floors[e.floorIndex];if(!o){if(oa.model.floors.index[e.floorIndex]||1!=oa.model.floors.length)return void console.error("ifPanoSeePoints 没找到楼层");o=oa.model.floors.list[0]}var r=o.bottom,a=1/(2*Math.sin(THREE.MathUtils.degToRad(5))),s=THREE.MathUtils.degToRad(5),l=function(l){var c=o.points[l],p=c.pointRulerInfo.horizons,f=(new THREE.Vector2).subVectors(i,c).angle(),m=[];if(p.length>2){var v=p.find((function(e){return e.angle>f}));if(v){var g=p.indexOf(v);m=0==g?[v,p[p.length-1]]:[p[g-1],v]}else m=[p[0],p[p.length-1]]}else m=p;if(i.distanceTo(c)>m.reduce((function(e,t){return e+t.ruler.length}),0)*a)return"continue";var A=t.getPos3dFrom2d(c,r);if(n&&n(A))return sa&&console.log("点在视频区域内",c),"continue";var y=[];if(m.forEach((function(a,s){y[s]={},a.anotherPoint2d=o.points[a.ruler.pointIds.find((function(e){return e!=l}))],a.anotherPoint=t.getPos3dFrom2d(a.anotherPoint2d,r);var u=(new THREE.Vector2).addVectors(a.anotherPoint2d,c).multiplyScalar(.5);return t.isShelter(o,u,i)?(sa&&console.log("isShelter线段中点被遮挡",a.ruler.pointIds,e.id),void(y[s].lineShelter=!0)):n&&n(a.anotherPoint)?(sa&&console.log("端点在视频区域内",a),void(y[s].coverVideo=!0)):n&&e.getVideoFilter("across").apply(void 0,H(a.ruler.points))?(sa&&console.log("线横跨视频区域",a),void(y[s].coverVideo=!0)):(y[s].panoToSidePoint=(new THREE.Vector3).subVectors(a.anotherPoint,e.position).setY(0),void y[s].panoToSidePoint.normalize())})),0==(m=m.filter((function(e,t){return!y[t].coverVideo&&!y[t].lineShelter}))).length)return"continue";y=y.filter((function(e,t){return!e.coverVideo&&!e.lineShelter}));var E=(u=(new THREE.Vector3).subVectors(A,e.position).setY(0)).lengthSq();u.normalize();var w=void 0,b=void 0,C=void 0,x=void 0;if(2==m.length?(h=(new THREE.Vector3).subVectors(A,m[0].anotherPoint).setY(0),d=(new THREE.Vector3).subVectors(A,m[1].anotherPoint).setY(0),u.clone().cross(h).y,u.clone().cross(d).y,(f>=0&&f<m[0].angle||f>m[1].angle&&f<2*Math.PI)&&(m=[m[1],m[0]]),C=y[0].panoToSidePoint,x=y[1].panoToSidePoint):(C=y[0].panoToSidePoint,x=u),b=(new THREE.Vector3).addVectors(C,x).normalize(),w=Math.acos(C.dot(x)),u.dot(b)<0&&(b.negate(),w=2*Math.PI-w),w<s)return sa&&console.log("coverRad过小",l,e.id,w.toFixed(3)),"continue";e.visibleRulerInfos.push({pId:c.vectorId,point:c,neibourHorizons:m,coverRad:w,panoToPoint:u,disSquaredToPano:E,backSide:void 0,midVec:b})};for(var c in o.points){var u,h,d;l(c)}Ae.timeMeasuring.addTimeMark("ifPanoSeePoints","end",!0)}},{key:"updateRulersVisi",value:function(){this.lastShowRulers&&this.lastShowRulers.forEach((function(e){e.state="unable"}));var e=oa.currentPano;if(this.updateList=this.lastShowRulers||[],!this.showRulers||oa.flying||"panorama"!=oa.mode||!e.isAligned()||Je.vrEnabled&&Je.vrSplitScreen)this.lastShowRulers=[];else{e.visibleRulerInfos||this.ifPanoSeePoints(e);var t=oa.getDirection().setY(0).normalize();oa.position;var n=this.getPos2dFrom3d(oa.position),i=na.getHFOVForCamera(oa.cameraControls.activeControl.camera,null,null,!0),o=Ae.sortByScore(e.visibleRulerInfos,[],[function(e){var n=Math.acos(e.midVec.dot(t)),o=Math.min(e.coverRad/2+n,i/2)+Math.min(e.coverRad/2-n,i/2),r=.5*(Math.PI-n),a=5+e.disSquaredToPano/30,s=3*Math.pow(1+o+r,3),l=s/a;return e.logMsg="v ".concat(o,", v2 ").concat(r,", v复合").concat(s,", dis复合 ").concat(a,", "),l}]);if(sa&&console.log(o),o[0]){o[0].item.neibourHorizons.forEach((function(t){return t.ruler.points.forEach((function(t){return t.y=e.floorPosition.y}))})),o[0].item.point.pointRulerInfo.verti.points[0].y=e.floorPosition.y,o[0].item.point.pointRulerInfo.verti.updateText();var r=o[0].item.neibourHorizons.map((function(e){return e.ruler})).concat(o[0].item.point.pointRulerInfo.verti);if(r.forEach((function(e){e.dir=null,e.state="active"})),this.lastShowRulers=r,this.updateList=Ae.getUnionSet(this.updateList,r),2==o[0].item.neibourHorizons.length){var a=n.distanceTo(o[0].item.point),s=o[0].item.neibourHorizons[0].ruler,l=o[0].item.neibourHorizons[1].ruler;s.length<a/2&&(s.dir="left"),l.length<a/2&&(l.dir="right")}}}this.updateList.forEach((function(e){e.update()}))}}]),e}();function ha(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var da,pa=function(e){f(n,THREE.Object3D);var t=ha(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.getArrow(),i.createArrows(),i}return u(n,[{key:"getArrow",value:function(){var e=new THREE.Object3D,t=ui.createLine([new THREE.Vector3,new THREE.Vector3(0,0,6)]),n=new THREE.Mesh(new THREE.BoxGeometry(.1,.1,2));n.position.set(0,0,8);var i=new THREE.Mesh(new THREE.CylinderBufferGeometry(0,.3,.5,12,1,!1));i.position.set(0,0,9.25),i.rotation.set(Math.PI/2,0,0),e.add(n),e.add(t),e.add(i),this.arrowGroup=e}},{key:"createArrows",value:function(){var e=this;new THREE.MeshBasicMaterial({color:"#00d7df",side:2,transparent:!0,opacity:.8,depthWrite:!1});var t={x:"#ea3f3f",y:"#86c215",z:"#3396f8"};["x","y","z"].forEach((function(n){var i=(new THREE.Color).set(t[n]),o=e.arrowGroup.clone();o.children.forEach((function(e){e.material=e.material.clone(),e.material.color.copy(i)}));var r=e.createLabel(n,i);r.position.set(0,0,12.5),o.add(r);var a=e.createLabel("1m",i,20,.4);a.position.set(0,0,1),o.add(a),"y"==n?o.rotation.x=-Math.PI/2:"x"==n&&(o.rotation.y=Math.PI/2),e.add(o)}))}},{key:"createLabel",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:120,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,o=new Ki({backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255*t.r,g:255*t.g,b:255*t.b,a:1},fontsize:n,renderOrder:5,player:this.app.core.get("Player"),text:e,name:"axis"});return o.scale.set(i,i,i),o}}]),n}();function fa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ma=Ce.urlHasValue("highMapColor"),va=be(da=function(e){f(n,THREE.Object3D);var t=fa(n);function n(e){var i;o(this,n),(i=t.call(this)).setupCustomProperties=function(){var e=Je.modelAlpha;Object.defineProperty(this,"alpha",{get:function(){return e},set:function(t){e=t,this.chunks.forEach((function(t){t.material&&t.material.uniforms.modelAlpha&&(t.material.uniforms.modelAlpha.value=e,e?"useModelMap"in t.material.defines||(t.material.defines.useModelMap="",t.material.needsUpdate=!0):"useModelMap"in t.material.defines&&(delete t.material.defines.useModelMap,t.material.needsUpdate=!0))}))}})},i.build=function(){var e=this;this.currentFloor=this.floors.last(),this.floors.build(),this.colliders=this.floors.reduce((function(e,t){return e.concat(t.collider.children)}),[]),this.panos.forEach((function(t){t.build1(),t.on("enter",(function(){t.floor!==e.currentFloor&&e.setFloor(t.floor)}))})),this.panos.forEach((function(e){e.build2()})),this.floors.forEach(function(e){this.boundingBox.union(e.boundingBox)}.bind(this));var t=new THREE.Vector3,n=new THREE.Vector3;this.boundingBox.getSize(t),this.boundingBox.getCenter(n),this.size=t,this.center=n,this.floors.forEach(function(e){nt.info("Floor "+e+": "+e.children.length+" chunks, "+e.panos.length+" panos.")}.bind(this)),this.skybox=new fo(this.boundingBox),this.skybox.matrixWorldNeedsUpdate=!0,this.add(this.skybox),this.skyBoxTight=new fo(this.boundingBox,2),nt.debug("Done building model"),ro.raycastsDone>0&&(nt.warn("raycasts: "+ro.raycastsDone),nt.warn("raycasts skipped: "+ro.raycastsSkipped)),this.floorLogos.createFloorLogo(),this.add(this.floorLogos.firstLogo),this.add(this.floorLogos.secondLogo),Ce.urlHasValue("axis")&&this.add(new pa(this.$app)),setTimeout((function(){e.floorplanCadImg.init(e),e.wallManager.init(e)}),100),this.addHighMapCube();var i=this.$app.core.get("PanoVideoRenderer").videosInfo;if(i){var o=i.parameters;this.updateVideoRenderParameters(o)}if(this.builded=!0,this.dispatchEvent({type:"builded"}),this.texSizeBlock=this.chunks.reduce((function(e,t){var n=t.material.uniforms.map.value;return e+Math.pow(n.image.width/512,2)}),0).toFixed(1),this.$app.config.mobile&&Ce.urlHasValue("vlog")){setInterval((function(){var t=e.getDrawedTexCount().toFixed(1),n=document.querySelector("#app .information .title span");n&&(n.innerText=t+"|"+e.$app.core.get("Player").lowTile)}),1e3);var r=document.querySelector("#app .information .right");r&&r.addEventListener("click",(function(){window.logEnable=!window.logEnable}))}return this.texSizeBlock>40&&setTimeout((function(){var t,n=e.$app.core.get("Player"),i=e.$app.config.mobile?100:60,o=e.texSizeBlock-Math.min(.5*e.texSizeBlock,i),r=[],a={update:function(){if("panorama"!=n.mode||n.flying||n.lastFrameChanged)r.length=0;else{t&&(delete t.material.defines.useModelMap,t.material.needsUpdate=!0,t=null);var i,a=e.getDrawedTexCount();if(a>o)(i=e.chunks.find((function(e){var t=e.material.uniforms.map.value;return t&&t._listeners&&t._listeners.dispose&&t._listeners.dispose.length>0})))&&i.material.uniforms.map.value.dispose();else if(a<o){var s=Ae.sortByScore(e.chunks,[function(e){if(!r.includes(e)){var t=e.material.uniforms.map.value;return t&&!(t._listeners&&t._listeners.dispose&&t._listeners.dispose.length>0)&&Math.pow(t.image.width/512,2)+a<=o}}],[function(t){var i=0;return t.floor==e.currentFloor&&(i+=1),he.isInsideFrustum(t.geometry.boundingBox,n.camera)&&(i+=1),i}]);s.length&&((i=s[0].item).material.defines.useModelMap="",i.material.needsUpdate=!0,t=i,r.push(i))}}}};e.$app.core.get("SceneRenderer").addComponent(a)}),1e3),Promise.resolve(this)},i.toggleAlpha=function(){this.alpha<1?this.alpha=1:this.alpha=0},i.waitForLoad=function(e,t){t()||(this.waitQueue.push({object:e,isLoadedCallback:t}),1===this.waitQueue.length&&this.emit("waiting"))},i.hide=function(){this.floors.hide()},i.show=function(){this.floors.show()},i.floorNames=function(){return this.floors.names()},i.setFloor=function(e,t){this.allFloorsVisible&&this.emit("allfloors.toggled",!1,this.currentFloor),this.allFloorsVisible=!1,this._setFloor(e,t)},i.toggleAllFloors=function(e){this.allFloorsVisible=void 0!==e?e:!this.allFloorsVisible,this.emit("allfloors.toggled",this.allFloorsVisible,this.currentFloor),this._setFloor(this.currentFloor)},i._setFloor=function(e,t){var n=this;t=t||this.mode;var i=this.currentFloor;this.currentFloor=e,this.$app.core.get("Player").mode,t===ht.PANORAMA?this.show():t!==ht.FLOORPLAN&&t!==ht.DOLLHOUSE||this.floors.list.forEach(function(e,t){var n=e===this.currentFloor||this.allFloorsVisible;e.toggle(n)}.bind(this)),this.emit("floor.changed",this.currentFloor,t,i),setTimeout((function(){return n.$app.core.get("SceneRenderer").update3dTiles({force:!0})}),10)},i.toggleExplode=function(){this.floors.toggleExplodeHorizontal()},i.toggleExplodeUp=function(){this.floors.toggleExplodeVertical()},i.nextFloor=function(e){return this.floors.nextFloor(this.currentFloor,e)},i.addFloor=function(e){this.floors.add(e)},i.getFloorAtPoint=function(e){return this.floors.getFloorAtPoint(e)},i.addTile=function(e,t){this.floors.getOrMakeFloor(e).addTile(t)},i.removeTile=function(e){this.floors.getOrMakeFloor(e.floorIndex).removeTile(e)},i.addChunk=function(e,t){this.floors.getOrMakeFloor(e).addChunk(t)},i.setMode=function(e){var t=this;if(!this.supportedModes[e])throw new BasicException("Mode not supported for this model: "+e);this.mode=e,this.chunks.forEach((function(n){n.setMode(e,t.player.modeTran)}))},i.updateProjectedPanos=function(e){this.projectedPano0&&this.projectedPano1&&(e==this.projectedPano0||e==this.projectedPano1)&&this.setProjectedPanos(this.projectedPano0,this.projectedPano1,!1)},i.setProjectedPanos=function(e,t,n){null!=n||(n=!0),n=!!n,this.projectedPano0=e,this.projectedPano1=t,this.skybox.material.setProjectedPanos(e,t,n),this.chunks.forEach((function(i){i.materialInside.setProjectedPanos(e,t,n)})),this.highMapCube&&this.highMapCube.tiles.forEach((function(i){i.material.setProjectedPanos(e,t,n)}))},i.setSide=function(e){this.floors.forEach((function(t){t.collider.material.side=e}))},i.fadePanoMarkers=function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.mode,r=i.hideVideoFlag,a=this.player.currentPano;if(Je.vrEnabled&&"portrait"!=window.VRScreenType)this.updateVrMarker();else{var s=this.$app.core.get("PanoVideoRenderer").canShowMarker(),l=function(){var e=[],i=[];n.player.model.panos.forEach((function(t){t.hasVideo||t.panoVideo?r||!t.hasNeighbor()||t.floor.hidden||!s?i.push(t):e.push(t):i.push(t)})),n.panos.fadeMarkerOpacity(1,t,[{toOp:0,member:i},{toOp:Je.panorama.markerOpacity,member:e}])};if(0==e)l();else if((o||this.player.mode)==ht.PANORAMA&&a){var c=[],u=[],h=a.getVideoFilter();this.player.model.panos.forEach((function(e){h&&h(e.position)||!(a.seeMarkers.indexOf(e.id)>-1)?u.push(e):c.push(e)})),this.panos.fadeMarkerOpacity(e,t,[{toOp:Je.panorama.markerOpacity,member:c},{toOp:0,member:u}])}else"panorama"!=this.player.modeTran.split("-")[1]&&l()}},i.outsideAllowed=function(){return this.supportedModes[ht.DOLLHOUSE]&&this.supportedModes[ht.FLOORPLAN]},i.getOption=function(e){return{autoload:!1,floors:!0,local:!1,url:e.config.num,urlFiles:"http://www.4dage.com/BigScene7niu/api/player/models/"+e.config.num+"/files",useVisionModelData:!0}},i.getModelMeta=function(e){return{sid:e.config.num,name:"四维时代",status:"viewable",floors:"",metainfo:{allowed_methods:["GET","OPTIONS","HEAD"]},image:"http://7xo6he.com2.z0.glb.qiniucdn.com/images/images1/07.13.2015_16.22.30.jpg",images:[],job:{uuid:"dacf7dfa24ae47fab8fcebfe4dc41ab9"},layers:[]}};var r=i.getOption(e),a=i.getModelMeta(e);return i.$app=e,i.sid=a.sid,i.data=a,i.options=r,i.urls=new gt(i.sid,e),i.outdoorPanoLocations=[],i.floors=new xt(h(i)),i.floorsEnabled=void 0===r.floors||r.floors,i.changingFloor=!1,i.panos=new so(e),i.colliders=[],i.loadPanosPromise=null,i.loadMeshTexturesPromise=null,i.auxDataPromise=null,i.mesh3dTilesLoaded=!1,i.meshTexturesLoaded=!1,i.meshTextures=[],i.mattertags={},i.tagsShown=!1,i.shouldShowMattertags=!1,i.has360Views=!1,i.showingLabels=Je.labels.enabled&&a.player_options.labels,i.supportedModes={},i.supportedModes[ht.PANORAMA]=!0,i.supportedModes[ht.DOLLHOUSE]=!a.player_options||a.player_options.dollhouse&&Ce.valueFromHash("dh",1),i.supportedModes[ht.FLOORPLAN]=!a.player_options||a.player_options.floor_plan&&Ce.valueFromHash("dh",1),i.supportedModes[ht.TRANSITIONING]=!0,i.supportsTiles=!0,i.supportsVR=a.is_vr,i.mode=ht.DOLLHOUSE,i.size=null,i.center=null,i.boundingBox=new THREE.Box3,i.currentFloor=null,i.allFloorsVisible=!0,i.projectedPano0=null,i.projectedPano1=null,i.floorsEnabled&&a.floors&&-1!==a.floors.indexOf(",")&&a.floors.split(",").forEach(function(e,t){this.addFloor(new Floor(this,t,e.trim()))}.bind(h(i))),i.waitQueue=[],i.on("load",function(e){0!==this.waitQueue.length&&(this.waitQueue=this.waitQueue.filter((function(e){return!e.isLoadedCallback()})),0===this.waitQueue.length&&this.emit("waiting-done"))}.bind(h(i))),i.setupCustomProperties(),i.vrMarkers=[],i.floorLogos=new Co(i.$app),i.floorplanCadImg=new ta(i.$app),i.wallManager=new ua(i.$app),i}return u(n,[{key:"chunks",get:function(){var e=[];return this.floors.forEach((function(t){return e.push.apply(e,H(t.chunks))})),e}},{key:"getDrawedTexCount",value:function(){return this.chunks.reduce((function(e,t){var n=t.material.uniforms.map.value;return n?e+(n._listeners&&n._listeners.dispose&&n._listeners.dispose.length>0?Math.pow(n.image.width/512,2):0):e}),0)}},{key:"createTranControl",value:function(e){var t={player:e,dontHideWhenFaceCamera:!0,scaleAxis:["x","y"],NoScaleZ:!0};this.transformControls=new Ir(e.camera,e.domElement,t),this.transformControls.space="local",this.transformControls.setSize(1.2),this.add(this.transformControls),this.transformControls.visible=!1}},{key:"updateVideoTexture",value:function(e){this.skybox&&(this.skybox.material.uniforms.videoTexture.value=e),this.chunks.forEach((function(t){t.materialInside.uniforms.videoTexture.value=e})),this.highMapCube&&this.highMapCube.tiles.forEach((function(t){t.material.uniforms.videoTexture.value=e}))}},{key:"suspendVideoRender",value:function(){this.skybox&&(this.skybox.material.uniforms.videoReady.value=0),this.chunks.forEach((function(e){e.materialInside.uniforms.videoReady.value=0})),this.highMapCube&&this.highMapCube.tiles.forEach((function(e){e.material.uniforms.videoReady.value=0}))}},{key:"resumeVideoRender",value:function(){this.skybox&&(this.skybox.material.uniforms.videoReady.value=1,this.skybox.material.uniforms.progress.value=1),this.chunks.forEach((function(e){e.materialInside.uniforms.videoReady.value=1,e.materialInside.uniforms.progress.value=1})),this.highMapCube&&this.highMapCube.tiles.forEach((function(e){e.material.uniforms.videoReady.value=1,e.material.uniforms.progress.value=1}))}},{key:"updateVideoRenderParameters",value:function(e){var t=[this.skybox.material].concat(H(this.chunks.map((function(e){return e.materialInside}))));this.highMapCube&&this.highMapCube.tiles.forEach((function(e){t.push(e.material)})),t.forEach((function(t){t.uniforms.parameters.value.set(e.inputWidth,e.inputHeight,e.outputWidth,e.outputHeight,e.focal,e.pixel,e.centerX,e.centerY,e.translateX,e.translateY,e.translateZ,0,e.lenOffsetX,e.lenOffsetY,e.videoWidth,e.videoHeight),8==e.cameraType?t.defines.HasVideo=8:2==e.cameraType?t.defines.HasVideo=2:3==e.cameraType&&(t.defines.HasVideo=3),t.defines.VideoMapping=e.mapping,t.needsUpdate=!0}))}},{key:"updateVrMarker",value:function(e){var t=this;if(this.player.currentPano.isAligned()){if(e=null==e?Je.vrEnabled:e)for(var n in this.panos.index){var i=this.panos.index[n];i.isAligned()&&(i.marker.opacity=0)}else this.fadePanoMarkers(null,null);this.vrMarkers.forEach((function(n){n.visible=e&&t.player.currentPano.id!=n.pano.id&&!!t.player.currentPano.neighbourPanos[n.pano.id];//!! 是防止undefined
- }))}}},{key:"addHighMapCube",value:function(){var e=this;if("4k"==this.$app.core.get("QualityManager").tileClass&&2048==this.$app.core.get("QualityManager").maxRenderTargetSize){var t=new THREE.PlaneGeometry(1,1,1,1),n=new THREE.Object3D;n.tiles=[];for(var i=0;i<6;i++){for(var o=new THREE.Object3D,r=0;r<8;r++)for(var a=0;a<8;a++){var s=new THREE.Mesh(t,new ho({side:THREE.DoubleSide,depthTest:!1,transparent:!0,defines:{BasePanoMap:""}}));if(s.material.uniforms.progress.value=1,s.material.uniforms.modelAlpha.value=0,s.position.set(r-3.5,a-3.5,-4),ma){s.material.uniforms.opacity.value=.4;var l=Math.random();s.material.uniforms.baseColor.value=(new THREE.Color).setHSL(l,.8,.9)}s.visible=!1,s.tileX=r,s.tileY=a,s.cubeFace=i,s.renderOrder=Me,n.tiles.push(s),o.add(s)}switch(i){case Ui:o.rotation.set(0,Math.PI/2,0);break;case Ni:o.rotation.set(0,-Math.PI/2,0);break;case zi:var c=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),u=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),Math.PI/2);o.quaternion.copy(c).multiply(u);break;case Gi:c=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),u=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/2);o.quaternion.copy(c).multiply(u);break;case ji:o.rotation.set(0,Math.PI,0);break;case Wi:o.rotation.set(0,0,0)}o.scale.set(1,-1,1),o.cubeFace=i,n.add(o)}n.name="highMapCube",this.highMapCube=n,this.add(n),n.scale.set(.21,.21,.21),this.highMapCube.visible=!1,this.highMapCube.texLoadedCount=0,this.$app.core.get("SceneRenderer").on(aa,(function(t){e.highMapCube.visibleTiles&&e.updateTiles(),e.player&&e.player.lastFrameChanged&&Ae.intervalTool.isWaiting("update4kTiles",(function(){var t=e.player.getDirection();e.updateTiles(t)}),500)}))}}},{key:"isHighMapLoaded",value:function(e,t,n){return!!this.highMapCube.children[e].children[8*t+n].material.uniforms.map.value}},{key:"updateTiles",value:function(e){var t=this;if(this.highMapCube&&this.highMapCube.visible&&!(this.highMapCube.tiles.filter((function(e){return e.image})).length<=10)){if(e){var n=this.player.cameraControls.cameras.panorama,i=na.getHFOVForCamera(n,null,null,!0)/2,o=THREE.MathUtils.degToRad(n.fov)/2,r=this.highMapCube.tiles;r.forEach((function(n){var r=n.getWorldPosition(new THREE.Vector3),a=(new THREE.Vector3).subVectors(r,t.highMapCube.position).normalize(),s=a.clone().setY(e.y).normalize().dot(e),l=Math.acos(s),c=-200;l>i+.08?n.score=-100:(c=Math.abs(Math.acos(a.y)-Math.acos(e.y)),n.score=c>o+.08?-100:-(l/i+c/o)),n.scores=l.toFixed(3)+", "+c.toFixed(3),-100==n.score&&t.resetTile(n)})),this.highMapCube.visibleTiles=r.filter((function(e){return e.score>-100}))}var a=this.highMapCube.visibleTiles.filter((function(e){return!e.material.uniforms.map.value}));if(a.length){var s=Ae.getBestCount({name:"4kmaxTileRecover",minCount:0,maxCount:2,durBound1:1.5,durBound2:6,ifLog:!1,maxHistory:2}),l=0;a.forEach((function(e,n){l>=s||t.recoverTile(e)&&l++}))}}}},{key:"getHighImage",value:function(e,t,n,i){this.highMapCube.children[t].children[8*n+i].image=e}},{key:"updateHighMap",value:function(e,t,n,i){var o=this.highMapCube.children[t].children[8*n+i];e&&(o.image=e);var r=o.material.uniforms;if(!r.map.value&&(!this.highMapCube.visibleTiles||this.highMapCube.visibleTiles.includes(o))){var a=new THREE.Texture;a.image=e,a.flipY=!1,a.wrapS=a.wrapT=THREE.ClampToEdgeWrapping,a.generateMipmaps=!1,a.minFilter=THREE.LinearFilter,a.needsUpdate=!0,r.map.value=a,ma&&(r.opacity.value=1),o.visible=!0,o.material.needsUpdate=!0}}},{key:"recoverTile",value:function(e){if(!e.material.uniforms.map.value)return e.image?(this.updateHighMap(e.image,e.cubeFace,e.tileX,e.tileY),!0):void 0}},{key:"resetTile",value:function(e,t){t&&(e.image=null);var n=e.material.uniforms.map.value;if(n){n.dispose(),n.loaded=!1,n.version=0;var i=this.$app.core.get("SceneRenderer").renderer.properties.get(n);this.$app.core.get("SceneRenderer").renderer.getContext().deleteTexture(i.__webglTexture),e.material.uniforms.map.value=null,ma&&(e.material.uniforms.opacity.value=.4),e.material.needsUpdate=!0,e.visible=!1}}},{key:"resetHighMap",value:function(){var e=this;this.highMapCube&&(this.highMapCube.children.forEach((function(t){return t.children.forEach((function(t){e.resetTile(t,!0)}))})),this.highMapCube.visibleTiles=null,this.hideHighMap())}},{key:"setHighMap",value:function(e){this.highMapCube&&(this.highMapCube.position.copy(e.position),this.highMapCube.quaternion.copy(e.quaternion))}},{key:"showHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!0)}},{key:"hideHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!1)}},{key:"showLowestTile",value:function(e){if(this._3dTilesRuntime){this._3dTilesRuntime.pauseTilesetUpdate(!1);var t=this.$app.core.get("SceneRenderer");t.autoUpdate3dTiles=!e,t.autoUpdate3dTiles&&t.update3dTiles({force:!0}),this._3dTilesRuntime.limit2lowestDepth(e),this._3dTilesRuntime.ingoreVisibleCompute(e),this._3dTilesRuntime.pauseTilesetUpdate(e)}}}]),n}())||da;function ga(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Aa=function(e){f(n,EventEmitter);var t=ga(n);function n(e){var i;return o(this,n),e=e||{},(i=t.call(this)).position=new THREE.Vector3,i.quaternion=new THREE.Quaternion,i.update(e),i}return u(n,[{key:"isValid",value:function(){return!!this.cameraMode}},{key:"update",value:function(e){return this.cameraMode=e.cameraMode||this.cameraMode,this.pano=e.pano||this.pano,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion),this}}]),n}();function ya(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ea=function(e){f(n,THREE.Mesh);var t=ya(n);function n(e){var i;o(this,n),i=t.call(this);var r=THREE.UniformsUtils.clone(sn.waypoint.uniforms);return r.map.value=Ae.loadTextureFromCache($n.getImageURL("images/blueReticle.png")),r.map.value.minFilter=THREE.LinearMipMapLinearFilter,r.map.value.anisotropy=4,r.opacity.value=0,(i=t.call(this,new THREE.PlaneBufferGeometry(.4,.4,1,1),new THREE.RawShaderMaterial({side:THREE.DoubleSide,depthWrite:!1,depthTest:!1,transparent:!0,vertexShader:sn.waypoint.vertexShader,fragmentShader:sn.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0}))).layers.set(Pt),i.renderOrder=Le,i.player=e,i.direction=new THREE.Vector3,i.hidden=!0,i.mouseLastMoveTime=Date.now(),i}return u(n,[{key:"move",value:function(e,t,n){this.hidden=n,this.mouseLastMoveTime=Date.now()}},{key:"hide",value:function(){this.hidden||(this.hidden=!0,pe.start(It.property(this.material.uniforms.opacity,"value",0),Je.reticuleOpacityTransitionTime))}},{key:"show",value:function(){this.hidden=!1,this.material.opacity<=0&&pe.start(It.property(this.material.uniforms.opacity,"value",Je[this.player.mode].reticuleOpacity),Je.reticuleOpacityTransitionTime)}},{key:"update",value:function(){Date.now()-this.mouseLastMoveTime>Je.hideReticuleTimeout&&!this.hidden&&this.hide()}},{key:"updatePosition",value:function(e,t){if(!this.hidden){if(!t)return this.hide();var n=t.point,i=e.distanceTo(n),o=1+.01*i;i<1&&(o-=1-i),this.show(),this.scale.set(o,o,o),this.direction=this.direction.multiplyScalar(.8),this.direction.add(t.face.normal.clone().multiplyScalar(.2)),this.position.copy(n).add(t.face.normal.clone().multiplyScalar(.01)),this.lookAt(this.position.clone().add(this.direction))}}}]),n}(),wa="move",ba="interaction.direct",Ca="interaction.key",xa="input.start",Ia="input.pinch",Ta="input.scroll",Ba="autopan.interrupt",ka="autopan.complete",Pa="autopan.clamped",Ra="longtap",Ma=Object.freeze({None:0,Queued:1,ForceQueued:2,Downloading:3,Downloaded:4,DownloadFailed:5}),Sa=Object.freeze({None:0,DirectionalFOV:1}),Da=function(){var e=function e(t,n){var i=e._panoSpaceDir,o=e._fovThreshold,r=e._fovThresholdNarrow,a=Math.max(Math.min(i.dot(t.direction),1),-1),s=Math.max(Math.min(i.dot(n.direction),1),-1);return t._dot=a,n._dot=s,a>=o&&s<o?-1:a<o&&s>=o?1:a>=r&&s<r?-1:a<r&&s>=r||t.panoSize>n.panoSize?1:n.panoSize>t.panoSize?-1:-(a-s)};return e._panoSpaceDir=new THREE.Vector3,e._fovThreshold=-1,e._fovThresholdNarrow=-1,e}(),Fa=function(){function e(t,n,i,r,a){o(this,e),this.filterAndPrioritize=function(){var t=[],n=[],i=[];return function(o,r,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;"360view"!=this.priorityCriteria.pano.panoType&&(this.populateNeighborPanos(this.priorityCriteria.pano,r,t),this.populateScoredPanos(this.priorityCriteria.pano,r,n,this.priorityCriteria.cameraDir,e.MAX_SCORED_PANOS_TOCONSIDER));var l=this.baseSize,c=this.standardSize,u=this.highSize,h=this.ultraHighSize;this.queueTilesForPano(o,a,this.priorityCriteria.pano,l),this.priorityCriteria.upcomingPanos&&this.queueTilesForPanos(o,this.priorityCriteria.upcomingPanos,a,l,e.MAX_UPCOMING_PANOS_TOADD),i.length=0,this.canDownloadSize(c)&&o.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),this.queueTilesForPanos(o,n,a,l,e.MAX_SCORED_PANOS_TOADD),i.length=0,o.length<s&&(this.canDownloadSize(u)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),this.canDownloadSize(h)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,h,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),i.length=0),o.length<s&&(this.canDownloadSize(c)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(u)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(h)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,h,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i)),this.queueTilesForPanos(o,t,a,l)}}(),this.queueTilesForPano=function(){var e={filter:Sa.None};return function(t,n,i,o){if(i.tiled)return this.filterAndQueueTileDownloadDescriptors(t,n,i,o,e)}}(),this.queueTilesForPanosInDirection=function(){var e=new THREE.Vector3;return function(t,n,i,o,r,a,s,l){for(var u=0,h=0;h<i.length;h++){var d=i[h];if(e.copy(d.position),e.sub(r),e.normalize(),Math.max(Math.min(a.dot(e),1),-1)>=c.getFOVDotThreshold(s))if(u+=this.queueTilesInDirectionForPano(t,n,d,o,r,a,s)>0?1:0,l&&u>=l)break}return u}}(),this.queueTilesInDirectionForPano=function(){var e={filter:Sa.DirectionalFOV,direction:new THREE.Vector3,fov:60},t=new THREE.Vector3;return function(n,i,o,r,a,s,l){if(o.tiled)return t.copy(s),qi.getRelativeDirection(o.quaternion,t),e.direction.copy(t),e.fov=l,this.filterAndQueueTileDownloadDescriptors(n,i,o,r,e)}}(),this.filterAndQueueTileDownloadDescriptors=function(){var e=[];return function(t,n,i,o,r){var a=n.getTileDownloadDescriptors(i,o);e.length=0,this.filterTileDownloadDescriptors(i,a,e,r);for(var s=0,l=0;l<e.length;l++){var c=e[l];c&&(t.push(c),s++)}return s}}(),this.filterTileDownloadDescriptors=(new THREE.Vector3,function(e,t,n,i){var o,r;switch(i.filter){case Sa.DirectionalFOV:for(o=0;o<t.length;o++)r=t[o],qi.isTileWithinFOV(r.panoSize,r.tileSize,r.face,r.tileX,r.tileY,i.direction,i.fov)&&n.push(r);break;default:for(o=0;o<t.length;o++)r=t[o],n.push(r)}for(o=0;o<n.length;o++)r=n[o],this.canIncludeDescriptor(r)||(n[o]=null)}),this.qualityManager=t,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize(),this.baseSize=n,this.standardSize=i,this.highSize=r,this.ultraHighSize=a,this.priorityCriteria=new e.PriorityCriteria(null,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,0,-1))}return u(e,[{key:"updateCriteria",value:function(e,t,n,i){this.priorityCriteria.pano=e,this.priorityCriteria.cameraPosition.copy(t),this.priorityCriteria.cameraDir.copy(n),this.priorityCriteria.upcomingPanos=i,this.maxNavQuality=this.qualityManager.limitQuality&&e.curTileQuality?e.curTileQuality:this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize()}},{key:"canDownloadSize",value:function(e){return this.maxNavQuality>=e||this.maxZoomQuality>=e&&this.zoomingActive}},{key:"populateNeighborPanos",value:function(e,t,n){(n=n||[]).length=0;var i=t.getNeighbours(e);for(var o in i)if(i.hasOwnProperty(o)){var r=t.get(o);n.push(r)}return n}},{key:"populateScoredPanos",value:function(t,n,i,o,r){(i=i||[]).length=0;var a=[ro.filters.inPanoDirection(t.position,o,e.DIRECTION_SCORE_STRICTNESS),ro.filters.not(t)],s=[ro.scoreFunctions.distanceSquared(t),ro.scoreFunctions.direction(t.position,o)],l=Ae.sortByScore(n.list,a,s);if(l)for(var c=0;c<l.length&&c<r;c++){var u=l[c].item;i.push(u)}return i}},{key:"queueTilesForPanos",value:function(e,t,n,i,o){for(var r=0,a=0;a<t.length;a++){var s=t[a];if(r+=this.queueTilesForPano(e,n,s,i)>0?1:0,o&&r>=o)break}return r}},{key:"queueTilesInDirectionForPanos",value:function(e,t,n,i,o,r,a,s){for(var l=0,c=0;c<n.length;c++){var u=n[c];if(l+=this.queueTilesInDirectionForPano(e,t,u,i,r,a)>0?1:0,s&&l>=s)break}return l}},{key:"canIncludeDescriptor",value:function(e){return e.status!==Ma.Downloading&&e.status!==Ma.Downloaded}},{key:"canIncludePano",value:function(e,t){return!e.isLoaded(t)}},{key:"setZoomingActive",value:function(e){e!==this.zoomingActive&&(this.zoomingActive=e)}}],[{key:"PriorityCriteria",value:function(e,t,n,i,o){this.pano=e,this.cameraPosition=(new THREE.Vector3).copy(t),this.cameraDir=(new THREE.Vector3).copy(n),this.panoSpaceDir=(new THREE.Vector3).copy(i),this.upcomingPanos=o,this.copy=function(e){this.pano=e.pano,this.cameraPosition.copy(e.cameraPosition),this.cameraDir.copy(e.cameraDir),this.panoSpaceDir.copy(e.panoSpaceDir),this.upcomingPanos=o},this.zoomingActive=!1}},{key:"appendQueue",value:function(e,t){if(e&&t)for(var n=0;n<t.length;n++)e.push(t[n])}},{key:"getFOVDotThreshold",value:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))}},{key:"sortPanoTiles",value:function(t,n,i){Da._panoSpaceDir.copy(i),qi.getRelativeDirection(n.quaternion,Da._panoSpaceDir),Da._fovThresholdNarrow=he.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Da._fovThreshold=he.getFOVDotThreshold(e.DIRECTIONAL_FOV),t.sort(Da)}},{key:"insertSortedPanoTile",value:function(t,n,i,o){Da._panoSpaceDir.copy(o),qi.getRelativeDirection(i.quaternion,Da._panoSpaceDir),Da._fovThresholdNarrow=he.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Da._fovThreshold=he.getFOVDotThreshold(e.DIRECTIONAL_FOV);for(var r=-1,a=0;a<t.length;a++){if(Da(n,t[a])<=0){r=a;break}}if(-1===r)t[t.length]=n;else{for(var s=t.length;s>r;s--)t[s]=t[s-1];t[r]=n}}}]),e}();Fa.DIRECTIONAL_FOV=180,Fa.DIRECTIONAL_FOV_NARROW=120,Fa.MAX_SCORED_PANOS_TOCONSIDER=6,Fa.MAX_SCORED_PANOS_TOADD=2,Fa.MAX_UPCOMING_PANOS_TOADD=3,Fa.DIRECTION_SCORE_STRICTNESS=.75;var La={ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,LEFTARROW:37,UPARROW:38,RIGHTARROW:39,DOWNARROW:40,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,SPACE:32,RETURN:13,SEMICOLON:186,PLUSEQUALS:187,DASHUNDERSCORE:189,OPENBRACKET:219};Ce.detectFirefox()&&(La.SEMICOLON=59,La.PLUSEQUALS=61,La.DASHUNDERSCORE=173);var Ha="model-added",Qa="active-model-changed";function Oa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Va=function(e){f(n,e);var t=Oa(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).panoId=e.panoId,i.orthoZoom=e.orthoZoom,i.floorVisibility=e.floorVisibility,i.thumbUrl=e.thumbUrl,i.name=e.name,i}return u(n,[{key:"isPano",value:function(){return this.panoId&&""!==this.panoId}}]),n}(Aa),_a=function(){function e(t,n,i){o(this,e),this.flightStepWalk=function(e,t,n){var i=new THREE.Vector3,o=new THREE.Vector3,r=function(e,t){var n=Math.min(this.player.position.distanceTo(e.position),Je.transition.flytimeMaxDistanceThreshold)*Je.transition.flytimeDistanceMultiplier+Je.transition.flyTime;o.copy($i.FORWARD),this.player.getDirection(o),i.copy(t).sub(e.position).normalize();var r=i.dot(o),a=Math.acos(r),s=a/n;return s>.001&&(n*=s/.001,a<1&&(n*=1.2)),n};return function(e,t,n){if(this.warpInterrupted)n&&n();else if(this.activeTransType!==l.WALK)this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),n&&n();else if(this.player.currentPano!==e){var i={pano:e,lookAtPoint:t,duration:null,maxDistanceOverride:Je.warp.walkMaxDist,skipWarpingCheck:!1,constantMoveSpeed:!0};i.duration=r.call(this,e,t),this.player.nonInterruptingFlyToPano(i,n)}else n&&n()}}(),this.warpTravel_WALK=function(){var e=[];return function(t){var n=this.player.model.panos;e.length=0;for(var i=null,o=!1,r=0;r<this.nodes.length;r++){var a=this.nodes[r],s=n.get(a);this.nodes.length,o=i&&s.position.distanceTo(i.position)<Je.warp.walkMinDist,i&&o||(e.push(a),i=s)}o&&this.nodes.length>1&&(e[e.length-1]=this.nodes[this.nodes.length-1]);var l=e.length,c=n.get(e[l-1]),u=new Array(l+1);u[u.length-1]=function(){t&&t()}.bind(this);for(var h=l-1,d=u.length-1;d>0;d-=1){var p=e[h];c=n.get(p);var f=new THREE.Vector3;this.getLookAtForWalkingTourNode(e,h,f),u[d-1]=this.makeWalkFlightFunc(c,f,u[d]),h--}u[0]()}}(),this.getLookAtForWalkingTourNode=function(){var e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3;return function(r,a,s){var l=r.length;if(a>=l)return!1;var c=1,u=1;t.set(0,0,0),o.set(0,0,0);for(var h=null,d=a;d<a+3&&!(d>=l);d++){if(h=this.player.model.panos.get(r[d]),this.getOrientationForWalkingTourNode(r,d,n),d===a&&e.copy(n),i.copy(n),d>a){var p=i.dot(e)<.65;c*=p?.2:.75,u*=p?.2:.4}n.multiplyScalar(c),t.add(n),o.lerp(h.position,u)}return t.normalize(),s.copy(o),s.add(t),!0}}(),this.obj3d=null,this.nodes=[],this.colorHull=[],this.shortPaths={},this.floorHull=null,this.cameraHull=null,this.floorPathDistance=0,this.floorCurvePoints=null,this.floorCurveColors=null,this.camCurvePoints=null,this.warpDestHeroLoc=null,this.warpDestPano=null,this.warpPathPoints=null,this.warpPathLengths=[0],this.warpLength=0,this.closeWarpDistance=4,this.UP=$i.UP.clone(),this.longestStep=0,this.upcomingTransType=null,this.burnsDir=1,this.prevNextDist=0,this.nextI=0,this.activeTransType=null,this.lastTransType=null,this.bunnyObj=null,this.director=t,this.player=n,this.playerControls=i,this.modelManager=n.modelManager,this.updateModel(),this.bindEvents(),this.warping=!1,this.waitingToWarp=!1,this.warpInterrupted=!1,this.warpInterruptionBlackoutStyle=null,this.warpInterruptionTravelTime=null,this.pathImg={},this.brushPrefs={linewidth:7,strokeWidth:15,cvSegments:48,paveStep:.1,paveWidth:.2,lookBlendDist:3,maxTurn:THREE.MathUtils.degToRad(2)},this.hintPrefs={rad:.18,width:.0125,depth:.0625,setBack:-.04,markRad:.25,markInnerRad:.16},this.init()}return u(e,[{key:"init",value:function(){this.pathImg.pathEnd=Ae.loadTextureFromCache($n.getImageURL("images/pathEnd.png"))}},{key:"setScene",value:function(e){this.createCpm(e)}},{key:"updateModel",value:function(){this.model=this.modelManager.getActiveModel()}},{key:"bindEvents",value:function(){this.modelManager.on(Qa,this.updateModel.bind(this))}},{key:"pointPathDistance",value:function(e){for(var t=0,n=1;n<e.length;n+=1)t+=e[n-1].distanceTo(e[n]);return t}},{key:"pointPathLengths",value:function(e){for(var t=[0],n=1;n<e.length;n+=1)t.push(t[n-1]+e[n-1].distanceTo(e[n]));return t}},{key:"interpAlongPath",value:function(e,t,n){var i,o=new THREE.Vector3,r=t[t.length-1];if(n<1){i=n*r;for(var a=1;a<t.length;a+=1)if(t[a]>i){var s=(i-t[a-1])/(t[a]-t[a-1]);return o.copy(e[a]),o.sub(e[a-1]),o.multiplyScalar(s),o.add(e[a-1]),o}}else o.copy(e[e.length-1]);return o}},{key:"pathHeight",value:function(){return Je.path.height}},{key:"createBunnyObj",value:function(e){this.bunnyObj||(this.bunnyObj=new THREE.AxesHelper(.1),this.bunnyObj.visible=Je.warp.showBunny),this.bunnyObj.parent&&this.bunnyObj.parent.remove(this.bunnyObj),e.add(this.bunnyObj)}},{key:"createCpm",value:function(e){if(!this.currentPanoMarker){var t=this.makeWaypointObj(this.pathImg.pathEnd,"Current");t.material.uniforms.opacity.value=0,this.currentPanoMarker={mesh:t,placed:!1}}this.currentPanoMarker.mesh.parent&&this.currentPanoMarker.mesh.parent.remove(this.currentPanoMarker.mesh),this.placeCpm(),this.currentPanoMarker.mesh.parent||e.add(this.currentPanoMarker.mesh)}},{key:"placeCpm",value:function(){if(Je.path.mapGuides&&this.player.currentPano&&this.player.currentPano.isAligned()){var e=this.player.currentPano.floor;this.currentPanoMarker.mesh.parent!==this.player.currentPano.floor&&(this.currentPanoMarker.mesh.parent&&this.currentPanoMarker.mesh.parent.remove(this.currentPanoMarker.mesh),e.add(this.currentPanoMarker.mesh)),this.currentPanoMarker.mesh.position.copy(this.player.currentPano.floorPosition).sub(e.position),this.currentPanoMarker.mesh.position.y+=this.pathHeight(),this.currentPanoMarker.placed=!0}else this.popOutCpm()}},{key:"fadeInCpm",value:function(e){this.player.mode===ht.PANORAMA&&this.player.currentPano&&!this.player.currentPano.isAligned()||Je.path.mapGuides&&this.currentPanoMarker.placed&&pe.start(It.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",1),e)}},{key:"fadeOutCpm",value:function(e){pe.start(It.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",0),e)}},{key:"popInCpm",value:function(){Je.path.mapGuides&&this.currentPanoMarker.placed&&this.fadeInCpm(2)}},{key:"popOutCpm",value:function(){this.fadeOutCpm(2)}},{key:"buildWarpDestinationDescriptor",value:function(e,t,n,i,o,r){return new Va({cameraMode:i,position:e,quaternion:t,panoId:n,orthoZoom:r,floorVisibility:o,thumbUrl:null,name:null})}},{key:"buildWarpDestinationDescriptorFromHero",value:function(e){return this.buildWarpDestinationDescriptor(e.position,e.quaternion,this.getHeroId(e),e.cameraMode,e.floorVisibility,e.orthoZoom)}},{key:"setWarpDestination",value:function(e){this.warpDestHeroLoc=e}},{key:"setWarpDestinationByHeroIndex",value:function(e){var t=this.getHeroDescriptorByHeroIndex(e);return null!==t&&(this.setWarpDestination(t),!0)}},{key:"setWarpDestinationByPano",value:function(e,t){return!!this.model.panos.get(e.id)&&this.setWarpDestinationByPanoId(e.id,t)}},{key:"setWarpDestinationByPanoId",value:function(e,t){var n=this.model.panos.get(e);if(n){t=t||new THREE.Quaternion;var i=this.buildWarpDestinationDescriptor(n.position,t,n.id,"panorama",[],-1);return this.setWarpDestination(i),!0}return!1}},{key:"getHeroDescriptorByHeroIndex",value:function(e){var t=objects.play.heroCount();if(null!==this.warpDestHeroLoc&&t<2)return nt.info("ShowPath.getHeroDescriptorByHeroIndex() -> Only one hero location is available."),this.model.getHeroDescriptorByIndex(0);var n=this.model.getHeroDescriptorByIndex(e);n=util.getPlayDataItem(e),1==objects.store.getters["guide/plays"][e].type&&(n=util.getPlayDataItem(e,0));var i=util.convertHighlight(n),o=new Va(i);if(o){var r=o.isPano()?o.panoId:o.cameraMode;nt.debug('ShowPath.getHeroDescriptorByHeroIndex() -> New brush/warp destination: "'+r+'" out of '+t+" choices.")}return o}},{key:"getHeroDescriptorByPano",value:function(e){return this.model.panos.get(e.id)?this.getHeroDescriptorByPanoId(e.id):null}},{key:"getHeroDescriptorByPanoId",value:function(e){var t=this.getHeroIndexFromPanoId(e);return this.getHeroDescriptorByHeroIndex(t)}},{key:"getHeroIndexFromPanoId",value:function(e){for(var t=0;t<this.model.heroLocations.length;t++){var n=this.model.heroLocations[t],i=this.getHeroId(n);if(i&&i===e)return t}return-1}},{key:"getHeroPano",value:function(e){if(null===e)return nt.warn("getHeroPano(): no destination"),null;var t=this.getHeroId(e),n=this.model.panos.get(t);return void 0===n&&(n=null,""!==t&&nt.debug('unable to find pano "'+t+'"')),n}},{key:"getHeroId",value:function(e){return e.panoId}},{key:"setWarpDestPano",value:function(){return this.warpDestPano=this.getHeroPano(this.warpDestHeroLoc),this.warpDestPano}},{key:"findShortestPath",value:function(e,t){if(!e||!t)return null;var n=Je.warp.walkExtraPanosDistance,i=e.id+":"+t.id+":"+n;if(this.shortPaths.hasOwnProperty(i))return this.shortPaths[i]?this.shortPaths[i].slice():null;var o=t.id+":"+e.id+":"+n;if(this.shortPaths.hasOwnProperty(o))return this.shortPaths[o]?this.shortPaths[o].slice().reverse():null;var r=this.model.panos.aStarSearch(e,t);return this.model.panos.includeNodesNearPath(r,n),this.shortPaths[i]=r?r.slice():null,r}},{key:"makePathHulls",value:function(e){var t,n,i,o,r,a=0,s=[],l=[],c=[],u=this.model.panos;o=(t=u.get(e[0])).floor.floorIndex;for(var h=0;h<e.length;h+=1)(n=(t=u.get(e[h])).floorPosition.clone().sub(this.model.position)).y+=this.pathHeight(),s.push(n),l.push(t.position.clone()),i=t.floor.floorIndex,c.push(i>o?Je.path.colorUp:i<o?Je.path.colorDown:Je.path.color),h>0&&((r=l[h].distanceTo(l[h-1]))>a&&(a=r));return a>this.longestStep&&(this.longestStep=a,nt.debug("path contains "+a+" meter segment")),{floor:s,camera:l,color:c}}},{key:"makeFloorCurves",value:function(e,t,n){var i=this.player.mode===ht.PANORAMA?Je.path.waypointIndoorRadius:Je.path.waypointRadius,o=this.pointPathDistance(e)-2*i,r=e.slice(0),a=r[1].clone().sub(r[0]);a.y=0,a.normalize().multiplyScalar(i),r[0]=(new THREE.Vector3).copy(r[0]).add(a),(a=r[r.length-2].clone().sub(r[r.length-1])).y=0,a.normalize().multiplyScalar(i),r[r.length-1]=(new THREE.Vector3).copy(r[r.length-1]).add(a);var s=new THREE.CatmullRomCurve3(r),l=Math.floor(o/n);l=4*Math.floor(l/4),l=Math.max(4,l);for(var c,u,h=s.getSpacedPoints(l),d=[],p=new THREE.Vector3,f=0;f<h.length;f+=1){u=0,c=h[f].distanceTo(e[0]);for(var m=1;m<e.length;m+=1)p.copy(h[f]).sub(e[m]),p.y*=4,p.length()<c&&(u=m);d.push(t[u])}return{distance:o,points:h,colors:d}}},{key:"makeCameraCurvePoints",value:function(e,t){var n=this.pointPathDistance(e);return new THREE.CatmullRomCurve3(e).getSpacedPoints(Math.max(2,Math.floor(n/t)))}},{key:"setPathHulls",value:function(e){var t=this.makePathHulls(e);this.floorHull=t.floor,this.cameraHull=t.camera,this.colorHull=t.color}},{key:"setFloorCurves",value:function(){var e=this.makeFloorCurves(this.floorHull,this.colorHull,this.brushPrefs.paveStep);this.floorPathDistance=e.distance,this.floorCurvePoints=e.points,this.floorCurveColors=e.colors}},{key:"setCameraCurvePoints",value:function(){this.camCurvePoints=this.makeCameraCurvePoints(this.cameraHull,Je.warp.stepFactor*this.brushPrefs.paveStep)}},{key:"chooseWarpPath",value:function(e){var t,n,i,o=this.playerControls.cameras[ht.PANORAMA];if(this.player.currentPano===this.warpDestPano||!e)return this.warpPathPoints=null,this.warpLength=0,!1;this.nodes=this.findShortestPath(this.player.currentPano,this.warpDestPano),this.setPathHulls(this.nodes),void 0===this.nodes||null===this.nodes||this.nodes.length<1?(nt.debug("warp path to unreachable node"),n=(t=this.warpDestPano.position.clone().sub(o.position)).clone().negate(),t.multiplyScalar(.15).add(o.position),n.multiplyScalar(.15).add(this.warpDestPano.position),t.y=o.position.y,n.y=this.warpDestPano.position.y,i=new THREE.CubicBezierCurve3(o.position.clone(),t,n,this.warpDestPano.position.clone()),this.warpPathPoints=i.getSpacedPoints(this.brushPrefs.cvSegments)):(nt.debug("follow warp path (path distance was "+this.nodes.length+" nodes, "+this.floorPathDistance+")"),this.setCameraCurvePoints(),this.warpPathPoints=this.camCurvePoints.slice(0)),this.warpLength=0,this.warpPathLengths=[0];for(var r=new THREE.Vector3,a=new THREE.Vector3,s=Math.cos(THREE.MathUtils.degToRad(Je.warp.minBrakeAngle)),l=Math.cos(THREE.MathUtils.degToRad(Je.warp.maxBrakeAngle)),c=1;c<this.warpPathPoints.length;c+=1){r.copy(this.warpPathPoints[c-1]).sub(this.warpPathPoints[c]);var u=r.length();r.y*=Je.warp.climbEffort;var h=r.length()/u;if(c>1){r.setY(0).normalize(),a.copy(this.warpPathPoints[c-2]).sub(this.warpPathPoints[c-1]).setY(0).normalize();var d=Math.min(1,r.dot(a)),p=1+(Je.warp.brakeStrength-1)*(1-THREE.MathUtils.smoothstep(d,l,s));h=Math.max(p,h)}this.warpLength+=u*h,this.warpPathLengths[c]=this.warpLength}return!0}},{key:"drawPathRibbon",value:function(e,t){this.bunnyObj.visible=Je.warp.showBunny;for(var n=.6*Je.path.ribbonWidth*.5,i=new THREE.Vector3,o=new THREE.Vector3(0,this.pathHeight(),0),r=new THREE.BufferGeometry,a=new THREE.Vector3,s=0;s<e.length;s+=1){a.copy(e[s]),0===s?a.sub(e[s+1]):a.sub(e[s-1]).negate(),a.normalize(),i.crossVectors(a,$i.UP),i.multiplyScalar(n);var l=(new THREE.Vector3).copy(e[s]).add(o);l.sub(i),r.vertices.push(l),(l=(new THREE.Vector3).copy(e[s]).add(o)).add(i),r.vertices.push(l)}var c,u,h,d=0;for(s=0;s<e.length-1;s+=1){var p=2*s,f=d,m=d+=e[s+1].distanceTo(e[s]),v=t[s],g=t[s+1];(c=new THREE.Face3(p,p+1,p+2)).vertexColors=[new THREE.Color(v),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,f),new THREE.Vector2(1,f),new THREE.Vector2(0,m)]),(c=new THREE.Face3(p+2,p+1,p+3)).vertexColors=[new THREE.Color(g),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,m),new THREE.Vector2(1,f),new THREE.Vector2(1,m)])}r.computeFaceNormals(),r.computeVertexNormals(),this.player.mode===ht.PANORAMA?((h=THREE.UniformsUtils.clone(sn.ribbon.uniforms)).map.value=this.pathImg.path,h.opacity.value=0,h.color.value.set(Je.path.color),u=new THREE.RawShaderMaterial({side:THREE.DoubleSide,depthWrite:!1,transparent:!0,vertexShader:sn.ribbon.vertexShader,fragmentShader:sn.ribbon.fragmentShader,uniforms:h,name:"ribbonT",opacity:0})):u=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,name:"ribbonOut",vertexColors:THREE.VertexColors});var A=new THREE.Mesh(r,u);return A.name="ribbon",this.player.mode===ht.PANORAMA&&(A.renderOrder=Qe),A}},{key:"drawPathPavement",value:function(e){for(var t,n=new THREE.Vector3,i=new THREE.BufferGeometry,o=new THREE.Vector3,r=0;r<e.length;r+=1)o.copy(e[r]),0===r?o.sub(e[r+1]).negate():o.sub(e[r-1]),o.normalize(),n.crossVectors(o,$i.UP),n.multiplyScalar(this.brushPrefs.paveWidth),(t=(new THREE.Vector3).copy(e[r])).sub(n),i.vertices.push(t),i.vertices.push((new THREE.Vector3).copy(e[r])),(t=(new THREE.Vector3).copy(e[r])).add(n),i.vertices.push(t);var a,s,l;for(r=0;r<e.length-1;r+=1)a=3*r+1,l=(s=.25*r)+.25,i.faces.push(new THREE.Face3(a-1,a,a+3)),i.faceVertexUvs[0].push([new THREE.Vector2(0,s),new THREE.Vector2(.5,s),new THREE.Vector2(.5,l)]),i.faces.push(new THREE.Face3(a+3,a+2,a-1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(0,l),new THREE.Vector2(0,s)]),i.faces.push(new THREE.Face3(a+3,a,a+1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(.5,s),new THREE.Vector2(1,s)]),i.faces.push(new THREE.Face3(a+3,a+1,a+4)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(1,s),new THREE.Vector2(1,l)]);var c=this.player.mode===ht.PANORAMA?new THREE.MeshBasicMaterial({color:Je.path.color,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,opacity:0,name:"paveT",map:this.pathImg.path}):new THREE.MeshBasicMaterial({color:Je.path.color,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,opacity:1,name:"paveO",map:this.pathImg.path});return new THREE.Mesh(i,c)}},{key:"makeWaypointObj",value:function(e,t){var n=this.player.mode===ht.PANORAMA?Je.path.waypointIndoorRadius:Je.path.waypointRadius,i=this.pathHeight(),o=new THREE.CylinderGeometry(n,n,i,32),r=THREE.UniformsUtils.clone(sn.waypoint.uniforms);r.map.value=e,r.opacity.value=0,r.color.value.set(Je.path.color);var a={side:THREE.DoubleSide,depthWrite:!1,depthTest:!1,transparent:!0,vertexShader:sn.waypoint.vertexShader,fragmentShader:sn.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0};this.player.mode!==ht.PANORAMA&&(a.depthTest=!1,a.name="wayPtOut");var s=new THREE.RawShaderMaterial(a),l=new THREE.Mesh(o,s);return l.renderOrder=Se,l.name=t,l}},{key:"makeStartMarker",value:function(e,t){var n=(new THREE.Vector3).copy(t[1]).sub(t[0]);n.y=0,n.normalize();var i=Math.acos(n.x),o=this.makeWaypointObj(this.pathImg.pathStart,"Start");return o.rotateOnAxis(new THREE.Vector3(0,1,0),i),o.position.copy(e),o}},{key:"makeEndMarker",value:function(e){var t=this.makeWaypointObj(this.pathImg.pathEnd,"End"),n=this.model.panos.get(this.nodes[0]).floor.floorIndex,i=this.model.panos.get(this.nodes[this.nodes.length-1]).floor.floorIndex;return n<i?t.material.uniforms.color.value.set(Je.path.colorUp):n>i&&t.material.uniforms.color.value.set(Je.path.colorDown),t.position.copy(e),t}},{key:"pathClean",value:function(e){if(e){for(var t in e.children)this.pathClean(e.children[t]);e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}}},{key:"discardPathObject",value:function(){if(this.obj3d){var e=this.obj3d.parent;e&&e.remove(this.obj3d),this.pathClean(this.obj3d)}this.obj3d=null,this.popInCpm()}},{key:"discardSlow",value:function(){if(this.obj3d){if(this.player.mode!==ht.PANORAMA)return void this.discardPathObject();for(var e,t=0,n=function(){this.discardPathObject()}.bind(this),i=0;i<this.obj3d.children.length;i+=1)void 0!==(e=this.obj3d.children[i]).material&&!0===e.material.transparent&&(void 0!==e.material.uniforms?pe.start(It.property(e.material.uniforms.opacity,"value",0),Je.path.fadeOutTime,n,0,de[Je.warp.blendEasing]):pe.start(It.property(e.material,"opacity",0),Je.path.fadeOutTime,n,0,de[Je.warp.blendEasing]),t+=1,n=null);0===t&&this.discardPathObject(),this.player.mode!==ht.PANORAMA&&this.fadeInCpm(Je.path.fadeInTime-3)}}},{key:"appearSlow",value:function(){var e;this.fadeOutCpm(Je.path.fadeInTime);for(var t=this.player.mode===ht.PANORAMA?Je.path.opacity:1,n=0;n<this.obj3d.children.length;n+=1)void 0!==(e=this.obj3d.children[n]).material&&!0===e.material.transparent&&(void 0!==e.material.uniforms?pe.start(It.property(e.material.uniforms.opacity,"value",t),Je.path.fadeInTime,null,0,de[Je.warp.blendEasing]):pe.start(It.property(e.material,"opacity",t),Je.path.fadeInTime,null,0,de[Je.warp.blendEasing]))}},{key:"update",value:function(){this.obj3d&&this.obj3d.updateMatrixWorld()}},{key:"calcBurnsAmount",value:function(e){var t=THREE.MathUtils.degToRad(Je.warp.burnsAngle);if(this.player.mode===ht.PANORAMA){var n=this.burnsDir*t;if(this.upcomingTransType===Ie)return n;var i=e;if(null===i)return nt.warn("Transition request for non-highlight"),n;var o=this.getHeroDescriptorByHeroIndex(i);if(null===o)return n;if(!o.isPano())return n;var r=this.getHeroPano(o),a=this.playerControls.cameras[ht.PANORAMA],s=$i.FORWARD.clone().applyQuaternion(a.quaternion).setY(0).normalize(),l=Math.min(THREE.MathUtils.degToRad(Je.warp.minBurnsAngle),t),c=function(e){var n=Math.acos(Math.min(1,e.dot(s))),i=(new THREE.Vector3).crossVectors(s,e);return Math.max(l,Math.min(Math.abs(n),t))*Math.sign(i.y)};if(r===this.player.currentPano)return c($i.FORWARD.clone().applyQuaternion(o.quaternion).setY(0).normalize());var u=this.findShortestPath(this.player.currentPano,r);if(null==u||u.length<1)return nt.debug("Empty path ahead..."),n;var h=this.makePathHulls(u),d=new THREE.CatmullRomCurve3(h.camera),p=Math.min(.1,Je.warp.lookAheadDist/d.getLength());return c(d.getPointAt(p).clone().sub(a.position).setY(0).normalize())}return this.player.mode===ht.DOLLHOUSE?.02*this.burnsDir:this.burnsDir}},{key:"waitNextStep",value:function(e,t){var n=Je.warp.tourStepDelay;n||(n=this.lastTransType===Ie?constants.tourStepDelaySlideShow:constants.tourStepDelayDefault);var i=new THREE.Euler,o=new THREE.Vector3;nt.debug("Starting wait: "+(void 0!==t));var r=this.calcBurnsAmount(e),a=function(){this.endWarpState(),this.player.mode===ht.DOLLHOUSE&&(this.playerControls.cameras[ht.DOLLHOUSE].controls.rotationAcceleration.x=0),t&&t()}.bind(this),s=function(e,t){if(this.warpInterrupted)return a(),!0;var s=t||1e3/60;if(Je.warp.doBurns)if(this.player.mode===ht.PANORAMA){var l=this.playerControls.cameras[ht.PANORAMA];i.setFromQuaternion(WarpcameraStyle.quaternion,Je.warp.eOrder);var c=s*r/n;i.y+=c,o.set(0,0,-1),o.applyEuler(i),o.add(l.position),l.controls.lookAt(o),l.controls.lookVector.copy(o),l.lookAt(o)}else this.player.mode===ht.DOLLHOUSE?this.playerControls.controls[ht.DOLLHOUSE].rotationAcceleration.x=r:this.playerControls.controls[ht.FLOORPLAN].absoluteScale*=.9996}.bind(this);this.startWarpState(),pe.start(s,n,a,0,de.easeInOutQuad,"wait")}},{key:"warpToNonPano",value:function(e){if(this.discardPathObject(),this.warpDestHeroLoc.cameraMode===ht.DOLLHOUSE||this.warpDestHeroLoc.cameraMode===ht.FLOORPLAN){var t=function(){e&&e()}.bind(this);this.player.flyToNewMode({mode:this.warpDestHeroLoc.cameraMode,duration:Je.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:t,force:!0})}else nt.warn("no warp destination!!!"),e&&e()}},{key:"_resetWarpShaderParams",value:function(e){this.player.mode===ht.PANORAMA&&(void 0!==e.material.uniforms.blackout&&(e.material.uniforms.blackout.value=0),void 0!==e.material.uniforms.modelAlpha&&(e.material.uniforms.modelAlpha.value=0))}},{key:"_clearWarpShading",value:function(){for(var e=this.model.chunks,t=0;t<e.length;t+=1)this._resetWarpShaderParams(e[t]),e[t].visible=!0;this._resetWarpShaderParams(this.model.skybox)}},{key:"_warpStopFlying",value:function(){this.activeTransType=null,this.placeCpm()}},{key:"_wrapupTravelOnlyBits",value:function(){this._warpStopFlying(),this.warpPathPoints&&(this.player.currentPano.exit(),this.warpDestPano.enter(),this.player.currentPano=this.warpDestPano),this.placeCpm()}},{key:"_wrapupTravel",value:function(e){this._wrapupTravelOnlyBits(),this.warpCameraAim(e)}},{key:"_wrapupWarpShading",value:function(e){this._clearWarpShading(),this._wrapupTravel(e)}},{key:"wrapupWarpShadingOnly",value:function(e,t){t!==rt&&this._clearWarpShading(),this._wrapupTravelOnlyBits(),this.upcomingTransType=null,e&&e()}},{key:"_warpCameraAim",value:function(e,t){var n=this.warpDestHeroLoc.quaternion,i=this.playerControls.cameras[ht.PANORAMA],o=new THREE.Vector3(0,0,1).applyQuaternion(n).normalize(),r=new THREE.Vector3(0,0,1).applyQuaternion(i.quaternion).normalize().dot(o),a=THREE.MathUtils.radToDeg(Math.acos(r)),s=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(n,Je.warp.eOrder),l=(new THREE.Euler).setFromQuaternion(i.quaternion,Je.warp.eOrder),c=new THREE.Euler(s.x-l.x,s.y-l.y,s.z-l.z,Je.warp.eOrder);c.y=he.constrainedTurn(c.y),this.burnsDir=Math.sign(c.y);var u=new THREE.Euler(0,0,0,Je.warp.eOrder),h=new THREE.Vector3,d=function(e,t){return!!this.warpInterrupted||(u.x=l.x+e*c.x,u.y=l.y+e*c.y,u.z=l.z+e*c.z,h.set(0,0,-1),h.applyEuler(u),h.add(i.position),i.controls.lookAt(h),i.controls.lookVector.copy(h),void i.lookAt(h))}.bind(this);return a>Je.warp.minRotation?pe.start(d,e,t,0,de[Je.warp.movementEasing]):(nt.debug("Aim angle only is "+a.toPrecision(3)+" degrees, skipping explicit re-aim"),void(t&&t()))}},{key:"_warpBendAim",value:function(e,t,n,i){var o=i||0,r=this.playerControls.cameras[ht.PANORAMA],a=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Je.warp.eOrder),s=(new THREE.Euler).setFromQuaternion(r.quaternion,Je.warp.eOrder),l=new THREE.Euler(a.x-s.x,a.y-s.y,a.z-s.z,Je.warp.eOrder);l.y=he.constrainedTurn(l.y);var c=Math.min(THREE.MathUtils.degToRad(Je.warp.softBendTilt),Math.abs(l.x));l.x=c*Math.sign(l.x),c=Math.min(THREE.MathUtils.degToRad(Math.max(0,Je.warp.softBendAngle)),c),this.burnsDir=Math.sign(l.y),c*=Math.sign(l.y),l.y=c;var u=new THREE.Euler(0,0,0,Je.warp.eOrder),h=new THREE.Vector3,d=function(e,t){if(e<.5)u.x=s.x+e*l.x,u.y=s.y+e*l.y,u.z=s.z+e*l.z;else{var n=(1-e)*Je.warp.softBendEnd;u.x=a.x-n*l.x,u.y=a.y-n*l.y,u.z=a.z-n*l.z}h.set(0,0,-1),h.applyEuler(u),h.add(r.position),r.controls.lookAt(h),r.controls.lookVector.copy(h),r.lookAt(h)}.bind(this);return pe.start(d,t,n,o,de[Je.warp.movementEasing])}},{key:"_warpStepCameraAim",value:function(e,t,n){var i=this.playerControls.cameras[ht.PANORAMA],o=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Je.warp.eOrder),r=(new THREE.Euler).setFromQuaternion(i.quaternion,Je.warp.eOrder),a=new THREE.Euler(o.x-r.x,o.y-r.y,o.z-r.z,Je.warp.eOrder);a.y=he.constrainedTurn(a.y),this.burnsDir=Math.sign(a.y);var s=new THREE.Euler(0,0,0,Je.warp.eOrder),l=new THREE.Vector3,c=function(e,t){e<.5?s.copy(r):s.copy(o),l.set(0,0,-1),l.applyEuler(s),l.add(i.position),i.controls.lookAt(l),i.controls.lookVector.copy(l),i.lookAt(l)}.bind(this);return pe.start(c,t,n,0,de[Je.warp.movementEasing])}},{key:"setBurnsDir",value:function(){var e=this.playerControls.cameras[ht.PANORAMA],t=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Je.warp.eOrder),n=(new THREE.Euler).setFromQuaternion(e.quaternion,Je.warp.eOrder),i=new THREE.Euler(t.x-n.x,t.y-n.y,t.z-n.z,Je.warp.eOrder);i.y=he.constrainedTurn(i.y),this.burnsDir=Math.sign(i.y)}},{key:"stepWarpPath",value:function(e,t){var n=this.playerControls.cameras[ht.PANORAMA],i=this.warpPathPoints?this.warpPathPoints[0]:e;if(!i)return n.position.copy(this.warpDestPano.position),!0;var o=this.warpDestPano.position;if(null!==this.nodes&&this.cameraHull&&this.cameraHull.length>1){var r=new THREE.Vector3;t<.5?r.copy(this.cameraHull[1]).sub(i).normalize().multiplyScalar(Je.warp.softPushDist*t).add(i):r.copy(this.cameraHull[this.cameraHull.length-2]).sub(o).normalize().multiplyScalar(Je.warp.softPushDist*Je.warp.softPushEnd*(1-t)).add(o),n.position.copy(r)}else t<.5?n.position.copy(i):n.position.copy(o)}},{key:"interruptAndFastForward",value:function(e,t){this.warping&&(this.warpInterrupted=!0,this.warpInterruptionBlackoutStyle=e,this.warpInterruptionTravelTime=t,null!==this.warpInterruptionBlackoutStyle&&void 0!==this.warpInterruptionBlackoutStyle||(this.warpInterruptionBlackoutStyle=ot),null!==this.warpInterruptionTravelTime&&void 0!==this.warpInterruptionTravelTime||(this.warpInterruptionTravelTime=Je.minWarpTime))}},{key:"warpCameraAim",value:function(e){var t=Je.warp.minWarpTime;if(this.upcomingTransType===Ie)t=Je.warp.teleportTime;else{var n=this.playerControls.cameras[ht.PANORAMA],i=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Je.warp.eOrder),o=(new THREE.Euler).setFromQuaternion(n.quaternion,Je.warp.eOrder),r=new THREE.Euler(i.x-o.x,i.y-o.y,i.z-o.z,Je.warp.eOrder);r.y=he.constrainedTurn(r.y);var a=1e3*Math.abs(r.y)/THREE.MathUtils.degToRad(Je.warp.maxAimPerSec);t=Math.max(t,a)}var s=function(){this._warpStopFlying(),this.discardSlow(),e&&e()}.bind(this);this._warpCameraAim(t,s)}},{key:"warpCommonParameters",value:function(e,t,n,i){this.model.skybox.material.uniforms.blackout.value=i;var o=It.uniform(this.model.skybox,"progress",1),r=It.allUniforms(this.model.chunks,"progress",1),a=!1,s=function(){if(this.warpInterrupted)return a=!0,!0}.bind(this),l=function(e,t){return n&&a?(this.model.skybox.material.uniforms.progress.value=0,!0):void o(e,t)}.bind(this),c=function(e,t){return n&&a?(r(0),!0):void r(e,t)}.bind(this);pe.start(s,e,null,t,null,"safeHaltWatch"),pe.start(l,e,null,t,de[Je.warp.blendEasing],"skyboxProgress"),pe.start(c,e,null,t,de[Je.warp.blendEasing],"chunkProgress")}},{key:"warpTravel_STD",value:function(e){var t,n=Math.min(Je.warp.lookAheadMax,Je.warp.lookAheadDist/this.warpLength),i=this.playerControls.cameras[a.PANORAMA],o=(Math.min(.25,3/this.warpLength),Math.min(.35,7/this.warpLength)),r=new THREE.Euler(0,0,0,Je.warp.eOrder),s=new THREE.Vector3,c=(new THREE.Euler).setFromQuaternion(i.quaternion,Je.warp.eOrder),u=(new THREE.Euler).copy(c),h=i.position.clone(),p=new THREE.Matrix4,f=new THREE.Euler,m=Je.warp.minWarpTime;m+=this.warpLength*Je.warp.timePerMeter,Je.warp.flySpeed>.01&&(m=1e3*this.warpLength/Je.warp.flySpeed);var v=!1,A=this.warpDestHeroLoc.quaternion,y=new THREE.Vector3(0,0,-1).applyQuaternion(A).normalize(),E=this.warpPathPoints[this.warpPathPoints.length-1].clone().sub(this.warpPathPoints[this.warpPathPoints.length-2]).normalize(),w=E.dot(y),b=THREE.MathUtils.radToDeg(Math.acos(w)),C=function(e){var t=o;return THREE.MathUtils.smoothstep(e,0,t)*(1-THREE.MathUtils.smoothstep(e,1-t,1))},x=function(){return p.lookAt(h,t,$i.UP),r.setFromRotationMatrix(p,Je.warp.eOrder),c.setFromQuaternion(i.quaternion,Je.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,Je.warp.eOrder),he.constrainedTurn(f.y)}.bind(this),I=function(e,t){if(this.warpInterrupted)return v=!0,!0}.bind(this),T=function(e,t){return v||!this.warpPathPoints?(effects.blur(0),!0):void effects.blur(e)}.bind(this),B=It.allUniforms(this.model.chunks,"modelAlpha",1),k=function(e,t){return v||!this.warpPathPoints?(B(0),!0):void B(e,t)}.bind(this),P=function(e,t){if(!this.warpPathPoints)return i.position.copy(this.warpDestPano.position),!0;if(v)return!0;var n=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,e);i.position.copy(n),h=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,.99*e)}.bind(this),R=function(e,i){return this.warpPathPoints?!!v||void(t=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,Math.min(e+n,1))):(nt.debug("Lost bunny."),!0)}.bind(this),M=function(e,o){if(v)return nt.debug(">>>> Walkthrough interupted at t="+e),!0;if(!this.warpPathPoints)return!0;var a=this.warpLength*e,l=THREE.MathUtils.smoothstep(a,0,this.brushPrefs.lookBlendDist),d=THREE.MathUtils.smoothstep(a,this.warpLength-this.brushPrefs.lookBlendDist,this.warpLength);Je.warp.matchCam&&(l*=1-d),p.lookAt(h,t,$i.UP),r.setFromRotationMatrix(p,Je.warp.eOrder),c.setFromQuaternion(i.quaternion,Je.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,Je.warp.eOrder),f.y=he.constrainedTurn(f.y),r.x=c.x+l*f.x,r.y=c.y+l*f.y,r.z=c.z+l*f.z,f.set(r.x-u.x,r.y-u.y,r.z-u.z,Je.warp.eOrder),f.y=he.constrainedTurn(f.y);var m=THREE.MathUtils.degToRad(Je.warp.maxTurnPerSec)*o/1e3;f.y=Math.sign(f.y)*Math.min(m,Math.abs(f.y)),u.x=u.x+f.x*Je.warp.turnFriction,u.y=u.y+f.y*Je.warp.turnFriction,u.z=u.z+f.z*Je.warp.turnFriction,u.x=Math.max(THREE.MathUtils.degToRad(Je.warp.minDownAngle),u.x);var g=t.clone().sub(h).normalize();if(b<Je.warp.maxAimRotation&&d>0){var A=1-d;g.x=g.x*A+d*E.x,g.y=g.y*A+d*E.y,g.z=g.z*A+d*E.z,g.normalize()}this.bunnyObj.position.copy(i.position).add(g),s.set(0,0,-1).applyEuler(u).normalize(),s.multiplyScalar(8),s.add(i.position),e>1-n&&Je.warp.matchCam||(i.controls.lookAt(s),i.controls.lookVector.copy(s),i.lookAt(s))}.bind(this),S=function(){v?(this.discardSlow(),this.upcomingTransType=l.BLACK,this.warpTravel_BLACK(-.5,this.warpInterruptionTravelTime,at,e)):this._wrapupWarpShading(e)}.bind(this);R(0);var D=Je.warp.motionLeadTime+1e3*Math.abs(x())/THREE.MathUtils.degToRad(Je.warp.maxTurnPerSec),F=D/(m+=D);this.warpCommonParameters(m,F,!0,it),pe.start(I,m,null,0,null,"_haltWatcher"),Je.warp.blur>0&&(g.blurStrength=Je.warp.blur,pe.start(T,m,null,F,C,"blurring")),pe.start(k,m,null,F,C,"modelAlpha"),pe.start(P,m,null,F,d[Je.warp.blendEasing],"followPath"),pe.start(R,m,null,F,d[Je.warp.blendEasing],"goBunny"),pe.start(M,m,S,0,d[Je.warp.blendEasing],"lookAtBunny")}},{key:"warpTravel_BLACK",value:function(e,t,n,i){this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1;var o=e||0;null!=t||(t=Je.warp.teleportTime),this.warpCommonParameters(t,o,!1,n),this.model.chunks.forEach((function(e){e.material.uniforms.blackout.value=n})),this._warpBendAim(null,t,null,o);var r=function(){this.wrapupWarpShadingOnly(i,n)}.bind(this),a=this.player.position.clone();pe.start(this.stepWarpPath.bind(this,a),t,r,o,de[Je.warp.blendEasing],"stepMotion")}},{key:"makeWalkFlightFunc",value:function(e,t,n){return this.flightStepWalk.bind(this,e,t,n)}},{key:"getOrientationForWalkingTourNode",value:function(e,t,n){var i=e.length;if(t>=i)return!1;if(t===i-1)n.copy($i.FORWARD).applyQuaternion(this.warpDestHeroLoc.quaternion);else{var o=this.player.model.panos.get(e[t]),r=this.player.model.panos.get(e[t+1]);n.copy(r.position).sub(o.position)}return n.normalize(),!0}},{key:"warpCameraTravel",value:function(e,t,n,i){if(this.activeTransType=this.upcomingTransType,this.lastTransType=this.activeTransType,this.upcomingTransType=null,e)this.activeTransType===Ie?this.warpTravel_BLACK(null,n,t,i):this.activeTransType===Be?this.warpTravel_WALK(function(){this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),i&&i()}.bind(this)):this.warpTravel_STD(i);else{var o=function(){this._wrapupTravel(i)}.bind(this),r={pano:this.warpDestPano,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(r,o)}}},{key:"startWarpState",value:function(){this.warping=!0,this.warpInterrupted=!1,this.warpInterruptionBlackoutStyle=null,this.warpInterruptionTravelTime=null}},{key:"endWarpState",value:function(){this.warping=!1}},{key:"warpToPano",value:function(e,t,n,i){if(this.warping)nt.warn("Cannot warp when already warping");else{if(this.upcomingTransType=e,this.activeTransType=null,!this.setWarpDestPano())return this.upcomingTransType=null,void this.warpToNonPano(i);if(this.player.mode!==ht.PANORAMA)return this.upcomingTransType=null,this.discardSlow(),void this.player.flyToNewMode({mode:ht.PANORAMA,pano:this.warpDestPano,duration:Je.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:i,force:!0});if(!this.warpDestPano)return nt.warn("no warp destination, callback dropped"),void(this.upcomingTransType=null);var o=!(this.model.panos.isNeighbour(this.player.currentPano,this.warpDestPano)&&this.warpDestPano!==this.player.currentPano&&this.warpDestPano.position.distanceTo(this.player.currentPano.position)<Je.warp.nearPanoDist),r=this.chooseWarpPath(o);if(r&&this.upcomingTransType!==Be){var a=function(){this.waitingToWarp=!1,this.warpToPano(e,t,n,i)}.bind(this);if(this.player.checkAndWaitForPanoLoad(this.warpDestPano,"high","low",this.player.basePanoSize,a))return void(this.waitingToWarp=!0)}this.player.currentPano||(nt.warn("Arrived at a very strange spot!"),this.player.currentPano=this.warpDestPano,this.placeCpm(),this.fadeOutCpm(Je.path.fadeOutTime),this.player.spider.draw()),nt.debug("Warping to pano ",this.warpDestPano.position),this.upcomingTransType!==Be&&this.player.emit(zr,this.player.currentPano,this.warpDestPano),this.startWarpState();var s=function(){this.endWarpState(),i&&i()}.bind(this);r?this.warpCameraTravel(o,t,n,s):this.warpCameraAim(s),this.player.smoothZoomToDefault(Je.zoom.restoreTime)}}}]),e}(),Ua="zoom.in",Na="zoom.out",za="zoom.max",Ga="zoom.min";function ja(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Wa=new WeakMap,qa=function(t){f(i,t);var n=ja(i);function i(e){var t;return o(this,i),(t=n.call(this,e)).decoderPath="",t.decoderConfig={},t.decoderBinary=null,t.decoderPending=null,t.workerLimit=4,t.workerPool=[],t.workerNextTaskID=1,t.workerSourceURL="",t.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},t.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},t}return u(i,[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(t,n,i,o){var r=this,a=new e.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){r.decodeDracoFile(e,n).catch(o)}),i,o)}},{key:"decodeDracoFile",value:function(e,t,n,i){var o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};return this.decodeGeometry(e,o).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,i=this,o=JSON.stringify(t);if(Wa.has(e)){var r=Wa.get(e);if(r.key===o)return r.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var a=this.workerNextTaskID++,s=e.byteLength,l=this._getWorker(a,s).then((function(i){return n=i,new Promise((function(i,o){n._callbacks[a]={resolve:i,reject:o},n.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))})).then((function(e){return i._createGeometry(e.geometry)}));return l.catch((function(){return!0})).then((function(){n&&a&&i._releaseTask(n,a)})),Wa.set(e,{key:o,promise:l}),l}},{key:"_createGeometry",value:function(t){var n=new e.BufferGeometry;t.index&&n.setIndex(new e.BufferAttribute(t.index.array,1));for(var i=0;i<t.attributes.length;i++){var o=t.attributes[i],r=o.name,a=o.array,s=o.itemSize;n.setAttribute(r,new e.BufferAttribute(a,s))}return n}},{key:"_loadLibrary",value:function(t,n){var i=new e.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(n),i.setWithCredentials(this.withCredentials),new Promise((function(e,n){i.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var i=n[0];t||(e.decoderConfig.wasmBinary=n[1]);var o=Ja.toString(),r=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var i=new Worker(n.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:n.decoderConfig}),i.onmessage=function(e){var t=e.data;switch(t.type){case"decode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(i)}else n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var o=n.workerPool[n.workerPool.length-1];return o._taskCosts[e]=t,o._taskLoad+=t,o}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}]),i}(e.Loader);function Ja(){var e,t;function n(e,t,n,i,o,r){var a=r.num_components(),s=n.num_points()*a,l=s*o.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),u=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,r,c,l,u);var h=new o(e.HEAPF32.buffer,u,s).slice();return e._free(u),{name:i,array:h,itemSize:a}}onmessage=function(i){var o=i.data;switch(o.type){case"init":e=o.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var r=o.buffer,a=o.taskConfig;t.then((function(e){var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(r),r.byteLength);try{var l=function(e,t,i,o){var r,a,s=o.attributeIDs,l=o.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)r=new e.Mesh,a=t.DecodeBufferToMesh(i,r);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");r=new e.PointCloud,a=t.DecodeBufferToPointCloud(i,r)}if(!a.ok()||0===r.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());var u={index:null,attributes:[]};for(var h in s){var d=self[l[h]],p=void 0,f=void 0;if(o.useUniqueIDs)f=s[h],p=t.GetAttributeByUniqueId(r,f);else{if(-1===(f=t.GetAttributeId(r,e[s[h]])))continue;p=t.GetAttribute(r,f)}u.attributes.push(n(e,t,r,h,d,p))}c===e.TRIANGULAR_MESH&&(u.index=function(e,t,n){var i=3*n.num_faces(),o=4*i,r=e._malloc(o);t.GetTrianglesUInt32Array(n,o,r);var a=new Uint32Array(e.HEAPF32.buffer,r,i).slice();return e._free(r),{array:a,itemSize:1}}(e,t,r));return e.destroy(r),u}(t,i,s,a),c=l.attributes.map((function(e){return e.array.buffer}));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:o.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}}))}}}var Ya=new THREE.GLTFLoader,Za=new qa;Za.setDecoderPath($n.getImageURL("images/loaders/DRACOLoader/draco/")),Ya.setDRACOLoader(Za);var Xa=function(e,t){Ya.load(e,t)};function Ka(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var $a,es={},ts=function(e){f(n,THREE.Object3D);var t=Ka(n);function n(e){var i;return o(this,n),(i=t.call(this)).parts={body:null,foot:null,line:null},i.type=e,i.addEventListener("createDone",(function(){i.traverse((function(e){e.isMesh&&(e.renderOrder=De-1,e.material.transparent=!0)}))})),i.type.indexOf("ground")>-1?i.createBracket():i.createFrame(),i}return u(n,[{key:"show",value:function(){this.overlay.visible&&("wall_1"!=this.type||0!=this.overlay.depthTemp)?this.visible=!0:this.visible=!1}},{key:"hide",value:function(){this.visible=!1}},{key:"setFrameThickness",value:function(e){"wall_1"==this.type?(isNaN(e)&&(e=0),this.overlay.depthTemp=e,e?this.show():this.hide()):e=this.type.indexOf("wall")>-1?Je.overlay.depth:0,this.overlay.depth=e,this.overlay.plane.position.set(0,0,e),this.update({mode:"scale"})}},{key:"setOverlay",value:function(e,t){if(this.overlay=e,e.frame=this,this.visible=e.visible,t){var n=this.computeOverlayTransform({reverse:!0}),i=n.position,o=n.quaternion;this.position.copy(i),this.quaternion.copy(o)}else{this.position.copy(this.overlay.position),this.quaternion.copy(this.overlay.quaternion);var r=this.computeOverlayTransform(),a=r.position,s=r.quaternion;this.overlay.position.copy(a),this.overlay.quaternion.copy(s)}this.update({mode:"scale"})}},{key:"computeOverlayTransform",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.overlay.position.clone(),n=this.overlay.quaternion.clone(),i=e.reverse?-1:1,o=Je.overlay.height*this.overlay.scale.y;switch(this.type){case"ground_1":t.add(new THREE.Vector3(0,(es[this.type].height+o/2)*i,0).applyQuaternion(this.overlay.quaternion));break;case"ground_2":n.multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/6*i)),t.add(new THREE.Vector3(0,es[this.type].height*i,0).applyQuaternion(1==i?this.quaternion:n));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":t.add(new THREE.Vector3(0,(o/2+this.getFrameModelData().border)*i,0).applyQuaternion(this.quaternion))}return this.setFrameThickness(this.overlay.depth),{position:t,quaternion:n}}},{key:"createBracket",value:function(){var e=this,t=new THREE.MeshPhongMaterial({color:0});if(t.visible=!1,"ground_1"==this.type){this.parts.body=new THREE.Group;var n=new THREE.Mesh(new THREE.PlaneGeometry(Je.overlay.width,Je.overlay.height),t);n.scale.z=-1,this.parts.body.backFace=n;var i=new THREE.Group;this.parts.body.bottom=i,this.parts.body.add(i,n),this.add(this.parts.body),this.initBracketMeshData((function(t){i.add(t);var o=t.children[1].material;n.material=o,e.dispatchEvent({type:"createDone"})}))}else{this.parts.body=new THREE.Group,this.parts.body.rotateX(-Math.PI/6),this.add(this.parts.body);var o=new THREE.Mesh(new THREE.BoxGeometry(.02,Je.overlay.height,.02),t);o.position.z-=.01;var r=new THREE.Mesh(new THREE.BoxGeometry(.1,.01,.04),t);r.position.y+=Je.overlay.height/2+.005;var a=new THREE.Mesh(new THREE.BoxGeometry(.1,.01,.04),t);a.position.y-=Je.overlay.height/2+.005;var s=new THREE.Mesh(new THREE.PlaneGeometry(Je.overlay.width,Je.overlay.height),t);s.scale.z=-1,this.parts.body.middle=o,this.parts.body.top=r,this.parts.body.bottom=a,this.parts.body.backFace=s,this.parts.body.add(o,r,a,s),this.parts.foot=new THREE.Group,this.parts.foot.position.z-=.02,this.add(this.parts.foot),this.initBracketMeshData((function(t){e.parts.foot.add(t);var n=t.children[0].material;o.material=r.material=a.material=s.material=n,e.dispatchEvent({type:"createDone"})})),this.parts.body.position.y+=es[this.type].height}}},{key:"createFrame",value:function(){var e=new THREE.Mesh;this.parts.body=e;var t=this.getFrameModelData(),n=t.vertices,i=t.indexs,o=t.uvs,r=t.normals;e.geometry=new THREE.BufferGeometry,e.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),e.geometry.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(o),2)),e.geometry.setIndex(new THREE.BufferAttribute(new Uint16Array(i),1)),r?e.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(r),3)):e.geometry.computeVertexNormals(),"wall_0"==this.type?(e.material=new THREE.MeshPhongMaterial({color:"#eeeeee"}),this.parts.line=new THREE.LineSegments(new THREE.EdgesGeometry(e.geometry),new THREE.LineBasicMaterial({color:0})),this.add(this.parts.line)):"wall_3"==this.type?e.material=new THREE.MeshStandardMaterial({color:"#222222"}):"wall_2"!=this.type&&"wall_1"!=this.type||(e.material=new THREE.MeshLambertMaterial({color:"#cccccc"})),e.position.z-=.001,this.add(e),this.dispatchEvent({type:"createDone"})}},{key:"update",value:function(e){var t=Math.abs(Je.overlay.width*this.overlay.scale.x),n=Math.abs(Je.overlay.height*this.overlay.scale.y);if(!e||"translate"==e.mode)switch(this.type){case"ground_1":this.overlay.position.copy(this.position).add(new THREE.Vector3(0,n/2+es[this.type].height,0).applyQuaternion(this.quaternion));break;case"ground_2":this.overlay.position.copy(this.position).add(new THREE.Vector3(0,es[this.type].height,0).applyQuaternion(this.quaternion));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":this.position.copy(this.overlay.position).add(new THREE.Vector3(0,-n/2-this.getFrameModelData().border,0).applyQuaternion(this.quaternion));break;default:this.overlay.position.copy(this.position)}if(!e||"rotate"==e.mode)switch(this.type){case"ground_1":this.overlay.rotation.copy(this.rotation),this.overlay.position.set(0,es[this.type].height+n/2,0).applyQuaternion(this.quaternion).add(this.position);break;case"ground_2":this.overlay.quaternion.setFromAxisAngle(new THREE.Vector3(1,0,0).applyQuaternion(this.overlay.quaternion),-Math.PI/6).multiply(this.quaternion),this.parts.body.quaternion.copy(this.quaternion).invert().multiply(this.overlay.quaternion),this.overlay.position.copy(this.position).add(new THREE.Vector3(0,es[this.type].height,0).applyQuaternion(this.quaternion));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":this.overlay.rotation.copy(this.rotation),this.overlay.position.set(0,this.getFrameModelData().border+n/2,0).applyQuaternion(this.quaternion).add(this.position);break;default:this.overlay.rotation.copy(this.rotation)}if(!e||"scale"==e.mode)switch(this.type){case"ground_1":this.parts.body.bottom.scale.x=this.overlay.scale.x,this.parts.body.backFace.scale.set(this.overlay.scale.x,this.overlay.scale.y,-this.overlay.scale.z),this.parts.body.backFace.position.set(0,n/2+es[this.type].height,0),this.overlay.position.copy(this.position).add(new THREE.Vector3(0,n/2+es[this.type].height,0).applyQuaternion(this.quaternion));break;case"ground_2":this.parts.body.middle.scale.y=this.overlay.scale.y,this.parts.body.top.position.y=n/2+.005,this.parts.body.bottom.position.y=-n/2-.005,this.parts.body.backFace.scale.set(this.overlay.scale.x,this.overlay.scale.y,-this.overlay.scale.z);break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":var i=this.getFrameModelData(t,n),o=i.vertices,r=i.normals;this.parts.body.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3)),r&&this.parts.body.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(r),3)),this.position.set(0,-this.getFrameModelData().border-n/2,0).applyQuaternion(this.quaternion).add(this.overlay.position),this.parts.line&&(this.parts.line.geometry.dispose(),this.parts.line.geometry=new THREE.EdgesGeometry(this.parts.body.geometry))}}},{key:"getFrameModelData",value:function(e,t){var n=this.overlay&&!isNaN(this.overlay.depth)?this.overlay.depth:Je.overlay.depth;!e&&(e=Je.overlay.width),!t&&(t=Je.overlay.height);for(var i={wall_0:{border:.05,vertices:[e/2,t/2,n,e/2+.01,t/2+.01,n+.02,e/2+.05,t/2+.05,n+.02,e/2,-t/2,n,e/2+.01,-t/2-.01,n+.02,e/2+.05,-t/2-.05,n+.02,-e/2,-t/2,n,-e/2-.01,-t/2-.01,n+.02,-e/2-.05,-t/2-.05,n+.02,-e/2,t/2,n,-e/2-.01,t/2+.01,n+.02,-e/2-.05,t/2+.05,n+.02,e/2+.05,t/2+.05,0,e/2+.05,-t/2-.05,0,-e/2-.05,-t/2-.05,0,-e/2-.05,t/2+.05,0],indexs:[0,3,4,0,4,1,1,4,5,1,5,2,3,6,7,3,7,4,4,7,8,4,8,5,6,9,10,6,10,7,7,10,11,7,11,8,9,0,1,9,1,10,10,1,2,10,2,11,0,6,3,0,9,6,2,13,12,2,5,13,5,14,13,5,8,4,8,15,14,8,11,15,11,12,15,11,2,12,12,13,14,12,14,15]},wall_1:{border:0,vertices:[e/2,t/2,n,e/2,t/2,0,e/2,-t/2,n,e/2,-t/2,0,-e/2,-t/2,n,-e/2,-t/2,0,-e/2,t/2,n,-e/2,t/2,0],normals:[1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1],indexs:[0,2,3,0,3,1,2,4,5,2,5,3,4,6,7,4,7,5,6,0,1,6,1,7,0,4,2,0,6,4,1,3,5,1,5,7]},wall_2:{border:.06,vertices:[e/2+.02,t/2+.02,n,e/2+.02,t/2+.02,n+.03,e/2+.06,t/2+.06,n,e/2+.02,-t/2-.02,n,e/2+.02,-t/2-.02,n+.03,e/2+.06,-t/2-.06,n,-e/2-.02,-t/2-.02,n,-e/2-.02,-t/2-.02,n+.03,-e/2-.06,-t/2-.06,n,-e/2-.02,t/2+.02,n,-e/2-.02,t/2+.02,n+.03,-e/2-.06,t/2+.06,n,e/2+.06,t/2+.06,0,e/2+.06,-t/2-.06,0,-e/2-.06,-t/2-.06,0,-e/2-.06,t/2+.06,0],normals:[-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,.1,-1,1,.1,-1,-1,.1,-1,1,.1,-1],indexs:[0,3,4,0,4,1,1,4,5,1,5,2,3,6,7,3,7,4,4,7,8,4,8,5,6,9,10,6,10,7,7,10,11,7,11,8,9,0,1,9,1,10,10,1,2,10,2,11,0,6,3,0,9,6,2,13,12,2,5,13,5,14,13,5,8,14,8,15,14,8,11,15,11,12,15,11,2,12,12,13,14,12,14,15]},wall_3:{border:.05,vertices:[e/2,t/2,n,e/2+.05,t/2+.05,n,e/2,-t/2,n,e/2+.05,-t/2-.05,n,-e/2,-t/2,n,-e/2-.05,-t/2-.05,n,-e/2,t/2,n,-e/2-.05,t/2+.05,n,e/2+.05,t/2+.05,0,e/2+.05,-t/2-.05,0,-e/2-.05,-t/2-.05,0,-e/2-.05,t/2+.05,0],normals:[1,1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],indexs:[0,2,3,0,3,1,2,4,5,2,5,3,4,6,7,4,7,5,6,0,1,6,1,7,0,4,2,0,6,4,1,9,8,1,3,9,3,10,9,3,5,10,5,11,10,5,7,11,7,8,11,7,1,8,8,9,10,8,10,11]}}[this.type],o=1;o<i.vertices.length;o+=3)i.vertices[o]+=t/2+i.border;i.uvs=[];for(var r=0;r<i.vertices.length*(2/3)/8;r++)i.uvs.push(0,1,1,1,1,0,0,0);return i}},{key:"initBracketMeshData",value:function(e){var t=this;if(es[this.type]&&es[this.type].loaded)e&&e(es[this.type].object.clone());else{if("ground_1"==this.type){var n=.2;return es[this.type]={object:null,height:.58*n,loaded:!1},Xa($n.getImageURL("images/brackets/bracket_1.glb"),(function(i){var o=i.scene;o.position.y*=n,o.rotateY(Math.PI/2),o.scale.set(n,n,1/2.44),o.children.forEach((function(e){"Plane"!==e.name&&e.material.color.setRGB(.3,.3,.3)})),es[t.type].object=o,es[t.type].loaded=!0,e&&e(o)})),es[this.type]}if("ground_2"==this.type){var i=.5;es[this.type]={object:null,height:.795,loaded:!1},Xa($n.getImageURL("images/brackets/bracket_2.glb"),(function(n){var o=n.scene;o.children.forEach((function(e){"dizuo001"==e.name?e.material.opacity=.6:e.material.color.setRGB(.3,.3,.3)})),o.scale.set(i,i,i),o.position.y+=.01,es[t.type].object=o,es[t.type].loaded=!0,e&&e(o)}))}}}},{key:"switchTranformControls",value:function(e){"scale"==e.mode||"translate"==e.mode&&this.type.indexOf("wall")>-1?e.attach(this.overlay):e.attach(this)}},{key:"remove",value:function(e){if(this.removeFromParent(),!e){var t=this.computeOverlayTransform({reverse:!0}),n=t.position,i=t.quaternion;this.overlay.position.copy(n),this.overlay.quaternion.copy(i)}}},{key:"dispose",value:function(e){this.remove(e),this.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())}))}}]),n}();function ns(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var is=function(e){f(n,THREE.Object3D);var t=ns(n);function n(e,i,r){var a;o(this,n),a=t.call(this),$a=!e.$app.config.view,a.player=e,a._planeGeometry=new THREE.PlaneGeometry(Je.overlay.width,Je.overlay.height,1,1),a._boxGeometry=new THREE.BoxBufferGeometry(Je.overlay.width,Je.overlay.height,Je.overlay.depth);var s=H(a._boxGeometry.index.array);return s.splice(24,6),a._boxGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array(s),1)),a._boxMat=new THREE.MeshBasicMaterial({color:"#eeeeee",transparent:!0,opacity:.8}),a.videoPlayer=r,a.isHidden=!1,null==i.reverse&&(i.reverse=!1),null==i.limitToOnlyPano&&(i.limitToOnlyPano=!1),a.cornerPoints=[],a.info=i,a.sid=i.sid,a.build(i),a.name="overlay_"+a.sid,a.floor=a.player.model.floors.get(i.floorIndex)||a.raycastToFindFloor(),a.updateVisibleOnFloor(),a.addEventListener("isVisible",(function(e){a.player.EditOverlay.editPlane==h(a)&&a.player.EditOverlay.controlSelectOverlay(e.visible?h(a):null)})),a}return u(n,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Ae.updateVisible(this,e,!0),this.frame&&this.frame.show(),"forceHide"==e&&(this.isHidden=!1)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Ae.updateVisible(this,e,!1),this.frame&&this.frame.hide(),"forceHide"==e&&(this.isHidden=!0)}},{key:"raycastToFindFloor",value:function(){return this.floor=tt.raycastToFindFloor(this.player,this.plane.getWorldPosition(new THREE.Vector3)),this.floor||(console.error("Overlay raycastToFindFloor cannot find floor?"),this.floor=this.player.model.floors.first()),this.floor}},{key:"updateVisibleOnFloor",value:function(e){this.player.model.currentFloor==this.floor||this.player.model.allFloorsVisible||"panorama"==this.player.modeTran.split("-")[1]?this.show("visiOnFloor"):this.hide("visiOnFloor")}},{key:"build",value:function(e){var t=this;this.modified=e.modified;var n=new THREE.Mesh(this._planeGeometry,new THREE.MeshBasicMaterial({color:"#00c8af",opacity:.4,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-.9,polygonOffsetUnits:-4}));if(n.renderOrder=De,this.add(n),this.plane=n,this.player.OverlayManager.add(this),e.media){if(e.media.includes("video"))e.type="video",$a?this.loadVideo():this.player.on("view.changed",(function(){var e=t.info.media instanceof HTMLVideoElement?1e3:200;Ae.intervalTool.isWaiting("overlayInsight",(function(){t.player.flying||(t.visible&&t.inSight()?t.videoControl(!0):t.videoControl(!1))}),e)}));else if(e.media.includes("photo")){var i=new Image;i.crossOrigin="anonymous",this.info.isBillboard?i.src=this.getMapSrc():i.src=this.player.$app.resource.getUserResourceURL(e.poster),i.onload=function(){t.dispatchEvent({type:"mapLoaded"})},e.media=i,e.type="photo"}n.material.color=new THREE.Color(1,1,1)}null==e.width&&(e.width=Je.overlay.width),null==e.height&&(e.height=Je.overlay.height),this.setFromInfo(e)}},{key:"loadVideo",value:function(){return this.info.media instanceof HTMLVideoElement||(this.info.media=this.videoPlayer.getVideo(this.info.sid),this.info.media.addEventListener("ended",(function(){info.media.play(),info.media.paused})),this.setFromInfo(this.info),this.plane.material.needsUpdate=!0),this.info.media}},{key:"setFromInfo",value:function(e){var t=this,n=this.plane;if(e.width&&(this.scale.setX(e.width/Je.overlay.width),this.width=e.width),e.height&&(this.scale.setY(e.height/Je.overlay.height),this.height=e.height),!isNaN(e.depth)&&(this.depth=e.depth),e.pos instanceof Array&&(e.pos=(new THREE.Vector3).fromArray(e.pos)),e.qua instanceof Array&&(e.qua=(new THREE.Quaternion).fromArray(e.qua)),e.pos&&this.position.copy(e.pos),e.qua&&this.quaternion.copy(e.qua),e.reverse&&(this.scale.x*=-1),this.isHidden=e.hide,Ae.updateVisible(this,"forceHide",!this.isHidden),e.type){if(n.material.map)n.material.map.image=e.media,n.material.map.needsUpdate=!0;else{if("video"==e.type){if(!(this.info.media instanceof HTMLVideoElement))return;var i=new THREE.VideoTexture(e.media);if(n.material.map=i,!$a){var o=i.needsUpdate;Object.defineProperty(i,"needsUpdate",{get:function(){return o},set:function(e){(o=!t.info.media.paused&&e)&&(i.version++,i.source.needsUpdate=!0)}})}}else n.material.map=new THREE.Texture(e.media),n.material.map.needsUpdate=!0;n.material.map.wrapS=n.material.map.wrapT=THREE.ClampToEdgeWrapping,n.material.map.minFilter=THREE.LinearFilter,n.material.map.magFilter=THREE.LinearFilter,n.material.map.anisotropy=4,n.material.map.generateMipmaps=!1,n.material.opacity=1}this.file=e.file}this.overlayType=e.type,e.frameType||this.info.isBillboard||(e.frameType="wall_1"),this.info.isBillboard||this.addFrame(e.frameType,"new"!==this.modified),this.limitToOnlyPano=!!e.limitToOnlyPano&&this.player.model.panos.index[e.limitToOnlyPano],this.limitToOnlyPano&&this.limitToOnlyPano!=this.player.currentPano&&this.hide("limitToOnlyPano"),this.visiblePanos=tt.getVisiblePano(this.position,this.player.model)}},{key:"addFrame",value:function(e,t){if(!this.frame||this.frame.type!==e||t){if(this.frame&&(this.frame.dispose(t),this.frame=null),e){t||"wall_1"!=e||(this.depth=this.depthTemp);var n=new ts(e);n.setOverlay(this,t),this.player.OverlayManager.frameGroup.add(n)}}else{var i=this.frame.computeOverlayTransform({reverse:!0}),o=i.position,r=i.quaternion;this.frame.position.copy(o),this.frame.quaternion.copy(r)}}},{key:"dispose",value:function(){this.plane.material.dispose(),this.plane.material.map=null,this.parent.remove(this)}},{key:"inSight",value:function(){if($a)return!0;if("panorama"!=this.player.mode||!this.player.currentPano){var e=new THREE.Matrix4;e.multiplyMatrices(this.player.camera.projectionMatrix,this.player.camera.matrixWorldInverse);var t=new THREE.Frustum;t.setFromProjectionMatrix(e),this.plane.geometry.boundingBox||this.plane.geometry.computeBoundingBox();var n=this.plane.geometry.boundingBox.clone().applyMatrix4(this.matrixWorld);return t.intersectsBox(n)}if(this.visiblePanos&&!this.visiblePanos.includes(this.player.currentPano))return!1;if(this.player.camera){var i,o=this.getCornerPoint(),r=new THREE.Vector2(2,2),a=1/this.player.zoomLevel,s=this.getMediaSize();if(s.x>0&&(a*=Math.sqrt(s.x*s.y)/1e3),r.multiplyScalar(a),o.diffLon<r.x||o.diffLat<r.y)return!1;for(var l=0,c=(i=o.diffLon<15&&o.diffLat<15?[o.cornerPoint[0]]:o.cornerPoint).length;l<c;l++){var u=tt.getPos2d(i[l],this.player);if(u.trueSide&&u.inSight)return!0}}}},{key:"getMediaSize",value:function(){var e=new THREE.Vector2;return this.info.media instanceof Image?(e.x=this.info.media.width,e.y=this.info.media.height):this.info.media instanceof HTMLVideoElement?(e.x=this.info.media.videoWidth||1e3,e.y=this.info.media.videoHeight||1e3):(e.x=1e3,e.y=1e3),e}},{key:"getCornerPoint",value:function(){var e,t,n,i=this;if(this.cornerPoints[this.player.currentPano.id])return this.cornerPoints[this.player.currentPano.id];this.plane&&(n=this.plane.getWorldPosition(new THREE.Vector3),e=[new THREE.Vector3(-.5,.5,0),new THREE.Vector3(.5,.5,0),new THREE.Vector3(.5,-.5,0),new THREE.Vector3(-.5,-.5,0)]);var o=-1/0,r=1/0,a=-1/0,s=1/0,l=this.player.currentPano.position.clone(),c=(n=this.position.clone()).clone().sub(l).normalize(),u={};this.player.cameraControls.controls.panorama.lookAt.call(u,null,c),e.forEach((function(e){var t=e.applyMatrix4(i.plane.matrixWorld).clone().sub(l).normalize(),n={};i.player.cameraControls.controls.panorama.lookAt.call(n,null,t);var c=(n.lon-u.lon)%360;Math.abs(c)>180&&(c+=c>0?-360:360);var h=n.lat-u.lat;o=Math.max(c,o),r=Math.min(c,r),a=Math.max(h,a),s=Math.min(h,s)}));var h=o-r,d=a-s;return d>180?t=e:(o+=u.lon,a+=u.lat,r+=u.lon,s+=u.lat,t=[he.getDirByLonLat(o,a),he.getDirByLonLat(r,s),he.getDirByLonLat(o,s),he.getDirByLonLat(r,a)].map((function(e){return e.negate().add(l)})),t=[n].concat(H(t))),this.cornerPoints[this.player.currentPano.id]={cornerPoint:t,diffLon:h,diffLat:d},this.cornerPoints[this.player.currentPano.id]}},{key:"videoControl",value:function(e){var t=this.info.media;this.shouldPlay=e,e&&"stop"!=e?e&&(!t.paused&&t instanceof HTMLVideoElement||(t=this.loadVideo()).play()):t instanceof HTMLVideoElement&&!t.paused&&t.pause()}}]),n}(),os={priorityEvent:[{dragOverlay:"move"},{hoverOverlay:"pointer"},{hoverMonitor:"pointer"},{addOverlay:"url(https://4dkk.4dage.com/v3-test/img/box_video.png),auto"},{hoverFootMarker:"pointer"},{hoverView:"pointer"},{dragView:"move"},{viewChoosePos:"pointer"}],list:[],currentCursorIndex:null,init:function(e){this.domElements=[e.domElement]},add:function(e){var t=this.priorityEvent.find((function(t){return t[e]}));t?this.list.includes(e)||(this.judge({addItem:t,name:e}),this.list.push(e)):console.error("CursorDeal 未定义优先级 name:"+e)},remove:function(e){var t=this.list.indexOf(e);t>-1&&(this.list.splice(t,1),this.judge())},judge:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.addItem){var n=this.priorityEvent.indexOf(t.addItem);(n<this.currentCursorIndex||null==this.currentCursorIndex)&&(this.domElements.forEach((function(e){return e.style.cursor=t.addItem[t.name]})),this.currentCursorIndex=n)}else{var i={index:1/0,cursor:null};this.list.forEach((function(t){var n=e.priorityEvent.find((function(e){return e[t]})),o=e.priorityEvent.indexOf(n);o<i.index&&(i.index=o,i.cursor=n[t])})),this.currentCursorIndex=i.index,this.domElements.forEach((function(e){return e.style.cursor=i.cursor||""}))}}};function rs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var as=function(e){f(n,EventEmitter);var t=rs(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.instances=new Map,i.video=null,i}return u(n,[{key:"addVideo",value:function(e){var t=this._createVideo(this._getVideoPath(e));return this.instances.set(e,t),t.videoElement.masters=[],t}},{key:"getVideo",value:function(e,t){var n=this.instances.get(e);return n||(n=this.addVideo(e)),t&&n.videoElement.masters.push(t),n.videoElement}},{key:"_getVideoPath",value:function(e){}},{key:"_createVideo",value:function(e){var t=document.createElement("video");t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("controls","true"),t.autoplay=!1,t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="1000",t.style.width="200px",t.style.display="none",t.player=this;var n=flvjs.createPlayer({type:"flv",url:e});return n.videoElement=t,n.attachMediaElement(t),n.on(flvjs.Events.ERROR,this._onPlayerError.bind(this)),n.load(),n}},{key:"_onPlayerError",value:function(){console.warn("视频加载失败")}}]),n}();function ss(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ls=function(e){f(n,e);var t=ss(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".flv")}}]),n}(as);function cs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var us=function(e){f(n,EventEmitter);var t=cs(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.video=null,i.videos=new Map,i}return u(n,[{key:"addVideo",value:function(e){var t=this._createVideoElement(this._getVideoPath(e));return this.videos.set(e,t),t.masters=[],t}},{key:"getVideo",value:function(e,t){var n=this.videos.get(e);return n||(n=this.addVideo(e)),t&&n.masters.push(t),n}},{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".mp4")}},{key:"_createVideoElement",value:function(e){var t=document.createElement("video");return t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("x5-playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("x5-video-player-type","h5"),t.setAttribute("controls","true"),t.setAttribute("x-webkit-airplay","allow"),t.autoplay=!0,t.muted=!0,t.loop=!0,t.src=e,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="1000",t.style.width="300px",t.style.height="300px",t}}]),n}();function hs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ds=function(e){f(n,e);var t=hs(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".mp4")}}]),n}(us);function ps(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var fs=function(e){f(n,EventEmitter);var t=ps(n);function n(e){var i;o(this,n),(i=t.call(this)).player=e,i.group=new THREE.Object3D,i.group.name="OverlayGroup",i.frameGroup=new THREE.Object3D,i.frameGroup.name="OverlayFrameGroup",e.OverlayManager=h(i),i.withBox=!0,i.lineMat=ui.createFatLineMat({depthTest:!1,lineWidth:2,color:"#4fffff",opacity:.3}),i.model=i.player.model,i.model.add(i.group),i.model.add(i.frameGroup),i.player.$app.core.get("SceneRenderer").addComponent(h(i)),i.VideoManager=i.player.$app.VideoManager;var r=i.player.$app.store.getValue("metadata");if(r.boxVideos&&r.boxVideos.length){var a=r.boxVideos[0],s=Ce.detectAndroidMobile();i.overlayVideoPlayer=s?new ls(i.player):new ds(i.player),i.add(new is(i.player,a,i.overlayVideoPlayer))}return r.boxPhotos&&r.boxPhotos.length&&r.boxPhotos.forEach((function(e){i.add(new is(i.player,e))})),e.on("collectIntersectMesh",(function(e){e.push.apply(e,H(i.group.children.filter((function(e){return e.visible})).map((function(e){return e.plane}))))})),e.on("judgeIntersect",(function(e,t){e&&(e.object.overlayType||e.object.parent.overlayType)?(i.hoverOverlay(e.object),t.consume()):i.hoverOverlay(null)})),e.on("pointerStart",(function(){i.autoPlay()})),e.on(Wr,(function(e){var t=e.panoId;i.group.children.forEach((function(e){e.limitToOnlyPano&&(e.limitToOnlyPano.id!=t?(e.hide("limitToOnlyPano"),i.player.EditOverlay.editPlane==e&&i.VideoManager.emit("videos/panel/updatePanoVisi",!1)):(e.show("limitToOnlyPano"),i.player.EditOverlay.editPlane==e&&i.VideoManager.emit("videos/panel/updatePanoVisi",!0)))}))})),e.$app.config.view&&(e.on(qr,(function(t){var n,o=t.currentPano;"panorama"==e.mode&&(n=o.getVideoFilter()),i.group.children.forEach((function(e){n&&n(e.position)?e.hide("coveredPanoVideo"):e.show("coveredPanoVideo")}))})),i.group.children.filter((function(e){return"video"==e.info.type}))),i}return u(n,[{key:"add",value:function(e){this.group.add(e)}},{key:"show",value:function(e,t){this.group.children.forEach((function(n){t&&n.info.hide||"all"!=e&&n.floor.floorIndex!=e||n.show("visiOnFloor")}))}},{key:"hide",value:function(e){this.group.children.forEach((function(t){"all"!=e&&t.floor.floorIndex!=e||t.hide("visiOnFloor")}))}},{key:"setGroupVisible",value:function(e){this.group.visible=!!e,this.frameGroup.visible=!!e}},{key:"setSize",value:function(e,t){this.openOverlay&&this.resizeOverlay()}},{key:"hoverOverlay",value:function(e,t){var n;if(this.group.visible&&(this.withBox&&e?e=(n=e.parent).plane:n=e,!(n&&n.info.isBillboard&&null==n.targetPano&&W.view))){if(this.model.player.billboardManager.editPlane||this.highlight(n,t),!e)return this.hoveringPlane&&(this.hoveringPlane.info.isBillboard&&this.model.player.billboardManager.emit("hoverBillboard",{sid:this.hoveringPlane.info.sid,state:!1}),this.hoveringPlane=null),os.remove("hoverOverlay"),void os.remove("dragOverlay");n.isEditing&&n.info.isBillboard?os.add("dragOverlay"):os.add("hoverOverlay"),this.hoveringPlane=n,n.info.isBillboard&&this.model.player.billboardManager.emit("hoverBillboard",{sid:n.info.sid,state:!0})}}},{key:"highlight",value:function(e,t){var n=this;if(e){if(e.visible&&e!=this.highlightPlane){this.highlightPlane&&this.highlight(null),this.highlightPlane=e;for(var i=e.plane.geometry.getAttribute("position").array,o=new THREE.Object3D,r=[0,1,3,2],a=0;a<4;a++){var s=[{x:i[3*r[a]],y:i[3*r[a]+1],z:i[3*r[a]+2]},{x:i[3*r[(a+1)%4]],y:i[3*r[(a+1)%4]+1],z:i[3*r[(a+1)%4]+2]}];o.add(ui.createFatLine(s,{material:this.lineMat}))}this.group.children.forEach((function(e){var t=n.withBox?e.plane:e;t.border&&(t.border.children.forEach((function(e){return e.geometry.dispose()})),t.remove(t.border))})),this.lineMat.opacity=0,pe.cancelById(Je.freeze.wallLineShine,!0),pe.start(function(e){this.lineMat.opacity=e}.bind(this),200,null,0,de[Je.transition.blendEasing],"wallLineShine",Je.freeze.wallLineShine),e.plane.border=o,e.plane.add(o)}}else{if(this.highlightPlane){var l=function(){c.border.children.forEach((function(e){e.geometry.dispose()})),c.remove(c.border)},c=this.withBox?this.highlightPlane.plane:this.highlightPlane;pe.cancelById(Je.freeze.wallLineShine),"soon"==t?(this.lineMat.opacity=0,l()):pe.start(function(e){this.lineMat.opacity=1-e}.bind(this),200,l,0,de[Je.transition.blendEasing],"wallLineShine",Je.freeze.wallLineShine,l)}this.highlightPlane=null}}},{key:"getMatFromCss",value:function(e){if(e.includes("matrix3d"))var t=e.slice(9,-1).split(",");else t=e.slice(7,-1).split(",");if(t.forEach((function(e,n){t[n]=parseFloat(e)})),16==t.length)var n=(new THREE.Matrix4).fromArray(t);else if(6==t.length)n=(new THREE.Matrix4).fromArray([t[0],t[1],0,0,t[2],t[3],0,0,0,0,1,0,t[4],t[5],0,1]);return n}},{key:"getCssFromMatrix",value:function(e){return"matrix3d("+e.elements+")"}},{key:"getOverlayOpenPos",value:function(e){var t=e.width/(.9*$("#player").width()),n=e.height/(.9*$("#player").height()),i=1/Math.max(t,n),o=-e.width*i/$("#player").width(),r=player.cameraControls.activeControl?player.cameraControls.activeControl.camera:player.camera,a=new THREE.Vector3(o,0,-1).unproject(r).clone().sub(player.camera.position),s=player.getDirection(),l=s.angleTo(a),c=e.width/2/Math.tan(l);this.withBox&&(c+=e.plane.position.length());var u=player.camera.position.clone().add(s.clone().multiplyScalar(c));return this.useCssRender||this.updatePlaneElemStyle(i),u}},{key:"updatePlaneElemStyle",value:function(e){this.openOverlay.elem.css({width:this.openOverlay.width*e+"px",height:this.openOverlay.height*e+"px"})}},{key:"getPlanePos",value:function(e){return this.withBox?(new THREE.Vector3).setFromMatrixPosition(e.plane.matrixWorld):e.position.clone()}},{key:"clickOverlay",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.dontEmit,o=n.forceFlyToPlane,r=n.afterFly;if(e.info.isBillboard){i||this.model.player.billboardManager.emit("clickBillboard",{sid:e.info.sid});var a=this.model.player.$app.core.get("Scene").firstView.pano;if(!o){var s=this.model.player.model.panos.index[e.targetPano];return void(null==s||s!=a&&!s.hasNeighbor()||this.model.player.flyToPano({pano:s}))}if(null!=e.homePanoId){var l=this.model.player.model.panos.index[e.homePanoId];if(null!=l&&(l==a||l.hasNeighbor()))return void this.model.player.flyToPano({pano:l,lookAtPoint:e.position,checkAlone:!0})}}if(!(this.openOverlay&&!e||this.model.player.GLTFEditor.selecting)){os.remove("hoverOverlay");var c=this.withBox&&e?e.plane:e;"video"==e.overlayType&&c.material.map.image.play();var u=this.player.cameraControls.cameras.panorama.aspect*Math.tan(THREE.MathUtils.degToRad(this.model.player.zoomFov/2)),h=Math.tan(THREE.MathUtils.degToRad(this.model.player.zoomFov/2)),d=e.width/2/u,p=e.height/2/h,f=Math.max(d,p);if(f*=f,console.log("goodDistance "+f),e.limitToOnlyPano)this.player.flyToPano({pano:e.limitToOnlyPano,lookAtPoint:e.position});else{var m=e.visiblePanos;0==m.length&&console.warn("clickOverlay 找不到visiblePanos");var v={};this.player.$app.Camera.flyToPoint(e.position.clone(),{rank:[function(t){var n=new THREE.Vector3(0,0,1).applyQuaternion(e.quaternion),i=t.position.clone().sub(e.position),o=n.dot(i.normalize());return v[t.id]=o,200*o},function(t){var n=t.position.clone().distanceToSquared(e.position),i=f*Math.abs(v[t.id]);return-1*Math.abs(n-i)/i},function(n){return-500*n.position.clone().sub(e.position).normalize().dot(t.player.getDirection())}],require:[function(e){return m.includes(e)}],dealDistance:5,done:r})}var g=!i&&this.player.EditOverlay&&this.player.EditOverlay.editing;g&&(this.player.EditOverlay.editPlane&&this.player.EditOverlay.editPlane.uuid!=e.uuid||this.player.EditOverlay.isAdding&&this.player.domElement.style.cursor.indexOf("box_video.png")<0||g&&this.player.EditOverlay.editPlane!=e&&setTimeout((function(){var n=JSON.parse(JSON.stringify(e.info));n.sid=e.sid,n.type=e.overlayType,t.VideoManager.emit("videos/panel/display",n),t.player.EditOverlay.updateOverlayPanel(e),e.updateVisibleOnFloor()}),10))}}},{key:"autoPlay",value:function(e){this.group.children.forEach((function(e){!e.clickToPlayInited&&e.info.media instanceof HTMLVideoElement&&!Ae.isVideoPlayed(e.info.media)&&e.shouldPlay&&(console.log("try mobileAutoPlay "),e.videoControl(!0),Ae.isVideoPlayed(e.info.media)&&(console.log("clickToPlayInited "),e.clickToPlayInited=!0))}))}}]),n}();function ms(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var vs=function(e){f(n,EventEmitter);var t=ms(n);function n(e){var i;return o(this,n),(i=t.call(this)).editing=!1,i.overlayMaxCount=1,i.meshGroup=new THREE.Object3D,i.player=e,i}return u(n,[{key:"checkIfCanInit",value:function(){return this.player.model&&this.player.model.chunks.length&&this.player.currentPano&&this.player.model.transformControls}},{key:"waitToInit",value:function(){var e=this;console.log("waitToInit");var t=setInterval((function(){e.checkIfCanInit()&&(e.init(),clearInterval(t))}),50)}},{key:"init",value:function(){var e=this;this.checkIfCanInit()?(this.VideoManager=this.player.$app.VideoManager,this.transformControls=this.player.model.transformControls,this.transformControls.addEventListener("mousing",(function(t){"overlay"==t.state&&(e.VideoManager.emit("VideoManager.BoxVideo.transform",t.mode),e.editPlane.frame.update(t))})),this.meshGroup.name="overlay-group",this.player.model.add(this.meshGroup),this.meshGroup.visible=!1,this.player.OverlayManager.group.children.forEach((function(t){e.updateOverlayInfo(t)})),window.addEventListener("keydown",(function(t){var n;if(!e.editing){switch(t.which){case 87:n="translate";break;case 82:n="scale"}n&&e.VideoManager.emit("videos/panel/switchTclMode",n),t.stopPropagation()}})),this.enter()):this.waitToInit()}},{key:"enter",value:function(){this.editing||(this.editing=!0,this.meshGroup.visible=!0,this.player.cameraControls.controls.dollhouse.resetRanges(3),this.player.cameraControls.controls.panorama.insideLookLimitDown=W.isMobile?-55:-50)}},{key:"leave",value:function(){this.editing&&(this.editing=!1,this.endAddPlane(),this.meshGroup.visible=!1,this.transformControls.switchEditState(null),this.player.cameraControls.controls.dollhouse.resetRanges(),this.player.cameraControls.controls.panorama.insideLookLimitDown=null)}},{key:"beginToAddPlane",value:function(){this.player.viewLinkManager.exitView(),this.player.reticule.visible=!1,this.isAdding=!0,os.add("addOverlay")}},{key:"endAddPlane",value:function(){this.isAdding=!1,os.remove("addOverlay"),this.player.reticule.visible=!0}},{key:"addOverlay",value:function(e){var t=e.intersect.face.normal.clone(),n=$i.UP.angleTo(t)>Math.PI/4?"wall":"ground";this.player.getMouseDirection().angleTo(e.intersect.face.normal)<Math.PI/2&&t.negate(),console.log("normal",t),t.y>.85&&(t=this.player.getMouseDirection().negate()),t.y=0,t.normalize();var i=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(t,$i.ZERO,$i.UP)),o=e.intersect.point.add(t.multiplyScalar(.01)),r=new is(this.player,{sid:Ae.getRandomSid(),floorIndex:this.player.model.currentFloor.floorIndex,pos:o,qua:i,modified:"new",frameType:n+"_1"});r.updateMatrixWorld(),this.player.OverlayManager.clickOverlay(r),this.VideoManager.emit("videos/panel/switchTclMode","translate"),this.endAddPlane()}},{key:"updateOverlayInfo",value:function(e){e.info.isBillboard||(e.info={width:e.width,height:e.height,depth:e.depth,pos:e.position.clone(),qua:e.quaternion.clone(),reverse:e.scale.x<0,media:e.plane.material.map.image,file:e.file,type:e.overlayType,hide:e.isHidden,frameType:e.frame&&e.frame.type,limitToOnlyPano:e.limitToOnlyPano&&e.limitToOnlyPano.id})}},{key:"undoEdit",value:function(){if(this.editPlane){var e=this.editPlane;"new"==e.modified?this.disposeOverlay(e):(e.setFromInfo(e.info),"delete"==e.modified&&this.player.OverlayManager.add(e))}}},{key:"updateOverlayScaleDisplay",value:function(){var e=this.editPlane,t=Math.abs(e.width)/190,n=Math.abs(e.height)/190,i=1/Math.max(t,n),o=Math.round(Math.abs(e.width)*i),r=Math.round(Math.abs(e.height)*i);this.VideoManager.emit("videos/panel/changeSize",{wText:e.width.toFixed(2),hText:e.height.toFixed(2),width:o,height:r,depth:isNaN(e.depth)?Je.overlay.depth:e.depth})}},{key:"updateOverlayPanel",value:function(e){this.editPlane=e;var t=e.plane,n=t.material.map&&t.material.map.image;this.VideoManager.emit("videos/panel/updatePoster",n),this.updateOverlayScaleDisplay(),this.transformControls.switchEditState("overlay"),e.frame?this.VideoManager.emit("videos/panel/changeDepth",100*e.depth):this.VideoManager.emit("videos/panel/changeDepth",0),this.player.emit("beginEditOverlay")}},{key:"controlSelectOverlay",value:function(e){e&&e.visible?e.frame?e.frame.switchTranformControls(this.transformControls):this.transformControls.attach(e):this.transformControls.detach()}},{key:"useImgRatio",value:function(e){var t=this.editPlane.plane;if(t.material.map){var n=t.material.map.image,i="video"==this.editPlane.overlayType?n.videoWidth:n.width,o="video"==this.editPlane.overlayType?n.videoHeight:n.height;if("suitSize"==e){var r=Math.min(Math.max(i,o)/200,1);if(i>o)var a=r,s=r*o/i;else s=r,a=r*i/o}else{var l=Math.sqrt(Math.abs(this.editPlane.width*this.editPlane.height)/(i*o));a=l*i*(this.editPlane.width<0?-1:1),s=l*o*(this.editPlane.height<0?-1:1)}this.editPlane.scale.setX(a/Je.overlay.width),this.editPlane.scale.setY(s/Je.overlay.height),this.editPlane.width=a,this.editPlane.height=s,this.updateOverlayScaleDisplay()}}},{key:"overlayUploaded",value:function(e,t){var n=this.editPlane.plane;t.style.width="100%",t.style.height="100%",t instanceof HTMLVideoElement?(n.material.map=new THREE.VideoTexture(t),n.material.map.image.play(),this.editPlane.overlayType="video",t.autoplay=!0,t.loop=!0,t.volume=0,t.muted=!0):(n.material.map=new THREE.Texture(t),n.material.map.needsUpdate=!0,this.editPlane.overlayType="photo"),n.material.map.minFilter=THREE.LinearFilter,this.useImgRatio(),this.editPlane.file=e,n.material.opacity=1,n.material.color=new THREE.Color(1,1,1),n.material.needsUpdate=!0,this.VideoManager.emit("videos/panel/updatePoster",t),this.editPlane.frame&&this.editPlane.frame.update({mode:"scale"})}},{key:"getOverlaySavingInfo",value:function(){var e=this.editPlane;if(e.file||e.plane.material.map&&e.plane.material.map.image){var t={width:he.toPrecision(e.width,4),height:he.toPrecision(e.height,4),depth:he.toPrecision(e.depth,4),pos:he.toPrecision(e.position.toArray(),4),qua:he.toPrecision(e.quaternion.toArray(),4),reverse:e.scale.x<0,sid:e.sid,media:[e.overlayType],hide:e.isHidden,floorIndex:e.floor.floorIndex,frameType:e.frame&&e.frame.type,limitToOnlyPano:e.limitToOnlyPano&&e.limitToOnlyPano.id},n=this;return{data:t,type:"new"==e.modified?1:0,needSaveMedia:!e.info||e.file!=e.info.file,done:function(){try{e.modified=!1,e.visiblePanos=tt.getVisiblePano(e.position,n.player.model),n.updateOverlayInfo(e)}catch(e){console.error(e)}}}}}},{key:"disposeOverlay",value:function(e){if(e==this.player.OverlayManager.hoveringPlane&&this.player.OverlayManager.hoverOverlay(null,"soon"),e.plane.material.map){var t=e.plane.material.map.image;t&&t.load&&(t.src="",t.load())}e.dispose(),e.modified="delete",e.frame&&e.frame.dispose()}},{key:"DeleteOverlay",value:function(e,t){var n=this;t(e.sid,(function(){n.disposeOverlay(e),n.controlSelectOverlay(null)}))}}]),n}();function gs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("store",(function(){return function(e){f(r,e);var t,n,i=gs(r);function r(){var e;return o(this,r),(e=i.call(this)).__store={},e}return u(r,[{key:"get",value:function(){var e=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n&&(this.$app.resource.reload=!0),!this.__store[t]||n){e.next=3;break}return e.abrupt("return",this.__store[t]);case 3:if(i=null,"function"!=typeof this.$app.resource[t]){e.next=8;break}return e.next=7,this.$app.resource[t]();case 7:i=e.sent;case 8:return this.$app.resource.reload=!1,e.abrupt("return",i||this.__store[t]);case 10:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"getAppImage",value:(n=k(S.mark((function e(t){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.__store[t]){e.next=2;break}return e.abrupt("return",this.__store[t]);case 2:return e.next=4,this.$app.resource.getAppImage(t);case 4:return e.abrupt("return",this.__store[t]);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getUserImage",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.__store[t]||n){e.next=2;break}return e.abrupt("return",this.__store[t]);case 2:return e.next=4,this.$app.resource.getUserImage(t);case 4:return e.abrupt("return",this.__store[t]);case 5:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getValue",value:function(e){return this.__store[e]}},{key:"setValue",value:function(e,t,n){if(void 0===e||void 0===t)return this;var i=this.__store[e];return i&&(i[t]=n,this.emit(e,i,t)),this}},{key:"set",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)return this;n&&(this.__store[e]=t),this.emit(e,t)}}]),r}(vo)}));var As,ys,Es={WalkManger:{enter:'单击<img src="'.concat($n.getImageURL("images/roam/roam_checked.png"),'" crossorigin="anonymous">设置选中点位漫游可行。'),firstPointLimit:"初始点位无法隐藏。",link:"漫游到选中点位时,操作点位可以行走。",unLink:"漫游到选中点位时,操作点位不可行走。",show:"该点位已显示",hide:"已隐藏该点位,漫游时将不再显示",deactive:'单击<img src="'.concat($n.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">设置点位漫游可行。'),activeHidePoint:'该点位已隐藏,点击<img src="'.concat($n.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">可显示。')},TagManger:{unLink:"在该点位漫游时不再显示选中热点。"}};function ws(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var bs=function(){function e(t){o(this,e),this.player=t,this.setPanoVisible=!1,this.setMultiFloorPanoVisible=!1,this.setTagVisible=!1,this.footIcons,this.actionIcons,this.activePano,this.panoVLines={},this.panoVTemp,this.tagVsetting,this.tagsVLines={},this.tagVTemp,this.linkToFloorPano,As=t.model.panos.list.filter((function(e){return e.isAligned()})),ys=t.model.panos.index}return u(e,[{key:"init",value:function(){var e=this;this.inited||(this.footTex1=$n.load($n.getImageURL("images/End_256.png")),this.footTex2=$n.load($n.getImageURL("images/End_unable_256.png")),this.footTex1_v=$n.load(this.player.$app.resource.getAppURL("images/video_256.png")),this.footTex2_v=$n.load(this.player.$app.resource.getAppURL("images/video_unable_256.png")),this.footTex5=$n.load($n.getImageURL("images/mutil_connect_upper.png")),this.footTex6=$n.load($n.getImageURL("images/mutil_connect_lower.png")),this.actionVisiTex0=$n.load($n.getImageURL("images/roam/roam_invisible.png")),this.actionVisiTex1=$n.load($n.getImageURL("images/roam/roam_visible.png")),this.actionLinkTex0=$n.load($n.getImageURL("images/roam/roam_uncheck.png")),this.actionLinkTex1=$n.load($n.getImageURL("images/roam/roam_checked.png")),this.ifAllPanoNoNeighbor(),this.meshGroup=new THREE.Object3D,this.meshGroup.name="setVisible-group",this.player.model.add(this.meshGroup),this.player.model.on("floor.changed",(function(t,n){(e.setTagVisible||e.setPanoVisible)&&e.gotoFloor(t.floorIndex)})),this.player.on("collectIntersectMesh",(function(t){e.footIcons&&(e.setPanoVisible||e.setTagVisible)&&t.push.apply(t,H(e.footIcons))})),this.player.on("judgeIntersect",(function(t,n){(n.getConsumed()||e.setPanoVisible||e.setTagVisible)&&(t&&"FootIcon"==t.object.type?os.add("hoverFootMarker"):os.remove("hoverFootMarker"),n.consume())})),this.inited=!0)}},{key:"enterSet",value:function(e){var t=this;if(this.init(),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.enter",content:Es.WalkManger.enter,showClose:!0}),"panoVisible"==e){if(!this.player.modeTran)return void(this.player.afterCModeFuc=function(){t.enterSet(e)});this.setPanoVisible=!0,this.player.flyoutType="beginSetPanoVisible",this.beginSetPanoVisible(),setTimeout((function(){t.player.flyToMode("floorplan",(function(){t.updateFootIconSize(),t.focusFloor()}))}),10)}else this.beginSetTagVisible(),this.player.flyToMode("floorplan",(function(){t.focusFloor()}))}},{key:"toggle",value:function(e){var t=this,n=this.activePano;if(e){var i=Ae.sortByScore(As,[function(e){return e.isAligned()}],[function(e){return-e.position.distanceTo(n.position)}]);if(1==i.length)return void console.log("仅有一个漫游点");var o=[],r=Math.max(2*-i[1].score,4);if("all"==e)(o=i.filter((function(e){return 0!=e.score&&e.item.footIcon.visible}))).forEach((function(e){return t.panoVLines[e.item.id]&&t.panoVLines[e.item.id].visible||t.dealPanoVisible(e.item.id)}));else{for(var a=function(e,t){var n=e.position.clone(),i=t.position.clone();return tt.ifIntersectChunks(n,i,{})},s=1;s<i.length;s++)if(-i[s].score<r)a(n,i[s].item)&&(i[s].block=!0),i[s].good=!0;else{if(o||(o=i.filter((function(e){return e.good&&!e.block}))),!(o.length<2))break;if(!a(n,i[s].item))if(0==o.length)o.push(i[s]);else{var l=o[0].item.position.clone().sub(n.position).setY(0),c=i[s].item.position.clone().sub(n.position).setY(0);if(l.angleTo(c)>Math.PI/2){console.log("再加一个 角度"+THREE.MathUtils.radToDeg(l.angleTo(c)));break}}}0==o.length&&o.push(i[0]),o.forEach((function(e){return t.dealPanoVisible(e.pano.id)}))}console.log(o)}else{if(this.player.$app.core.get("Scene").firstView.pano==this.activePano)return this.player.$app.WalkManager.emit(this.checkLinkStatus()),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Es.WalkManger.firstPointLimit,showClose:!0}),!1;for(var u in this.panoVLines)this.panoVLines[u].visible&&this.dealPanoVisible(u)}return this.checkFloorLinkStatus(),!0}},{key:"setDisplay",value:function(e){if(this.player.path.currentPanoMarker.mesh.visible=!e,this.player.OverlayManager&&this.player.OverlayManager.setGroupVisible(!e),this.player.reticule.visible=!e,this.player.emit("linkEditorSetVisible",e),!e&&this.footIcons)for(var t=0;t<this.footIcons.length;t++){var n=this.footIcons[t].pano.label._oriScale;if(null==n)break;this.footIcons[t].pano.marker.add(this.footIcons[t].pano.label),this.footIcons[t].pano.label.scale.set(n,n,n),delete this.footIcons[t].pano.label._oriScale,this.footIcons[t].pano.label.sprite.material.color.set("#fff"),this.footIcons[t].pano.label.sprite.material.opacity=1}}},{key:"beginSetPanoVisible",value:function(){this.panoVTemp={},this.player.currentPano.floor!=this.player.model.currentFloor&&this.player.gotoFloor(this.player.currentPano.floor.floorIndex),this.SetOnePanoVisible(this.player.currentPano),this.setDisplay(!0),this.player.$app.WalkManager.emit(this.checkLinkStatus(),"enter")}},{key:"SetOnePanoVisible",value:function(e){this.activePano!=e&&(this.activePano=e,this.delVisibleLines(),this.showFootIcons(e,!0),this.createPanoVisiLines(e))}},{key:"checkPanoVisiChange",value:function(){if(Object.keys(this.panoVTemp).length)return!0;for(var e in this.panoVLines){var t=this.panoVLines[e];if(t.name.indexOf("new")>-1&&t.visible)return!0;if(-1==t.name.indexOf("new")&&!t.visible)return!0}return!1}},{key:"saveLastPanoVi",value:function(e){if(e=e||this.activePano){var t=[];for(var n in this.panoVLines){var i=this.panoVLines[n];i.name.indexOf("new")>-1&&i.visible?t.push({type:"add",id:n}):-1!=i.name.indexOf("new")||i.visible||t.push({type:"sub",id:n})}if(t.length){var o=e.id;this.savePanoVisiChange(o,t)}}}},{key:"savePanoVisiChange",value:function(e,t){for(var n=this.searchNeib(e),i=n.seeMarkers,o=n.neighbourUUIDs,r=n.neighbourPanos,a=0;a<t.length;a++){var s,l=this.searchNeib(t[a].id),c=l.seeMarkers,u=l.neighbourUUIDs,h=l.neighbourPanos;if("add"==t[a].type)c.push(e),u.push(e),h[e]=!0,i.push(t[a].id),o.push(t[a].id),r[t[a].id]=!0;else(s=c.indexOf(e))>-1&&c.splice(s,1),(s=u.indexOf(e))>-1&&u.splice(s,1),h[e]=!1,(s=i.indexOf(t[a].id))>-1&&i.splice(s,1),(s=o.indexOf(t[a].id))>-1&&o.splice(s,1),r[t[a].id]=!1;this.panoVTemp[t[a].id]={neighbourPanos:h,seeMarkers:c,neighbourUUIDs:u}}this.panoVTemp[e]={neighbourPanos:r,seeMarkers:i,neighbourUUIDs:o}}},{key:"pauseSetPanoVisible",value:function(e,t){var n=this;this.setPanoVisible&&("unsaved"==e?this.saveLastPanoVi():(this.panoVTemp={},this.startEditPano=null),this.delVisibleLines(),this.activePano=null,this.showFootIcons(null,!0,t),As.forEach((function(e){return n.changeIconVisiState(e.footIcon,n.checkHasNeighbor(e))})))}},{key:"finishSetPanoVisible",value:function(){this.setPanoVisible&&(this.setPanoVisible=!1,this.hideFootIcons(),this.delVisibleLines(),this.recoverAllState2(),this.activePano=null,this.startEditPano=null,this.panoVTemp={},this.player.flyoutType=null,this.setDisplay(!1),os.remove("hoverFootMarker"))}},{key:"savePanoVisibles",value:function(e){this.activePano&&this.saveLastPanoVi(this.activePano);var t=[];for(var n in this.panoVTemp)t.push({panoID:n,visibles:this.turnToPanoIndex(this.panoVTemp[n].seeMarkers),visibles3:this.turnToPanoIndex(this.panoVTemp[n].neighbourUUIDs)});if(0!=t.length)return t;console.warn("PanoLink没有改变")}},{key:"afterSavePanoVisibles",value:function(){var e=this;for(var t in this.panoVTemp){var n=ys[t];n.seeMarkers=this.panoVTemp[t].seeMarkers,n.neighbourUUIDs=this.panoVTemp[t].neighbourUUIDs,n.neighbourPanos=this.panoVTemp[t].neighbourPanos}var i=this;if(this.checkHasNeighbor(this.player.currentPano))this.noPanoHasNeighbor=!1;else{var o=Ae.sortByScore(As,[function(t){return e.checkHasNeighbor(t)}],[function(e){return-e.position.distanceTo(i.player.currentPano.position)}]);o&&o.length?(this.player.currentPano=o[0].item,this.noPanoHasNeighbor=!1):this.noPanoHasNeighbor=!0}this.pauseSetPanoVisible(),this.player.$app.WalkManager.emit("walkManager.deactive"),this.updateFootIconSize()}},{key:"searchNeib",value:function(e){var t={};return this.panoVTemp[e]?(t.seeMarkers=this.panoVTemp[e].seeMarkers,t.neighbourUUIDs=this.panoVTemp[e].neighbourUUIDs,t.neighbourPanos=this.panoVTemp[e].neighbourPanos):(t.seeMarkers=ys[e].seeMarkers.slice(0),t.neighbourUUIDs=ys[e].neighbourUUIDs.slice(0),t.neighbourPanos=Ae.CloneObject(ys[e].neighbourPanos)),t}},{key:"turnToPanoIndex",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=ys[e[n]],o=As.indexOf(i);t.push(o)}return t}},{key:"beginSetTagVisible",value:function(){this.setTagVisible||(this.setTagVisible=!0,this.tagVTemp={},this.setDisplay(!0))}},{key:"SetOneTagVisible",value:function(e){this.tagVsetting!=e&&(this.tagVsetting&&this.saveLastTagVi(this.tagVsetting),this.tagVsetting=e,this.delVisibleLines(),this.showFootIcons(),this.createTagVisiLines(e),this.updateFootIconSize(),this.player.$app.TagManager.emit(this.checkTagLinkStatus()))}},{key:"checkTagVisiChange",value:function(){if(Object.keys(this.tagVTemp).length)return!0;for(var e in this.tagsVLines){var t=this.tagsVLines[e];if(t.name.indexOf("new")>-1&&t.visible)return!0;if(-1==t.name.indexOf("new")&&!t.visible)return!0}return!1}},{key:"checkTagLinkStatus",value:function(){var e=Object.values(this.tagsVLines).filter((function(e){return e.visible}));return this.footIcons.filter((function(e){return e.visible})).length==e.length?"tagManager.linkAll":0==e.length?"tagManager.linkNone":"tagManager.linkSome"}},{key:"saveLastTagVi",value:function(){var e=!1,t=this.tagVTemp[this.tagVsetting.sid]||this.tagVsetting.visiblePanos.slice(0);for(var n in this.tagsVLines){var i=this.tagsVLines[n];if(i.name.indexOf("new")>-1&&i.visible)t.push(ys[n]),e=!0;else if(-1==i.name.indexOf("new")&&!i.visible){var o=t.map((function(e){return e.id})).indexOf(n);if(-1==o){console.log("visiblePanos删除error");continue}t.splice(o,1),e=!0}}e&&(this.tagVTemp[this.tagVsetting.sid]=t)}},{key:"pauseSetTagVisible",value:function(e){this.setTagVisible&&this.tagVsetting&&("unsaved"==e?this.saveLastTagVi(this.tagVsetting):this.tagVTemp={},this.delVisibleLines(),this.hideFootIcons(),this.tagVsetting=null)}},{key:"finishSetTagVisible",value:function(){this.setTagVisible&&(this.pauseSetTagVisible(),this.setTagVisible=!1,this.setDisplay(!1))}},{key:"saveTagVisibles",value:function(){this.tagVsetting&&this.saveLastTagVi(this.tagVsetting);var e=[];for(var t in this.tagVTemp)e.push({sid:t,value:this.tagVTemp[t].filter((function(e){return!!e})).map((function(e){return e.id}))});return e}},{key:"afterSaveTagVisibles",value:function(){this.finishSetTagVisible()}},{key:"createTagVisiLines",value:function(e){var t=this;(this.tagVTemp[e.sid]||e.visiblePanos).forEach((function(n){t.createTagSingleLine(n,"old",e)}))}},{key:"createTagSingleLine",value:function(e,t,n){var i=ui.createLine([e.floorPosition.clone(),n.position.clone()],{color:xe.green});this.meshGroup.add(i),i.name="tagVL-"+t+"-"+e.id,this.tagsVLines[e.id]=i,i.material.opacity=e.floor.floorIndex==this.player.model.currentFloor.floorIndex?1:.4,this.changeIconLinkState(ys[e.id].footIcon,"linked")}},{key:"dealTagVisible",value:function(e,t){this.tagsVLines[t]?(this.tagsVLines[t].visible=!this.tagsVLines[t].visible,this.changeIconLinkState(ys[t].footIcon,!!this.tagsVLines[t].visible&&"linked"),this.tagsVLines[t].visible||this.player.$app.gui.toast({event:"DialogList3D.TagManger.unLink",content:Es.TagManger.unLink,showClose:!0})):this.createTagSingleLine(ys[t],"new",e),this.player.$app.TagManager.emit(this.checkTagLinkStatus())}},{key:"setTagHideAll",value:function(e){var t=this;Object.keys(this.tagsVLines).forEach((function(e){t.tagsVLines[e].visible=!1,t.changeIconLinkState(ys[e].footIcon,!1)}))}},{key:"setTagShowAll",value:function(e){var t=this;this.footIcons.filter((function(e){return e.visible})).forEach((function(n){var i=n.pano.id;t.tagsVLines[i]?(t.tagsVLines[i].visible=!0,t.changeIconLinkState(ys[i].footIcon,"linked")):t.createTagSingleLine(ys[i],"new",e)}))}},{key:"delVisibleLines",value:function(){for(var e in this.tagsVLines)this.tagsVLines[e].geometry.dispose(),this.tagsVLines[e].material.dispose(),this.meshGroup.remove(this.tagsVLines[e]),delete this.tagsVLines[e];for(var e in this.panoVLines)this.panoVLines[e].geometry.dispose(),this.panoVLines[e].material.dispose(),this.meshGroup.remove(this.panoVLines[e]),delete this.panoVLines[e]}},{key:"createPanoVisiLines",value:function(e,t){var n=this.panoVTemp[e.id]&&this.panoVTemp[e.id].neighbourPanos||e.neighbourPanos;for(var i in n)n[i]&&i!=e.id&&!i.includes("view360_")&&this.createPanoSingleLine(e,"old",i)}},{key:"createPanoSingleLine",value:function(e,t,n){var i=ys[n];if(!i.panoType){var o=i.floorPosition.clone(),r=ui.createLine([e.floorPosition.clone(),o],{color:xe.green,deshed:i.floorIndex!=e.floorIndex});this.meshGroup.add(r),r.name="PanoVL-"+t+"-"+n,i.floorIndex!=e.floorIndex&&(r.material.opacity=.5),this.panoVLines[n]=r,this.activePano&&(i.floorIndex!=e.floorIndex?this.changeIconLinkState(ys[n].footIcon,"otherFloorLink"):this.changeIconLinkState(ys[n].footIcon,"linked"))}}},{key:"dealPanoVisible",value:function(e,t){var n=this;if(this.setMultiFloorPanoVisible){if(this.linkToFloorPano){var i=this.linkToFloorPano.footIcon;this.changeIconLinkState(i,!1),this.changeFloorIconState(i)||(i.status="visible",i.material.uniforms.map.value=this.linkToFloorPano.hasVideo?this.footTex1_v:this.footTex1)}else this.player.$app.WalkManager.emit("walkManager.multiFloorLinking",!0);this.linkToFloorPano=t.pano,this.changeIconLinkState(t,"center"),"upper"==this.setMultiFloorPanoVisible?(t.status="floor",t.material.uniforms.map.value=this.footTex6):(t.status="floor",t.material.uniforms.map.value=this.footTex5)}else if(t&&"FootIcon"==t.type)this.activePano?e==this.activePano.id?(this.startEditPano||(this.startEditPano=this.activePano),this.player.$app.WalkManager.emit("walkManager.deactive"),this.pauseSetPanoVisible("unsaved"),this.actionIcons.forEach((function(e){return e.material.map="invisible"==e.footIcon.status?n.actionVisiTex0:n.actionVisiTex1})),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.deactive",content:Es.WalkManger.deactive})):(this.lastFloorActivePano=null,this.pauseSetPanoVisible("unsaved"),this.SetOnePanoVisible(ys[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus())):(this.lastFloorActivePano=null,this.SetOnePanoVisible(ys[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus()));else if(!t||"ActionIcon"==t.type)if(this.activePano){var o;if(this.panoVLines[e]?(this.panoVLines[e].visible=!this.panoVLines[e].visible,o=this.panoVLines[e].visible,this.changeIconLinkState(ys[e].footIcon,ys[e].footIcon.visible?!!this.panoVLines[e].visible&&"linked":"otherFloorLink")):(this.createPanoSingleLine(this.activePano,"new",e),o=!0),this.startEditPano||(this.startEditPano=this.activePano),o)this.changeIconVisiState(ys[e].footIcon,!0),this.changeIconVisiState(this.activePano.footIcon,!0),t&&"ActionIcon"==t.type&&this.player.$app.WalkManager.emit(this.checkLinkStatus());else{var r=this.player.$app.core.get("Scene").firstView.pano;if(ys[e].floorIndex!=this.activePano.floorIndex)ys[e].footIcon.visible=!1;else{var a=this.checkHasNeighbor(ys[e]);this.changeIconVisiState(ys[e].footIcon,a)}var s=this.checkHasNeighbor(this.activePano);if(this.changeIconVisiState(this.activePano.footIcon,s),t&&"ActionIcon"==t.type){if(this.player.$app.WalkManager.emit(this.checkLinkStatus()),!s&&this.activePano==r)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Es.WalkManger.firstPointLimit}),void this.dealPanoVisible(e,t);s||this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:Es.WalkManger.hide})}}}else{if("invisible"==t.footIcon.status){if(this.panoVTemp[e]){var l=Object.keys(this.panoVTemp[e].neighbourPanos).filter((function(t){return!t.includes("view360_")&&t!=e})),c=l.filter((function(e){return n.checkHasNeighbor(ys[e])}));l=c.length?c:l.slice(0,1);var u=[];l.forEach((function(e){u.push({type:"add",id:e})})),this.savePanoVisiChange(e,u)}else{var h=tt.getVisiblePano(ys[e].position,this.player.model).map((function(e){return e.id})).filter((function(t){return t!=e}));if(0==h.length){var d=Ae.sortByScore(As,[function(e){return e.isAligned()}],[function(t){return-t.position.distanceTo(ys[e].position)}]),p=d.map((function(e){return e.item})).find((function(e){return n.checkHasNeighbor(e)}));h=p?[p.id]:[d[0].item.id]}else{var f=h.filter((function(e){return n.checkHasNeighbor(ys[e])}));h=f.length?f:h.slice(0,1)}var m=[];h.forEach((function(e){return m.push({type:"add",id:e})})),this.savePanoVisiChange(e,m)}this.player.$app.gui.toast({event:"DialogList3D.WalkManger.show",content:Es.WalkManger.show})}else{if(this.player.$app.core.get("Scene").firstView.pano.footIcon==t.footIcon)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Es.WalkManger.firstPointLimit}),!1;this.createPanoVisiLines(ys[e],!0),Object.values(this.panoVLines).forEach((function(e){e.visible=!1})),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:Es.WalkManger.hide}),this.saveLastPanoVi(ys[e]),this.delVisibleLines()}As.forEach((function(e){return n.changeIconVisiState(e.footIcon,n.checkHasNeighbor(e))}))}this.updateFootIconSize()}},{key:"showFootIcons",value:function(e,t,n){var i=this;if(!this.footIcons){this.footIcons=[],this.actionIcons=[];var o=.4;o*=40/Math.sqrt(Math.min(this.player.domElement.clientWidth,this.player.domElement.clientHeight)),o=THREE.MathUtils.clamp(o,.3,.7);var r=new THREE.PlaneGeometry(o,o,1,1),a=r.clone();a.scale(.5,.5,.5),As.forEach((function(e){var t=new Cs(r,e);t.material.uniforms.map.value=e.hasVideo?i.footTex1_v:i.footTex1,t.visible=!1,e.footIcon=t;var n=new xs(t,a,e);n.material.map=i.actionLinkTex0,t.actionIcon=n,i.meshGroup.add(t),t.add(n),i.footIcons.push(t),i.actionIcons.push(n)}))}n=n||this.player.model.currentFloor,As.forEach((function(o){if(o.label.parent!=o.footIcon){o.label._oriScale=o.label.scale.x;var r=1.65*o.label.scale.x;o.label.scale.set(r,r,r),o.footIcon.add(o.label),o.footIcon.label=o.label}if(o.floor==n)o.footIcon.visible=!0,i.changeIconLinkState(o.footIcon,!1),t&&i.changeIconVisiState(o.footIcon,i.checkHasNeighbor(ys[o.id],"beforeCreateLine")),e&&o==e?(o.footIcon.oriScale=new THREE.Vector3(1.5,1.5,1.5),t&&i.changeIconLinkState(o.footIcon,"center")):(o.footIcon.oriScale=new THREE.Vector3(1,1,1),o.footIcon.actionIcon.visible=!0);else{var a=(i.panoVTemp&&i.panoVTemp[o.id]?i.panoVTemp[o.id].neighbourUUIDs:o.neighbourUUIDs).filter((function(t){return e&&t==e.id}));o.footIcon.oriScale=new THREE.Vector3(1,1,1),a.length>0?(t&&i.changeFloorIconState(o.footIcon),i.changeIconLinkState(o.footIcon,"otherFloorLink")):o.footIcon.visible=!1}}))}},{key:"checkHasNeighbor",value:function(e,t){var n=this.panoVTemp&&this.panoVTemp[e.id]?this.panoVTemp[e.id].neighbourPanos:e.neighbourPanos;if("beforeCreateLine"==t||e!=this.activePano){for(var i in n)if(i!=e.id&&!isNaN(parseInt(i))&&n[i]){if(this.activePano&&this.activePano.id==i&&this.panoVLines[e.id]&&!this.panoVLines[e.id].visible)continue;if(this.activePano==e&&this.panoVLines[i]&&!this.panoVLines[i].visible)continue;return!0}return!1}for(var i in this.panoVLines)if(this.panoVLines[i].visible)return!0}},{key:"getCurNeighbors",value:function(e){var t=this.panoVTemp&&this.panoVTemp[e.id]?this.panoVTemp[e.id].neighbourPanos:e.neighbourPanos,n=[];for(var i in t)if(i!=e.id&&!isNaN(parseInt(i))&&t[i]){if(this.activePano&&this.activePano.id==i&&this.panoVLines[e.id]&&!this.panoVLines[e.id].visible)continue;if(this.activePano==e&&this.panoVLines[i]&&!this.panoVLines[i].visible)continue;n.push(i)}return n}},{key:"ifAllPanoNoNeighbor",value:function(){for(var e in ys)if(ys[e].isAligned()&&this.checkHasNeighbor(ys[e]))return!1;return this.noPanoHasNeighbor=!0,!0}},{key:"changeIconLinkState",value:function(e,t){if(e){var n;e.otherFloorLink=!1,"linked"==t&&(n=xe.green,e.actionIcon.material.map=this.actionLinkTex1),"otherFloorLink"==t&&(n=xe.yellow,e.actionIcon.visible=!1,e.material.uniforms.opacity.value=.5,e.label.sprite.material.opacity=.5,e.visible=!0,e.otherFloorLink=!0),"center"==t&&(n=xe.yellow,e.actionIcon.visible=!1),0==t&&(n="#fff",e.actionIcon.material.map=this.actionLinkTex0);try{e.material.uniforms.color.value.set(n),e.label.sprite.material.color.set(n)}catch(e){console.log(e)}}}},{key:"checkLinkStatus",value:function(){this.checkFloorLinkStatus();var e=Object.values(this.panoVLines).filter((function(e){return e.visible}));return this.footIcons.filter((function(e){return e.visible})).length==e.length+1?"walkManager.linkAll":0==e.length?"walkManager.linkNone":"walkManager.linkSome"}},{key:"changeIconVisiState",value:function(e,t){e&&(e.pano==this.player.$app.core.get("Scene").firstView.pano&&(t=!0),t?(e.status="visible",e.material.uniforms.map.value=e.pano.hasVideo?this.footTex1_v:this.footTex1,this.activePano||(e.actionIcon.material.map=this.actionVisiTex1),e.otherFloorLink||(e.material.uniforms.opacity.value=1,e.label.sprite.material.opacity=1),this.changeFloorIconState(e)):(e.status="invisible",e.material.uniforms.map.value=e.pano.hasVideo?this.footTex2_v:this.footTex2,this.activePano||(e.actionIcon.material.map=this.actionVisiTex0),this.activePano&&this.activePano.id==e.name?(e.material.uniforms.opacity.value=1,e.label.sprite.material.opacity=1,this.player.$app.gui.toast({event:"DialogList3D.WalkManger.activeHidePoint",content:Es.WalkManger.activeHidePoint})):(e.material.uniforms.opacity.value=.5,e.label.sprite.material.opacity=.5)))}},{key:"changeFloorIconState",value:function(e){var t=this;if(e){var n=ys[e.name],i=(this.panoVTemp&&this.panoVTemp[n.id]?this.panoVTemp[n.id].neighbourUUIDs:n.neighbourUUIDs).filter((function(e){return ys[e].floorIndex!=n.floorIndex&&(!t.activePano||!t.panoVLines[e]||t.panoVLines[e].visible)})).map((function(e){return ys[e].floor}));return!!i.length&&(this.getFloorOrder(i[0])>this.getFloorOrder(n.floor)?(e.status="floor",e.material.uniforms.map.value=this.footTex5):this.getFloorOrder(i[0])<this.getFloorOrder(n.floor)&&(e.status="floor",e.material.uniforms.map.value=this.footTex6),!0)}}},{key:"getClosestOtherFloorPano",value:function(e,t){return this.player.model.panos.closestPanoTowardPoint({point:e.position,getAll:!0}).map((function(e){return e.pano})).filter((function(n){return"up"==t?n.floorIndex>e.floorIndex:n.floorIndex<e.floorIndex}))[0]}},{key:"checkFloorLinkStatus",value:function(){var e=this,t="walkManager.unlinkFloor",n=(this.panoVTemp[this.activePano.id]&&this.panoVTemp[this.activePano.id].neighbourUUIDs||ys[this.activePano.id].neighbourUUIDs).map((function(e){return ys[e]})).filter((function(t){return t.floorIndex!=e.activePano.floorIndex&&(!e.activePano||!e.panoVLines[t.id]||e.panoVLines[t.id].visible)}))[0];n&&this.getFloorOrder(n.floor)>this.getFloorOrder(this.activePano.floor)&&(t="walkManager.linkUpperFloor"),n&&this.getFloorOrder(n.floor)<this.getFloorOrder(this.activePano.floor)&&(t="walkManager.linkLowerFloor"),this.player.$app.WalkManager.emit(t)}},{key:"getFloorOrder",value:function(e){return this.player.$app.store.getValue("flooruser").floors.find((function(t){return t.subgroup==e.floorIndex})).id}},{key:"getFloor",value:function(e,t){this.player.model.floors.index[e];var n=this.player.$app.store.getValue("flooruser").floors,i=n.find((function(t){return t.subgroup==e})),o="upper"==t?i.id+1:i.id-1,r=n.find((function(e){return e.id==o}));return console.log("getFloor",t,e,r.subgroup),r.subgroup}},{key:"recoverAllState2",value:function(){for(var e=0;e<this.footIcons.length;e++)this.footIcons[e].material.uniforms.opacity.value=1,this.footIcons[e].label.sprite.material.opacity=1,this.footIcons[e].material.uniforms.map.value=this.footIcons[e].pano.hasVideo?this.footTex1_v:this.footTex1}},{key:"hideFootIcons",value:function(){if(this.footIcons)for(var e=0;e<this.footIcons.length;e++)this.footIcons[e].visible=!1,this.footIcons[e].actionIcon.visible=!0}},{key:"updateFootIconSize",value:function(){if(this.footIcons){var e=he.getScaleForConstantSize({width2d:240,position:new THREE.Vector3,camera:this.player.camera,dom:this.player.$app.dom}),t=this.player;e=THREE.MathUtils.clamp(e,.6,2.5),this.footIcons.forEach((function(n){n.visible&&n.scale.copy(n.oriScale).multiplyScalar(e),n.quaternion.copy(t.quaternion)}))}}},{key:"resetTagVisiByModel",value:function(){var e=[];for(var t in objects.tagManager.tags){var n=objects.tagManager.tags[t];if("videoPanoFlag"!=n.state){var i=n.getVisiblePanos();e.push({sid:n.sid,value:i})}}return e}},{key:"afterResetTagVisibles",value:function(e){e.forEach((function(e){objects.tagManager.tags[e.sid].setVisiblePanos(e.value)})),"panorama"==objects.player.mode&&objects.tagManager.updateVisible("panorama")}},{key:"resetVisiblesByModel",value:function(){this.resetTagVisiByModel()}},{key:"gotoFloor",value:function(e){var t=this;if(this.player.model.currentFloor.floorIndex==e){var n=this.player.model.floors.index[e];if(this.activePano&&(this.lastFloorActivePano=this.activePano),this.setTagVisible){if(this.tagVsetting)for(var i in this.hideFootIcons(),this.showFootIcons(),this.tagsVLines)ys[i].floor.floorIndex==this.player.model.currentFloor.floorIndex&&this.tagsVLines[i].visible?(this.tagsVLines[i].material.opacity=1,this.changeIconLinkState(ys[i].footIcon,"linked")):this.tagsVLines[i].material.opacity=.4}else this.setPanoVisible&&(this.pauseSetPanoVisible("unsaved",n),setTimeout((function(){t.lastFloorActivePano&&t.lastFloorActivePano.floorIndex==e?(t.SetOnePanoVisible(t.lastFloorActivePano),t.player.$app.WalkManager.emit("walkManager.active",t.checkLinkStatus())):t.player.$app.WalkManager.emit("walkManager.deactive")}),1));this.focusFloor(n)}}},{key:"focusFloor",value:function(e){var t=(e=e||this.player.model.currentFloor).boundingBox.clone();this.setTagVisible&&this.player.$app.TagManager.tags.forEach((function(n){n.floorIndex==e.floorIndex&&t.expandByPoint(n.position)}));var n=t.getCenter(new THREE.Vector3),i=t.getSize(new THREE.Vector3);this.player.focusPoint({modelSize:i,aim:n})}}]),e}(),Cs=function(e){f(n,THREE.Mesh);var t=ws(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).geometry=e,r.material=new THREE.RawShaderMaterial({vertexShader:sn.waypoint.vertexShader,fragmentShader:sn.waypoint.fragmentShader,uniforms:THREE.UniformsUtils.clone(sn.waypoint.uniforms),transparent:!0,depthWrite:!1,depthTest:!1,name:"footIcon"}),r.material.uniforms.color.value.set("#ffffff"),r.renderOrder=Fe,r.type="FootIcon",r.name=i.id,r.pano=i,r.status="",r.position.copy(i.floorPosition.clone()),r.position.y/=100,r.lookAt(r.position.clone().add(new THREE.Vector3(0,1,0))),r}return n}(),xs=function(e){f(n,THREE.Mesh);var t=ws(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).geometry=i,a.material=new THREE.MeshPhongMaterial({transparent:!0,depthTest:!1,name:"footIcon"}),a.footIcon=e,a.renderOrder=Fe+1,a.type="ActionIcon",a.name=r.id,a.pano=r,a.position.set(.2,.2,1),a}return n}();function Is(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ts=function(e){f(n,THREE.EventDispatcher);var t=Is(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).player=e,r.position=i.pos,r.sid=i.sid,r.text=i.text||"",r.toPano=i.toPano,r.clickFun=i.clickFun,r.noLine=i.noLine,r.driftDir=i.driftDir,r.floorIndex=i.floorIndex,r.elem=document.createElement("div"),r.elem.className="room-label",r.elem.style.display="none",r.elem.innerHTML="<a><p><span>".concat(r.text,"</span></p></a>"),i.container?i.container.append(r.elem):document.querySelector(".widgets-doll-labels").append(r.elem),r.player.dollLabels.push(h(r)),r.elem.addEventListener("click",r.clickFuc.bind(h(r))),r.enable=!0,r.type="doll",r.pos2d=new THREE.Vector3,r.noLine&&(r.elem.className+=" noLine"),r.visible=!0,e.on("beginShowMonitor",(function(){Ae.updateVisible(h(r),"showMonitor",!1)})),e.on("leavedShowMonitor",(function(){Ae.updateVisible(h(r),"showMonitor",!0)})),r}return u(n,[{key:"changeText",value:function(e){this.elem.querySelector("span").innerHTML=this.text=e}},{key:"update",value:function(){if("dollhouse"!==this.player.mode||!this.enable||!this.visible||!this.text||this.player.model.currentFloor.floorIndex!=this.floorIndex&&!this.player.model.allFloorsVisible||this.player.EditOverlay&&this.player.EditOverlay.editing||this.player.linkEditor&&(this.player.linkEditor.setPanoVisible||this.player.linkEditor.setTagVisible))this.elem.style.display="none";else{var e=tt.getPos2d(this.position,this.player);if(e.trueSide)if(tt.ifShelter(this.position,this.player,{x:e.vector.x,y:e.vector.y},null,this.player.model.allFloorsVisible?null:this.floorIndex))this.elem.style.display="none";else{if(this.elem.style.display="",this.driftDir){var t=tt.getPos2d(this.position.clone().add(this.driftDir),this.player),n=this.elem.children[0].getBoundingClientRect(),i=he.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.position.distanceTo(this.player.camera.position),r=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()));this.elem.style.left=r.x+"px",this.elem.style.top=r.y+"px"}else this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px";this.pos2d=e.vector}else this.elem.style.display="none"}}},{key:"clickFuc",value:function(){this.toPano?this.player.flyToPano({pano:this.toPano}):this.clickFun&&this.clickFun()}},{key:"remove",value:function(){var e=this.elem.parentElement;e&&e.removeChild(this.elem);var t=this.player.dollLabels.indexOf(this);t>-1&&this.player.dollLabels.splice(t,1)}}]),n}();function Bs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ks,Ps=1.6,Rs=.2,Ms=new THREE.Vector3(0,0,-1),Ss=new THREE.MeshStandardMaterial({transparent:!0,color:new THREE.Color(1,1,1),opacity:.45,metalness:1,emissive:new THREE.Color(.85,.85,.85)}),Ds=Ss.clone();Ds.opacity=.9;var Fs=function(e){f(n,THREE.Object3D);var t=Bs(n);function n(e,i){var r;o(this,n),(r=t.call(this)).player=e;var a=r.createArrow();r.add(a),a.oriPosition=a.position.clone();for(var s=1;s<4;s++){var l=a.clone();l.position.setZ(1.8*s),l.oriPosition=l.position.clone(),r.add(l)}return r.name="entryArrow",e.model.add(h(r)),r.scale.set(Rs,Rs,Rs),r.setPosition(i),r.currentHighLight=0,r.traverse((function(e){e.renderOrder=Ne})),console.log("create entryArrow"),r}return u(n,[{key:"createArrow",value:function(){if(!ks){var e=[{x:0,y:0},{x:1,y:.8},{x:1,y:Ps},{x:0,y:.8},{x:-1,y:Ps},{x:-1,y:.8}],t=new THREE.Shape;t.moveTo(e[0].x,e[0].y);for(var n=1,i=e.length;n<i;n++)t.lineTo(e[n].x,e[n].y);t.lineTo(e[0].x,e[0].y),ks=new THREE.ExtrudeBufferGeometry(t,{depth:.4,bevelEnabled:!1})}var o=new THREE.Mesh(ks,Ss);return o.rotation.x=Math.PI/2,o}},{key:"setPosition",value:function(e){var t=new THREE.Vector3(e.points2d[0].x,e.bottom+.4*Rs,-e.points2d[0].y),n=new THREE.Vector3(e.points2d[1].x,e.bottom+.4*Rs,-e.points2d[1].y),i=t.clone().add(n).multiplyScalar(.5),o=t.clone().sub(n).normalize(),r=new THREE.Matrix4;r.set(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1),o.applyMatrix4(r);var a="LEFT"==e.openSide?o.multiplyScalar(-1):o;"reverse"==e.enter&&(i.add(a.clone().multiplyScalar(t.distanceTo(n))),a.multiplyScalar(-1)),this.enterDir=a,this.position.copy(i);var s=he.getQuaBetween2Vector(Ms,a,new THREE.Vector3(0,1,0));this.quaternion.copy(s),this.addLabel(i,a,e.floorIndex),this.entryPos=i}},{key:"addLabel",value:function(e,t,n){var i=this.player.model.panos.closestPanoTowardPoint({point:e});i||console.error("what!!! no closetPano");this.dollLabelOriPos=e.clone().sub(t.clone().multiplyScalar(1.4000000000000001));var o=new Ts(this.player,{sid:"entry",pos:this.dollLabelOriPos,driftDir:t,noLine:!0,text:W.i18n("model.enter"),toPano:i,floorIndex:n});this.player.defaultRoomLabels.push(o),this.dollLabel=o}},{key:"moveCloseToWall",value:function(e){this.children.forEach((function(t){t.position.z=t.oriPosition.z+e})),this.dollLabel.position=this.dollLabelOriPos.clone().sub(this.enterDir.clone().multiplyScalar(e*Rs))}},{key:"reSetHeight",value:function(e){this.position.setY(e),this.dollLabel.position.y=e,this.dollLabelOriPos.y=e}},{key:"animate",value:function(){var e=this;this.children.forEach((function(t,n){n==e.currentHighLight?t.material=Ds:t.material=Ss})),this.currentHighLight=(this.currentHighLight-1+this.children.length)%this.children.length,this.stopAnimation(),this.animation=setTimeout(this.animate.bind(this),200)}},{key:"stopAnimation",value:function(){clearTimeout(this.animation),this.animation=null}},{key:"dispose",value:function(){this.parent.remove(this),this.stopAnimation()}},{key:"show",value:function(){this.visible=!0,this.animate()}},{key:"hide",value:function(){this.visible=!1,this.stopAnimation()}}],[{key:"switchDepthTest",value:function(e){Ss.depthTest=e,Ds.depthTest=e}}]),n}(),Ls={forward:new THREE.Vector3(0,0,-1),back:new THREE.Vector3(0,0,1),left:new THREE.Vector3(-1,0,0),right:new THREE.Vector3(1,0,0)},Hs=function(){function e(t,n){o(this,e),this.player=t,this.position=n.pos,this.text=n.text||"",this.aim=n.aim,this.toPano=n.toPano,this.door=n.door,this.visiblePanos=n.visiblePanos,this.sameRoomPanos=n.sameRoomPanos,this.doorDir=n.doorDir,this.floorIndex=n.floorIndex,this.enable=null==n.enable||n.enable,this.elem=document.createElement("div"),this.elem.className="door show-arrow",this.elem.style.display="none",this.elem.innerHTML="<a>".concat(this.text,"</a>"),n.container?n.container.append(this.elem):document.querySelector(".widgets-doors").append(this.elem),this.player.doorLabels.push(this),this.elem.addEventListener("pointerup",this.clickFuc.bind(this)),this.type="door",this.pos2d=new THREE.Vector3,this.getDirection(),this.updateVisible()}return u(e,[{key:"updateVisible",value:function(e){e?this.sameRoomPanos.includes(e)||(this.enable=!1):this.visiblePanos.includes(this.player.currentPano)?this.enable=!0:this.enable=!1}},{key:"update",value:function(){if("panorama"!==this.player.mode||!this.enable||!this.text||Je.vrEnabled&&Je.vrSplitScreen||this.player.linkEditor&&(this.player.linkEditor.setPanoVisible||this.player.linkEditor.setTagVisible))this.elem.style.display="none";else{var e=tt.getPos2d(this.position,this.player);e.trueSide?(this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px",Je.vrEnabled?this.elem.style.transform="rotate("+window.screenFaceOrient+"deg)":this.elem.style.transform="",this.elem.style.display="",this.pos2d=e.vector):this.elem.style.display="none"}}},{key:"getDirection",value:function(){var t=e.getToward(this.doorDir);this.elem.className+=" "+t}},{key:"clickFuc",value:function(e){this.toPano?(e.stopPropagation(),this.player.flyToPano({pano:this.toPano,lookAtPoint:this.aim.clone().setY(this.toPano.position.y),duration:1800})):console.error("doorlabel没有toPano")}},{key:"remove",value:function(){this.elem.parentElement.removeChild(this.elem);var e=this.player.doorLabels.indexOf(this);e>-1&&this.player.doorLabels.splice(e,1)}}],[{key:"getToward",value:function(e){for(var t in Ls){var n=Ls[t].clone().dot(e.setY(0).normalize());if(Math.acos(n)<Math.PI/4)return t}console.warn("没有找到朝向..")}},{key:"updateCameraDir",value:function(t){if("panorama"==t.mode&&0!=t.doorLabels.length){var n=t.getDirection(),i=e.getToward(n);document.querySelector(".widgets-doors").setAttribute("data-camera-toward",i)}}}]),e}();z('#compass {\n display: none;\n position: absolute;\n width: 90px;\n height: 90px;\n pointer-events: none;\n}\n\n#compass .north {\n color: #02a0e9;\n top: 0;\n}\n#compass .south {\n color: #ff1414;\n bottom: 0;\n}\n\n#compass .dirText {\n text-align: center;\n font-size: 10px;\n position: absolute;\n line-height: 25px;\n\n color: rgb(255, 255, 255);\n top: 50%;\n left: 50%;\n width: 45%;\n height: 0px;\n transform-origin: left center;\n}\n\n#compass #dirTextX {\n color: rgb(255, 0, 0);\n}\n\n#compass #dirTextY {\n color: rgb(0, 255, 0);\n}\n\n#compass #dirTextZ {\n color: rgb(0, 0, 255);\n}\n\n#compass .dirText span {\n display: block;\n position: absolute;\n right: 5px;\n top: 0;\n width: 20px;\n height: 20px;\n line-height: 20px;\n margin-top: -10px;\n}\n\n#compass .center {\n width: 50px;\n height: 50px;\n background-size: contain;\n background-position: center;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n position: absolute;\n}\n#compass .center canvas{\n position: relative;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n background-color: transparent;\n}\n\n.widgets-doll-labels a, .widgets-plan-labels a, .widgets-doors a {\n color: #fff;\n font-size: 14px;\n line-height: normal;\n font-family: OpenSans,sans-serif;\n user-select: none;\n}\n\n.widgets-doll-labels .room-label {\n position: absolute;\n width: 0;\n height: 0;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-animation: room-label 0.3s ease 0.1s;\n animation: room-label 0.3s ease 0.1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n cursor: pointer;\n}\n\n.widgets-doll-labels .room-label:not(.noLine):after {\n content: "";\n display: block;\n position: absolute;\n width: 4px;\n height: 68px;\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABQCAYAAADYxx/bAAAASElEQVQYlY2QwQoAIAhDR///x6Z2CCaGSpfHNoegcHdfAGwBCKVUMdAMK7IKm2Wh2oSOdkaUhVbG3u++x7aqPbX9lWVEdn9/AGvVUp4wTpLmAAAAAElFTkSuQmCC");\n background-size: contain;\n background-repeat: no-repeat;\n bottom: 0;\n left: 50%;\n -webkit-transform: translate(-50%);\n transform: translate(-50%);\n}\n.widgets-doll-labels .room-label a {\n display: block;\n position: absolute;\n line-height: 22px;\n top: -66px;\n transform: translate(-50%, -100%);\n text-align: center;\n white-space: nowrap;\n font-size: 12px;\n font-style: normal;\n pointer-events: auto;\n \n background-repeat: no-repeat;\n background-size: 100% 100%;\n background: rgba(210, 210, 210, 0.7);\n border: 1px solid rgba(255, 255, 255, 0.4);\n border-radius: 3px; \n text-shadow: 0px 1px 3px rgb(0,0, 0, 0.5);\n}\n .widgets-doll-labels .room-label a::before {\n content: "";\n position: absolute;\n left: -1px;\n top: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n }\n .widgets-doll-labels .room-label a::after {\n content: "";\n position: absolute;\n left: -1px;\n bottom: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(270deg);\n }\n .widgets-doll-labels .room-label a > p {\n margin: 0;\n padding: 2px 10px;\n height: 100%;\n line-height: 1.5;\n }\n .widgets-doll-labels .room-label a > p::before {\n content: "";\n position: absolute;\n right: -1px;\n top: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(90deg);\n }\n .widgets-doll-labels .room-label a > p::after {\n content: "";\n position: absolute;\n right: -1px;\n bottom: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(180deg);\n }\n\n.widgets-doll-labels .room-label.noLine a {\n top: 16px;\n}\n\n.widgets-doll-labels .room-label a span {\n white-space: nowrap;\n user-select: none;\n}\n\n.widgets-doll-labels .room-label.with-entrance:after {\n display: none;\n}\n\n.widgets-doll-labels .room-label.with-entrance a {\n top: 50%;\n width: 38.5px;\n height: 15.75px;\n background-size: 38.5px 15.75px;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n}\n\n.widgets-doll-labels .room-label.with-entrance a span {\n margin-left: -0.875px;\n margin-top: -0.875px;\n}\n\n.widgets-plan-labels .room-label {\n position: absolute;\n -webkit-animation: room-label 0.3s ease 0.1s;\n animation: room-label 0.3s ease 0.1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n}\n\n.widgets-plan-labels .room-label a {\n display: block;\n position: absolute;\n line-height: 24px;\n -webkit-transform: translate(-50%);\n transform: translate(-50%, -50%);\n text-align: center;\n white-space: nowrap;\n font-size: 14px;\n font-style: normal;\n}\n\n.widgets-doors {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.left a:after,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.left a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.left a:after {\n content: "";\n display: inline-block;\n vertical-align: middle;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n margin-left: 4px;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before ,\n.widgets-doors[data-camera-toward=right] .door.show-arrow.back a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.back a:before,\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.right a:after {\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward=back] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.left a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.right a:after {\n content: "";\n display: inline-block;\n vertical-align: middle;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.back a:after {\n position: relative;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\n position: relative;\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after,\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\n content: "";\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after {\n margin-left: 4px;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before,\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors .door {\n position: absolute;\n width: 0;\n height: 0;\n /* display: none; */\n -webkit-animation: viewport-door-label 0.3s ease 1s;\n animation: viewport-door-label 0.3s ease 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n cursor: pointer;\n}\n\n.widgets-doors .door a {\n display: block;\n position: absolute;\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n border-radius: 1.75px;\n background: rgba(0, 0, 0, 0.5);\n line-height: 14px;\n padding: 8px 8px;\n border-radius: 4px;\n white-space: nowrap;\n font-size: 14px;\n font-style: normal;\n pointer-events: auto;\n -webkit-transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease;\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n}\n\n.widgets-doors .door a:after {\n -webkit-transition: opacity 0.3s ease;\n transition: opacity 0.3s ease;\n}\n\n.widgets-doors .door a:active {\n background: rgba(0, 0, 0, 0.5);\n color: hsla(0, 0%, 100%, 0.5);\n}\n\n.widgets-doors .door a:active:after {\n opacity: 0.5;\n}\n\n@-webkit-keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@-webkit-keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}',{});var Qs=function(){function e(t){o(this,e),this.player=t;var n=document.createElement("div");n.className="widgets-doll-labels",t.domElement.append(n);var i=document.createElement("div");i.className="widgets-plan-labels",t.domElement.append(i);var r=document.createElement("div");r.className="widgets-doors",t.domElement.append(r),this.player.$app.store.getValue("flooruser")&&this.init(),this.player.$app.store.on("flooruser",this.init.bind(this))}return u(e,[{key:"init",value:function(){var e=this,t=this.player.$app.store.getValue("flooruser");Ae.timeMeasuring.addTimeMark("initLabels","start"),this.player.defaultRoomLabels.forEach((function(e){return e.remove()})),this.player.defaultRoomLabels=[],t.floors.forEach((function(n,i){i=e.player.model.floors.list.length>1?null!=n.subgroup?n.subgroup:n.id:i;var o=e.player.model.floors.index[i];if(o){o.entryArrow=[];var r=o.boundingBox.min.y,a=JSON.parse(JSON.stringify(n)),s=JSON.parse(JSON.stringify(e.player.model.center));if(s.z=-1*s.z,a.symbols&&Object.keys(a.symbols).forEach((function(e){var n=a.symbols[e];n.endPoint=Os(n.endPoint,t.angle,s),n.startPoint=Os(n.startPoint,t.angle,s),n.points2d=(n.points2d||[]).map((function(e){return Os(e,t.angle,s)}))})),a.tags&&Object.keys(a.tags).forEach((function(e){var n=a.tags[e];n.center=Os(n.center,t.angle,s),n.points2d=n.points2d.map((function(e){return Os(e,t.angle,s)}))})),a.rooms&&Object.keys(a.rooms).forEach((function(e){var n=a.rooms[e];n.center=Os(n.center,t.angle,s)})),a.points&&Object.keys(a.points).forEach((function(e){var n=a.points[e],i=Os({x:n.x,y:n.y},t.angle,s);n.x=i.x,n.y=i.y})),a.symbols){for(var l,c=Object.keys(a.symbols),u=0;u<c.length;u++)a.symbols[c[u]].enter&&((l=JSON.parse(JSON.stringify(a.symbols[c[u]]))).bottom=r+.1,l.floorIndex=i,o.entryArrow.push(new Fs(e.player,l)),e.player.model.currentFloor.floorIndex==i?e.updateEntryVisi(!0,i):e.updateEntryVisi(!1,i));e.moveEntryArrow(i)}a.tags=a.tags||{},e.hasPlaneLabels=a.tags.length>0;var h=o.center.y;Object.keys(a.tags).forEach((function(t){var n=a.tags[t],r=n.des&&parseFloat(n.des).toFixed(2),s=n.title,l=r+n.unit+"<sup>2</sup>",c=n.des?"约"+l:"";if(s||c){var u=s&&c?s+"<br>"+l:s||c,d="floorplan"==e.player.modeTran.split("-")[1]?new THREE.Vector3(0,-1,0):new THREE.Vector3(0,1,0),p=n.center,f=new THREE.Vector3(p.x,-999*d.y,-p.y),m=new THREE.Raycaster(f,d,.001,9999).intersectObject(o.children[0]);m[0]?(f=m[0].point).y+=.5:f.y=h;var v=e.player.model.panos.closestPanoTowardPoint({point:f,floor:o});v||console.error("what!!! no closetPano");var g=new Ts(e.player,{sid:t,pos:f.clone(),text:u,toPano:v,floorIndex:i});e.player.defaultRoomLabels.push(g),e.player.defaultRoomLabels.forEach((function(e){e.update()}))}})),e.initDoorLabels(i,JSON.parse(JSON.stringify(a)))}else nt.warn("floor[".concat(i,"] is empty"))})),this.initedLabel=!0,this.setPlanLabelVisi(),Ae.timeMeasuring.addTimeMark("initLabels","end",!0)}},{key:"initDoorLabels",value:function(e,t){var n=this,i=[];if(t.rooms&&t.rooms[0]&&t.rooms[0].wallPointIDs){var o=this.player.model.floors.index[e],r=o.boundingBox.min.y;Object.keys(t.tags).forEach((function(e){var n=t.tags[e];n.__panos=[],n.title||delete t.tags[e]}));var a={};Object.keys(t.symbols).forEach((function(e){var n=t.symbols[e];"SingleDoor"!=n.geoType&&"SlideDoor"!=n.geoType&&"DoubleDoor"!=n.geoType||(a[e]=n)})),t.rooms.forEach((function(e,t){e.name="",e.doors=Object.values(a).filter((function(t){return e.wallIds.indexOf(t.parent)>-1}))||[],e.taggings=[],e.panos=[]})),Object.keys(a).forEach((function(e){var n=a[e];n.doorLabels=[],i.push(n),n.center={x:(n.points2d[0].x+n.points2d[1].x)/2,y:(n.points2d[0].y+n.points2d[1].y)/2},n.atRooms=[],t.rooms.forEach((function(e){e.doors.find((function(e){return e.vectorId==n.vectorId}))&&n.atRooms.push(e)}))})),t.rooms.forEach((function(e){e.doors=e.doors.filter((function(e){return e.atRooms}))})),o.panos.forEach((function(e){e._atRoom=null})),t.rooms.forEach((function(e){e.points=e.wallPointIDs.map((function(e){return t.points[e]})),null==e.closetParent&&(o.panos.forEach((function(i){!i._atRoom&&i.isAligned()&&n.searchAtRoom(t,e,i,{x:i.position.x,y:-i.position.z},(function(e){i._atRoom=e,e.panos.push(i)}))})),Object.keys(t.tags).forEach((function(i){var o=t.tags[i];o._atRoom||n.searchAtRoom(t,e,o,{x:o.center.x,y:o.center.y},(function(e){o._atRoom=e,e.taggings.push(o),e.name+=o.title+" "}))}))),e.taggings.length&&e.panos.forEach((function(i){var o=Ae.sortByScore(e.taggings,[],[function(e){var t=new THREE.Vector2(i.position.x,i.position.z),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}]);o&&o.length&&(o.slice(0,3).find((function(e){var o=e.item,r=new THREE.Vector2(i.position.x,i.position.z),a=new THREE.Vector2(o.center.x,-o.center.y);return!n.isShelter(t,a,r)}))||o[0]).item.__panos.push(i)}))})),Object.keys(t.tags).forEach((function(e){var n=t.tags[e],i=n.__panos.filter((function(e){return e.neighbourUUIDs.length>0}));i.length&&(n.clickToPano=Ae.sortByScore(i,[],[function(e){var t=new THREE.Vector2(e.position.x,e.position.z),i=new THREE.Vector2(n.center.x,-n.center.y);return-t.distanceTo(i)}])[0].item)})),o.taggingTables=Object.values(t.tags).filter((function(e){return e.clickToPano}));var s="floor".concat(e,"(").concat(t.name||"no name",") 共有").concat(t.rooms.length,"个房间,分别是 ");t.rooms.forEach((function(e){s+="\n房间".concat(e.roomId," : ").concat(e.name," ")})),t.rooms.forEach((function(i){if(0!=i.taggings.length){var a=he.getArea(i.points)>0;i.doors.forEach((function(s){var l=[];if(i.closetChilds){var c=s.atRooms.find((function(e){return s.startPoint&&s.endPoint}));a=he.getArea(c.points)>0,c!=i&&(a=!a),l=c.points}else l=i.points;var u=t.walls[s.parent],h=t.points[u.start],d=t.points[u.end],p=n.order(h,d,l),f=he.getNormal({points:[h,d]}),m=new THREE.Vector3(f.x,0,-f.y);p==a&&m.negate();var v=!1,g=i.panos.filter((function(e){return e.neighbourUUIDs.length>0}));0==g.length&&(v=!0,g=o.panos.filter((function(e){if(0!=e.neighbourUUIDs.length){var t=new THREE.Vector2(s.center.x,-s.center.y),n=new THREE.Vector2(e.position.x,e.position.z);if(!(t.distanceTo(n)>5)){var i=e.position.clone().sub(new THREE.Vector3(s.center.x,0,-s.center.y));return m.angleTo(i)<Math.PI/2||void 0}}})));var A=Ae.sortByScore(g,[],[function(e){var t=0;if(v){var n=e.position.clone().sub(new THREE.Vector3(s.center.x,0,-s.center.y));t=2*-m.angleTo(n)}var i=new THREE.Vector2(s.center.x,-s.center.y),o=new THREE.Vector2(e.position.x,e.position.z);return-i.distanceTo(o)+t}]);A=A.length?A[0].item:null;var y=Ae.sortByScore(i.taggings,[],[function(e){var t=A?new THREE.Vector2(A.position.x,A.position.z):new THREE.Vector2(s.center.x,s.center.y),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}])[0].item,E=new THREE.Vector3(s.center.x,r+.3,-s.center.y),w=s.atRooms.find((function(e){return e!=i&&e.name}));w||(w=s.atRooms.find((function(e){return e!=i})));var b=Math.PI/6,C=w?w.panos:n.player.model.panos.list.filter((function(e){return!e._atRoom})),x=C.filter((function(e){var i=e.position.clone().setY(0).distanceTo(E.clone().setY(0));if(!(i<1.5||i>15))return i>4||C.find((function(t){return ro.filters.isInFanAngle(E,e.position.clone().sub(E).setY(0),b)(t.position)}))?!n.isShelter(t,E,e.position,s.parent):void 0}));if(x.length){var I=new Hs(n.player,{doorDir:m,text:y.title,pos:E,visiblePanos:x,sameRoomPanos:C,toPano:A,aim:new THREE.Vector3(y.center.x,0,-y.center.y),floorIndex:e});I.door=s,I.forRoom=i,I.forTag=y,s.doorLabels.push(I),n.player.defaultRoomLabels.push(I)}else console.log("因无visiblePanos取消创建doorlabel的门: ".concat(w?w.name:"(未闭合区域) ","通往 ").concat(y.title," "))}))}})),s+="\n门共有".concat(i.length,"扇: \n"),i.forEach((function(e,t){s+="门".concat(e.vectorId,"在 "),e.atRooms.forEach((function(e){s+="房间".concat(e.roomId,"(").concat(e.name,")、 ")})),s+="的边上 \n"})),console.log("%c".concat(s),"color:#13f"),this.player.doorLabels.forEach((function(e){e.update()})),this.player.updateLabelZIndex(["doorLabels"]),Hs.updateCameraDir(this.player)}else console.log("没有room or 数据不标准 得不到doorlabels")}},{key:"setPlanLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){null==e&&(e=this.player.model.floorplanCadImg.getVisible());var n=this.player.planLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"setDoorLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){var n=this.player.doorLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"setDollLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){var n=this.player.dollLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"updateEntryVisi",value:function(e,t){var n=this,i=!(this.player.model.floorplanCadImg&&this.player.model.floorplanCadImg.isEdit||this.player.linkEditor&&this.player.linkEditor.setPanoVisible),o=this.player.model.floors;null!=t&&(o=o.filter((function(e){return e.floorIndex==t}))),o.forEach((function(t){if(t.entryArrow.length){if(i)if(0==e)i=!1;else{var o=n.player.modeTran.split("-")[1];i="floorplan"==o||"panorama"!=o&&"dollhouse"==o}t.entryArrow.forEach((function(e){return i?e.show():e.hide()}))}}))}},{key:"moveEntryArrow",value:function(e){var t=this.player.model.floors.index[e];if(t.entryArrow.length&&t.cadImgRatio){var n=24*this.player.model.floors.index[e].cadImgRatio;t.entryArrow.forEach((function(e){return e.moveCloseToWall(n)}))}}},{key:"searchAtRoom",value:function(e,t,n,i,o){var r=this;if(he.isPointInArea(t.points,i)){if(t.closetChilds)t.closetChilds.find((function(t){return r.searchAtRoom(e,e.rooms.find((function(e){return e.roomId==t})),n,i,o)}))||o(t);else o(t);return!0}}},{key:"order",value:function(e,t,n){var i=n.indexOf(e);return(n.indexOf(t)-i+n.length)%n.length==1}},{key:"isShelter",value:function(e,t,n,i){var o=[new THREE.Vector2(t.x,-t.z),new THREE.Vector2(n.x,-n.z)];return Object.values(e.walls).find((function(t){if(null==i||null==t.vectorId||t.vectorId!==i){var n=[e.points[t.start],e.points[t.end]];return he.isLineIntersect(o,n)}}))}},{key:"show",value:function(e){this.updateEntryVisi(!0,e),this.setPlanLabelVisi(!0,e),this.setDoorLabelVisi(!0,e),this.setDollLabelVisi(!0,e)}},{key:"hide",value:function(e){this.updateEntryVisi(!1,e),this.setPlanLabelVisi(!1,e),this.setDoorLabelVisi(!1,e),this.setDollLabelVisi(!1,e)}},{key:"reset",value:function(){this.player.defaultRoomLabels.forEach((function(e){return e.remove()})),this.player.model.floors.forEach((function(e){e.entryArrow.forEach((function(e){return e.dispose()}))}))}},{key:"gotoFloor",value:function(e){this.hide(),this.show(e)}}]),e}();function Os(e,t,n){var i=new THREE.Vector2(e.x,e.y);if(Math.abs(t)<.01||Math.abs(t-2*Math.PI)<.01)return i;var o=(i.x-n.x)*Math.cos(t)-(i.y-n.z)*Math.sin(t)+n.x,r=(i.y-n.z)*Math.cos(t)+(i.x-n.x)*Math.sin(t)+n.z;return i.x=o,i.y=r,i}var Vs,_s,Us,Ns,zs,Gs,js,Ws,qs,Js,Ys,Zs,Xs,Ks=new THREE.Vector3(0,0,-1),$s=function(){function e(t){o(this,e),this.angle=0,this.quar=new THREE.Quaternion,this.player=t,this.config=t.$app.config,this.init(),this.show=!1,this.force=!1,this.switch("direction")}return u(e,[{key:"switch",value:function(e){this.type=e,"direction"==e&&(this.dirTextNDiv.style.display="block",this.dirTextXDiv.style.display="none",this.dirTextYDiv.style.display="none",this.dirTextZDiv.style.display="none",this.lines.visible=!1,this.cones.visible=!0),"axis"==e&&(this.dirTextNDiv.style.display="none",this.dirTextXDiv.style.display="block",this.dirTextYDiv.style.display="block",this.dirTextZDiv.style.display="block",this.lines.visible=!0,this.cones.visible=!1),this.autoJudgeDisplay()}},{key:"init",value:function(){var e=this;if(this.dom=document.createElement("div"),this.dom.id="compass",this.dom.innerHTML='\n <div class="dirText north"> <span>N</span> </div>\n\n <div id="dirTextX" class="dirText"> <span>X</span> </div>\n <div id="dirTextY" class="dirText"> <span>Y</span> </div>\n <div id="dirTextZ" class="dirText"> <span>Z</span> </div>\n <div class="center"></div>\n ',this.player.domElement.append(this.dom),this.dirTextNDiv=this.dom.querySelector(".north"),this.dirTextXDiv=this.dom.querySelector("#dirTextX"),this.dirTextYDiv=this.dom.querySelector("#dirTextY"),this.dirTextZDiv=this.dom.querySelector("#dirTextZ"),this.centerDiv=this.dom.querySelector(".center"),this.config.view?(this.dom.style.right=this.config.mobile?"1%":"2%",this.dom.style.top=this.config.mobile?"10%":"4%"):(this.dom.style.right=this.config.mobile?"1%":"277px",this.dom.style.top=this.config.mobile?"10%":"55px"),this.centerDiv.style.width="50px",this.centerDiv.style.height="50px",this.config.mobile){var t=this.player.getSize(),n=t.clientWidth,i=t.clientHeight,o=Math.min(n,i);if(o<450){var r=Math.round(o/450*1e3)/1e3;this.dom.transform=" scale(".concat(r,")")}}try{this.renderer=new THREE.WebGLRenderer({antialias:this.config.antialias,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.domElement.setAttribute("name","compass"),this.renderer.setClearAlpha(0),this.renderer.setSize(50,50,!1,window.devicePixelRatio?window.devicePixelRatio:1)}catch(e){throw new RendererCreationException("Unable to create a WebGL rendering context")}this.centerDiv.appendChild(this.renderer.domElement),this.camera=new THREE.PerspectiveCamera,this.camera.fov=70,this.scene=new THREE.Scene,this.scene.add(this.camera),this.createCompass(),this.player.on("scene/LoadHouseFloor",(function(){e.setNorth()})),this.player.on("changeDir",(function(){e.setNorth()}));var a=this.player.$app.store.getValue("flooruser");this.angle=(a.compass-THREE.MathUtils.radToDeg(a.angle)+360)%360||0,this.player.$app.store.on("flooruser",(function(t){e.angle=(t.compass-THREE.MathUtils.radToDeg(t.angle)+360)%360||0}))}},{key:"createCompass",value:function(){var e=new THREE.ConeBufferGeometry(.7,2,4,!0),t=new THREE.ConeBufferGeometry(.7,2,4,!0),n=new THREE.MeshBasicMaterial({vertexColors:!0}),i=function(e,t,n){for(var i=[],o=0,r=e.attributes.position.count;o<r;++o)i.push(1,1,1);var a=function(e,t){i[3*e+0]=t[0],i[3*e+1]=t[1],i[3*e+2]=t[2]},s=[(t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2];a(1,t),a(5,t),a(6,t),a(2,s),a(3,s),a(7,s),a(4,n),a(8,n),a(9,n),e.setAttribute("color",new THREE.BufferAttribute(new Float32Array(i),3))},o=[20/255,146/255,170/255];i(e,[1/255,238/255,245/255],o),i(t,o,[40/255,60/255,103/255]);var r=new THREE.Mesh(e,n);r.position.setY(1),e.computeVertexNormals(),t.computeVertexNormals();var a=new THREE.Object3D;a.add(r);var s=new THREE.Mesh(t,n);s.rotation.x=Math.PI,s.position.setY(-1),a.add(s),a.rotation.z=Math.PI/2,a.rotation.y=Math.PI/2,a.scale.set(.7,.7,.7),this.scene.add(a),this.cones=a;var l=new THREE.Object3D,c=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,10)]),new THREE.LineBasicMaterial({color:255}));l.add(c);var u=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,10,0)]),new THREE.LineBasicMaterial({color:65280}));l.add(u);var h=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(10,0,0)]),new THREE.LineBasicMaterial({color:16711680}));l.add(h),this.lines=l,this.scene.add(l)}},{key:"setNorth",value:function(){var e=this.player.$app.store.getValue("flooruser").floors;if(e&&e.length){var t=e[0],n=this.player.$app.store.getValue("metadata")||{};this.angle=(t&&t.dire||0)+THREE.MathUtils.radToDeg(parseFloat(n.floorPlanAngle||0)),this.cones.rotation.y=Math.PI/2-THREE.MathUtils.degToRad(this.angle),console.log("dir:"+t.dire+", floorPlanAngle:"+n.floorPlanAngle),this.update(),this.player.model.floorLogos.setDir(this.angle)}}},{key:"update",value:function(e){this.show&&(e||(e=this.player.camera.quaternion.clone()),this.cones.rotation.y=Math.PI/2-this.angle/180*Math.PI,this.updateCamera(e),this.updateLabel(e),this.render())}},{key:"updateLabel",value:function(e){var t,n=this.player.getDirection(),i=Ks.clone();if("transitioning"==this.player.mode){var o=new THREE.Camera;o.position.copy(this.camera.position),o.lookAt(o.position.clone().add(n)),t=o.quaternion.invert().premultiply(e)}var r=new THREE.Vector3(0,1,0);t&&r.applyQuaternion(t),n.projectOnPlane(r),i.projectOnPlane(r);var a=n.angleTo(i);n.cross(i).y>0&&(a=-a);var s=this.angle-90+THREE.MathUtils.radToDeg(a);"axis"==this.type?(this.dirTextXDiv.style.transform="rotate("+(s+90-this.angle)+"deg)",this.dirTextXDiv.querySelector("span").style.transform="rotate("+-(s+90-this.angle)+"deg)",this.dirTextYDiv.style.transform="rotate(-90deg)",this.dirTextYDiv.querySelector("span").style.transform="rotate(90deg)",this.dirTextZDiv.style.transform="rotate("+(s+90+90-this.angle)+"deg)",this.dirTextZDiv.querySelector("span").style.transform="rotate("+-(s+90+90-this.angle)+"deg)"):(this.dirTextNDiv.style.transform="rotate("+s+"deg)",this.dirTextNDiv.querySelector("span").style.transform="rotate("+-s+"deg)")}},{key:"updateCamera",value:function(e){this.camera.quaternion.copy(e);var t=this.player.getDirection();this.camera.position.copy(t.multiplyScalar(5).negate())}},{key:"render",value:function(){this.renderer.render(this.scene,this.camera)}},{key:"setDisplay",value:function(e,t){this.force&&null==t||(null!=t&&(this.force=t),this.show=!!e,this.show?(this.update(),this.dom.style.display="block"):this.dom.style.display="none")}},{key:"autoJudgeDisplay",value:function(){"panorama"!=this.player.modeTran.split("-")[1]||"axis"==this.type?this.setDisplay(!0):this.setDisplay(!1)}},{key:"setDomLeft",value:function(){this.dom.css({right:"none",left:this.config.mobile?"1%":"2%"})}}]),e}();function el(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var tl={},nl=function(e,t,n){Zs.material.uniforms.tDiffuse.value=t;var i=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI/2);Js.quaternion.copy((new THREE.Quaternion).multiplyQuaternions(i,n));var o=new THREE.Vector3(0,0,-8).applyQuaternion(Js.quaternion);Js.position.copy(o.clone().negate());var r=_s.renderer.autoClear;_s.renderer.autoClear=!1,_s.renderer.setRenderTarget(e),_s.renderer.render(Ys,Js),_s.renderer.setRenderTarget(null),_s.renderer.autoClear=r},il=function(e){return console.log(e),e&&!e.includes("/")?Us.resource.getUserResourceURL(e):e},ol=function(e){f(n,THREE.EventDispatcher);var t=el(n);function n(e,i){var r;return o(this,n),r=t.call(this),Xs=!(Us=e).config.view,Vs=i,_s=Us.core.get("SceneRenderer"),r.loaded=!1,r.enabled=!0,r.views={},r.ViewLinkCircles=new THREE.Object3D,r.ViewLinkCircles.name="ViewLinkCircles",r.ViewLinkBalloons=new THREE.Object3D,r.ViewLinkBalloons.name="ViewLinkBalloons",r.ViewLinkExits=new THREE.Object3D,r.ViewLinkExits.name="ViewLinkExits",r.ViewTitles=new THREE.Object3D,r.ViewTitles.name="ViewTitles",r.addEventListener("getViewLinkEdit",(function(e){tl=e.v})),Us.Scene.on("loadeddata",(function(){var e=Us.store.getValue("links");if(e)return Vs.model.builded?void r.init(e):Vs.model.addEventListener("builded",r.init.bind(h(r),e));r.init()})),r}return u(n,[{key:"init",value:function(e){var t=this;rl.init(),this.createViews(e),Vs.model.add(this.ViewLinkCircles),Vs.model.add(this.ViewLinkBalloons),Vs.model.add(this.ViewLinkExits),Vs.model.add(this.ViewTitles),this.inited=!0,Vs.currentPano&&Vs.currentPano.hasVideo&&(this.ViewLinkCircles.visible=!1,this.ViewLinkBalloons.visible=!1,this.ViewLinkExits.visible=!1,setTimeout((function(){t.enabled&&(t.ViewLinkCircles.visible=!0,t.ViewLinkBalloons.visible=!0,t.ViewLinkExits.visible=!0)}),1e3));var n,i=[];Vs.on("collectIntersectMesh",(function(e,o){if(t.inited&&t.enabled){var r=!0;if(Vs.isOutsideMode()?i=tl.markView?[tl.markView.balloon.mesh]:t.ViewLinkBalloons.children:Vs.is360View(Vs.mode,Vs.currentPano)?(i=tl.settingEntry?[]:tl.settingVisibles?t.ViewLinkCircles.children:t.ViewLinkExits.children.concat(t.ViewLinkCircles.children),r=!1):tl.markView?(i=[tl.markView.circle.mesh],r=!1):i=t.ViewLinkCircles.children,r)e.push.apply(e,H(i));else{var a=tt.getMouseIntersect(Vs.camera,i,Vs.mouse);a&&i.includes(a.object)&&(n=a,t.dealwithIntersect(a),o.consume())}}})),Vs.on("judgeIntersect",(function(e,o){o.getConsumed()||(e&&i.includes(e.object)?(n=e,o.consume()):n=null,t.dealwithIntersect(n))})),Vs.on("click",(function(e){e.getConsumed()||t.dealWithClick()&&e.consume()})),Vs.on("update",(function(e){e.hasChanged.cameraChanged&&t.update()})),Vs.on("mode.changing",(function(e,n,i,o){if("panorama"==e)setTimeout((function(){for(var e in t.views)t.views[e].balloon.showOrHide(!0,o/2,"auto"),t.views[e].circle.setVisible(!1);tl.markView&&tl.markView.circle.setVisible(!0)}),o||500);else if("floorplan"==e)for(var r in t.views)t.views[r].balloon.mesh.material.depthTest=!0;if("floorplan"==n&&setTimeout((function(){for(var e in t.views)t.views[e].balloon.mesh.material.depthTest=!1}),o),"panorama"==n){for(var a in t.views)t.views[a].balloon.showOrHide(!1),t.views[a].circle.setVisible(!0);tl.cancelPos&&tl.cancelPos()}})),Vs.model.on("floor.changed",(function(e,t,n){if("panorama"!=Vs.mode||"panorama"==t){var i=Vs.model.allFloorsVisible;Vs.model.floors.forEach((function(n){n==e||i?"floorplan"!=t&&"dollhouse"!=t||n.views.forEach((function(e){e.balloon.showOrHide(!0,500)})):n.views.forEach((function(e){tl.markView!=e&&e.balloon.showOrHide(!1,500)}))}))}})),Vs.$app.config.view&&Vs.on(qr,(function(e){var n,i=e.currentPano;"panorama"==Vs.mode&&(n=i.getVideoFilter()),t.ViewLinkCircles.children.forEach((function(e){n&&n(e.position)?Ae.updateVisible(e,"coveredPanoVideo",!1):Ae.updateVisible(e,"coveredPanoVideo",!0)}))})),Us.store.getValue("metadata").controls.showLinkTitle||this.changeTitlesShow(!1)}},{key:"createViews",value:function(e){if(e){if(Ae.CloneJson(e.tags||e).forEach(function(e){if(this.views[e.sid])console.log("有重复的view sid"+e.sid);else{var t=new rl(e);this.addView(t)}}.bind(this)),"panorama"!=Vs.getToMode())for(var t in this.views)this.views[t].balloon.showOrHide(!0,0);this.dispatchEvent({type:"loaded"}),this.loaded=!0}}},{key:"dealwithIntersect",value:function(e){if(this.enabled){var t,n=e&&e.object;if(!this.hoverCircle||this.hoverCircle.mesh==n||tl.markView&&tl.markView.circle==this.hoverCircle||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverCircle.setSelect(!1)),!this.hoverBalloon||this.hoverBalloon.mesh==n||tl.markView&&tl.markView.balloon==this.hoverBalloon||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverBalloon.setSelect(!1)),this.hoverExit&&this.hoverExit.mesh!=n&&this.hoverExit.setSelect(!1),this.clickEnable=!1,this.hoverBalloon=null,this.hoverCircle=null,this.hoverExit=null,!e)return os.remove("hoverView"),os.remove("dragView"),!0;if(n.name.includes("balloon"))(t=this.views[n.name.split("balloon_")[1]]).balloon.setSelect(!0),this.hoverBalloon=t.balloon,this.dispatchEvent({type:"changeIntersect",hovered:t.sid});else if(n.name.includes("exit"))(t=this.views[n.name.split("circle_exitDoor")[1]]).exitDoor.setSelect(!0),this.hoverExit=t.exitDoor;else{if(!(t=this.views[n.name.split("circle_")[1]]))return console.error("找不到view?",n.name);this.hoverCircle=t.circle,t.circle.setSelect(!0),this.dispatchEvent({type:"changeIntersect",hovered:t.sid})}tl.markView==t&&(Vs.currentPano!=t.pano||tl.settingExit||tl.settingVisibles)?os.add("dragView"):(os.add("hoverView"),this.clickEnable=!0)}}},{key:"dealWithClick",value:function(){if(this.clickEnable){var e=this.hoverCircle||this.hoverBalloon||this.hoverExit,t=this.views[e.sid];if(e==this.hoverExit)return t.backToPanorama(),!0;if("url"==t.linkType)if(Us.config.link&&"object"==typeof Us.config.link){var n=t.url;"function"==typeof Us.config.link.onAction&&(n=Us.config.link.onAction(n)),n&&("blank"==Us.config.link.target?window.open(n):window.location.href=n)}else t.url&&(window.location.href=t.url);else"pano"==t.linkType&&t.pano&&t.enter360Pano();return!0}}},{key:"addView",value:function(e){this.views[e.sid]=e,this.ViewLinkCircles.add(e.circle.mesh),this.ViewLinkBalloons.add(e.balloon.mesh),e.exitDoor&&this.ViewLinkExits.add(e.exitDoor.mesh),this.ViewTitles.add(e.titleLabel)}},{key:"removeView",value:function(e){this.ViewLinkCircles.remove(e.circle.mesh),this.ViewLinkBalloons.remove(e.balloon.mesh),this.ViewLinkExits.remove(e.exitDoor.mesh),delete this.views[e.sid]}},{key:"update",value:function(e){for(var t in this.views)this.views[t].update()}},{key:"showAllViews",value:function(){this.enabled||(this.ViewLinkCircles.visible=!0,this.ViewLinkBalloons.visible=!0,this.ViewLinkExits.visible=!0,this.changeTitlesShow(!0,"showAll"),this.enabled=!0)}},{key:"hideAllViews",value:function(){this.enabled&&(Vs.is360View(Vs.mode,Vs.currentPano)?Vs.currentPano.view.backToPanorama():Vs.enteringView&&Vs.once("flying.ended",(function(){Vs.currentPano.view.backToPanorama()})),this.ViewLinkCircles.visible=!1,this.ViewLinkBalloons.visible=!1,this.ViewLinkExits.visible=!1,this.changeTitlesShow(!1,"showAll"),this.dealwithIntersect(null),this.enabled=!1)}},{key:"changeTitlesShow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onShow";Ae.updateVisible(this.ViewTitles,t,!!e),e&&this.ViewTitles.children.forEach((function(e){return e.updatePos()}))}},{key:"setViewsVisible",value:function(e,t){if(this.enabled)for(var n in this.views)this.views[n].linkType==e&&this.views[n].setVisible(t)}},{key:"focusOn",value:function(e){var t=this;if(Vs.flying)return Vs.once("flying.ended",(function(){t.focusOn(e)}));"panorama"==Vs.mode?Vs.flyToPano({pano:e.nearestPano,lookAtPoint:e.circle.mesh.position,checkAlone:!0}):Vs.focusPoint({aim:e.balloon.mesh.position})}},{key:"updateCirclesWhenFade",value:function(e,t){if("enter"==e)for(var n in this.views)if(n in t.pano.view.visibleViews){var i={};i.viewDir=(new THREE.Vector3).fromArray(t.pano.view.visibleViews[n]),this.views[n].circle.updatePos("at360View",i),this.views[n].circle.setVisible(!0)}else this.views[n].circle.setVisible(!1);else{for(var o in this.views)this.views[o].circle.at360View&&this.views[o].circle.updatePos("normal"),t.flyOut||this.views[o].circle.setVisible(!0);t.flyOut&&tl.markView&&tl.markView.circle.setVisible(!0)}}},{key:"exitView",value:function(){var e=new vt;return Vs.is360View(Vs.mode,Vs.currentPano)?(Vs.currentPano.view.backToPanorama(),Vs.once(qr,(function(){e.resolve()}))):e.resolve(),e.promise()}}]),n}(),rl=function(e){f(n,THREE.EventDispatcher);var t=el(n);function n(e){var i;return o(this,n),(i=t.call(this)).sid=e.sid,i.pano=null,i.balloon=new ll(e,h(i)),i.circle=new sl(e,h(i)),i.linkType=e.type,i.enterQuaternion=e.enterQuaternion?(new THREE.Quaternion).fromArray(e.enterQuaternion):new THREE.Quaternion,i.exitDirection=e.exitDirection?(new THREE.Vector3).fromArray(e.exitDirection):new THREE.Vector3(0,0,Je.view360.circleDisToCenter),i.url=e.url,(Xs||"pano"==i.linkType)&&(i.exitDoor=new sl(Object.assign({},e,{circleType:"exitDoor",exitDirection:i.exitDirection}),h(i))),i.titleLabel=new cl(e.title,h(i)),i.addEventListener("updatePose",(function(e){"exitDoor"!=e.target.circleType&&i.titleLabel.updatePos()})),i.circle.addEventListener("move",(function(){"circle"==i.titleLabel.bindTo&&i.titleLabel.updatePos()})),e.thumb&&(i.imgSid=e.thumb.split(".jpg")[0],e.thumb=Us.resource.getUserImagesURL("panorama/".concat(i.imgSid,"/low/").concat(e.thumb)),i.resolution=e.resolution),i.nearestPano=e.nearestPano&&Vs.model.panos.index[e.nearestPano],i.nearestPano&&(i.floor=i.nearestPano.floor,i.floor.addView(h(i))),i.setPano(e),i.visibleViews=e.visibleViews||{},i._data=e,i}return u(n,[{key:"update",value:function(e){this.balloon.update(e),this.circle.update(e),this.exitDoor&&this.exitDoor.update(e)}},{key:"dispose",value:function(){var e=this;this.balloon.dispose(),this.circle.dispose(),this.exitDoor.dispose(),this.deleteOldPano(),this.titleLabel.dispose(),Vs.currentPano==this.pano?this.backToPanorama():this.entering&&Vs.once("flying.ended",(function(){e.backToPanorama()})),this.floor&&this.floor.removeView(this)}},{key:"deleteOldPano",value:function(){var e=this;if(this.pano){this.pano.floor.removePano(this.pano),this.pano.exit(),delete this.pano.panoRenderer.activeRenderTargetDescriptors[this.sid],delete this.pano.panoRenderer.panoDescriptors[this.sid],this.pano.tiled&&(delete this.pano.panoRenderer.tileTrees[this.sid],delete this.pano.panoRenderer.tileDirectory[this.sid],delete this.pano.tileDownloader.downloadDescriptors[this.sid],this.pano.tileDownloader.priorityQueue=this.pano.tileDownloader.priorityQueue.filter((function(t){return t.pano!=e.pano})),this.pano.tileDownloader.activeDownloads=this.pano.tileDownloader.activeDownloads.filter((function(t){return t.pano!=e.pano})));for(var t=this.pano.panoRenderer.M,n=0;n<t.length;n++)if(t[n].pano==this.pano){t.splice(n,1);break}var i=Vs.model.panos.list.indexOf(this.pano);Vs.model.panos.list.splice(i,1)}}},{key:"setPano",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("pano"==this.linkType){if(e.thumb||e.thumbPanoTex){var t=!!this.pano;this.pano&&this.deleteOldPano();var n=new ro(Vs.$app,this.sid,{panoType:"360view",position:new THREE.Vector3,quaternion:new THREE.Quaternion,puck:new THREE.Vector3(0,-1.6,0),seeMarkers:[],subgroup:this.nearestPano.floor.floorIndex,tiled:!e.mapSrc});if(n.mapSrc=e.mapSrc,n.attachToPanoRenderer(Vs.$app.core.get("PanoRenderer")),n.qualityManager=Vs.$app.core.get("QualityManager"),n.tiled&&(n.tileDownloader=Vs.$app.core.get("TileDownloader")),n.build1(),n.view=this,Vs.model.panos.add(n),this.panoImgVersion=e.version,t&&Vs.currentPano==this.pano){var i=function e(){Vs.checkAndWaitForPanoLoad(n,"high","low",Vs.basePanoSize,e)||(Vs.model.setProjectedPanos(n,n),n.enter())};Vs.currentPano=n,i()}this.pano=n,e.thumbPanoTex?this.thumbPanoTex=e.thumbPanoTex:this.thumbPanoTex=this.renderToGetMap(e.thumb),this.circle.setMapIn(this.thumbPanoTex),this.balloon.setMapIn(this.thumbPanoTex)}this.thumbPanoTex&&(this.circle.mesh.material.uniforms.changeMap.value=1,this.balloon.mesh.material.uniforms.changeMap.value=1)}else this.circle.mesh.material.uniforms.changeMap.value=0,this.balloon.mesh.material.uniforms.changeMap.value=0}},{key:"renderToGetMap",value:function(e){var t=this,n=new THREE.WebGLRenderTarget(256,256,{stencilBuffer:!1}),i=$n.load(e,(function(){Xs&&(t.unDealTex=i),nl(n,i,t.enterQuaternion)}));return i.flipY=!1,i.minFilter=THREE.LinearFilter,this.renderTarget=n,n.texture}},{key:"mapChangeRot",value:function(){nl(this.renderTarget,this.unDealTex,this.enterQuaternion)}},{key:"enter360Pano",value:function(e){Vs.isOutsideMode()?Vs.flyToNewMode({mode:"panorama",pano:this.pano,callback:e}):Vs.flyToPano({pano:this.pano},e)}},{key:"backToPanorama",value:function(){Vs.flyToPano({pano:Vs.lastPano||this.nearestPano,lookAtPoint:this.circle.mesh.position})}},{key:"setVisible",value:function(e){!e!=this.disabled&&(e?(this.balloon.disabled=!1,this.balloon.showOrHide(!0,0,"auto")):(this.balloon.showOrHide(!1,0),this.balloon.disabled=!0,Vs.currentPano!=this.pano&&Vs.enteringView!=this||this.backToPanorama()),this.disabled=!e,this.circle.disabled=!e,this.circle.setVisible())}},{key:"setSelect",value:function(e){this.selected!=e&&(this.selected=!!e,this.circle.setSelect(e),this.balloon.setSelect(e))}}]),n}();rl.init=function(){rl.inited||(Ns=new THREE.PlaneBufferGeometry(.4,.4),zs=new THREE.PlaneBufferGeometry(1.5,1.5),Gs=$n.load($n.getImageURL("images/img_pamove.png")),js=$n.load($n.getImageURL("images/img_pamove_normal.png")),Ws=$n.load($n.getImageURL("images/img_panorama_dot.png")),qs=$n.load($n.getImageURL("images/img_exit_dot.png")),js.minFilter=THREE.LinearMipmapNearestFilter,js.needsUpdate=!0,(Js=new THREE.PerspectiveCamera).fov=80,Js.aspect=1,Js.updateProjectionMatrix(),(Ys=new THREE.Scene).add(Js),Zs=new THREE.Mesh(new THREE.SphereBufferGeometry(10,25,25),new THREE.RawShaderMaterial({uniforms:THREE.UniformsUtils.clone(on.uniforms),vertexShader:on.vertexShader,fragmentShader:on.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide})),Ys.add(Zs),rl.inited=!0)};var al=function(e){f(n,THREE.EventDispatcher);var t=el(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).view=i,r.sid=e.sid,r}return u(n,[{key:"update",value:function(e){var t=!1;if("sprite"==this.state&&this.mesh.visible&&(e||!this.mesh.material.uniforms.opacity||this.mesh.material.uniforms.opacity.value>0)&&(this.mesh.quaternion.copy(Vs.camera.quaternion),t=!0),this.strictScale){var n="floorplan"==Vs.mode?Vs.cameraControls.activeControl.camera:Vs.camera,i=he.getScaleForConstantSize({dom:Vs.$app.dom,maxSize:100,minSize:40,nearBound:2,farBound:80,camera:n,position:this.mesh.position});this.mesh.scale.set(i,i,i),t=!0}t&&this.view.dispatchEvent({type:"updatePose"})}},{key:"setStrictScale",value:function(e){this.strictScale=e,e?this.update():this.mesh.scale.set(1,1,1),this.view.dispatchEvent({type:"updatePose"})}},{key:"setMapIn",value:function(e){this.mesh.material.uniforms.mapIn.value=e}},{key:"dispose",value:function(){}}]),n}(),sl=function(e){f(n,e);var t=el(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).circleType=e.circleType,r.position=new THREE.Vector3,r.quaternion=new THREE.Quaternion,r.build(e),r}return u(n,[{key:"build",value:function(e){var t=THREE.UniformsUtils.clone(nn.uniforms),n=new THREE.Mesh(Ns,new THREE.RawShaderMaterial({uniforms:t,vertexShader:nn.vertexShader,fragmentShader:nn.fragmentShader,transparent:!0,side:THREE.DoubleSide}));if(n.renderOrder=_e,n.name="circle_"+(this.circleType?this.circleType:"")+this.sid,this.mesh=n,this.setMapOut(e),"exitDoor"==this.circleType)this.mesh.visible=!1,this.mesh.material.depthTest=!1,e.exitDirection&&this.mesh.position.copy(e.exitDirection),this.state="sprite";else{if(e.circle){e.circle.pos&&this.position.fromArray(e.circle.pos),e.circle.qua&&this.quaternion.fromArray(e.circle.qua);var i=e.circle.scale/100;e.circle.scale&&this.mesh.scale.set(i,i,i),this.state="3D",this.updatePos()}Vs.isOutsideMode()&&this.setVisible(!1)}}},{key:"updatePos",value:function(e,t){if("at360View"==e){new THREE.Vector3;var n=t.viewDir.clone().normalize();this.mesh.position.copy(n.multiplyScalar(Je.view360.circleDisToCenter)),this.at360View=!0,this.state="sprite"}else t&&(t.position&&this.position.copy(t.position),t.quaternion&&this.quaternion.copy(t.quaternion)),this.mesh.position.copy(this.position),this.mesh.quaternion.copy(this.quaternion),this.at360View=!1,this.state="3D",this.judgeDepthTest(),this.dispatchEvent({type:"move"})}},{key:"state",get:function(){return this._state},set:function(e){this._state=e,this.mesh&&this.update()}},{key:"judgeDepthTest",value:function(){this.mesh.material.depthTest=!("sprite"==this.state||this.selected)}},{key:"update",value:function(){At(w(n.prototype),"update",this).call(this),this.judgeDepthTest()}},{key:"setSelect",value:function(e){if(e!=this.selected){this.selected=e;this.judgeDepthTest(),pe.cancelById("circlePro"),pe.start(It.uniform(this.mesh,"progress",e?1:0),500,(function(){}),0,de[Je.transition.blendEasing],"circlePro")}}},{key:"setMapOut",value:function(e){var t;if("exitDoor"==this.circleType)if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=$n.load(e);else{var n;if(e.style)e.style.exit.name&&"custom"!=e.style.exit.name?n=Us.resource.getAppURL("images/link/exit-style-".concat(e.style.exit.name,".png")):e.style.exit.url&&(n=il(e.style.exit.url)),t=$n.load(n);else t=qs}else t=qs;else if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=$n.load(il(e));else{var i;if(e.style)e.style.enter.name&&"custom"!=e.style.enter.name?i=Us.resource.getAppURL("images/link/enter-style-".concat(e.style.enter.name,".png")):e.style.enter.url&&(i=il(e.style.enter.url)),t=$n.load(i);else t=Ws}else t=Ws;this.mesh.material.uniforms.mapOut.value=t}},{key:"setVisible",value:function(e){null==e&&(e=this._visible),Ae.updateVisible(this.mesh,"setVisible",!this.disabled&&e),this._visible=e}}]),n}(al),ll=function(e){f(n,e);var t=el(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).state="sprite",r.build(e),r}return u(n,[{key:"build",value:function(e){var t=THREE.UniformsUtils.clone(tn.uniforms);t.mapOut.value=Gs,t.mapOut2.value=js,t.opacity.value=0;var n=new THREE.Mesh(zs,new THREE.RawShaderMaterial({uniforms:t,vertexShader:tn.vertexShader,fragmentShader:tn.fragmentShader,transparent:!0,side:THREE.DoubleSide,depthTest:!1}));n.renderOrder=_e,n.name="balloon_"+this.sid,this.mesh=n,e.balloon&&e.balloon.pos&&this.mesh.position.fromArray(e.balloon.pos),this.mesh.visible=!1}},{key:"showOrHide",value:function(e,t,n){var i=this;if(!this.disabled){"auto"==n&&(e="panorama"!=Vs.getToMode()&&(Vs.model.allFloorsVisible||!this.view.floor||this.view.floor==Vs.model.currentFloor));t=null!=t?t:500;var o=e?1:0;pe.cancelById("balloonOpa_"+this.sid),this.mesh.material.uniforms.opacity.value!=o&&(e&&(this.mesh.visible=!0),this.update(!0),pe.start(It.uniform(this.mesh,"opacity",o),t,(function(t){i.mesh.material.depthTest="floorplan"!=Vs.modeTran.split("-")[1],i.mesh.visible=!!e,i.view.titleLabel.switchBind(e?"balloon":"circle")}),0,de[Je.transition.blendEasing],null,"balloonOpa_"+this.sid))}}},{key:"setSelect",value:function(e){if(e!=this.selected){this.selected=e;pe.cancelById("balloonPro"),pe.start(It.uniform(this.mesh,"activeProgress",e?1:0),300,(function(){}),0,de[Je.transition.blendEasing],"balloonPro")}}}]),n}(al),cl=function(e){f(n,e);var t=el(n);function n(e,i){var r;return o(this,n),(r=t.call(this,{text:e,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:5,margin:{x:12,y:10},player:Vs,fixOrient:!0,sizeInfo:{scale:.4,nearBound:3}})).sprite.material.depthTest=r.sprite.material.depthWrite=!0,r.view=i,r.visible=!1,setTimeout((function(){r.visible=!0,r.switchBind(i.balloon.mesh.visible?"balloon":"circle")}),1),r}return u(n,[{key:"switchBind",value:function(e){this.bindTo=e,"circle"==e?(this.fixOrient=!0,this.quaternion.copy(this.view.circle.mesh.quaternion)):(this.fixOrient=!1,this.view.balloon),this.updatePos()}},{key:"updatePos",value:function(){if(Ae.realVisible(this)){var e,t,n=new THREE.Vector3(0,-1,0);"circle"==this.bindTo?(e=this.view.circle.mesh,t=.08,this.quaternion.copy(this.view.circle.mesh.quaternion)):((e=this.view.balloon.mesh).scale.x,t=.2),e.updateMatrix(),n.multiplyScalar(t+Math.abs(e.geometry.attributes.position.array[0])),n.applyMatrix4(e.matrix),this.position.copy(n),this.updatePose()}}}]),n}(Ki);function ul(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var hl=function(e){f(n,e);var t=ul(n);function n(e,i){var r;o(this,n),(r=t.call(this)).app=e,r.player=i,r.sceneRenderer=e.core.get("SceneRenderer"),r.sceneNum=e.config.num,r.painting=!1,r.pause=!1,r.mousePosition=new THREE.Vector4,r.currentPaintUrl=null;var a=e.store.getValue("metadata");return a?(r.paintData=a.mosaicList,r.width=1024*("pro"==a.sceneFrom?2:4),r.height=1024*("pro"==a.sceneFrom?1:2)):e.store.on("metadata",(function(e){r.paintData=e.mosaicList,r.width=1024*("pro"==e.sceneFrom?2:4),r.height=1024*("pro"==e.sceneFrom?1:2)})),r}return u(n,[{key:"init",value:function(){var e=this,t=new THREE.Vector3(this.width,this.height,window.devicePixelRatio);this.bufferRenderer=new pl(this.sceneRenderer.renderer,{width:this.width,height:this.height}),this.bufferShader=new dl({iResolution:{value:t},iMouse:{value:this.mousePosition},iChannel0:{value:null},iChannel1:{value:null},iBrushType:{value:1},iBrushSize:{value:5},iAngle:{value:0},iPitch:{value:0},iIsBrush:{value:0}}),Object.assign(this.player.model.skybox.material.uniforms,this.bufferShader.uniforms),this.player.model.chunks.forEach((function(t){return Object.assign(t.materialInside.uniforms,e.bufferShader.uniforms)}))}},{key:"start",value:function(e){var t=this;this.player.reticule.visible=!1,this.player.cameraControls.activeControl.enabled=!1,this.mousePosition.setZ(0);var n=this.player.camera.getWorldDirection(new THREE.Vector3),i=n.clone().projectOnPlane(new THREE.Vector3(0,1,0)),o=n.angleTo(i)*Math.sign(-n.y),r=n.clone().setY(0),a=(new THREE.Euler).setFromQuaternion(this.player.currentPano.quaternion),s=new THREE.Vector3(1,0,0).applyEuler(a).setY(0),l=new THREE.Vector3(0,0,1).applyEuler(a).setY(0),c=r.angleTo(s)*Math.sign(r.dot(l));if(this.bufferShader.uniforms.iAngle.value=c,this.bufferShader.uniforms.iPitch.value=o,e)this.showBrush(!0),this.pause=!1;else{var u=function(e){t.bufferRenderer.readBuffer=new THREE.WebGLRenderTarget(t.width,t.height,t.bufferRenderer.bufferOptions),e&&(t.bufferRenderer.readBuffer.texture=e),t.bufferRenderer.writeBuffer=new THREE.WebGLRenderTarget(t.width,t.height,t.bufferRenderer.bufferOptions),t.setPaintTexture("paint0Map",t.bufferRenderer.readBuffer.texture),t.setPaintTexture("paint1Map",t.bufferRenderer.readBuffer.texture),t.painting=!0,t.pause&&t.cancel(!0)};this.currentPaintUrl?(new THREE.TextureLoader).load(this.currentPaintUrl,(function(e){e.minFilter=THREE.LinearFilter,e.magFilter=THREE.LinearFilter,e.type=THREE.FloatType,e.needsUpdate=!0,u(e)})):u(),this.player.locked=!0,this.hasEdit=!1,this.defineHasPaint(!0),$n.load(this.app.resource.getViewImagesURL("pan/high/".concat(this.player.currentPano.id,".jpg")),(function(e){t.bufferShader.uniforms.iChannel1.value=e,t.showBrush(!0),t.emit("start")}))}}},{key:"cancel",value:function(e){this.player.reticule.visible=!0,this.player.cameraControls.activeControl.enabled=!0,this.showBrush(!1),e?this.pause=!0:(this.painting=!1,this.hasEdit=!1,this.player.locked=!1,this.setPaintImage(this.currentPaintUrl,this.currentPaintUrl),this.bufferRenderer.readBuffer.dispose(),this.bufferRenderer.writeBuffer.dispose())}},{key:"save",value:function(){var e=this,t=this.player.currentPano.id;return{panoId:t,data:this.bufferRenderer.save(),func:function(){e.currentPaintUrl=e.bufferRenderer.base64,e.paintData||(e.paintData=[]);var n=e.paintData.find((function(e){return e.panoId==t}));n?n.data=e.bufferRenderer.base64:e.paintData.push({panoId:t,data:e.bufferRenderer.base64})}}}},{key:"update",value:function(){this.painting&&!this.pause&&(this.bufferShader.uniforms.iChannel0.value=this.bufferRenderer.readBuffer.texture,this.bufferRenderer.render(this.bufferShader.scene,this.bufferShader.camera))}},{key:"showBrush",value:function(e){this.sceneRenderer.renderer.domElement.style.cursor=e?"none":"default",this.player.model.skybox&&(this.player.model.skybox.material.uniforms.iShowBrush.value=e?1:0),this.player.model.chunks.forEach((function(t){return t.materialInside.uniforms.iShowBrush.value=e?1:0}))}},{key:"changeBrush",value:function(e){-1==parseInt(e)?this.cancel(!0):(this.pause&&this.start(!0),this.bufferShader.uniforms.iBrushType.value=parseInt(e))}},{key:"setBrushSize",value:function(e){this.bufferShader.uniforms.iBrushSize.value=parseFloat(e)}},{key:"updatePanoPaint",value:function(e,t){if(this.paintData){var n=this.paintData.find((function(t){return t.panoId==e})),i=n&&(n.data||this.app.resource.getUserResourceURL(n.fileName)),o=this.paintData.find((function(e){return e.panoId==t})),r=o&&(o.data||this.app.resource.getUserResourceURL(o.fileName));this.currentPaintUrl=null!=t?r:i,this.setPaintImage(i,r)}}},{key:"setPaintImage",value:function(e,t){var n=this;this.defineHasPaint(!!t||!!e),e?$n.loadWithoutUpdate(e,(function(e){return n.setPaintTexture("paint0Map",e)}),(function(){})):this.setPaintTexture("paint0Map",null),t?$n.loadWithoutUpdate(t,(function(e){return n.setPaintTexture("paint1Map",e)}),(function(){})):this.setPaintTexture("paint1Map",null)}},{key:"setPaintTexture",value:function(e,t){t&&(t.minFilter=THREE.LinearFilter,t.magFilter=THREE.LinearFilter),this.app.core.get("QuickstartManager").skybox.material.uniforms[e].value=t,this.player.model.skybox&&(this.player.model.skybox.material.uniforms[e].value=t),this.player.model.chunks.forEach((function(n){return n.materialInside.uniforms[e].value=t})),this.player.model.highMapCube&&this.player.model.highMapCube.tiles.forEach((function(n){n.material.uniforms[e].value=t}))}},{key:"defineHasPaint",value:function(e){var t=[];t.push(this.app.core.get("QuickstartManager").skybox.material),this.player.model.skybox&&t.push(this.player.model.skybox.material),this.player.model.chunks.forEach((function(e){return t.push(e.materialInside)})),this.player.model.highMapCube&&t.push.apply(t,H(this.player.model.highMapCube.tiles.map((function(e){return e.material})))),e?t.forEach((function(e){return e.defines.HasPaint=!0,e.needsUpdate=!0})):t.forEach((function(e){return delete e.defines.HasPaint,e.needsUpdate=!0}))}},{key:"dealPointerDown",value:function(){this.player.locked?(this.hasEdit=!0,this.mousePosition.setZ(1)):this.once("start",this.dealPointerDown.bind(this))}},{key:"dealPointerMove",value:function(e){e.x=(e.x-window.innerWidth/2)/(this.player.zoomLevel+.2*(this.player.zoomLevel-1))+window.innerWidth/2,e.y=(e.y-window.innerHeight/2)/(this.player.zoomLevel+.2*(this.player.zoomLevel-1))+window.innerHeight/2,this.mousePosition.setX(e.x/window.innerWidth*this.width),this.mousePosition.setY((1-e.y/window.innerHeight)*this.height)}},{key:"dealPointerUp",value:function(){this.mousePosition.setZ(0)}}]),n}(vo),dl=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.uniforms=t,this.material=new THREE.RawShaderMaterial({fragmentShader:sn.model.fragmentBufferShader,vertexShader:sn.model.vertexShader,uniforms:t,side:THREE.DoubleSide}),this.scene=new THREE.Scene,this.scene.add(new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2),this.material)),this.camera=new THREE.PerspectiveCamera(90,1,.01,1e3),this.camera.position.set(0,0,1)},pl=function(){function e(t,n){o(this,e),this.renderer=t,this.width=n.width,this.height=n.height,this.bufferOptions={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,type:THREE.FloatType,stencilBuffer:!1},this.readBuffer=null,this.writeBuffer=null}return u(e,[{key:"render",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n)this.renderer.render(e,t);else{var i=this.renderer.autoClear;this.renderer.autoClear=!1,this.renderer.setRenderTarget(this.writeBuffer),this.renderer.render(e,t),this.renderer.setRenderTarget(null),this.renderer.autoClear=i}var o=[this.writeBuffer,this.readBuffer];this.readBuffer=o[0],this.writeBuffer=o[1]}},{key:"save",value:function(){var e=new Float32Array(this.width*this.height*4);this.renderer.readRenderTargetPixels(this.readBuffer,0,0,this.width,this.height,e),this.outputCanvas=document.createElement("canvas"),this.outputCanvas.width=this.width,this.outputCanvas.height=this.height;for(var t=this.outputCanvas.getContext("2d"),n=4*this.width,i=0;i<this.height;i++){for(var o=this.height-1-i,r=t.createImageData(this.width,1),a=o*this.width*4,s=0;s<n;s++)r.data[s]=255*e[a+s];t.putImageData(r,0,i)}return this.base64=this.outputCanvas.toDataURL("image/png"),this.base64}}]),e}();function fl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ml=function(e){f(n,THREE.Group);var t=fl(n);function n(e,i){var r;if(o(this,n),(r=t.call(this)).manager=e,r.version=0,r.axisAngle={x:0,y:0,z:0},i)r.setFromInfo(i),r.updateInfo(!0);else{r.sid=Ae.getRandomSid(),r.panoId=r.manager.player.currentPano.id,r.isNew=!0,r.position.setY(1e3);var a=new THREE.MeshBasicMaterial({color:"#00c8af",opacity:.4,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-.9,polygonOffsetUnits:-4}),s=new THREE.BoxGeometry(.5,.5,.5);s.translate(0,.25,0);var l=new THREE.Mesh(s,a);r.add(l)}return r}return u(n,[{key:"load",value:function(e){this.children.forEach((function(e){e.geometry.dispose(),e.material.dispose()})),this.children=[],e&&(this.url=e,Xa("".concat(this.manager.player.$app.resource.getUserModelResourceURL(e),"&v=").concat(this.version),function(e){var t=this,n=[];e.scene.traverse((function(e){return"Mesh"==e.type&&n.push(e)})),n.forEach((function(e){t.add(e),e.renderOrder=De,e.material.transparent=!0})),this.version++,this.dispatchEvent({type:"loaded"})}.bind(this)))}},{key:"remove",value:function(){this.removeFromParent(),this.children.forEach((function(e){e.geometry.dispose(),e.material.dispose()}))}},{key:"setFromInfo",value:function(e){this.sid=e.sid,this.panoId=e.panoId,this.url!=e.url&&this.load(e.url),this.zipName=e.zipName,this.visible=e.visible,this.setTransformFromInfo(e)}},{key:"setTransformFromInfo",value:function(e){var t=e.position,n=e.rotation,i=e.scale;this.position.set(parseFloat(t.x),parseFloat(t.y),parseFloat(t.z)),this.setAxisAngle("x",THREE.MathUtils.degToRad(n.x)),this.setAxisAngle("y",THREE.MathUtils.degToRad(n.y)),this.setAxisAngle("z",THREE.MathUtils.degToRad(n.z)),this.scale.set(parseFloat(i.x),parseFloat(i.y),parseFloat(i.z))}},{key:"setAxisAngle",value:function(e,t){var n="x"==e?$i.RIGHT:"y"==e?n=$i.UP:$i.BACK;this.rotateOnAxis(n,t-this.axisAngle[e]),this.axisAngle[e]=t}},{key:"updateInfo",value:function(e){var t={sid:this.sid,panoId:this.panoId,url:this.url,zipName:this.zipName,position:{x:parseFloat(this.position.x.toFixed(2)),y:parseFloat(this.position.y.toFixed(2)),z:parseFloat(this.position.z.toFixed(2))},rotation:{x:parseInt(THREE.MathUtils.radToDeg(this.axisAngle.x)),y:parseInt(THREE.MathUtils.radToDeg(this.axisAngle.y)),z:parseInt(THREE.MathUtils.radToDeg(this.axisAngle.z))},scale:{x:parseFloat(this.scale.x.toFixed(1)),y:parseFloat(this.scale.y.toFixed(1)),z:parseFloat(this.scale.z.toFixed(1))},visible:this.visible};return e&&(this.info=t),t}}]),n}(),vl=function(){function e(t){o(this,e),this.player=t,this.editing=!1,this.adding=null,this.selecting=null,this.group=new THREE.Group,this.group.name="GLTFDecorations",t.model.add(this.group),this.bindEvents()}return u(e,[{key:"show",value:function(e,t){var n=this;this.group.children.forEach((function(i){i!==n.adding&&i!==n.selecting&&(t&&!i.info.visible||"all"!=e&&n.player.model.panos.get(i.panoId).floorIndex!=e||(i.visible=!0))}))}},{key:"hide",value:function(e){var t=this;this.group.children.forEach((function(n){n!==t.adding&&n!==t.selecting&&("all"!=e&&t.player.model.panos.get(n.panoId).floorIndex!=e||(n.visible=!1))}))}},{key:"bindEvents",value:function(){var e,t=this;this.player.on("pointerUp",this.onMouseUp.bind(this)),this.player.on("pointerMove",this.onMouseMove.bind(this)),this.player.model.transformControls.addEventListener("mouseDown",(function(){t.selecting&&(e=JSON.parse(JSON.stringify(t.selecting.axisAngle)))})),this.player.model.transformControls.addEventListener("mousing",(function(n){if(t.selecting){if("rotate"==n.mode){var i=n.axis.toLowerCase(),o=e[i]+n.angle;t.selecting.axisAngle[i]=((o+Math.PI)%(2*Math.PI)-2*Math.PI)%(2*Math.PI)+Math.PI}t.player.$app.Scene.Decoration.emit("Decoration.GLTF.select",t.selecting.updateInfo())}})),this.player.model.transformControls.addEventListener("mouseUp",(function(){t.selecting}))}},{key:"onMouseUp",value:function(e){if(!this.player.EditOverlay.isAdding&&!this.player.EditOverlay.editPlane&&!this.selecting&&this.editing)if(this.adding)e.consume(),this.adding.updateInfo(!0),this.select(this.adding),this.adding=null;else if(this.player.mouseCouldBeClickToMove){var t=this.player.getMouseIntersect(null,this.group.children.filter((function(e){return e.visible})));if(t){e.consume();var n=t.object.parent;this.select(n),this.player.flyToPano({pano:this.player.model.panos.get(n.panoId),lookAtPoint:n.position,checkAlone:!0})}}}},{key:"onMouseMove",value:function(){if(this.adding){var e=this.player.getMouseIntersect(null,this.player.model.colliders);e&&this.adding.position.copy(e.point)}}},{key:"select",value:function(e){this.selecting=e,this.player.model.transformControls.switchEditState("decoration"),this.player.model.transformControls.attach(e),this.player.$app.Scene.Decoration.emit("Decoration.GLTF.select",e.updateInfo()),this.player.compass.switch("axis")}},{key:"unselect",value:function(){this.selecting=null,this.player.model.transformControls.detach(),this.player.compass.switch("direction")}},{key:"add",value:function(e){var t=new ml(this,e);return this.group.add(t),e||(this.adding=t),t}},{key:"delete",value:function(e){e==this.selecting&&this.unselect(),e.remove()}},{key:"save",value:function(e){return{data:this.selecting.updateInfo(),successCallBack:function(){try{this.selecting.isNew=!1,this.selecting.updateInfo(!0),this.unselect(),e&&e()}catch(e){console.error(e)}}.bind(this)}}}]),e}();function gl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("Player",(function(){return function(e){f(n,EventEmitter);var t=gl(n);function n(){var e,i,r,a,s,l;return o(this,n),(e=t.call(this)).setupCustomProperties=function(e){var t=e||ht.PANORAMA;Object.defineProperty(this,"mode",{get:function(){return t},set:function(e){var n=t;t=e,this.onModeUpdated(n,t)}})},e.isOutsideMode=function(e){return(e=e||this.mode)===ht.DOLLHOUSE||e===ht.FLOORPLAN},e.is360View=function(e,t){return e===ht.PANORAMA&&t&&"360view"==t.panoType},e.setScene=function(){var e=this.$app.core.get("SceneRenderer").scene;this.sceneIntersectionPlane=e.plane,this.path.setScene(e),this.moveReticuleToScene(e)},e.moveReticuleToScene=function(e){this.reticule.parent&&this.reticule.parent.remove(this.reticule),e.add(this.reticule)},e.updateModel=function(){var e=this;this.model=this.modelManager.getActiveModel(),this.model.player=this,this.paintEditor.init(),this.on(zr,(function(t,n,i){e.model.setProjectedPanos(t,n,i),e.paintEditor&&e.paintEditor.updatePanoPaint(t.id,n.id),e.$app.FilterManager&&e.$app.FilterManager.updatePanoFilters(t,n)})),this.on(Wr,this.model.resetHighMap.bind(this.model))},e.updateModelDependentData=function(){this.cameraControls.setModelForControls(this.model),this.getPanoMarkersFromModel(this.model)},e.getPanoMarkersFromModel=function(e){this.panoMarkers=e.panos.list.reduce((function(e,t){return t.marker?e.concat(t.marker):e}),[])},e.handleControlMove=function(e){this.emit(Hr,e),this.mode===ht.PANORAMA&&this.emit(Qr,{quaternion:this.cameraControls.activeControl.camera.quaternion,mode:ht.PANORAMA,currentPanoId:this.currentPano?this.currentPano.id:null,type:"rotate"})},e.handleControlInputStart=function(e){this.emit($r,e)},e.onModeUpdated=function(e,t){this.cameraControls.activateControls(t),this.emit(Ur,e,t),"transitioning"==t?(e=this.modeTran.split("-")[0])==ht.PANORAMA&&(this.flyingToTag=this.flyRotate=this.flyingWithRot=!1):(t=this.modeTran.split("-")[1],this.isOutsideMode(e)&&this.isOutsideMode(t)||this.model.fadePanoMarkers(null,0),ht.PANORAMA)},e.isWarping=function(){return!1},e.isWaitingToWarp=function(){return!1},e.bindEvents=function(e){e!==document&&e.setAttribute("tabindex",-1),e.addEventListener("mousedown",this.onMouseDown.bind(this)),e.addEventListener("mousemove",this.onMouseMove.bind(this)),e.addEventListener("mouseover",this.onMouseOver.bind(this)),e.addEventListener("mouseout",this.onMouseOut.bind(this)),e.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("touchstart",this.onTouchStart.bind(this),{passive:!1}),e.addEventListener("touchmove",this.onTouchMove.bind(this),{passive:!1}),e.addEventListener("touchend",this.onTouchEnd.bind(this)),e.addEventListener("pointerdown",this.onPointerDown.bind(this)),e.addEventListener("pointermove",this.onPointerMove.bind(this)),e.addEventListener("pointerup",this.onPointerUp.bind(this)),e.addEventListener("pointerout",this.onPointerOut.bind(this)),e.addEventListener("pointercancel",this.onPointerCancel.bind(this)),document.addEventListener("keydown",this.onKeyDown.bind(this)),this.cameraControls.on(wa,this.handleControlMove.bind(this)),this.cameraControls.on(xa,this.handleControlInputStart.bind(this)),this.cameraControls.on(Ia,this.handleControlPinch.bind(this)),this.cameraControls.on(Ta,this.handleControlScroll.bind(this))},e.onMouseDown=function(e){e.currentTarget!==document&&e.currentTarget.focus(),0===e.button&&(this.handleInputStart.call(this,e.clientX,e.clientY,!1),this.updateIntersect())},e.onMouseMove=function(e){this.isTouchEvent=!1,this.containsMouse=!0,this.handleInputMove.call(this,e.clientX,e.clientY,!1)},e.onMouseOver=function(e){this.containsMouse=!0,!this.mouseDown||0!==e.which&&0!==e.buttons||(this.mouseDown=!1)},e.onMouseOut=function(e){this.containsMouse=!1},e.onMouseUp=function(e){this.handleInputEnd.call(this,e.clientX,e.clientY,!1),this.emit(Vr,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})},e.onTouchStart=function(e){if(e.currentTarget!==document&&e.currentTarget.focus(),!this.mouseDown){this.couldBeLongTap=!0;var t=Ae.average(e.changedTouches,"clientX"),n=Ae.average(e.changedTouches,"clientY");this.handleInputStart.call(this,t,n,!0),this.mouseDownTimer=setTimeout(function(){this.updateIntersect(),this.handleInputEnd.call(this,t,n,!0)}.bind(this),Je.input.longTapThreshold)}},e.onTouchMove=function(e){var t=Ae.average(e.changedTouches,"clientX"),n=Ae.average(e.changedTouches,"clientY");this.handleInputMove.call(this,t,n,!0)},e.onTouchEnd=function(e){if(clearTimeout(this.mouseDownTimer),this.mouseDown){this.couldBeLongTap=!1,this.updateIntersect();var t=Ae.average(e.changedTouches,"clientX"),n=Ae.average(e.changedTouches,"clientY");this.handleInputEnd.call(this,t,n,!0),this.emit(Vr,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})}},e.onPointerDown=function(e){return e.currentTarget!==document&&e.currentTarget.focus(),this.mouseDown||"mouse"===e.pointerType?this.onMouseDown(e):(this.couldBeLongTap=!0,this.handleInputStart.call(this,e.clientX,e.clientY,!0),void(this.mouseDownTimer=setTimeout(function(){this.updateIntersect(),this.handleInputEnd.call(this,e.clientX,e.clientY,!0)}.bind(this),Je.input.longTapThreshold)))},e.onPointerMove=function(e){"mouse"!==e.pointerType?this.handleInputMove.call(this,e.clientX,e.clientY,!0):this.onMouseMove(e)},e.onPointerUp=function(e){this.mouseDown&&"mouse"!==e.pointerType?(this.mouseDownTimer&&clearTimeout(this.mouseDownTimer),this.couldBeLongTap=!1,this.updateIntersect(),this.handleInputEnd.call(this,e.clientX,e.clientY,!0),this.emit(Vr,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})):this.onMouseUp(e)},e.onPointerOut=function(e){this.mouseDown=!1},e.onPointerCancel=function(e){this.mouseDown=!1},e.onKeyDown=function(e){if(this.$app.config.useShortcutKeys){var t=function(){this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(wa,"key")}.bind(this),n=e.which;switch(n){case La.F:t(),this.changeFloor(-1);break;case La.R:t(),this.changeFloor(1)}if(this.mode===ht.PANORAMA)switch(n){case La.UPARROW:case La.W:this.flyLocalDirection($i.FORWARD.clone());break;case La.DOWNARROW:case La.S:this.flyLocalDirection($i.BACK.clone());break;case La.A:this.flyLocalDirection($i.LEFT.clone());break;case La.D:this.flyLocalDirection($i.RIGHT.clone())}if(this.started)switch(n){case La.ONE:this.insideMode();break;case La.TWO:this.flyToNewMode({mode:ht.DOLLHOUSE});break;case La.THREE:this.flyToNewMode({mode:ht.FLOORPLAN})}}},e.handleScrollPinchZoom=function(e){var t=e,n=this.zoomLevel;this.zoomBy(t),this.currentPano&&this.zoomStats.addZoomAction(n,this.zoomLevel,this.currentPano.id)},e.handleControlPinch=function(e){Je.zoom.enabled?this.handleScrollPinchZoom(1-e):this.$app.config.useShortcutKeys&&this.flyLocalDirection(new THREE.Vector3(0,0,e).normalize())},e.handleControlScroll=function(e){this.emit(Or,{zoom:e,type:"zoom"}),Je.zoom.enabled?(e>0?e=1+this.scrollZoomSpeed:e<0&&(e=1-this.scrollZoomSpeed),0!==e&&this.handleScrollPinchZoom(e)):this.$app.config.useShortcutKeys&&this.flyLocalDirection(new THREE.Vector3(0,0,-e).normalize())},e.handleInputStart=function(e,t,n,i){var o,r={x:e,y:t};i||(r=he.handelPadding(e,t,this.domElement)),he.convertScreenPositionToNDC(r.x,r.y,this.mouse,this.domElement),he.convertScreenPositionToNDC(r.x,r.y,this.mouseAtMouseDown,this.domElement),this.mouseCouldBeClickToMove=!0,this.mouseDown=!0,this.updateIntersect();this.emit("pointerStart",{consume:function(){o=!0},getConsumed:function(){return o}}),o||(this.EditPanoVideo&&this.EditPanoVideo.editing?this.EditPanoVideo.dealPointerDown():this.EditPanoMosaic&&this.EditPanoMosaic.editing?this.EditPanoMosaic.dealPointerDown():this.model.transformControls&&this.model.transformControls.handleDragStart(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerDown(),this.aimQuaternion=null)},e.handleInputMove=function(e,t,n){this.isTouchEvent=n;var i,o=he.handelPadding(e,t,this.domElement);he.convertScreenPositionToNDC(o.x,o.y,this.mouse,this.domElement),this.mouseAtMouseDown.distanceTo(this.mouse)>.01&&(this.mouseCouldBeClickToMove=!1,this.couldBeLongTap=!1,clearTimeout(this.mouseDownTimer),this.model.transformControls&&this.model.transformControls.handleDragging()),this.EditPanoMosaic&&this.EditPanoMosaic.editing&&this.EditPanoMosaic.dealPointerMove(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerMove(o);this.emit("pointerMove",{consume:function(){i=!0},getConsumed:function(){return i}}),i||(this.mouseLastMoveTime=Date.now(),this.reticule.move(e,t,n))},e.handleInputEnd=function(e,t,n){var i,o=this;if(this.isTouchEvent=n,this.mouseDown=!1,this.cameraControls.controls[ht.PANORAMA].emit("interaction.direct"),!n&&this.couldBeLongTap)return!0;this.model.transformControls&&this.model.transformControls.handleDragEnd(),this.EditPanoVideo&&this.EditPanoVideo.dealPointerUp(),this.EditPanoMosaic&&this.EditPanoMosaic.dealPointerUp(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerUp();if(this.emit("pointerUp",{consume:function(){i=!0},getConsumed:function(){return i}}),!i){if(this.handleLongTap())return!0;if(this.mouseCouldBeClickToMove){if(this.flying)return this.flyToPanoClosestToMouse();//!0; 改for panoTask
- if(this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),this.linkEditor&&this.linkEditor.setPanoVisible){var r=[].concat(H(this.linkEditor.actionIcons),H(this.linkEditor.footIcons)).filter((function(e){return e.pano.floorIndex==o.model.currentFloor.floorIndex}));if(this.intersect=this.getMouseIntersect(null,r),this.intersect&&this.intersect.object.visible){var a=this.intersect.object;if("ActionIcon"!=a.type||this.linkEditor.activePano||"floor"!=a.footIcon.status)this.linkEditor.dealPanoVisible(this.intersect.object.name,this.intersect.object);else{var s=this;this.$app.WalkManager.emit("walkManager.floorPointHide",(function(){s.linkEditor.dealPanoVisible(s.intersect.object.name,s.intersect.object)}))}}return}if(this.linkEditor&&this.linkEditor.setTagVisible)return void(this.linkEditor.tagVsetting&&this.intersect&&this.intersect.object.visible&&this.linkEditor.dealTagVisible(this.linkEditor.tagVsetting,this.intersect.object.name));var l,c=this.getMouseIntersect(null,this.measureRulers.filter((function(e){return"active"==e.state})).map((function(e){return e.boldLine})));if(c&&c.object.parentRuler)return void c.object.parentRuler.showOptionLabel(!0,c.point);if(this.EditOverlay&&this.EditOverlay.isAdding)return void(this.intersect&&this.EditOverlay.addOverlay({intersect:this.intersect}));if(this.OverlayManager.hoveringPlane)return void this.OverlayManager.clickOverlay(this.OverlayManager.hoveringPlane);if(this.intersect&&this.billboardManager&&this.billboardManager.isAdding)return this.billboardManager.startInsertion({intersect:this.intersect});if(this.emit("click",{intersect:this.intersect,consume:function(){l=!0},getConsumed:function(){return l},raycaster:this.raycaster}),l)return;if(this.currentPano&&this.is360View(this.mode,this.currentPano))return;if(this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(wa,this.isTouchEvent?"touch":"mouse"),this.history.invalidate(),this.intersect)return this.flyToPanoClosestToMouse();if(this.mode===ht.PANORAMA){var u=this.closestPanoInDirection(this.getMouseDirection());return u?this.flyToPano({pano:u}):this.bump(this.getMouseDirection())}}this.intersect&&this.closestPano&&this.closestPano.hoverOff(this.mode)}},e.handleLongTap=function(){if(this.couldBeLongTap&&(!this.isPanoHover||this.mode!==ht.PANORAMA))return this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Ra,"touch"),!0},e.start=function(e){var t=this,n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.tag,s=e.quickstart,l=vt();this.updateModelDependentData(),this.updateFromControls();var c=this.is360View(n,i);return!this.model.outsideAllowed()||c||s?this.startInside(i,o,r,a,l):(this.startOutside(e,l),this.once(qr,(function(e){t.emit(Jr,c,e,a),t.started=!0}))),this.compass=new $s(this),this.linkEditor=new bs(this),this.labelManager=new Qs(this),l},e.startOutside=function(e,t){var n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.zoom,s=e.floorVisibility,l=e.tag;this.emit(Zr,Je[n].transitionTime),this.isOutsideMode(n)?(this.model.warpDestFloors(s,!0),pe.cancelById(Je.freeze.FlyToViewFloor),n===ht.FLOORPLAN?this.floorplanMode(o,r,a):this.dollhouseMode(o,r),t.resolve(!1)):this.startInsideWithFlyin(i,o,r,l,t),this.beforeChangeMode(null,n)},e.startInside=function(e,t,n,i,o){o=o||vt(),this.currentPano=e;var r=e&&!e.isAligned();if(t=r?e.position:t||e.position,n=n||e.quaternion,e){var a=this.startInside.bind(this,e,t,n,i,o);if(this.checkAndWaitForPanoLoad(e,"high","low",this.basePanoSize,a))return}this.modeTran="panorama-panorama",this.beforeChangeMode(null,ht.PANORAMA,this.currentPano,0),this.afterChangeMode(null,ht.PANORAMA),e.enter(),this.mode=ht.PANORAMA,e.floor.enter(this.mode),this.emit(zr,this.currentPano,this.currentPano),this.switchCameraMode(this.mode,n),this.emit(Yr,r);var s=this.$app.core.get("PanoVideoRenderer");return s.setMuted(!0),s.activatePanorama(this.currentPano),o.resolve(!0),o},e.startInsideWithFlyin=function(e,t,n,i,o){if(o=o||vt(),this.dollhouseMode(),!e)return nt.warn("Player.startInsideWithFlyin() -> targetPano is invalid."),o.resolve(!1),o;t=t||e.position;var r=n||this.cameraControls.activeControl.camera.quaternion,a=e.position;return this.fitDollhouse(a,t,r),setTimeout(function(t){this.cameraControls.activeControl&&(this.cameraControls.activeControl.maxDistance=t);var i={mode:ht.PANORAMA,pano:e,quaternion:n,callback:function(){this.emit(jr),o.resolve(!0)}.bind(this)};this.flyToNewMode(i)}.bind(this,this.cameraControls.activeControl.maxDistance),Je.startupFlyinDelay),o},e.checkAndWaitForPanoLoad=(i={},r={},a={},function(e,t,n,o,s,l,c,u,h,d){if(function(e){if(i.hasOwnProperty(e.id)&&i[e.id]&&performance.now()-r[e.id]<5e3)return!0}(e))return e.id,a[e.id]=s,!0;var p=function(t,n,o){Ae.delayOneFrame(function(){i[t]=!1,a[e.id]&&a[e.id](n,o),a[e.id]=null}.bind(this))}.bind(this,e.id),f=function(e,t){Ae.delayOneFrame(function(){this.panosTaskList=[],i[e]=!1,l&&l(t)}.bind(this))}.bind(this,e.id);try{return null!=u||(u=!0),e.tiled?i[e.id]=this.checkAndWaitForTiledPanoLoad(e,o,p,f,c,u,h,d):i[e.id]=this.checkAndWaitForWholePanoLoad(e,t,n,p,u),i[e.id]&&(r[e.id]=performance.now(),a[e.id]=s),i[e.id]}catch(t){throw i[e.id]=!1,r[e.id]=performance.now()-5e3,t}}),e.checkAndWaitForWholePanoLoad=function(e,t,n,i,o){if(!e)throw new BasicException("Player.checkAndWaitForWholePanoLoad() -> Cannot load texture for null pano.");return o&&this.model.waitForLoad(e,(function(){return e.isLoaded(n)})),!e.isLoaded(t)&&(e.loadCube(t).done(i),!0)},e.checkAndWaitForTiledPanoLoad=(s=new THREE.Vector3,function(e,t,n,i,o,r,a,l){if(!e)throw new BasicException("Player.checkAndWaitForTiledPanoLoad() -> Cannot load texture for null pano.");if(s.copy($i.FORWARD),this.getDirection(s),!e.isLoaded(t))return r&&this.model.waitForLoad(e,(function(){return e.isLoaded(t)})),e.loadTiledPano(t,s,null,a,l).done(function(e,t){n&&n(e,t)}.bind(this)).fail(function(e){i&&i(e)}.bind(this)).progress(function(e,t,n){o&&o(e,t,n)}.bind(this)),!0}),e.switchCameraMode=function(e,t,n,i,o){var r,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=this.cameraControls.controls[e],l=s.camera;if(e==ht.PANORAMA)l.position.copy(this.currentPano.position),r=t?$i.FORWARD.clone().applyQuaternion(t):this.getDirection().setY(0).normalize(),s.lookAt(r.add(l.position));else if(n&&s.target.copy(n),i&&l.position.copy(i),e==ht.DOLLHOUSE){if(!i&&!n){if(a.dontFitScreen&&this.mode===ht.PANORAMA)i=this.position.clone(),this.mode===ht.PANORAMA?i.add(new THREE.Vector3(0,6,0)).add(this.getDirection().multiplyScalar(-10)):i.add($i.DOWN.clone().applyQuaternion(this.quaternion).multiplyScalar(6)).setY(6);else{var c;this.mode===ht.PANORAMA?(s.target.copy(this.model.center).setY(this.model.boundingBox.min.y+2),c=this.getDirection().negate().setY(1).normalize()):(s.target.copy(this.target.clone().setY(this.model.boundingBox.min.y+2)),c=$i.DOWN.clone().applyQuaternion(this.quaternion).setY(1).normalize());var u=s.suitableDistance;c.multiplyScalar(u),i=s.target.clone().add(c)}l.position.copy(i)}}else if(e==ht.FLOORPLAN){if(n||s.target.copy(this.model.center).setY(0),!i){var h="panorama"==this.mode?.7*this.cameraControls.controls.dollhouse.suitableDistance:THREE.MathUtils.clamp(this.camera.position.y,1,Je.floorplan.cameraHeight);h=Math.max(h,this.model.boundingBox.max.y+ke.orthoNear+.1),l.position.copy(this.model.center).setY(h),s.rotateToView(this.model.size,this.getDirection())}o?a.fitBoundSize?s.zoomToContain(this.fitBoundSize):s.currentScale=s.absoluteScale=o:s.zoomToContain(this.model.size)}s.update(0)},e.update=function(){var e,t={},n=2;return function(i){if(this.updatePersistentZooming(i),this.updateFromControls(i),this.lastFrameChanged=!1,this.hasChanged(t)&&(this.lastFrameChanged=t.cameraChanged3?"level3":t.cameraChanged2?"level2":!!t.cameraChanged&&"level1",this.lastChangeTime=Date.now(),!this.mouseDown&&this.containsMouse&&this.updateIntersect(),this.emit(Xr,t),t.cameraChanged&&(this.compass&&this.compass.update(this.quaternion),this.model.floorLogos.updateFloorlogo(this.camera&&this.camera.quaternion,this),this.linkEditor&&(this.linkEditor.setTagVisible||this.linkEditor.setPanoVisible)&&this.linkEditor.updateFootIconSize(),this.updateLabelZIndex(["dollLabels","doorLabels"]),this.chosenMeasureRuler&&this.chosenMeasureRuler.updateOptionPos(),e=!0),(t.cameraChanged||t.floorChanged||t.allFlVisiChanged)&&this.dollLabels.concat(this.planLabels).concat(this.doorLabels).concat(this.measureRulers).forEach((function(e){e.update()}))),e)if(0==n--)Hs.updateCameraDir(this),this.setAnimateMakerPano(),n=15,e=!1;else if(n%Math.round(5)==0&&this.model.supportsTiles){var o=this.panosTaskList.length>1?this.panosTaskList.map((function(e){return e.pano})):[];this.updateTileDownloader(o),this.updatePanoRenderer(),this.updateZoomPano()}this.paintEditor&&this.paintEditor.painting&&this.paintEditor.update(),this.reticule.update(),this.cachedPanoCandidates&&Je.navigation.panoScores&&this.model.panos.showPanoScores(this.cachedPanoCandidates),this.updateControlLocks(),this.emit("update",{x:this.position.x,y:this.position.z,lon:this.cameraControls.controls.panorama.lon,hasChanged:t,mode:this.mode,lastFrameChanged:this.lastFrameChanged})}}(),e.updateLabelZIndex=function(e){var t=this;e.forEach((function(e){"dollLabels"==e&&"dollhouse"!=t.mode||"doorLabels"==e&&"panorama"!=t.mode||t[e].sort((function(e,t){return t.pos2d.z-e.pos2d.z})).forEach((function(e,t){e.elem.style.zIndex=t}))}))},e.updatePersistentZooming=function(e){1===this.zooming?this.zoomBy(1+this.zoomSpeed*e):-1===this.zooming&&this.zoomBy(1-this.zoomSpeed*e)},e.updateControlLocks=function(){this.currentPano&&this.model.supportsTiles&&(this.cameraControls.controls[ht.PANORAMA].locked=Je.vrEnabled||!this.currentPano.highestFullTileRenderOpCompleted&&this.currentPano.lockUntilRenderingComplete)},e.updatePanoRenderer=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;e.copy($i.FORWARD),this.getDirection(e),this.$app.core.get("PanoRenderer").hasQueuedTiles()&&n&&this.$app.core.get("PanoRenderer").updateDirection(e)}}(),e.updatePreRendering=function(){var e={};return function(t){if(1===Je.tiling.preRenderTourPanos&&this.preRenderingEnabled){var n=this.nextPano||this.currentPano;if(n&&t&&t.length>1){var i=t.findIndex((function(e){if(e.id===n.id)return!0}));if(i>=0&&i+1<t.length){var o=t[i+1];o.isLoaded(this.basePanoSize)||e[o.id]||(window.setTimeout(function(t){this.checkAndWaitForPanoLoad(t,"high","low",this.basePanoSize,null,null,null,!1,!1,!1),window.setTimeout(function(t){e[t.id]=!1}.bind(this,t),Je.tiling.panoPreRenderRepeatDelay)}.bind(this,o),Je.tiling.panoPreRenderDelay),e[o.id]=!0)}}}}}(),e.enablePreRendering=function(){this.preRenderingEnabled=!0},e.updateTileDownloader=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;if(n){var i=Ae.timeMeasuring.collection.loop.median;this.lowTile=this.$app.config.mobile&&"level1",this.lowTile&&(i>10||this.model.texSizeBlock*i>500)&&(this.lowTile="level2"),e.copy($i.FORWARD),this.getDirection(e),this.$app.core.get("TileDownloader").tilePrioritizer.updateCriteria(n,this.position,e,t.length>0?t:null),this.$app.core.get("TileDownloader").processPriorityQueue=!0}}}(),e.updateFromControls=function(e){null!=e||(e=0);var t=this.cameraControls.activeControl;t&&(t.update(e),this.quaternion.copy(t.camera.quaternion),this.position.copy(t.camera.position),this.target.copy(t.target),t.camera.updateProjectionMatrix(),this.camera.projectionMatrix.copy(t.camera.projectionMatrix),this.camera.projectionMatrixInverse.copy(t.camera.projectionMatrixInverse),this.emit("updateFromControls",this,e)),this.camera.position.copy(this.position),this.camera.quaternion.copy(this.quaternion),this.camera.updateMatrix(),this.camera.updateMatrixWorld()},e.updateIntersect=function(){var e=this,t=this.flying,n=this.isOutsideMode()&&this.cameraControls.controls[this.mode].isEngaged(),i=pe.getById(Je.freeze.LookTransition);if(t||n||this.isTouchEvent||i.length&&i[0].running,this.linkEditor&&this.linkEditor.footIcons&&(this.linkEditor.setPanoVisible||this.linkEditor.setTagVisible))return this.intersect=this.getMouseIntersect(null,this.linkEditor.footIcons.filter((function(e){return e.visible&&!e.otherFloorLink}))),void(this.intersect?os.add("hoverFootMarker"):os.remove("hoverFootMarker"));var o,r=function(){o=!0},a=function(){return o},s=[];if(this.emit("collectIntersectMesh",s,{consume:r,getConsumed:a}),!o){var l=this.panoMarkers.filter((function(t){return t.visible&&ro.filters.isNeighbourPanoTo(e.currentPano)(t.pano)})),c=this.model.panos.list.filter((function(e){return e.flagSpot&&!e.flagSpot.hidden})).map((function(e){return e.flagSpot.disc}));this.intersect=this.getMouseIntersect(null,l.concat(c)),(this.intersect||(s.push.apply(s,H(this.getColliders())),this.intersect=this.getMouseIntersect(null,s),this.emit("judgeIntersect",this.intersect,{consume:r,getConsumed:a}),!o))&&(this.intersect&&this.updateClosestPano(this.intersect),this.closestPano||this.closestPanoInDirection(this.getMouseDirection())?(this.reticule.updatePosition(this.position,this.intersect),Je.navigation.panoScores&&!Je.navigation.mouseDirection&&this.closestPanoInDirection(this.getDirection())):this.reticule.hide())}},e.getMouseDirection=function(e){e=e||this.mouse;var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);return new THREE.Vector3(e.x,e.y,1).unproject(this.camera).sub(t).normalize()},e.getColliders=function(){var e=[];return this.is360View(this.mode,this.currentPano)||(this.$app.config.mobile&&this.mode==ht.PANORAMA||(e=this.model.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),[])),this.mode===ht.PANORAMA&&e.push(this.model.skybox)),e},e.getMouseIntersect=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.recursive,o=void 0!==i&&i,r=n.type;e=e||this.mouse.clone(),t||(t=this.getColliders());var a=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);this.raycaster.set(a,this.getMouseDirection(e)),this.raycaster.camera=this.camera;var s=this.raycaster.intersectObjects(t,o);if(0===s.length)return null;if("getAll"==r)return s;var l=s[0];if(l.face){l.normal=l.face.normal.applyQuaternion(l.object.quaternion);var c=this.position.clone().sub(l.point);c.dot(l.normal)<0&&l.normal.negate(),this.currentPano?l.onFloor=l.point.y<this.position.y-.5*this.currentPano.height:l.onFloor=l.point.y<this.position.y-.5,l.horizontal=l.normal.y>.8}return l},e.updateClosestPano=function(e){var t=this;if(this.mode!==ht.TRANSITIONING){var n,i=[ro.filters.isPanoAligned()];if(!this.flying&&(e&&(this.panoMarkers.includes(e.object)||this.model.panos.list.find((function(t){return t.flagSpot&&t.flagSpot.disc==e.object})))&&(n=e.object.pano),!n)){if(this.mode===ht.PANORAMA){if(!this.currentPano)return;i.push(ro.filters.not(this.currentPano)),i.push(ro.filters.isNeighbourPanoTo(this.currentPano)),i.push(ro.filters.inFloorDirection(this.currentPano.floorPosition,this.getDirection(),.25)),i.push(ro.filters.isCloseEnoughTo(e.point,Je.panoFloorClickRadius)),i.push(ro.filters.isNotBehindNormal(e.point,e.normal))}else i.push((function(e){return t.linkEditor.checkHasNeighbor(e)||e==t.$app.core.get("Scene").firstView.pano})),i.push(ro.filters.isOnVisibleFloor()),this.mode!==ht.FLOORPLAN&&i.push(ro.filters.inDirection(this.position,this.getDirection(),.25));n=this.model.panos.find(i,[ro.sortFunctions.floorDistanceToPoint(e.point)])}n!==this.closestPano?(n&&(this.isPanoHover=!0),this.emit(Gr,this.closestPano,n,this.mode),this.closestPano=n):this.isPanoHover=!1}},e.dollhouseMode=function(e,t){this.modeTran="dollhouse-panorama",this.emit(Nr,this.mode,ht.DOLLHOUSE),this.mode=ht.DOLLHOUSE,this.cameraControls.controls[ht.DOLLHOUSE].reset();var n=new THREE.Vector3(this.model.center.x,0,this.model.center.z),i=new THREE.Vector3(15,10,15);if(e&&t){var o=$i.FORWARD.clone().applyQuaternion(t),r=(e=this.model.center.clone().sub(e)).dot(o);r>0?n=o.clone().multiplyScalar(r).add(e):nt.warn("Tried to initiate dollhouse mode that wasn'quaternion looking at the model",e,t)}this.cameraControls.controls[ht.DOLLHOUSE].resetRanges(0,!0),this.cameraControls.controls[ht.DOLLHOUSE].target.copy(n),this.cameraControls.cameras[ht.DOLLHOUSE].position.copy(i),this.updateFromControls(),this.model.alpha=1,this.model.skybox.material.uniforms.opacity.value=0},e.insideMode=function(e,t){var n=vt(),i=t||null;if(this.mode!==ht.PANORAMA&&this.mode!==ht.TRANSITIONING)e||((!this.currentPano||this.model.currentFloor&&this.currentPano.floor!=this.model.currentFloor)&&(e=this.getFloorPanoByScore(null,this.model.currentFloor)),e||(e=this.currentPano)),this.flyToNewMode({mode:ht.PANORAMA,pano:e,callback:i}).done(n.resolve.bind(n)).fail(n.reject.bind(n));else{var o="Cannot change mode during mode transition";this.mode===ht.PANORAMA&&(o="Already in panorama mode"),n.reject(o)}return n.promise()},e.fitDollhouse=function(e,t,n){var i=this.model.boundingBox.max.y,o=$i.FORWARD.clone().applyQuaternion(n);n=o.clone().add(e),this.cameraControls.activeControl.target.copy(n),this.cameraControls.activeControl.camera.position.set(0,2.4*i,0).add(e).add(o.multiplyScalar(-10))},e.floorplanMode=function(e,t,n,i){this.mode=ht.FLOORPLAN;var o=this.cameraControls.controls[ht.FLOORPLAN];o.reset();var r=e||this.model.center;if(o.target.copy(r).setY(0),o.camera.position.copy(r).setY(Je.floorplan.cameraHeight),n?(o.currentScale=n/(this.domElement.clientWidth/this.domElement.clientHeight),o.absoluteScale=o.currentScale):o.zoomToContain(this.model.size,i),t){var a=$i.LEFT.clone().applyQuaternion(t);o.rotateLeft(-Math.atan2(a.x,a.z))}else o.rotateToView(this.model.size,this.getDirection());o.update(0)},e.getAimToNextPano=function(e,t,n){var i;if(!t&&!n){var o={importance:0,aim:null};this.emit("ifFocusPoint",o),o.aim&&o.importance>=3&&(t=o.aim)}if(!t)if(e.panoVideo)i=!0,t=e.position.clone().add(e.panoVideo.dir);else if(i=!t&&e.hasVideo&&this.$app.core.get("PanoVideoRenderer")&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(e.videoInfo.dir)t=e.position.clone().add(e.videoInfo.dir);else{var r=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180));t=$i.FORWARD.clone().applyQuaternion(r.multiply(e.quaternion)).add(e.position)}return{aimQua:n=t?tt.getQuaByAim(t,e.position):n,hasVideo:i}},e.flyToPano=function(e,t){var n=this;if(!this.locked){var i=e.pano,o=e.lookAtPoint,r=e.quaternion,a=e.duration,s=e.aimDuration,l=e.rotSpeed;e.maxDistanceOverride,e.skipWarpingCheck,e.easeType;var c=null,u=null,h=e.zoomLevel||(Je.zoom.zoomToDefaultWhenToPano?1:this.zoomLevel),d=e.cancelLookFun,p=e.checkAlone;if(t=t||e.callback,e.quaOri=this.quaternion.clone(),"number"==typeof i&&(i=e.pano=this.model.panos.index[i]),!this.EditPanoMosaic||!this.EditPanoMosaic.editVideo||this.EditPanoMosaic.editVideo.pano==i){if(p&&o&&0==i.neighbourUUIDs.filter((function(e){return e!=i.id})).length){var f=this.model.panos.closestPanoTowardPoint({point:o,require:[function(e){return e.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}]});f&&(i=f,e.pano=i)}if(!e.gotQua){var m=this.getAimToNextPano(i,o,r);r=m.aimQua;m.hasVideo,e.quaternion=r,e.gotQua=!0}if(this.mode===ht.PANORAMA){var v=this.is360View(this.mode,i)||this.is360View(this.mode,this.currentPano);if(!this.judgePanoTask(e,v))return t&&t(!1),void e.dea;if(i&&(c=Ae.deepExtend(e),u=function(){Ae.delayOneFrame(function(){this.panosTaskList[0]==c&&(c.retry=!0,this.flyToPano(c,t))}.bind(this))}.bind(this)),W.mobile?(this.$app.core.get("PanoRenderer").switchPanoQuality(i,{size:1024}),"level2"==this.lowTile&&(i.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(this.currentPano,{size:1024}))):i.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(i,{size:2048}),!i||!this.checkAndWaitForPanoLoad(i,"high","low",this.basePanoSize,u)){var g=e.finalCallback=function(n){this.nextPanoTask(e,n),t&&t()}.bind(this);this.currentPano||(this.currentPano=i);var A=a;if("number"!=typeof a&&(A=this.computeDuration(e)),e.duration=A,e.pano.id,this.panosTaskList.map((function(e){return e.pano.id})),this.zoomLevel!==h)switch(Je.zoom.transitionStyle){case 1:this.smoothZoomLevelTo(h,A/2);break;case 2:return c=Ae.deepExtend(e),u=this.flyToPano.bind(this,c,t),void this.smoothZoomLevelTo(h,Je.zoom.restoreTime*(this.zoomLevel-h),u)}if(r){var y=e.quaOri.clone(),E=new THREE.Vector3;if(pe.cancelById(Je.freeze.LookTransition),i===this.currentPano){var w=$i.FORWARD.clone().applyQuaternion(e.quaOri),b=$i.FORWARD.clone().applyQuaternion(r),C=w.angleTo(b);return this.flyRotate=!0,null!=s||(s=1*Math.sqrt(C)/(l||Je.tags.navigate.rotateSpeedFactor)*1e3),void pe.start(function(t){if(this.mode!=ht.PANORAMA)return pe.cancelById(Je.freeze.LookTransition),void g(!0);y.copy(e.quaOri),It.quaternion(y,r)(t),E.copy(tt.getAimByQua(y,this.cameraControls.activeControl.camera.position)),this.cameraControls.activeControl.lookAt(E)}.bind(this),s,g.bind(this,!0),0,de[Je.transition.movementEasing],null,Je.freeze.LookTransition,d)}}if(i===this.currentPano||this.flying)return this.currentPano,this.flying,void g();this.flying=!0,this.position.clone();var x=this.currentPano;if(this.nextPano=i,this.emit(zr,this.currentPano,i),this.emit(Wr,{panoId:i.id,quaternion:r,lastPanoId:x.id,type:"flyToPano",duration:e.duration,isTagFlying:e.isTagFlying}),this.model.currentFloor=i.floor,this.doorLabels.forEach((function(e){return e.updateVisible(i)})),this.model.fadePanoMarkers(0,0,{hideVideoFlag:!0}),v)return void this.fade360View(this.cameraControls.activeControl.camera,{pano:i,aim:o,aimQua:r},(function(){n.afterFlyToPano(e)}));this.model.floorLogos.changefloorLogoOpa({index:0,opa:0,dur:A,delay:.7}),this.model.floorLogos.secondLogo.position.copy(i.floorPosition.clone().sub(this.model.position)),this.model.floorLogos.secondLogo.visible=!0,this.model.floorLogos.changefloorLogoOpa({index:1,opa:1,dur:250}),r&&!v&&(this.flyingWithRot=!0,e.aimQua=r),e.chunkProgress=this.judgeHideWall(i),this.startTransition(e)}}else this.flyToNewMode({mode:ht.PANORAMA,pano:i,duration:a,quaternion:r,callback:t})}}},e.startTransition=function(e){var t=this;e.easeFun||(e.easeFun=de.linearTween);var n=e.progress||0,i=this.$app.resource.num+Je.freeze.FlyToPano;pe.cancelById(i);var o=this.currentPano.position.distanceTo(e.pano.position),r=THREE.MathUtils.clamp(1-2/o,0,.9),a=e.quaOri.clone(),s=new THREE.Vector3;pe.start((function(l,c){var u,h=pe.getById(i)[0],d=n+l*(1-n);if(u=1!=l&&0!=l?e.currentSpeed=(d-e.progress)*o/c:e.currentSpeed||0,e.progress=d,l>0&&l<1&&c){if(e.easeFun==de.linearTween&&e.flySpeed&&u>0&&!he.closeTo(u,e.flySpeed)&&e.flySpeed){var p=e.flySpeed/u;!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.08;Math.abs(e-1)>n&&(e=e>1?1+n:1-n),pe.adjustSpeed(i,e),pe.adjustSpeed(Je.freeze.LookTransition,e)}(p,"渐变匀速","constant"==e.easeType?p-1:.01)}if(d>r&&1==e.flyCount&&e.easeFun==de.linearTween&&1==t.panosTaskList.length){e.easeFun=de.easeOutSine;var f=(1-d)*o;e.duration=Math.PI/2*f/u,e.duration=Math.max(e.duration,Je.transition.flyTime-h.duration*d),e.ignoreFirstFrame=!1,t.startTransition(e)}d>.2&&t.panosTaskList.length>1&&!t.panosTaskList[1].pano.tiledPanoRenderTarget&&(t.$app.core.get("PanoRenderer").switchPanoQuality(t.panosTaskList[1].pano,{useIdel:!0,size:"level2"==t.lowTile?512:1024}),t.checkAndWaitForPanoLoad(t.panosTaskList[1].pano,"low","low",t.basePanoSize,(function(){})))}t.model.skybox.material.uniforms.progress.value=d,e.chunkProgress&&t.model.chunks.forEach((function(e){return e.materialInside.uniforms.progress.value=d})),isNaN(d)&&(console.error("progress isNaN",d,l,n,c,e.duration,e),pe.cancelById(i));var m=t.currentPano.position.clone(),v=e.pano.position.clone();It.vector(m,v)(d),t.cameraControls.cameras[ht.PANORAMA].position.copy(m),e.aimQua&&(a.copy(e.quaOri),It.quaternion(a,e.aimQua)(d),s.copy(tt.getAimByQua(a,t.cameraControls.activeControl.camera.position)),t.cameraControls.activeControl.lookAt(s))}),e.duration,this.afterFlyToPano.bind(this,e),0,e.easeFun,"chunkFly",i,(function(){t.afterFlyToPano(e,!0)}),e.ignoreFirstFrame),e.flyCount++},e.nextPanoTask=function(e,t){if(e==this.panosTaskList[0]&&this.panosTaskList.splice(0,1),t&&this.panosTaskList.length){var n=this.panosTaskList[0];n.dealingTask=!0;var i=n.pano.position.distanceTo(e.pano.position),o=e.currentSpeed,r=this.computeDuration(n);o=Math.max(.002,o),n.duration=i/o,n.quaternion&&(n.duration=r),n.flySpeed=i/r,this.flyToPano(n)}},e.judgePanoTask=function(e,t){e.progress=e.progress||0,e.flyCount=0;var n=this.panosTaskList.length,i=this.panosTaskList[n-1];if(this.dontInterruptPanoTask)return!!e.dealingTask;if(!e.retry&&!e.dealingTask){var o=this.panosTaskList[0];if((e.quaternion||t)&&(e.canConstantlyWalk=!1),i&&i.pano.tileError&&(this.panosTaskList=[],n=0,i=void 0),0!=n&&!i.canConstantlyWalk&&e.pano!=this.currentPano)return;if(n>0){if(this.panosTaskList.some((function(t){return t.pano==e.pano&&(!t.lookAtPoint&&!e.lookAtPoint||t.lookAtPoint.equals(e.lookAtPoint))})))return;if(n>1)return;if(0==o.flyCount)return}if(this.panosTaskList.push(e),n++,e.pano.id,n>1){if(o.easeFun!=de.linearTween){var r=this.currentPano.position.distanceTo(o.pano.position),a=(1-o.progress)*r,s=Math.max(o.currentSpeed,.002),l=a/s;isNaN(l)&&console.error("newDur isNaN",s,o.progress,o),o.easeFun=de.linearTween,o.flySpeed=r/this.computeDuration(o),o.duration=l,this.startTransition(o)}return}}return!0},e.judgeHideWall=function(e){if(this.model.chunks.forEach((function(e){return Ae.updateVisible(e,"isBlock",!0)})),this.currentPano.noBlockPanos.includes(e.id));else if(this.currentPano.blocks[e.id])this.hideWalls=this.currentPano.blocks[e.id],this.hideWalls.forEach((function(e){Ae.updateVisible(e,"isBlock",!1)}));else{var t=this.currentPano.origin.clone(),n=e.origin.clone(),i=n.clone().sub(t).normalize().multiplyScalar(.1),o=t.clone().sub(i),r=n.clone().add(i),a=tt.ifIntersectChunks(o,r,this.model,{throughWidth:.08,meshes:this.model.chunks});a?(this.hideWalls=a.map((function(e){return e.object.visible=!1,e.object})),this.currentPano.blocks[e.id]=this.hideWalls.slice(0)):this.currentPano.noBlockPanos.push(e.id)}return!0},e.afterFlyToPano=function(e,t){this.currentPano.isAligned()&&(this.lastPano=this.currentPano),this.currentPano!==e.pano&&(this.currentPano.exit(),e.pano.enter(),this.currentPano=e.pano,this.nextPano=null,this.path.placeCpm(),this.mode==ht.PANORAMA&&(this.path.fadeOutCpm(Je.path.fadeOutTime),this.paintEditor&&this.paintEditor.updatePanoPaint(this.currentPano.id,this.currentPano.id))),t||(this.mode==ht.PANORAMA&&(this.flying=!1,this.emit(qr,{targetPosition:e.pano.position,currentPosition:e.pano.position,targetPano:e.pano,currentPano:this.currentPano}),this.model.floorLogos.firstLogo.position.copy(this.model.floorLogos.secondLogo.position),this.model.floorLogos.changefloorLogoOpa({index:0,opa:1,dur:0}),this.model.floorLogos.secondLogo.visible=!1,this.model.chunks.forEach((function(e){e.materialInside.uniforms.progress.value=1,Ae.updateVisible(e,"isBlock",!0)})),1==this.panosTaskList.length&&this.$app.core.get("PanoRenderer").switchPanoQuality(this.currentPano,{size:2048})),this.model.fadePanoMarkers(),this.doorLabels.forEach((function(e){return e.updateVisible()})),this.lastFlyPanoDoneTime=Date.now(),e.finalCallback&&e.finalCallback(!0))},e.fastToPano=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.flying&&!this.isWarping()){var n=t.pano||this.model.panos.index[t.panoId];if(!n)return console.error("fastToPano pano 无");this.position.clone();var i=this.currentPano,o=t.duration||1500;this.path.warpDestPano=n;var r=function(){e.waitingToWarp=!1,e.fastToPano(t)};W.mobile?this.$app.core.get("PanoRenderer").switchPanoQuality(n,{size:1024}):n.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(n,{size:2048}),this.checkAndWaitForPanoLoad(n,"high","low",this.basePanoSize,r)?this.waitingToWarp=!0:(this.emit("pano.chosen",i,n),this.emit(Wr,{panoId:n.id,lastPanoId:i.id,type:"flyToPano"}),this.flying=!0,this.nextPano=n,this.path.warpDestHeroLoc={panoId:t.panoId,position:n.position,quaternion:t.quaternion||this.quaternion.clone()},nt.time("[fly to pano] ".concat(n&&n.id)),this.path.warpTravel_BLACK(null,o,1,(function(){t.finalCallback=t.callback,e.afterFlyToPano(t)})))}},e.fade360View=function(e,t,n){var i=this,o=t.transitionTime||400;if(t.pano&&t.pano.view){if(!this.viewLinkManager.views[t.pano.view.sid])return void(n&&n());if(this.enteringView)return console.log("重复进入360"),void(n&&n());if(t.pano==this.currentPano&&!t.flyIn)return console.log("已经在此360漫游点"),void(n&&n());t.pano.view.entering=!0,this.enteringView=t.pano.view}this.domElement.style.opacity=1,pe.start(It.property(this.domElement.style,"opacity",0),o,(function(){!t.flyIn&&W.mobile&&i.$app.core.get("PanoRenderer").switchPanoQuality(i.currentPano,{size:1024}),t.pano&&i.$app.core.get("PanoRenderer").switchPanoQuality(t.pano,{size:2048}),i.model.skybox.material.uniforms.opacity.value=null!=t.skyboxOpacity?t.skyboxOpacity:1,i.model.alpha=null!=t.modelAlpha?t.modelAlpha:0,t.pano&&(e.position.copy(t.pano.position),e.quaternion.copy(t.pano.quaternion));var r=!(!t.pano||!t.pano.view),a=!!(i.is360View(i.mode,i.currentPano)&&!t.flyIn||t.flyOut);if(r){t.pano.view.exitDoor.mesh.visible=!0,i.viewLinkManager.updateCirclesWhenFade("enter",t),t.pano.view.balloon.showOrHide(!1),t.pano.view.entering=!1;var s=t.aim||new THREE.Vector3(0,0,-1).applyQuaternion(t.pano.view.enterQuaternion||t.pano.quaternion).add(e.position);i.cameraControls.controls.panorama.lookAt(s),i.cameraControls.controls.panorama.update(0),i.OverlayManager.setGroupVisible(!1),i.GLTFEditor.group.visible=!1,i.viewLinkManager.changeTitlesShow(!1,"enterView360"),i.$app.Camera.monitor.changeTitlesShow(!1,"enterView360")}if(a){var l=i.currentPano.view;if(l.exitDoor.mesh.visible=!1,t.flyOut){if("dollhouse"==t.toMode){var c=(new THREE.Vector3).subVectors(l.circle.mesh.position,l.balloon.mesh.position).setY(0).normalize();i.cameraControls.controls.dollhouse.target.copy(l.circle.mesh.position),i.cameraControls.cameras.dollhouse.position.copy(l.balloon.mesh.position).add(new THREE.Vector3(0,4,0)).add(c.multiplyScalar(-10)),i.cameraControls.controls.dollhouse.update(0)}l.balloon.visible=!1,setTimeout((function(){l.balloon.visible=!0}),500)}r||(i.viewLinkManager.updateCirclesWhenFade("leave",t),i.viewLinkManager.changeTitlesShow(!0,"enterView360"),i.$app.Camera.monitor.changeTitlesShow(!0,"enterView360")),!t.aim||t.flyIn||t.flyOut||(i.cameraControls.controls.panorama.lookAt(t.aim),i.cameraControls.controls.panorama.update(0)),i.OverlayManager.setGroupVisible(!0),i.GLTFEditor.group.visible=!0}t.pano&&(i.emit(zr,i.currentPano,t.pano),i.model.chunks.concat([i.model.skybox]).forEach((function(e){e.material.uniforms.progress.value=1})),i.model.floorLogos.changefloorLogoOpa({index:0,opa:0,dur:0,delay:0}),i.model.floorLogos.secondLogo.position.copy(t.pano.floorPosition.clone().sub(i.model.position)),i.model.floorLogos.secondLogo.visible=!0,i.model.floorLogos.changefloorLogoOpa({index:1,opa:1,dur:250})),pe.start(It.property(i.domElement.style,"opacity",1),o,(function(){i.enteringView=null,n&&n(),i.reticule.hide()}),0,null,null,"fade360")}),0,null,null,"fade360")},e.flyToPanoClosestToMouse=function(){if(Date.now()-this.mouseLastMoveTime>50&&this.updateIntersect(),this.closestPano)return this.flyToPano({pano:this.closestPano,checkAlone:!0});var e=this.getMouseDirection();this.flyDirection(e)||this.flyToPano({pano:this.currentPano})},e.flyLocalDirection=function(e){if(!(this.panosTaskList.length>1||1==this.panosTaskList.length&&this.panosTaskList[0].progress<.3)){var t=this.getDirection(e),n=1===e.z?.4:.75,i=1===Math.abs(e.x);return this.flyDirection(t,n,i,!0)}},e.flyDirection=function(e,t,n,i){if(!this.locked){var o=vt();this.history.invalidate();var r=this.closestPanoInDirection(e,t,n);return r?this.flyToPano({pano:r,canConstantlyWalk:this.canConstantlyWalk,byKey:i},o.resolve.bind(o,!0)):0==this.panosTaskList.length&&(this.bump(e),o.resolve(!1)),o.promise()}},e.closestPanoInDirection=function(e,t,n){return this.rankedPanoInDirection(0,e,t,n)},e.rankedPanoInDirection=(l={pano:null,candidates:[]},function(e,t,n,i){e||(e=0),n=void 0!==n?n:.75;var o=i?"angle":"direction",r=this.panosTaskList.length?this.panosTaskList[this.panosTaskList.length-1].pano:this.currentPano,a=[ro.filters.not(r),ro.filters.isPanoAligned(),ro.filters.isNeighbourPanoTo(r),ro.filters.inPanoDirection(r.position,t,n)],s=[ro.scoreFunctions.distanceSquared(r),ro.scoreFunctions[o](r.position,t)];return this.model.panos.findRankedByScore(e,a,s,l),this.cachedPanoCandidates=l.candidates,l.pano}),e.bump=function(e){var t=this;if(this.mode===ht.PANORAMA&&!this.flying&&!this.isWarping()){var n,i,o,r=Je.transition,a=(r.flytimeMaxDistanceThreshold*r.flytimeDistanceMultiplier+r.flyTime)/10,s=this.camera.getWorldDirection(new THREE.Vector3).dot(e);if(Math.abs(s)>.5)n=function(){pe.start(It.property(this.cameraControls.cameras[ht.PANORAMA],"zoom",s>0?1.04:.96),a,i,0,de.easeInOutSine,"bumpZStart")}.bind(this),i=function(){pe.start(It.property(this.cameraControls.cameras[ht.PANORAMA],"zoom",1),3*a,o,0,de.easeInOutSine,"bumpZRelax")}.bind(this);else{var l=this.camera.position.clone(),c=e.clone();this.raycaster.set(l,c);var u=this.model.floors.reduce((function(e,t){return e.concat(t.collider.children)}),[]),h=this.raycaster.intersectObjects(u),d=h.length>0?h[0].distance/25:.04,p=l.clone().add(c.multiplyScalar(d));n=function(){pe.start(It.vector(this.cameraControls.cameras[ht.PANORAMA].position,p),a,i,0,de.easeInOutSine,"bumpTStart")}.bind(this),i=function(){pe.start(It.vector(this.cameraControls.cameras[ht.PANORAMA].position,l),5*a,o,0,de.easeInOutSine,"bumpTRelax")}.bind(this)}o=function(){"panorama"==t.mode&&(t.flying=!1,t.emit(qr,{targetPano:t.currentPano,currentPano:t.currentPano}))},this.flying=!0,n()}},e.changeFloor=function(e){if(!this.is360View(this.mode,this.currentPano))if(this.mode===ht.PANORAMA){var t=this.history.reversePano(e);if(t)this.flyToPano({pano:t});else{var n=this.getFloorPanoByScore(e);n&&(this.cachedPanoCandidates=e.candidates,this.history.push(t,this.currentPano),this.flyToPano({pano:n}))}}else this.model.setFloor(this.model.nextFloor(e)||this.model.currentFloor)},e.getFloorPanoByScore=function(){var e={pano:null,candidates:[]};return function(t,n){var i=n||this.model.nextFloor(t);return i?(this.model.panos.lowestByScore([ro.filters.atFloor(i),ro.filters.isPanoAligned(),function(e){return e.hasNeighbor()}],[ro.scoreFunctions.distance(this.currentPano),ro.scoreFunctions.direction(this.position,new THREE.Vector3(0,t,0)),ro.scoreFunctions.penalizeHeightDifferenceUnder(this.position,.5)],e),e.pano):void nt.debug("player.changeFloor("+t+"): no such floor")}}(),e.gotoFloor=function(e){var t=e-this.model.currentFloor.floorIndex;this.changeFloor(t)},e.getDirection=function(e){return(e=e||(new THREE.Vector3).copy($i.FORWARD)).applyQuaternion(this.camera.quaternion)},e.flyToNewMode=function(e,t){var n=this,i=(e=e||{}).mode,o=e.pano,r=e.duration;e.warpDest;var a=e.callback;e.force;var s=e.quaternion,l=e.target,c=e.position,u=e.currentScale,h=e.floor,d=e.fitBoundSize;if(t=t||vt(),this.isWarping())return nt.warn("Player.flyToNewMode() -> Cannot fly when warping"),a&&a(!1),t.reject("Cannot change mode during tour transition");if(this.mode===ht.TRANSITIONING)return a&&a(!1),t.reject("Cannot change mode during mode transition");if(i===this.mode)return a&&a(!1),t.resolve(),t;i==ht.PANORAMA&&this.model._3dTilesRuntime&&(this.model._3dTilesRuntime.pauseTilesetUpdate(!0),this.model._3dTilesRuntime.clearLoadingTiles()),nt.debug("Switching mode to "+i);var p=function(){Ae.delayOneFrame(function(){this.flyToNewMode(e,t)}.bind(this))}.bind(this);if(o&&this.checkAndWaitForPanoLoad(o,"low","low",this.basePanoSize,p))return t.promise();if(!this.model.mesh3dTilesLoaded&&!this.model.meshTexturesLoaded&&this.isOutsideMode(i))return nt.info("Waiting for model 3dTiles or damTextures to be loaded before going out to dollhouse"),this.model.waitForLoad(this.model,function(){return!1}.bind(this)),p(),t.promise();this.history.invalidate();var f=this.mode,m=this.cameraControls.cameras[i],v=Ae.deepExtend({},Je[i],Je[f+"-"+i]);this.modeTran=this.mode+"-"+i;var g=v.transitionTime;void 0!==r&&(g=r),this.emit(Nr,f,i,o,g),o&&(this.currentPano=o),pe.cancelById(Je.freeze.LookTransition),i===ht.PANORAMA?(this.$app.core.get("PanoRenderer").switchPanoQuality(o,{size:2048}),this.emit(zr,o,o),setTimeout(function(){o.floor.enter(i)}.bind(this),g/2),this.path.fadeOutCpm(Je.path.fadeOutTime)):(this.path.placeCpm(),this.path.fadeInCpm(Je.path.fadeInTime),null!=h?"all"==h&&i!=ht.FLOORPLAN?this.model.toggleAllFloors(!0):"number"==typeof h&&(h=this.model.floors.list[h]).enter(i):i===ht.FLOORPLAN?this.model.currentFloor.enter(i):i==ht.DOLLHOUSE&&this.model.toggleAllFloors(!0)),this.switchCameraMode(i,s,l,c,u,{fitBoundSize:d});var A=(new THREE.Vector3).copy(this.position),y=this.currentPano,E=this.position.clone();this.emit(Wr,{mode:e.mode,duration:e.duration,target:e.target,position:e.position,quaternion:e.quaternion?(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):null,zoom:e.zoom,panoId:e.pano?e.pano.id:null,lastPanoId:y&&y.id,type:"flyToNewMode"}),this.flying=!0;var w=function(){n.isOutsideMode(i)&&n.is360View(f,y)?(v.blackoutStyle=st,g=Je.show360Views.transitionTime,v.transitionTime=g,v.skyboxOpacity=0,v.modelAlpha=1,v.flyOut=!0,v.toMode=i,n.fade360View(m,v)):n.isOutsideMode(f)&&n.is360View(i,o)?(n.mode=i,v.pano=o,v.blackoutStyle=rt,g=Je.show360Views.transitionTime,v.transitionTime=g,v.flyIn=!0,n.fade360View(m,v,n.afterchangeMode)):(pe.start(It.property(n.model,"alpha",v.modelAlpha,null),g*v.modelAlphaLength,null,v.modelAlphaDelay,null,Je.freeze.FlyToNewMode),pe.start(It.vector(n.position,m.position),g,null,Je.flydown.movementDelay,de[Je.flydown.movementEasing],null,Je.freeze.FlyToNewMode),pe.start(It.quaternion(n.quaternion,m.quaternion),g*v.rotationDuration,null,v.rotationDelay,de[Je.flydown.rotationEasing],null,Je.freeze.FlyToNewMode),pe.start(It.matrix4(n.camera.projectionMatrix,m.projectionMatrix),g*v.cameraMatrixDuration,null,v.cameraMatrixDelay,v.cameraMatrixEase,null,Je.freeze.FlyToNewMode),pe.start((function(){n.camera.projectionMatrixInverse.copy(n.camera.projectionMatrix).invert()}),g*v.cameraMatrixDuration,null,v.cameraMatrixDelay,v.cameraMatrixEase,null,Je.freeze.FlyToNewMode),pe.start(It.uniform(n.model.skybox,"opacity",v.skyboxOpacity),g*v.skyboxOpacityLength,null,v.skyboxOpacityDelay,null,Je.freeze.FlyToNewMode),pe.start(It.property(n.reticule.material.uniforms.opacity,"value",0),g,null,Je.freeze.FlyToNewMode)),pe.setTimeout(function(){this.flying=!1,f===ht.PANORAMA&&i!==ht.PANORAMA?this.currentPano.exit():f!==ht.PANORAMA&&i===ht.PANORAMA&&(this.currentPano!==y&&y.exit(),this.currentPano.enter()),f===ht.DOLLHOUSE&&this.cameraControls.controls[ht.DOLLHOUSE].resetRanges(),this.mode=i,this.afterChangeMode(f,i),this.emit(qr,{targetPosition:A,currentPosition:E,targetPano:this.currentPano,currentPano:y}),a&&a(),t.resolve()}.bind(n),g,Je.freeze.FlyToNewMode),n.mode=ht.TRANSITIONING};return"panorama"!=this.mode||this.isOutsideMode(i)&&this.is360View(f,y)?w():this.$app.core.get("SceneRenderer").once(aa,(function(){w()})),this.beforeChangeMode(f,i,o,g),t.promise()},e.setSize=function(e,t){var n=e/t;this.baseFov=na.clampVFOV(Je.insideFOV,Je.insideFOVMax,e,t);var i=na.getHFOVFromVFOV(Je.insideFOV,e,t);for(var o in i>Je.insideFOVMax?this.baseFov=na.getVFOVFromHFOV(Je.insideFOVMax,e,t):this.baseFov=Je.insideFOV,this.cameraControls.cameras){var r=this.cameraControls.cameras[o];r.fov=r.staticFov?r.staticFov:this.baseFov*(1/this.zoomLevel),r.updateAspect(n)}this.emit("setSize",e,t)},e.toJSON=function(){var e={};return this.cameraControls.activeControl?((e=this.cameraControls.activeControl.toJSON()).camera_mode=ht.toInt(this.mode),this.isOutsideMode()?this.model.allFloorsVisible?e.floor_visibility=[]:e.floor_visibility=this.model.floors.list.map((function(e){return e.hidden?0:1})):ht.PANORAMA&&(e.scan_id=this.currentPano.id),e):e},e.zoomBy=function(e){this.zoomTo(this.zoomLevel*e)},e.zoomIn=function(){this.zoomBy(1+this.zoomSpeed)},e.zoomOut=function(){this.zoomBy(1-this.zoomSpeed)},e.zoomTo=function(e,t){if((t||Je.zoom.enabled&&this.mode===ht.PANORAMA&&this.zoomEnabled)&&(e<Je.zoom.min&&(e=Je.zoom.min),e>Je.zoom.max&&(e=Je.zoom.max),e>this.zoomLevel?(this.emit(Ua),e===Je.zoom.max&&this.emit(za)):e<this.zoomLevel&&(this.emit(Na),e===Je.zoom.min&&this.emit(Ga)),this.cameraControls.activeControl)){var n=this.cameraControls.activeControl.camera;this.zoomLevel=e,n.fov=this.baseFov*(1/this.zoomLevel),n.updateProjectionMatrix(),this.zoomFov=n.fov,this.emit("zoomTo",e)}},e.zoomDefault=function(){this.zoomTo(1,!0)},e.smoothZoomToDefault=function(e,t){var n,i=this.zoomLevel,o=function(e){e>1&&(e=1),n=i*(1-e)+e,this.zoomTo(n,!0)}.bind(this),r=function(){this.zoomDefault(),t&&window.setTimeout(t,50)}.bind(this);pe.start(o,e,r,null,0,de[Je.transition.blendEasing])},e.smoothZoomFovTo=function(e,t,n){var i=this.baseFov/e;this.smoothZoomLevelTo(i,t,n)},e.smoothZoomLevelTo=function(e,t,n){if(this.zoomLevel!=e){var i,o=this.zoomLevel,r=function(t){t>1&&(t=1),i=o*(1-t)+t*e,this.zoomTo(i,!0)}.bind(this);pe.start(r,t,n,null,0,de[Je.transition.blendEasing])}},e.updateZoomPano=function(){var e=this,t=this.$app.core.get("QualityManager"),n=this.$app.core.get("PanoRenderer"),i=this.currentPano;if(!n.zoomPanoRenderingDisabled&&this.mode===ht.PANORAMA&&i.tiled&&i){var o=1.8,r="2k"==t.navTileClass&&"4k"==t.tileClass?o:Je.zoom.activationThreshold,a=Je.highestQualityTile||this.zoomLevel>r,s=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano)&&!this.isWarping(),l=a&&s;this.$app.core.get("TileDownloader").tilePrioritizer.setZoomingActive(l),n.setZoomingActive(l,i,!0);var c=function(e,i){n.resetRenderStatus(e.id,!1,!0,t.getMaxNavPanoSize()),n.clearAllQueuedUploadsForPano(e.id),n.renderPanoTiles(e.id,null,!1,!1),e.setZoomed(i)}.bind(this);if(l&&(!i.zoomed||t.zoomLevelResolution&&"4k"!=t.zoomLevelResolution)?(i.zoomed||c(i,!0),"1k"==t.navTileClass&&"1k"!=t.tileClass&&this.zoomLevel<2?n.enableHighQuality(function(){"4k"!=t.tileClass&&c(i,!0)}.bind(this)):n.enableUltraHighQualityMode(function(){t.useUltraHighResolutionPanos&&!Je.zoom.overridemax&&(Je.zoom.max=Je.ultraHighQualityMaxZoom),c(i,!0)}.bind(this))):!a&&i.zoomed&&c(i,!1),l&&"1k"==t.navTileClass&&"4k"==t.tileClass){var u=function(i){t.updateMaximums(),n.setupZoomRenderTarget(),"4k"==t.zoomLevelResolution?e.model.showHighMap():e.model.hideHighMap()};t.zoomLevelResolution=this.zoomLevel>=o?"4k":this.zoomLevel>Je.zoom.activationThreshold?"2k":"1k",this.oldZoomLevel<o&&this.zoomLevel>=o?(u(),c(i,a)):this.oldZoomLevel<=Je.zoom.activationThreshold&&this.zoomLevel>Je.zoom.activationThreshold?u():this.oldZoomLevel>o&&this.zoomLevel<=o?(u(),c(i,a)):this.oldZoomLevel>Je.zoom.activationThreshold&&this.zoomLevel<=Je.zoom.activationThreshold&&u(),this.oldZoomLevel=this.zoomLevel}}},e.hasChanged=function(e){if(!this.previousState)return this.previousState={allFloorsVisible:this.model.allFloorsVisible,position:this.position.clone(),quaternion:this.quaternion.clone(),mouse:this.mouse.clone(),currentFloor:this.model.currentFloor,projectionMatrix:this.camera.projectionMatrix.clone(),worldMatrix:this.camera.matrixWorld.clone(),mode:this.mode,modelPosition:this.model.position.clone(),modelCenter:this.model.center.clone(),zoomLevel:this.zoomLevel},e.cameraChanged=!0,e.cameraChanged2=!0,e.cameraChanged3=!0,!0;var t=this.position.equals(this.previousState.position)&&this.quaternion.equals(this.previousState.quaternion)&&this.camera.matrixWorld.equals(this.previousState.worldMatrix)&&this.camera.projectionMatrix.equals(this.previousState.projectionMatrix)&&this.mode===this.previousState.mode&&this.zoomLevel===this.previousState.zoomLevel&&this.model.center.equals(this.previousState.modelCenter)&&this.model.position.equals(this.previousState.modelPosition),n=t&&this.mouse.equals(this.previousState.mouse)&&this.model.allFloorsVisible===this.previousState.allFloorsVisible&&this.model.currentFloor===this.previousState.currentFloor&&null===this.nextPano;return e.cameraChanged=!t||e.cameraProjectionChanged,e.allFlVisiChanged=this.model.allFloorsVisible!==this.previousState.allFloorsVisible,e.moved=!this.position.equals(this.previousState.position),e.rotated=!this.quaternion.equals(this.previousState.quaternion),e.mouseMoved=!this.mouse.equals(this.previousState.mouse),e.floorChanged=this.model.currentFloor!==this.previousState.currentFloor,e.cameraProjectionChanged=!this.camera.projectionMatrix.equals(this.previousState.projectionMatrix),e.cameraWorldMatrixChanged=!this.camera.matrixWorld.equals(this.previousState.worldMatrix),e.modeChanged=this.mode!==this.previousState.mode,e.modelPositionChanged=!this.model.position.equals(this.previousState.modelPosition),e.modelCenterChanged=!this.model.center.equals(this.previousState.modelCenter),e.nextPanoActive=null!==this.nextPano,e.zoomLevel=this.zoomLevel!==this.previousState.zoomLevel,n?(e.cameraChanged2=!1,e.cameraChanged3=!1):(e.cameraChanged2=e.cameraProjectionChanged||!$e.closeTo(this.quaternion,this.previousState.quaternion,5)||!$e.closeTo(this.position,this.previousState.position,4),e.cameraChanged3=e.cameraProjectionChanged||!$e.closeTo(this.quaternion,this.previousState.quaternion,3)||!$e.closeTo(this.position,this.previousState.position,3)),this.previousState.allFloorsVisible=this.model.allFloorsVisible,this.previousState.position.copy(this.position),this.previousState.quaternion.copy(this.quaternion),this.previousState.mouse.copy(this.mouse),this.previousState.currentFloor=this.model.currentFloor,this.previousState.projectionMatrix.copy(this.camera.projectionMatrix),this.previousState.worldMatrix.copy(this.camera.matrixWorld),this.previousState.mode=this.mode,this.previousState.modelPosition.copy(this.model.position),this.previousState.modelCenter.copy(this.model.center),this.previousState.zoomLevel=this.zoomLevel,!n},e.getToMode=function(){return this.modeTran.split("-")[1]},e.flyToMode=function(e,t,n){var i=this;if(this.mode==e)t&&t();else if("transitioning"==this.mode)this.once(qr,(function(){i.flyToMode(e,t,n)}));else{t&&this.once(qr,(function(){t()}));try{this.flyToNewMode({mode:e,pano:"panorama"==e&&this.currentPano,duration:n})}catch(e){console.log("flyToMode遇到问题?")}}},e.vrModeChange=function(){Je.vrEnabled?Je.vrEnabled=!1:Je.vrEnabled=!0},e.focusPoint=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(console.log("focusPoint"),"floorplan"==this.mode){var t=e.modelSize||new THREE.Vector3(5,5,5),n=(s=this.cameraControls.controls.floorplan).getDefaultAbsoluteScale(t),i=s.absoluteScale,o=s.target.clone(),r=this.model.boundingBox.max.y+ke.orthoNear+.1,a=e.aim.clone().setY(r);pe.cancelById(Je.freeze.outsideFocus,!0),pe.start(function(e){s.absoluteScale=n*e+i*(1-e),s.target=a.clone().multiplyScalar(e).add(o.clone().multiplyScalar(1-e)),s.camera.position.copy(s.target.clone().add(s.offset))}.bind(this),e.dur||600,null,0,de[Je.transition.blendEasing],"outsideFocus",Je.freeze.outsideFocus,null)}else if("dollhouse"==this.mode){var s=this.cameraControls.controls.dollhouse,l=e.radius||10,c=(o=s.target.clone(),s.offset.clone().normalize()),u=s.offset.length();pe.cancelById(Je.freeze.outsideFocus,!0),pe.start(function(t){s.target=e.aim.clone().multiplyScalar(t).add(o.clone().multiplyScalar(1-t));var n=l*t+u*(1-t);s.camera.position.copy(s.target.clone().add(c.clone().multiplyScalar(n)))}.bind(this),e.dur||600,null,0,de[Je.transition.blendEasing],"outsideFocus",Je.freeze.outsideFocus,null)}},e.getSnapAngleInfo=function(){var e={metadata:{}},t=this.camera.quaternion.clone();switch(this.mode){case"panorama":e.metadata.scan_id=this.currentPano.id;break;case"floorplan":var n=this.getSize(),i=n.clientWidth,o=n.clientHeight;(t=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90))).multiply(this.camera.quaternion),e.metadata.camera_mode=1,e.metadata.ortho_zoom=he.toPrecision(this.cameraControls.activeControl.currentScale/(i/o),4);break;case"dollhouse":e.metadata.camera_mode=2}return e.metadata.camera_position=this.camera.position.clone(),e.metadata.camera_quaternion=t,e.metadata.lon=this.cameraControls.activeControl.lon,e.metadata.lat=this.cameraControls.activeControl.lat,e.sid="4dkk"+(new Date).getTime(),e.name="",e.mode=this.mode,e},e.model=new va(e.$app),e.currentPano=null,e.nextPano=null,e.camera=null,e.paused=!1,e.flying=!1,e.sceneIntersectionPlane=null,e.target=new THREE.Vector3,e.mouse=new THREE.Vector3(1.1,1.1,.5),e.mouseAtMouseDown=new THREE.Vector2,e.mouseCouldBeClickToMove=!1,e.mouseLastMoveTime=Date.now(),e.mouseDown=!1,e.mouseDownTimer=null,e.couldBeLongTap=!1,e.containsMouse=!1,//!0 //xzw改为false,否则触屏一直是true
- e.isTouchEvent=!1,e.isPanoHover=!1,e.reticule=new Ea(h(e)),e.panoMarkers=[],e.quaternion=new THREE.Quaternion,e.position=new THREE.Vector3(15,10,15),e.previousState=null,e.lastInsideView=new Aa,e.last360View=new Aa,e.raycaster=new THREE.Raycaster,e.raycaster.layers.enable(kt),e.intersect=null,e.lastChangeTime=Date.now(),e.history=new ut,e.cameraControls=null,e.domElement=null,e.cachedPanoCandidates=null,e.basePanoSize=0,e.standardPanoSize=0,e.highPanoSize=0,e.ultraHighPanoSize=0,e.zoomLevel=1,e.zooming=0,e.zoomSpeed=.5,e.scrollZoomSpeed=.06,e.zoomSpeedAdjust=.05,e.defaultZoomIncrement=.2,e.baseFov=Je.insideFOV,e.zoomFov=e.baseFov,e.zoomEnabled=!0,e.measureRulers=[],e.cornerRulers=[],e.planLabels=[],e.dollLabels=[],e.doorLabels=[],e.defaultRoomLabels=[],e.modeTran="",e.preRenderingEnabled=!1,e.setupCustomProperties(ht.PANORAMA),e.zoomStats=new lt,e.lastFrameChanged=!0,e.cameraControls=e.$app.core.get("CameraControls"),e.modelManager=e.$app.core.get("ModelManager"),e.started=!1,e._locked=!1,e._flying=!1,e.panosTaskList=[],e.setPanoTaskEnable(!0),e.viewLinkManager=new ol(e.$app,h(e)),e.paintEditor=new hl(e.$app,h(e)),e}return u(n,[{key:"init",value:function(){this.domElement=this.$app.dom.querySelector(".player"),this.camera=this.$app.core.get("SceneRenderer").camera,this.path=new _a(this.director,this,this.cameraControls),this.basePanoSize=this.$app.core.get("QualityManager").getPanoSize(Dt),this.standardPanoSize=this.$app.core.get("QualityManager").getPanoSize(Ft),this.highPanoSize=this.$app.core.get("QualityManager").getPanoSize(Lt),this.ultraHighPanoSize=this.$app.core.get("QualityManager").getPanoSize(Ht),this.$app.core.get("TileDownloader").processPriorityQueue=!1,this.$app.core.get("TileDownloader").tilePrioritizer=new Fa(this.$app.core.get("QualityManager"),this.basePanoSize,this.standardPanoSize,this.highPanoSize,this.ultraHighPanoSize),this.bindEvents(this.domElement),this.updateModel(),os.init(this),oi.init(this.$app),this.model.createTranControl(this)}},{key:"locked",get:function(){return this._locked},set:function(e){this._locked=e,this._locked?this.model.fadePanoMarkers(0,0,{vrCustomer:!0,hideVideoFlag:!0}):this.$app.VRScreenSYNC||this.model.fadePanoMarkers(1,0,{vrCustomer:!0,hideVideoFlag:!1}),e&&(this.panosTaskList=[])}},{key:"flying",get:function(){return this._flying},set:function(e){this._flying=e}},{key:"setPanoTaskEnable",value:function(e){this.canConstantlyWalk=e,e||(this.panosTaskList=[])}},{key:"setTourPanoTask",value:function(e,t){var n=e.panoList,i=void 0===n?[]:n,o=e.flySpeed,r=e.callback;console.log("setTourPanoTask"),0!=i.length&&(this.panosTaskList.length=0,this.addTourPanoTask({panoList:i,flySpeed:o,callback:r},t))}},{key:"addTourPanoTask",value:function(e,t){var n=this,i=e.panoList,o=void 0===i?[]:i,r=e.flySpeed,a=void 0===r?Je.transition.flySpeed:r,s=e.callback;this.dontInterruptPanoTask=!0;var l=o.map((function(e,t){var i=Object.assign({flySpeed:a,easeType:"constant",gotQua:!0},e,{sid:Math.random(),dealingTask:!0,callback:t==o.length-1?function(){n.dontInterruptPanoTask=!1,e.callback&&e.callback(),s&&s()}:e.callback}),r=n.getAimToNextPano(e.pano,e.lookAtPoint,e.quaternion),l=r.aimQua;return r.hasVideo,i.quaternion=l,i}));console.log("addTourPanoTask",l.map((function(e){return[e.pano.id,e.flySpeed]}))),t&&(l[0].easeType=null),this.panosTaskList=this.panosTaskList.concat(l),this.flying||this.flyToPano(this.panosTaskList[0])}},{key:"stopTourPanoTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;if(this.panosTaskList.length){var t=this.panosTaskList[0],n=this.currentPano.position.distanceTo(t.pano.position),i=(1-t.progress)*n;t.flySpeed=Math.max(i/e,t.flySpeed),t.aimQua=null}this.panosTaskList=[],this.dontInterruptPanoTask=!1}},{key:"computeDuration",value:function(e){var t,n=this.currentPano.position.distanceTo(e.pano.position);if(e.flySpeed&&"constant"==e.easeType)t=n/e.flySpeed;else{var i=e.maxDistanceOverride||Je.transition.flytimeMaxDistanceThreshold;t=(n=Math.min(n,i))*Je.transition.flytimeDistanceMultiplier+Je.transition.flyTime}if(e.quaternion){var o=e.maxRotSpeed||Je.transition.maxRotSpeed;e.flySpeed&&"constant"==e.easeType&&(o*=e.flySpeed/.002);var r=this.cameraControls.activeControl.camera.quaternion.clone(),a=$i.FORWARD.clone().applyQuaternion(r),s=$i.FORWARD.clone().applyQuaternion(e.quaternion),l=a.angleTo(s),c=Math.pow(l,.3)/o*1e3;t=Math.max(c,t),e.flySpeed&&"constant"==e.easeType&&(e.flySpeed=n/t)}return t}},{key:"getSize",value:function(){var e=this.$app.dom.querySelector('.player[name="main"]');return{clientWidth:e.clientWidth,clientHeight:e.clientHeight}}},{key:"beforeChangeMode",value:function(e,t,n,i){var o=this;e==ht.PANORAMA?(this.labelManager&&this.labelManager.updateEntryVisi(!0,this.model.currentFloor.floorIndex),this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),Ae.updateVisible(this.model.floorLogos.firstLogo,"show",!1),Ae.updateVisible(this.model.floorLogos.secondLogo,"show",!1),this.model.skybox.material.depthTest=!1,this.model.skybox.material.transparent=!0,this.$app.core.get("PanoRenderer").disposeIdelTargets(),setTimeout((function(){if(o.panosTaskList.length){var e=o.$app.resource.num+Je.freeze.FlyToPano;pe.cancelById(e,!0),o.panosTaskList.forEach((function(e){e.pano.exit()}))}}),1)):e==ht.FLOORPLAN?Fs.switchDepthTest(!0):ht.DOLLHOUSE,t==ht.PANORAMA?(this.model.floorLogos.firstLogo.position.copy(n.floorPosition.clone().sub(this.model.position)),this.model.floorLogos.secondLogo.position.copy(this.model.floorLogos.firstLogo.position),this.compass&&this.compass.autoJudgeDisplay(),this.labelManager&&this.labelManager.updateEntryVisi(!1,this.model.currentFloor.floorIndex)):t==ht.FLOORPLAN?(setTimeout(Fs.switchDepthTest.bind(this,!1),.5*i),this.labelManager&&this.labelManager.setPlanLabelVisi(!0,this.model.currentFloor.floorIndex)):ht.DOLLHOUSE,this.$app.Camera.emit("mode.beforeChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex,allVisible:this.model.allFloorsVisible})}},{key:"afterChangeMode",value:function(e,t,n,i){e==ht.PANORAMA?(this.compass&&this.compass.autoJudgeDisplay(),this.$app.core.get("PanoRenderer").disposeIdelTargets()):e==ht.FLOORPLAN?this.labelManager&&this.labelManager.setPlanLabelVisi(!1,this.model.currentFloor.floorIndex):ht.DOLLHOUSE,t==ht.PANORAMA?(Ae.updateVisible(this.model.floorLogos.firstLogo,"show",!0),this.model.floorLogos.changefloorLogoOpa({index:0,from:0,opa:1,dur:150}),this.doorLabels.forEach((function(e){return e.updateVisible()})),this.model.skybox.material.depthTest=!0,this.model.skybox.material.transparent=!1,this.model.showLowestTile(!0)):t==ht.FLOORPLAN?this.model.showLowestTile(!1):t==ht.DOLLHOUSE&&(this.model.floors.forEach((function(e){e.entryArrow.forEach((function(e){return e.dollLabel.update()}))})),this.model.showLowestTile(!1)),this.$app.Camera.emit("mode.afterChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex,allVisible:this.model.allFloorsVisible}),this.panosTaskList=[]}},{key:"setAnimateMakerPano",value:function(){var e=this;if(this.currentPano){var t;if(this.mode===ht.PANORAMA&&!this.flying&&!this.enteringView&&this.currentPano.isAligned()){var n=[ro.filters.isPanoAligned()],i=this.getDirection();n.push(ro.filters.not(this.currentPano)),n.push(ro.filters.isNeighbourPanoTo(this.currentPano)),n.push(ro.filters.inFloorDirection(this.currentPano.position,i,.707)),n.push(ro.filters.isClampDisSquaredTo(this.currentPano.floorPosition,.5,16));var o=Ae.sortByScore(this.model.panos.list,n,[ro.scoreFunctions.distanceSquared(this.currentPano,-.6),ro.scoreFunctions.directionFloor(this.currentPano.position,i)]);if(o.length>1){var r=o.slice(0,4).find((function(t){return tt.getPos2d(t.item.floorPosition,e).inSight}));r&&(t=r.item)}t||(t=o[0]&&o[0].item)}t&&t.id!=this.model.panos.animatePanoId?(null!=this.model.panos.animatePanoId&&this.model.panos.get(this.model.panos.animatePanoId).updateMakerStyle(),t.updateMakerStyle("animate"),this.model.panos.animatePanoId=t.id):t||null==this.model.panos.animatePanoId||(this.model.panos.get(this.model.panos.animatePanoId).updateMakerStyle(),this.model.panos.animatePanoId=null)}}}]),n}()})),Xe("QualityManager",(function(){return function(){function e(t,n,i){o(this,e),this.maxNavPanoSize=-1,this.maxZoomPanoSize=-1,this.devicePixelDensity=t,this.deviceScreenSize=n,this.clientBandwidth=i,this.panoSizeClassMap={},this.useHighResolutionPanos=!0,this.useUltraHighResolutionPanos=!1,this.modelHasUltraHighPanos=!1,this.maxRenderTargetSize=W.mobile?2048:4096}return u(e,[{key:"init",value:function(){this.buildPanoSizeClassMap(this.devicePixelDensity,this.deviceScreenSize,this.clientBandwidth),this.ultraHighSize=this.getPanoSize(Ht),this.highSize=this.getPanoSize(Lt),this.standardSize=this.getPanoSize(Ft),this.baseSize=this.getPanoSize(Dt),Je.tiling.maxZoomPanoQuality&&this.ultraHighSize<=Je.tiling.maxZoomPanoQuality&&(Je.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=Ce.valueFromHash("threshold2k",ke.windowHeightHighQualityThreshold),this.updateMaximums(),this.$app.core.get("ModelManager").on(Qa,this.onModelChanged.bind(this));var e=this.$app.store.getValue("metadata").sceneResolution||"2k";-1!=e.indexOf("/")?this.tileClass=e.split("/")[1]:this.tileClass=e,this.navTileClass="2k","1k"==this.tileClass&&(this.navTileClass="1k",this.useHighResolutionPanos=!1),Ce.urlHasValue("1k")&&(this.navTileClass="1k"),this.limitQuality=!0}},{key:"updateFromModel",value:function(e){this.updateUltraHighResolutionSettings(e)}},{key:"updateHighResolutionSettings",value:function(e){showcase.modelDataPromisesTiles(e.data)?this.useHighResolutionPanos=!0:this.useHighResolutionPanos=!1,this.updateMaximums()}},{key:"updateUltraHighResolutionSettings",value:function(e){Je.tiling.allowUltraHighResolution&&this.modelHasUltraHighPanos?this.useUltraHighResolutionPanos=!0:this.useUltraHighResolutionPanos=!1,this.updateMaximums()}},{key:"enableUltraHighQualityMode",value:function(){this.modelHasUltraHighPanos=!0,this.updateUltraHighResolutionSettings(null)}},{key:"ultraHighQualityModeEnabled",value:function(){return this.modelHasUltraHighPanos}},{key:"onModelChanged",value:function(e){this.updateFromModel(e.model),this.updateMaximums()}},{key:"updateMaximums",value:function(){this.maxNavPanoSize=Je.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=Je.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSize<this.maxNavPanoSize&&(this.maxNavPanoSize=this.maxZoomPanoSize)}},{key:"buildPanoSizeClassMap",value:function(){this.panoSizeClassMap[Dt]=512,this.panoSizeClassMap[Ft]=1024,this.panoSizeClassMap[Lt]=2048,this.panoSizeClassMap[Ht]=4096}},{key:"getPanoSize",value:function(e){return this.panoSizeClassMap[e]}},{key:"getMaxPossiblePanoSize",value:function(){return this.getPanoSize(Ht)}},{key:"getMaxPanoSize",value:function(){return this.maxZoomPanoSize}},{key:"getMaxNavPanoSize",value:function(){return this.maxNavPanoSize}},{key:"getMaxZoomPanoSize",value:function(){return this.maxZoomPanoSize}},{key:"detectMaxNavPanoSizeClass",value:function(){switch(this.navTileClass){case"1k":return Ft;case"512":return Dt;case"2k":default:return Lt}}},{key:"detectMaxNavPanoSize",value:function(){var e=this.detectMaxNavPanoSizeClass();return this.getPanoSize(e)}},{key:"detectMaxZoomPanoSize",value:function(){return this.zoomLevelResolution?"4k"==this.zoomLevelResolution&&this.useUltraHighResolutionPanos?this.getPanoSize(Ht):"1k"!=this.zoomLevelResolution&&this.useHighResolutionPanos?this.getPanoSize(Lt):this.getPanoSize(Ft):this.useHighResolutionPanos?this.useUltraHighResolutionPanos?this.getPanoSize(Ht):this.getPanoSize(Lt):this.getPanoSize(Ft)}}]),e}()}));var Al={getCubemapUrls:function(e,t,n){return[0,1,2,3,4,5].map(function(i,o){return e.get("pan/"+n+"/"+t+"_skybox"+r(i)+".jpg")}.bind(this))},mapFaceToCubemapFace:function(e){return{0:zi,1:ji,2:Ui,3:Wi,4:Ni,5:Gi}[e]}},yl="tiledownloader.download.success",El="tiledownloader.download.failure",wl="tiledownloader.pano.download.complete";function bl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Cl(e,t){this.tree=e,this.parent=t,this.children=[],this.id=++Pl}function xl(e,t,n,i,o,r,a,s){if(e){a=a||TileTree.TraversalType.PreOrder;var l=i*Bl+n;if(a===TileTree.TraversalType.PreOrder&&(o&&o(e,t,l,n,i),r&&r.push(e)),e.children&&0!==e.children.length){for(var c=i*Bl,u=n*Bl,h=0;h<Bl;h++)for(var d=0;d<Bl;d++)xl(e.children[d*Bl+h],t+1,u+h,c+d,o,r,a);a===TileTree.TraversalType.PostOrder&&(o&&o(e,t,l,n,i),r&&r.push(e))}}}function Il(e,t,n){if(n>e.levels)return null;var i=new Cl(e,t);e.allNodes.push(i);for(var o=0;o<kl;o++)i.children[o]=Il(e,i,n+1);return i}function Tl(e,t,n,i,o){if(!e)return null;if(0===n)return e;if(!e.children||0===e.children.length)return null;var r=Math.pow(Bl,n)/Bl,a=i%r,s=o%r,l=Math.floor(o/r),c=Math.floor(i/r),u=l*Bl+c;return Tl(e.children[u],t+1,n-1,a,s)}Xe("TileDownloader",(function(){var e,t;return t=e=function(e){f(n,EventEmitter);var t=bl(n);function n(e){var i;return o(this,n),(i=t.call(this)).forceQueueTilesForPano=function(){var e=[],t=[];return function(n,i,o,r,a,s){e.length=0;for(var l=this.getTileDownloadDescriptors(n,i),c=0;c<l.length;c++){var u=l[c];u.status!==Ma.None&&u.status!==Ma.Queued||e.push(u)}if(o&&e.length>0){Fa.sortPanoTiles(e,n,o),t.length=0,qi.matchingTilesInDirection(n,i,o,r,a,t);for(var h=0,d=function(e){return e.face===p.face&&e.faceTileIndex===p.faceTileIndex};h<e.length;){var p=e[h];t.findIndex(d)<0?e.splice(h,1):h++}}for(var f=0;f<e.length;f++)this.forceQueue.push(e[f]);this.setStatusForAllDescriptors(this.forceQueue,Ma.ForceQueued),this.clearFromQueue(this.priorityQueue,Ma.ForceQueued,!1),s&&this.processQueueForDownloading(this.forceQueue,!0)}}(),i.cleanupActiveDownloads=function(){var e=[];return function(){e.length=0;for(var t=0;t<this.activeDownloads.length;t++){var n=this.activeDownloads[t];n.status!==Ma.Downloaded&&n.status!==Ma.Failed&&e.push(n)}this.activeDownloads.length=0,this.activeDownloads.push.apply(this.activeDownloads,e)}}(),i.getTileUrl=function(){var e={256:"256",512:"512",1024:"1k",2048:"2k",4096:"4k"},t={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(n,i,o,r,a){qi.getTileLocation(i,r,t);var s=Math.floor(i/o),l=s*s,c=Math.floor(r/l),u="";1===Je.tiling.customCompression&&Je.tiling["q"+e[i]];var h=this.$app.store.getValue("metadata"),d=h.sceneKind||"tiles",p=h.sceneResolution||"2k";if(-1!=p.indexOf("/")){var f=p.split("/");d=f[0],p=f[1]}if("local"===this.$app.config.deploy||"face"===d?u="360view"==n.panoType?"tiles/"+n.view.imgSid+"/"+e[i]+"_face"+c+"_"+t.tileX+"_"+t.tileY+".jpg":"tiles/"+n.id+"/"+e[i]+"_face"+c+"_"+t.tileX+"_"+t.tileY+".jpg":(u="360view"==n.panoType?"tiles/".concat(n.view.resolution,"/").concat(n.view.imgSid):d+"/"+p+"/"+n.id,u+="_skybox"+c+".jpg?x-oss-process=","512"==e[i]?u+="image/resize,h_512":(u+="1k"==e[i]||"2k"==e[i]?"image/resize,m_lfit,w_"+i+"/crop,w_512,h_512,":"image/crop,w_512,h_512,",u+=0==t.tileX?"x_0,":"x_"+512*t.tileX+",",u+=0==t.tileY?"y_0":"y_"+512*t.tileY)),"360view"==n.panoType){if(!this.$app.core.get("Player").viewLinkManager.views[n.id])return;u=this.$app.resource.getUserImagesURL("panorama/".concat(n.view.imgSid,"/").concat(u))}else u=this.getTiles(u);return u}}(),i.panos=null,i.retryMinimumTime=1e4,i.urls=null,i.panoLoadCallbacks={},i.downloadDescriptors={},i.priorityQueue=[],i.forceQueue=[],i.activeDownloads=[],i.tilePrioritizer=null,i.refreshInterval=null,i.processPriorityQueue=!1,i.concurrentDownloads=e.concurrentDownloads||1,i.downloadTestResults={},i.freeze=Object.freeze({Testing:1,Success:2,Fail:3}),i.$app=e.$app,i}return u(n,[{key:"init",value:function(){}},{key:"setUrls",value:function(e){this.urls=e}},{key:"setPanoData",value:function(e,t,n){this.panos=e.clone(),this.panos.filter((function(e){return e.tiled})),this.imagePanos=t,this.panoGroupId=n}},{key:"refreshUpdateInterval",value:function(e){e||(e=0),this.refreshInterval=window.setTimeout(function(){this.update()?this.refreshUpdateInterval(n.ACTIVE_REFRESH_DELAY):this.refreshUpdateInterval(n.IDLE_REFRESH_DELAY)}.bind(this),e)}},{key:"start",value:function(){this.started=!0,this.refreshEveryFrame?this.$app.core.get("SceneRenderer").addComponent(this,!0):this.refreshUpdateInterval(0)}},{key:"useComponent",value:function(){this.refreshEveryFrame=!0,window.clearTimeout(this.refreshInterval),this.start()}},{key:"stop",value:function(){window.clearTimeout(this.refreshInterval),this.$app.core.get("SceneRenderer").removeComponent(this)}},{key:"update",value:function(){var e=this,t=this.forceQueue.length>0;return this.processQueueForDownloading(this.forceQueue),this.processPriorityQueue&&(Ae.intervalTool.isWaiting("processPriorityQueue",(function(){e.queuePrioritizedTilesForPanos(e.panos)}),this.$app.config.mobile?120:66),this.priorityQueue.length>0&&(t=!0),this.processQueueForDownloading(this.priorityQueue)),t}},{key:"clearForceQueue",value:function(){this.clearQueue(this.forceQueue)}},{key:"queuePrioritizedTilesForPanos",value:function(e){if(this.tilePrioritizer){var t=this.$app.core.get("Player"),n="level2"==t.lowTile?6:"level1"==t.lowTile?10:30;this.clearQueue(this.priorityQueue),this.tilePrioritizer.filterAndPrioritize(this.priorityQueue,e,this,n),this.clearFromQueue(this.priorityQueue,Ma.None,!0),this.setStatusOrRemoveForAllDescriptors(this.priorityQueue,Ma.Queued)}}},{key:"clearQueue",value:function(e){this.setStatusForAllDescriptors(e,Ma.None),e.length=0}},{key:"clearFromQueue",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];o&&(t===o.status&&!n||t!==o.status&&n)&&(e[i]=null)}}},{key:"setStatusForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status=t)}}},{key:"setStatusOrRemoveForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status!==t?i.status=t:e[n]=null)}}},{key:"getTileDownloadDescriptors",value:function(e,t){var n=this.getAllTileDownloadDescriptorsForPano(e),i=n[t];return i||(i=this.buildDownloadDescriptorArray(t),n[t]=i,this.initTileDownloadDescriptors(i,e,t)),i}},{key:"getAllTileDownloadDescriptorsForPano",value:function(e){var t=this.downloadDescriptors[e.id];return t||(t={},this.downloadDescriptors[e.id]=t),t}},{key:"processQueueForDownloading",value:function(e,t){if(this.cleanupActiveDownloads(),e.length){var n=Ae.getBestCount({name:"concurrentDownloads",minCount:0,maxCount:6,durBound1:1,durBound2:12,ifLog:!1,maxHistory:4,isMobile:this.$app.config.mobile});if(this.activeDownloads.length<n||t)for(var i=t?e.length:n-this.activeDownloads.length,o=0,r=0;o<i&&e.length>0;r++){var a=e.shift();a&&(this.startDownload(a),o++)}}}},{key:"testDownload",value:function(e,t,n){var i=this.downloadTestResults[e];if(i)i===this.freeze.Success?n(!0):i===this.freeze.Fail&&n(!1);else{this.downloadTestResults[e]=this.freeze.Testing;var o=this.panos.list[0],r=this.getTileUrl(o,e,t,0),a=function(t){this.downloadTestResults[e]=this.freeze.Success,n(!0)}.bind(this),s=function(){this.downloadTestResults[e]=this.freeze.Fail,n(!1)}.bind(this);this.loadImage(r,0,a,s)}}},{key:"startDownload",value:function(e){e.status=Ma.Downloading;var t=this.getTileUrl(e.pano,e.panoSize,e.tileSize,e.tileIndex);this.activeDownloads.push(e),this.loadImage(t,n.DOWNLOAD_RETRIES,this.downloadComplete.bind(this,e),this.downloadFailed.bind(this,e))}},{key:"downloadFailed",value:function(e,t){e.pano.tileError=!0,console.warn(t),this.emit(El)}},{key:"downloadComplete",value:function(e,t){if(e.panoGroupId===this.panoGroupId){var n=this.getPanoLoadCallbacks(e.pano,e.panoSize);e.status=Ma.Downloaded,n&&n.onProgress&&n.onProgress(e.pano,e.panoSize);var i={panoId:e.pano.id,image:t,tileSize:e.tileSize,panoSize:e.panoSize,tileIndex:e.tileIndex,faceTileIndex:e.faceTileIndex,totalTiles:e.totalTiles,face:e.face,tileX:e.tileX,tileY:e.tileY,direction:e.direction};e.image=t,this.emit(yl,i),this.isPanoDownloaded(e.pano,e.panoSize)&&(i={panoId:e.pano.id,tileSize:e.tileSize,panoSize:e.panoSize},this.emit(wl,i),n&&n.onLoad&&n.onLoad(e.pano,e.panoSize))}}},{key:"isPanoDownloaded",value:function(e,t){var n=this.getTileDownloadDescriptors(e,t);if(n.length<=0)return!1;for(var i=0;i<n.length;i++){if(n[i].status!==Ma.Downloaded)return!1}return!0}},{key:"setPanoLoadCallbacks",value:function(e,t,n,i,o){var r=e.id+":"+this.$app.core.get("QualityManager").getPanoSize(t);this.panoLoadCallbacks[r]={onLoad:n,onFail:i,onProgress:o}}},{key:"getPanoLoadCallbacks",value:function(e,t){var n=e.id+":"+t;return this.panoLoadCallbacks[n]}},{key:"buildDownloadDescriptorArray",value:function(e){for(var t=qi.getTileCountForSize(e),n=[],i=0;i<t;i++){var o=this.buildDownloadDescriptor();n.push(o)}return n}},{key:"buildDownloadDescriptor",value:function(){return{panoGroupId:null,pano:null,panoSize:-1,tileSize:-1,tileIndex:-1,totalTiles:-1,faceTileIndex:-1,status:Ma.None,url:null,image:null,direction:new THREE.Vector3,face:-1,cubeFace:-1,tileX:-1,tileY:-1}}},{key:"initTileDownloadDescriptors",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];this.initTileDownloadDescriptor(o,t,n,i)}}},{key:"initTileDownloadDescriptor",value:function(e,t,n,i){var o=n>=qi.TILE_SIZE?qi.TILE_SIZE:n;e.face=qi.getFaceForTile(n,i),e.cubeFace=Al.mapFaceToCubemapFace(e.face),e.panoGroupId=this.panoGroupId,e.pano=t,e.panoSize=n,e.tileSize=o,e.tileIndex=i,e.totalTiles=qi.getTileCountForSize(n),e.status=Ma.None,e.image=null,qi.getTileLocation(e.panoSize,e.tileIndex,e),qi.getTileVector(e.panoSize,e.tileSize,e.cubeFace,e.tileX,e.tileY,qi.LocationOnTile.Center,0,e.direction)}},{key:"loadImage",value:function(e,t,n,i){Xn.getImage(e,t).then((function(e){n(e)})).fail(i)}},{key:"getTiles",value:function(e){return this.urls.get(e)}}]),n}(),e.IDLE_REFRESH_DELAY=500,e.ACTIVE_REFRESH_DELAY=16,e.DOWNLOAD_RETRIES=4,t})),window.TileTree=function(e,t){this.levels=t,this.tileSize=e,this.root=null,this.allNodes=[],function(e){e.root=Il(e,null,0)}(this)};var Bl=2,kl=Bl*Bl;TileTree.TraversalType=Object.freeze({PreOrder:0,PostOrder:1});var Pl=0;TileTree.getLevelCountForSize=function(e,t){var n=0;for(t<e&&(t=e);!((t/=Bl)<e);)n++;return n},TileTree.getSizeForLevel=function(e,t){return Math.pow(Bl,t)*e},TileTree.prototype.getSubNode=function(e,t,n){(!t||e<this.tileSize)&&(t=0),(!n||e<this.tileSize)&&(n=0),e<this.tileSize&&(e=this.tileSize);var i=TileTree.getLevelCountForSize(this.tileSize,e);return Tl(this.root,0,i,t,n)},TileTree.prototype.breadthFirst=function(e){var t=!!(e=e||{}).nullLevelEnd,n=e.maxLevel,i=e.minLevel,o=e.callback,r=e.saveVisited,a=[],s={},l=0;for(a.push(this.root),a.push(s);a.length>0&&!(null!=n&&l>n);){var c=a.shift();if(c===s)(!i||l>=i)&&(o&&t&&o(null),r&&t&&r.push(null)),a.length>0&&a.push(s),l++;else{if(c.children)for(var u=0;u<c.children.length;u++){c.children[u]&&a.push(c.children[u])}var h=this.getFaceIndexFromNode(c);(!i||l>=i)&&(o&&o(c,l,h),r&&r.push(c))}}},TileTree.prototype.getFaceIndexFromNode=function(e){if(!e)return-1;for(var t=1,n=e,i=0,o=0;;){var r=n.parent;if(!r)break;for(var a=-1,s=0;s<r.children.length;s++)r.children[s]===n&&(a=s);i=a%Bl*t+i,o=Math.floor(a/Bl)*t+o,t*=Bl,n=r}return o*t+i},TileTree.prototype.depthFirst=function(e,t,n){xl(this.root,0,0,0,e,t,n,this.tileSize)};var Rl=TileTree;function Ml(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Sl(e){return e.config.mobile?Ae.getBestCount({name:"maxTileRender",minCount:0,maxCount:4,durBound1:1,durBound2:4,ifLog:!1,maxHistory:3}):Ae.getBestCount({name:"maxTileRender",minCount:0,maxCount:6,durBound1:1,durBound2:6,ifLog:!1,maxHistory:2})}function Dl(){if(!this.uploadIntervalCancelled){Fl=!0;var e=Sl(this.$app);this.updateUploadQueue(2,6,e);this.peekNextFromUploadQueue()?this.refreshUploadInterval(16):this.uploadInterval=null}}var Fl=!1,Ll=Je.tiling.uploadIntervalDelay,Hl=Je.tiling.initialIntervalDelay,Ql=Je.tiling.maxNonBaseUploadsPerFrame,Ol=Je.tiling.maxBaseUploadsPerFrame,Vl=0,_l=1;Xe("PanoRenderer",(function(){return function(e){f(n,EventEmitter);var t=Ml(n);function n(e){var i,r,a,s;return o(this,n),(i=t.call(this)).updateActivePanos=function(){var e=[];return function(t,n){e.length=0;for(var i=0;i<this.activePanos.length;i++){t&&e.length===n&&e.push(t);var o=this.activePanos[i],r=this.getActiveRenderTargetDescriptor(o.id);t&&o.id===t.id||!this.isRenderTargetDescriptorValid(r)||e.push(o)}t&&n>=e.length&&e.push(t),this.activePanos.length=0,this.activePanos.push.apply(this.activePanos,e)}}(),i.renderPanoTiles=function(){var e=[];return function(t,n,i,o,r){this.zoomRenderTarget&&this.zoomRenderTarget.width===this.$app.core.get("QualityManager").getMaxZoomPanoSize()||this.zoomPanoRenderingDisabled||this.setupZoomRenderTarget(),n=n||this.direction||Vectors.FORWARD;var a=this.getActiveRenderTargetDescriptor(t);this.isRenderTargetDescriptorValid(a)||console.error("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated.");for(var s=0;s<qi.FACES_PER_PANO;s++){var l=this.getTileTree(t,s);e.length=0,l.breadthFirst({saveVisited:e,maxLevel:r?512==r?0:1024==r?1:2048==r?2:3:3});for(var c=this.$app.config.mobile&&"panorama"==this.$app.core.get("Player").mode,u=0;u<e.length;u++){var h=e[u];this.queueTileUpload(h.tile,!1,!c&&(o||0===u&&i))}}this.updateDirection(n)}}(),i.getNextFromUploadQueue=function(){var e=function(e){var t=e.shift();return t.uploadQueued=!1,t};return function(){if(this.forceQueue.length>0)return e(this.forceQueue);var t=this.getTopUploadQueue();return t&&t.length>0?e(t):null}}(),i.refreshUploadInterval=function(){var e=null;return function(t){this.uploadIntervalCancelled||(e||(e=Dl.bind(this)),null!=t||(t=Ll),Fl||(t=Hl),this.uploadInterval=window.setTimeout(e,t),this.uploadIntervalDelay=t)}}(),i.update=function(){this.uploadIntervalCancelled=!0,this.$app.core.get("Player").lastFrameChanged;var e=Sl(this.$app);this.updateUploadQueue(2,6,e)},i.uploadTile=(r={},a=Je.tiling.overlayStyle,s={},function(e,t){var n=this,i=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer"),o=e.panoId,l=e.image,c=e.tileSize,u=e.panoSize,h=e.tileIndex,d=e.totalTiles,p=e.tileX,f=e.tileY,m=!0,v=!1,g=!1,A=(this.getPanoDescriptor(o),this.getPanoLODDescriptor(o,u)),y=this.getActiveRenderTargetDescriptor(o),E=y.renderTarget,w=y.size;this.isPanoZoomed(o)&&this.zoomRenderTarget&&(E=this.zoomRenderTarget,w=this.zoomRenderTarget.width);var b=function(){A.uploaded.includes(h)||(A.uploaded.push(h),A.uploadCount++),n.emit(Tt.TileRenderSuccess,o,u,h,d),A.uploadCount===d&&n.emit(Tt.PanoRenderComplete,o,u,d),n.setUploaded(e,!0),n.addCoverageForNode(e.node)};if(this.isRenderTargetDescriptorValid(y)||(m=!1,v=!1),t||(this.anyUploaded(e.node)&&(m=!1,v=!0,g=!0),this.isTileUploaded(e)&&(m=!1,v=!1,g=!0)),m){var C=c/u*w,x=p*c/u*w,I=f*c/u*w;if(u>this.$app.core.get("QualityManager").maxRenderTargetSize)this.$app.core.get("Player").model.getHighImage(l,e.cubeFace,p,f);else{r[c]||(r[c]=i.initSizedTexture2D(c,THREE.ClampToEdgeWrapping));var T=r[c];if(i.uploadTexture2D(l,T,0,0,c,c),1===a||2===a){var B=1===a?this.overlayTilesBasic:this.overlayTilesEnhanced;i.renderToCubeMap(T,E,c,c,0,0,c,c,x,I,C,C,e.cubeFace),i.renderToCubeMap(B[u],E,c,c,0,0,c,c,x,I,C,C,e.cubeFace,THREE.NormalBlending,!0,.5)}else i.renderToCubeMap(T,E,c,c,0,0,c,c,x,I,C,C,e.cubeFace)}b()}else g?b():(s[o+":"+u+":"+h]=!0,this.setUploaded(e,!1));return e.uploadAttempted||(A.uploadAttempts++,this.emit(Tt.TileUploadAttempted,o,u,h,d)),e.uploadAttempted=!0,A.uploadAttempts===d&&this.emit(Tt.UploadAttemptedForAllTiles,o,u,d),v}),i.tileDirectory={},i.activeRenderTargetDescriptors={},i.activePanos=[],i.panoLODDescriptors={},i.panoDescriptors={},i.tileTrees={},i.forceQueue=[],i.uploadQueues={},i.uploadInterval=null,i.uploadIntervalCancelled=!1,i.usingTileOverlay=!1,i.overlayTilesLoaded=!1,i.overlayTileBase=null,i.overlayTilesBasic={},i.overlayTilesEnhanced={},i.zoomRenderTarget=null,i.zoomPano=null,i.zoomingActive=!1,i.zoomPanoId=null,i.zoomPanoRenderingDisabled=!1,i.direction=new THREE.Vector3,i.initTime=-1,i.maxBaseUploadsPerFrame=Ol,i.maxNonBaseUploadsPerFrame=Ql,i.M=[],i.index=e||0,i}return u(n,[{key:"init",value:function(e,t,n){1==this.index&&(this.sceneRenderer2=e,this.tileDownloader2=t),this.initTime=performance.now(),this.bindEvents()}},{key:"getActivePanoTextures",value:function(e){e=e||[];for(var t=0;t<M.length;t++){var n=M[t];n.renderTarget&&n.renderTarget.texture&&e.push(n.renderTarget.texture)}}},{key:"hasQueuedTiles",value:function(){var e=this.peekNextFromUploadQueue();return null!=e}},{key:"getActiveRenderTargetDescriptor",value:function(e){return this.activeRenderTargetDescriptors[e]}},{key:"setActiveRenderTargetDescriptor",value:function(e,t){this.activeRenderTargetDescriptors[e]=t}},{key:"bindEvents",value:function(){1==this.index?this.tileDownloader2.on(yl,this.onTileDownloaded.bind(this)):this.$app.core.get("TileDownloader").on(yl,this.onTileDownloaded.bind(this))}},{key:"setupZoomRenderTarget",value:function(){var e=this.$app.core.get("QualityManager");if(2048!=e.maxRenderTargetSize||2048!=e.getMaxNavPanoSize())if(e.tileClass>e.navTileClass){var t=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer");if(this.zoomRenderTarget&&this.zoomRenderTarget.width===e.getMaxZoomPanoSize())return;var n=this.zoomRenderTarget;if(e.getMaxZoomPanoSize()>e.maxRenderTargetSize)return;if(this.zoomRenderTarget=this.initTiledPano(e.getMaxZoomPanoSize(),!1),n){var i=n.width,o=this.zoomRenderTarget.width;t.copyCubeMap(n.texture,this.zoomRenderTarget,i,i,o,o),n.texture.dispose(),n.texture.loaded=!1,n.texture.version=0,t.deallocateCubeTexture(n.texture),n.texture=null}this.zoomPanoRenderingDisabled=!1}else this.zoomPanoRenderingDisabled=!0}},{key:"enableHighQuality",value:function(e){this.$app.core.get("QualityManager").highQualityModeStarted||(this.setupZoomRenderTarget(),e(),this.$app.core.get("QualityManager").highQualityModeStarted=!0)}},{key:"enableUltraHighQualityMode",value:function(e){var t=this.$app.core.get("QualityManager");if("2k"==t.tileClass||"1k"==t.tileClass)return this.enableHighQuality(e);if(!t.ultraHighQualityModeEnabled()){var n=t.getPanoSize(Ht);this.$app.core.get("TileDownloader").testDownload(n,qi.TILE_SIZE,function(t){t&&(this.$app.core.get("QualityManager").enableUltraHighQualityMode(),this.setupZoomRenderTarget(),e())}.bind(this))}}},{key:"activateTiledPano",value:function(e,t,n,i){if(n&&this.clearAllQueuedUploads(),!i){for(var o=0;o<qi.FACES_PER_PANO;o++)this.initTileTree(e.id,o,this.$app.core.get("QualityManager").getMaxPossiblePanoSize());this.linkAllTilesAndNodes(e)}var r=this.getActiveRenderTargetDescriptor(e.id),a=t;if(a>this.$app.core.get("QualityManager").getMaxNavPanoSize()&&(a=this.$app.core.get("QualityManager").getMaxNavPanoSize()),!r||a!==r.size){if(r&&this.deactiveDescripor(r.renderTarget),!(r=this.activeDescripor(a))){var s=this.initTiledPano(a,!this.$app.config.mobile);(r=this.initDescriptor(s.width)).renderTarget=s}r.pano=e,this.resetPanoDescriptor(e.id),i||(this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0))}this.setActiveRenderTargetDescriptor(e.id,r);var l=n?0:1;return this.updateActivePanos(e,l),r.renderTarget}},{key:"deactivateTiledPano",value:function(e){var t=this.getActiveRenderTargetDescriptor(e.id);this.isRenderTargetDescriptorValid(t)&&(this.deactiveDescripor(t.renderTarget),this.setActiveRenderTargetDescriptor(e.id,null));var n=this.getUploadQueueForPano(e.id);this.clearUploadQueue(n),this.updateActivePanos()}},{key:"getActivePanoCount",value:function(){return this.activePanos.length}},{key:"resetRenderStatus",value:function(e,t,n,i){var o=null;i&&(o=Rl.getLevelCountForSize(qi.TILE_SIZE,i)+1);for(var r=function(e,i,o,r){n&&(i.tile.zoomUploaded=!1),t&&(i.tile.uploaded=!1)},a=0;a<qi.FACES_PER_PANO;a++){this.getTileTree(e,a).breadthFirst({callback:r.bind(this,a),minLevel:o})}}},{key:"copyBaseRenderStatusToZoomed",value:function(e){for(var t=Rl.getLevelCountForSize(qi.TILE_SIZE,this.$app.core.get("QualityManager").getMaxNavPanoSize()),n=function(e,t,n,i){t.tile.zoomUploaded=t.tile.uploaded,t.zoomCovered=t.covered},i=0;i<qi.FACES_PER_PANO;i++){this.getTileTree(e,i).breadthFirst({callback:n.bind(this,i),maxLevel:t})}}},{key:"isRenderTargetDescriptorValid",value:function(e){return e&&e.renderTarget}},{key:"isPanoActive",value:function(e){var t=this.getActiveRenderTargetDescriptor(e);return this.isRenderTargetDescriptorValid(t)}},{key:"isPanoZoomed",value:function(e){return this.zoomingActive&&this.zoomPanoId===e}},{key:"initTileTree",value:function(e,t,n){var i=this.tileTrees[e];i||(i=[],this.tileTrees[e]=i);var o=i[t];if(!o){var r=Rl.getLevelCountForSize(qi.TILE_SIZE,n);o=new Rl(qi.TILE_SIZE,r),i[t]=o}}},{key:"getTileTree",value:function(e,t){var n=this.tileTrees[e];n||console.error("PanoRenderer.getTileTree() -> Tree array not yet initialized!");var i=n[t];return i||console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),i}},{key:"initTiledPano",value:function(e,t){return new THREE.WebGLCubeRenderTarget(e,{stencilBuffer:!1,generateMipmaps:t,minFilter:t?THREE.LinearMipMapLinearFilter:THREE.LinearFilter})}},{key:"getUploadQueueForPano",value:function(e){var t=this.uploadQueues[e];return t||(t=[],this.uploadQueues[e]=t),t}},{key:"isTileUploaded",value:function(e){return this.isPanoZoomed(e.panoId)?e.zoomUploaded:e.uploaded}},{key:"setUploaded",value:function(e,t){this.isPanoZoomed(e.panoId)?e.zoomUploaded=t:e.uploaded=t}},{key:"queueTileUpload",value:function(e,t,n){var i=this.getActiveRenderTargetDescriptor(e.panoId);if(this.isRenderTargetDescriptorValid(i)&&e.downloaded&&!this.isTileUploaded(e)&&(!e.uploadQueued||n)&&(!(e.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive)){var o=this.getUploadQueueForPano(e.panoId);n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?Fa.insertSortedPanoTile(o,e,i.pano,this.direction):o.push(e),e.uploadQueued=!0,this.uploadInterval||this.uploadIntervalCancelled||this.refreshUploadInterval(0))}}},{key:"shoulPushToFrontOfQueue",value:function(e){return 0===Rl.getLevelCountForSize(qi.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e=null,t=null,n=Vl;n<=_l;n++)for(var i=0;i<this.activePanos.length;i++)if(e=this.activePanos[i],(t=this.getUploadQueueForPano(e.id)).length>0)switch(n){case Vl:if(0===t[0].level)return t;break;case _l:return t}return null}},{key:"peekNextFromUploadQueue",value:function(){if(this.forceQueue.length>0)return this.forceQueue[0];var e=this.getTopUploadQueue();return e&&e.length>0?e[0]:null}},{key:"clearAllQueuedUploads",value:function(){this.clearAllUploadQueues(null,0)}},{key:"clearAllQueuedUploadsForPano",value:function(e){this.clearAllUploadQueues(e,0)}},{key:"clearAllUploadQueues",value:function(e,t){if(e)this.clearUploadQueue(this.getUploadQueueForPano(e),t),this.clearUploadQueue(this.forceQueue,t,e);else{for(var n=0;n<this.activePanos.length;n++){var i=this.activePanos[n];this.clearUploadQueue(this.getUploadQueueForPano(i.id),t)}this.clearUploadQueue(this.forceQueue,t)}}},{key:"clearUploadQueue",value:function(e,t,n){null!=t||(t=0);for(var i=0;i<e.length;){var o=e[i];(!n||n&&n===o.panoId)&&o.level>=t?(o.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t,n){for(var i=0,o=0,r=0;!(o>=t||i>=e||r>=n);){var a=this.getNextFromUploadQueue();if(!a)break;if(0!==a.level?i++:o++,r++,!(a.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive){var s=this.getActiveRenderTargetDescriptor(a.panoId);this.isRenderTargetDescriptorValid(s)&&this.uploadTile(a,a.forceUpload)}}}},{key:"updateDirection",value:function(e){if(e=e||this.direction){this.direction=e;for(var t=0;t<this.activePanos.length;t++){var n=this.activePanos[t],i=this.getUploadQueueForPano(n.id);Fa.sortPanoTiles(i,n,this.direction)}}}},{key:"linkTileAndNode",value:function(e,t){t.tile=e,e.node=t}},{key:"linkAllTilesAndNodes",value:function(e){for(var t=function(t,n,i,o,r){var a=this.getTileDirectoryEntry(e.id,n,o,r);this.linkTileAndNode(a,i)},n=0;n<qi.FACES_PER_PANO;n++){var i=this.getTileTree(e.id,n);i.breadthFirst({callback:t.bind(this,i,n)})}}},{key:"anyUploaded",value:function(e){if(!e)return!1;if(e.tile&&this.isTileUploaded(e.tile))return!0;if(e.children)for(var t=0;t<e.children.length;t++){var n=e.children[t];if(this.anyUploaded(n))return!0}return!1}},{key:"setNodeCovered",value:function(e,t){this.isPanoZoomed(e.tile.panoId)?e.zoomCovered=t:e.covered=t}},{key:"isNodeCovered",value:function(e){return!!e&&(this.isPanoZoomed(e.tile.panoId)?e.zoomCovered:e.covered)}},{key:"addCoverageForNode",value:function(e){if(this.setNodeCovered(e,!0),e.parent&&e.covered){var t=e.parent;this.nodeSubcovered(t)&&this.addCoverageForNode(t,!0)}}},{key:"calcFullCoverage",value:function(e){var t=!1;if(e.children)for(var n=0;n<e.children.length;n++){var i=e.children[n];t=t||this.calcFullCoverage(i)}e.covered=e.tile.uploaded||t}},{key:"nodeSubcovered",value:function(e){if(!e.children)return!1;for(var t=0;t<e.children.length;t++)if(!e.children[t]||!this.isNodeCovered(e.children[t]))return!1;return!0}},{key:"resetPanoDescriptor",value:function(e){this.getPanoDescriptor(e)}},{key:"getPanoDescriptor",value:function(e){var t=this.panoDescriptors[e];return t||(t={},this.panoDescriptors[e]=t),t}},{key:"resetPanoLODDescriptors",value:function(e){var t=this.getPanoLODDescriptors(e);for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];i.uploadCount=0,i.uploadAttempts=0,i.uploaded=[]}}},{key:"getPanoLODDescriptor",value:function(e,t){var n=this.getPanoLODDescriptors(e),i=n[t];return i||(i={uploadCount:0,uploadAttempts:0,uploaded:[]},n[t]=i),i}},{key:"getPanoLODDescriptors",value:function(e){var t=this.panoLODDescriptors[e];return t||(t={},this.panoLODDescriptors[e]=t),t}},{key:"onTileDownloaded",value:function(e){var t=Rl.getLevelCountForSize(qi.TILE_SIZE,e.panoSize),n=this.getTileDirectoryEntry(e.panoId,e.face,t,e.faceTileIndex);if(n.downloaded=!0,n.image=e.image,n.panoSize=e.panoSize,n.tileX=e.tileX,n.tileY=e.tileY,n.totalTiles=e.totalTiles,n.tileIndex=e.tileIndex,n.faceTileIndex=e.faceTileIndex,n.face=e.face,n.cubeFace=Al.mapFaceToCubemapFace(e.face),n.panoId=e.panoId,n.tileSize=e.tileSize,n.direction=(new THREE.Vector3).copy(e.direction),n.node=null,n.level=Rl.getLevelCountForSize(qi.TILE_SIZE,n.panoSize),this.isPanoActive(n.panoId)){var i=this.getTileTree(n.panoId,n.face).getSubNode(n.panoSize,n.tileX,n.tileY);this.linkTileAndNode(n,i),this.queueTileUpload(n,!0)}}},{key:"getTileDirectoryEntry",value:function(e,t,n,i){var o=this.tileDirectory[e];o||(o={},this.tileDirectory[e]=o);var r=16384*t+1024*n+i,a=o[r];return a||(a={downloaded:!1,uploaded:!1,zoomUploaded:!1},o[r]=a),a._key=e+":"+t+":"+n+":"+i,a._tileKey=r,a}},{key:"setZoomingActive",value:function(e,t,n){this.zoomPanoRenderingDisabled||e===this.zoomingActive&&this.zoomPanoId===t.id||(this.zoomingActive=e,this.zoomPanoId=t.id,this.zoomingActive&&(this.zoomPanoId!==t.id||n)&&this.updateZoomedPanoFromBase(t))}},{key:"updateZoomedPanoFromBase",value:function(e){if(!this.zoomPanoRenderingDisabled){var t=this.$app.core.get("QualityManager"),n=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer"),i=this.getActiveRenderTargetDescriptor(e.id);if(i&&i.renderTarget){if(this.zoomRenderTarget){var o=Math.min(t.maxRenderTargetSize,t.getMaxZoomPanoSize()),r=i.renderTarget,a=i.size;n.copyCubeMap(r.texture,this.zoomRenderTarget,a,a,o,o)}this.copyBaseRenderStatusToZoomed(e.id)}}}},{key:"switchPanoQuality",value:function(e,t){var n,i=t.useIdel,o=t.size;i&&(o&&(n=this.activeDescripor(o,!0)),n||(n=this.activeDescripor(null,!0)),n&&(o=n.size));if(e.updateTileQuality(o),e.tiledPanoRenderTarget){var r=e.tiledPanoRenderTarget.width;if(o!=r){this.deactiveDescripor(this.tiledPanoRenderTarget);var a=this.activateTiledPano(e,o,!1,!0);this.$app.core.get("SceneRenderer").copyCubeMap(e.tiledPanoRenderTarget.texture,a,r,r,o,o),e.tiledPanoRenderTarget=a,this.renderPanoTiles(e.id,null,null,null,o),e.updateSkyboxForZoomLevel()}}}},{key:"add",value:function(e){this.M.push(e)}},{key:"initDescriptor",value:function(e){var t={renderTarget:null,inUse:!1,size:-1,pano:null};return t.inUse=!0,t.size=e,this.add(t),t}},{key:"activeDescripor",value:function(e,t){for(var n=0;n<this.M.length;n++){var i=this.M[n];if(!(i.inUse||e&&i.size!==e))return t||(i.inUse=!0),i}return null}},{key:"deactiveDescripor",value:function(e){for(var t=0;t<this.M.length;t++){var n=this.M[t];if(n.renderTarget===e)return n.inUse=!1,!0}return!1}},{key:"disposeIdelTargets",value:function(){for(var e=0;e<this.M.length;e++){var t=this.M[e];t.inUse||t.renderTarget.dispose()}}}]),n}()}));var Ul="panorama.videorenderer.suspendrender",Nl="panorama.videorenderer.resumerender",zl="panorama.videorenderer.textured",Gl="panorama.videorenderer.canplayvideo",jl="panorama.videorenderer.startvideo";function Wl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function ql(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("ModelManager",(function(){return function(e){f(n,EventEmitter);var t=Wl(n);function n(){var e;return o(this,n),(e=t.call(this)).modelMap={},e.activeModel=null,e.modelCount=0,e}return u(n,[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){this.$app.core.get("PanoRenderer").on(Tt.TileRenderSuccess,this.onTileRendered.bind(this)),this.$app.core.get("PanoVideoRenderer").on(zl,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ul,this.onSuspendVideoRender.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Nl,this.onResumeVideoRender.bind(this))}},{key:"onTileRendered",value:function(e,t,n,i){}},{key:"onVideoTextureUpdate",value:function(e){this.activeModel&&this.activeModel.updateVideoTexture(e)}},{key:"onSuspendVideoRender",value:function(){this.activeModel&&this.activeModel.suspendVideoRender()}},{key:"onResumeVideoRender",value:function(){this.activeModel&&this.activeModel.resumeVideoRender()}},{key:"addModel",value:function(e){this.modelMap[e.sid]=e,0===this.modelCount&&this.activateModel(e.sid),this.modelCount++,this.emit(Ha)}},{key:"activateModel",value:function(e){var t=this.modelMap[e];if(!t)throw new BasicException("Tried to activate invalid model!");var n=this.activeModel;this.activeModel=t,this.$app.core.get("TileDownloader").setPanoData(t.panos,[],t.sid),this.$app.core.get("TileDownloader").setUrls(t.urls),t.panos.forEach(function(e){e.attachToPanoRenderer(this.$app.core.get("PanoRenderer")),e.attachToPanoVideoRenderer(this.$app.core.get("PanoVideoRenderer")),e.tileDownloader=this.$app.core.get("TileDownloader"),e.qualityManager=this.$app.core.get("QualityManager")}.bind(this)),this.emit(Qa,{oldModel:n,model:t})}},{key:"getActiveModel",value:function(){return this.activeModel}}]),n}()}));var Jl=function(e){f(n,THREE.PerspectiveCamera);var t=ql(n);function n(e){var i;return o(this,n),(i=t.call(this,na.clampVFOV(Je.insideFOV),window.innerWidth/window.innerHeight,Je.insideNear,Je.insideFar)).controls=null,i}return u(n,[{key:"updateAspect",value:function(e){this.aspect=e,this.updateProjectionMatrix()}}]),n}();function Yl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zl=function(e){f(n,THREE.PerspectiveCamera);var t=Yl(n);function n(e){var i;return o(this,n),(i=t.call(this,na.clampVFOV(ke.dollhouseFOV),window.innerWidth/window.innerHeight,ke.dollhouseNear,ke.dollhouseFar)).controls=null,i}return u(n,[{key:"updateAspect",value:function(e){isNaN(e)&&(e=1),this.aspect=e,this.controls.updateDistance(e),this.updateProjectionMatrix()}}]),n}();function Xl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Kl=function(e){f(n,THREE.OrthographicCamera);var t=Xl(n);function n(e){var i;o(this,n),i=t.call(this);var r=window.innerWidth/window.innerHeight;return(i=t.call(this,-ke.orthoBase,ke.orthoBase,ke.orthoBase/r,-ke.orthoBase/r,ke.orthoNear,ke.orthoFar)).controls=null,i.updateAspect(r),i}return u(n,[{key:"updateAspect",value:function(e){isNaN(e)&&(e=1),this.aspect=e}}]),n}(),$l=0,ec=1,tc=2;function nc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ic=function(e){f(n,EventEmitter);var t=nc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).camera=e,a.camera.controls=h(a),a.player=r,a.config=r.$app.config,a.dom=i,a.target=new THREE.Vector3(0,0,0),a.lookVector=new THREE.Vector3,a.lookSpeed=.05,a.rotationAcc=new THREE.Vector2,a.rotationSpeed=new THREE.Vector2,a.speed=1,a.lat=0,a.lon=0,a.phi=0,a.theta=0,a.enabled=!1,a.locked=!1,a.pointer=new THREE.Vector2(0,0),a.pointersLimit=2,a.pointers=[],a.rotationDifference=new THREE.Vector2,a.rotationHistory=[],a.pointerDragOn=!1,a.pointerDragStart=new THREE.Vector2(0,0),a.pinchDistance=0,a.moveStart=new THREE.Vector2,a.moveTolerance=.01,a.limitAngleIsBound=!0,a.config.camera&&null!=a.config.camera.lookLimitUp&&null!=a.config.camera.lookLimitDown&&(a.limitAngleIsBound=!1,a.insideLookLimitUp=a.config.camera.lookLimitUp,a.insideLookLimitDown=a.config.camera.lookLimitDown),a}return u(n,[{key:"usable",value:function(){return this.enabled&&!this.locked}},{key:"lookAt",value:function(e,t){var n=t||this.camera.position.clone().sub(e),i=Math.atan(n.z/n.x);i+=n.x<0?Math.PI:0,i+=n.x>0&&n.z<0?2*Math.PI:0,this.lon=THREE.MathUtils.radToDeg(i)+180;var o=Math.sqrt(n.x*n.x+n.z*n.z),r=Math.atan(n.y/o);this.lat=-THREE.MathUtils.radToDeg(r)}},{key:"startRotationFrom",value:function(e,t){var n=he.handelPadding(e,t,this.dom);he.convertScreenPositionToNDC(n.x,n.y,this.pointer,this.dom),this.pointerDragOn=!0,this.pointerDragStart.copy(this.pointer),this.moveStart.copy(this.pointer),this.rotationHistory=[],this.rotationSpeed.set(0,0)}},{key:"onMouseOver",value:function(e){!this.pointerDragOn||0!==e.which&&0!==e.buttons||this.onMouseUp(e)}},{key:"onTouchStart",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:this.startRotationFrom(e.touches[0].clientX,e.touches[0].clientY);break;case 2:var t=(e.touches[0].clientX-e.touches[1].clientX)/window.innerWidth,n=(e.touches[0].clientY-e.touches[1].clientY)/window.innerHeight;this.pinchDistance=Math.sqrt(t*t+n*n)}this.emit(xa,"touch")}}},{key:"onPointerDown",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.length<this.pointersLimit&&this.pointers.push({id:e.pointerId,clientX:e.clientX,clientY:e.clientY}),e.touches=this.pointers,this.onTouchStart(e),this.emit(xa,"pointer"))}},{key:"onMouseDown",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.button){case $l:this.startRotationFrom(e.clientX,e.clientY)}this.emit(xa,"mouse")}}},{key:"updateRotation",value:function(){if(this.usable()&&this.pointerDragOn){this.camera.matrixWorld=new THREE.Matrix4;var e=new THREE.Vector3(this.pointerDragStart.x,this.pointerDragStart.y,-1).unproject(this.camera),t=new THREE.Vector3(this.pointer.x,this.pointer.y,-1).unproject(this.camera),n=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.sqrt(t.x*t.x+t.z*t.z),o=Math.atan2(e.y,n),r=Math.atan2(t.y,i);this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.rotationDifference.y=THREE.MathUtils.radToDeg(o-r),e.y=0,t.y=0;var a=Math.acos(e.dot(t)/e.length()/t.length());isNaN(a)||(this.rotationDifference.x=THREE.MathUtils.radToDeg(a),this.pointerDragStart.x<this.pointer.x&&(this.rotationDifference.x*=-1)),this.rotationDifference.multiplyScalar(this.speed),this.pointerDragStart.copy(this.pointer)}}},{key:"onMouseMove",value:function(e){if(this.usable()){var t=he.handelPadding(e.clientX,e.clientY,this.dom);he.convertScreenPositionToNDC(t.x,t.y,this.pointer,this.dom),this.pointerDragOn&&(Math.abs(this.pointer.x-this.moveStart.x)>this.moveTolerance||Math.abs(this.pointer.y-this.moveStart.y)>this.moveTolerance)&&this.emit(wa,"mouse")}}},{key:"onTouchMove",value:function(e){if(this.usable())switch(this.emit(wa,"touch"),e.touches.length){case 1:var t=he.handelPadding(e.touches[0].clientX,e.touches[0].clientY,this.dom);he.convertScreenPositionToNDC(t.x,t.y,this.pointer,this.dom);break;case 2:var n=(e.touches[0].clientX-e.touches[1].clientX)/window.innerWidth,i=(e.touches[0].clientY-e.touches[1].clientY)/window.innerHeight,o=this.pinchDistance-Math.sqrt(n*n+i*i);Math.abs(o)>.01&&(this.emit(ba),this.emit(Ia,o),this.pinchDistance-=o)}}},{key:"onPointerMove",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.forEach((function(t){e.pointerId===t.id&&(t.clientX=e.clientX,t.clientY=e.clientY)})),e.touches=this.pointers,this.onTouchMove(e))}},{key:"endRotation",value:function(){this.pointerDragOn=!1;var e=Ae.averageVectors(this.rotationHistory);this.player.$app.VRScreenSYNC?this.rotationSpeed.set(e.x*Je.rotationAfterMoveMultiplierX/6,e.y*Je.rotationAfterMoveMultiplierY/6):this.rotationSpeed.set(e.x*Je.rotationAfterMoveMultiplierX,e.y*Je.rotationAfterMoveMultiplierY)}},{key:"onTouchEnd",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.endRotation())}},{key:"onMouseUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.endRotation())}},{key:"onPointerUp",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.forEach(function(t,n){e.pointerId===t.id&&this.pointers.splice(n,1)}.bind(this)),e.touches=this.pointers,this.onTouchEnd(e))}},{key:"update",value:function(e){if(!this.locked){for(this.updateRotation(),this.rotationHistory.push(this.rotationDifference.clone());this.rotationHistory.length>Je.rotationAfterMoveHistoryCount;)this.rotationHistory.shift();this.lon+=this.rotationDifference.x,this.lat+=this.rotationDifference.y,this.rotationDifference.set(0,0);var t,n,i=Math.min(1,Je.rotationFriction*e*60);if(this.rotationSpeed.x=this.rotationSpeed.x*(1-i)+this.rotationAcc.x*Je.rotationAccelerationInside,this.rotationSpeed.y=this.rotationSpeed.y*(1-i)+this.rotationAcc.y*Je.rotationAccelerationInside,this.lon+=this.rotationSpeed.x*e,this.lat+=this.rotationSpeed.y*e,null==this.limitDownAngel)this.limitAngleIsBound?(t=Je.insideLookLimitDown-Je.insideFOV/2+this.camera.fov/2,n=Je.insideLookLimitUp+Je.insideFOV/2-this.camera.fov/2):(t=null!=this.insideLookLimitDown?this.insideLookLimitDown:Je.insideLookLimitDown,n=null!=this.insideLookLimitUp?this.insideLookLimitUp:Je.insideLookLimitUp),this.lat=Math.max(t,Math.min(n,this.lat));else this.lat=this.limitDownAngel;this.phi=THREE.MathUtils.degToRad(90-this.lat),this.theta=THREE.MathUtils.degToRad(this.lon),this.lookVector.x=Math.sin(this.phi)*Math.cos(this.theta),this.lookVector.y=Math.cos(this.phi),this.lookVector.z=Math.sin(this.phi)*Math.sin(this.theta),this.target.copy(this.lookVector).add(this.camera.position),this.camera.lookAt(this.target)}}},{key:"onMouseWheel",value:function(e){if(this.usable()){var t=e.wheelDelta||-e.detail;this.emit(ba),this.emit(Ta,t)}}},{key:"onKeyDown",value:function(e){this.player.$app.config.useShortcutKeys&&this.usable()&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.handleKeyDown(e.which)))}},{key:"handleKeyDown",value:function(e){var t=function(e,t){this.rotationAcc[e]=t}.bind(this);this.emit(Ca);var n=!0;switch(e){case La.LEFTARROW:case La.J:t("x",-1);break;case La.RIGHTARROW:case La.L:t("x",1);break;case La.I:t("y",1);break;case La.K:t("y",-1);break;default:n=!1}n&&this.emit(wa,"key")}},{key:"onKeyUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case La.LEFTARROW:case La.J:case La.RIGHTARROW:case La.L:this.rotationAcc.x=0;break;case La.I:case La.K:this.rotationAcc.y=0}}},{key:"startRotating",value:function(e,t){e&&(this.rotationAcc.x=e),t&&(this.rotationAcc.y=t)}},{key:"stopRotating",value:function(e){e&&(this.rotationSpeed.x=this.rotationSpeed.y=0),this.rotationAcc.set(0,0)}},{key:"reset",value:function(){this.pointerDragOn=!1,this.rotationAcc.set(0,0),this.rotationSpeed.set(0,0),this.pointers=[]}},{key:"toJSON",value:function(){return{camera_position:{x:he.toPrecision(this.camera.position.x,4),y:he.toPrecision(this.camera.position.y,4),z:he.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:he.toPrecision(this.camera.quaternion.x,4),y:he.toPrecision(this.camera.quaternion.y,4),z:he.toPrecision(this.camera.quaternion.z,4),w:he.toPrecision(this.camera.quaternion.w,4)}}}},{key:"setStateFromJSON",value:function(e){this.camera.position.copy(e.camera_position),this.camera.quaternion.copy(e.camera_quaternion)}}]),n}(),oc=-1,rc=0,ac=1,sc=2,lc=3,cc=4;function uc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var hc=function(e){f(n,EventEmitter);var t=uc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).setAutoPanPosition=function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){n.copy(this.camera.position),void 0===e&&null===e||n.setX(e),void 0===t&&null===t||n.setZ(t);var o=this.camera.position.distanceTo(this.target),r=Vector3.FORWARD.clone().applyQuaternion(this.camera.quaternion);this.targetClamped=!1,i.copy(n).addScaledVector(r,o),this.targetBounds.containsPoint(i)||(this.targetBounds.clampPoint(i,i),n.copy(i).addScaledVector(r,-o),this.targetClamped=!0),this.autoPanPosition.x=n.x,this.autoPanPosition.z=n.z,this.autoPan&&this.stopAutoPanning()}}(),a.camera=e,a.camera.controls=h(a),a.player=r,a.enabled=!1,a.target=new THREE.Vector3,a.targetBounds=new THREE.Box3,a.zoomSpeed=1,a.minDistance=0,a.maxDistance=1/0,a.scale=1,a.dollyStart=new THREE.Vector2,a.dollyEnd=new THREE.Vector2,a.dollyDelta=new THREE.Vector2,a.noRotateUpDown=!1,a.rotateSpeed=1,a.keyboardZoomSpeed=0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.minPolarAngle=THREE.MathUtils.degToRad(25),a.maxPolarAngle=THREE.MathUtils.degToRad(65),a.rotationAcceleration=new THREE.Vector2,a.rotationSpeed=new THREE.Vector2,a.rotateStart=new THREE.Vector2,a.rotateEnd=new THREE.Vector2,a.rotateDelta=new THREE.Vector2,a.phiDelta=0,a.thetaDelta=0,a.rotateCenter=new THREE.Vector2,a.rotateStartVec=new THREE.Vector2,a.rotateEndVec=new THREE.Vector2,a.autoPan=!1,a.autoPanPosition=new THREE.Vector3,a.panAcceleration=new THREE.Vector2,a.panSpeed=new THREE.Vector2,a.panStart=new THREE.Vector2,a.panEnd=new THREE.Vector2,a.panDelta=new THREE.Vector2,a.panOffset=new THREE.Vector3,a.panVector=new THREE.Vector3,a.offset=new THREE.Vector3,a.lastPosition=new THREE.Vector3,a.state=oc,a.mouseActions={},a.touchActions={},a.lastMoveTime=0,a.pointersLimit=2,a.pointers=[],a.angle=1e-6,a}return u(n,[{key:"setBounds",value:function(e){this.targetBounds=e}},{key:"isEngaged",value:function(){return this.state!==oc}},{key:"rotateLeft",value:function(e){void 0===e&&(e=this.getAutoRotationAngle()),this.thetaDelta-=e}},{key:"rotateUp",value:function(e){this.noRotateUpDown||(void 0===e&&(e=this.getAutoRotationAngle()),this.phiDelta-=e)}},{key:"panLeft",value:function(e){isNaN(e)&&(e=0);var t=this.camera.matrix.elements;this.panOffset.set(t[0],0,t[2]).normalize(),this.panOffset.multiplyScalar(-e),this.panVector.add(this.panOffset)}},{key:"panUp",value:function(e){isNaN(e)&&(e=0);var t=this.camera.matrix.elements;this.panOffset.set(t[4],0,t[6]).normalize(),this.panOffset.multiplyScalar(-e),this.panVector.add(this.panOffset)}},{key:"stopAutoPanning",value:function(){var e=this.autoPan;this.autoPan=!1,this.emit(this.targetClamped?Pa:e?Ba:ka)}},{key:"dollyIn",value:function(e){void 0===e&&(e=this.getZoomScale()),this.scale/=e}},{key:"dollyOut",value:function(e){void 0===e&&(e=this.getZoomScale()),this.scale*=e}},{key:"updatePan",value:function(e){if(this.panSpeed.multiplyScalar(1-Je.panFriction).addScaledVector(this.panAcceleration,Je.panAccelerationOutside*e),this.pan(-this.panSpeed.x,this.panSpeed.y),this.autoPan){var t=(new THREE.Vector3).copy(this.autoPanPosition).sub(this.camera.position);t.setY(0).clampLength(0,50*e),this.target.add(t),this.camera.position.add(t),this.autoPanPosition.x===this.camera.position.x&&this.autoPanPosition.z===this.camera.position.z&&(this.autoPan=!1,this.stopAutoPanning())}}},{key:"update",value:function(e,t){if(!this.updateForCad||this.screenshot){e||(e=1/60);var n=Math.min(1,Je.rotationFriction*e*60);this.rotationSpeed.multiplyScalar(1-n).addScaledVector(this.rotationAcceleration,Je.rotationAccelerationOutside*e),this.rotateLeft(-this.rotationSpeed.x),this.noRotateUpDown||this.rotateUp(this.rotationSpeed.y),this.updatePan(e);var i=this.camera.position;this.offset.copy(i).sub(this.target);var o=Math.atan2(this.offset.x,this.offset.z),r=Math.atan2(Math.sqrt(this.offset.x*this.offset.x+this.offset.z*this.offset.z),this.offset.y);this.autoRotate&&this.rotateLeft(this.getAutoRotationAngle()),o+=this.thetaDelta,r+=this.phiDelta,r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(this.angle,Math.min(Math.PI-this.angle,r)),this.lon=o,this.lat=r;var a=this.updateZoom();a=Math.max(this.minDistance,Math.min(this.maxDistance,a)),this.target.add(this.panVector),this.targetBounds.clampPoint(this.target,this.target),this.offset.x=a*Math.sin(r)*Math.sin(o),this.offset.y=a*Math.cos(r),this.offset.z=a*Math.sin(r)*Math.cos(o),i.copy(this.target).add(this.offset),this.camera.lookAt(this.target),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.panVector.set(0,0,0),this.lastPosition.distanceTo(this.camera.position)>0&&this.lastPosition.copy(this.camera.position)}}},{key:"getAutoRotationAngle",value:function(){return 2*Math.PI/60/60*this.autoRotateSpeed}},{key:"getZoomScale",value:function(){return Math.pow(.95,this.zoomSpeed)}},{key:"onMouseDown",value:function(e){if(this.enabled){switch(e.preventDefault(),this.stopAutoPanning(),this.mouseDown=!0,this.state=this.mouseActions[e.button],this.state){case rc:this.rotateStart.set(e.clientX,e.clientY),this.rotationSpeed.set(0,0),this.noRotateUpDown&&(this.rotateCenter=tt.getPos2d(this.target,this.player).pos,this.rotateStartVec.subVectors(this.rotateStart,this.rotateCenter));break;case ac:this.dollyStart.set(e.clientX,e.clientY);break;case sc:this.panStart.set(e.clientX,e.clientY)}this.emit(xa,"mouse")}}},{key:"onMouseMove",value:function(e){if(this.enabled&&this.mouseDown&&0!==e.buttons){switch(e.preventDefault(),this.state){case rc:if(this.rotateEnd.set(e.clientX,e.clientY),this.noRotateUpDown){this.rotateEndVec.subVectors(this.rotateEnd,this.rotateCenter);var t=he.getVec2Angle(this.rotateStartVec,this.rotateEndVec),n=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),i=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);n.clone().cross(i).z<0&&(t*=-1),this.rotateLeft(t),this.rotateStartVec.copy(this.rotateEndVec)}else this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.player.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.player.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd);break;case ac:this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),(this.dollyDelta.y>0?this.dollyIn:this.dollyOut).call(this),this.dollyStart.copy(this.dollyEnd);break;case sc:this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}this.emit(wa,"mouse"),this.lastMoveTime=e.timeStamp,this.update();var o={};o.quaternion={_w:this.camera.quaternion._w,_x:this.camera.quaternion._x,_y:this.camera.quaternion._y,_z:this.camera.quaternion._z},o.position={x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},o.target={x:this.target.x,y:this.target.y,z:this.target.z},this.player.emit(_r,{info:o,mode:this.player.mode,type:"moveModel"})}}},{key:"onMouseUp",value:function(e){this.enabled&&(this.mouseDown=!1,this.state=oc,"mouseover"!==e.type&&(e.timeStamp>this.lastMoveTime+100?(this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0)):this.rotationAcceleration.set(-this.rotateDelta.x,this.rotateDelta.y),this.update(),this.rotationAcceleration.set(0,0),this.rotateDelta.set(0,0)))}},{key:"onMouseOver",value:function(e){0!==e.which&&0!==e.buttons||this.onMouseUp(e)}},{key:"onMouseWheel",value:function(e){if(this.enabled&&Je.useWheel){this.emit(wa,"wheel");var t=e.wheelDelta||-e.detail,n=this.dollyIn;t>0&&(n=this.dollyOut),n.call(this),this.update();var i={};this.player.mode===ht.FLOORPLAN?(i.scale=this.absoluteScale,this.player.emit(_r,{info:i,mode:ht.FLOORPLAN,type:"moveModel"})):this.player.mode===ht.DOLLHOUSE&&(i.quaternion=this.camera.quaternion,i.position=this.camera.position,i.target=this.target,this.player.emit(_r,{info:i,mode:ht.DOLLHOUSE,type:"moveModel"}))}}},{key:"onKeyDown",value:function(e){this.enabled&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.handleKeyDown(e.which)))}},{key:"navRotationAcc",value:function(e,t){"y"===e?this.noRotateUpDown?this.keyboardZoomSpeed=t:this.rotationAcceleration.y=t:this.rotationAcceleration.x=t}},{key:"navPanAcc",value:function(e,t){this.stopAutoPanning(),this.panAcceleration[e]=t}},{key:"handleKeyDown",value:function(e){var t=!0;switch(e){case La.UPARROW:case La.I:this.navRotationAcc("y",1);break;case La.DOWNARROW:case La.K:this.navRotationAcc("y",-1);break;case La.LEFTARROW:case La.J:this.navRotationAcc("x",-1);break;case La.RIGHTARROW:case La.L:this.navRotationAcc("x",1);break;case La.W:this.navPanAcc("y",1);break;case La.S:this.navPanAcc("y",-1);break;case La.A:this.navPanAcc("x",-1);break;case La.D:this.navPanAcc("x",1);break;default:t=!1}t&&this.emit(wa,"key")}},{key:"onKeyUp",value:function(e){this.enabled&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case La.I:case La.K:case La.UPARROW:case La.DOWNARROW:this.keyboardZoomSpeed=0,this.rotationAcceleration.y=0;break;case La.J:case La.L:case La.LEFTARROW:case La.RIGHTARROW:this.rotationAcceleration.x=0;break;case La.S:case La.W:this.panAcceleration.y=0;break;case La.A:case La.D:this.panAcceleration.x=0}}},{key:"onTouchStart",value:function(e){if(this.enabled||this.state===oc){e.preventDefault(),e.stopPropagation(),this.stopAutoPanning();var t=function(){if(2===e.touches.length){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this.dollyStart.set(t,n)}}.bind(this),n=function(){this.panStart.set(Ae.average(e.touches,"pageX"),Ae.average(e.touches,"pageY"))}.bind(this),i=function(){if(this.noRotateUpDown){e.touches[1]||console.error("!pointerEvent.touches[0]11");var t=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),n=new THREE.Vector2(e.touches[1].pageX,e.touches[1].pageY);this.rotateStartVec.subVectors(t,n),this.rotateStart=t,this.rotateCenter=tt.getPos2d(this.target,this.player).pos}else this.rotateStart.set(Ae.average(e.touches,"pageX"),Ae.average(e.touches,"pageY"))}.bind(this);switch(this.state=this.touchActions[e.touches.length],this.state){case cc:t();case sc:n();break;case lc:t();case rc:i()}this.rotationSpeed.set(0,0),this.emit(xa,"touch")}}},{key:"onTouchMove",value:function(e){if(this.enabled&&this.state!==oc){if(this.touchActions[e.touches.length]!=this.state)return;e.preventDefault(),e.stopPropagation();var t=function(){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this.dollyEnd.set(t,n);var i=this.dollyEnd.length()/this.dollyStart.length();return i>1?this.dollyIn(i):this.dollyOut(1/i),this.dollyStart.copy(this.dollyEnd),i}.bind(this),n=function(){0!=e.touches.length&&(this.panEnd.set(Ae.average(e.touches,"pageX"),Ae.average(e.touches,"pageY")),this.panDelta.subVectors(this.panEnd,this.panStart),window.logEnable&&console.log("delta",Array.from(e.touches).map((function(e){return[e.pageX.toFixed(1),e.pageY.toFixed(1)]})),e.touches instanceof Array,e.currentTarget.className+e.currentTarget.nodeName),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.rotateDelta.set(0,0))}.bind(this),i=function(t,n){var i=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),o=i.clone().rotateAround(this.rotateCenter,n).clone().sub(this.rotateCenter).multiplyScalar(1/t),r=this.rotateCenter.clone().sub(this.rotateStart);this.panDelta.addVectors(o,r),this.pan(this.panDelta.x,this.panDelta.y),this.rotateStart=i}.bind(this),o=function(){if(this.noRotateUpDown){var t=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),n=new THREE.Vector2(e.touches[1].pageX,e.touches[1].pageY);this.rotateEndVec.subVectors(t,n);var i=he.getVec2Angle(this.rotateStartVec,this.rotateEndVec),o=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),r=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);return o.clone().cross(r).z<0&&(i*=-1),this.rotateLeft(i),this.rotateStartVec.copy(this.rotateEndVec),i}this.rotateEnd.set(Ae.average(e.touches,"pageX"),Ae.average(e.touches,"pageY")),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.player.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.player.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd)}.bind(this);switch(this.state){case cc:t();case sc:n();break;case lc:i(t(),o());break;case ac:t();break;case rc:o();break;default:this.state=oc}this.lastMoveTime=e.timeStamp,this.emit(wa,"touch");var r={scale:this.absoluteScale};r.quaternion={_w:this.camera.quaternion._w,_x:this.camera.quaternion._x,_y:this.camera.quaternion._y,_z:this.camera.quaternion._z},r.position={x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},r.target={x:this.target.x,y:this.target.y,z:this.target.z},this.player.emit(_r,{info:r,mode:this.player.mode,type:"moveModel"})}}},{key:"onTouchEnd",value:function(e){this.enabled&&(this.state===rc&&(e.timeStamp>this.lastMoveTime+100?(this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0)):this.rotationAcceleration.set(-this.rotateDelta.x,this.rotateDelta.y)),this.state=oc,this.update(),this.rotationAcceleration.set(0,0),this.rotateDelta.set(0,0))}},{key:"onPointerDown",value:function(e){this.enabled&&("touch"===e.pointerType&&(this.pointers.length<this.pointersLimit&&!this.pointers.find((function(t){return t.id==e.pointerId}))&&this.pointers.push({id:e.pointerId,pageX:e.pageX,pageY:e.pageY}),e.touches=this.pointers,this.onTouchStart(e)),this.emit(xa,"pointer"))}},{key:"onPointerMove",value:function(e){this.enabled&&"touch"===e.pointerType&&(this.pointers.forEach((function(t){e.pointerId===t.id&&(t.pageX=e.pageX,t.pageY=e.pageY,t.pressed=e.pressed)})),e.touches=this.pointers,this.onTouchMove(e))}},{key:"onPointerUp",value:function(e){this.enabled&&"touch"===e.pointerType&&(this.pointers=this.pointers.filter((function(t){return t.id!=e.pointerId})),e.touches=this.pointers,this.onTouchEnd(e))}},{key:"reset",value:function(){this.state=oc,this.stopAutoPanning(),this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0),this.panSpeed.set(0,0),this.panAcceleration.set(0,0)}},{key:"toJSON",value:function(){return{camera_position:{x:he.toPrecision(this.camera.position.x,4),y:he.toPrecision(this.camera.position.y,4),z:he.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:he.toPrecision(this.camera.quaternion.x,4),y:he.toPrecision(this.camera.quaternion.y,4),z:he.toPrecision(this.camera.quaternion.z,4),w:he.toPrecision(this.camera.quaternion.w,4)}}}}]),n}();function dc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var pc=function(e){f(n,e);var t=dc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this,e,i,r)).minPolarAngle=Je.dollhouseDefault.minPolarAngle,a.maxPolarAngle=Je.dollhouseDefault.maxPolarAngle,a.minDistance=Je.dollhouseDefault.minDistance,a.maxDistance=Je.dollhouseDefault.maxDistance,a.adjustedMinDistance=a.minDistance,a.adjustedMaxDistance=a.maxDistance,a.dom=i,a.mode="model",a.mouseActions[$l]=rc,a.mouseActions[ec]=ac,a.mouseActions[tc]=sc,a.touchActions[1]=rc,a.touchActions[2]=cc,a}return u(n,[{key:"pan",value:function(e,t){this.camera.updateMatrix();var n=Math.max(this.camera.position.clone().sub(this.target).length(),"security"==this.mode?1:0);n*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(2*e*n/this.player.domElement.clientWidth),this.panUp(-2*t*n/this.player.domElement.clientHeight)}},{key:"updateZoom",value:function(){return this.offset.length()*this.scale}},{key:"setZoomBounds",value:function(e){e.min.distanceTo(e.max);var t=e.min.distanceTo(e.max.clone().setY(e.min.y)),n=.5*(e.max.y-e.min.y)+.5*t;this.camera.suitModelAspect=t/n,this.distanceHorizon=t,this.distanceVerti=n,this.updateDistance(this.camera.aspect)}},{key:"updateDistance",value:function(e){var t=this.suitableDistance;if(this.player.model&&!isNaN(this.camera.suitModelAspect)&&!this.forbitSetRanges){var n=this.player.model.boundingBox;if(e<=this.camera.suitModelAspect){var i=na.getHFOVFromVFOV(this.camera.fov,e,1);this.suitableDistance=this.distanceHorizon/2/Math.tan(THREE.MathUtils.degToRad(i/2)),this.suitableDistance+=.5*Math.min(n.max.x-n.min.x,n.max.z-n.min.z)}else this.suitableDistance=this.distanceVerti/2/Math.tan(THREE.MathUtils.degToRad(this.camera.fov/2)),this.suitableDistance+=.5*Math.min(n.max.x-n.min.x,n.max.z-n.min.z);this.adjustedMaxDistance=10*this.suitableDistance,this.adjustedMinDistance=.1*this.suitableDistance,this.resetRanges(),this.enabled&&(this.scale=this.suitableDistance/t)}}},{key:"resetRanges",value:function(e,t){this.forbitSetRanges||(e?(this.minDistance=Math.min(e,this.minDistance),this.maxDistance=Math.max(e,this.maxDistance)):(this.minDistance=this.adjustedMinDistance,this.maxDistance=this.adjustedMaxDistance),t?(this.minPolarAngle=THREE.MathUtils.degToRad(-15),this.maxPolarAngle=THREE.MathUtils.degToRad(89.9)):(this.minPolarAngle=Je.dollhouseDefault.minPolarAngle,this.maxPolarAngle=Je.dollhouseDefault.maxPolarAngle))}},{key:"toJSON",value:function(){return hc.prototype.toJSON.call(this)}}]),n}(hc);function fc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var mc=function(e){f(n,e);var t=fc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this,e,i,r)).minDistance=5,a.maxDistance=100,a.noRotateUpDown=!0,a.minPolarAngle=0,a.maxPolarAngle=0,a.absoluteScale=1,a.currentScale=1,a.dom=i,a.$app=r.$app,a.plane=null,a.cadSize=null,a.floorTexture=null,a.mouseActions[$l]=sc,a.mouseActions[ec]=ac,a.mouseActions[tc]=rc,a.touchActions[1]=sc,a.touchActions[2]=lc,a}return u(n,[{key:"zoomToContain",value:function(e,t){var n=this.getDefaultAbsoluteScale(e,t);this.absoluteScale=n,this.currentScale=this.absoluteScale}},{key:"getDefaultAbsoluteScale",value:function(e,t,n){null!=n&&void 0!==n||(void 0===(n=this.$app.store.getValue("metadata").floorPlanAngle)&&(n=0),n=parseFloat(n)),e=e.clone().applyEuler(new THREE.Euler(0,n,0));var i=Math.max(Math.abs(e.x),Math.abs(e.z)*this.camera.aspect),o=this.$app.core.get("Player"),r=Math.min(o.domElement.clientWidth-400,o.domElement.clientHeight-200),a=o.linkEditor&&(o.linkEditor.setTagVisible||o.linkEditor.setPanoVisible)?1.2:2;return t=null!=t?t:Math.max(r*a/800,a),i/2/Je.orthoBase*t}},{key:"rotateToView",value:function(e,t){var n=0,i=Ce.aspectRatio()<1,o=e.x<e.z,r=this.$app.store.getValue("metadata");n=void 0!==r.floorPlanAngle?2*Math.PI-1*parseFloat(r.floorPlanAngle):i===o?0:Math.PI/2,this.rotateLeft(n),this.update(0)}},{key:"pan",value:function(e,t){this.camera.updateMatrix(),this.panLeft(e*(this.camera.right-this.camera.left)/this.player.domElement.clientWidth),this.panUp(-t*(this.camera.top-this.camera.bottom)/this.player.domElement.clientHeight)}},{key:"updateZoom",value:function(){this.absoluteScale*=this.scale-.03*this.keyboardZoomSpeed,this.absoluteScale=Math.max(Je.zoomNearLimit,Math.min(this.absoluteScale,Je.zoomFarLimit)),this.currentScale=.8*this.currentScale+.2*this.absoluteScale;var e=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;return this.camera.left=-Je.orthoBase*this.currentScale*e,this.camera.right=Je.orthoBase*this.currentScale*e,this.camera.top=Je.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.bottom=-Je.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.updateProjectionMatrix(),this.offset.length()}},{key:"updateDirect",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.left=-e.width/2,this.camera.right=e.width/2,this.camera.top=e.height/2,this.camera.bottom=-e.height/2,this.camera.updateProjectionMatrix(),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y),this.updateForCad=!0}},{key:"updateForRotateCad",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y);var i=this.$app.core.get("Player").model;this.absoluteScale=this.getDefaultAbsoluteScale(i.size,null,e.floorPlanAngle),this.currentScale=this.absoluteScale;var o=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;this.camera.left=-Je.orthoBase*this.currentScale*o,this.camera.right=Je.orthoBase*this.currentScale*o,this.camera.top=Je.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.bottom=-Je.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.updateProjectionMatrix(),this.updateForCad=!0}},{key:"recoverToUpdate",value:function(){this.updateForCad=!1,this.target.copy(this.camera.position);var e=this.$app.store.getValue("metadata"),t=parseFloat(e.floorPlanAngle||0);this.thetaDelta=t,this.absoluteScale=this.currentScale=this.camera.right/Je.orthoBase,this.update(1)}},{key:"toJSON",value:function(){var e=new THREE.Quaternion,t=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)),n=new THREE.Quaternion;return function(){var i=hc.prototype.toJSON.call(this);return e.copy(i.camera_quaternion),n.copy(t),n.multiply(e),i.camera_quaternion.x=math.toPrecision(n.x,4),i.camera_quaternion.y=math.toPrecision(n.y,4),i.camera_quaternion.z=math.toPrecision(n.z,4),i.camera_quaternion.w=math.toPrecision(n.w,4),i.ortho_zoom=math.toPrecision(this.currentScale*this.camera.aspect,4),i}}},{key:"setZoomBounds",value:function(e){var t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z)/2/Je.orthoBase;n=Math.max(.1,n),Je.zoomFarLimit=parseInt(10*n),Je.zoomNearLimit=Je.zoomFarLimit/100,Je.floorplan.cameraHeight=THREE.MathUtils.clamp(Math.ceil(2.4*t.length()),5,5e3),this.maxDistance=Math.max(Je.floorplan.cameraHeight+1,this.maxDistance)}}]),n}(hc);function vc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("CameraControls",(function(){return function(e){f(n,EventEmitter);var t=vc(n);function n(){var e;return o(this,n),(e=t.call(this)).activeControl=null,e.controls={},e.cameras={},e}return u(n,[{key:"init",value:function(e,t){this.setUpControls(e,t),this.bindEvents(e)}},{key:"activateControls",value:function(e){this.activeControl&&(this.activeControl.reset(),this.activeControl.enabled=!1),this.controls[e]&&(this.controls[e].enabled=!0),this.activeControl=this.controls[e]}},{key:"setUpControls",value:function(e,t){var n={},i={},o=(t=t||[ht.PANORAMA,ht.DOLLHOUSE,ht.FLOORPLAN],[Jl,Zl,Kl]),r=[ic,pc,mc];t.forEach(function(t,a){n[t]=new o[a](e),i[t]=new r[a](n[t],e,this.$app.core.get("Player")),i[t].on(wa,this.emit.bind(this,wa)),i[t].on(xa,this.emit.bind(this,xa)),i[t].on(ba,this.emit.bind(this,ba)),i[t].on(Ca,this.emit.bind(this,Ca)),i[t].on(Ia,this.emit.bind(this,Ia)),i[t].on(Ta,this.emit.bind(this,Ta))}.bind(this)),this.controls=i,this.cameras=n}},{key:"bindEvents",value:function(e){var t=this;e.addEventListener("mousemove",this.onMouseMove.bind(this)),e.addEventListener("mousedown",this.onMouseDown.bind(this)),e.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("mouseover",this.onMouseOver.bind(this)),Je.useWheel&&(e.addEventListener("mousewheel",this.onMouseWheel.bind(this),{passive:!1}),e.addEventListener("DOMMouseScroll",this.onMouseWheel.bind(this),{passive:!1})),e.addEventListener("touchstart",this.onTouchStart.bind(this),{passive:!1}),e.addEventListener("touchmove",this.onTouchMove.bind(this),{passive:!1}),e.addEventListener("touchend",this.onTouchEnd.bind(this)),e.addEventListener("contextmenu",(function(e){e.preventDefault()})),e.addEventListener("pointerdown",this.onPointerDown.bind(this)),e.addEventListener("pointermove",this.onPointerMove.bind(this)),e.addEventListener("pointerup",this.onPointerUp.bind(this)),e.addEventListener("pointerout",this.onPointerCancel.bind(this)),e.addEventListener("pointercancel",this.onPointerCancel.bind(this)),document.addEventListener("keydown",this.onKeyDown.bind(this)),document.addEventListener("keyup",this.onKeyUp.bind(this)),this.$app.core.get("ModelManager").on(Qa,function(e){this.setModelForControls(e.model)}.bind(this)),this.on("syncCadAnd3D",(function(e){t.controls[ht.FLOORPLAN].updateDirect(e)})),this.on("syncCadAnd3DForRotate",(function(e){t.controls[ht.FLOORPLAN].updateForRotateCad(e)}))}},{key:"setModelForControls",value:function(e){var t=e.boundingBox.clone().expandByScalar(Je.modelBoundsPadding);[ht.DOLLHOUSE,ht.FLOORPLAN].forEach(function(n){this.controls[n].setZoomBounds(e.boundingBox),this.controls[n].setBounds(t)}.bind(this))}},{key:"onMouseDown",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseDown(e)}},{key:"onMouseMove",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseMove(e)}},{key:"onMouseUp",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseUp(e)}},{key:"onMouseOver",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseOver(e)}},{key:"onMouseWheel",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseWheel(e)}},{key:"onTouchStart",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onTouchStart(e)}},{key:"onTouchMove",value:function(e){var t=this,n=function(){e.preventDefault(),t.activeControl&&t.activeControl.onTouchMove(e)};this.$app.VRScreenSYNC?Ae.debounce(n,1e3/60,!0)():n()}},{key:"onTouchEnd",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onTouchEnd(e)}},{key:"onPointerDown",value:function(e){if(e.preventDefault(),this.activeControl)switch(e.pointerType){case"mouse":this.activeControl.onMouseDown(e);break;default:this.activeControl.onPointerDown(e)}}},{key:"onPointerMove",value:function(e){var t=this,n=function(){if(e.preventDefault(),t.activeControl)switch(e.pointerType){case"mouse":t.activeControl.onMouseMove(e);break;default:t.activeControl.onPointerMove(e)}};this.$app.VRScreenSYNC?Ae.debounce(n,1e3/60,!0)():n()}},{key:"onPointerUp",value:function(e){if(e.preventDefault(),this.activeControl){switch(e.pointerType){case"mouse":this.activeControl.onMouseUp(e);break;default:this.activeControl.onPointerUp(e)}this.emit("pointerUp")}}},{key:"onPointerCancel",value:function(e){e.preventDefault(),this.activeControl&&"mouse"!==e.pointerType&&this.activeControl.onPointerUp(e)}},{key:"onKeyDown",value:function(e){this.$app.config.useShortcutKeys&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.activeControl&&this.activeControl.onKeyDown(e)))}},{key:"onKeyUp",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onKeyUp(e)}}]),n}()}));var gc="panovideo.canplay",Ac="panovideo.start",yc="panovideo.resume",Ec="panovideo.pause",wc="panovideo.stop",bc="panovideo.switch";function Cc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function xc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ic(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Tc=function(e){f(n,EventEmitter);var t=Ic(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).domElement=e,r.os="",r.environment="",r._resource=new Map,i.forEach((function(e,t){var n=r._createVideoElement(e.mp4.url,0==r._resource.size);r._resource.set(t,{url:e.mp4.url,video:n,texture:r._createTexture(n),loaded:!0})})),r.video=null,r.isFirstPlay=!0,r.isMuted=!0,r.events={onDomElementTouchStart:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.video.play(),console.log("onDomElementTouchStart muted",r.video.muted,"paused",r.video.paused),r.domElement.removeEventListener("touchstart",r.events.onDomElementTouchStart,!0))},onDomElementTouchEnd:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.domElement.removeEventListener("touchend",r.events.onDomElementTouchEnd,!0))},onDomElementMouseDown:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.domElement.removeEventListener("mousedown",r.events.onDomElementMouseDown,!0))}},r}return u(n,[{key:"_createTexture",value:function(e){var t=new THREE.VideoTexture(e);return t.minFilter=THREE.LinearFilter,t.uploaded=!1,t}},{key:"_createVideoElement",value:function(e){var t;return(t=document.createElement("video")).setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("x5-playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("x5-video-player-type","h5"),t.setAttribute("controls","true"),t.autoplay=!1,t.muted=this.isMuted,t.loop=!0,t.src=e,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.width=Ce.urlHasValue("debug")?"300px":"1px",t.style.height=Ce.urlHasValue("debug")?"300px":"1px",t.style.display="block",t.style.zIndex=Ce.urlHasValue("debug")?"1000":"0",t.style.opacity=Ce.urlHasValue("debug")?"1":"0",t}},{key:"_onCanPlay",value:function(){this.emit(gc)}},{key:"_onPlaying",value:function(){var e=this;this.emit(bc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.5&&(e.emit(yc),e.video.ontimeupdate=null,e.isFirstPlay=!1)},this.isFirstPlay&&this.emit(Ac)}},{key:"_onPause",value:function(e){this.video&&(this.video._isPaused=!0),this.emit(Ec)}},{key:"preload",value:function(e){var t=this;if(e!=this.video&&!e._isPrepload){e.muted=!0;try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(t){e.play()}),!1)}catch(t){e.play()}e.onplaying=function(){e.pause(),e._isPrepload=!0,t.video&&!t.video._isPaused&&t.video.play()}}}},{key:"preloadAll",value:function(){this.video&&(this.video._isPaused=this.video.paused);var e,t=Cc(this._resource.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.preload(n.video)}}catch(e){t.e(e)}finally{t.f()}}},{key:"preloadPano",value:function(e){var t=this._resource.get(e.id);t&&this.preload(t.video)}},{key:"startVideo",value:function(e,t){var n=this._resource.get(e);n&&(n.video.autoplay=!0,n.video.onplaying=this._onPlaying.bind(this),n.video.onpause=this._onPause.bind(this),n.video.oncanplay=this._onCanPlay.bind(this),this.video=n.video,this.texture=n.texture,this.video.paused?this.play(this.video):this._onPlaying())}},{key:"pauseVideo",value:function(e){var t=this._resource.get(e);t&&(t.video.pause(),t.video.muted=!0,t.video.onplaying=null)}},{key:"play",value:function(e){if(this.shouldPlay=e,this.isFirstPlay||!e._isCanplay)if(Ce.detectWeixin())try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(t){e.play(),e._isCanplay=!0}),!1)}catch(t){e.play(),e._isCanplay=!0}else e.play(),e._isCanplay=!0,Ce.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.events.onDomElementTouchEnd,!0):Ce.detectIOS()?this.domElement.addEventListener("touchstart",this.events.onDomElementTouchStart,!0):this.domElement.addEventListener("mousedown",this.events.onDomElementMouseDown,!0);else e.play()}},{key:"pause",value:function(){this.video&&(this.video._isPaused=!0,this.video.pause(),this.shouldPlay=!1)}},{key:"resume",value:function(){this.video?(this.play(this.video),this.video.onplaying=this._onPlaying.bind(this)):console.warn("PanoVideoRenderer: 没有可播放的视频")}},{key:"setMuted",value:function(e){var t,n=Cc(this._resource.values());try{for(n.s();!(t=n.n()).done;){t.value.video.muted=e}}catch(e){n.e(e)}finally{n.f()}this.isMuted=e}}]),n}();function Bc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return kc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function kc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Pc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Tc.videoReady=!1;var Rc,Mc,Sc=function(e){f(n,EventEmitter);var t=Pc(n);function n(e,r){var a;return o(this,n),(a=t.call(this)).domElement=e,a.instances=new Map,a.instanceTextures=new Map,r.forEach((function(e,t){a.instances.set(t,a._createVideo(e.flv.url));var n=new i.VideoTexture(a.instances.get(t).videoElement);n.minFilter=i.LinearFilter,a.instanceTextures.set(t,n)})),a.video=null,a.texture=null,a.isFirstPlay=!0,a.isMuted=!0,a.events={onDomElementTouchStart:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("touchstart",a.events.onDomElementTouchStart,!0)},onDomElementTouchEnd:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("touchend",a.events.onDomElementTouchEnd,!0)},onDomElementMouseDown:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("mousedown",a.events.onDomElementMouseDown,!0)}},a}return u(n,[{key:"_createVideo",value:function(e){var t=document.createElement("video");t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("controls","true"),t.autoplay=!1,t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.width=Ce.urlHasValue("debug")?"200px":"1px",t.style.display="block",t.style.zIndex=Ce.urlHasValue("debug")?"1000":"0",t.style.opacity=Ce.urlHasValue("debug")?"1":"0",this.domElement.appendChild(t);var n=flvjs.createPlayer({type:"flv",url:e},{lazyLoad:!0,lazyLoadMaxDuration:5});return n.videoElement=t,n.attachMediaElement(t),n.on(flvjs.Events.ERROR,this._onPlayerError.bind(this)),n}},{key:"_onPlayerError",value:function(e){console.warn("球幕视频资源加载错误:",e)}},{key:"_onPlaying",value:function(){var e=this;this.emit(bc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.2&&(e.emit(yc),e.isFirstPlay&&e.emit(Ac),e.isFirstPlay=!1,e.video.ontimeupdate=null)}}},{key:"_onPause",value:function(){this.emit(Ec),this.state=0}},{key:"preloadPano",value:function(e){var t=this.instances.get(e.id);t&&0==t.buffered.length&&t.load()}},{key:"startVideo",value:function(e){var t=this.instances.get(e);t&&(0==t.buffered.length&&t.load(),this.video=t.videoElement,this.video.onplaying=this._onPlaying.bind(this),this.video.onpause=this._onPause.bind(this),this.texture=this.instanceTextures.get(e),this.video.paused?this.play(this.video):this._onPlaying())}},{key:"pauseVideo",value:function(e){var t=this.instances.get(e);t&&(t.videoElement.pause(),t.videoElement.onplaying=null)}},{key:"play",value:function(e){this.isFirstPlay?(e.play(),Ce.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.events.onDomElementTouchEnd,!0):Ce.detectIOS()?this.domElement.addEventListener("touchstart",this.events.onDomElementTouchStart,!0):this.domElement.addEventListener("mousedown",this.events.onDomElementMouseDown,!0)):e.play()}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"resume",value:function(){this.video?this.play(this.video):console.warn("FlvVideoPlayer: 没有可播放的视频")}},{key:"setMuted",value:function(e){var t,n=Bc(this.instances.values());try{for(n.s();!(t=n.n()).done;){t.value.videoElement.muted=e}}catch(e){n.e(e)}finally{n.f()}this.isMuted=e}}]),n}();function Dc(){Mc={version:1,upPath:"",videoPath:Rc.resource.getViewResourceURL("video/"),videoInfos:new Map,parameters:{inputWidth:0,inputHeight:0,outputWidth:0,outputHeight:0,focal:0,pixel:0,centerX:0,centerY:0,translateX:0,translateY:0,translateZ:0,lenOffsetX:0,lenOffsetY:0,videoWidth:0,videoHeight:0,mapping:0,cameraType:0,blend_fov:5}}}var Fc=null;function Lc(e,t,n){t&&(JSON.parse(t).forEach((function(t){e.videoInfos.set(t.panoId,{dir:(new THREE.Vector3).copy(t.dir),hfov:parseFloat(t.hfov),vfov:parseFloat(t.vfov),mp4:{url:e.videoPath+t.panoId+"-user.mp4"+n},mpeg:{url:e.videoPath+t.panoId+"-user.ts",size:t.tsSize+n},flv:{url:e.videoPath+t.panoId+"-user.flv"+n},exposure:1,clipRect:t.rect,mapping:2})})),e.parameters.mapping=2,e.parameters.cameraType=8)}var Hc={handle:function(e,t){Rc=t,Mc||Dc();var n="";if(void 0!==e.version&&(n="?imagesVersion="+e.version),!e.videos)return e.videos={version:Mc.version,videos:Mc.videoInfos,parameters:Mc.parameters},void Lc(Mc,e.videosUser,n);try{var i=e.videos;if(!i.data||!i.data.length)return e.videos={version:Mc.version,videos:Mc.videoInfos,parameters:Mc.parameters},void Lc(Mc,e.videosUser,n)}catch(e){console.error(e)}var o,r=e.sceneFrom||"pro";if("pro"==r){var a=e.videos,s=a.version||0;return Mc.version=s,Mc.parameters.cameraType=8,1==s?a.data.forEach((function(e){Mc.videoInfos.set(e.id,{mp4:{url:Mc.videoPath+e.id+".mp4"+n},mpeg:{url:Mc.videoPath+e.id+".ts",size:e.tsSize+n},flv:{url:Mc.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:0,cameraType:8,blend_fov:e.blend_fov||5})})):s>1&&a.data.forEach((function(e){Mc.videoInfos.set(e.id,{mp4:{url:Mc.videoPath+e.id+".mp4"+n},mpeg:{url:Mc.videoPath+e.id+".ts"+n,size:e.tsSize},flv:{url:Mc.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:1,cameraType:8,blend_fov:e.blend_fov||5})})),(o=a.upPath,Fc||(Fc=new Promise((function(e,t){o||t("找不到参数请求地址"),Xn.getText(o).then((function(t){return e(t)})).catch((function(e){return t(e)}))})).then((function(e){var t=e.split(/\n/).filter((function(e){return""!=e.trim()})).map((function(e){return e.split(":")})),n=Number(t[0][1]),i=Number(t[1][1]),o=t[2][1].trim().split(/\s+/).map((function(e){return Number(e)})),r=t[7][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],a=t[8][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],s=t[9][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3];return Mc.parameters.focal=n,Mc.parameters.pixel=i,Mc.parameters.centerX=o[0],Mc.parameters.centerY=o[1],Mc.parameters.translateX=r,Mc.parameters.translateY=a,Mc.parameters.translateZ=s,Mc})).catch((function(e){return console.warn("球幕视频【八目】:参数文件加载失败",e),Mc})).finally((function(){return Mc})))).then((function(t){return s<=2?(t.parameters.inputWidth=2304,t.parameters.inputHeight=1728,t.parameters.outputWidth=2048,t.parameters.outputHeight=1024):s>2&&(t.parameters.inputWidth=4608,t.parameters.inputHeight=3456,t.parameters.outputWidth=8192,t.parameters.outputHeight=4096,t.parameters.lenOffsetX=1235,t.parameters.lenOffsetY=954,t.parameters.videoWidth=2112,t.parameters.videoHeight=1584,t.parameters.mapping=1),e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},Lc(t,e.videosUser,n),t})).catch((function(e){throw e}))}if("lite"==r){var l=e.videos,c=l.version||0;Mc.version=c,Mc.parameters.cameraType=2;var u="";return void 0!==e.version&&(u="?imagesVersion="+e.version),1==c&&l.data.forEach((function(e){Mc.videoInfos.set(e.id,{mp4:{url:Mc.videoPath+e.id+".mp4"+u},mpeg:{url:Mc.videoPath+e.id+".ts",size:e.tsSize+u},flv:{url:Mc.videoPath+e.id+".flv"+u},exposure:Number(e.value)||1,mapping:1,cameraType:2,blend_fov:e.blend_fov||5})})),function(e){return Fc||(Fc=new Promise((function(t,n){e||n("找不到参数请求地址"),Xn.getText(e,null,(function(e){t(e)}),(function(e){n(e)}))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),Mc.parameters.focal=t.focal,Mc.parameters.centerX=t.cx,Mc.parameters.centerY=t.cy,Mc.parameters.translateX=t.tx,Mc.parameters.translateY=t.ty,Mc.parameters.translateZ=t.tz,Mc})).catch((function(e){return console.warn("球幕视频【双目】:参数文件加载失败"),Mc})).finally((function(){return Mc})))}(l.upPath).then((function(t){return 1==c&&(t.parameters.inputWidth=3e3,t.parameters.inputHeight=3e3,t.parameters.outputWidth=4096,t.parameters.outputHeight=2048,t.parameters.pixel=1.12),e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},t})).catch((function(e){throw e}))}if("minion"==r){var h=e.videos,d=h.version||0;Mc.version=d,Mc.parameters.cameraType=3;var p="";return void 0!==e.version&&(p="?imagesVersion="+e.version),h.data.forEach((function(e){Mc.videoInfos.set(e.id,{mp4:{url:Mc.videoPath+e.id+".mp4"+p},mpeg:{url:Mc.videoPath+e.id+".ts",size:e.tsSize+p},flv:{url:Mc.videoPath+e.id+".flv"+p},exposure:Number(e.value)||1,mapping:1,cameraType:3,blend_fov:e.blend_fov||5})})),function(e){return Fc||(Fc=new Promise((function(t,n){e||n("找不到参数请求地址"),t(Xn.getText(e))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),Mc.parameters.focal=t.focal,Mc.parameters.centerX=t.cx,Mc.parameters.centerY=t.cy,Mc.parameters.translateX=t.rx,Mc.parameters.translateY=t.ry,Mc.parameters.translateZ=t.rz,Mc})).catch((function(e){return console.warn("球幕视频【转台】:参数文件加载失败",e),Mc})).finally((function(){return Mc})))}(h.upPath).then((function(t){return t.parameters.inputWidth=5472,t.parameters.inputHeight=3648,t.parameters.outputWidth=4096,t.parameters.outputHeight=2048,t.parameters.lenOffsetX=920,t.parameters.lenOffsetY=500,t.parameters.videoWidth=3630,t.parameters.videoHeight=2670,t.parameters.pixel=1.12,e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},Lc(t,e.videosUser,p),t})).catch((function(e){throw e}))}console.warn("有尚不支持的相机来源:",r)},getEnvironment:function(){Mc||Dc();var e="PC",t="H5";return Ce.detectAndroidMobile()?e="Android":Ce.detectIOS()&&(e="Ios"),Ce.detectWeixin()&&(t="WeChat",navigator.userAgent.match("miniProgram")&&(t="WeChatMiniprogram")),{os:e,environment:t}}},Qc=0,Oc=1;function Vc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function _c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("PanoVideoRenderer",(function(){return function(e){f(n,EventEmitter);var t=Vc(n);function n(){var e;o(this,n),e=t.call(this),window.panoVideoRenderer=h(e),e.version=1,e.videoPlayer=null,e.activePanorama=null,e.nearestPano=null,e.ready=!1,e._state=Qc,e.texture=null,e.isGuiding=!1,e.isRecording=!1,e.isSoundRecording=!1,e.loadingAnimEnable=!0,e.loadingTimeStamp=0,e.loadingUITimer=0,e.loadingUIAnimHandler=0;var i=THREE.UniformsUtils.clone(sn.videoLoading.uniforms);return i.uColor.value=new THREE.Vector4(0,.7843137254901961,.6862745098039216,.7),e.loadingUI=new THREE.Mesh(new THREE.PlaneBufferGeometry(.4,.4),new THREE.RawShaderMaterial({uniforms:i,vertexShader:sn.videoLoading.vertexShader,fragmentShader:sn.videoLoading.fragmentShader,transparent:!0})),e.loadingUI.visible=!1,e}return u(n,[{key:"init",value:function(e){var t=this,n=this.$app.core.get("Player");if(this.videosInfo=e,e){this.version=e.version,n.on("guide/play/start",(function(e){t.isGuiding=!0,t.setMuted(!0)})),n.on("guide/play/pause",(function(e){t.isGuiding=!1,t.setMuted(!1)})),this.$app.core.get("Player").on("guide/play/stop",(function(e){t.isGuiding=!1,t.setMuted(!1)})),this.ready=!0,(Ce.detectIE()||navigator.userAgent.match("JSN-AL00"))&&(this.ready=!1,console.warn("浏览器不支持球幕视频",navigator.userAgent)),this.$app.core.get("SceneRenderer").scene.add(this.loadingUI);n.on("linkEditorSetVisible",(function(e){!function(){if("floorplan"==n.mode){var e=t.canShowMarker("floorplan");console.log("updateVideoMarkerDisplay",e),n.model.panos.forEach((function(t){var i=e&&(n.model.allFloorsVisible||!t.floor.hidden);t.flagSpot&&(t.marker.material.opacity=i?1:0)}))}}()}));n.on("editViewStateChange",(function(e){0==e&&n.model.panos.forEach((function(e){var t=n.model.allFloorsVisible||!e.floor.hidden;e.flagSpot&&(e.marker.material.opacity=t?1:0)}))}))}else nt.warn("PanoVideoRenderer初始化失败,数据为空")}},{key:"initVideoPlayer",value:function(e,t){var n=Hc.getEnvironment(),i=n.os,o=n.environment;!window.MediaSource||"Android"!=i&&"WeChat"!=o?this.videoPlayer=new Tc(e,t):this.videoPlayer=new Sc(e,t),this.videoPlayer.on(gc,this.onVideoCanPlay.bind(this)),this.videoPlayer.on(Ac,this.onVideoStartPlay.bind(this)),this.videoPlayer.on(bc,this.onVideoSwitch.bind(this)),this.videoPlayer.on(yc,this.onVideoResume.bind(this)),this.videoPlayer.on(Ec,this.onVideoPause.bind(this)),this.videoPlayer.on(wc,this.onVideoStop.bind(this))}},{key:"activatePanorama",value:function(e,t){var n=this;e.hasVideo&&this.ready&&(this.activePanorama=e,this.started=!0,this.videoPlayer.startVideo(e.id,t),this.loadingUITimer=setTimeout((function(){n.showLoading(e),window.clearTimeout(n.loadingUITimer)}),500))}},{key:"deactivePanorama",value:function(e){null!=e&&null!=e.id&&this.videoPlayer.pauseVideo(e.id),this.activePanorama=null}},{key:"preActivatePanorama",value:function(e){this.videoPlayer.startVideo(e.id,!0)}},{key:"getActivePanorama",value:function(){return this.activePanorama}},{key:"showLoading",value:function(e){if(this.loadingAnimEnable){var t=(new THREE.Vector3).copy(e.position),n=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.$app.core.get("Player").model.supportsTiles?90:180)),i=new THREE.Vector3(0,0,-1).applyQuaternion(n.multiply(e.quaternion));this.loadingUI.position.copy(t).add(i),this.loadingUI.lookAt(t),this.loadingTimeStamp=performance.now(),this.loadingAnimte(0)}}},{key:"hideLoading",value:function(){this.loadingUI.visible=!1,window.cancelAnimationFrame(this.loadingUIAnimHandler),window.clearTimeout(this.loadingUITimer)}},{key:"loadingAnimte",value:function(e){this.loadingUI.material.uniforms.uTime.value=performance.now()-this.loadingTimeStamp,this.loadingUIAnimHandler=window.requestAnimationFrame(this.loadingAnimte.bind(this))}},{key:"suspend",value:function(){if(!this.ready)return!1;this.videoPlayer.pause(),this.emit(Ul)}},{key:"resume",value:function(){if(!this.ready)return!1;this.videoPlayer.resume()}},{key:"canPhonate",value:function(){return 0==this.isGuiding&&0==this.isRecording&&0==this.isSoundRecording}},{key:"setMuted",value:function(e){this.videoPlayer&&(this.canPhonate()||(e=!0),this.videoPlayer.setMuted(e))}},{key:"getState",value:function(){return this._state}},{key:"onVideoPanoramasEnter",value:function(e,t){}},{key:"onVideoPanoramasExit",value:function(e){}},{key:"onVideoCanPlay",value:function(){this.emit(Gl)}},{key:"onVideoStartPlay",value:function(){this.emit(jl)}},{key:"onVideoSwitch",value:function(e){this.texture&&this.texture.dispose(),this.texture=e,this.emit(zl,e)}},{key:"onVideoResume",value:function(){this._state=Oc,this.emit(Nl),this.hideLoading()}},{key:"onVideoPause",value:function(){this._state=Qc,this.emit(Ul)}},{key:"onVideoStop",value:function(){this._state=Qc,this.emit(Ul)}},{key:"ifEnable",value:function(){return this.ready}},{key:"canShowMarker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"floorplan",t=this.$app.core.get("Player");if("floorplan"==e)return!(this.$app.Plugins.EditCAD&&this.$app.Plugins.EditCAD.display||t.linkEditor&&(t.linkEditor.setPanoVisible||t.linkEditor.setTagVisible))}}]),n}()})),Xe("DisplayController",(function(){return function(e){f(n,EventEmitter);var t=_c(n);function n(e){var i;return o(this,n),(i=t.call(this)).fadeInSpeed=e,null!==i.fadeInSpeed&&void 0!==i.fadeInSpeed||(i.fadeInSpeed=0),i.panoVideoRenderer=null,i}return u(n,[{key:"init",value:function(){this.container=this.$app.core.get("Player").domElement,this.panoVideoRenderer=this.$app.core.get("PanoVideoRenderer"),this.updateModel(),this.bindEvents()}},{key:"bindEvents",value:function(){this.$app.core.get("Player").on(Wr,this.handlePlayerFlyingStarted.bind(this)),this.$app.core.get("Player").on(qr,this.handlePlayerFlyingEnded.bind(this)),this.$app.core.get("Player").on(Nr,this.handlePlayerModeChanging.bind(this)),this.$app.core.get("Player").on(Ur,this.handlePlayerModeChanged.bind(this)),this.$app.core.get("Player").on(Gr,this.handleClosestPanoChanging.bind(this)),this.$app.core.get("Player").on(Yr,this.handleStartInside.bind(this)),this.$app.core.get("Player").on(Zr,this.handleStartOutside.bind(this))}},{key:"updateModel",value:function(){this.model=this.$app.core.get("ModelManager").getActiveModel()}},{key:"handlePlayerFlyingStarted",value:function(e){var t=this.model.panos.index[e.lastPanoId];this.panoVideoRenderer.deactivePanorama(t),this.panoVideoRenderer.setMuted(!0)}},{key:"handlePlayerFlyingEnded",value:function(e){var t=e.targetPano;t&&this.model.mode==ht.PANORAMA&&this.panoVideoRenderer.activatePanorama(t),this.panoVideoRenderer.setMuted(!1)}},{key:"handlePlayerModeChanging",value:function(e,t,n){var i,o=this.$app.core.get("ModelManager").getActiveModel();i=this.$app.core.get("Player").is360View(t,n)?0:Je[t].markerOpacity,o.fadePanoMarkers(i,0,{mode:t}),o.setMode(t)}},{key:"handlePlayerModeChanged",value:function(e,t){var n=this.$app.core.get("ModelManager").getActiveModel(),i=t===ht.PANORAMA?THREE.DoubleSide:THREE.FrontSide;n.setSide(i),n.setMode(t)}},{key:"handleClosestPanoChanging",value:function(e,t,n){n!==ht.TRANSITIONING&&(e&&e.hoverOff(n),t&&t.hoverOn(n))}},{key:"handleStartInside",value:function(e){var t=Je[this.$app.core.get("Player").mode],n=e?0:t.transitionTime*t.skyboxOpacityLength;this.fadeIn(this.fadeInSpeed),this.model.alpha=0,this.model.skybox.material.uniforms.opacity.value=1,this.model.fadePanoMarkers(null,null,{player:this.$app.core.get("Player")});var i=this.$app.core.get("Player").reticule;pe.start(It.property(i.material,"opacity",0),n,null,0,null,"retReOpac")}},{key:"handleStartOutside",value:function(e){this.fadeIn(e)}},{key:"fadeIn",value:function(e){null!=e||(e=2e3,logger.warn("DisplayController.fadeIn -> no transition time specified, defaulting to 2000 ms.")),this.model&&this.model.panos.forEach((function(e){return e.updateMakerStyle()}))}}]),n}()})),Xe("QuickstartManager",(function(){return function(){function e(t,n,i,r,a){o(this,e),this.locked=!1,this.qualityManager=t,this.scene=n,this.camera=i,this.controls=r,this.quickStartcamera=r.camera,this.view=null,this.panoVideoRenderer=a,this.unlockDom=null,this.unlockHanlde=null,this.loadPromise=null,this.ready=!1,this.touchStartPosition=new THREE.Vector2(0,0),this.touchMoveDelta=new THREE.Vector2(0,0),this.touchPrevPosition=new THREE.Vector2(0,0),this.touchMoveOffset=new THREE.Vector2(0,0),this.enter=!1,this.canEnter=!1,this.animFov=null,this.animRotation=null,this.initTarget=new THREE.Vector3(0,0,0),this.enterView={pano:null,quaternion:new THREE.Quaternion,position:new THREE.Vector3,fov:Je.insideFOV}}return u(e,[{key:"init",value:function(e,t){if(this.dom=this.$app.core.get("Player").domElement,this.pano=e.pano,this.setSize(window.innerWidth,window.innerHeight),this.initView(e),this.skybox=new THREE.Mesh(new THREE.BoxBufferGeometry(1,1,1),new ho({side:THREE.DoubleSide})),this.skybox.material.uniforms.map.value=e.pano.getSkyboxTexture(),this.skybox.quaternion.copy(e.quaternion),this.scene.add(this.skybox),this.skybox.material.depthTest=!1,this.skybox.material.depthWrite=!1,this.skybox.renderOrder=1e3,this.skybox.name="quickStartSkyBox",this.skybox.material.uniforms.modelAlpha.value=0,this.skybox.position.copy(this.pano.position),this.skybox.visible=!0,this.scene.add(this.skybox),this.pano.attachToPanoVideoRenderer(this.$app.core.get("PanoVideoRenderer")),this.$app.core.get("PanoVideoRenderer").on(jl,this.onVideoStartPlay.bind(this)),this.$app.core.get("PanoVideoRenderer").on(zl,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Nl,this.onVideoRenderResume.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ul,this.onVideoRenderSuspend.bind(this)),this.$app.core.get("PanoVideoRenderer").videosInfo){var n=this.$app.core.get("PanoVideoRenderer").videosInfo.parameters;this.skybox.material.uniforms.parameters.value.set(n.inputWidth,n.inputHeight,n.outputWidth,n.outputHeight,n.focal,n.pixel,n.centerX,n.centerY,n.translateX,n.translateY,n.translateZ,0,n.lenOffsetX,n.lenOffsetY,n.videoWidth,n.videoHeight),8==n.cameraType?this.skybox.material.defines.HasVideo=8:2==n.cameraType&&(this.skybox.material.defines.HasVideo=2),this.skybox.material.defines.VideoMapping=n.mapping,this.skybox.material.uniforms.videoReady.value=0,this.skybox.material.uniforms.progress.value=1}}},{key:"initView",value:function(e){this.view=e;var t=e.pano;e.mode,e.zoom,e.position,e.quaternion,this.controls.locked=!1,this.controls.camera.position.copy(t.position),this.initTarget.copy(new THREE.Vector3(0,0,-1).applyQuaternion(e.quaternion)).add(e.position),this.controls.lookAt(this.initTarget),this.quickStartcamera.fov=this.view.fov,this.quickStartcamera.aspect=window.innerWidth/window.innerHeight,this.quickStartcamera.updateProjectionMatrix(),this.camera.fov=this.view.fov,this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.position.copy(this.quickStartcamera.position),this.camera.quaternion.copy(this.quickStartcamera.quaternion),this.enterView.pano=t,this.enterView.position.copy(this.view.position),this.enterView.quaternion.copy(this.view.quaternion),this.enterView.fov=this.view.fov,this.controls.update(.016),this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion)}},{key:"load",value:function(e){var t=this;if(this.loadPromise)return this.loadPromise;var n=this.$app.store.__store.metadata;if(this.view=e,this.view.pano.shouldRedrawOnBaseLoaded=!0,this.view.pano.tiled){this.init(e,n);var i=document.querySelector(".player[name=main]"),o=this.qualityManager.getPanoSize(Dt),r=this.qualityManager.getPanoSize(Ft),a=na.getHFOVForCamera(this.quickStartcamera,i.clientWidth,i.clientHeight),s=this.quickStartcamera.fov,l=$i.FORWARD.clone().applyQuaternion(this.view.quaternion),c=this.view.pano.loadTiledPano(r,l,{hFov:a,vFov:s},!1,!1,!0),u=this.view.pano.loadTiledPano(o,l.clone().negate(),null,!1,!1,!0);this.loadPromise=new Promise((function(e){(t.view.pano.hasVideo||t.qualityManager.getMaxNavPanoSize()<1024?u:c).then(e)}))}else this.init(e,n),this.loadPromise=new Promise((function(e){t.view.pano.hasVideo?t.view.pano.loadCube("low").then((function(){return e()})):t.view.pano.loadCube("high").then((function(){return e()}))}));return this.loadPromise.then((function(){t.ready=!0,t.skybox.material.setProjectedPanos(t.view.pano,t.view.pano),t.$app.core.get("Player").paintEditor.updatePanoPaint(t.view.pano.id,t.view.pano.id),t.$app.FilterManager.updatePanoFilters(t.view.pano,t.view.pano)})),this.loadPromise}},{key:"onVideoStartPlay",value:function(){}},{key:"onVideoTextureUpdate",value:function(e){this.skybox.material.uniforms.videoTexture.value=e}},{key:"onVideoRenderResume",value:function(){this.skybox.material.uniforms.videoReady.value=1,this.$app.Scene.emit("panorama.videorenderer.resumerender")}},{key:"onVideoRenderSuspend",value:function(){this.skybox.material.uniforms.videoReady.value=0,this.$app.Scene.emit("panorama.videorenderer.suspendrender")}},{key:"watingUnlock",value:function(){var e=this;return this.locked=!0,this.controls.locked=!0,new Promise((function(t){e.unlockHanlde=t}))}},{key:"autoUnlock",value:function(){return this.locked=!1,this.app.active=!0,this.controls.locked=!1,this.controls.limitDownAngel=null,this.pano.hasVideo&&Ce.detectIOS()?this.panoVideoRenderer.setMuted(!1):this.panoVideoRenderer.setMuted(!0),this.panoVideoRenderer.activatePanorama(this.pano),Promise.resolve(!0)}},{key:"activate",value:function(){this.panoVideoRenderer.setMuted("0"==Ce.urlQueryValue("sound")),this.panoVideoRenderer.activatePanorama(this.pano)}},{key:"unlock",value:function(e){var t=this;if(this.enter)this.controls.rotationAcc.set(0,0);else{this.enter=!0,this.app.emit("unlock"),this.controls.locked=!1,this.controls.rotationAcc.set(e.x>0?.3:-.3,0),this.controls.limitDownAngel=null,this.animFov&&pe.cancel(this.animFov);try{parent.postMessage({num:config.projectNum,cmd:"unlocking",isParent:top==self},"*")}catch(e){console.error("跨域",e)}this.animFov=pe.start(It.property(this.quickStartcamera,"fov",70),3e3,(function(){t.unlockHanlde&&t.unlockHanlde(),t.locked=!1,t.enter=!0,t.controls.locked=!1,t.controls.rotationAcc.set(0,0),t.controls.limitDownAngel=null;try{parent.postMessage({num:config.projectNum,cmd:"unlocked",isParent:top==self},"*")}catch(e){console.error("跨域",e)}}),0,de.easeOutCubic)}}},{key:"exit",value:function(){this.enter=!1,this.pano.enter(),this.controls.rotationAcc.set(0,0),this.controls.limitDownAngel=null,this.animFov&&pe.cancel(this.animFov),this.app.player.model?this.app.player.flyToPano({pano:this.pano}):this.smoothLookAt(this.initTarget,1e3)}},{key:"smoothLookAt",value:function(e,t){var n=this;t=t||1e3;var i=e.clone().sub(this.controls.camera.position).normalize(),o=this.controls.lookVector.clone(),r=new THREE.Vector3;new THREE.Vector3;this.animFov=pe.start((function(e){r.lerpVectors(o,i,e),n.controls.lookAt(r.add(n.controls.camera.position))}),t)}},{key:"cancelRotate",value:function(){this.enter&&this.app.startOption.needUnlock&&this.controls.rotationAcc.set(0,0)}},{key:"update",value:function(e){this.locked,this.controls.update(e),this.camera.position.copy(this.quickStartcamera.position),this.camera.quaternion.copy(this.quickStartcamera.quaternion),this.camera.fov=this.quickStartcamera.fov,this.camera.updateProjectionMatrix(),this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion),this.view.fov=this.quickStartcamera.fov}},{key:"setSize",value:function(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}},{key:"destroy",value:function(){this.scene.remove(this.skybox),this.controls.rotationAcc.set(0,0)}},{key:"attachDom",value:function(e){e.addEventListener("touchstart",this.onTouchStart.bind(this)),e.addEventListener("touchmove",this.onTouchMove.bind(this)),e.addEventListener("touchend",this.onTouchEnd.bind(this))}},{key:"onTouchEvent",value:function(e,t){"touchstart"==t.type?this.onTouchStart(t):"touchmove"==t.type?this.onTouchMove(t):"touchend"==t.type&&this.onTouchEnd(t)}},{key:"onTouchStart",value:function(e){this.touchStartPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveDelta.set(0,0),this.touchMoveOffset.set(0,0),this.enter||0==this.app.needUnlock?(this.controls.rotationAcc.set(0,0),this.controls.onTouchStart(e)):this.canEnter=!1,this._start={x:e.touches[0].clientX,y:e.touches[0].clientY}}},{key:"onTouchMove",value:function(e){if(this._move={x:e.touches[0].clientX,y:e.touches[0].clientY},this.touchMoveDelta.set(e.touches[0].clientX-this.touchPrevPosition.x,e.touches[0].clientY-this.touchPrevPosition.y),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveOffset.set(e.touches[0].clientX-this.touchStartPosition.x,e.touches[0].clientY-this.touchStartPosition.y),this.enter||0==this.app.needUnlock)this.controls.onTouchMove(e);else{var t=-this.touchMoveDelta.x;Math.abs(this.getAngle(this._start,this._move))<15&&0==this.enter&&this.unlock(new THREE.Vector2(t,0))}}},{key:"onTouchEnd",value:function(e){(this.enter||0==this.app.needUnlock)&&this.controls.onTouchEnd(e)}},{key:"getAngle",value:function(e,t){var n=t.x-e.x,i=t.y-e.y;return 360*Math.atan(i/n)/(2*Math.PI)}}]),e}()}));var Uc={currentBlur:0,aspect:Je.aspect,blurStrength:1,hblurPass:Je.HorizontalBlurShader,vblurPass:Je.VerticalBlurShader,bindEvents(e){e.on(Ur,(function(e,t){e===ht.PANORAMA&&(pe.cancel(Uc.blur),pe.cancel(Uc.addBlur),pe.start(Uc.removeBlur,500,null,0,null,"deblur"))}))},blur(e){Uc.currentBlur=e;var t=e*Uc.blurStrength;Je.VerticalBlurShader.uniforms.v.value=t/512*Uc.aspect,Je.HorizontalBlurShader.uniforms.h.value=t/512},addBlur(e){e=Math.max(e,Uc.currentBlur),Uc.blur(e)},removeBlur(e){e=Math.min(1-e,Uc.currentBlur),Uc.blur(e)}};Uc.blur(0);var Nc=function e(t){o(this,e),this.message=t};function zc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Gc,jc,Wc,qc,Jc=function(e){f(n,e);var t=zc(n);function n(e){return o(this,n),t.call(this,e)}return n}(Nc);function Yc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}window.screenFaceOrient=0;var Zc,Xc={},Kc=function(e,t){"reset"==e?Xc={}:(Xc[e]=t,2!=Object.keys(Xc).length||"granted"==Xc.deviceMotion&&"granted"==Xc.deviceOrientation||console.error("运动和方向访问失败"))},$c=function(e){f(n,THREE.EventDispatcher);var t=Yc(n);function n(){return o(this,n),t.call(this)}return u(n,[{key:"Init",value:function(e,t){if(Gc=e,(jc=t).VR=this,Gc.renderer&&!Gc.newRenderer&&!Wc){var n=Ae.loadTextureFromCache($n.getImageURL("images/circleMarker.png"));if(jc.model.panos.list.forEach((function(e){e.createVrMarker(n,jc)})),Gc.newRenderer=new nu(Gc.renderer,Gc,Gc.camera),Gc.isHuawei5X=Ce.detectHUAWEI5X(),Gc.oldRenderer=Gc.renderer,ru.init(Gc.renderer),function(){for(var e=[{name:"nova 10z",words:["CHA-AL80","537.36"],threshold:{min:.005,max:.7},useRatio:.2}],t=window.navigator.userAgent,n=0,i=e.length;n<i;n++){var o=e[n];if(!o.words.some((function(e){return!t.includes(e)}))){qc=o;break}}qc||(qc={name:"default",threshold:{min:.01,max:.3},useRatio:.5})}(),null!=jc.$app.config.vr.markerHeight&&!isNaN(jc.$app.config.vr.markerHeight)){var i=jc.$app.config.vr.markerHeight;jc.model.panos.forEach((function(e){e.vrMarker&&(e.vrMarker.position.y=e.floorPosition.y+i)}))}var o=!1,r=!1,a={setSize:function(e,t){Gc.camera.aspect=e/t}};Object.defineProperty(Je,"vrEnabled",{get:function(){return o},set:function(e){if(e=!!e,jc.cameraControls.controls.panorama.locked=e,jc.model.chunks.forEach((function(t){return t.visible=!(e&&(ru.xrType||Je.vrSplitScreen))})),ru.xrType)return e?ru.enterVR():ru.leaveVR();if(e&&Je.vrSplitScreen?(Gc.renderer=Gc.newRenderer,jc.cameraControls.cameras.panorama.staticFov=70):(Gc.renderer=Gc.oldRenderer,jc.cameraControls.cameras.panorama.staticFov=null),o=e,window.VRScreenNotFull||(e?Ce.requestFullscreen(document.body):Ce.exitFullscreen()),Zc.cursor||eu(.5,!0,1,16777215,0),"portrait"!=window.VRScreenType&&(Zc.cursor.visible=e,Gc.updateScreenSize({forceUpdateSize:!0}),jc.model.updateVrMarker(e,jc)),e)jc.viewLinkManager.hideAllViews(),Gc.resizeListeners.push(a),setTimeout((function(){if(console.log("orientEnable"+window.orientEnable),Je.vrEnabled&&!window.orientEnable&&Ce.detectIOS()){var e=Ce.iosVersion();if(12==e.major&&e.minor>=2)window.VRScreenNotFull||(Ce.detectSafari()?$alert({content:i18n.t("modules.base.vr_fail_safari_tips")}):$alert({content:i18n.t("modules.base.vr_fail_app_tips")}));else if(e.major>=13){var t=window.vrPermission&&("granted"!=window.vrPermission.deviceMotion||"granted"!=window.vrPermission.deviceOrientation);setTimeout((function(){Je.vrEnabled&&!window.orientEnable&&(Kc("reset"),window.DeviceMotionEvent&&window.DeviceMotionEvent.requestPermission&&"function"==typeof window.DeviceMotionEvent.requestPermission?(console.log("开始获取权限1"),window.DeviceMotionEvent.requestPermission().then((function(e){console.log("permissionState1: "+e),Kc("deviceMotion",e)})).catch((function(e){Kc("deviceMotion",!1),console.log(e)}))):(console.log("window.DeviceMotionEvent undefined"),Kc("deviceMotion",!1)),window.DeviceOrientationEvent&&window.DeviceOrientationEvent.requestPermission&&"function"==typeof window.DeviceOrientationEvent.requestPermission?(console.log("开始获取权限2"),window.DeviceOrientationEvent.requestPermission().then((function(e){console.log("permissionState2: "+e),Kc("deviceOrientation",e)})).catch((function(e){Kc("deviceOrientation",!1),console.log(e)}))):(console.log("window.DeviceOrientationEvent undefined"),Kc("deviceOrientation",!1)))}),t?0:150)}else console.log("陀螺仪似乎未能启用 ios "+e.major+"."+e.minor)}}),200);else{var t=jc.position,n=(new THREE.Quaternion).copy(jc.camera.quaternion),i=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t);i.x==t.x&&i.z==t.z?console.log("看向正地面时无法lookAt,无法更新camera转向,直接退出vr"):jc.cameraControls.activeControl.lookAt(i),jc.viewLinkManager.showAllViews(),Zc.shiftQuaternion=null;var r=Gc.resizeListeners.indexOf(a);Gc.resizeListeners.splice(r,1)}jc.emit("vrStateChanged")}}),Object.defineProperty(Je,"vrSplitScreen",{get:function(){return r},set:function(e){r!=(e=!!e)&&(r=e,Je.vrEnabled&&"portrait"!=window.VRScreenType&&(e?(Gc.renderer=Gc.newRenderer,jc.cameraControls.cameras.panorama.staticFov=70):(Gc.renderer=Gc.oldRenderer,jc.cameraControls.cameras.panorama.staticFov=null),jc.model.chunks.forEach((function(t){return t.visible=!e})),Gc.updateScreenSize({forceUpdateSize:!0}),jc.emit("vrStateChanged")))}}),90!=window.orientation&&270!=window.orientation||(Je.vrSplitScreen=!0),window.addEventListener("orientationchange",(function(e){0==window.orientation||180==window.orientation?Je.vrSplitScreen=!1:Je.vrSplitScreen=!0})),Wc=!0}}},{key:"isSupportXR",value:function(){return!!ru.xrType}}]),n}();window.VR=Zc=new $c;var eu=function(e,t,n,i,o){var r,a=new THREE.SpriteMaterial({opacity:n,color:i,transparent:t,map:ou($n.getImageURL("images/vrCursor.png")),side:THREE.DoubleSide});a.map.offset=new THREE.Vector2(1/17*o,0),a.map.repeat=new THREE.Vector2(1/17,1),a.depthTest=!1,a.blending=THREE.AdditiveBlending,(r=new THREE.Sprite(a)).scale.set(e,e,e),r.position.z=-5,r.visible=!1,r.name="cursor",r.renderOrder=Se,Gc.camera.add(r),Gc.scene.add(Gc.camera),Zc.cursor=r;var s=new tu(Gc.scene,r,Gc.camera);Zc.cursor.triggerTargetEvent=s.triggerTargetEvent.bind(s),Gc.updateListeners=[s].concat(Gc.updateListeners)};window.orientEnable=0;var tu=function(e,t,n){var i=this;this.cursor=t,this.raycaster=new THREE.Raycaster,this.targetEventObj={},this.type=1,this.canStartAnimation=!0;var o=this;this.target=n,this.euler=new THREE.Euler,this.q0=new THREE.Quaternion,this.q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this.zee=new THREE.Vector3(0,0,1),this.alpha=-1e3,this.beta=-1e3,this.gamma=-1e3,this.lastQua=new THREE.Quaternion,this.orient=THREE.MathUtils.degToRad(window.orientation||0),window.addEventListener("orientationchange",(function(){o.orient=THREE.MathUtils.degToRad(window.orientation||0)})),window.addEventListener("deviceorientation",(function(e){if(Je.vrEnabled||!window.orientEnable){window.orientEnable||(window.orientEnable=1);var t=THREE.MathUtils.degToRad(e.alpha),n=THREE.MathUtils.degToRad(e.beta),o=THREE.MathUtils.degToRad(e.gamma);i.isHuawei5X?(-1e3===i.alpha&&(i.alpha=t),-1e3===i.beta&&(i.beta=n),-1e3===i.gamma&&(i.gamma=o),Math.abs(t-i.alpha)>.06&&(i.alpha=t),Math.abs(n-i.beta)>.006&&(i.beta=n),Math.abs(o-i.gamma)>.006&&(i.gamma=o)):(i.alpha=t,i.beta=n,i.gamma=o)}})),this.setObjectQuaternion=function(e,t,n,i,r){if(-1e3!=t){var a=e.clone();o.euler.set(n,t,-i,"YXZ"),a.setFromEuler(o.euler),a.multiply(o.q1),a.multiply(o.q0.setFromAxisAngle(o.zee,-r));var s=this.lastQua.angleTo(a);if(!(s<1e-7)){if(qc&&Zc.shiftQuaternion){e.copy(this.lastQua);var l=he.linearClamp(s,qc.threshold.min,qc.threshold.max,qc.useRatio,.9);It.quaternion(e,a)(l)}else e.copy(a);if(this.lastQua.copy(e),null==Zc.shiftQuaternion){var c=new THREE.Vector3(0,0,-1).applyQuaternion(jc.camera.quaternion);c.setY(0).normalize();var u=(new THREE.Matrix4).lookAt(new THREE.Vector3,c,new THREE.Vector3(0,1,0)),h=(new THREE.Quaternion).setFromRotationMatrix(u),d=new THREE.Vector3(0,0,-1).applyQuaternion(e);d.setY(0).normalize();var p=(new THREE.Matrix4).lookAt(new THREE.Vector3,d,new THREE.Vector3(0,1,0)),f=(new THREE.Quaternion).setFromRotationMatrix(p).invert();Zc.shiftQuaternion=h.clone().premultiply(f)}e.premultiply(Zc.shiftQuaternion),function(e){if(!Je.vrSplitScreen){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);jc.camera.lookAt(jc.camera.position.clone().add(t));var n=new THREE.Vector3(1,0,0).applyQuaternion(e),i=new THREE.Vector3(1,0,0).applyQuaternion(jc.camera.quaternion);window.screenFaceOrient=THREE.MathUtils.radToDeg(n.angleTo(i)),n.clone().cross(i).dot(t)<0&&(window.screenFaceOrient*=-1)}}(e)}}},parent!==window&&window.addEventListener("message",(function(e){if(e.data&&!(e.data&&e.data.type&&e.data.type.indexOf("webpack")>-1)){var t="string"==typeof e.data?JSON.parse(e.data):e.data,n=-1!==window.navigator.userAgent.indexOf("KIW-TL00H");t&&t.alpha&&t.beta&&t.gamma&&function(e){var n=THREE.MathUtils.degToRad(t.alpha),i=THREE.MathUtils.degToRad(t.beta),r=THREE.MathUtils.degToRad(t.gamma);e?(-1e3===o.alpha&&(o.alpha=n),-1e3===o.beta&&(o.beta=i),-1e3===o.gamma&&(o.gamma=r),Math.abs(n-o.alpha)>.06&&(o.alpha=n),Math.abs(i-o.beta)>.006&&(o.beta=i),Math.abs(r-o.gamma)>.006&&(o.gamma=r)):(o.alpha=n,o.beta=i,o.gamma=r)}(n)}})),this.update=function(e){TWEEN.update(),window.ifTest&&Je.vrEnabled?this.triggerTargetEvent():Je.vrEnabled&&(this.setObjectQuaternion(jc.cameraControls.activeControl.camera.quaternion,this.alpha,this.beta,this.gamma,this.orient),this.triggerTargetEvent())},this.triggerTargetEvent=function(){var e=this.choseObj(),t=e?e.object:void 0;this.targetEventObj.currentObj=t,t!==this.targetEventObj.lastObj&&(t&&this.autoCursorPosition(e),1===this.type?(this.cursorAnimate&&this.cursorAnimate.stop(),t&&t.enabled&&this.startAnimate(function(){this.clickCallback(t)}.bind(this))):this.type,this.targetEventObj.lastObj=t)},this.choseObj=function(){this.raycaster.setFromCamera({x:0,y:0},n);var e=this.raycaster.intersectObjects(jc.model.vrMarkers.filter((function(e){return e.visible})));if(e.length>0)return e[0]},this.clickCallback=function(e){this.runTHREEAction(e,"onclick")},this.runTHREEAction=function(e,t){switch(t){case"onclick":e._listeners&&e._listeners.click&&e._listeners.click.forEach((function(e){e()}));break;case"onhover":e._listeners&&e._listeners.hover&&e._listeners.hover.forEach((function(e){e()}));break;case"onout":e._listeners&&e._listeners.out&&e._listeners.out.forEach((function(e){e()}))}},this.startAnimate=function(e){this.canStartAnimation&&this.initAnimation(e)},this.initAnimation=function(e){var t=this,n=this.cursor.material.map.offset;t.canStartAnimation=!1,this.cursorAnimate=new TWEEN.Tween(n).to({x:1},1e3).onStart((function(){t.canStartAnimation=!1})).onStop((function(){t.canStartAnimation=!0,this.x=0,n.x=0})).onUpdate((function(){})).onComplete((function(){e(),n.x=0,setTimeout((function(){t.canStartAnimation=!0}),1500)})),this.cursorAnimate.easing((function(e){return Math.floor(17*e)/17})),this.cursorAnimate.start()},this.autoCursorPosition=function(e){var t=Math.abs(e.distance-10);this.cursor.position.z=-t,t/=10,this.cursor.scale.set(t,t,t)}},nu=function(e,t,n){var i=new iu(n);window.VRCamera=i,i.bananaAspect=.8,this.width,this.height,this.name="vrRenderer";var o=this;this.setSize=function(t,n){e.setSize.call(this,t,n),o.width=t,o.height=n},this.render=function(t,n,o,r){var a,s;if(n.__RESS__SKIP__STEREO__){var l=e.autoClear;return e.autoClear=!1,e.setRenderTarget(o),r&&e.clear(),e.render(t,n),e.setRenderTarget(null),void(e.autoClear=l)}if("PerspectiveCamera"===n.type)a=i.cameraL,s=i.cameraR,t.updateMatrixWorld(),null===n.parent&&n.updateMatrixWorld(),i.vrCameraUpdate(n);else{if("OrthographicCamera"!==n.type)return DEBUG&&console.error("Unsupported renderer: ",n.type);a=s=n}e.setScissorTest(!0),e.setScissor(0,0,this.width/2,this.height),e.setViewport(0,0,this.width/2,this.height),e.render.call(this,t,a,o,r),e.setScissor(this.width/2,0,this.width/2,this.height),e.setViewport(this.width/2,0,this.width/2,this.height),e.render.call(this,t,s,o,r),e.setScissorTest(!1)},this.__proto__={__proto__:e}},iu=function(e){this.type="StereoCamera",this._aspect=1,this._overlap=.064,this.cameraL=new THREE.PerspectiveCamera,this.cameraL.layers.enable(0),this.cameraL.near=.01,this.cameraL.matrixAutoUpdate=!1,this.cameraR=new THREE.PerspectiveCamera,this.cameraR.layers.enable(0),this.cameraR.near=.01,this.cameraR.matrixAutoUpdate=!1,this.eyeRight=new THREE.Matrix4,this.eyeLeft=new THREE.Matrix4,this.vrCameraNeedsUpdate=!0,Object.defineProperty(this,"bananaAspect",{get:function(){return this._aspect},set:function(e){this._aspect!==e&&(this.vrCameraNeedsUpdate=!0),this._aspect=e}}),Object.defineProperty(this,"overlap",{get:function(){return this._overlap},set:function(e){this._overlap!==e&&(this.vrCameraNeedsUpdate=!0),this._overlap=e}}),this.vrCameraUpdate=function(e){if(this.vrCameraNeedsUpdate=this.vrCameraNeedsUpdate||this.bananaFov!==e.fov||this.bananaReal_aspect!==e.aspect*this.bananaAspect||this.bananaNear!==e.near||this.bananaFar!==e.far,this.vrCameraNeedsUpdate){this.vrCameraNeedsUpdate=!1,this.bananaFocus=e.focus,this.bananaFov=50,this.bananaReal_aspect=e.aspect*this.bananaAspect,this.bananaNear=e.near,this.bananaFar=e.far,this.bananaFocus=10;var t,n,i=e.projectionMatrix.clone(),o=this.overlap/2,r=o*this.bananaNear/this.bananaFocus,a=this.bananaNear*Math.tan(Math.PI/180*this.bananaFov*.5);this.eyeLeft.elements[12]=-o,this.eyeRight.elements[12]=o,t=-a*this.bananaReal_aspect+r,n=a*this.bananaReal_aspect+r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(i),t=-a*this.bananaReal_aspect-r,n=a*this.bananaReal_aspect-r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(this.eyeLeft),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(this.eyeRight)}},ou=function(e){var t=new THREE.TextureLoader;return t.crossOrigin="anonymous",t.load(e)},ru={init(e){var t=this;this.renderer=e,e.xr.enabled=!0;var n=this.renderer.xr,i=n.getCamera(),o=function(){Zc.cursor.parent.remove(Zc.cursor),i.add(Zc.cursor),Gc.scene.add(i),t.initHandler(),jc.on("update",(function(e){t.entered&&(e.hasChanged.cameraChanged2||e.hasChanged.vrHandlerMoved)&&(t.setHandlerLength(jc.intersect),jc.reticule.move(null,null,!1))}))};if("xr"in navigator&&"isSessionSupported"in navigator.xr){navigator.xr.isSessionSupported("immersive-vr").then((function(e){e?(t.xrType="xr",o()):t.xrNotFound("isSessionSupported not supported")})).catch(this.xrNotFound.bind(this,"isSessionSupported error"))}else if("getVRDisplays"in navigator){console.log("\n getVRDisplays!!!!!!!!!\n \n \n ");var r=function(e){t.xrType="vr",t.device=e,t.renderer.xr.setDevice(e),o()};window.addEventListener("vrdisplayconnect",(function(e){r(e.display)}),!1),window.addEventListener("vrdisplaydisconnect",(function(){console.log("vrdisplaydisconnect")}),!1),window.addEventListener("vrdisplaypresentchange",(function(e){console.log("vrdisplaypresentchange",e.display.isPresenting?"EXIT VR":"ENTER VR"),t.callback(!!e.display.isPresenting)}),!1),window.addEventListener("vrdisplayactivate",(function(e){e.display.requestPresent([{source:this.renderer.domElement}])}),!1),navigator.getVRDisplays().then((function(e){e.length>0?r(e[0]):this.xrNotFound("no displays")})).catch(this.xrNotFound.bind(this,"getVRDisplays error"))}else this.xrNotFound("xr not supported");var a=n.updateCamera,s=this;n.updateCamera=function(e){a(e),s.getShiftPosMat(i.position),s.getTranCamMatrix(i.position,i.quaternion),i.cameras[0].matrix.premultiply(s.tranCamMatrix),i.cameras[1].matrix.premultiply(s.tranCamMatrix),i.cameras.concat([i]).forEach((function(e){e.layers.mask=jc.camera.layers.mask})),a(e),e.quaternion.copy(i.quaternion),jc.quaternion.copy(i.quaternion)},jc.on("update",(function(e){t.entered&&e.hasChanged.moved&&t.devicePos&&(t.getShiftPosMat(t.devicePos),t.getTranCamMatrix())}))},enterVR(){var e=this;if(this.xrType)if(console.log("enterVR",this.xrType),Ce.exitFullscreen(),"vr"==this.xrType)this.device.isPresenting?this.device.exitPresent():this.device.requestPresent([{source:renderer.domElement}]);else if("xr"==this.xrType)if(null==this.currentSession){console.log("this.currentSession == void 0 ");var t=function t(){console.log("onSessionEnded"),e.currentSession.removeEventListener("end",t),setTimeout((function(){e.renderer.xr.setSession(null),e.currentSession=null,e.callback(!1)}),1)},n=function(){console.log("onReset")},i="immersive-vr",o=function(e,t){var n=(t||{}).referenceSpaceType||"local-floor",i=t&&t.sessionInit||{};if("viewer"==n)return i;if("local"==n&&e.startsWith("immersive"))return i;if(i.optionalFeatures&&i.optionalFeatures.includes(n))return i;if(i.requiredFeatures&&i.requiredFeatures.includes(n))return i;var o=Object.assign({},i);return o.requiredFeatures=[n],i.requiredFeatures&&(o.requiredFeatures=o.requiredFeatures.concat(i.requiredFeatures)),o}(i);navigator.xr.requestSession(i,o).then((function(i){console.log("onSessionStarted"),i.addEventListener("end",t),i.addEventListener("reset",n),e.renderer.xr.setSession(i),e.currentSession=i,e.callback(!0)}))}else console.log("this.currentSession.end()",this.currentSession),this.currentSession.end()},leaveVR(){"xr"==this.xrType?this.currentSession&&this.currentSession.end():this.xrType},switchRender(e){e?(console.log("switchRender",e),this.renderer.setAnimationLoop((function(){Gc.updateComponents(),Gc.render()})),Gc.started=!1):(this.renderer.setAnimationLoop(null),Gc.started=!0,Gc.animate())},callback(e){(e=!!e)||(Je.vrEnabled=!1,this.tranCamMatrix=this.shiftQuaMat=this.shiftPosMat=null),this.switchRender(e),this.handler.visible=e,this.entered=e,Zc.dispatchEvent({type:"webxrEntered",isEnter:e})},xrNotFound(e){console.log("xrNotFound:",e)},getShiftQuaMat(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(jc.quaternion);t.setY(0).normalize();var n=(new THREE.Matrix4).lookAt(new THREE.Vector3,t,new THREE.Vector3(0,1,0)),i=new THREE.Vector3(0,0,-1).applyQuaternion(e);i.setY(0).normalize();var o=(new THREE.Matrix4).lookAt(new THREE.Vector3,i,new THREE.Vector3(0,1,0));this.shiftQuaMat=n.clone().premultiply(o.clone().invert())},getShiftPosMat(e){this.shiftPosMat1=(new THREE.Matrix4).setPosition(e.clone().negate()),this.shiftPosMat2=(new THREE.Matrix4).setPosition(jc.position.clone()),this.devicePos=e.clone()},getTranCamMatrix(e,t,n){this.shiftQuaMat||this.getShiftQuaMat(t),this.shiftPosMat1||this.getShiftPosMat(e),this.tranCamMatrix=(new THREE.Matrix4).multiplyMatrices(this.shiftQuaMat,this.shiftPosMat1),this.tranCamMatrix=(new THREE.Matrix4).multiplyMatrices(this.shiftPosMat2,this.tranCamMatrix)},initHandler(){var e=this,t=THREE.MathUtils.degToRad(5),n=this.renderer.xr.getController(0),i=this.renderer.xr.getController(1);n.name="controller0-right",i.name="controller1-left";var o=new THREE.MeshBasicMaterial({color:"#ffffff",opacity:.5,transparent:!0,depthTest:!1,depthWrite:!1}),r=new THREE.Mesh(new THREE.BoxBufferGeometry(.01,.01,1),o),a=(new THREE.Matrix4).makeTranslation(0,0,-.5);r.geometry.applyMatrix4(a);var s=new THREE.Mesh(new THREE.SphereBufferGeometry(.03,6,5),o);s.position.set(0,0,-1);var l=new THREE.Object3D;l.add(r),l.add(s),l.matrixAutoUpdate=!1,l.name="handler",l.visible=!1,Gc.scene.add(l),this.handler=l,this.handler.lastMatrix=this.handler.matrix.clone();var c=n,u=function(n){var i,o;n.addEventListener("selectstart",(function(e){c!=n&&(c=n,console.log("切换control",n.name)),i=n.quaternion.clone(),o=Date.now()})),n.addEventListener("selectend",(function(e){var r=n.quaternion.clone();if(Date.now()-o<1e3&&r.angleTo(i)<t&&jc.intersect)return jc.flyToPanoClosestToMouse()})),n.addEventListener("connected",(function(e){console.log("connected",n.name)})),n.addEventListener("disconnected",(function(e){console.log("disconnected",n.name)}));var r=function(){c==n&&(e.handler.lastMatrix=e.handler.matrix.clone(),e.tranCamMatrix||new THREE.Matrix4,e.tranCamMatrix&&e.handler.matrix.copy(n.matrix).premultiply(e.tranCamMatrix),e.handler.matrix.decompose(e.handler.position,e.handler.quaternion,new THREE.Vector3))};n.addEventListener("move",r),r()};u(n),u(i)},handlerMoved(){return!this.handler.lastMatrix.equals(this.handler.matrix)},setRayCaster(e){e.set(this.handler.position,this.getHandlerDir())},getHandlerDir(){return new THREE.Vector3(0,0,-1).applyQuaternion(this.handler.quaternion)},setHandlerLength(e){e&&(this.handler.children[0].scale.z=e.distance,this.handler.children[1].position.set(0,0,-e.distance))}};Zc.webxr=ru;var au=Zc;function su(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function lu(e){var t,n,i,o,r,a=Math.floor,s=new Array(64),l=new Array(64),c=new Array(64),u=new Array(64),h=new Array(65535),d=new Array(65535),p=new Array(64),f=new Array(64),m=[],v=0,g=7,A=new Array(64),y=new Array(64),E=new Array(64),w=new Array(256),b=new Array(2048),C=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],x=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],I=[0,1,2,3,4,5,6,7,8,9,10,11],T=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],B=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],k=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],M=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function S(e,t){for(var n=0,i=0,o=new Array,r=1;r<=16;r++){for(var a=1;a<=e[r];a++)o[t[i]]=[],o[t[i]][0]=n,o[t[i]][1]=r,i++,n++;n*=2}return o}function D(e){for(var t=e[0],n=e[1]-1;n>=0;)t&1<<n&&(v|=1<<g),n--,--g<0&&(255==v?(F(255),F(0)):F(v),g=7,v=0)}function F(e){m.push(e),m.length}function L(e){F(e>>8&255),F(255&e)}function H(e,t,n,i,o){for(var r,a=o[0],s=o[240],l=function(e,t){var n,i,o,r,a,s,l,c,u,h,d=0;for(u=0;u<8;++u){n=e[d],i=e[d+1],o=e[d+2],r=e[d+3],a=e[d+4],s=e[d+5],l=e[d+6];var f=n+(c=e[d+7]),m=n-c,v=i+l,g=i-l,A=o+s,y=o-s,E=r+a,w=r-a,b=f+E,C=f-E,x=v+A,I=v-A;e[d]=b+x,e[d+4]=b-x;var T=.707106781*(I+C);e[d+2]=C+T,e[d+6]=C-T;var B=.382683433*((b=w+y)-(I=g+m)),k=.5411961*b+B,P=1.306562965*I+B,R=.707106781*(x=y+g),M=m+R,S=m-R;e[d+5]=S+k,e[d+3]=S-k,e[d+1]=M+P,e[d+7]=M-P,d+=8}for(d=0,u=0;u<8;++u){n=e[d],i=e[d+8],o=e[d+16],r=e[d+24],a=e[d+32],s=e[d+40],l=e[d+48];var D=n+(c=e[d+56]),F=n-c,L=i+l,H=i-l,Q=o+s,O=o-s,V=r+a,_=r-a,U=D+V,N=D-V,z=L+Q,G=L-Q;e[d]=U+z,e[d+32]=U-z;var j=.707106781*(G+N);e[d+16]=N+j,e[d+48]=N-j;var W=.382683433*((U=_+O)-(G=H+F)),q=.5411961*U+W,J=1.306562965*G+W,Y=.707106781*(z=O+H),Z=F+Y,X=F-Y;e[d+40]=X+q,e[d+24]=X-q,e[d+8]=Z+J,e[d+56]=Z-J,d++}for(u=0;u<64;++u)h=e[u]*t[u],p[u]=h>0?h+.5|0:h-.5|0;return p}(e,t),c=0;c<64;++c)f[C[c]]=l[c];var u=f[0]-n;n=f[0],0==u?D(i[0]):(D(i[d[r=32767+u]]),D(h[r]));for(var m=63;m>0&&0==f[m];m--);if(0==m)return D(a),n;for(var v,g=1;g<=m;){for(var A=g;0==f[g]&&g<=m;++g);var y=g-A;if(y>=16){v=y>>4;for(var E=1;E<=v;++E)D(s);y&=15}r=32767+f[g],D(o[(y<<4)+d[r]]),D(h[r]),g++}return 63!=m&&D(a),n}function Q(e){if(e<=0&&(e=1),e>100&&(e=100),r!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var i=a((t[n]*e+50)/100);i<1?i=1:i>255&&(i=255),s[C[n]]=i}for(var o=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],r=0;r<64;r++){var h=a((o[r]*e+50)/100);h<1?h=1:h>255&&(h=255),l[C[r]]=h}for(var d=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,f=0;f<8;f++)for(var m=0;m<8;m++)c[p]=1/(s[C[p]]*d[f]*d[m]*8),u[p]=1/(l[C[p]]*d[f]*d[m]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),r=e}}this.encode=function(e,r){(new Date).getTime(),r&&Q(r),m=[],v=0,g=7,L(65496),L(65504),L(16),F(74),F(70),F(73),F(70),F(0),F(1),F(1),F(0),L(1),L(1),F(0),F(0),function(){L(65499),L(132),F(0);for(var e=0;e<64;e++)F(s[e]);F(1);for(var t=0;t<64;t++)F(l[t])}(),function(e,t){L(65472),L(17),F(8),L(t),L(e),F(3),F(1),F(17),F(0),F(2),F(17),F(1),F(3),F(17),F(1)}(e.width,e.height),function(){L(65476),L(418),F(0);for(var e=0;e<16;e++)F(x[e+1]);for(var t=0;t<=11;t++)F(I[t]);F(16);for(var n=0;n<16;n++)F(T[n+1]);for(var i=0;i<=161;i++)F(B[i]);F(1);for(var o=0;o<16;o++)F(k[o+1]);for(var r=0;r<=11;r++)F(P[r]);F(17);for(var a=0;a<16;a++)F(R[a+1]);for(var s=0;s<=161;s++)F(M[s])}(),L(65498),L(12),F(3),F(1),F(0),F(2),F(17),F(3),F(17),F(0),F(63),F(0);var a=0,h=0,d=0;v=0,g=7,this.encode.displayName="_encode_";for(var p,f,w,C,S,O,V,_,U,N=e.data,z=e.width,G=e.height,j=4*z,W=0;W<G;){for(p=0;p<j;){for(O=S=j*W+p,V=-1,_=0,U=0;U<64;U++)O=S+(_=U>>3)*j+(V=4*(7&U)),W+_>=G&&(O-=j*(W+1+_-G)),p+V>=j&&(O-=p+V-j+4),f=N[O++],w=N[O++],C=N[O++],A[U]=(b[f]+b[w+256>>0]+b[C+512>>0]>>16)-128,y[U]=(b[f+768>>0]+b[w+1024>>0]+b[C+1280>>0]>>16)-128,E[U]=(b[f+1280>>0]+b[w+1536>>0]+b[C+1792>>0]>>16)-128;a=H(A,c,a,t,i),h=H(y,u,h,n,o),d=H(E,u,d,n,o),p+=32}W+=8}if(g>=0){var q=[];q[1]=g+1,q[0]=(1<<g+1)-1,D(q)}return L(65497),"undefined"==typeof module?new Uint8Array(m):Buffer.from(m)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)w[t]=e(t)}(),t=S(x,I),n=S(k,P),i=S(T,B),o=S(R,M),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var i=e;i<t;i++)d[32767+i]=n,h[32767+i]=[],h[32767+i][1]=n,h[32767+i][0]=i;for(var o=-(t-1);o<=-e;o++)d[32767+o]=n,h[32767+o]=[],h[32767+o][1]=n,h[32767+o][0]=t-1+o;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)b[e]=19595*e,b[e+256>>0]=38470*e,b[e+512>>0]=7471*e+32768,b[e+768>>0]=-11059*e,b[e+1024>>0]=-21709*e,b[e+1280>>0]=32768*e+8421375,b[e+1536>>0]=-27439*e,b[e+1792>>0]=-5329*e}(),Q(e),(new Date).getTime()}new THREE.RawShaderMaterial({fragmentShader:sn.skysphere.fragmentShader,vertexShader:sn.skysphere.vertexShader,uniforms:THREE.UniformsUtils.clone(sn.skysphere.uniforms),side:THREE.BackSide,name:"skysphereBG"}),window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame,Xe("SceneRenderer",(function(){return function(e){f(n,EventEmitter);var t=su(n);function n(){var e,i,r,a;return o(this,n),(e=t.call(this)).createScene=function(e){this.camera=new THREE.PerspectiveCamera,this.camera.layers.enable(kt),this.camera.layers.enable(Pt),this.scene=new THREE.Scene,this.light=new THREE.AmbientLight(16777215),this.scene.add(this.light);var t=new THREE.DirectionalLight(16777215,1);t.position.set(1,10,1).normalize(),this.scene.add(t)},e.addComponent=function(e,t){this.components.push(e),e.update&&(t?this.updateLisAfter.push(e):this.updateListeners.push(e)),e.setSize&&(this.resizeListeners.push(e),this.forceUpdateSize=!0)},e.removeComponent=function(e){var t=function(t){return t!==e};this.components=this.components.filter(t),this.updateListeners=this.updateListeners.filter(t),this.resizeListeners=this.resizeListeners.filter(t)},e.start=function(e){if(this.started)throw new Nc("Can't start SceneRenderer, already started");if(this.createContext(e),this.initComposer(),this.started=!0,this.$app.config.mobile)try{au.Init(this,this.$app.core.get("Player"))}catch(e){console.error(e)}(this.animate=this.animate.bind(this))()},e.createContext=function(e){try{this.renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setClearColor("#292929",0),this.emit(ra)}catch(e){throw new Jc("Unable to create a WebGL rendering context")}e.appendChild(this.renderer.domElement)},e.initComposer=function(){this.composer=new THREE.EffectComposer(this.renderer),this.composer.addPass(new THREE.RenderPass(this.scene,this.camera)),this.composer.addPass(this.effects.hblurPass),this.composer.addPass(this.effects.vblurPass)},e.setSize=function(e,t){this.renderWidth=e,this.renderHeight=t,this.effects.aspect=e/t,this.renderer.setSize(e,t),this.composer.setSize(e,t);for(var n=0;n<this.resizeListeners.length;n++)this.resizeListeners[n].setSize(e,t);this.emit("resize",e,t)},e.render=function(){this.emit("render",this.updateClock2.getDelta()),this.update3dTiles(),this.effects.currentBlur>0?this.composer.render():this.renderer.render(this.scene,this.camera)},e.updateScreenSize=function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=!1;o.forceUpdateSize&&(this.forceUpdateSize=!0),o.resize||null==o.width||null==o.height?(t=this.renderer.domElement.parentElement.clientWidth,n=this.renderer.domElement.parentElement.clientHeight,o.resize&&(i=this.renderWidth,r=this.renderHeight),(t!==i||n!==r||this.forceUpdateSize||a!=window.devicePixelRatio)&&(i=t,r=n,s=!0,a=window.devicePixelRatio,e=window.devicePixelRatio)):(t=o.width,n=o.height,s=!0,e=1),s&&(this.setSize(t,n,e),this.forceUpdateSize=!1)},e.updateComponents=function(){for(var e=Math.min(1,this.updateClock.getDelta()),t=0;t<this.updateListeners.length;t++)this.updateListeners[t].update(e)},e.updateAfterRender=function(){Ae.timeMeasuring.addTimeMark("afterRender","start");for(var e=0;e<this.updateLisAfter.length;e++)this.updateLisAfter[e].update();Ae.timeMeasuring.addTimeMark("afterRender","end")},e.suspend=function(){this.started=!1,this.suspendedObjects=this.scene.children.map(function(e){return this.scene.remove(e),e}.bind(this)),this.render()},e.resume=function(){this.suspendedObjects.forEach(function(e){this.scene.add(e)}.bind(this)),this.suspendedObjects=[],this.started=!0,this.animate()},e.animate=function(){this.started&&(performance.mark("loop-start"),window.requestAnimationFrame(this.animate),this.updateScreenSize(),this.updateComponents(),this.render(),this.updateAfterRender(),this.emit(aa),Ae.timeMeasuring.addTimeMark("loop","end"),Ae.timeMeasuring.report(performance.now()))},e.getImageData=function(){var e=document.createElement("canvas"),t=e.getContext("2d");return function(n,i,o){return e.width===i&&e.height===o||(e.width=i,e.height=o),t.drawImage(n,0,0,i,o),t.getImageData(0,0,i,o)}}(),e.initSizedTexture2D=function(e,t,n){var i=this.renderer,o=i.getContext(),r=i.state,a=new THREE.Texture;a.flipY=!1,a.wrapS=t,a.wrapT=t,!0!==n&&(n=!1),a.generateMipmaps=n;var s=i.paramThreeToGL(a.format),l=i.paramThreeToGL(a.type),c=i.properties.get(a),u=o.createTexture();r.bindTexture(o.TEXTURE_2D,u),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,a.flipY),o.texImage2D(o.TEXTURE_2D,0,s,e,e,0,s,l,null);var h=i.paramThreeToGL(t);return o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,h),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,h),n?(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearMipMapLinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_NEAREST),o.generateMipmap(o.TEXTURE_2D)):(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR)),r.bindTexture(o.TEXTURE_2D,null),c.__webglTexture=u,a},e.deallocateCubeTexture=function(e){var t=this.renderer;t.getContext(),t.properties.get(e),e.dispose()},e.renderToCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null;return function(a,s,l,c,u,h,d,p,f,m,v,g,A,y,E,w){var b=this.oldRenderer||this.renderer;e||(t=new THREE.Scene,r=new THREE.CubeCamera(.1,1e3,s),t.add(r),n=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"scene",value:null},alpha:{type:"startYinTile",value:1}},vertexShader:sn.basicTextured.vertexShader,fragmentShader:sn.basicTextured.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),i=new THREE.PlaneGeometry(1,1),o=new THREE.Mesh(i,n),t.add(o),e=!0),r.renderTarget=s;var C=i.getAttribute("uv");C.setUsage(THREE.DynamicDrawUsage),C.needsUpdate=!0;var x=C.array,I=u/l,T=h/c,B=d/l,k=p/c;x[0]=I,x[1]=T+k,x[2]=I+B,x[3]=T+k,x[4]=I,x[5]=T,x[6]=I+B,x[7]=T;var P=i.getAttribute("position");P.setUsage(THREE.DynamicDrawUsage),P.needsUpdate=!0;var R=P.array,M=f/s.width-.5,S=m/s.height-.5,D=v/s.width,F=g/s.height;R[0]=M,R[1]=S+F,R[3]=M+D,R[4]=S+F,R[6]=M,R[7]=S,R[9]=M+D,R[10]=S,b.properties.get(t),n.uniforms.tDiffuse.value=a,n.blending=y||THREE.NoBlending,n.transparent=!!E,null!=w||(w=1),n.uniforms.alpha.value=w,n.needUpdate=!0,0==A&&(o.scale.set(-1,-1,1),o.position.set(.5,0,0)),1==A&&(o.scale.set(-1,-1,1),o.position.set(-.5,0,0)),2==A&&(o.scale.set(1,1,1),o.position.set(0,.5,0)),3==A&&(o.scale.set(1,1,1),o.position.set(0,-.5,0)),4==A&&(o.scale.set(-1,-1,1),o.position.set(0,0,.5)),5==A&&(o.scale.set(-1,-1,1),o.position.set(0,0,-.5)),o.lookAt(r.position),s.viewport.set(0,0,s.width,s.height);var L=b.autoClear;b.autoClear=!1,r.update(b,t),b.autoClear=L}}(),e.copyCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null,a=new THREE.Euler;return function(s,l,c,u,h,d,p,f,m){if(!e){t=new THREE.Scene,n=new THREE.CubeCamera(.1,1e3,l),t.add(n),i=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:sn.copyCubeMap.vertexShader,fragmentShader:sn.copyCubeMap.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),o=new THREE.BoxGeometry(2,2,2),(r=new THREE.Mesh(o,i)).scale.set(-1,-1,1),t.add(r),e=!0}var v=this.oldRenderer||this.renderer;n.renderTarget=l;for(var g=0;g<6;g++){this.getCubeOrientationForCubeFace(g,a),r.rotation.copy(a),r.matrixWorldNeedsUpdate=!0,r.updateMatrixWorld(),i.uniforms.tDiffuse.value=s,i.blending=p||THREE.NoBlending,i.transparent=!!f,null!=m||(m=1),i.uniforms.alpha.value=m,i.needUpdate=!0,l.viewport.set(0,0,h,d);var A=v.autoClear;v.autoClear=!1,n.update(v,t),v.autoClear=A}}}(),e.getCubeOrientationForCubeFace=function(e,t){switch(e){case Ui:t.set(0,-Math.PI/2,0);break;case Ni:t.set(0,Math.PI/2,0);break;case zi:t.set(Math.PI/2,Math.PI,0);break;case Gi:t.set(-Math.PI/2,Math.PI,0);break;case ji:t.set(0,-Math.PI,0);break;case Wi:t.set(0,0,0)}},e.scene=null,e.camera=null,e.light=null,e.renderer=null,e.effects=Uc,e.animateCallback=null,e.composer=null,e.qualityManager=null,e.updateClock=new THREE.Clock,e.updateClock2=new THREE.Clock,e.components=[],e.updateListeners=[],e.resizeListeners=[],e.updateLisAfter=[],e.forceUpdateSize=!1,e.started=!1,e.textures={},e.suspendedObjects=[],e.vrMode=!1,e.autoUpdate3dTiles=!1,Ae.timeMeasuring.reportTimings=!1,Ae.timeMeasuring.registerCollect("loop",{minCount:120,median:3,refreshTime:5e3}),e}return u(n,[{key:"update3dTiles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.$app.core.get("Player"),n=t.model._3dTilesRuntime;if(n){var i=this.updateClock2.getDelta();t.mode!==ht.PANORAMA&&n.getTileset().tiles.forEach((function(e){var o=n.getRenderMap()[e.id];o&&"remove"!==o.modified&&(i=9999,e.isVisibleAndInRequestVolume||t.mode===ht.TRANSITIONING?t.model.floors.get(e.floorIndex).add(o):(o.removeFromParent(),o.traverse((function(e){e.isChunk&&e.geometry&&(e.geometry.dispose(),e.material.dispose(),e.material.uniforms.map&&e.material.uniforms.map.value.dispose())}))))})),(this.autoUpdate3dTiles||e.force)&&(n.update(i,this.renderer,this.camera,e.force),n.stats&&n.stats.update())}}},{key:"uploadTexture2D",value:function(e,t,n,i,o,r){var a=this.renderer,s=a.getContext(),l=a.state,c=a.properties.get(t);l.bindTexture(s.TEXTURE_2D,c.__webglTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,t.unpackAlignment),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,a.paramThreeToGL(t.wrapS)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,a.paramThreeToGL(t.wrapT)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,a.paramThreeToGL(t.magFilter)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,a.paramThreeToGL(t.minFilter)),s.texSubImage2D(s.TEXTURE_2D,0,n,i,s.RGBA,s.UNSIGNED_BYTE,e),t.generateMipmaps&&s.generateMipmap(s.TEXTURE_2D),l.bindTexture(s.TEXTURE_2D,null)}}]),n}()}));var cu=function(){var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,n=799,i=3406,o=2276,r=1567,a=3784,s=5793,l=2896;function c(){}function u(e,t){for(var n,i,o=0,r=[],a=16;a>0&&!e[a-1];)a--;r.push({children:[],index:0});var s,l=r[0];for(n=0;n<a;n++){for(i=0;i<e[n];i++){for((l=r.pop()).children[l.index]=t[o];l.index>0;){if(0===r.length)throw new Error("Could not recreate Huffman Table");l=r.pop()}for(l.index++,r.push(l);r.length<=n;)r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;o++}n+1<a&&(r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s)}return r[0].children}function h(t,n,i,o,r,a,s,l,c){i.precision,i.samplesPerLine,i.scanLines;var u=i.mcusPerLine,h=i.progressive;i.maxH,i.maxV;var d=n,p=0,f=0;function m(){if(f>0)return f--,p>>f&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw new Error("unexpected marker: "+(p<<8|e).toString(16))}return f=7,p>>>7}function v(e){for(var t,n=e;null!==(t=m());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw new Error("invalid huffman sequence")}return null}function g(e){for(var t=0;e>0;){var n=m();if(null===n)return;t=t<<1|n,e--}return t}function A(e){var t=g(e);return t>=1<<e-1?t:t+(-1<<e)+1}var y=0;var E,w=0;function b(e,t,n,i,o){var r=n%u,a=(n/u|0)*e.v+i,s=r*e.h+o;t(e,e.blocks[a][s])}function C(e,t,n){var i=n/e.blocksPerLine|0,o=n%e.blocksPerLine;t(e,e.blocks[i][o])}var x,I,T,B,k,P,R=o.length;P=h?0===a?0===l?function(e,t){var n=v(e.huffmanTableDC),i=0===n?0:A(n)<<c;t[0]=e.pred+=i}:function(e,t){t[0]|=m()<<c}:0===l?function(t,n){if(y>0)y--;else for(var i=a,o=s;i<=o;){var r=v(t.huffmanTableAC),l=15&r,u=r>>4;if(0!==l)n[e[i+=u]]=A(l)*(1<<c),i++;else{if(u<15){y=g(u)+(1<<u)-1;break}i+=16}}}:function(t,n){for(var i=a,o=s,r=0;i<=o;){var l=e[i],u=n[l]<0?-1:1;switch(w){case 0:var h=v(t.huffmanTableAC),d=15&h;if(r=h>>4,0===d)r<15?(y=g(r)+(1<<r),w=4):(r=16,w=1);else{if(1!==d)throw new Error("invalid ACn encoding");E=A(d),w=r?2:3}continue;case 1:case 2:n[l]?n[l]+=(m()<<c)*u:0==--r&&(w=2==w?3:0);break;case 3:n[l]?n[l]+=(m()<<c)*u:(n[l]=E<<c,w=0);break;case 4:n[l]&&(n[l]+=(m()<<c)*u)}i++}4===w&&0==--y&&(w=0)}:function(t,n){var i=v(t.huffmanTableDC),o=0===i?0:A(i);n[0]=t.pred+=o;for(var r=1;r<64;){var a=v(t.huffmanTableAC),s=15&a,l=a>>4;if(0!==s)n[e[r+=l]]=A(s),r++;else{if(l<15)break;r+=16}}};var M,S,D,F,L=0;for(S=1==R?o[0].blocksPerLine*o[0].blocksPerColumn:u*i.mcusPerColumn,r||(r=S);L<S;){for(I=0;I<R;I++)o[I].pred=0;if(y=0,1==R)for(x=o[0],k=0;k<r;k++)C(x,P,L),L++;else for(k=0;k<r;k++){for(I=0;I<R;I++)for(D=(x=o[I]).h,F=x.v,T=0;T<F;T++)for(B=0;B<D;B++)b(x,P,L,T,B);if(++L===S)break}if(f=0,(M=t[n]<<8|t[n+1])<65280)throw new Error("marker was not found");if(!(M>=65488&&M<=65495))break;n+=2}return n-d}function d(e,c){var u,h,d=[],p=c.blocksPerLine,f=c.blocksPerColumn,m=p<<3,v=new Int32Array(64),g=new Uint8Array(64);function A(e,u,h){var d,p,f,m,v,g,A,y,E,w,b=c.quantizationTable,C=h;for(w=0;w<64;w++)C[w]=e[w]*b[w];for(w=0;w<8;++w){var x=8*w;0!=C[1+x]||0!=C[2+x]||0!=C[3+x]||0!=C[4+x]||0!=C[5+x]||0!=C[6+x]||0!=C[7+x]?(d=s*C[0+x]+128>>8,p=s*C[4+x]+128>>8,f=C[2+x],m=C[6+x],v=l*(C[1+x]-C[7+x])+128>>8,y=l*(C[1+x]+C[7+x])+128>>8,g=C[3+x]<<4,A=C[5+x]<<4,E=d-p+1>>1,d=d+p+1>>1,p=E,E=f*a+m*r+128>>8,f=f*r-m*a+128>>8,m=E,E=v-A+1>>1,v=v+A+1>>1,A=E,E=y+g+1>>1,g=y-g+1>>1,y=E,E=d-m+1>>1,d=d+m+1>>1,m=E,E=p-f+1>>1,p=p+f+1>>1,f=E,E=v*o+y*i+2048>>12,v=v*i-y*o+2048>>12,y=E,E=g*n+A*t+2048>>12,g=g*t-A*n+2048>>12,A=E,C[0+x]=d+y,C[7+x]=d-y,C[1+x]=p+A,C[6+x]=p-A,C[2+x]=f+g,C[5+x]=f-g,C[3+x]=m+v,C[4+x]=m-v):(E=s*C[0+x]+512>>10,C[0+x]=E,C[1+x]=E,C[2+x]=E,C[3+x]=E,C[4+x]=E,C[5+x]=E,C[6+x]=E,C[7+x]=E)}for(w=0;w<8;++w){var I=w;0!=C[8+I]||0!=C[16+I]||0!=C[24+I]||0!=C[32+I]||0!=C[40+I]||0!=C[48+I]||0!=C[56+I]?(d=s*C[0+I]+2048>>12,p=s*C[32+I]+2048>>12,f=C[16+I],m=C[48+I],v=l*(C[8+I]-C[56+I])+2048>>12,y=l*(C[8+I]+C[56+I])+2048>>12,g=C[24+I],A=C[40+I],E=d-p+1>>1,d=d+p+1>>1,p=E,E=f*a+m*r+2048>>12,f=f*r-m*a+2048>>12,m=E,E=v-A+1>>1,v=v+A+1>>1,A=E,E=y+g+1>>1,g=y-g+1>>1,y=E,E=d-m+1>>1,d=d+m+1>>1,m=E,E=p-f+1>>1,p=p+f+1>>1,f=E,E=v*o+y*i+2048>>12,v=v*i-y*o+2048>>12,y=E,E=g*n+A*t+2048>>12,g=g*t-A*n+2048>>12,A=E,C[0+I]=d+y,C[56+I]=d-y,C[8+I]=p+A,C[48+I]=p-A,C[16+I]=f+g,C[40+I]=f-g,C[24+I]=m+v,C[32+I]=m-v):(E=s*h[w+0]+8192>>14,C[0+I]=E,C[8+I]=E,C[16+I]=E,C[24+I]=E,C[32+I]=E,C[40+I]=E,C[48+I]=E,C[56+I]=E)}for(w=0;w<64;++w){var T=128+(C[w]+8>>4);u[w]=T<0?0:T>255?255:T}}for(var y=0;y<f;y++){var E=y<<3;for(u=0;u<8;u++)d.push(new Uint8Array(m));for(var w=0;w<p;w++){A(c.blocks[y][w],g,v);var b=0,C=w<<3;for(h=0;h<8;h++){var x=d[E+h];for(u=0;u<8;u++)x[C+u]=g[b++]}}}return d}function p(e){return e<0?0:e>255?255:e}return c.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;function i(){var e=t[n]<<8|t[n+1];return n+=2,e}function o(){var e=i(),o=t.subarray(n,n+e-2);return n+=o.length,o}function r(e){var t,n,i=0,o=0;for(n in e.components)e.components.hasOwnProperty(n)&&(i<(t=e.components[n]).h&&(i=t.h),o<t.v&&(o=t.v));var r=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/o);for(n in e.components)if(e.components.hasOwnProperty(n)){t=e.components[n];for(var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),l=Math.ceil(Math.ceil(e.scanLines/8)*t.v/o),c=r*t.h,u=a*t.v,h=[],d=0;d<u;d++){for(var p=[],f=0;f<c;f++)p.push(new Int32Array(64));h.push(p)}t.blocksPerLine=s,t.blocksPerColumn=l,t.blocks=h}e.maxH=i,e.maxV=o,e.mcusPerLine=r,e.mcusPerColumn=a}t.length;var a,s,l=null,c=null,p=[],f=[],m=[],v=[],g=i();if(65496!=g)throw new Error("SOI not found");for(g=i();65497!=g;){switch(g){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var A=o();65504===g&&74===A[0]&&70===A[1]&&73===A[2]&&70===A[3]&&0===A[4]&&(l={version:{major:A[5],minor:A[6]},densityUnits:A[7],xDensity:A[8]<<8|A[9],yDensity:A[10]<<8|A[11],thumbWidth:A[12],thumbHeight:A[13],thumbData:A.subarray(14,14+3*A[12]*A[13])}),65518===g&&65===A[0]&&100===A[1]&&111===A[2]&&98===A[3]&&101===A[4]&&0===A[5]&&(c={version:A[6],flags0:A[7]<<8|A[8],flags1:A[9]<<8|A[10],transformCode:A[11]});break;case 65499:for(var y=i()+n-2;n<y;){var E=t[n++],w=new Int32Array(64);if(E>>4==0)for(U=0;U<64;U++){w[e[U]]=t[n++]}else{if(E>>4!=1)throw new Error("DQT: invalid table spec");for(U=0;U<64;U++){w[e[U]]=i()}}p[15&E]=w}break;case 65472:case 65473:case 65474:i(),(a={}).extended=65473===g,a.progressive=65474===g,a.precision=t[n++],a.scanLines=i(),a.samplesPerLine=i(),a.components={},a.componentsOrder=[];var b,C=t[n++];for(V=0;V<C;V++){b=t[n];var x=t[n+1]>>4,I=15&t[n+1],T=t[n+2];a.componentsOrder.push(b),a.components[b]={h:x,v:I,quantizationIdx:T},n+=3}r(a),f.push(a);break;case 65476:var B=i();for(V=2;V<B;){var k=t[n++],P=new Uint8Array(16),R=0;for(U=0;U<16;U++,n++)R+=P[U]=t[n];var M=new Uint8Array(R);for(U=0;U<R;U++,n++)M[U]=t[n];V+=17+R,(k>>4==0?v:m)[15&k]=u(P,M)}break;case 65501:i(),s=i();break;case 65498:i();var S=t[n++],D=[];for(V=0;V<S;V++){N=a.components[t[n++]];var F=t[n++];N.huffmanTableDC=v[F>>4],N.huffmanTableAC=m[15&F],D.push(N)}var L=t[n++],H=t[n++],Q=t[n++],O=h(t,n,a,D,s,L,H,Q>>4,15&Q);n+=O;break;case 65535:255!==t[n]&&n--;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw new Error("unknown JPEG marker "+g.toString(16))}g=i()}if(1!=f.length)throw new Error("only single frame JPEGs supported");for(var V=0;V<f.length;V++){var _=f[V].components;for(var U in _)_[U].quantizationTable=p[_[U].quantizationIdx],delete _[U].quantizationIdx}this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=l,this.adobe=c,this.components=[];for(V=0;V<a.componentsOrder.length;V++){var N=a.components[a.componentsOrder[V]];this.components.push({lines:d(0,N),scaleX:N.h/a.maxH,scaleY:N.v/a.maxV})}},getData:function(e,t){var n,i,o,r,a,s,l,c,u,h,d,f,m,v,g,A,y,E,w,b,C,x=this.width/e,I=this.height/t,T=0,B=e*t*this.components.length,k=new Uint8Array(B);switch(this.components.length){case 1:for(n=this.components[0],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*I],u=0;u<e;u++)d=a[0|u*n.scaleX*x],k[T++]=d;break;case 2:for(n=this.components[0],i=this.components[1],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*I],s=i.lines[0|h*i.scaleY*I],u=0;u<e;u++)d=a[0|u*n.scaleX*x],k[T++]=d,d=s[0|u*i.scaleX*x],k[T++]=d;break;case 3:for(C=!0,this.adobe&&this.adobe.transformCode?C=!0:void 0!==this.colorTransform&&(C=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*I],s=i.lines[0|h*i.scaleY*I],l=o.lines[0|h*o.scaleY*I],u=0;u<e;u++)C?(d=a[0|u*n.scaleX*x],f=s[0|u*i.scaleX*x],E=p(d+1.402*((m=l[0|u*o.scaleX*x])-128)),w=p(d-.3441363*(f-128)-.71413636*(m-128)),b=p(d+1.772*(f-128))):(E=a[0|u*n.scaleX*x],w=s[0|u*i.scaleX*x],b=l[0|u*o.scaleX*x]),k[T++]=E,k[T++]=w,k[T++]=b;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(C=!1,this.adobe&&this.adobe.transformCode?C=!0:void 0!==this.colorTransform&&(C=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],r=this.components[3],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*I],s=i.lines[0|h*i.scaleY*I],l=o.lines[0|h*o.scaleY*I],c=r.lines[0|h*r.scaleY*I],u=0;u<e;u++)C?(d=a[0|u*n.scaleX*x],f=s[0|u*i.scaleX*x],m=l[0|u*o.scaleX*x],v=c[0|u*r.scaleX*x],g=255-p(d+1.402*(m-128)),A=255-p(d-.3441363*(f-128)-.71413636*(m-128)),y=255-p(d+1.772*(f-128))):(g=a[0|u*n.scaleX*x],A=s[0|u*i.scaleX*x],y=l[0|u*o.scaleX*x],v=c[0|u*r.scaleX*x]),k[T++]=255-g,k[T++]=255-A,k[T++]=255-y,k[T++]=255-v;break;default:throw new Error("Unsupported color mode")}return k},copyToImageData:function(e,t){var n,i,o,r,a,s,l,c,u,h=e.width,d=e.height,f=e.data,m=this.getData(h,d),v=0,g=0;switch(this.components.length){case 1:for(i=0;i<d;i++)for(n=0;n<h;n++)o=m[v++],f[g++]=o,f[g++]=o,f[g++]=o,t&&(f[g++]=255);break;case 3:for(i=0;i<d;i++)for(n=0;n<h;n++)l=m[v++],c=m[v++],u=m[v++],f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;case 4:for(i=0;i<d;i++)for(n=0;n<h;n++)a=m[v++],s=m[v++],o=m[v++],l=255-p(a*(1-(r=m[v++])/255)+r),c=255-p(s*(1-r/255)+r),u=255-p(o*(1-r/255)+r),f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;default:throw new Error("Unsupported color mode")}}},c}();var uu={encode:function(e,t){return void 0===t&&(t=50),{data:new lu(t).encode(e,t),width:e.width,height:e.height}},decode:function(e,t){var n={useTArray:!1,colorTransform:void 0,formatAsRGBA:!0};t?"object"==typeof t?t={useTArray:void 0===t.useTArray?n.useTArray:t.useTArray,colorTransform:void 0===t.colorTransform?n.colorTransform:t.colorTransform,formatAsRGBA:void 0===t.formatAsRGBA?n.formatAsRGBA:t.formatAsRGBA}:(t=n).useTArray=!0:t=n;var i=new Uint8Array(e),o=new cu;o.parse(i),o.colorTransform=t.colorTransform;var r=t.formatAsRGBA?4:3,a=o.width*o.height*r;try{var s={width:o.width,height:o.height,data:t.useTArray?new Uint8Array(a):new Buffer(a)}}catch(e){throw e instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+a):e}return o.copyToImageData(s,t.formatAsRGBA),s}};function hu(e,t,n){e&&(e=e.toLowerCase().trim());var i=new I.UP.clone,o=Math.PI/3,r=Math.PI/2;switch(e){case"left":n.copy(t),n.applyAxisAngle(i,r);break;case"right":n.copy(t),n.applyAxisAngle(i,-r);break;case"forwardleft":n.copy(t),n.applyAxisAngle(i,o);break;case"forwardright":n.copy(t),n.applyAxisAngle(i,-o);break;case"forward":default:n.copy(t)}return n}function du(e,t){if(e){var n={pano:e,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(n,(function(){t&&t({success:!0,message:"Transition complete."})}))}else R.warn("Showcase -> clickPanoObject: Unable to find pano."),t&&t({success:!1,error:"Unable to find pano."})}function pu(e,t){var n=this.findRankedPano(e,t);return n>=0?this.handleToObject[n]:(R.warn("Showcase -> findRankedPanoObject: Unable to find nearby pano."),null)}function fu(e,t){var n=this.findRankedtag(e,t);return n>=0?this.handleToObject[n]:(R.warn("Showcase -> findRankedtagObject: Unable to find nearby tag."),null)}function mu(e,t){t.copy(I.FORWARD),e.getDirection(t)}var vu={director:null,player:null,controls:null,sceneRenderer:null,model:null,init:function(e,t,n,i){this.director=e,this.player=n,this.controls=t,this.sceneRenderer=i},handleToObject:{},objectToHandle:{},handleCount:0,onMessageReceive:function(e){if(e){var t=e.targetFunction,n=e.params,i=e.onDone;t&&this[t]&&this[t](n,i)}},waitForInit:function(e,t){F.then(t.bind({success:!0,message:"Init complete."}))},moveToPano:function(e,t){var n=new THREE.Euler(0,0,0,"YXZ"),i=new THREE.Quaternion;return function(e,t){var o=e.pano,r=e.rotation,a=e.transition;if(!this.model)return t({success:!1,error:"The model has not been loaded yet"});var s=this.model.panos.get(o);if(!s)return t({success:!1,error:o+" does not exist in this model"});if(!r)return t({sucess:!1,erorr:r+" is not a valid rotation"});n.set(c.Math.degToRad(r.x||0),c.Math.degToRad(r.y||0),c.Math.degToRad(r.z||0),"YXZ"),nt.info(r.z);var l={success:!0,message:o};if(a===A.FADEOUT)i.setFromEuler(n),this.player.warpToPano(s,i,null,null,b.BLACK,null,null,t.bind(this,l));else{var u,h;a===A.INSTANT&&(u=0,h=0);var d=I.FORWARD.clone().applyEuler(n).add(s.position);this.player.flyToPano({pano:s,lookAtPoint:d,duration:u,aimDuration:h},t.bind(this,l))}}}(),moveInDirection:function(e,t){var n=e.direction;return void 0===v[n]?(R.warn("Showcase -> moveInDirection: Cannot move in invalid direction."),void(t&&t({success:!1,error:"Invalid direction."}))):void this.player.flyLocalDirection(I[n].clone()).then((function(e){t(e?{success:!0,message:"moved "+n}:{success:!1,error:"Cannot move in direction: "+n})}))},getPose:function(e,t){return this.player.camera.position,(new THREE.Euler).setFromQuaternion(this.player.camera.quaternion,"YXZ"),t({success:!0,message:B(this.player)})},takeScreenShot:function(){var e=new THREE.PerspectiveCamera,t=new THREE.WebGLRenderTarget;return function(n,i){if(!n.resolution)return i({success:!1,error:"An invalid resolution was specified"});if(-1===n.resolution.width||-1===n.resolution.height){var o=this.sceneRenderer.renderer.getSize();n.resolution.width=o.width,n.resolution.height=o.height}e.layers.set(Bt),n.visibleObjects&&(n.visibleObjects.showPucks&&e.layers.enable(kt),n.visibleObjects.showReticule&&e.layers.enable(Pt));var r=n.resolution.width,a=n.resolution.height,s=r/a;e.position.copy(this.sceneRenderer.camera.position),e.quaternion.copy(this.sceneRenderer.camera.quaternion),e.projectionMatrix.copy(this.player.camera.projectionMatrix),e.projectionMatrix.elements[0]=this.player.camera.projectionMatrix.elements[5]/s,e.projectionMatrix.elements[5]=-e.projectionMatrix.elements[5],t.setSize(r,a),this.sceneRenderer.renderer.setRenderTarget(t),this.sceneRenderer.renderer.render(this.sceneRenderer.scene,e),this.sceneRenderer.renderer.setRenderTarget(null);var l=new Uint8Array(r*a*4);this.sceneRenderer.renderer.readRenderTargetPixels(t,0,0,r,a,l);var c=uu.encode({data:l,width:r,height:a,heading:180,pitch:0},n.quality);i({success:!0,message:"data:image/png;base64,"+Ae.uint8ToBase64(c.data),camera:e})}}(),findRankedPano:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){mu(this.player,i),hu(t,i,n);var o=this.player.rankedPanoInDirection(e,n);if(o){var r=this.objectToHandle[o.id];return r||(this.objectToHandle[o.id]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedPano: Unable to find nearby pano."),-1}}(),findRankedtag:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){mu(this.player,i),hu(t,i,n);var o=this.player.rankedtagInDirection(e,n);if(o){var r=this.objectToHandle[o.sid];return r||(this.objectToHandle[o.sid]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedtag: Unable to find nearby tag."),-1}}(),clickNearesttag:function(e){this.clickRankedtag(0,e)},clickRankedtag:function(e,t){var n=fu.call(this,e,t);n&&O.call(this,n)},clickNearestPano:function(e,t){this.clickRankedPano(0,e,t)},clickRankedPano:function(e,t,n){var i=pu.call(this,e,t);i?du.call(this,i,n):n(null)},clickPano:function(e,t){var n=this.handleTable[e];n?du.call(this,n,t):t(null)},rotateDirection:function(e,t){var n=e.direction,i=e.angle;if(!P.active){var o=0,r=0,a=0,s=0;if(!i||isNaN(i))return R.warn("Showcase -> rotateDirection: Invalid rotation angle."),void(t&&t({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotateDirection: Cannot rotate while transitioning"),void(t&&t({success:!1,error:"Cannot rotate while transitioning"}));if(n===v.RIGHT||n===v.LEFT)n===v.RIGHT&&(i=-i),o=i>0?-1:1,a=i;else{if(n!==v.UP&&n!==v.DOWN)return R.warn("Showcase -> rotateDirection: Invalid direction for rotation: "+n),void(t&&t({success:!1,error:"Invalid direction for rotation."}));if(this.player.mode===E.FLOORPLAN)return R.warn("Showcase -> rotateDirection: Cannot rotate "+n+" in floorplan mode"),void(t&&t({success:!1,error:"Cannot rotate "+n+" in floorplan mode"}));if(n===v.DOWN&&(i=-i),0===(i=N.call(this,i)))return R.warn("Showcase -> rotateDirection: Already at maximum rotation in direction: "+n),void(t&&t({success:!1,error:"Already at maximum rotation in direction: "+n}));r=i>0?1:-1,s=i}var l=i;i=c.Math.degToRad(i),a=c.Math.degToRad(a),s=c.Math.degToRad(s);var u=this.controls.activeControl;u.startRotating(o,r),P.start(a,s,this.player,(function(){u.stopRotating(!0),t&&t({success:!0,message:"Rotated "+l.toFixed(2)+"° in direction: "+e.direction})}))}},rotate:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(n,i){var o=n.xAngle,r=n.yAngle;if(!P.active){if(o=o||0,r=r||0,isNaN(o)||isNaN(r))return R.warn("Showcase -> rotate: Invalid rotation angle."),void(i&&i({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotate: Cannot rotate while transitioning"),void(i&&i({success:!1,error:"Cannot rotate while transitioning"}));Math.abs(o)<.01&&(o=0),Math.abs(r)<.01&&(r=0);var a=r;r=N.call(this,r);var s=a>0?"UP":"DOWN";if(!(o=-o)&&a&&!r)return R.warn("Showcase -> rotate: Already at maximum rotation in direction: "+s),void(i&&i({success:!1,error:"Already at maximum rotation in direction: "+s}));a>r&&R.warn("Showcase -> rotate: Reached maximum rotation in direction: "+s);var l=r;r=c.Math.degToRad(r),o=c.Math.degToRad(o),e.copy(this.player.mode===E.FLOORPLAN?I.UP:I.FORWARD),this.player.getDirection(e),t.copy(e).applyAxisAngle(I.UP,o),t.applyAxisAngle(I.RIGHT,r);var u=(e.angleTo(t),o>0?-1:o<0?1:0),h=r>0?1:r<0?-1:0;Math.abs(o)>Math.abs(r)?h*=Math.abs(r/o):Math.abs(r)>Math.abs(o)&&(u*=Math.abs(o/r));var d=this.controls.activeControl;d.startRotating(u,h),P.start(o,r,this.player,(function(){d.stopRotating(!0),i&&i({success:!0,message:"Rotated "+n.xAngle.toFixed(2)+"° horizontally, "+l.toFixed(2)+"° vertically"})}))}}}(),panCamera:function(e,t){function n(e){switch(o.removeAllListeners(T.AutoPanComplete),o.removeAllListeners(T.AutoPanInterrupt),o.removeAllListeners(T.AutoPanClamped),e){case T.AutoPanInterrupt:t({success:!0,message:"Camera panning interrupted."});break;case T.AutoPanClamped:if(o.autoPanPosition.x!==i.x||o.autoPanPosition.z!==i.z){if(Math.abs(this.player.position.x-o.autoPanPosition.x)<.01&&Math.abs(this.player.position.z-o.autoPanPosition.z)<.01)return void t({success:!1,error:"Already at edge of current model bounds."});var n="The view point is outside the bounds for the current model. ";n+="The view point was clamped to "+r(o.target.x,o.target.z),console.warn(n)}case T.AutoPanComplete:t({success:!0,message:"Panned camera to position "+r(o.autoPanPosition.x,o.autoPanPosition.z)})}}if(this.player.mode!==E.DOLLHOUSE&&this.player.mode!==E.FLOORPLAN)return t({success:!1,error:"Camera panning is not available in the current mode: "+this.player.mode});var i=e.position,o=this.player.control;o.setAutoPanPosition(i.x,i.z),o.autoPan=!0;var r=function(e,t){return"("+e.toFixed(2)+", "+t.toFixed(2)+")"};o.on(T.AutoPanComplete,n.bind(this,T.AutoPanComplete)),o.on(T.AutoPanInterrupt,n.bind(this,T.AutoPanInterrupt)),o.on(T.AutoPanClamped,n.bind(this,T.AutoPanClamped))},click:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputStart(n,i),this.player.updateIntersect(),this.player.handleInputEnd(n,i)},mouseOver:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputMove(n,i),this.player.updateIntersect()},moveToMode:function(e,t){function n(e){t(e?{success:!1,error:"Failed to load new mode: "+e}:{success:!0,message:"Moved to new mode: "+i})}var i=e.mode;i===E.PANORAMA||i===E.DOLLHOUSE||i===E.FLOORPLAN?this.director.changeMode(i).then((function(){n()}),(function(e){n(e)})):t({success:!1,error:"Invalid mode selection"})}},gu=function(e,t,n,i,o){vu.init(e,t,n,o)},Au=function(e,t){vu.takeScreenShot(e,t)};Xe("Screenshot",(function(){var e,t,n,i;return e=K("execute"),t=K("recover"),n=K("toFish"),i=K("unFish"),function(){function a(){o(this,a),Object.defineProperty(this,e,{value:r}),Object.defineProperty(this,t,{writable:!0,value:function(e){if(this.player.reticule.visible=!0,this.player.model.floorLogos.firstLogo.visible=e.fL0,this.player.model.floorLogos.secondLogo.visible=e.fL1,this.player.path.currentPanoMarker.mesh.visible=!0,this.player.model.panos.list.forEach((function(e){e.isAligned()&&(e.marker.visible=e.marker.forceHide)})),this.$app.core.get("CameraControls").controls.floorplan.snapshotTopAspect=null,this.player.mode!=ht.PANORAMA){this.player.model.chunks.forEach((function(e){e.material.side=THREE.FrontSide}));var t=this.$app.core.get("SceneRenderer").scene.skyboxBG;t&&(t.material.side=THREE.BackSide)}this.player.model.skybox.material.side=THREE.BackSide,this.player.OverlayManager.show("all",!0),this.player.GLTFEditor.show("all",!0),e.notHideMonitors||this.player.$app.Camera.monitor.control.showAll()}}),Object.defineProperty(this,n,{writable:!0,value:function(e){this.player.model.fishSkybox||(this.player.model.fishSkybox=new THREE.Mesh(new THREE.SphereGeometry(ke.skyRadius,80,50),this.player.model.skybox.material),this.core.get("SceneRenderer").scene.add(this.player.model.fishSkybox)),this.player.model.fishSkybox.position.copy(this.player.position),this.player.model.fishSkybox.visible=!0,this.player.model.skybox.visible=!1;for(var t=0;t<this.player.model.chunks.length;t++)this.player.model.chunks[t].visible=!1;e.cameraPosOld=this.player.camera.position.clone(),this.player.cameraControls.activeControl.fishState=!0,this.player.cameraControls.activeControl.camera.fov=Je.fish.insideFOV,this.player.cameraControls.activeControl.target.copy(this.player.position),this.player.updateFromControls()}}),Object.defineProperty(this,i,{writable:!0,value:function(e){if(this.player.mode==ht.PANORAMA){this.player.cameraControls.activeControl.camera.position.copy(e.cameraPosOld),this.player.cameraControls.activeControl.fishState=!1,this.player.model.fishSkybox.visible=!1,this.player.model.skybox.visible=!0;for(var t=0;t<this.player.model.chunks.length;t++)this.player.model.chunks[t].visible=!0;this.player.cameraControls.activeControl.camera.fov=Je.insideFOV}this.player.updateFromControls()}})}return u(a,[{key:"capture",value:function(t){this.player=this.$app.core.get("Player"),(this.player.flying||this.player.isWarping()||this.player.mode==ht.TRANSITIONING)&&nt.warn("you take a screenshot on flying or transitioning mode!!");var n=this.player.getSize(),i=n.clientWidth,o=n.clientHeight,r=this.player.model.floorLogos.firstLogo.visible,a=this.player.model.floorLogos.secondLogo.visible;this.player.model.panos.list.forEach((function(e){e.isAligned()&&(e.marker.forceHide=e.marker.visible,e.marker.visible=!1)})),this.player.reticule.visible=!1,this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1,this.player.path.currentPanoMarker.mesh.visible=!1,this.player.mode!=ht.PANORAMA&&this.player.model.chunks.forEach((function(e){e.material.side=THREE.BackSide})),this.player.model.skybox.material.side=THREE.DoubleSide,this.player.OverlayManager.hide("all"),this.player.GLTFEditor.hide("all"),t.notHideMonitors||this.player.$app.Camera.monitor.control.hideAll(),t.snapshotTopview&&this.player.mode==ht.FLOORPLAN&&(this.$app.core.get("CameraControls").controls.floorplan.snapshotTopAspect=i/o),t.changeBefore={fL0:r,fL1:a,notHideTags:t.notHideTags,notHideMonitors:t.notHideMonitors},Z(this,e)[e](t)}}]),a}();function r(o,r){var a,s,l=this;o.tasks.unFish&&o.tasks.unFish.length?(a=o.tasks.unFish.splice(0,1)[0],s="unFish"):o.tasks.fish&&o.tasks.fish.length?(a=o.tasks.fish.splice(0,1)[0],s="fish"):s="finish","unFish"==r&&"fish"==s?Z(this,n)[n](o.changeBefore):"fish"==r&&"finish"==s?(Z(this,i)[i](o.changeBefore),Z(this,t)[t](o.changeBefore)):"finish"==s?Z(this,t)[t](o.changeBefore):nt.info("other state:"+r+"|"+s),"finish"!=s&&Au({resolution:{width:a.width,height:a.height},quality:Je.isSafari?45:60},(function(t){o.done&&o.done(t.message,a.name,t),Z(l,e)[e](o,s)}))}}));var yu=Object.freeze({Show:0,Hide:1,Retain:2}),Eu=Object.freeze({Standard:0,Slow:1,Retain:2});function wu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Xe("Director",(function(){return function(e){f(n,EventEmitter);var t=wu(n);function n(){var e;return o(this,n),(e=t.call(this)).endlessLoop=Je.warp.loop,e.clock=new THREE.Clock(!0),e.currentItem=null,e.destinationItem=null,e.tourIsPlaying=!1,e.nextFunc=null,e.onTheBus=!1,e.reachSource=null,e.interrupted=!1,e.nItems=0,e.currentScript=0,e.walkingSectionPaused=!1,e.C=Object.freeze({None:0,Moving:1,Aiming:2,Interlude:3}),e.I=Object.freeze({Forward:1,NoChange:0,Backwards:-1}),e.transitionStage=e.C.None,e.player=e.$app.core.get("Player"),e}return u(n,[{key:"init",value:function(){this.updateModel(),this.resetAll(),this.bindEvents()}},{key:"resetAll",value:function(){if(this.currentItem=null,this.destinationItem=null,this.tourIsPlaying=!1,this.transitionStage=this.C.None,this.nextFunc=null,this.onTheBus=!1,this.reachSource=null,this.interrupted=!1,this.player.model)switch(this.player.model.switch_scene_type){case 1:this.defaultWarpStyle=Ie;break;case 2:this.defaultWarpStyle=Be;break;case 3:this.defaultWarpStyle=Te;break;default:this.defaultWarpStyle=Ie}else this.defaultWarpStyle=Ie,nt.warn('No model yet, choosing "'+this.defaultWarpStyle+'" transitions');this.resetSpecialTransition()}},{key:"updateModel",value:function(){this.player.model=this.modelManager.getActiveModel(),this.nItems=0}},{key:"bindEvents",value:function(){this.modelManager.on(Qa,this.updateModel.bind(this)),this.player.on(Kr,this.handleFlyToWarpInterruption.bind(this)),this.player.on(Hr,this.handlePlayerMove.bind(this)),this.player.on(zr,this.handlePlayerPanoChosen.bind(this)),this.player.on(Ur,this.handlePlayerModeChanged.bind(this)),this.player.on($r,this.handlePlayerInputStart.bind(this)),this.player.on(Wr,this.handlePlayerFlyingStarted.bind(this))}},{key:"handleFlyToWarpInterruption",value:function(e,t){e===Be?(this.interrupt(BlackoutStyle.NONE),this.pauseWalkingSection(),this.player.fastForwardActivePanoFlight()):this.transitionStage===this.C.Interlude&&(this.interrupt(BlackoutStyle.NONE),t&&t())}},{key:"handlePlayerMove",value:function(e){this.transitionStage===this.C.Interlude&&this.interrupt(BlackoutStyle.NONE)}},{key:"handlePlayerPanoChosen",value:function(e,t){this.intermediateState()||e.id===t.id||(this.onTheBus=!1,this.emit("update.controls"))}},{key:"handlePlayerModeChanged",value:function(e,t){this.intermediateState()||e===t||(this.onTheBus=!1,this.emit("update.controls"))}},{key:"handlePlayerInputStart",value:function(e){this.transitionStage===this.C.Interlude&&this.interrupt(BlackoutStyle.NONE)}},{key:"handlePlayerFlyingStarted",value:function(){this.clearWalkingSectionPaused()}},{key:"describe",value:function(){return{nItems:this.nItems,currentItem:this.currentItem,destinationItem:this.destinationItem,tourIsPlaying:this.tourIsPlaying,onTheBus:this.onTheBus,endlessLoop:this.endlessLoop,viewMode:this.player.mode,inTransition:this._inTransition(),transitionStage:this.transitionStage,tourInProgress:this.tourInProgress}}},{key:"_inTransition",value:function(){return this.player.flying||this.player.isWarping()||this.player.isWaitingToWarp()||this.player.mode===Viewmode.TRANSITIONING||this.tourIsPlaying}},{key:"bounceable",value:function(){var e=this.clock.getDelta();return this.isInterrupted()||e<.9&&e>.01||this.player.flying&&!this.player.isWarping()}},{key:"currentMoveDirection",value:function(){return null===this.currentItem||void 0===this.currentItem?this.I.Forward:this.destinationItem===this.currentItem?this.I.NoChange:this.destinationItem>this.currentItem?this.I.Forward:I.Backwards}},{key:"clearPath",value:function(){this._inTransition()||this.player.path.discardPathObject()}},{key:"allFloors",value:function(){this.player.model.toggleAllFloors()}},{key:"actionComplete",value:function(e){var t=this.transitionStage;if(this.interrupted=!1,this.transitionStage=this.C.None,this.resetSpecialTransition(),null!==this.destinationItem&&this.setCurrentItem(this.destinationItem),this.tourIsPlaying||this.player.mode===ht.PANORAMA&&this.player.currentPano.isAligned()&&this.player.model.fadePanoMarkers(),this.emit("update.controls"),this.currentScript&&(this.player.model.enableTagMovie&&t===this.C.Interlude||this.player.model.enableTagMovie&&t===this.C.Aiming&&null===this.nextFunc))this.openTag();else if(this.nextFunc){var n=this.nextFunc;this.nextFunc=null,n()}}},{key:"awaitCompletion",value:function(e,t){this.nextFunc=t,e()}},{key:"updateSuccessFunction",value:function(e){this.nextFunc=e}},{key:"interrupt",value:function(e,t){return!!this.wouldInterrupt()&&(this.tourIsPlaying&&(this.player.zoomEnabled=this.wasZoomEnabled),this.tourIsPlaying=!1,this.interrupted=!0,this.nextFunc=null,this.emit(DirectorEvents.ActionInterrupted),null!=e||(e=BlackoutStyle.BEGINNING),this.player.interruptAndFastForward(e,t),!0)}},{key:"wouldInterrupt",value:function(){return this.transitionStage!==this.C.None}},{key:"intermediateState",value:function(){return this.transitionStage!==this.C.None}},{key:"isInterrupted",value:function(){return this.interrupted}},{key:"pauseWalkingSection",value:function(){this.walkingSectionPaused=!0}},{key:"clearWalkingSectionPaused",value:function(){this.walkingSectionPaused=!1}},{key:"autoTour",value:function(){Je.nestscenes&&Je.nestscenes.scenes&&Je.nestscenes.scenes.length&&!Je.nestscenes.scenes[0].script&&(Je.basic.menu.scene_autoplay&&(Je.warp.auto=0,$("#play").removeClass("play").addClass("pause"),G.playing=!0,$(".gui-floor").hide(),$(".rightbar").hide(),$("#userlogo").hide(),$("#page-view").hide(),$("#back-url").hide(),$(".indoordir, .indoorscale").hide(),$("#virgule, #barrageShow, #barrageCon").hide()),Je.warp.auto>=0&&transitions.trigger({duration:1e3*Math.min(300,Je.warp.auto),done:function(){this.playTour()}.bind(this),name:"_atr"}))}},{key:"atDestinationPano",value:function(){if(!this.player.currentPano||null===this.destinationItem)return!1;var e=this.player.currentPano.id;if(void 0===e)return!1;var t=this.player.model.heroLocations;return null!==this.destinationItem&&void 0!==t[this.destinationItem]&&e==t[this.destinationItem].panoId}},{key:"redirectToItem",value:function(e,t){if(null!=e)if(this.wouldInterrupt())if(this.player.mode!==ht.TRANSITIONING){nt.debug("Director.redirectToItem() -> Redirecting to "+e+" via "+t);var n=function(){transitions.setTimeout(function(){this.setDestinationItem(e),nt.info("from redirectToItem"),this.goToDestination(!0,BlackoutStyle.BEGINNING,Je.warp.warpInterruptionRedirectTime,!1)}.bind(this),0)}.bind(this);this.interrupt(BlackoutStyle.END,0),this.updateSuccessFunction(n)}else nt.debug("Director.redirectToItem() -> Cannot redirect while transitioning.");else nt.warn("Director.redirectToItem() -> Director cannot redirect if there is nothing to interrupt.");else nt.warn("Director.redirectToItem() -> Redirecting to null item.")}},{key:"useSpecialTransition",value:function(e){void 0!==e&&this.defaultWarpStyle!==Ie&&nt.debug("useSpecialTransition(): "+e),this.nextWarpStyle=this.defaultWarpStyle}},{key:"resetSpecialTransition",value:function(){this.nextWarpStyle=this.defaultWarpStyle}},{key:"arrivedAtDestination",value:function(e){if(this.player.flying||this.player.isWarping())nt.warn("Cannot advance to interlude or aiming while player is flying or warping.");else{this.transitionStage=this.C.Aiming;var t=this.tourIsPlaying?this.tourInterlude.bind(this,this.nextItem(this.currentItem)):null;this.player.model.fadePanoMarkers(0),this.awaitCompletion(function(){this.resetSpecialTransition(),e?this.player.aimTourCamera(this.destinationItem,yu.Retain,yu.Slow,this.actionComplete.bind(this)):this.actionComplete()}.bind(this),t)}this.play.control.canPlay||(this.play.control.canPlay=!0),this.play.control.wait&&this.play.control.isPlaying&&(this.record.updateFragmentUI(this.play.control.currentIndex),this.play.control.wait=!1)}},{key:"toast",value:function(e){setTimeout((function(){document.getElementsByClassName("toast-wrap")[0].getElementsByClassName("toast-msg")[0].innerHTML=e;var t=document.getElementsByClassName("toast-wrap")[0];t.className=t.className.replace("toastAnimate",""),setTimeout((function(){t.className=t.className+" toastAnimate"}),10)}),10)}},{key:"tour360view",value:function(){if(this.player.currentPano&&2===this.player.currentPano.alignmentType){var e=this.player.model.language;this.toast(e.watchPr)}else $("#play").hasClass("play")}},{key:"goToDestination",value:function(e,t,n,i){if(this.destinationItem=objects.play.control.currentIndex,this.onTheBus=!0,this.emit("update.controls"),i||!this.atDestinationPano())if(this.player.flying||this.player.isWarping())nt.warn("Cannot go to new destination while player is flying or warping.");else{var o=this.player.model.getHeroDescriptorByIndex(this.destinationItem),r=null,a=null;if(null!=o.pano&&void 0!==o.pano){var s=0===this.destinationItem||e?Ie:this.nextWarpStyle;a=this.player.warpToPanoByHeroIndex.bind(this.player,this.destinationItem,yu.Show,Eu.Slow,s,t,n,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!0)}else a=this.player.warpToNonPanoByHeroIndex.bind(this.player,this.destinationItem,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!1);this.transitionStage=this.C.Moving,this.player.model.fadePanoMarkers(0,null,{hideVideoFlag:!0}),this.awaitCompletion(function(){a()}.bind(this),r),this.emit("update.controls")}else this.arrivedAtDestination(!0)}},{key:"tourInterlude",value:function(){if(this.player.model.fadePanoMarkers(0),this.emit("update.controls"),this.tourIsPlaying)return this.atEndOfTour()&&!this.endlessLoop?(this.tourInProgress=!1,this.stopTour(),this.emit(DirectorEvents.TourEnd),void(this.player.mode===Viewmode.PANORAMA&&this.player.model.fadePanoMarkers(Je.panorama.markerOpacity))):void this.awaitCompletion(function(){this.transitionStage=this.C.Interlude,this.player.tourInterlude(this.nextItem(this.currentItem),this.actionComplete.bind(this))}.bind(this),this.goNext.bind(this))}},{key:"playTour",value:function(){if(!this.bounceable())return this.tourIsPlaying?void nt.info("tour is already playing"):void(this.wouldInterrupt()||(this.player.emit("tour_auto",this.defaultWarpStyle),this.tourInProgress=!0,this.reachSource="play",this.tourIsPlaying=!0,this.wasZoomEnabled=this.player.zoomEnabled,this.player.zoomEnabled=!1,this.resetSpecialTransition(),this.emit("update.controls"),this.emit(DirectorEvents.TourStart),this.player.enablePreRendering(),this.walkingSectionPaused?(this.clearWalkingSectionPaused(),this.goToDestination()):this.goNext()))}},{key:"hideTourBar",value:function(){browser.isMobile()?$(".btn-cat-play").removeClass("cat-mob-pause").addClass("cat-mob-play"):$(".btn-cat-play").removeClass("cat-pc-pause").addClass("cat-pc-play"),$("#gui").show()}},{key:"stopTour",value:function(){this.isInterrupted()||this.transitionStage===this.C.Moving&&this.checkAndHandleWalkingtourInterruption(this.nextWarpStyle)||(this.tourIsPlaying&&(this.player.zoomEnabled=this.wasZoomEnabled),this.tourIsPlaying=!1,this.interrupt(),this.clearWalkingSectionPaused(),this.resetSpecialTransition(),this.emit("update.controls"))}},{key:"endTourProgress",value:function(){this.tourInProgress=!1,this.emit("update.controls"),this.emit(DirectorEvents.TourEnd)}},{key:"goToHighlight",value:function(e){this.clearWalkingSectionPaused(),this.destinationItem=e,this.useSpecialTransition("Hilight"),this.goToDestination()}},{key:"goToHighlightByLocation",value:function(e){var t=this.player.model.heroLocations.findIndex((function(t){return!(!t.panoId||t.panoId!=e)}));if(!this.wouldInterrupt()){if(nt.debug("<tour.goto "+t+">"),this.wouldInterrupt()&&(t===this.destinationItem?this.interrupt():this.redirectToItem(t,"goToHighlight")),this.isInterrupted())return;this.clearWalkingSectionPaused(),this.setDestinationItem(t),this.useSpecialTransition("Hilight"),this.goToDestination()}}},{key:"prevHighlight",value:function(){this.bounceable()||(this.player.emit("tour_manual","prev"),this.interrupt(BlackoutStyle.BEGINNING)||this.isInterrupted()||(this.clearWalkingSectionPaused(),this.reachSource="prev",this.goPrev()))}},{key:"nextHighlight",value:function(){this.bounceable()||(this.player.emit("tour_manual","next"),this.interrupt(BlackoutStyle.BEGINNING)||this.isInterrupted()||(this.clearWalkingSectionPaused(),this.reachSource="next",this.goNext()))}},{key:"changeMode",value:function(e,t){var n=t||"gui";switch(this.wouldInterrupt()&&this.interrupt(),this.player.controls[e].emit("interaction."+n),this.clearWalkingSectionPaused(),e){case ht.PANORAMA:this.player.insideMode();break;case ht.DOLLHOUSE:case ht.FLOORPLAN:this.player.flyToNewMode({mode:e})}}},{key:"atEndOfTour",value:function(){return this.currentItem>=this.nItems-1}},{key:"firstDestination",value:function(){if(this.nItems<=0)return null;for(var e=0;e<this.nItems;e++)if(this.player.model.images.list[e].script===this.currentScript)return e;return 0}},{key:"finalDestination",value:function(){if(this.nItems<=0)return null;for(var e=this.nItems-1;e>=0;e--)if(this.player.model.images.list[e].script===this.currentScript)return e;return 0}},{key:"goPrev",value:function(){this.tourAdvance(-1)}},{key:"goNext",value:function(){this.tourAdvance(1)}},{key:"setDestinationItem",value:function(e){e>this.nItems&&(e=this.firstDestination()),this.destinationItem=e,this.emit("update.controls")}},{key:"setCurrentItem",value:function(e){this.currentItem=e,this.emit("update.controls")}},{key:"nextItem",value:function(e){return null===e?this.firstDestination():e>=this.nItems-1?this.endlessLoop?this.firstDestination():null:e+1}},{key:"prevItem",value:function(e){return null===e?this.firstDestination():e<0?this.endlessLoop?this.lastDestination():null:e-1}},{key:"tourAdvance",value:function(e){nt.debug("tourAdvance("+e+")"),null===this.currentItem||void 0===this.currentItem?this.setDestinationItem(this.firstDestination()):this.setDestinationItem(this.currentItem+e),this.destinationItem<0?(this.setDestinationItem(this.finalDestination()),this.useSpecialTransition("reverse-looping to end")):this.destinationItem>=this.nItems&&(this.setDestinationItem(this.firstDestination()),this.useSpecialTransition("looping back to start")),this.goToDestination()}}]),n}()}));var bu=function(e){this.elem=e.elem,this.domParent=e.domParent,this.elem.addEventListener("mousedown",this.beginMove.bind(this)),this.elem.addEventListener("touchstart",this.beginMove.bind(this)),this.elem.addEventListener("pointerdown",this.beginMove.bind(this)),document.addEventListener("mousedown",this.move.bind(this)),document.addEventListener("touchmove",this.move.bind(this)),document.addEventListener("pointermove",this.move.bind(this)),e.cameraControls?e.cameraControls.on("pointerUp",this.moveDone.bind(this)):(document.addEventListener("pointerup",this.moveDone.bind(this)),document.addEventListener("mouseup",this.moveDone.bind(this)),document.addEventListener("touchend",this.moveDone.bind(this)),document.addEventListener("touchcancel",this.moveDone.bind(this))),this.beginMoveFuc=e.beginMoveFuc,this.moveDoneFuc=e.moveDoneFuc,this.hasBound=e.hasBound,this.useTransform=e.useTransform,e.hasBound&&(this.needGetBound=1,window.addEventListener("resize",function(){this.needGetBound=1}.bind(this))),this.recover()};function Cu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}bu.prototype.beginMove=function(e){if(e.preventDefault(),e.stopPropagation(),this.hasBound&&this.getMoveBound(),!this.moving){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;if(this.moving=!0,this.useTransform){var n,i,o=this.elem.style.transform;if(o){var r=o.indexOf("("),a=o.indexOf(")");o=o.slice(r+1,a).split(","),n=parseFloat(o[0]),i=parseFloat(o[1])}else n=i=0;this.dragInfo={startElem:{x:n,y:i},endElem:{x:n,y:i}}}else this.dragInfo={startElem:{x:parseFloat(this.elem[0].style.left),y:parseFloat(this.elem[0].style.top)}};this.dragInfo.startMouse={x:t?e.changedTouches[0].clientX:e.clientX,y:t?e.changedTouches[0].clientY:e.clientY},this.beginMoveFuc&&this.beginMoveFuc()}},bu.prototype.move=function(e){if(this.moving){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1,n=t?e.changedTouches[0].clientX:e.clientX,i=t?e.changedTouches[0].clientY:e.clientY;this.dragInfo.vector={x:n-this.dragInfo.startMouse.x,y:i-this.dragInfo.startMouse.y},this.dragInfo.endElem={x:this.dragInfo.startElem.x+this.dragInfo.vector.x,y:this.dragInfo.startElem.y+this.dragInfo.vector.y},this.hasBound&&(this.dragInfo.endElem.x=Math.max(this.bound.left,this.dragInfo.endElem.x),this.dragInfo.endElem.x=Math.min(this.bound.right,this.dragInfo.endElem.x),this.dragInfo.endElem.y=Math.max(this.bound.top,this.dragInfo.endElem.y),this.dragInfo.endElem.y=Math.min(this.bound.bottom,this.dragInfo.endElem.y)),this.useTransform?this.elem.style.transform="translate("+this.dragInfo.endElem.x+"px,"+this.dragInfo.endElem.y+"px)":(this.elem.style.left=this.dragInfo.endElem.x+"px",this.elem.style.top=this.dragInfo.endElem.y+"px")}},bu.prototype.moveDone=function(e){this.moving&&(this.getMoveBound(),this.moving=!1,this.move(e),this.moveDoneFuc&&this.moveDoneFuc(this.reportPos()),this.dragInfo.startElem=this.dragInfo.endElem,this.dragInfo.vector={x:0,y:0})},bu.prototype.getMoveBound=function(){if(this.needGetBound){var e=isMobile?68:100,t=isMobile?32:60,n=($("#player").width()-e)/2;isMobile?this.bound={left:-n,right:n,top:-($("#player").height()/2-$("header")[0].offsetTop-$("header").height()-t/2),bottom:$("#player").height()/2-$("footer").height()-t/2}:this.bound={left:-n,right:n,top:-($("#player").height()/2-50-t/2),bottom:$("#player").height()/2-t/2},console.log(this.bound),this.needGetBound=0}},bu.prototype.reportPos=function(){return{x:this.dragInfo.endElem.x+this.domParent.clientWidth/2,y:this.dragInfo.endElem.y+this.domParent.clientHeight/2}},bu.prototype.recover=function(){this.dragInfo={startElem:{x:0,y:0},endElem:{x:0,y:0}},this.useTransform?this.elem.style.transform="":(this.elem.style.left=0,this.elem.style.top=0)};var xu,Iu,Tu=function(e){f(n,EventEmitter);var t=Cu(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return o(this,n),e=t.call(this),i.pos3d&&(e.pos3d=(new THREE.Vector3).copy(i.pos3d)),i.pos2d&&(e.pos2d=(new THREE.Vector2).copy(i.pos2d),e.setElemPos()),e.name=i.name,e.elem=i.elem,e.camera=i.camera,e.domParent=i.domParent,e.player=r,e.useTransform=i.useTransform,e.mayShelter=i.mayShelter,e}return u(n,[{key:"update",value:function(){if(this.pos3d&&!this.dragging){var e=tt.getPos2d(this.pos3d,this.player,this.camera,this.domParent);if(e.trueSide)if(this.mayShelter&&tt.ifShelter(this.pos3d,this.player,{x:e.vector.x,y:e.vector.y},this.camera))this.elem.style.display="none";else{if(this.elem.style.display="block",this.driftDir){var t=tt.getPos2d(this.pos3d.clone().add(this.driftDir)),n=this.elem[0].children[0].getBoundingClientRect(),i=he.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.pos3d.distanceTo(this.camera.position);this.pos2d=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()))}else this.pos2d=(new THREE.Vector2).copy(e.vector);this.setElemPos()}else this.elem.style.display="none"}}},{key:"setElemPos",value:function(){if(this.useTransform){var e=this.pos2d.x/2*this.domParent.clientWidth,t=-this.pos2d.y/2*this.domParent.clientHeight;this.elem.style.transform="translate("+parseInt(e)+"px,"+parseInt(t)+"px)"}else this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}}]),n}();function Bu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ku,Pu,Ru,Mu,Su=new THREE.Vector2,Du={},Fu={};function Lu(e){Su=Hu(e)}function Hu(e){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;return{x:t?e.changedTouches[0].clientX:e.offsetX,y:t?Iu?e.changedTouches[0].clientY-xu.domElement.clientHeight:e.changedTouches[0].clientY:e.offsetY}}Xe("TagEditManager",(function(){return function(e){f(n,e);var t=Bu(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,n),(i=t.call(this)).splitView=e,i.panoA,i.paonB,i.markTagPos,i.init(r),i}return u(n,[{key:"init",value:function(e){var t=this;this.inited||(ku=this.$app.dom.querySelector('.player[name="copy"]'),xu=this.$app.core.get("Player"),this.$app.core.get("TagManager"),Iu=this.$app.config.mobile,this.markSpotA=new Tu({name:"markSpotA",elem:e.spotA,domParent:xu.domElement,camera:xu.camera,useTransform:!0},xu),this.markSpotB=new Tu({name:"markSpotB",elem:e.spotB,domParent:ku,camera:this.splitView.panoramaCam,useTransform:!0},xu),this.markSpotA.name="markSpotA",this.markSpotB.name="markSpotB",new bu({elem:this.markSpotA.elem,domParent:xu.domElement,useTransform:!0,cameraControls:xu.cameraControls,beginMoveFuc:function(){t.editing&&(t.markSpotA.dragging=!0,xu.cameraControls.controls.panorama.locked=!0,t.splitView.panoramaCtl.locked=!0)},moveDoneFuc:function(e){t.editing&&(t.markSpotA.dragging=!1,xu.cameraControls.controls.panorama.locked=!1,t.splitView.panoramaCtl.locked=!1,e&&t.moveToReGetA(e),xu.mouseCouldBeClickToMove=!1)}}),Pu=new bu({elem:this.markSpotB.elem,domParent:ku,useTransform:!0,beginMoveFuc:function(){t.markSpotB.dragging=!0,t.splitView.panoramaCtl.locked=!0,xu.cameraControls.controls.panorama.locked=!0},moveDoneFuc:function(e){t.markSpotB.dragging=!1,t.splitView.panoramaCtl.locked=!1,xu.cameraControls.controls.panorama.locked=!1,e&&t.moveToReGetB(e)}}),ku.addEventListener("pointerdown",Lu),ku.addEventListener("touchstart",Lu),ku.addEventListener("pointerup",this.clickToReGetB.bind(this)),ku.addEventListener("touchend",this.clickToReGetB.bind(this)),xu.on("update",(function(e){t.editing&&(e.hasChanged.cameraChanged2&&t.markSpotA.update(),t.splitView.changed()&&t.markSpotB.update())})),xu.on("pano.chosen",(function(e,n){t.changePano(n)})),xu.on("click",(function(e){t.editing&&!t.clickA&&(e.intersect&&t.getA(e.intersect),e.consume())})),xu.on("ifFocusPoint",(function(e){if(t.editing&&t.markTagPos){e.importance<3&&(e.importance=3,e.aim=t.markTagPos.clone())}})),this.inited=!0)}},{key:"enter",value:function(){var e=this;xu.viewLinkManager.exitView().then((function(){if(xu.flying||xu.flyingToTag)return xu.flyingToTag,void xu.once(qr,(function(){e.enter()}));xu.flyToMode("panorama",(function(){!function t(){xu.currentPano?(e.editing=!0,e.setSpotPos||xu.flying||(e.splitView.enter(),e.panoB=e.splitView.panoB,e.markSpotA.elem.style.display="none",e.markSpotB.elem.style.display="none",e.markSpotA.pos3d=e.clickA=null,e.markSpotB.pos3d=e.clickB=null,e.markTagPos=null,xu.reticule.visible=!1,xu.locked=!0,null==Ru&&(Ru=Je.insideLookLimitDown,Mu=Je.insideLookLimitUp,Je.insideLookLimitDown=-35,Je.insideLookLimitUp=35))):setTimeout(t,50)}()}))}))}},{key:"reSetPos",value:function(e){var t=this;this.markTagPos=(new THREE.Vector3).copy(e),xu.viewLinkManager.exitView().then((function(){return xu.flying||xu.flyingToTag?(xu.flyingToTag,void xu.once(qr,(function(){t.reSetPos(e)}))):(t.editing=!0,t.hotRePos=!0,t.markSpotA.pos3d=t.clickA=t.markTagPos.clone(),t.markSpotA.enable=!0,t.markSpotB.pos3d=t.clickB=t.markTagPos.clone(),t.markSpotA.elem.style.display="block",t.markSpotB.elem.style.display="block",t.markSpotB.enable=!0,setTimeout((function(){t.markSpotA.update(),t.markSpotB.update()}),300),t.splitView.enter(),t.panoA=t.splitView.panoA,t.panoB=t.splitView.panoB,null==Ru&&(Ru=Je.insideLookLimitDown,Mu=Je.insideLookLimitUp,Je.insideLookLimitDown=-35,Je.insideLookLimitUp=35),xu.flyToPano({pano:xu.currentPano,aimDuration:500,lookAtPoint:t.markTagPos}),!0)}))}},{key:"confirmPos",value:function(e){if(this.editing){var t=Ae.getRandomSid(),n=this.computeHotPos();return e&&xu.model.add(new e(t,{position:n})),this.panoA?{sid:t,position:n,panoId:this.panoA.id}:{}}}},{key:"exit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.cancel,this.clickA=this.clickB=null,this.markSpotA.pos3d=this.markSpotB.pos3d=null,this.splitView.leave(),this.markSpotA.elem.style.display="none",this.markSpotB.elem.style.display="none",this.markSpotA.pos2d=new THREE.Vector2,this.markSpotB.pos2d=new THREE.Vector2,this.markSpotA.setElemPos(),this.markSpotB.setElemPos(),xu.reticule.visible=!0,this.hideMarker&&(editSpot.hideMarker.visible=!0,editSpot.hideMarker=null),this.hotRePos=!1,this.editing=!1,xu.locked=!1,null!=Ru&&(Je.insideLookLimitDown=Ru,Je.insideLookLimitUp=Mu,Ru=Mu=null)}},{key:"changePano",value:function(e){this.editing&&(this.splitView.changePano(e),this.markTagPos&&(e.assistPano==this.splitView.panoB?this.markSpotA.pos3d.copy(this.clickA):this.markSpotA.pos3d=this.markTagPos.clone(),this.splitView.pauseCameraBind=!0))}},{key:"getA",value:function(e){var t=this;if(!xu.flying&&this.editing){if(this.panoA=xu.currentPano,xu.locked=!1,2!=Je.visions&&this.panoA==this.panoB){var n=xu.model.matrixWorld.clone().invert(),i=e.point.clone().applyMatrix4(n);if(!this.clickA){this.clickA=this.clickB=i;var o=xu.model.panos.find([function(e){return xu.currentPano.neighbourPanos[e.id]&&xu.currentPano!=e}],[ro.sortFunctions.distanceToPoint(xu.currentPano.position)]);o?xu.flyToPano({pano:o,lookAtPoint:i.clone()}):console.log("当前场景只有一个pano,所以不走到下一个点")}this.clickA=this.clickB=i}else{if(xu.currentPano.assistPano!=this.splitView.panoB){if(this.clickA){this.panoA=xu.currentPano;n=xu.model.matrixWorld.clone().invert();return this.clickA=e.point.clone().applyMatrix4(n),this.markSpotA.pos3d=this.clickA,this.markSpotA.update(),void this.computeHotPos()}this.splitView.setSceneB(),this.panoB=this.splitView.panoB,this.splitView.pauseCameraBind=!1}if(!this.getMatchData()){var r=this.panoA.id+"_"+this.panoB.id;if(Du[r]=(Du[r]||0)+1,!(Du[r]>5))return void setTimeout((function(){t.getA(e)}),200);console.error("获取不到matchdata 放弃使用: "+r)}n=xu.model.matrixWorld.clone().invert();if(this.clickA=e.point.clone().applyMatrix4(n),this.dirA=he.getNormalDir(this.clickA,xu.model.supportsTiles,xu.currentPano),this.UVa=he.getUVfromDir(this.dirA),this.UVb=this.searchPointAtLeft(this.UVa),this.UVb)this.UVb.x=this.UVb.x.toFixed(3)-0,this.UVb.y=this.UVb.y.toFixed(3)-0;else{console.log("找不到UVb,假设一个");this.UVb={x:this.UVa.x,y:this.UVa.y+-.02}}this.dirB=he.getDirFromUV(this.UVb),this.clickB=function(e,t){e=e.clone();var n=t.matrixWorld.clone();return n.invert(),e=he.crossRight(e,n),t.position.clone().add(e)}(this.dirB,this.splitView.panoB)}this.markSpotA.pos3d=this.clickA,this.markSpotB.pos3d=this.clickB,this.markSpotA.elem.style.display="block",this.markSpotB.elem.style.display="block",this.markSpotA.enable=!0,this.markSpotB.enable=!0,this.markSpotA.update(),this.markSpotB.update(),2!=Je.visions&&this.panoA==this.panoB?this.markTagPos=this.markSpotA.pos3d.clone():this.computeHotPos(),this.$app.TagManager.emit("tagManager.markTagPos")}}},{key:"getB",value:function(e){var t=tt.getMouseIntersect(this.splitView.panoramaCam,[this.splitView.cube],e),n=xu.model.matrixWorld.clone().invert();this.clickB=t.point.clone().applyMatrix4(n),this.markSpotB.pos3d=this.clickB,this.markSpotB.update(),this.computeHotPos()}},{key:"moveToReGetA",value:function(e){xu.handleInputStart(e.x,e.y,!0,!0),xu.updateIntersect({}),xu.intersect?this.getA(xu.intersect):this.markSpotA.update(),xu.mouseDown=!1}},{key:"moveToReGetB",value:function(e){var t=new THREE.Vector2;he.convertScreenPositionToNDC(e.x,e.y,t,ku),this.getB(t)}},{key:"clickToReGetB",value:function(e){if(!Pu.moving){var t=Hu(e);if(!(Math.abs(Su.x-t.x)>3||Math.abs(Su.y-t.y)>3)){if(!this.clickA&&!this.hotRePos)return console.log("..?.."),void this.$app.TagManager.emit("tagManager.firstMarkTagPosB");var n=new THREE.Vector2;he.convertScreenPositionToNDC(t.x,t.y,n,ku),this.getB(n)}}}},{key:"restricPosAtRoom",value:function(e){var t=xu.currentPano.position,n=e,i=n.clone().sub(t).normalize(),o=new THREE.Raycaster(t,i,0,t.distanceTo(n)).intersectObjects(xu.model.skyBoxTight);return o&&o.length&&(console.log("热点飘出skyBoxTight外,矫正:"+e.toArray()+" --\x3e "+o[0].point.toArray()),e.copy(o[0].point).sub(i.clone().multiplyScalar(.001))),e}},{key:"computeHotPos",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.panoA||!this.clickA)return null;var t=this.panoA.position.clone(),n=this.panoB.position.clone(),i=this.clickA,o=this.clickB,r=he.getLineIntersect({A:t,B:n,p1:i,p2:o}),a=r.pos3d;return e.dontRestric||this.restricPosAtRoom(a),this.markTagPos=a,console.log("markTagPos: ",a.toArray()),a}},{key:"getMatchData",value:function(){var e=this.panoA.id+"_"+this.panoB.id;if(Fu[e])return Fu[e];Xn.get(this.$app.resource.getEditDataURL("mapping/".concat(e,".json"))).then((function(t){Fu[e]=t}))}},{key:"searchPointAtLeft",value:function(e){var t=this.getMatchData();if(e||console.log("!!!"),!t||!t["view pair"]||!t["view pair"].uv)return null;var n,i=e.x,o=e.y,r={},a={},s={},l={},c={leftTop:r,rightTop:a,leftBot:s,rightBot:l};function u(e,t){var n=t[0],r=t[1],a=(n-i)*(n-i)+(r-o)*(r-o);(null==e.dis||e.dis>a)&&(e.dis=a,e.pair=t)}t["view pair"].uv.forEach((function(e){e[0]<i&&e[1]<=o?u(r,e):e[0]>=i&&e[1]<=o?u(a,e):e[0]<i&&e[1]>=o?u(s,e):u(l,e)}));var h=0;for(var d in c)c[d].pair&&h++;var p={};function f(e,t){return e.pair?t.pair?e.dis<t.dis?e:t:e:t}function m(){var e=f(r,s),t=f(a,l),n=f(r,a),c=f(s,l);return p.x=(i-e.pair[0])/(t.pair[0]-e.pair[0]),p.y=(o-n.pair[1])/(c.pair[1]-n.pair[1]),{x:e.pair[2]+(t.pair[2]-e.pair[2])*p.x,y:n.pair[3]+(c.pair[3]-n.pair[3])*p.y}}return(h>=3||2==h&&(r.pair&&l.pair||s.pair&&a.pair))&&(n=m()),n}}]),n}(vo)}));var Qu,Ou,Vu,_u=function(){function e(t,n){o(this,e),this.quickstart=!0,this.mode=ht.PANORAMA,this.zoom=-1,this.fov=Ce.urlHasValue("fov")?Number(Ce.urlQueryValue("fov")):Je.insideFOV,this.pano=null,this.position=new THREE.Vector3,this.quaternion=new THREE.Quaternion,this.init(t,n)}return u(e,[{key:"init",value:function(e,t){var n=Ce.urlHasValue("pose",!0);if(n)try{n=Ae.replaceAll(n,"pano",'"pano"'),n="{"+(n=Ae.replaceAll(n,"qua:",'"qua":['))+"]}";var i=JSON.parse(n);this.pano=t.get(i.pano),this.pano?(this.quaternion=(new THREE.Quaternion).fromArray(i.qua),this.zoom=-1,this.setByUrl=!0):(n=!1,console.error("检测到firstView但是 找不到该pano"))}catch(e){n=!1,console.error("检测到firstView但是解析出错"+e)}else if(e&&e.entry){var o=e.entry;this.updateByEntry(o,t)}else this.pano=t.list[0],this.quaternion.copy(this.pano.quaternion);this.position.copy(this.pano.position),this.quaternion.equals(new THREE.Quaternion(-.5,.5,.5,.5))&&(this.quaternion.set(0,0,0,1),console.log("检测到初始画面quaternion为-0.5,0.5,0.5,0.5,强制更改为0,0,0,1"))}},{key:"updateByEntry",value:function(e,t){"string"==typeof e&&(e=JSON.parse(e)),e.pano&&(this.pano=t.get(e.pano)),null==this.pano&&(this.pano=t.list[0]),this.quaternion.copy(this.pano.quaternion),e.camera&&(this.quaternion=(new THREE.Quaternion).fromArray(e.camera.quaternion),this.zoom=e.camera.zoom)}},{key:"fromGuideView",value:function(e,t){this.mode=e.value.mode,this.zoom=e.value.zoom,this.position.copy(e.value.pos),this.quaternion.set(e.value.qua._x,e.value.qua._y,e.value.qua._z,e.value.qua._w),this.pano=t.get(e.value.pano)}}]),e}();function Uu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Nu,zu={},Gu=function(e){f(n,EventEmitter);var t=Uu(n);function n(e,i){var r,a;return o(this,n),(r=t.call(this)).changed=function(){var e,t=this.panoramaCam.position.clone(),n=this.panoramaCam.quaternion.clone();return a&&$e.closeTo(a.position,t,5)&&$e.closeTo(a.quaternion,n,5)||(e=!0),e&&(a={position:t,quaternion:n}),e},r.$app=e,r.init(),r.editType=i,r.pauseCameraBind,r}return u(n,[{key:"init",value:function(){var e=this;Vu=this.$app.core.get("Player"),Ou=this.$app.dom.querySelector('.player[name="copy"]'),(Qu=new THREE.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),Qu.setSize(300,300,!1),Ou.appendChild(Qu.domElement);var t=this.$app.withNewComponent("CameraControls");if(t.init(Ou,["panorama"]),t.activateControls("panorama"),this.panoramaCtl=t.activeControl,this.panoramaCam=t.activeControl.camera,this.panoramaCam.fov=60,this.panoramaCam.name="splitViewCam",this.panoramaCam.layers.toggle(Bt),this.panoramaCam.layers.enable(kt),this.panoramaCam.layers.enable(Rt),this.panoramaCam.layers.enable(Mt),2!=Je.visions||Vu.model.panos.list[0].assistPano||(Je.visions=1,console.warn("自动更改 visions = 1")),2!=Je.visions&&Vu.model.supportsTiles){var n=this.$app.withNewComponent("SceneRenderer",1),i=this.$app.withNewComponent("PanoRenderer",1),o=this.$app.withNewComponent("TileDownloader",1);o.index=1,n.renderer=Qu,o.processPriorityQueue=!0,i.init(n,o),(Nu=new so).extend(Vu.model.panos.list.map((function(t){var n=new ro(e.$app,t.id,t);return n.attachToPanoRenderer(i),n.tileDownloader=o,n.qualityManager=e.$app.core.get("QualityManager"),n}))),o.setPanoData(Nu,[],this.$app.core.get("ModelManager").projectNum),o.setUrls(Vu.model.urls),o.start()}this.cube=new THREE.Mesh(new THREE.BoxGeometry(10,10,10),new ho({side:THREE.BackSide,transparent:!1,name:"splitViewCubeMat",not_Cube:2==Je.visions},"skybox")),this.cube.name="splitView-cube",this.cube.layers.set(Mt),this.$app.core.get("SceneRenderer").scene.add(this.cube),Vu.on("updateFromControls",(function(t,n){e.editing&&(e.pauseCameraBind?e.panoramaCtl.update(n):(e.panoramaCtl.lon=t.cameraControls.controls.panorama.lon,e.panoramaCtl.lat=t.cameraControls.controls.panorama.lat,e.panoramaCtl.update(n),t.cameraControls.controls.panorama.lon=e.panoramaCtl.lon,t.cameraControls.controls.panorama.lat=e.panoramaCtl.lat))}))}},{key:"enter",value:function(){if(!this.editing){this.editing=!0,this.$app.core.get("SceneRenderer").addComponent(this);var e=Vu.cameraControls.cameras.panorama;e.fov=e.staticFov=60,this.zoomEnabled=Je.zoom.enabled,Je.zoom.enabled=!1,this.pauseCameraBind=!1,this.panoA=Vu.currentPano,this.setSize(),this.setSceneB(),this.emit("enter"),Vu.OverlayManager.hide("all"),Vu.GLTFEditor.hide("all")}}},{key:"leave",value:function(){this.editing&&(this.$app.core.get("SceneRenderer").removeComponent(this),this.emit("leave"),this.editing=!1,Je.zoom.enabled=this.zoomEnabled,Vu.OverlayManager.show("all",!0),Vu.GLTFEditor.show("all",!0),Vu.cameraControls.cameras.panorama.staticFov=null)}},{key:"setSceneB",value:function(){var e=this.panoB;2!=Je.visions?(this.panoB=this.panoA,this.cube.position.copy(this.panoB.position),this.panoramaCam.position.copy(this.panoB.position)):this.panoB!=this.panoA.assistPano&&(this.panoB=this.panoA.assistPano,this.cube.position.copy(this.panoB.position),this.panoramaCam.position.copy(this.panoB.position),this.hideMarker&&(this.hideMarker.visible=!0),this.hideMarker=this.panoA.marker,this.hideMarker.visible=!1),this.getTextureForCube(this.panoB),e&&e!=this.panoB&&e.exit()}},{key:"getTextureForCube",value:function(e){var t=this;console.log("getTextureForCube",e.id);e=e||this.panoB;2!=Je.visions&&Vu.model.supportsTiles&&(e=Nu.index[e.id]);var n=function(){if(zu[t.panoB.id]&&(clearTimeout(zu[t.panoB.id]),delete zu[t.panoB.id]),e&&t.panoB.id!=e.id)console.log("getTextureForCube退出");else{console.log("texGetted",e.id),e.ensureSkyboxReadyForRender();var n=e.getSkyboxTexture();t.cube.material.uniforms.pano1Map.value=n,t.cube.material.uniforms.pano1Matrix.value.copy(t.panoB.matrixWorld)}};if(e.tiled){var i=na.getHFOVForCamera(Vu.camera,Vu.domElement.clientWidth/2,Vu.domElement.clientHeight),o=Vu.zoomFov,r=Vu.getDirection();e.loadTiledPano(2048,r,{hFov:i,vFov:o},!1,!1,!0).then((function(){n()})),Vu.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){}))}else Vu.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){n()}))}},{key:"update",value:function(){this.editing&&Qu.render(this.$app.core.get("SceneRenderer").scene,this.panoramaCam)}},{key:"setSize",value:function(){this.editing&&(Qu.setSize(Ou.clientWidth,Ou.clientHeight,!0,Math.min(window.devicePixelRatio,2)),this.panoramaCam.updateAspect(Ou.clientWidth/Ou.clientHeight))}},{key:"changePano",value:function(e){this.panoA=e}}]),n}(),ju=function(){function e(t,n){o(this,e),this.model=t,this.panos=t.panos,this.player=n,this.retryMinimumTime=1e4}return u(e,[{key:"start",value:function(){this.loadNextPano(function(e){e?this.start():(nt.debug("No suitable pano loaded, waiting a little while before looking again"),setTimeout(function(){this.start()}.bind(this),1e3))}.bind(this))}},{key:"validLoadTarget",value:function(e){return e&&!e.isLoaded("high")&&Date.now()-e.failedLoadingAt>this.retryMinimumTime}},{key:"listImagePanos",value:function(){var e=[],t=this;return this.model.images.forEach((function(n){if(n.metadata&&n.metadata.scan_id){var i=t.model.panos.get(n.metadata.scan_id);i&&!i.isLoaded("high")&&e.push(i)}})),e}},{key:"loadNextPano",value:function(e){var t,n,i=this.model.waitQueue.filter((function(e){return e.object instanceof ro}));i.length>0?(t=i[0].object,nt.debug("Overrode pano selection: Flying to an unloaded pano "+t.id)):this.validLoadTarget(this.player.currentPano)?(t=this.player.currentPano,nt.debug("Overrode pano selection: Currently at an unloaded pano "+t.id)):this.validLoadTarget(this.player.closestPano)?(t=this.player.closestPano,nt.debug("Overrode pano selection: Hovering over an unloaded pano "+t.id)):this.player.mode===ht.PANORAMA&&(t=this.panos.lowestByScore([this.validLoadTarget.bind(this),ro.filters.isNeighbourPanoTo(this.player.currentPano)],[ro.scoreFunctions.distance(this.player.currentPano),ro.scoreFunctions.direction(this.player.position,this.player.getDirection()),ro.scoreFunctions.inFieldOfView(this.player.position,this.player.getDirection())]))&&nt.debug("Normal pano selection: neighbor "+t.id),t?(n=n||t.isLoaded("low")?"high":"low",nt.debug("Preloading "+n+"-res pano "+t.id),console.log("Preloading "+n+"-res pano "+t.id),t.loadCube(n).done(e).fail((function(){nt.warn("Failed preloading pano",t.id,", marking it as failed and forgetting it for a while"),e()}))):e&&e(null)}}]),e}();function Wu(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return qu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qu(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function qu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ju(e){var t=e.core.get("Player"),n=e.TagManager.tags.length,i=t.model.chunks.length,o=t.model.chunks.reduce((function(e,t){return e+t.geometry.attributes.position.count}),0),r=t.model.texSizeBlock,a=t.model.panos.list.length,s=t.model.panos.list.filter((function(e){return e.hasVideo})).length,l=t.OverlayManager.group.children.length,c=t.OverlayManager.group.children.filter((function(e){return"video"==e.info.type})).length,u=Object.keys(t.viewLinkManager.views),h=u.length,d=u.filter((function(e){return"pano"==t.viewLinkManager.views[e].linkType})).length;console.log("%c".concat("共有初始chunk ".concat(i," 个 ( 顶点数 ").concat(o," )\n 模型贴图尺寸是512的 ").concat(r," 倍数 \n 热点 ").concat(n," 个 \n 漫游点 ").concat(a," 个 ( 视频漫游点 ").concat(s," 个 )\n overlay ").concat(l," 个 ( 视频类型 ").concat(c," 个 )\n viewLink ").concat(h," 个 ( pano类型 ").concat(d," 个 )\n ")),"color:#FF4399")}Xe("Scene",(function(){return function(){function e(){var t=this;o(this,e),this.ready=!1,this.loaded=!1,this.tilegen=!0,this.quickstart=!1,this.position=new THREE.Vector3(15,10,15),this.splitViews=[],!1===this.$app.config.view&&(this.locked=vt(),this.$app.store.on("auth",(function(e){t.locked.resolve()})))}var t,n,i,r,a;return u(e,[{key:"beforeLoad",value:function(){this.$app.withComponent("Screenshot"),this.$app.withComponent("SceneRenderer"),this.$app.withComponent("PanoRenderer"),this.$app.withComponent("PanoVideoRenderer"),this.$app.withComponent("QualityManager"),this.$app.withComponent("ModelManager"),this.$app.withComponent("CameraControls"),this.$app.withComponent("DisplayController"),this.$app.withComponent("TileDownloader",{concurrentDownloads:this.tilegen?6:2,$app:this.$app}),this.$app.withComponent("Player"),this.$app.withComponent("Director"),this.$app.core.get("SceneRenderer").createScene(),this.$app.core.get("CameraControls").init(this.$app.dom.querySelector(".player")),this.$app.core.get("QualityManager").init(),this.$app.core.get("TileDownloader").init(),this.$app.core.get("PanoRenderer").init()}},{key:"start",value:(a=k(S.mark((function e(){var t,n,i,o,r,a,s=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==this.$app.config.view||!this.$app.config.useAuth){e.next=14;break}return e.prev=1,e.next=4,this.$app.resource.auth();case 4:if(0!=e.sent.success){e.next=8;break}return e.next=8,this.locked;case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,this.locked;case 14:return e.next=16,this.$app.resource.metadata();case 16:if(!(t=e.sent).filters||1!=t.filters){e.next=20;break}return e.next=20,this.$app.store.get("filters");case 20:if(this.beforeLoad(),!this.$app.Scene.locked){e.next=24;break}return e.next=24,this.$app.Scene.locked;case 24:return t.sceneKind&&"pano"==t.sceneKind&&(this.$app.core.get("Player").model.supportsTiles=!1),this.$app.core.get("TileDownloader").start(),n=JSON.parse(JSON.stringify(t)),e.next=29,Hc.handle(n,this.$app);case 29:if(this.$app.core.get("PanoVideoRenderer").init(n.videos),!(t.mosaic&&t.mosaicList&&t.mosaicList.length)){e.next=50;break}i=Wu(t.mosaicList),e.prev=32,i.s();case 34:if((o=i.n()).done){e.next=42;break}if(r=o.value,e.t1=r.fileName,!e.t1){e.next=40;break}return e.next=40,$n.loadWithoutUpdate(this.$app.resource.getUserResourceURL(r.fileName));case 40:e.next=34;break;case 42:e.next=47;break;case 44:e.prev=44,e.t2=e.catch(32),i.e(e.t2);case 47:return e.prev=47,i.f(),e.finish(47);case 50:return e.next=52,this.$app.resource.visions();case 52:return this.initPanos(t),this.$app.FilterManager.initFilters(),e.next=56,this.isQuick(t);case 56:if(this.$app.Scene.emit("ready"),this.ready=!0,a=function(){var e=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.$app.resource.flooruser();case 2:return s.$app.core.get("SceneRenderer").addComponent(pe),s.$app.core.get("Player").model.build(),s.afterLoad(),s.$app.core.get("Player").model.supportsTiles||new ju(s.$app.core.get("Player").model,s.$app.core.get("Player")).start(),e.next=8,s.loadPanos();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),"3dtiles"!==t.modelKind){e.next=65;break}return e.next=62,this.$app.resource.modelmesh3dTiles();case 62:this.$app.Scene.on("3dTilesLoaded",a),e.next=71;break;case 65:return e.next=67,this.$app.resource.modelmeshDam();case 67:return e.next=69,this.$app.resource.textures();case 69:return e.next=71,a();case 71:case"end":return e.stop()}}),e,this,[[1,10],[32,44,47,50]])}))),function(){return a.apply(this,arguments)})},{key:"isQuick",value:(r=k(S.mark((function e(t){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.firstView.quickstart){e.next=3;break}return e.next=3,this.quickEnter(this.firstView,t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"loadPanos",value:(i=k(S.mark((function e(){var t,n=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.$app.core.get("Player").start(this.firstView);case 2:if(this.firstView.quickstart&&(this.$app.core.get("SceneRenderer").removeComponent(this.$app.core.get("QuickstartManager")),this.$app.core.get("QuickstartManager").destroy()),this.loaded=!0,this.$app.Scene.emit("loaded",this.$app.core.get("Player").currentPano),this.$app.core.get("TileDownloader").useComponent(),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("PanoRenderer"),!0),t=function(){var e=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.$app.store.get("tags");case 2:return e.next=4,n.$app.store.get("tours");case 4:return e.next=6,n.$app.store.get("links");case 6:return e.next=8,n.$app.store.get("cameras");case 8:return e.next=10,n.$app.store.get("billboards");case 10:n.$app.Scene.emit("loadeddata"),Ju(n.$app);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.$app.core.get("Player").mode===ht.TRANSITIONING){e.next=13;break}return e.next=11,t();case 11:e.next=14;break;case 13:this.$app.Camera.once("mode.afterChange",t);case 14:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"initPanos",value:function(e){this.startSceneRenderer();var t=this.$app.core.get("Player").model;this.$app.core.get("ModelManager").init(),this.$app.core.get("ModelManager").addModel(t),this.firstView=new _u(e,t.panos),this.firstView.quickstart=!0}},{key:"afterLoad",value:function(){this.$app.core.get("SceneRenderer").scene.add(this.$app.core.get("Player").model),this.$app.core.get("Player").init(),this.$app.core.get("Player").setScene(),this.$app.core.get("DisplayController").init(),Uc.bindEvents(this.$app.core.get("Player")),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("Player")),gu(this.$app.core.get("Director"),this.$app.core.get("CameraControls"),this.$app.core.get("Player"),this.$app.core.get("ModelManager"),this.$app.core.get("SceneRenderer"))}},{key:"startSceneRenderer",value:function(){if(!this.$app.core.get("SceneRenderer").started){try{this.$app.core.get("SceneRenderer").start(this.$app.dom.querySelector(".player"))}catch(e){nt.error(e.message)}1==this.$app.uid&&this.$app.config.mobile&&au.Init(this.$app.core.get("SceneRenderer"),this.$app.core.get("Player"))}}},{key:"quickEnter",value:(n=k(S.mark((function e(t,n){var i,o,r=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$app.core.get("CameraControls").activateControls(ht.PANORAMA),i=this.$app.core.get("CameraControls").controls[ht.PANORAMA],this.$app.withComponent("QuickstartManager",this.$app.core.get("QualityManager"),this.$app.core.get("SceneRenderer").scene,this.$app.core.get("SceneRenderer").camera,i),o=this.$app.core.get("QuickstartManager"),e.next=6,o.load(t);case 6:this.$app.core.get("SceneRenderer").addComponent(o),this.$app.core.get("SceneRenderer").once(aa,(function(){nt.info("".concat(r.$app.config.num,"First render after quickstart load finished."))}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getSplit",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$app.dom.classList.add("kankan-app__split"),e.prev=1,e.next=4,this.$app.resource.visions2();case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),nt.warn("".concat(this.$app.config.num,"[load visions2] fail"));case 9:return this.splitViews[t]||(this.splitViews[t]=new Gu(this.$app,t)),n&&this.splitViews[t].enter(),e.abrupt("return",this.splitViews[t]);case 12:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(e,n){return t.apply(this,arguments)})},{key:"restore",value:function(e){this.$app.dom.classList.remove("kankan-app__split"),this.splitViews[e].leave()}}]),e}()}));var Yu={damPro:Base64.decode("bWVzc2FnZSBiaW5hcnlfbWVzaCB7CglyZXBlYXRlZCBjaHVua19zaW1wbGUgY2h1bmsgPSAxOwoJcmVwZWF0ZWQgY2h1bmtfcXVhbnRpemVkIHF1YW50aXplZF9jaHVuayA9IDI7Cn0KCi8vIERlZmluaXRpb24gb2YgdmVydGljZXM6IDNEIGNvb3JkaW5hdGVzLCBhbmQgMkQgdGV4dHVyZSBjb29yZGluYXRlcy4KbWVzc2FnZSB2ZXJ0aWNlc19zaW1wbGUgewoJcmVwZWF0ZWQgZmxvYXQgeHl6ID0gMSBbcGFja2VkPXRydWVdOyAgLy8geF8wLHlfMCx6XzAsIHhfMSx5XzEsel8xLCAuLi4KCXJlcGVhdGVkIGZsb2F0IHV2ID0gMiBbcGFja2VkPXRydWVdOyAgLy8gdV8wLHZfMCwgdV8xLHZfMSwgLi4uCn0KCi8vIEluZGV4ZXMgb2YgdmVydGljZXMgb2YgZmFjZXMKbWVzc2FnZSBmYWNlc19zaW1wbGUgewoJcmVwZWF0ZWQgdWludDMyIGZhY2VzID0gMSBbcGFja2VkPXRydWVdOyAvLyBpMDAsaTAxLGkwMiwgaTEwLGkxMSxpMTIsIC4uLgp9CgovLyBBIHNpbXBseSBlbmNvZGVkIGNodW5rLgovLyBUT0RPOiBhZGQgY2h1bmsgcHJvcGVyaXRlcyAoc3VjaCBhcyAicmVmbGVjdGl2ZSIpCm1lc3NhZ2UgY2h1bmtfc2ltcGxlIHsKCW9wdGlvbmFsIHZlcnRpY2VzX3NpbXBsZSB2ZXJ0aWNlcyA9IDE7CglvcHRpb25hbCBmYWNlc19zaW1wbGUgZmFjZXMgPSAyOwoJb3B0aW9uYWwgc3RyaW5nIGNodW5rX25hbWUgPSAzOwoJb3B0aW9uYWwgc3RyaW5nIG1hdGVyaWFsX25hbWUgPSA0Owp9CgovLyBRdWFudGl6ZWQgdmVyc2lvbnMgZm9sbG93OgptZXNzYWdlIHZlcnRpY2VzX3F1YW50aXplZCB7CglvcHRpb25hbCBmbG9hdCBxdWFudGl6YXRpb24gPSAxOwoJcmVwZWF0ZWQgZmxvYXQgdHJhbnNsYXRpb24gPSAyOwoJcmVwZWF0ZWQgc2ludDMyIHggPSAzIFtwYWNrZWQ9dHJ1ZV07CglyZXBlYXRlZCBzaW50MzIgeSA9IDQgW3BhY2tlZD10cnVlXTsKCXJlcGVhdGVkIHNpbnQzMiB6ID0gNSBbcGFja2VkPXRydWVdOwp9CgptZXNzYWdlIHV2X3F1YW50aXplZCB7CglvcHRpb25hbCBzdHJpbmcgbmFtZSA9IDE7CglvcHRpb25hbCBmbG9hdCBxdWFudGl6YXRpb24gPSAyOwoJcmVwZWF0ZWQgc2ludDMyIHUgPSAzIFtwYWNrZWQ9dHJ1ZV07CglyZXBlYXRlZCBzaW50MzIgdiA9IDQgW3BhY2tlZD10cnVlXTsKfQoKLy8gSW5kZXhlcyBvZiB2ZXJ0aWNlcyBvZiBmYWNlcwptZXNzYWdlIGZhY2VzX2NvbXByZXNzZWQgewoJcmVwZWF0ZWQgc2ludDMyIGZhY2VzID0gMSBbcGFja2VkPXRydWVdOyAvLyBpMDAsaTAxLGkwMiwgaTEwLGkxMSxpMTIsIC4uLgp9CgptZXNzYWdlIGNodW5rX3F1YW50aXplZCB7CglvcHRpb25hbCBzdHJpbmcgY2h1bmtfbmFtZSA9IDE7CglvcHRpb25hbCBzdHJpbmcgbWF0ZXJpYWxfbmFtZSA9IDI7CglvcHRpb25hbCB2ZXJ0aWNlc19xdWFudGl6ZWQgdmVydGljZXMgPSAzOwoJcmVwZWF0ZWQgdXZfcXVhbnRpemVkIHV2cyA9IDQ7CglvcHRpb25hbCBmYWNlc19zaW1wbGUgZmFjZXMgPSA1Owp9Cg=="),visionmodeldataPro:Base64.decode("Ly8KLy8gUHJvdG9jb2wgQnVmZmVyIGZvciBwdWNrIHZpc2liaWxpdHkgYW5kIHJlbGF0ZWQgZGF0YQovLwovL3BhY2thZ2UgZW9zLnN0b3JhZ2U7CgovLyBpbXBvcnQgImVvcy9pbmZyYS9jb21tb24ucHJvdG8iOwovLyBUaGUgZm9sbG93aW5nIHdlcmUgbWFudWFsbHkgZXh0cmFjdGVkIGhlcmUsIEpTIGRvZXMgbm90IGxpa2UgcHJvdG9idWYgaW1wb3J0cwoKbWVzc2FnZSBBZmZpbmUzZiB7CglvcHRpb25hbCBRdWF0ZXJuaW9uZiByb3RhdGlvbiA9IDE7CglvcHRpb25hbCBWZWN0b3IzZiB0cmFuc2xhdGlvbiA9IDI7Cn0KCm1lc3NhZ2UgUXVhdGVybmlvbmYgewoJb3B0aW9uYWwgZmxvYXQgdyA9IDE7CglvcHRpb25hbCBmbG9hdCB4ID0gMjsKCW9wdGlvbmFsIGZsb2F0IHkgPSAzOwoJb3B0aW9uYWwgZmxvYXQgeiA9IDQ7Cn0KCm1lc3NhZ2UgVmVjdG9yM2YgewoJb3B0aW9uYWwgZmxvYXQgeCA9IDE7CglvcHRpb25hbCBmbG9hdCB5ID0gMjsKCW9wdGlvbmFsIGZsb2F0IHogPSAzOwp9CgovLwovLyBPbmUgc3dlZXAgLyBwYW5vCi8vCm1lc3NhZ2UgU3dlZXBMb2NhdGlvbiB7CglvcHRpb25hbCBieXRlcyB1dWlkID0gMTsgIC8qIHV1aWQgKi8KCW9wdGlvbmFsIEFmZmluZTNmIHBvc2UgPSAyOyAgLyogY2FtZXJhIHBvc2UgKHgsIHkseikgaW4gbWV0ZXIgYW5kIGEgcXVhdGVybmlvbiovCglvcHRpb25hbCBWZWN0b3IzZiBwdWNrID0gMzsgIC8qIHB1Y2sgbG9jYXRpb24gLSB4IGFueSBpcyBnZW5lcmFsbHkgdGhlIHNhbWUgYXMgcG9zZSwgeiBpcyB0aGUgaGVpZ2h0IG9mIHRoZSBjbG9zZXN0IGZsb29yIHVuZGVyIHRoZSBjYW1lcmEgKi8KCW9wdGlvbmFsIGludDMyIGdyb3VwID0gNDsgIC8qIGZsb29yIGluZGV4ICovCglvcHRpb25hbCBpbnQzMiBzdWJncm91cCA9IDU7ICAvKiByb29tIGluZGV4ICovCglyZXBlYXRlZCBpbnQzMiB2aXNpYmxlcyA9IDY7ICAvKiBsaXN0IG9mIGluZGljZXMgdG8gYWxsIHB1Y2tzIHZpc2libGUgZnJvbSB0aGlzIHB1Y2sgKi8KCXJlcGVhdGVkIGludDMyIHZpc2libGVzMiA9IDc7IAoJcmVwZWF0ZWQgaW50MzIgdmlzaWJsZXMzID0gODsKfQoKLy8KLy8gQWxsIHB1Y2tzIGluIGEgbW9kZWwuIFB1Y2tzIGFyZSBzdG9yZWQgaW4gc2Nhbm5pbmcgb3JkZXIuCi8vCm1lc3NhZ2UgTmF2aWdhdGlvbkluZm8gewoJcmVwZWF0ZWQgU3dlZXBMb2NhdGlvbiBzd2VlcExvY2F0aW9ucyA9IDE7Cn0="),decoderMesh(){return dcodeIO.ProtoBuf.loadProto(this.damPro).build("binary_mesh")},decoderModeldata(){return dcodeIO.ProtoBuf.loadProto(this.visionmodeldataPro).build("NavigationInfo")},decompressMesh(e){var t=null;try{t=this.decoderMesh().decode(e)}catch(e){return nt.error("failed parsing proto for .dam"),null}return t},decompressModeldata(e){var t=null;try{t=this.decoderModeldata().decode(e)}catch(e){return nt.error("failed parsing proto for .modeldata"),null}return t}};function Zu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Xu=function(e){f(n,THREE.Mesh);var t=Zu(n);function n(e){var i;o(this,n);var r=new ho({side:THREE.DoubleSide});(i=t.call(this,e.geometry,r)).materialInside=r;var a=THREE.UniformsUtils.clone(sn.modelOutside.uniforms);return i.materialOutside=new THREE.RawShaderMaterial({fragmentShader:sn.modelOutside.fragmentShader,vertexShader:sn.modelOutside.vertexShader,uniforms:a,side:THREE.FrontSide,name:"chunkOut",transparent:!0}),i.materialOutside.extraValues={},i.name=e.name||"",i.meshUrl=e.meshUrl,i.tileId=e.tileId,e.tileId&&(i.materialInside.defines.Is3dTiles=1,i.materialOutside.defines.Is3dTiles=1),e.textureName?i.textureName=e.textureName:i.setTextureMap(e.texture),i.isChunk=!0,i}return u(n,[{key:"setTextureMap",value:function(e){this.materialInside.uniforms.map.value=e,this.materialOutside.uniforms.map.value=e}},{key:"setMode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n=t.split("-")[0],i=t.split("-")[1],o=this.materialInside;(e===ht.DOLLHOUSE||e===ht.FLOORPLAN||n!=ht.PANORAMA&&i!=ht.PANORAMA)&&(o=this.materialOutside),e===ht.PANORAMA?o.side=THREE.DoubleSide:o.side=THREE.FrontSide,this.material=o}}]),n}(),Ku={convertProtobufToSceneObject:function(e,t,n){if(0==t.chunk.length)return nt.warn("No chunks in damfile..."),null;var i=new THREE.Matrix4;return i.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),t.chunk.map((function(t){var n=new THREE.BufferGeometry;n.setAttribute("position",new THREE.BufferAttribute(new Float32Array(t.vertices.xyz,0,3),3)),t.vertices.uv.length>0&&n.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(t.vertices.uv,0,2),2)),n.setIndex(new THREE.BufferAttribute(new Uint32Array(t.faces.faces,0,1),1)),n.applyMatrix4(i),n.computeBoundingBox();var o=Je.job+Je.format;return W.model.name&&(o=W.model.name),new Xu({geometry:n,textureName:t.material_name,name:t.chunk_name,meshUrl:e.resource.getViewImagesURL(o)})}))},visionModeldata:function(e){var t;e.sweepLocations.forEach((function(e){e.visibles3=e.visibles3||[],e.visibles.forEach((function(t){-1==e.visibles3.indexOf(t)&&e.visibles3.push(t)}))}));for(var n=e.sweepLocations.length,i=0;i<n;i++){if((e.sweepLocations[i].visibles2&&e.sweepLocations[i].visibles2.length||0)>0){t=!0;break}}t||(e.sweepLocations.forEach((function(e){e.visibles2=null})),nt.info("检测到疑似没有noblock数据,应该是手动上传,block置空"));var o=e.sweepLocations.map(function(e,t){return{uuid:e.uuid.toUTF8().replace(/-/g,""),position:{x:e.pose.translation.x,y:e.pose.translation.y,z:e.pose.translation.z},quaternion:{x:e.pose.rotation.x,y:e.pose.rotation.y,z:e.pose.rotation.z,w:e.pose.rotation.w},puck:{x:e.puck.x,y:e.puck.y,z:e.puck.z},alignmentType:e.alignment_type,neighbours:e.visibles3||e.visibles,noBlocks:e.visibles2,seeMarkers:e.visibles,group:e.group,subgroup:e.subgroup,index:t}}.bind(this)).map(function(e){return e.position=this.convertVisionVector(e.position),e.quaternion=this.convertVisionQuaternion(e.quaternion),e.puck=this.convertVisionVector(e.puck),e}.bind(this));return o.forEach((function(e){e.neighbours=e.neighbours.filter((function(e){return o[e]})).map((function(e){return o[e].uuid}))})),o.forEach((function(e){e.noBlocks&&(e.noBlocks=e.noBlocks.map((function(e){return o[e].uuid})))})),o.forEach((function(e){e.seeMarkers&&(e.seeMarkers=e.seeMarkers.filter((function(e){return o[e]})).map((function(e){return o[e].uuid})))})),o},panos:function(e,t,n){var i=e.core.get("Player").model.panos,o=e.core.get("PanoVideoRenderer"),r=o.videosInfo.videos;if(e.config.view){var a=new Map;i.extend(t.map(function(t){if(t.neighbours.length){var n=r.get(t.uuid);return n&&a.set(t.uuid,n),new ro(e,t.uuid,t,n)}return new ro(e,t.uuid,t,null)}.bind(this)),"id"),o.initVideoPlayer(e.dom,a)}else i.extend(t.map(function(t){return new ro(e,t.uuid,t,r.get(t.uuid))}.bind(this)),"id"),o.initVideoPlayer(e.dom,r);return i.forEach((function(e){e.neighbourUUIDs&&(e.neighbourUUIDs.forEach((function(t){var n=i.get(t);n&&i.setNeighbour(e,n,!0)})),e.neighbourPanos=i.getNeighbours(e)||{})})),0===i.length&&nt.warn("Model has no panos, turning off inside mode"),i},panosAssist(e,t){return e.map(function(e){return e.panoType="assistant",e.tiled=!1,new ro(t,e.uuid,e)}.bind(this))},convertVisionVector:function(e){return new THREE.Vector3(e.x,e.z,-e.y)},convertVisionQuaternion:function(e){return new THREE.Quaternion(e.x,e.z,-e.y,e.w).multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)))},convertWorkshopVector:function(e){return new THREE.Vector3(-e.x,e.y,e.z)},convertWorkshopQuaternion:function(e){return new THREE.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new THREE.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))}},$u={parseIdsFromChunkName(e,t){t.floorId=this.parseFloor(e),t.roomId=this.parseRoom(e)},parseFloor(e){var t=e.match(/_group([0-9]+)/);if(!t)return 0;try{return parseInt(t[1],10)}catch(e){return logger.warn('Non-int value "'+t[1]+'" for mesh group, defaulting to floor 0'),0}},parseRoom(e){var t=e.match(/_sub([0-9]+)/);if(!t)return-1;try{return parseInt(t[1],10)}catch(e){return logger.warn('Non-int value "'+t[1]+'" for mesh subgroup, defaulting to subgroup 0'),0}}},eh={load:(e,t,n)=>new Promise((function(n){function i(e,i){e||(t.push(i),++a===o&&n())}if(!e.chunks[0]||!e.chunks[0].meshUrl)return n();var o=Ae.countUnique(e.chunks.map((function(e){return e.textureName})));e.chunks[0].meshUrl.indexOf("_50k");var r="low";Je.minimalMemoryMode&&"high"===r&&(Ce.detectSamsungS6()?(nt.warn("Galaxy S6 cannot handle large textures, turning down quality."),r="low"):o>Je.maxMobileTextures&&(nt.warn("Model probably too large for mobile, turning down quality."),r="low"));var a=0,s=e.data.job.uuid+"_50k_texture_jpg_high1/";W.model.name&&(s=W.model.name.replace(".dam","_texture/")),e.chunks.forEach((function(t){if(!t.material.map&&t.textureName){var n=e.urls.get(s+t.textureName);t.setTextureMap($n.load(n,i.bind(this,$n.isLoaded(n))))}}))}))};function th(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nh(e){this.wrapped=e}function ih(e){return new nh(e)}function oh(e){var t,n;function i(t,n){try{var r=e[t](n),a=r.value,s=a instanceof nh;Promise.resolve(s?a.wrapped:a).then((function(e){s?i("return"===t?"return":"next",e):o(r.done?"return":"normal",e)}),(function(e){i("throw",e)}))}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?i(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise((function(r,a){var s={key:e,arg:o,resolve:r,reject:a,next:null};n?n=n.next=s:(t=n=s,i(e,o))}))},"function"!=typeof e.return&&(this.return=void 0)}function rh(e){return function(){return new oh(e.apply(this,arguments))}}function ah(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}oh.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},oh.prototype.next=function(e){return this._invoke("next",e)},oh.prototype.throw=function(e){return this._invoke("throw",e)},oh.prototype.return=function(e){return this._invoke("return",e)};var sh,lh,ch,uh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;o(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return u(e,[{key:"_initWorker",value:function(e){if(!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}},{key:"_getIdleWorker",value:function(){for(var e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}},{key:"_onMessage",value:function(e,t){var n=this.workersResolve[e];if(n&&n(t),this.queue.length){var i=this.queue.shift(),o=i.resolve,r=i.msg,a=i.transfer;this.workersResolve[e]=o,this.workers[e].postMessage(r,a)}else this.workerStatus^=1<<e}},{key:"setWorkerCreator",value:function(e){this.workerCreator=e}},{key:"setWorkerLimit",value:function(e){this.pool=e}},{key:"postMessage",value:function(e,t){var n=this;return new Promise((function(i){var o=n._getIdleWorker();-1!==o?(n._initWorker(o),n.workerStatus|=1<<o,n.workersResolve[o]=i,n.workers[o].postMessage(e,t)):n.queue.push({resolve:i,msg:e,transfer:t})}))}},{key:"dispose",value:function(){this.workers.forEach((function(e){return e.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),e}(),hh=function e(){o(this,e),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null},dh=function(){function e(t,n,i,r){o(this,e),this._dataView=new DataView(t.buffer,t.byteOffset+n,i),this._littleEndian=r,this._offset=0}return u(e,[{key:"_nextUint8",value:function(){var e=this._dataView.getUint8(this._offset);return this._offset+=1,e}},{key:"_nextUint16",value:function(){var e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}},{key:"_nextUint32",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_nextUint64",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}},{key:"_nextInt32",value:function(){var e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_skip",value:function(e){return this._offset+=e,this}},{key:"_scan",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._offset,i=0;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}]),e}(),ph=[171,75,84,88,32,50,48,187,13,10,26,10];function fh(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function mh(e){var t=new Uint8Array(e.buffer,e.byteOffset,ph.length);if(t[0]!==ph[0]||t[1]!==ph[1]||t[2]!==ph[2]||t[3]!==ph[3]||t[4]!==ph[4]||t[5]!==ph[5]||t[6]!==ph[6]||t[7]!==ph[7]||t[8]!==ph[8]||t[9]!==ph[9]||t[10]!==ph[10]||t[11]!==ph[11])throw new Error("Missing KTX 2.0 identifier.");var n=new hh,i=17*Uint32Array.BYTES_PER_ELEMENT,o=new dh(e,ph.length,i,!0);n.vkFormat=o._nextUint32(),n.typeSize=o._nextUint32(),n.pixelWidth=o._nextUint32(),n.pixelHeight=o._nextUint32(),n.pixelDepth=o._nextUint32(),n.layerCount=o._nextUint32(),n.faceCount=o._nextUint32();var r=o._nextUint32();n.supercompressionScheme=o._nextUint32();for(var a=o._nextUint32(),s=o._nextUint32(),l=o._nextUint32(),c=o._nextUint32(),u=o._nextUint64(),h=o._nextUint64(),d=new dh(e,ph.length+i,3*r*8,!0),p=0;p<r;p++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});for(var f=new dh(e,a,s,!0),m={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},v=(m.descriptorBlockSize/4-6)/4,g=0;g<v;g++){var A={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&A.channelType?(A.sampleLower=f._nextInt32(),A.sampleUpper=f._nextInt32()):(A.sampleLower=f._nextUint32(),A.sampleUpper=f._nextUint32()),m.samples[g]=A}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(m);for(var y=new dh(e,l,c,!0);y._offset<c;){var E=y._nextUint32(),w=y._scan(E),b=fh(w),C=y._scan(E-w.byteLength);n.keyValue[b]=b.match(/^ktx/i)?fh(C):C,y._offset%4&&y._skip(4-y._offset%4)}if(h<=0)return n;for(var x=new dh(e,u,h,!0),I=x._nextUint16(),T=x._nextUint16(),B=x._nextUint32(),k=x._nextUint32(),P=x._nextUint32(),R=x._nextUint32(),M=[],S=0;S<r;S++)M.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});var D=u+x._offset,F=D+B,L=F+k,H=L+P,Q=new Uint8Array(e.buffer,e.byteOffset+D,B),O=new Uint8Array(e.buffer,e.byteOffset+F,k),V=new Uint8Array(e.buffer,e.byteOffset+L,P),_=new Uint8Array(e.buffer,e.byteOffset+H,R);return n.globalData={endpointCount:I,selectorCount:T,imageDescs:M,endpointsData:Q,selectorsData:O,tablesData:V,extendedData:_},n}var vh={env:{emscripten_notify_memory_growth:function(e){ch=new Uint8Array(lh.exports.memory.buffer)}}},gh=function(){function e(){o(this,e)}return u(e,[{key:"init",value:function(){return sh||(sh="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Ah).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,vh)})).then(this._init):WebAssembly.instantiate(Buffer.from(Ah,"base64"),vh).then(this._init))}},{key:"_init",value:function(e){lh=e.instance,vh.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!lh)throw new Error("ZSTDDecoder: Await .init() before decoding.");var n=e.byteLength,i=lh.exports.malloc(n);ch.set(e,i),t=t||Number(lh.exports.ZSTD_findDecompressedSize(i,n));var o=lh.exports.malloc(t),r=lh.exports.ZSTD_decompress(o,t,i,n),a=ch.slice(o,o+r);return lh.exports.free(i),lh.exports.free(o),a}}]),e}(),Ah="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";function yh(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Eh,wh=new WeakMap,bh=0,Ch=function(t){f(i,t);var n=yh(i);function i(e){var t;return o(this,i),(t=n.call(this,e)).transcoderPath="",t.transcoderBinary=null,t.transcoderPending=null,t.workerPool=new uh,t.workerSourceURL="",t.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),t}return u(i,[{key:"setTranscoderPath",value:function(e){return this.transcoderPath=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerPool.setWorkerLimit(e),this}},{key:"detectSupport",value:function(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var n=new e.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);var o=n.loadAsync("basis_transcoder.js"),r=new e.FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);var a=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([o,a]).then((function(e){var n=ce(e,2),o=n[0],r=n[1],a=i.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(i.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(i.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(i.BasisFormat),"/* basis_transcoder.js */",o,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([s])),t.transcoderBinary=r,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),n=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:n},[n]),e}))})),bh>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),bh++}return this.transcoderPending}},{key:"load",value:function(t,n,i,o){var r=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var a=new e.FileLoader(this.manager);a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){if(wh.has(e))return wh.get(e).promise.then(n).catch(o);r._createTexture(e).then((function(e){return n?n(e):null})).catch(o)}),i,o)}},{key:"_createTextureFrom",value:function(t){var n=t.mipmaps,i=t.width,o=t.height,r=t.format,a=t.type,s=t.error,l=t.dfdTransferFn,c=t.dfdFlags;if("error"===a)return Promise.reject(s);var u=new e.CompressedTexture(n,i,o,r,e.UnsignedByteType);return u.minFilter=1===n.length?e.LinearFilter:e.LinearMipmapLinearFilter,u.magFilter=e.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.encoding=2===l?e.sRGBEncoding:e.LinearEncoding,u.premultiplyAlpha=!!(1&c),u}},{key:"_createTexture",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=mh(new Uint8Array(e));if(0!==i.vkFormat)return Bh(i);var o=n,r=this.init().then((function(){return t.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])})).then((function(e){return t._createTextureFrom(e.data)}));return wh.set(e,{promise:r}),r}},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),bh--,this}}]),i}(e.Loader);Ch.BasisFormat={ETC1S:0,UASTC_4x4:1},Ch.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},Ch.EngineFormat={RGBAFormat:e.RGBAFormat,RGBA_ASTC_4x4_Format:e.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:e.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:e.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:e.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:e.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:e.RGB_ETC1_Format,RGB_ETC2_Format:e.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:e.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:e.RGB_S3TC_DXT1_Format},Ch.BasisWorker=function(){var e,t,n,i=_EngineFormat,o=_TranscoderFormat,r=_BasisFormat;self.addEventListener("message",(function(a){var u,h=a.data;switch(h.type){case"init":e=h.config,u=h.transcoderBinary,t=new Promise((function(e){n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)})).then((function(){n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((function(){try{for(var t=function(t){var a=new n.KTX2File(new Uint8Array(t));function u(){a.close(),a.delete()}if(!a.isValid())throw u(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var h=a.isUASTC()?r.UASTC_4x4:r.ETC1S,d=a.getWidth(),p=a.getHeight(),f=a.getLevels(),m=a.getHasAlpha(),v=a.getDFDTransferFunc(),g=a.getDFDFlags(),A=function(t,n,a,u){for(var h,d,p=t===r.ETC1S?s:l,f=0;f<p.length;f++){var m=p[f];if(e[m.if]&&(m.basisFormat.includes(t)&&!(u&&m.transcoderFormat.length<2)&&(!m.needsPowerOfTwo||c(n)&&c(a))))return{transcoderFormat:h=m.transcoderFormat[u?1:0],engineFormat:d=m.engineFormat[u?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),h=o.RGBA32,d=i.RGBAFormat,{transcoderFormat:h,engineFormat:d}}(h,d,p,m),y=A.transcoderFormat,E=A.engineFormat;if(!d||!p||!f)throw u(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!a.startTranscoding())throw u(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var w=[],b=0;b<f;b++){var C=a.getImageLevelInfo(b,0,0),x=C.origWidth,I=C.origHeight,T=new Uint8Array(a.getImageTranscodedSizeInBytes(b,0,0,y));if(!a.transcodeImage(T,b,0,0,y,0,-1,-1))throw u(),new Error("THREE.KTX2Loader: .transcodeImage failed.");w.push({data:T,width:x,height:I})}return u(),{width:d,height:p,hasAlpha:m,mipmaps:w,format:E,dfdTransferFn:v,dfdFlags:g}}(h.buffer),a=t.width,u=t.height,d=t.hasAlpha,p=t.mipmaps,f=t.format,m=t.dfdTransferFn,v=t.dfdFlags,g=[],A=0;A<p.length;++A)g.push(p[A].data.buffer);self.postMessage({type:"transcode",id:h.id,width:a,height:u,hasAlpha:d,mipmaps:p,format:f,dfdTransferFn:m,dfdFlags:v},g)}catch(e){console.error(e),self.postMessage({type:"error",id:h.id,error:e.message})}}))}}));var a=[{if:"astcSupported",basisFormat:[r.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=a.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),l=a.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function c(e){return e<=2||0==(e&e-1)&&0!==e}};var xh={109:e.RGBAFormat,97:e.RGBAFormat,37:e.RGBAFormat,43:e.RGBAFormat,103:e.RGFormat,83:e.RGFormat,16:e.RGFormat,22:e.RGFormat,100:e.RedFormat,76:e.RedFormat,15:e.RedFormat,9:e.RedFormat},Ih={109:e.FloatType,97:e.HalfFloatType,37:e.UnsignedByteType,43:e.UnsignedByteType,103:e.FloatType,83:e.HalfFloatType,16:e.UnsignedByteType,22:e.UnsignedByteType,100:e.FloatType,76:e.HalfFloatType,15:e.UnsignedByteType,9:e.UnsignedByteType},Th={43:e.sRGBEncoding,22:e.sRGBEncoding,15:e.sRGBEncoding};function Bh(e){return kh.apply(this,arguments)}function kh(){return(kh=k(S.mark((function t(n){var i,o,r,a,s,l,c,u;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.vkFormat,o=n.pixelWidth,r=n.pixelHeight,a=n.pixelDepth,void 0!==xh[i]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(s=n.levels[0],0!==n.supercompressionScheme){t.next=8;break}l=s.levelData,t.next=16;break;case 8:if(2!==n.supercompressionScheme){t.next=15;break}return Eh||(Eh=new Promise(function(){var e=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new gh,e.next=3,n.init();case 3:t(n);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),t.next=12,Eh;case 12:l=t.sent.decode(s.levelData,s.uncompressedByteLength),t.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return c=Ih[i]===e.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Ih[i]===e.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(u=0===a?new e.DataTexture(c,o,r):new e.Data3DTexture(c,o,r,a)).type=Ih[i],u.format=xh[i],u.encoding=Th[i]||e.LinearEncoding,u.needsUpdate=!0,t.abrupt("return",Promise.resolve(u));case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Ph(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Rh=S.mark(vf),Mh=S.mark(Af),Sh=S.mark(db);function Dh(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Fh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fh(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Fh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Lh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Hh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lh(Object(n),!0).forEach((function(t){th(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Qh=THREE.GLTFLoader,Oh=window;
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */function Vh(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function _h(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Uh=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Nh="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Nh&&parseFloat(Nh[1]);var zh="3.1.4";function Gh(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var jh={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},Wh=jh.global||jh.self||jh.window||{},qh="object"!=typeof process||"[object process]"!==String(process)||process.browser,Jh="function"==typeof importScripts,Yh="undefined"!=typeof window&&void 0!==window.orientation,Zh="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);function Xh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Zh&&parseFloat(Zh[1]);var Kh=function(){function e(t,n){var i=this;o(this,e),Xh(this,"name",void 0),Xh(this,"workerThread",void 0),Xh(this,"isRunning",void 0),Xh(this,"result",void 0),Xh(this,"_resolve",void 0),Xh(this,"_reject",void 0),this.name=t,this.workerThread=n,this.isRunning=!0,this._resolve=function(){},this._reject=function(){},this.result=new Promise((function(e,t){i._resolve=e,i._reject=t}))}return u(e,[{key:"postMessage",value:function(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}},{key:"done",value:function(e){Gh(this.isRunning),this.isRunning=!1,this._resolve(e)}},{key:"error",value:function(e){Gh(this.isRunning),this.isRunning=!1,this._reject(e)}}]),e}(),$h=new Map;function ed(e){Gh(e.source&&!e.url||!e.source&&e.url);var t=$h.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return td((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),$h.set(e.url,t)),e.source&&(t=td(e.source),$h.set(e.source,t))),Gh(t),t}function td(e){var t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function nd(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=n||new Set;if(e){if(id(e))i.add(e);else if(id(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(var o in e)nd(e[o],t,i)}else;return void 0===n?Array.from(i):[]}function id(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var od=function(){},rd=function(){function e(t){o(this,e),Xh(this,"name",void 0),Xh(this,"source",void 0),Xh(this,"url",void 0),Xh(this,"terminated",!1),Xh(this,"worker",void 0),Xh(this,"onMessage",void 0),Xh(this,"onError",void 0),Xh(this,"_loadableURL","");var n=t.name,i=t.source,r=t.url;Gh(i||r),this.name=n,this.source=i,this.url=r,this.onMessage=od,this.onError=function(e){return console.log(e)},this.worker=this._createBrowserWorker()}return u(e,[{key:"destroy",value:function(){this.onMessage=od,this.onError=od,this.worker.terminate(),this.terminated=!0}},{key:"isRunning",get:function(){return Boolean(this.onMessage)}},{key:"postMessage",value:function(e,t){t=t||nd(e),this.worker.postMessage(e,t)}},{key:"_getErrorFromErrorEvent",value:function(e){var t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}},{key:"_createBrowserWorker",value:function(){var e=this;this._loadableURL=ed({source:this.source,url:this.url});var t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=function(t){t.data?e.onMessage(t.data):e.onError(new Error("No data received"))},t.onerror=function(t){e.onError(e._getErrorFromErrorEvent(t)),e.terminated=!0},t.onmessageerror=function(e){return console.error(e)},t}}],[{key:"isSupported",value:function(){return"undefined"!=typeof Worker}}]),e}(),ad=function(){function e(t){o(this,e),Xh(this,"name","unnamed"),Xh(this,"source",void 0),Xh(this,"url",void 0),Xh(this,"maxConcurrency",1),Xh(this,"maxMobileConcurrency",1),Xh(this,"onDebug",(function(){})),Xh(this,"reuseWorkers",!0),Xh(this,"props",{}),Xh(this,"jobQueue",[]),Xh(this,"idleQueue",[]),Xh(this,"count",0),Xh(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}var t,n;return u(e,[{key:"destroy",value:function(){this.idleQueue.forEach((function(e){return e.destroy()})),this.isDestroyed=!0}},{key:"setProps",value:function(e){this.props=Hh(Hh({},this.props),e),void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}},{key:"startJob",value:(n=k(S.mark((function e(t){var n,i,o,r=this,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:function(e,t,n){return e.done(n)},i=a.length>2&&void 0!==a[2]?a[2]:function(e,t){return e.error(t)},o=new Promise((function(e){return r.jobQueue.push({name:t,onMessage:n,onError:i,onStart:e}),r})),this._startQueuedJob(),e.next=6,o;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_startQueuedJob",value:(t=k(S.mark((function e(){var t,n,i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.jobQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(t=this._getAvailableWorker()){e.next=5;break}return e.abrupt("return");case 5:if(!(n=this.jobQueue.shift())){e.next=18;break}return this.onDebug({message:"Starting job",name:n.name,workerThread:t,backlog:this.jobQueue.length}),i=new Kh(n.name,t),t.onMessage=function(e){return n.onMessage(i,e.type,e.payload)},t.onError=function(e){return n.onError(i,e)},n.onStart(i),e.prev=12,e.next=15,i.result;case 15:return e.prev=15,this.returnWorkerToQueue(t),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[12,,15,18]])}))),function(){return t.apply(this,arguments)})},{key:"returnWorkerToQueue",value:function(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;var e="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new rd({name:e,source:this.source,url:this.url})}return null}},{key:"_getMaxConcurrency",value:function(){return Yh?this.maxMobileConcurrency:this.maxConcurrency}}]),e}(),sd={maxConcurrency:3,maxMobileConcurrency:1,onDebug:function(){},reuseWorkers:!0},ld=function(){function e(t){o(this,e),Xh(this,"props",void 0),Xh(this,"workerPools",new Map),this.props=Hh({},sd),this.setProps(t),this.workerPools=new Map}return u(e,[{key:"destroy",value:function(){var e,t=Dh(this.workerPools.values());try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(e){t.e(e)}finally{t.f()}}},{key:"setProps",value:function(e){this.props=Hh(Hh({},this.props),e);var t,n=Dh(this.workerPools.values());try{for(n.s();!(t=n.n()).done;){t.value.setProps(this._getWorkerPoolProps())}}catch(e){n.e(e)}finally{n.f()}}},{key:"getWorkerPool",value:function(e){var t=e.name,n=e.source,i=e.url,o=this.workerPools.get(t);return o||((o=new ad({name:t,source:n,url:i})).setProps(this._getWorkerPoolProps()),this.workerPools.set(t,o)),o}},{key:"_getWorkerPoolProps",value:function(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}],[{key:"isSupported",value:function(){return rd.isSupported()}},{key:"getWorkerFarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}}]),e}();Xh(ld,"_workerFarm",void 0);var cd="latest";function ud(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t[e.id]||{},i="".concat(e.id,"-worker.js"),o=n.workerUrl;if(o||"compression"!==e.id||(o=t.workerUrl),"test"===t._workerType&&(o="modules/".concat(e.module,"/dist/").concat(i)),!o){var r=e.version;"latest"===r&&(r=cd);var a=r?"@".concat(r):"";o="https://unpkg.com/@loaders.gl/".concat(e.module).concat(a,"/dist/").concat(i)}return Gh(o),o}function hd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zh;Gh(e,"no worker provided");var n=e.version;return!(!t||!n)}var dd={},pd=Object.freeze(Object.assign(Object.create(null),dd,{default:dd})),fd={};function md(e){return vd.apply(this,arguments)}function vd(){return(vd=k(S.mark((function e(t){var n,i,o=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:null,i=o.length>2&&void 0!==o[2]?o[2]:{},n&&(t=gd(t,n,i)),fd[t]=fd[t]||Ad(t),e.next=6,fd[t];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gd(e,t,n){if(e.startsWith("http"))return e;var i=n.modules||{};return i[e]?i[e]:qh?n.CDN?(Gh(n.CDN.startsWith("http")),"".concat(n.CDN,"/").concat(t,"@").concat("3.1.4","/dist/libs/").concat(e)):Jh?"../src/libs/".concat(e):"modules/".concat(t,"/src/libs/").concat(e):"modules/".concat(t,"/dist/libs/").concat(e)}function Ad(e){return yd.apply(this,arguments)}function yd(){return(yd=k(S.mark((function e(t){var n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.endsWith("wasm")){e.next=7;break}return e.next=3,fetch(t);case 3:return n=e.sent,e.next=6,n.arrayBuffer();case 6:return e.abrupt("return",e.sent);case 7:if(qh){e.next=20;break}if(e.prev=8,e.t0=pd&&dd.requireFromFile,!e.t0){e.next=14;break}return e.next=13,dd.requireFromFile(t);case 13:e.t0=e.sent;case 14:return e.abrupt("return",e.t0);case 17:return e.prev=17,e.t1=e.catch(8),e.abrupt("return",null);case 20:if(!Jh){e.next=22;break}return e.abrupt("return",importScripts(t));case 22:return e.next=24,fetch(t);case 24:return i=e.sent,e.next=27,i.text();case 27:return o=e.sent,e.abrupt("return",Ed(o,t));case 29:case"end":return e.stop()}}),e,null,[[8,17]])})))).apply(this,arguments)}function Ed(e,t){if(!qh)return dd.requireFromString&&dd.requireFromString(e,t);if(Jh)return eval.call(Wh,e),null;var n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch(t){n.text=e}return document.body.appendChild(n),null}function wd(e,t){return!!ld.isSupported()&&(e.worker&&(null==t?void 0:t.worker))}function bd(e,t,n,i,o){return Cd.apply(this,arguments)}function Cd(){return(Cd=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.id,s=ud(t,i),l=ld.getWorkerFarm(i),c=l.getWorkerPool({name:a,url:s}),i=JSON.parse(JSON.stringify(i)),e.next=7,c.startJob("process-on-worker",xd.bind(null,r));case 7:return(u=e.sent).postMessage("process",{input:n,options:i}),e.next=11,u.result;case 11:return h=e.sent,e.next=14,h.result;case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xd(e,t,n,i){return Id.apply(this,arguments)}function Id(){return(Id=k(S.mark((function e(t,n,i,o){var r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=i,e.next="done"===e.t0?3:"error"===e.t0?5:"process"===e.t0?7:20;break;case 3:return n.done(o),e.abrupt("break",21);case 5:return n.error(new Error(o.error)),e.abrupt("break",21);case 7:return r=o.id,a=o.input,s=o.options,e.prev=8,e.next=11,t(a,s);case 11:l=e.sent,n.postMessage("done",{id:r,result:l}),e.next=19;break;case 15:e.prev=15,e.t1=e.catch(8),c=e.t1 instanceof Error?e.t1.message:"unknown error",n.postMessage("error",{id:r,error:c});case 19:return e.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(i));case 21:case"end":return e.stop()}}),e,null,[[8,15]])})))).apply(this,arguments)}function Td(e,t,n){if(e.byteLength<=t+n)return"";for(var i=new DataView(e),o="",r=0;r<n;r++)o+=String.fromCharCode(i.getUint8(t+r));return o}function Bd(e){try{return JSON.parse(e)}catch(t){throw new Error('Failed to parse JSON from data starting with "'.concat(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Td(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Td(e,0,t)}return""}(e),'"'))}}function kd(e){return e&&"object"==typeof e&&e.isBuffer}function Pd(e){if(kd(e))return kd(t=e)?new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer:t;var t;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){var n=e;return(new TextEncoder).encode(n).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Rd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i,o=t.map((function(e){return e instanceof ArrayBuffer?new Uint8Array(e):e})),r=o.reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(r),s=0,l=Dh(o);try{for(l.s();!(i=l.n()).done;){var c=i.value;a.set(c,s),s+=c.byteLength}}catch(e){l.e(e)}finally{l.f()}return a.buffer}function Md(e,t,n){var i=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(i).buffer}function Sd(e,t){return _h(e>=0),_h(t>0),e+(t-1)&~(t-1)}function Dd(e,t,n){var i;if(e instanceof ArrayBuffer)i=new Uint8Array(e);else{var o=e.byteOffset,r=e.byteLength;i=new Uint8Array(e.buffer||e.arrayBuffer,o,r)}return t.set(i,n),n+Sd(i.byteLength,4)}function Fd(e){var t,n,i,o,r,a,s;return S.async((function(l){for(;;)switch(l.prev=l.next){case 0:t=[],n=!1,i=!1,l.prev=3,r=ah(e);case 5:return l.next=7,S.awrap(r.next());case 7:if(!(n=!(a=l.sent).done)){l.next=13;break}s=a.value,t.push(s);case 10:n=!1,l.next=5;break;case 13:l.next=19;break;case 15:l.prev=15,l.t0=l.catch(3),i=!0,o=l.t0;case 19:if(l.prev=19,l.prev=20,!n||null==r.return){l.next=24;break}return l.next=24,S.awrap(r.return());case 24:if(l.prev=24,!i){l.next=27;break}throw o;case 27:return l.finish(24);case 28:return l.finish(19);case 29:return l.abrupt("return",Rd.apply(void 0,t));case 30:case"end":return l.stop()}}),null,null,[[3,15,19,29],[20,,24,28]],Promise)}function Ld(){var e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){var t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}var Hd=function(){function e(t,n){o(this,e),Xh(this,"name",void 0),Xh(this,"type",void 0),Xh(this,"sampleSize",1),Xh(this,"time",void 0),Xh(this,"count",void 0),Xh(this,"samples",void 0),Xh(this,"lastTiming",void 0),Xh(this,"lastSampleTime",void 0),Xh(this,"lastSampleCount",void 0),Xh(this,"_count",0),Xh(this,"_time",0),Xh(this,"_samples",0),Xh(this,"_startTime",0),Xh(this,"_timerPending",!1),this.name=t,this.type=n,this.reset()}return u(e,[{key:"setSampleSize",value:function(e){return this.sampleSize=e,this}},{key:"incrementCount",value:function(){return this.addCount(1),this}},{key:"decrementCount",value:function(){return this.subtractCount(1),this}},{key:"addCount",value:function(e){return this._count+=e,this._samples++,this._checkSampling(),this}},{key:"subtractCount",value:function(e){return this._count-=e,this._samples++,this._checkSampling(),this}},{key:"addTime",value:function(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}},{key:"timeStart",value:function(){return this._startTime=Ld(),this._timerPending=!0,this}},{key:"timeEnd",value:function(){return this._timerPending?(this.addTime(Ld()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}},{key:"getSampleAverageCount",value:function(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}},{key:"getSampleAverageTime",value:function(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}},{key:"getSampleHz",value:function(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}},{key:"getAverageCount",value:function(){return this.samples>0?this.count/this.samples:0}},{key:"getAverageTime",value:function(){return this.samples>0?this.time/this.samples:0}},{key:"getHz",value:function(){return this.time>0?this.samples/(this.time/1e3):0}},{key:"reset",value:function(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}},{key:"_checkSampling",value:function(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}]),e}(),Qd=function(){function e(t){o(this,e),Xh(this,"id",void 0),Xh(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}return u(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}},{key:"size",get:function(){return Object.keys(this.stats).length}},{key:"reset",value:function(){for(var e in this.stats)this.stats[e].reset();return this}},{key:"forEach",value:function(e){for(var t in this.stats)e(this.stats[t])}},{key:"getTable",value:function(){var e={};return this.forEach((function(t){e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}})),e}},{key:"_initializeStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){return e._getOrCreate(t)}))}},{key:"_getOrCreate",value:function(e){if(!e||!e.name)return null;var t=e.name,n=e.type;return this.stats[t]||(this.stats[t]=e instanceof Hd?e:new Hd(t,n)),this.stats[t]}}]),e}(),Od="Queued Requests",Vd="Active Requests",_d="Cancelled Requests",Ud="Queued Requests Ever",Nd="Active Requests Ever",zd={id:"request-scheduler",throttleRequests:!0,maxRequests:6},Gd=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Xh(this,"props",void 0),Xh(this,"stats",void 0),Xh(this,"activeRequestCount",0),Xh(this,"requestQueue",[]),Xh(this,"requestMap",new Map),Xh(this,"deferredUpdate",null),this.props=Hh(Hh({},zd),t),this.stats=new Qd({id:this.props.id}),this.stats.get(Od),this.stats.get(Vd),this.stats.get(_d),this.stats.get(Ud),this.stats.get(Nd)}return u(e,[{key:"scheduleRequest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return 0};if(!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(e))return this.requestMap.get(e);var n={handle:e,priority:0,getPriority:t},i=new Promise((function(e){return n.resolve=e,n}));return this.requestQueue.push(n),this.requestMap.set(e,i),this._issueNewRequests(),i}},{key:"_issueRequest",value:function(e){var t=this,n=e.handle,i=e.resolve,o=!1,r=function(){o||(o=!0,t.requestMap.delete(n),t.activeRequestCount--,t._issueNewRequests())};return this.activeRequestCount++,i?i({done:r}):Promise.resolve({done:r})}},{key:"_issueNewRequests",value:function(){var e=this;this.deferredUpdate||(this.deferredUpdate=setTimeout((function(){return e._issueNewRequestsAsync()}),0))}},{key:"_issueNewRequestsAsync",value:function(){this.deferredUpdate=null;var e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(var t=0;t<e;++t){var n=this.requestQueue.shift();n&&this._issueRequest(n)}}}},{key:"_updateAllRequests",value:function(){for(var e=this.requestQueue,t=0;t<e.length;++t){var n=e[t];this._updateRequest(n)||(e.splice(t,1),this.requestMap.delete(n.handle),t--)}e.sort((function(e,t){return e.priority-t.priority}))}},{key:"_updateRequest",value:function(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}]),e}(),jd={};function Wd(e){for(var t in jd)if(e.startsWith(t)){var n=jd[t];e=e.replace(t,n)}return e.startsWith("http://")||e.startsWith("https://")||(e="".concat("").concat(e)),e}function qd(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}var Jd=function(e){return"function"==typeof e},Yd=function(e){return null!==e&&"object"==typeof e},Zd=function(e){return Yd(e)&&e.constructor==={}.constructor},Xd=function(e){return e&&"function"==typeof e[Symbol.iterator]},Kd=function(e){return e&&"function"==typeof e[Symbol.asyncIterator]},$d=function(e){return"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json},ep=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},tp=function(e){return function(e){return"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Yd(e)&&Jd(e.tee)&&Jd(e.cancel)&&Jd(e.getReader)}(e)||function(e){return Yd(e)&&Jd(e.read)&&Jd(e.pipe)&&function(e){return"boolean"==typeof e}(e.readable)}(e)},np=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,ip=/^([-\w.]+\/[-\w.+]+)/;function op(e){var t=ip.exec(e);return t?t[1]:e}function rp(e){var t=np.exec(e);return t?t[1]:""}var ap=/\?.*/;function sp(e){if($d(e)){var t=cp(e.url||"");return{url:t,type:op(e.headers.get("content-type")||"")||rp(t)}}return ep(e)?{url:cp(e.name||""),type:e.type||""}:"string"==typeof e?{url:cp(e),type:rp(e)}:{url:"",type:""}}function lp(e){return $d(e)?e.headers["content-length"]||-1:ep(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}function cp(e){return e.replace(ap,"")}function up(e){return hp.apply(this,arguments)}function hp(){return(hp=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!$d(t)){e.next=2;break}return e.abrupt("return",t);case 2:return n={},(i=lp(t))>=0&&(n["content-length"]=String(i)),o=sp(t),r=o.url,(a=o.type)&&(n["content-type"]=a),e.next=9,vp(t);case 9:return(s=e.sent)&&(n["x-first-bytes"]=s),"string"==typeof t&&(t=(new TextEncoder).encode(t)),l=new Response(t,{headers:n}),Object.defineProperty(l,"url",{value:r}),e.abrupt("return",l);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dp(e){return pp.apply(this,arguments)}function pp(){return(pp=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=5;break}return e.next=3,fp(t);case 3:throw n=e.sent,new Error(n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fp(e){return mp.apply(this,arguments)}function mp(){return(mp=k(S.mark((function e(t){var n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n="Failed to fetch resource ".concat(t.url," (").concat(t.status,"): "),e.prev=1,i=t.headers.get("Content-Type"),o=t.statusText,!i.includes("application/json")){e.next=11;break}return e.t0=o,e.t1=" ",e.next=9,t.text();case 9:e.t2=e.sent,o=e.t0+=e.t1.concat.call(e.t1,e.t2);case 11:n=(n+=o).length>60?"".concat(n.slice(60),"..."):n,e.next=17;break;case 15:e.prev=15,e.t3=e.catch(1);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function vp(e){return gp.apply(this,arguments)}function gp(){return(gp=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=5,"string"!=typeof t){e.next=3;break}return e.abrupt("return","data:,".concat(t.slice(0,n)));case 3:if(!(t instanceof Blob)){e.next=8;break}return i=t.slice(0,5),e.next=7,new Promise((function(e){var t=new FileReader;t.onload=function(t){var n;return e(null==t||null===(n=t.target)||void 0===n?void 0:n.result)},t.readAsDataURL(i)}));case 7:return e.abrupt("return",e.sent);case 8:if(!(t instanceof ArrayBuffer)){e.next=12;break}return o=t.slice(0,n),r=Ap(o),e.abrupt("return","data:base64,".concat(r));case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ap(e){for(var t="",n=new Uint8Array(e),i=0;i<n.byteLength;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function yp(e,t){return Ep.apply(this,arguments)}function Ep(){return(Ep=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=7;break}return t=Wd(t),i=n,null!=n&&n.fetch&&"function"!=typeof(null==n?void 0:n.fetch)&&(i=n.fetch),e.next=6,fetch(t,i);case 6:return e.abrupt("return",e.sent);case 7:return e.next=9,up(t);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wp(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;var t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}()}var bp={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},Cp=bp.window||bp.self||bp.global,xp=bp.process||{},Ip="4.10.6";function Tp(e){try{var t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch(e){return null}}wp();var Bp,kp=function(){function e(t){o(this,e);var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";Xh(this,"storage",void 0),Xh(this,"id",void 0),Xh(this,"config",{}),this.storage=Tp(i),this.id=t,this.config={},Object.assign(this.config,n),this._loadConfiguration()}return u(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function Pp(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(n=Math.min(n,i/e.width));var r=e.width*n,a=e.height*n,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(r/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(r,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}function Rp(e){return"string"==typeof e?Bp[e.toUpperCase()]||Bp.WHITE:e}function Mp(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],i=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(i),r=Dh(o);try{var a=function(){var i=t.value;"function"==typeof e[i]&&(n.find((function(e){return i===e}))||(e[i]=e[i].bind(e)))};for(r.s();!(t=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}function Sp(e,t){if(!e)throw new Error(t||"Assertion failed")}function Dp(){var e,t,n;if(wp&&"performance"in Cp)e=null==Cp||null===(t=Cp.performance)||void 0===t||null===(n=t.now)||void 0===n?void 0:n.call(t);else if("hrtime"in xp){var i,o=null==xp||null===(i=xp.hrtime)||void 0===i?void 0:i.call(xp);e=1e3*o[0]+o[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Bp||(Bp={}));var Fp={debug:wp&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Lp={enabled:!0,level:0};function Hp(){}var Qp={},Op={once:!0},Vp=function(){function e(){o(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},n=t.id;Xh(this,"id",void 0),Xh(this,"VERSION",Ip),Xh(this,"_startTs",Dp()),Xh(this,"_deltaTs",Dp()),Xh(this,"_storage",void 0),Xh(this,"userData",{}),Xh(this,"LOG_THROTTLE_TIMEOUT",0),this.id=n,this._storage=new kp("__probe-".concat(this.id,"__"),Lp),this.userData={},this.timeStamp("".concat(this.id," started")),Mp(this),Object.seal(this)}return u(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((Dp()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((Dp()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration({[e]:t})}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"assert",value:function(e,t){Sp(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,Fp.warn,arguments,Op)}},{key:"error",value:function(e){return this._getLogFunction(0,e,Fp.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,Fp.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,Fp.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return this._getLogFunction(e,t,Fp.debug||Fp.info,arguments,Op)}},{key:"table",value:function(e,t,n){return t?this._getLogFunction(e,t,console.table||Hp,n&&[n],{tag:Np(t)}):Hp}},{key:"image",value:function(e){var t=e.logLevel,n=e.priority,i=e.image,o=e.message,r=void 0===o?"":o,a=e.scale,s=void 0===a?1:a;return this._shouldLog(t||n)?wp?function(e){var t=e.image,n=e.message,i=void 0===n?"":n,o=e.scale,r=void 0===o?1:o;if("string"==typeof t){var a=new Image;return a.onload=function(){var e,t=Pp(a,i,r);(e=console).log.apply(e,H(t))},a.src=t,Hp}var s=t.nodeName||"";if("img"===s.toLowerCase()){var l;return(l=console).log.apply(l,H(Pp(t,i,r))),Hp}if("canvas"===s.toLowerCase()){var c=new Image;return c.onload=function(){var e;return(e=console).log.apply(e,H(Pp(c,i,r)))},c.src=t.toDataURL(),Hp}return Hp}({image:i,message:r,scale:s}):function(e){var t=e.image;e.message;var n=e.scale,i=void 0===n?1:n,o=null;try{o=module.require("asciify-image")}catch(e){}if(o)return function(){return o(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((function(e){return console.log(e)}))};return Hp}({image:i,message:r,scale:s}):Hp}},{key:"time",value:function(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}},{key:"timeEnd",value:function(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(e,t){return this._getLogFunction(e,t,console.timeStamp||Hp)}},{key:"group",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},i=Up({logLevel:e,message:t,opts:n}),o=n.collapsed;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}},{key:"groupCollapsed",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},n,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||Hp)}},{key:"withGroup",value:function(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=_p(e)}},{key:"_getLogFunction",value:function(e,t,n,i,o){if(this._shouldLog(e)){var r;o=Up({logLevel:e,message:t,args:i,opts:o}),Sp(n=n||o.method),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Dp();var a=o.tag||o.message;if(o.once){if(Qp[a])return Hp;Qp[a]=Dp()}return t=function(e,t,n){if("string"==typeof t){var i=n.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}((s=n.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=n.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),o=t,r=n.color,a=n.background,wp||"string"!=typeof o||(r&&(r=Rp(r),o="[".concat(r,"m").concat(o,"[39m")),a&&(r=Rp(a),o="[".concat(a+10,"m").concat(o,"[49m"))),t=o}var o,r,a;var s;return t}(this.id,o.message,o),(r=n).bind.apply(r,[console,t].concat(H(o.args)))}return Hp}}]),e}();function _p(e){if(!e)return 0;var t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Sp(Number.isFinite(t)&&t>=0),t}function Up(e){var t=e.logLevel,n=e.message;e.logLevel=_p(t);for(var i=e.args?Array.from(e.args):[];i.length&&i.shift()!==n;);switch(typeof t){case"string":case"function":void 0!==n&&i.unshift(n),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var o=typeof e.message;return Sp("string"===o||"object"===o),Object.assign(e,{args:i},e.opts)}function Np(e){for(var t in e)for(var n in e[t])return n||"untitled";return"empty"}Xh(Vp,"VERSION",Ip);var zp=new Vp({id:"loaders.gl"}),Gp=function(){function e(){o(this,e)}return u(e,[{key:"log",value:function(){return function(){}}},{key:"info",value:function(){return function(){}}},{key:"warn",value:function(){return function(){}}},{key:"error",value:function(){return function(){}}}]),e}(),jp={fetch:null,mimeType:void 0,nothrow:!1,log:new(function(){function e(){o(this,e),Xh(this,"console",void 0),this.console=console}return u(e,[{key:"log",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.log).bind.apply(e,[this.console].concat(n))}},{key:"info",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.info).bind.apply(e,[this.console].concat(n))}},{key:"warn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.warn).bind.apply(e,[this.console].concat(n))}},{key:"error",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.error).bind.apply(e,[this.console].concat(n))}}]),e}()),CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Wp={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function qp(){Oh.loaders=Oh.loaders||{};var e=Oh.loaders;return e._state=e._state||{},e._state}var Jp=function(){var e=qp();return e.globalOptions=e.globalOptions||Hh({},jp),e.globalOptions};function Yp(e,t,n,i){return n=n||[],function(e,t){Xp(e,null,jp,Wp,t);var n,i=Dh(t);try{for(i.s();!(n=i.n()).done;){var o=n.value,r=e&&e[o.id]||{},a=o.options&&o.options[o.id]||{},s=o.deprecatedOptions&&o.deprecatedOptions[o.id]||{};Xp(r,o.id,a,s,t)}}catch(e){i.e(e)}finally{i.f()}}(e,n=Array.isArray(n)?n:[n]),function(e,t,n){var i=Hh({},e.options||{});(function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)})(i,n),null===i.log&&(i.log=new Gp);return $p(i,Jp()),$p(i,t),i}(t,e,i)}function Zp(e,t){var n=Jp(),i=e||n;return"function"==typeof i.fetch?i.fetch:Yd(i.fetch)?function(e){return yp(e,i)}:null!=t&&t.fetch?null==t?void 0:t.fetch:yp}function Xp(e,t,n,i,o){var r=t||"Top level",a=t?"".concat(t,"."):"";for(var s in e){var l=!t&&Yd(e[s]);if(!(s in n)&&!("baseUri"===s&&!t)&&!("workerUrl"===s&&t))if(s in i)zp.warn("".concat(r," loader option '").concat(a).concat(s,"' no longer supported, use '").concat(i[s],"'"))();else if(!l){var c=Kp(s,o);zp.warn("".concat(r," loader option '").concat(a).concat(s,"' not recognized. ").concat(c))()}}}function Kp(e,t){var n,i=e.toLowerCase(),o="",r=Dh(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;for(var s in a.options){if(e===s)return"Did you mean '".concat(a.id,".").concat(s,"'?");var l=s.toLowerCase();(i.startsWith(l)||l.startsWith(i))&&(o=o||"Did you mean '".concat(a.id,".").concat(s,"'?"))}}}catch(e){r.e(e)}finally{r.f()}return o}function $p(e,t){for(var n in t)if(n in t){var i=t[n];Zd(i)&&Zd(e[n])?e[n]=Hh(Hh({},e[n]),t[n]):e[n]=t[n]}}function ef(e){var t;return!!e&&(Array.isArray(e)&&(e=e[0]),Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions))}function tf(e){var t,n,i;return _h(e,"null loader"),_h(ef(e),"invalid loader"),Array.isArray(e)&&(i=e[1],e=Hh(Hh({},e=e[0]),{},{options:Hh(Hh({},e.options),i)})),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(n=e)&&void 0!==n&&n.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}function nf(){return(e=qp()).loaderRegistry=e.loaderRegistry||[],e.loaderRegistry;var e}var of=/\.([^.]+)$/;function rf(e){return af.apply(this,arguments)}function af(){return(af=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:[],i=a.length>2?a[2]:void 0,o=a.length>3?a[3]:void 0,cf(t)){e.next=5;break}return e.abrupt("return",null);case 5:if(!(r=sf(t,n,Hh(Hh({},i),{},{nothrow:!0}),o))){e.next=8;break}return e.abrupt("return",r);case 8:if(!ep(t)){e.next=13;break}return e.next=11,t.slice(0,10).arrayBuffer();case 11:t=e.sent,r=sf(t,n,i,o);case 13:if(r||null!=i&&i.nothrow){e.next=15;break}throw new Error(uf(t));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!cf(e))return null;if(t&&!Array.isArray(t))return tf(t);var o,r=[];(t&&(r=r.concat(t)),null!=n&&n.ignoreRegisteredLoaders)||(o=r).push.apply(o,H(nf()));hf(r);var a=lf(e,r,n,i);if(!(a||null!=n&&n.nothrow))throw new Error(uf(e));return a}function lf(e,t,n,i){var o=sp(e),r=o.url,a=o.type,s=r||(null==i?void 0:i.url),l=null;return null!=n&&n.mimeType&&(l=df(t,null==n?void 0:n.mimeType)),l=(l=(l=(l=l||function(e,t){var n=t&&of.exec(t),i=n&&n[1];return i?function(e,t){t=t.toLowerCase();var n,i=Dh(e);try{for(i.s();!(n=i.n()).done;){var o,r=n.value,a=Dh(r.extensions);try{for(a.s();!(o=a.n()).done;){if(o.value.toLowerCase()===t)return r}}catch(e){a.e(e)}finally{a.f()}}}catch(e){i.e(e)}finally{i.f()}return null}(e,i):null}(t,s))||df(t,a))||function(e,t){if(!t)return null;var n,i=Dh(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;if("string"==typeof t){if(pf(t,o))return o}else if(ArrayBuffer.isView(t)){if(ff(t.buffer,t.byteOffset,o))return o}else if(t instanceof ArrayBuffer){if(ff(t,0,o))return o}}}catch(e){i.e(e)}finally{i.f()}return null}(t,e))||df(t,null==n?void 0:n.fallbackMimeType)}function cf(e){return!(e instanceof Response&&204===e.status)}function uf(e){var t=sp(e),n=t.url,i=t.type,o="No valid loader found (";o+=n?"".concat(function(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(n),", "):"no url provided, ",o+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");var r=e?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return mf(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer)return mf(e,0,t);return""}(e):"";return o+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",o+=")"}function hf(e){var t,n=Dh(e);try{for(n.s();!(t=n.n()).done;){tf(t.value)}}catch(e){n.e(e)}finally{n.f()}}function df(e,t){var n,i=Dh(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.mimeTypes&&o.mimeTypes.includes(t))return o;if(t==="application/x.".concat(o.id))return o}}catch(e){i.e(e)}finally{i.f()}return null}function pf(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some((function(t){return e.startsWith(t)}))}function ff(e,t,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((function(i){return function(e,t,n,i){if(i instanceof ArrayBuffer)return function(e,t,n){if(n=n||e.byteLength,e.byteLength<n||t.byteLength<n)return!1;for(var i=new Uint8Array(e),o=new Uint8Array(t),r=0;r<i.length;++r)if(i[r]!==o[r])return!1;return!0}(i,e,i.byteLength);switch(typeof i){case"function":return i(e,n);case"string":return i===mf(e,t,i.length);default:return!1}}(e,t,n,i)}))}function mf(e,t,n){if(e.byteLength<t+n)return"";for(var i=new DataView(e),o="",r=0;r<n;r++)o+=String.fromCharCode(i.getUint8(t+r));return o}function vf(e,t){var n,i,o,r,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:n=(null==t?void 0:t.chunkSize)||262144,i=0,o=new TextEncoder;case 3:if(!(i<e.length)){s.next=11;break}return r=Math.min(e.length-i,n),a=e.slice(i,i+r),i+=r,s.next=9,o.encode(a);case 9:s.next=3;break;case 11:case"end":return s.stop()}}),Rh)}var gf=262144;function Af(e){var t,n,i,o,r,a,s,l=arguments;return S.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:t=l.length>1&&void 0!==l[1]?l[1]:{},n=t.chunkSize,i=void 0===n?gf:n,o=0;case 3:if(!(o<e.byteLength)){c.next=14;break}return r=Math.min(e.byteLength-o,i),a=new ArrayBuffer(r),s=new Uint8Array(e,o,r),new Uint8Array(a).set(s),o+=r,c.next=12,a;case 12:c.next=3;break;case 14:case"end":return c.stop()}}),Mh)}var yf=1048576;function Ef(){return(Ef=rh(S.mark((function e(t,n){var i,o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=(null==n?void 0:n.chunkSize)||yf,o=0;case 2:if(!(o<t.size)){e.next=12;break}return r=o+i,e.next=6,ih(t.slice(o,r).arrayBuffer());case 6:return a=e.sent,o=r,e.next=10,a;case 10:e.next=2;break;case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wf(e,t){return Uh?function(e,t){return bf.apply(this,arguments)}(e,t):function(e,t){return Cf.apply(this,arguments)}(e)}function bf(){return(bf=rh(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.getReader(),e.prev=1;case 2:return r=o||i.read(),null!=n&&n._streamReadAhead&&(o=i.read()),e.next=7,ih(r);case 7:if(a=e.sent,s=a.done,l=a.value,!s){e.next=12;break}return e.abrupt("return");case 12:return e.next=14,Pd(l);case 14:e.next=2;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),i.releaseLock();case 21:case"end":return e.stop()}}),e,null,[[1,18]])})))).apply(this,arguments)}function Cf(){return(Cf=rh(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=!1,o=!1,e.prev=2,a=ah(t);case 4:return e.next=6,ih(a.next());case 6:if(!(i=!(s=e.sent).done)){e.next=13;break}return l=s.value,e.next=10,Pd(l);case 10:i=!1,e.next=4;break;case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(2),o=!0,r=e.t0;case 19:if(e.prev=19,e.prev=20,!i||null==a.return){e.next=24;break}return e.next=24,ih(a.return());case 24:if(e.prev=24,!o){e.next=27;break}throw r;case 27:return e.finish(24);case 28:return e.finish(19);case 29:case"end":return e.stop()}}),e,null,[[2,15,19,29],[20,,24,28]])})))).apply(this,arguments)}function xf(e,t){if("string"==typeof e)return vf(e,t);if(e instanceof ArrayBuffer)return Af(e,t);if(ep(e))return function(e,t){return Ef.apply(this,arguments)}(e,t);if(tp(e))return wf(e,t);if($d(e))return wf(e.body,t);throw new Error("makeIterator")}var If="Cannot convert supplied data type";function Tf(e,t,n){if(t.text&&"string"==typeof e)return e;if(function(e){return e&&"object"==typeof e&&e.isBuffer}(e)&&(e=e.buffer),e instanceof ArrayBuffer){var i=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);var o=e.buffer,r=e.byteLength||e.length;return 0===e.byteOffset&&r===o.byteLength||(o=o.slice(e.byteOffset,e.byteOffset+r)),o}throw new Error(If)}function Bf(e,t,n){return kf.apply(this,arguments)}function kf(){return(kf=k(S.mark((function e(t,n,i){var o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t instanceof ArrayBuffer||ArrayBuffer.isView(t),"string"!=typeof t&&!o){e.next=3;break}return e.abrupt("return",Tf(t,n));case 3:if(!ep(t)){e.next=7;break}return e.next=6,up(t);case 6:t=e.sent;case 7:if(!$d(t)){e.next=21;break}return r=t,e.next=11,dp(r);case 11:if(!n.binary){e.next=17;break}return e.next=14,r.arrayBuffer();case 14:e.t0=e.sent,e.next=20;break;case 17:return e.next=19,r.text();case 19:e.t0=e.sent;case 20:return e.abrupt("return",e.t0);case 21:if(tp(t)&&(t=xf(t,i)),!Xd(t)&&!Kd(t)){e.next=24;break}return e.abrupt("return",Fd(t));case 24:throw new Error(If);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(n)return n;var i=Hh({fetch:Zp(t,e)},e);return Array.isArray(i.loaders)||(i.loaders=null),i}function Rf(e,t){if(!t&&e&&!Array.isArray(e))return e;var n;if(e&&(n=Array.isArray(e)?e:[e]),t&&t.loaders){var i=Array.isArray(t.loaders)?t.loaders:[t.loaders];n=n?[].concat(H(n),H(i)):i}return n&&n.length?n:null}function Mf(e,t,n,i){return Sf.apply(this,arguments)}function Sf(){return(Sf=k(S.mark((function e(t,n,i,o){var r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Gh(!o||"object"==typeof o),!n||Array.isArray(n)||ef(n)||(o=void 0,i=n,n=void 0),e.next=4,t;case 4:return t=e.sent,i=i||{},r=sp(t),a=r.url,s=Rf(n,o),e.next=11,rf(t,s,i);case 11:if(l=e.sent){e.next=14;break}return e.abrupt("return",null);case 14:return i=Yp(i,l,s,a),o=Pf({url:a,parse:Mf,loaders:s},i,o),e.next=18,Df(l,t,i,o);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Df(e,t,n,i){return Ff.apply(this,arguments)}function Ff(){return(Ff=k(S.mark((function e(t,n,i,o){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hd(t),e.next=3,Bf(n,t,i);case 3:if(n=e.sent,!t.parseTextSync||"string"!=typeof n){e.next=7;break}return i.dataType="text",e.abrupt("return",t.parseTextSync(n,i,o,t));case 7:if(!wd(t,i)){e.next=11;break}return e.next=10,bd(t,n,i,o,Mf);case 10:return e.abrupt("return",e.sent);case 11:if(!t.parseText||"string"!=typeof n){e.next=15;break}return e.next=14,t.parseText(n,i,o,t);case 14:return e.abrupt("return",e.sent);case 15:if(!t.parse){e.next=19;break}return e.next=18,t.parse(n,i,o,t);case 18:return e.abrupt("return",e.sent);case 19:throw Gh(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"));case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lf(e,t,n,i){return Hf.apply(this,arguments)}function Hf(){return(Hf=k(S.mark((function e(t,n,i,o){var r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Array.isArray(n)||ef(n)||(i=n,n=void 0),r=Zp(i),a=t,"string"!=typeof t){e.next=7;break}return e.next=6,r(t);case 6:a=e.sent;case 7:if(!ep(t)){e.next=11;break}return e.next=10,r(t);case 10:a=e.sent;case 11:return e.next=13,Mf(a,n,i);case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qf(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Of=1/Math.PI*180,Vf=1/180*Math.PI,_f={};function Uf(e){return Math.round(e/_f.EPSILON)*_f.EPSILON}function Nf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.precision,i=void 0===n?_f.precision||4:n;return e=Uf(e),"".concat(parseFloat(e.toPrecision(i)))}function zf(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gf(e,t,n){if(zf(e)){n=n||((o=e).clone?o.clone():new Array(o.length));for(var i=0;i<n.length&&i<e.length;++i)n[i]=t(e[i],i,n);return n}var o;return t(e)}function jf(e){return function(e,t){return Gf(e,(function(e){return e*Vf}),t)}(e)}function Wf(e){return qf(e)}function qf(e,t){return Gf(e,(function(e){return e*Of}),t)}function Jf(e,t,n){return Gf(e,(function(e){return Math.max(t,Math.min(n,e))}))}function Yf(e,t,n){var i=_f.EPSILON;n&&(_f.EPSILON=n);try{if(e===t)return!0;if(zf(e)&&zf(t)){if(e.length!==t.length)return!1;for(var o=0;o<e.length;++o)if(!Yf(e[o],t[o]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=_f.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{_f.EPSILON=i}}_f.EPSILON=1e-12,_f.debug=!1,_f.precision=4,_f.printTypes=!1,_f.printDegrees=!1,_f.printRowMajor=!0;var Zf=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Qf(!1),0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"from",value:function(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}},{key:"to",value:function(e){return e===this?this:zf(e)?this.toArray(e):this.toObject(e)}},{key:"toTarget",value:function(e){return e?this.to(e):this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}},{key:"toFloat32Array",value:function(){return new Float32Array(this)}},{key:"toString",value:function(){return this.formatString(_f)}},{key:"formatString",value:function(e){for(var t="",n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+Nf(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}},{key:"equals",value:function(e){if(!e||this.length!==e.length)return!1;for(var t=0;t<this.ELEMENTS;++t)if(!Yf(this[t],e[t]))return!1;return!0}},{key:"exactEquals",value:function(e){if(!e||this.length!==e.length)return!1;for(var t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}},{key:"negate",value:function(){for(var e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}},{key:"lerp",value:function(e,t,n){void 0===n&&(n=t,t=e,e=this);for(var i=0;i<this.ELEMENTS;++i){var o=e[i];this[i]=o+n*(t[i]-o)}return this.check()}},{key:"min",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}},{key:"max",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}},{key:"clamp",value:function(e,t){for(var n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}},{key:"add",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]+=r[a];return this.check()}},{key:"subtract",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]-=r[a];return this.check()}},{key:"scale",value:function(e){if(Array.isArray(e))return this.multiply(e);for(var t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}},{key:"sub",value:function(e){return this.subtract(e)}},{key:"setScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}},{key:"addScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}},{key:"subScalar",value:function(e){return this.addScalar(-e)}},{key:"multiplyScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}},{key:"divideScalar",value:function(e){return this.scale(1/e)}},{key:"clampScalar",value:function(e,t){for(var n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),t);return this.check()}},{key:"multiplyByScalar",value:function(e){return this.scale(e)}},{key:"elements",get:function(){return this}},{key:"check",value:function(){if(_f.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}},{key:"validate",value:function(){for(var e=this.length===this.ELEMENTS,t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}]),n}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array));function Xf(e,t){if(e.length!==t)return!1;for(var n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Kf(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function $f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(_f.debug&&!Xf(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}var em={};function tm(e,t){em[e]||(em[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}var nm,im=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Qf(!1),0}},{key:"copy",value:function(e){return Qf(!1),this}},{key:"x",get:function(){return this[0]},set:function(e){this[0]=Kf(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=Kf(e)}},{key:"len",value:function(){return Math.sqrt(this.lengthSquared())}},{key:"magnitude",value:function(){return this.len()}},{key:"lengthSquared",value:function(){for(var e=0,t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}},{key:"magnitudeSquared",value:function(){return this.lengthSquared()}},{key:"distance",value:function(e){return Math.sqrt(this.distanceSquared(e))}},{key:"distanceSquared",value:function(e){for(var t=0,n=0;n<this.ELEMENTS;++n){var i=this[n]-e[n];t+=i*i}return Kf(t)}},{key:"dot",value:function(e){for(var t=0,n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return Kf(t)}},{key:"normalize",value:function(){var e=this.magnitude();if(0!==e)for(var t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}},{key:"multiply",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]*=r[a];return this.check()}},{key:"divide",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]/=r[a];return this.check()}},{key:"lengthSq",value:function(){return this.lengthSquared()}},{key:"distanceTo",value:function(e){return this.distance(e)}},{key:"distanceToSquared",value:function(e){return this.distanceSquared(e)}},{key:"getComponent",value:function(e){return Qf(e>=0&&e<this.ELEMENTS,"index is out of range"),Kf(this[e])}},{key:"setComponent",value:function(e,t){return Qf(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}},{key:"addVectors",value:function(e,t){return this.copy(e).add(t)}},{key:"subVectors",value:function(e,t){return this.copy(e).subtract(t)}},{key:"multiplyVectors",value:function(e,t){return this.copy(e).multiply(t)}},{key:"addScaledVector",value:function(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}]),n}(Zf),om=1e-6,rm="undefined"!=typeof Float32Array?Float32Array:Array;function am(e,t,n){var i=t[0],o=t[1];return e[0]=n[0]*i+n[3]*o+n[6],e[1]=n[1]*i+n[4]*o+n[7],e}function sm(e,t,n){var i=t[0],o=t[1];return e[0]=n[0]*i+n[4]*o+n[12],e[1]=n[1]*i+n[5]*o+n[13],e}function lm(e,t,n){var i=t[0],o=t[1],r=n[3]*i+n[7]*o||1;return e[0]=(n[0]*i+n[4]*o)/r,e[1]=(n[1]*i+n[5]*o)/r,e}function cm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[3]*i+n[7]*o+n[11]*r||1;return e[0]=(n[0]*i+n[4]*o+n[8]*r)/a,e[1]=(n[1]*i+n[5]*o+n[9]*r)/a,e[2]=(n[2]*i+n[6]*o+n[10]*r)/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),nm=new rm(2),rm!=Float32Array&&(nm[0]=0,nm[1]=0);var um=function(e){f(n,e);var t=Ph(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(this,n),e=t.call(this,2),zf(i)&&1===arguments.length?e.copy(i):(_f.debug&&(Kf(i),Kf(r)),e[0]=i,e[1]=r),e}return u(n,[{key:"set",value:function(e,t){return this[0]=e,this[1]=t,this.check()}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this.check()}},{key:"fromObject",value:function(e){return _f.debug&&(Kf(e.x),Kf(e.y)),this[0]=e.x,this[1]=e.y,this.check()}},{key:"toObject",value:function(e){return e.x=this[0],e.y=this[1],e}},{key:"ELEMENTS",get:function(){return 2}},{key:"horizontalAngle",value:function(){return Math.atan2(this.y,this.x)}},{key:"verticalAngle",value:function(){return Math.atan2(this.x,this.y)}},{key:"transform",value:function(e){return this.transformAsPoint(e)}},{key:"transformAsPoint",value:function(e){return sm(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return lm(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return am(this,this,e),this.check()}},{key:"transformByMatrix2x3",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o+n[4],e[1]=n[1]*i+n[3]*o+n[5]}(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o,e[1]=n[1]*i+n[3]*o}(this,this,e),this.check()}}]),n}(im);function hm(){var e=new rm(3);return rm!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function dm(e){var t=e[0],n=e[1],i=e[2];return Math.hypot(t,n,i)}function pm(e,t,n){var i=new rm(3);return i[0]=e,i[1]=t,i[2]=n,i}function fm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function mm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-r*s,e[1]=r*a-i*l,e[2]=i*s-o*a,e}function vm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[3]*i+n[7]*o+n[11]*r+n[15];return a=a||1,e[0]=(n[0]*i+n[4]*o+n[8]*r+n[12])/a,e[1]=(n[1]*i+n[5]*o+n[9]*r+n[13])/a,e[2]=(n[2]*i+n[6]*o+n[10]*r+n[14])/a,e}function gm(e,t,n){var i=t[0],o=t[1],r=t[2];return e[0]=i*n[0]+o*n[3]+r*n[6],e[1]=i*n[1]+o*n[4]+r*n[7],e[2]=i*n[2]+o*n[5]+r*n[8],e}var Am=dm;!function(){var e=hm()}();var ym=[0,0,0],Em={},wm=function(e){f(n,e);var t=Ph(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(this,n),e=t.call(this,-0,-0,-0),1===arguments.length&&zf(i)?e.copy(i):(_f.debug&&(Kf(i),Kf(r),Kf(a)),e[0]=i,e[1]=r,e[2]=a),e}return u(n,[{key:"set",value:function(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}},{key:"fromObject",value:function(e){return _f.debug&&(Kf(e.x),Kf(e.y),Kf(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}},{key:"toObject",value:function(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}},{key:"ELEMENTS",get:function(){return 3}},{key:"z",get:function(){return this[2]},set:function(e){this[2]=Kf(e)}},{key:"angle",value:function(e){return function(e,t){var n=e[0],i=e[1],o=e[2],r=t[0],a=t[1],s=t[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(r*r+a*a+s*s),c=l&&fm(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))}(this,e)}},{key:"cross",value:function(e){return mm(this,this,e),this.check()}},{key:"rotateX",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[0],r[1]=o[1]*Math.cos(i)-o[2]*Math.sin(i),r[2]=o[1]*Math.sin(i)+o[2]*Math.cos(i),e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?ym:n,t),this.check()}},{key:"rotateY",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[2]*Math.sin(i)+o[0]*Math.cos(i),r[1]=o[1],r[2]=o[2]*Math.cos(i)-o[0]*Math.sin(i),e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?ym:n,t),this.check()}},{key:"rotateZ",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[0]*Math.cos(i)-o[1]*Math.sin(i),r[1]=o[0]*Math.sin(i)+o[1]*Math.cos(i),r[2]=o[2],e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?ym:n,t),this.check()}},{key:"transform",value:function(e){return this.transformAsPoint(e)}},{key:"transformAsPoint",value:function(e){return vm(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return cm(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return gm(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o,e[1]=n[1]*i+n[3]*o,e[2]=t[2]}(this,this,e),this.check()}},{key:"transformByQuaternion",value:function(e){return function(e,t,n){var i=n[0],o=n[1],r=n[2],a=n[3],s=t[0],l=t[1],c=t[2],u=o*c-r*l,h=r*s-i*c,d=i*l-o*s,p=o*d-r*h,f=r*u-i*d,m=i*h-o*u,v=2*a;u*=v,h*=v,d*=v,p*=2,f*=2,m*=2,e[0]=s+u+p,e[1]=l+h+f,e[2]=c+d+m}(this,this,e),this.check()}}],[{key:"ZERO",get:function(){return Em.ZERO=Em.ZERO||Object.freeze(new n(0,0,0,0))}}]),n}(im),bm=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Qf(!1),0}},{key:"RANK",get:function(){return Qf(!1),0}},{key:"toString",value:function(){var e="[";if(_f.printRowMajor){e+="row-major:";for(var t=0;t<this.RANK;++t)for(var n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+t])}else{e+="column-major:";for(var i=0;i<this.ELEMENTS;++i)e+=" ".concat(this[i])}return e+="]"}},{key:"getElementIndex",value:function(e,t){return t*this.RANK+e}},{key:"getElement",value:function(e,t){return this[t*this.RANK+e]}},{key:"setElement",value:function(e,t,n){return this[t*this.RANK+e]=Kf(n),this}},{key:"getColumn",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Array(this.RANK).fill(-0),n=e*this.RANK,i=0;i<this.RANK;++i)t[i]=this[n+i];return t}},{key:"setColumn",value:function(e,t){for(var n=e*this.RANK,i=0;i<this.RANK;++i)this[n+i]=t[i];return this}}]),n}(Zf);function Cm(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=n[0],p=n[1],f=n[2],m=n[3],v=n[4],g=n[5],A=n[6],y=n[7],E=n[8];return e[0]=d*i+p*a+f*c,e[1]=d*o+p*s+f*u,e[2]=d*r+p*l+f*h,e[3]=m*i+v*a+g*c,e[4]=m*o+v*s+g*u,e[5]=m*r+v*l+g*h,e[6]=A*i+y*a+E*c,e[7]=A*o+y*s+E*u,e[8]=A*r+y*l+E*h,e}function xm(e,t,n){var i=n[0],o=n[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}var Im=Object.freeze([1,0,0,0,1,0,0,0,1]),Tm=Object.freeze([0,0,0,0,0,0,0,0,0]),Bm=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),km={},Pm=function(e){f(n,e);var t=Ph(n);function n(e){var i;return o(this,n),i=t.call(this,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?i.copy(e):i.identity(),i}return u(n,[{key:"ELEMENTS",get:function(){return 9}},{key:"RANK",get:function(){return 3}},{key:"INDICES",get:function(){return Bm}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}},{key:"set",value:function(e,t,n,i,o,r,a,s,l){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=s,this[8]=l,this.check()}},{key:"setRowMajor",value:function(e,t,n,i,o,r,a,s,l){return this[0]=e,this[1]=i,this[2]=a,this[3]=t,this[4]=o,this[5]=s,this[6]=n,this[7]=r,this[8]=l,this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*r-a*l)+n*(-c*o+a*s)+i*(l*o-r*s)}(this)}},{key:"identity",value:function(){return this.copy(Im)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n+n,s=i+i,l=o+o,c=n*a,u=i*a,h=i*s,d=o*a,p=o*s,f=o*l,m=r*a,v=r*s,g=r*l;e[0]=1-h-f,e[3]=u-g,e[6]=d+v,e[1]=u+g,e[4]=1-c-f,e[7]=p-m,e[2]=d-v,e[5]=p+m,e[8]=1-c-h}(this,e),this.check()}},{key:"transpose",value:function(){return function(e,t){if(e===t){var n=t[1],i=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=i,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=u*a-s*c,d=-u*r+s*l,p=c*r-a*l,f=n*h+i*d+o*p;f&&(f=1/f,e[0]=h*f,e[1]=(-u*i+o*c)*f,e[2]=(s*i-o*a)*f,e[3]=d*f,e[4]=(u*n-o*l)*f,e[5]=(-s*n+o*r)*f,e[6]=p*f,e[7]=(-c*n+i*l)*f,e[8]=(a*n-i*r)*f)}(this,this),this.check()}},{key:"multiplyLeft",value:function(e){return Cm(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return Cm(this,this,e),this.check()}},{key:"rotate",value:function(e){return function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=Math.sin(n),p=Math.cos(n);e[0]=p*i+d*a,e[1]=p*o+d*s,e[2]=p*r+d*l,e[3]=p*a-d*i,e[4]=p*s-d*o,e[5]=p*l-d*r,e[6]=c,e[7]=u,e[8]=h}(this,this,e),this.check()}},{key:"scale",value:function(e){return Array.isArray(e)?xm(this,this,e):xm(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=n[0],p=n[1];e[0]=i,e[1]=o,e[2]=r,e[3]=a,e[4]=s,e[5]=l,e[6]=d*i+p*a+c,e[7]=d*o+p*s+u,e[8]=d*r+p*l+h}(this,this,e),this.check()}},{key:"transform",value:function(e,t){switch(e.length){case 2:t=am(t||[-0,-0],e,this);break;case 3:t=gm(t||[-0,-0,-0],e,this);break;case 4:t=function(e,t,n){var i=t[0],o=t[1],r=t[2];return e[0]=n[0]*i+n[3]*o+n[6]*r,e[1]=n[1]*i+n[4]*o+n[7]*r,e[2]=n[2]*i+n[5]*o+n[8]*r,e[3]=t[3],e}(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return $f(t,e.length),t}},{key:"transformVector",value:function(e,t){return tm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector2",value:function(e,t){return tm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector3",value:function(e,t){return tm("Matrix3.transformVector"),this.transform(e,t)}}],[{key:"IDENTITY",get:function(){return km.IDENTITY=km.IDENTITY||Object.freeze(new n(Im)),km.IDENTITY}},{key:"ZERO",get:function(){return km.ZERO=km.ZERO||Object.freeze(new n(Tm)),km.ZERO}}]),n}(bm);function Rm(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],v=t[13],g=t[14],A=t[15],y=n[0],E=n[1],w=n[2],b=n[3];return e[0]=y*i+E*s+w*h+b*m,e[1]=y*o+E*l+w*d+b*v,e[2]=y*r+E*c+w*p+b*g,e[3]=y*a+E*u+w*f+b*A,y=n[4],E=n[5],w=n[6],b=n[7],e[4]=y*i+E*s+w*h+b*m,e[5]=y*o+E*l+w*d+b*v,e[6]=y*r+E*c+w*p+b*g,e[7]=y*a+E*u+w*f+b*A,y=n[8],E=n[9],w=n[10],b=n[11],e[8]=y*i+E*s+w*h+b*m,e[9]=y*o+E*l+w*d+b*v,e[10]=y*r+E*c+w*p+b*g,e[11]=y*a+E*u+w*f+b*A,y=n[12],E=n[13],w=n[14],b=n[15],e[12]=y*i+E*s+w*h+b*m,e[13]=y*o+E*l+w*d+b*v,e[14]=y*r+E*c+w*p+b*g,e[15]=y*a+E*u+w*f+b*A,e}function Mm(e,t,n){var i=n[0],o=n[1],r=n[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Sm(e,t,n,i,o){var r,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(r=1/(i-o),e[10]=(o+i)*r,e[14]=2*o*i*r):(e[10]=-1,e[14]=-2*i),e}function Dm(e,t,n,i){var o,r,a,s,l,c,u,h,d,p,f=t[0],m=t[1],v=t[2],g=i[0],A=i[1],y=i[2],E=n[0],w=n[1],b=n[2];return Math.abs(f-E)<om&&Math.abs(m-w)<om&&Math.abs(v-b)<om?function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(e):(u=f-E,h=m-w,d=v-b,o=A*(d*=p=1/Math.hypot(u,h,d))-y*(h*=p),r=y*(u*=p)-g*d,a=g*h-A*u,(p=Math.hypot(o,r,a))?(o*=p=1/p,r*=p,a*=p):(o=0,r=0,a=0),s=h*a-d*r,l=d*o-u*a,c=u*r-h*o,(p=Math.hypot(s,l,c))?(s*=p=1/p,l*=p,c*=p):(s=0,l=0,c=0),e[0]=o,e[1]=s,e[2]=u,e[3]=0,e[4]=r,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=c,e[10]=d,e[11]=0,e[12]=-(o*f+r*m+a*v),e[13]=-(s*f+l*m+c*v),e[14]=-(u*f+h*m+d*v),e[15]=1,e)}function Fm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[0],s=n[1],l=n[2],c=n[3],u=c*i+s*r-l*o,h=c*o+l*i-a*r,d=c*r+a*o-s*i,p=-a*i-s*o-l*r;return e[0]=u*c+p*-a+h*-l-d*-s,e[1]=h*c+p*-s+d*-a-u*-l,e[2]=d*c+p*-l+u*-s-h*-a,e[3]=t[3],e}!function(){var e=function(){var e=new rm(4);return rm!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}();var Lm=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Hm=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Qm=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),Om={},Vm=function(e){f(n,e);var t=Ph(n);function n(e){var i;return o(this,n),i=t.call(this,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?i.copy(e):i.identity(),i}return u(n,[{key:"INDICES",get:function(){return Qm}},{key:"ELEMENTS",get:function(){return 16}},{key:"RANK",get:function(){return 4}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}},{key:"set",value:function(e,t,n,i,o,r,a,s,l,c,u,h,d,p,f,m){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=s,this[8]=l,this[9]=c,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=f,this[15]=m,this.check()}},{key:"setRowMajor",value:function(e,t,n,i,o,r,a,s,l,c,u,h,d,p,f,m){return this[0]=e,this[1]=o,this[2]=l,this[3]=d,this[4]=t,this[5]=r,this[6]=c,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=f,this[12]=i,this[13]=s,this[14]=h,this[15]=m,this.check()}},{key:"toRowMajor",value:function(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}},{key:"identity",value:function(){return this.copy(Lm)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n+n,s=i+i,l=o+o,c=n*a,u=i*a,h=i*s,d=o*a,p=o*s,f=o*l,m=r*a,v=r*s,g=r*l;e[0]=1-h-f,e[1]=u+g,e[2]=d-v,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+v,e[9]=p-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}},{key:"frustum",value:function(e){var t=e.left,i=e.right,o=e.bottom,r=e.top,a=e.near,s=e.far;return s===1/0?n._computeInfinitePerspectiveOffCenter(this,t,i,o,r,a):function(e,t,n,i,o,r,a){var s=1/(n-t),l=1/(o-i),c=1/(r-a);e[0]=2*r*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*r*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+i)*l,e[10]=(a+r)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r*2*c,e[15]=0}(this,t,i,o,r,a,s),this.check()}},{key:"lookAt",value:function(e,t,n){if(1===arguments.length){var i=e;e=i.eye,t=i.center,n=i.up}return Dm(this,e,t=t||[0,0,0],n=n||[0,1,0]),this.check()}},{key:"ortho",value:function(e){var t=e.left,n=e.right,i=e.bottom,o=e.top,r=e.near,a=void 0===r?.1:r,s=e.far;return function(e,t,n,i,o,r,a){var s=1/(t-n),l=1/(i-o),c=1/(r-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+i)*l,e[14]=(a+r)*c,e[15]=1}(this,t,n,i,o,a,void 0===s?500:s),this.check()}},{key:"orthographic",value:function(e){var t=e.fovy,i=void 0===t?45*Math.PI/180:t,o=e.aspect,r=void 0===o?1:o,a=e.focalDistance,s=void 0===a?1:a,l=e.near,c=void 0===l?.1:l,u=e.far,h=void 0===u?500:u;if(i>2*Math.PI)throw Error("radians");var d=i/2,p=s*Math.tan(d),f=p*r;return(new n).ortho({left:-f,right:f,bottom:-p,top:p,near:c,far:h})}},{key:"perspective",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.fovy,n=void 0===t?void 0:t,i=e.fov,o=void 0===i?45*Math.PI/180:i,r=e.aspect,a=void 0===r?1:r,s=e.near,l=void 0===s?.1:s,c=e.far,u=void 0===c?500:c;if((n=n||o)>2*Math.PI)throw Error("radians");return Sm(this,n,a,l,u),this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],v=e[15];return(t*a-n*r)*(h*v-d*m)-(t*s-i*r)*(u*v-d*f)+(t*l-o*r)*(u*m-h*f)+(n*s-i*a)*(c*v-d*p)-(n*l-o*a)*(c*m-h*p)+(i*l-o*s)*(c*f-u*p)}(this)}},{key:"getScale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}},{key:"getTranslation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}},{key:"getRotation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getScale(t||[-0,-0,-0]),i=1/n[0],o=1/n[1],r=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*r,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*o,e[6]=this[6]*r,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*o,e[10]=this[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}},{key:"getRotationMatrix3",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getScale(t||[-0,-0,-0]),i=1/n[0],o=1/n[1],r=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*r,e[3]=this[4]*i,e[4]=this[5]*o,e[5]=this[6]*r,e[6]=this[8]*i,e[7]=this[9]*o,e[8]=this[10]*r,e}},{key:"transpose",value:function(){return function(e,t){if(e===t){var n=t[1],i=t[2],o=t[3],r=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=r,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],v=t[14],g=t[15],A=n*s-i*a,y=n*l-o*a,E=n*c-r*a,w=i*l-o*s,b=i*c-r*s,C=o*c-r*l,x=u*m-h*f,I=u*v-d*f,T=u*g-p*f,B=h*v-d*m,k=h*g-p*m,P=d*g-p*v,R=A*P-y*k+E*B+w*T-b*I+C*x;R&&(R=1/R,e[0]=(s*P-l*k+c*B)*R,e[1]=(o*k-i*P-r*B)*R,e[2]=(m*C-v*b+g*w)*R,e[3]=(d*b-h*C-p*w)*R,e[4]=(l*T-a*P-c*I)*R,e[5]=(n*P-o*T+r*I)*R,e[6]=(v*E-f*C-g*y)*R,e[7]=(u*C-d*E+p*y)*R,e[8]=(a*k-s*T+c*x)*R,e[9]=(i*T-n*k-r*x)*R,e[10]=(f*b-m*E+g*A)*R,e[11]=(h*E-u*b-p*A)*R,e[12]=(s*I-a*B-l*x)*R,e[13]=(n*B-i*I+o*x)*R,e[14]=(m*y-f*w-v*A)*R,e[15]=(u*w-h*y+d*A)*R)}(this,this),this.check()}},{key:"multiplyLeft",value:function(e){return Rm(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return Rm(this,this,e),this.check()}},{key:"rotateX",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=r*o+c*i,e[5]=a*o+u*i,e[6]=s*o+h*i,e[7]=l*o+d*i,e[8]=c*o-r*i,e[9]=u*o-a*i,e[10]=h*o-s*i,e[11]=d*o-l*i}(this,this,e),this.check()}},{key:"rotateY",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o-c*i,e[1]=a*o-u*i,e[2]=s*o-h*i,e[3]=l*o-d*i,e[8]=r*i+c*o,e[9]=a*i+u*o,e[10]=s*i+h*o,e[11]=l*i+d*o}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o+c*i,e[1]=a*o+u*i,e[2]=s*o+h*i,e[3]=l*o+d*i,e[4]=c*o-r*i,e[5]=u*o-a*i,e[6]=h*o-s*i,e[7]=d*o-l*i}(this,this,e),this.check()}},{key:"rotateXYZ",value:function(e){var t=ce(e,3),n=t[0],i=t[1],o=t[2];return this.rotateX(n).rotateY(i).rotateZ(o)}},{key:"rotateAxis",value:function(e,t){return function(e,t,n,i){var o,r,a,s,l,c,u,h,d,p,f,m,v,g,A,y,E,w,b,C,x,I,T,B,k=i[0],P=i[1],R=i[2],M=Math.hypot(k,P,R);M<om||(k*=M=1/M,P*=M,R*=M,o=Math.sin(n),a=1-(r=Math.cos(n)),s=t[0],l=t[1],c=t[2],u=t[3],h=t[4],d=t[5],p=t[6],f=t[7],m=t[8],v=t[9],g=t[10],A=t[11],y=k*k*a+r,E=P*k*a+R*o,w=R*k*a-P*o,b=k*P*a-R*o,C=P*P*a+r,x=R*P*a+k*o,I=k*R*a+P*o,T=P*R*a-k*o,B=R*R*a+r,e[0]=s*y+h*E+m*w,e[1]=l*y+d*E+v*w,e[2]=c*y+p*E+g*w,e[3]=u*y+f*E+A*w,e[4]=s*b+h*C+m*x,e[5]=l*b+d*C+v*x,e[6]=c*b+p*C+g*x,e[7]=u*b+f*C+A*x,e[8]=s*I+h*T+m*B,e[9]=l*I+d*T+v*B,e[10]=c*I+p*T+g*B,e[11]=u*I+f*T+A*B,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}},{key:"scale",value:function(e){return Array.isArray(e)?Mm(this,this,e):Mm(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m=n[0],v=n[1],g=n[2];t===e?(e[12]=t[0]*m+t[4]*v+t[8]*g+t[12],e[13]=t[1]*m+t[5]*v+t[9]*g+t[13],e[14]=t[2]*m+t[6]*v+t[10]*g+t[14],e[15]=t[3]*m+t[7]*v+t[11]*g+t[15]):(i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=i,e[1]=o,e[2]=r,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=i*m+s*v+h*g+t[12],e[13]=o*m+l*v+d*g+t[13],e[14]=r*m+c*v+p*g+t[14],e[15]=a*m+u*v+f*g+t[15])}(this,this,e),this.check()}},{key:"transform",value:function(e,t){return 4===e.length?($f(t=function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3];return e[0]=n[0]*i+n[4]*o+n[8]*r+n[12]*a,e[1]=n[1]*i+n[5]*o+n[9]*r+n[13]*a,e[2]=n[2]*i+n[6]*o+n[10]*r+n[14]*a,e[3]=n[3]*i+n[7]*o+n[11]*r+n[15]*a,e}(t||[-0,-0,-0,-0],e,this),4),t):this.transformAsPoint(e,t)}},{key:"transformAsPoint",value:function(e,t){switch(e.length){case 2:t=sm(t||[-0,-0],e,this);break;case 3:t=vm(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return $f(t,e.length),t}},{key:"transformAsVector",value:function(e,t){switch(e.length){case 2:t=lm(t||[-0,-0],e,this);break;case 3:t=cm(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return $f(t,e.length),t}},{key:"makeRotationX",value:function(e){return this.identity().rotateX(e)}},{key:"makeTranslation",value:function(e,t,n){return this.identity().translate([e,t,n])}},{key:"transformPoint",value:function(e,t){return tm("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}},{key:"transformVector",value:function(e,t){return tm("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}},{key:"transformDirection",value:function(e,t){return tm("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}],[{key:"IDENTITY",get:function(){return Om.IDENTITY=Om.IDENTITY||Object.freeze(new n(Lm)),Om.IDENTITY}},{key:"ZERO",get:function(){return Om.ZERO=Om.ZERO||Object.freeze(new n(Hm)),Om.ZERO}},{key:"_computeInfinitePerspectiveOffCenter",value:function(e,t,n,i,o,r){var a=2*r/(n-t),s=2*r/(o-i),l=(n+t)/(n-t),c=(o+i)/(o-i),u=-2*r;return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=l,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=u,e[15]=0,e}}]),n}(bm);function _m(){var e=new rm(4);return rm!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Um(e,t,n){n*=.5;var i=Math.sin(n);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(n),e}function Nm(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=i*u+a*s+o*c-r*l,e[1]=o*u+a*l+r*s-i*c,e[2]=r*u+a*c+i*l-o*s,e[3]=a*u-i*s-o*l-r*c,e}function zm(e,t,n,i){var o,r,a,s,l,c=t[0],u=t[1],h=t[2],d=t[3],p=n[0],f=n[1],m=n[2],v=n[3];return(r=c*p+u*f+h*m+d*v)<0&&(r=-r,p=-p,f=-f,m=-m,v=-v),1-r>om?(o=Math.acos(r),a=Math.sin(o),s=Math.sin((1-i)*o)/a,l=Math.sin(i*o)/a):(s=1-i,l=i),e[0]=s*c+l*p,e[1]=s*u+l*f,e[2]=s*h+l*m,e[3]=s*d+l*v,e}function Gm(e,t){var n,i=t[0]+t[4]+t[8];if(i>0)n=Math.sqrt(i+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var o=0;t[4]>t[0]&&(o=1),t[8]>t[3*o+o]&&(o=2);var r=(o+1)%3,a=(o+2)%3;n=Math.sqrt(t[3*o+o]-t[3*r+r]-t[3*a+a]+1),e[o]=.5*n,n=.5/n,e[3]=(t[3*r+a]-t[3*a+r])*n,e[r]=(t[3*r+o]+t[3*o+r])*n,e[a]=(t[3*a+o]+t[3*o+a])*n}return e}var jm,Wm,qm,Jm=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e},Ym=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},Zm=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Xm=function(e,t,n,i){var o=t[0],r=t[1],a=t[2],s=t[3];return e[0]=o+i*(n[0]-o),e[1]=r+i*(n[1]-r),e[2]=a+i*(n[2]-a),e[3]=s+i*(n[3]-s),e},Km=function(e){var t=e[0],n=e[1],i=e[2],o=e[3];return Math.hypot(t,n,i,o)},$m=function(e){var t=e[0],n=e[1],i=e[2],o=e[3];return t*t+n*n+i*i+o*o},ev=function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n*n+i*i+o*o+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=n*a,e[1]=i*a,e[2]=o*a,e[3]=r*a,e},tv=(jm=hm(),Wm=pm(1,0,0),qm=pm(0,1,0),function(e,t,n){var i=fm(t,n);return i<-.999999?(mm(jm,Wm,t),Am(jm)<1e-6&&mm(jm,qm,t),function(e,t){var n=t[0],i=t[1],o=t[2],r=n*n+i*i+o*o;r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r}(jm,jm),Um(e,jm,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(mm(jm,t,n),e[0]=jm[0],e[1]=jm[1],e[2]=jm[2],e[3]=1+i,ev(e,e))});_m(),_m(),function(){var e=new rm(9);rm!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}();var nv=[0,0,0,1],iv=function(e){f(n,e);var t=Ph(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return o(this,n),e=t.call(this,-0,-0,-0,-0),Array.isArray(i)&&1===arguments.length?e.copy(i):e.set(i,r,a,s),e}return u(n,[{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}},{key:"set",value:function(e,t,n,i){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this.check()}},{key:"fromMatrix3",value:function(e){return Gm(this,e),this.check()}},{key:"identity",value:function(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}},{key:"fromAxisRotation",value:function(e,t){return Um(this,e,t),this.check()}},{key:"setAxisAngle",value:function(e,t){return this.fromAxisRotation(e,t)}},{key:"ELEMENTS",get:function(){return 4}},{key:"x",get:function(){return this[0]},set:function(e){this[0]=Kf(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=Kf(e)}},{key:"z",get:function(){return this[2]},set:function(e){this[2]=Kf(e)}},{key:"w",get:function(){return this[3]},set:function(e){this[3]=Kf(e)}},{key:"len",value:function(){return Km(this)}},{key:"lengthSquared",value:function(){return $m(this)}},{key:"dot",value:function(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Zm(this,e)}},{key:"rotationTo",value:function(e,t){return tv(this,e,t),this.check()}},{key:"add",value:function(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return Jm(this,this,e),this.check()}},{key:"calculateW",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2];e[0]=n,e[1]=i,e[2]=o,e[3]=Math.sqrt(Math.abs(1-n*n-i*i-o*o))}(this,this),this.check()}},{key:"conjugate",value:function(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n*n+i*i+o*o+r*r,s=a?1/a:0;e[0]=-n*s,e[1]=-i*s,e[2]=-o*s,e[3]=r*s}(this,this),this.check()}},{key:"lerp",value:function(e,t,n){return Xm(this,e,t,n),this.check()}},{key:"multiplyRight",value:function(e,t){return Qf(!t),Nm(this,this,e),this.check()}},{key:"multiplyLeft",value:function(e,t){return Qf(!t),Nm(this,e,this),this.check()}},{key:"normalize",value:function(){var e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}},{key:"rotateX",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+a*s,e[1]=o*l+r*s,e[2]=r*l-o*s,e[3]=a*l-i*s}(this,this,e),this.check()}},{key:"rotateY",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l-r*s,e[1]=o*l+a*s,e[2]=r*l+i*s,e[3]=a*l-o*s}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+o*s,e[1]=o*l-i*s,e[2]=r*l+a*s,e[3]=a*l-r*s}(this,this,e),this.check()}},{key:"scale",value:function(e){return Ym(this,this,e),this.check()}},{key:"slerp",value:function(e,t,n){switch(arguments.length){case 1:var i=arguments[0],o=i.start;e=void 0===o?nv:o,t=i.target,n=i.ratio;break;case 2:var r=Array.prototype.slice.call(arguments);t=r[0],n=r[1],e=this}return zm(this,e,t,n),this.check()}},{key:"transformVector4",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return Fm(t,e,this),$f(t,4)}},{key:"lengthSq",value:function(){return this.lengthSquared()}},{key:"setFromAxisAngle",value:function(e,t){return this.setAxisAngle(e,t)}},{key:"premultiply",value:function(e,t){return this.multiplyLeft(e,t)}},{key:"multiply",value:function(e,t){return this.multiplyRight(e,t)}}]),n}(Zf),ov=.1,rv=1e-12,av=1e-15,sv=(Math.PI,Math.PI,Math.PI,Math.PI,function(e){return e}),lv=new wm;function cv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sv;return zf(e)?(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z),t}function uv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lv;return cv(e,t,_f._cartographicRadians?sv:jf)}function hv(e,t){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sv;return zf(t)?(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]),t}(e,t,_f._cartographicRadians?sv:Wf)}var dv=new wm,pv=new wm,fv=new wm;var mv=new wm,vv={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},gv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Av={east:new wm,north:new wm,up:new wm,west:new wm,south:new wm,down:new wm},yv=new wm,Ev=new wm,wv=new wm;function bv(e,t,n,i,o,r){var a,s,l,c=vv[t]&&vv[t][n];Qf(c&&(!i||i===c));var u=mv.copy(o);if(Yf(u.x,0,1e-14)&&Yf(u.y,0,1e-14)){var h=Math.sign(u.z);a=yv.fromArray(gv[t]),"east"!==t&&"west"!==t&&a.scale(h),s=Ev.fromArray(gv[n]),"east"!==n&&"west"!==n&&s.scale(h),l=wv.fromArray(gv[i]),"east"!==i&&"west"!==i&&l.scale(h)}else{var d=Av.up,p=Av.east,f=Av.north;p.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,d),f.copy(d).cross(p);var m=Av.west,v=Av.south;Av.down.copy(d).scale(-1),m.copy(p).scale(-1),v.copy(f).scale(-1),a=Av[t],s=Av[n],l=Av[i]}return r[0]=a.x,r[1]=a.y,r[2]=a.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=l.x,r[9]=l.y,r[10]=l.z,r[11]=0,r[12]=u.x,r[13]=u.y,r[14]=u.z,r[15]=1,r}var Cv,xv=new wm,Iv=new wm,Tv=new wm,Bv=new wm,kv=new wm,Pv=new wm,Rv=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;o(this,e),Qf(t>=0),Qf(n>=0),Qf(i>=0),this.radii=new wm(t,n,i),this.radiiSquared=new wm(t*t,n*n,i*i),this.radiiToTheFourth=new wm(t*t*t*t,n*n*n*n,i*i*i*i),this.oneOverRadii=new wm(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),this.oneOverRadiiSquared=new wm(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),this.minimumRadius=Math.min(t,n,i),this.maximumRadius=Math.max(t,n,i),this.centerToleranceSquared=ov,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}return u(e,[{key:"equals",value:function(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}},{key:"toString",value:function(){return this.radii.toString()}},{key:"cartographicToCartesian",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=Iv,i=Tv,o=ce(e,3),r=o[2];this.geodeticSurfaceNormalCartographic(e,n),i.copy(this.radiiSquared).scale(n);var a=Math.sqrt(n.dot(i));return i.scale(1/a),n.scale(r),i.add(n),i.to(t)}},{key:"cartesianToCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];Pv.from(e);var n=this.scaleToGeodeticSurface(Pv,Bv);if(n){var i=this.geodeticSurfaceNormal(n,Iv),o=kv;o.copy(Pv).subtract(n);var r=Math.atan2(i.y,i.x),a=Math.asin(i.z),s=Math.sign(fm(o,Pv))*dm(o);return hv([r,a,s],t)}}},{key:"eastNorthUpToFixedFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vm;return bv(this,"east","north","up",e,t)}},{key:"localFrameToFixedFrame",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Vm;return bv(this,e,t,n,i,o)}},{key:"geocentricSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return xv.from(e).normalize().to(t)}},{key:"geodeticSurfaceNormalCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=uv(e),i=n[0],o=n[1],r=Math.cos(o);return xv.set(r*Math.cos(i),r*Math.sin(i),Math.sin(o)).normalize(),xv.to(t)}},{key:"geodeticSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return xv.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}},{key:"scaleToGeodeticSurface",value:function(e,t){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new wm,i=t.oneOverRadii,o=t.oneOverRadiiSquared,r=t.centerToleranceSquared;dv.from(e);var a=e.x,s=e.y,l=e.z,c=i.x,u=i.y,h=i.z,d=a*a*c*c,p=s*s*u*u,f=l*l*h*h,m=d+p+f,v=Math.sqrt(1/m);if(Number.isFinite(v)){var g=pv;if(g.copy(e).scale(v),m<r)return g.to(n);var A=o.x,y=o.y,E=o.z,w=fv;w.set(g.x*A*2,g.y*y*2,g.z*E*2);var b,C,x,I,T=(1-v)*e.len()/(.5*w.len()),B=0;do{var k=(b=1/(1+(T-=B)*A))*b,P=(C=1/(1+T*y))*C,R=(x=1/(1+T*E))*x;B=(I=d*k+p*P+f*R-1)/(-2*(d*(k*b)*A+p*(P*C)*y+f*(R*x)*E))}while(Math.abs(I)>rv);return dv.scale([b,C,x]).to(n)}}(e,this,t)}},{key:"scaleToGeocentricSurface",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];Bv.from(e);var n=Bv.x,i=Bv.y,o=Bv.z,r=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return Bv.multiplyScalar(a).to(t)}},{key:"transformPositionToScaledSpace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Bv.from(e).scale(this.oneOverRadii).to(t)}},{key:"transformPositionFromScaledSpace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Bv.from(e).scale(this.radii).to(t)}},{key:"getSurfaceNormalIntersectionWithZAxis",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0];Qf(Yf(this.radii.x,this.radii.y,av)),Qf(this.radii.z>0),Bv.from(e);var i=Bv.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return Bv.set(0,0,i).to(n)}}],[{key:"WGS84",get:function(){return Cv=Cv||new e(6378137,6378137,6356752.314245179)}}]),e}(),Mv=function e(t,n,i){o(this,e),Xh(this,"item",void 0),Xh(this,"previous",void 0),Xh(this,"next",void 0),this.item=t,this.previous=n,this.next=i},Sv=function(){function e(){o(this,e),Xh(this,"head",null),Xh(this,"tail",null),Xh(this,"_length",0)}return u(e,[{key:"length",get:function(){return this._length}},{key:"add",value:function(e){var t=new Mv(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}},{key:"remove",value:function(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}},{key:"splice",value:function(e,t){e!==t&&(this.remove(t),this._insert(e,t))}},{key:"_insert",value:function(e,t){var n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,++this._length}}]),e}();function Dv(e){return null!=e}var Fv=function(){function e(){o(this,e),Xh(this,"_list",void 0),Xh(this,"_sentinel",void 0),Xh(this,"_trimTiles",void 0),this._list=new Sv,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}return u(e,[{key:"reset",value:function(){this._list.splice(this._list.tail,this._sentinel)}},{key:"touch",value:function(e){var t=e._cacheNode;Dv(t)&&this._list.splice(this._sentinel,t)}},{key:"add",value:function(e,t,n){Dv(t._cacheNode)||(t._cacheNode=this._list.add(t),n&&n(e,t))}},{key:"unloadTile",value:function(e,t,n){var i=t._cacheNode;Dv(i)&&(this._list.remove(i),t._cacheNode=void 0,n&&n(e,t))}},{key:"unloadTiles",value:function(e,t){var n=this._trimTiles;this._trimTiles=!1;for(var i=this._list,o=1024*e.maximumMemoryUsage*1024,r=this._sentinel,a=i.head;a!==r&&(e.gpuMemoryUsageInBytes>o||n);){var s=a.item;a=a.next,this.unloadTile(e,s,t)}}},{key:"trim",value:function(){this._trimTiles=!0}}]),e}();var Lv=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new wm,new wm;var Hv=new wm,Qv=new wm,Ov=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.radius=-0,this.center=new wm,this.fromCenterRadius(t,n)}return u(e,[{key:"fromCenterRadius",value:function(e,t){return this.center.from(e),this.radius=t,this}},{key:"fromCornerPoints",value:function(e,t){return t=Hv.from(t),this.center=(new wm).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}},{key:"equals",value:function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}},{key:"clone",value:function(){return new e(this.center,this.radius)}},{key:"union",value:function(e){var t=this.center,n=this.radius,i=e.center,o=e.radius,r=Hv.copy(i).subtract(t),a=r.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return e.clone();var s=.5*(n+a+o);return Qv.copy(r).scale((-n+s)/a).add(t),this.center.copy(Qv),this.radius=s,this}},{key:"expand",value:function(e){var t=(e=Hv.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}},{key:"transform",value:function(e){this.center.transform(e);var t=function(e,t){var n=t[0],i=t[1],o=t[2],r=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,i,o),e[1]=Math.hypot(r,a,s),e[2]=Math.hypot(l,c,u),e}(Hv,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}},{key:"distanceSquaredTo",value:function(e){var t=this.distanceTo(e);return t*t}},{key:"distanceTo",value:function(e){var t=(e=Hv.from(e)).subtract(this.center);return Math.max(0,t.len()-this.radius)}},{key:"intersectPlane",value:function(e){var t=this.center,n=this.radius,i=e.normal.dot(t)+e.distance;return i<-n?Lv.OUTSIDE:i<n?Lv.INTERSECTING:Lv.INSIDE}}]),e}(),Vv=new wm,_v=new wm,Uv=new wm,Nv=new wm,zv=new wm,Gv=new wm,jv=new wm,Wv=0,qv=1,Jv=2,Yv=3,Zv=4,Xv=5,Kv=6,$v=7,eg=8,tg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0,0,0,0,0,0];o(this,e),this.center=(new wm).from(t),this.halfAxes=new Pm(n)}return u(e,[{key:"halfSize",get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new wm(e).len(),new wm(t).len(),new wm(n).len()]}},{key:"quaternion",get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new wm(e).normalize(),o=new wm(t).normalize(),r=new wm(n).normalize();return(new iv).fromMatrix3(new Pm([].concat(H(i),H(o),H(r))))}},{key:"fromCenterHalfSizeQuaternion",value:function(e,t,n){var i=new iv(n),o=(new Pm).fromQuaternion(i);return o[0]=o[0]*t[0],o[1]=o[1]*t[0],o[2]=o[2]*t[0],o[3]=o[3]*t[1],o[4]=o[4]*t[1],o[5]=o[5]*t[1],o[6]=o[6]*t[2],o[7]=o[7]*t[2],o[8]=o[8]*t[2],this.center=(new wm).from(e),this.halfAxes=o,this}},{key:"clone",value:function(){return new e(this.center,this.halfAxes)}},{key:"equals",value:function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}},{key:"getBoundingSphere",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ov,t=this.halfAxes,n=t.getColumn(0,Uv),i=t.getColumn(1,Nv),o=t.getColumn(2,zv),r=Vv.copy(n).add(i).add(o);return e.center.copy(this.center),e.radius=r.magnitude(),e}},{key:"intersectPlane",value:function(e){var t=this.center,n=e.normal,i=this.halfAxes,o=n.x,r=n.y,a=n.z,s=Math.abs(o*i[Wv]+r*i[qv]+a*i[Jv])+Math.abs(o*i[Yv]+r*i[Zv]+a*i[Xv])+Math.abs(o*i[Kv]+r*i[$v]+a*i[eg]),l=n.dot(t)+e.distance;return l<=-s?Lv.OUTSIDE:l>=s?Lv.INSIDE:Lv.INTERSECTING}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceSquaredTo(e))}},{key:"distanceSquaredTo",value:function(e){var t=_v.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,Uv),o=n.getColumn(1,Nv),r=n.getColumn(2,zv),a=i.magnitude(),s=o.magnitude(),l=r.magnitude();i.normalize(),o.normalize(),r.normalize();var c,u=0;return(c=Math.abs(t.dot(i))-a)>0&&(u+=c*c),(c=Math.abs(t.dot(o))-s)>0&&(u+=c*c),(c=Math.abs(t.dot(r))-l)>0&&(u+=c*c),u}},{key:"computePlaneDistances",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[-0,-0],i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=this.center,a=this.halfAxes,s=a.getColumn(0,Uv),l=a.getColumn(1,Nv),c=a.getColumn(2,zv),u=Gv.copy(s).add(l).add(c).add(r),h=jv.copy(u).subtract(e),d=t.dot(h);return i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).add(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}},{key:"transform",value:function(e){this.center.transformAsPoint(e);var t=this.halfAxes.getColumn(0,Uv);t.transformAsPoint(e);var n=this.halfAxes.getColumn(1,Nv);n.transformAsPoint(e);var i=this.halfAxes.getColumn(2,zv);return i.transformAsPoint(e),this.halfAxes=new Pm([].concat(H(t),H(n),H(i))),this}},{key:"getTransform",value:function(){throw new Error("not implemented")}}]),e}(),ng=new wm,ig=new wm,og=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,1],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.normal=new wm,this.distance=-0,this.fromNormalDistance(t,n)}return u(e,[{key:"fromNormalDistance",value:function(e,t){return Qf(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}},{key:"fromPointNormal",value:function(e,t){e=ng.from(e),this.normal.from(t).normalize();var n=-this.normal.dot(e);return this.distance=n,this}},{key:"fromCoefficients",value:function(e,t,n,i){return this.normal.set(e,t,n),Qf(Yf(this.normal.len(),1)),this.distance=i,this}},{key:"clone",value:function(t){return new e(this.normal,this.distance)}},{key:"equals",value:function(e){return Yf(this.distance,e.distance)&&Yf(this.normal,e.normal)}},{key:"getPointDistance",value:function(e){return this.normal.dot(e)+this.distance}},{key:"transform",value:function(e){var t=ig.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,t)}},{key:"projectPointOntoPlane",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];e=ng.from(e);var n=this.getPointDistance(e),i=ig.copy(this.normal).scale(n);return e.subtract(i).to(t)}}]),e}(),rg=[new wm([1,0,0]),new wm([0,1,0]),new wm([0,0,1])],ag=new wm,sg=new wm;new og(new wm(1,0,0),0);var lg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o(this,e),this.planes=t,Qf(this.planes.every((function(e){return e instanceof og})))}return u(e,[{key:"fromBoundingSphere",value:function(e){this.planes.length=2*rg.length;var t,n=e.center,i=e.radius,o=0,r=Dh(rg);try{for(r.s();!(t=r.n()).done;){var a=t.value,s=this.planes[o],l=this.planes[o+1];s||(s=this.planes[o]=new og),l||(l=this.planes[o+1]=new og);var c=ag.copy(a).scale(-i).add(n);a.dot(c),s.fromPointNormal(c,a);var u=ag.copy(a).scale(i).add(n),h=sg.copy(a).negate();h.dot(u),l.fromPointNormal(u,h),o+=2}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"computeVisibility",value:function(e){Qf(e);var t,n=Lv.INSIDE,i=Dh(this.planes);try{for(i.s();!(t=i.n()).done;){var o=t.value;switch(e.intersectPlane(o)){case Lv.OUTSIDE:return Lv.OUTSIDE;case Lv.INTERSECTING:n=Lv.INTERSECTING}}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"computeVisibilityWithPlaneMask",value:function(t,n){if(Qf(t,"boundingVolume is required."),Qf(Number.isFinite(n),"parentPlaneMask is required."),n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;for(var i=e.MASK_INSIDE,o=this.planes,r=0;r<this.planes.length;++r){var a=r<31?1<<r:0;if(!(r<31&&0==(n&a))){var s=o[r],l=t.intersectPlane(s);if(l===Lv.OUTSIDE)return e.MASK_OUTSIDE;l===Lv.INTERSECTING&&(i|=a)}}return i}}],[{key:"MASK_OUTSIDE",get:function(){return 4294967295}},{key:"MASK_INSIDE",get:function(){return 0}},{key:"MASK_INDETERMINATE",get:function(){return 2147483647}}]),e}(),cg=new wm,ug=new wm,hg=new wm,dg=new wm,pg=new wm,fg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t=Hh({near:1,far:5e8},t),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this._cullingVolume=new lg([new og,new og,new og,new og,new og,new og]),this._perspectiveMatrix=new Vm,this._infinitePerspective=new Vm}return u(e,[{key:"clone",value:function(){return new e({right:this.right,left:this.left,top:this.top,bottom:this.bottom,near:this.near,far:this.far})}},{key:"equals",value:function(t){return t&&t instanceof e&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far}},{key:"projectionMatrix",get:function(){return mg(this),this._perspectiveMatrix}},{key:"infiniteProjectionMatrix",get:function(){return mg(this),this._infinitePerspective}},{key:"computeCullingVolume",value:function(e,t,n){Qf(e,"position is required."),Qf(t,"direction is required."),Qf(n,"up is required.");var i=this._cullingVolume.planes;n=cg.copy(n).normalize();var o=ug.copy(t).cross(n).normalize(),r=hg.copy(t).multiplyByScalar(this.near).add(e),a=dg.copy(t).multiplyByScalar(this.far).add(e),s=pg;return s.copy(o).multiplyByScalar(this.left).add(r).subtract(e).cross(n),i[0].fromPointNormal(e,s),s.copy(o).multiplyByScalar(this.right).add(r).subtract(e).cross(n).negate(),i[1].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.bottom).add(r).subtract(e).cross(o).negate(),i[2].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.top).add(r).subtract(e).cross(o),i[3].fromPointNormal(e,s),s=(new wm).copy(t),i[4].fromPointNormal(r,s),s.negate(),i[5].fromPointNormal(a,s),this._cullingVolume}},{key:"getPixelDimensions",value:function(e,t,n,i){mg(this),Qf(Number.isFinite(e)&&Number.isFinite(t)),Qf(e>0),Qf(t>0),Qf(n>0),Qf(i);var o=1/this.near,r=this.top*o,a=2*n*r/t,s=2*n*(r=this.right*o)/e;return i.x=s,i.y=a,i}}]),e}();function mg(e){Qf(Number.isFinite(e.right)&&Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.near)&&Number.isFinite(e.far));var t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,a=e.far;t===e._top&&n===e._bottom&&o===e._left&&i===e._right&&r===e._near&&a===e._far||(Qf(e.near>0&&e.near<e.far,"near must be greater than zero and less than far."),e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=a,e._perspectiveMatrix=(new Vm).frustum({left:o,right:i,bottom:n,top:t,near:r,far:a}),e._infinitePerspective=(new Vm).frustum({left:o,right:i,bottom:n,top:t,near:r,far:1/0}))}var vg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t=Hh({near:1,far:5e8,xOffset:0,yOffset:0},t),this._offCenterFrustum=new fg,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this.xOffset=t.xOffset,this._xOffset=this.xOffset,this.yOffset=t.yOffset,this._yOffset=this.yOffset}return u(e,[{key:"clone",value:function(){return new e({aspectRatio:this.aspectRatio,fov:this.fov,near:this.near,far:this.far})}},{key:"equals",value:function(t){return null!=t&&t instanceof e&&(gg(this),gg(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}},{key:"projectionMatrix",get:function(){return gg(this),this._offCenterFrustum.projectionMatrix}},{key:"infiniteProjectionMatrix",get:function(){return gg(this),this._offCenterFrustum.infiniteProjectionMatrix}},{key:"fovy",get:function(){return gg(this),this._fovy}},{key:"sseDenominator",get:function(){return gg(this),this._sseDenominator}},{key:"computeCullingVolume",value:function(e,t,n){return gg(this),this._offCenterFrustum.computeCullingVolume(e,t,n)}},{key:"getPixelDimensions",value:function(e,t,n,i){return gg(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i)}}]),e}();function gg(e){Qf(Number.isFinite(e.fov)&&Number.isFinite(e.aspectRatio)&&Number.isFinite(e.near)&&Number.isFinite(e.far));var t=e._offCenterFrustum;e.fov===e._fov&&e.aspectRatio===e._aspectRatio&&e.near===e._near&&e.far===e._far&&e.xOffset===e._xOffset&&e.yOffset===e._yOffset||(Qf(e.fov>=0&&e.fov<Math.PI),Qf(e.aspectRatio>0),Qf(e.near>=0&&e.near<e.far),e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}new wm,new wm,new wm,new wm,new wm,new wm,new wm,new wm,new wm,new wm,new wm,new wm,new Pm,new Pm,new Pm,new Pm,new Pm,new wm,new wm,new wm,new wm,new wm,new Pm,new Pm,new Pm;var Ag=new wm,yg=new wm,Eg=new lg([new og,new og,new og,new og,new og,new og]);function wg(e,t){var n=e.cameraDirection,i=e.cameraUp,o=e.height,r=e.distanceScales.metersPerUnit,a=e.unprojectPosition(e.center),s=Rv.WGS84.cartographicToCartesian(a,new wm),l=Rv.WGS84.eastNorthUpToFixedFrame(s),c=e.unprojectPosition(e.cameraPosition),u=Rv.WGS84.cartographicToCartesian(c,new wm),h=new wm(l.transformAsVector(new wm(n).scale(r))).normalize(),d=new wm(l.transformAsVector(new wm(i).scale(r))).normalize();return function(e,t){var n=e.getFrustumPlanes(),i=0;for(var o in n){var r=n[o],a=r.normal.dot(e.center);yg.copy(r.normal).scale(r.distance-a).add(e.center);var s=e.unprojectPosition(yg),l=Rv.WGS84.cartographicToCartesian(s,new wm);Eg.planes[i++].fromPointNormal(l,Ag.copy(t).subtract(l))}}(e,s),{camera:{position:u,direction:h,up:d},viewport:e,height:o,cullingVolume:Eg,frameNumber:t,sseDenominator:1.15}}var bg=6356752.314245179,Cg=new wm;function xg(e){var t=e.halfAxes,n=e.radius,i=e.width,o=e.height;if(t){var r=function(e){e.getColumn(0,Cg);var t=e.getColumn(1),n=e.getColumn(2);return Cg.add(t).add(n).len()}(t);return Math.log2(bg/r)}return n?Math.log2(bg/n):o&&i?(Math.log2(6378137/i)+Math.log2(6378137/o))/2:1}var Ig=0,Tg=1,Bg=3,kg=4,Pg=5,Rg=1,Mg=2,Sg="empty",Dg="scenegraph",Fg="pointcloud",Lg="mesh",Hg="I3S",Qg="TILES3D",Og="geometricError",Vg=1;function _g(e){return null!=e}var Ug=new wm,Ng=new wm,zg=new wm;function Gg(e,t,n){if(_h(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,n){var i=new wm(e[0],e[1],-e[2]);t.transform(i,i);var o=[];if(10===e.length){var r=e.slice(3,6),a=new iv;a.fromArray(e,6);var s=new wm([1,0,0]),l=new wm([0,1,0]),c=new wm([0,0,1]);s.transformByQuaternion(a),s.scale(r[0]),l.transformByQuaternion(a),l.scale(r[1]),c.transformByQuaternion(a),c.scale(r[2]),o=[].concat(H(s.toArray()),H(l.toArray()),H(c.toArray()))}else o=[].concat(H(e.slice(3,6)),H(e.slice(6,9)),H(e.slice(9,12)));var u=t.transformAsVector(o.slice(0,3)),h=t.transformAsVector(o.slice(3,6)),d=t.transformAsVector(o.slice(6,9)),p=new Pm([u[0],u[1],u[2],h[0],h[1],h[2],d[0],d[1],d[2]]);if(_g(n))return n.center=i,n.halfAxes=p,n;return new tg(i,p)}(e.box,t,n);if(e.region){var i=ce(e.region,6),o=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=Rv.WGS84.cartographicToCartesian([qf(o),qf(s),l],Ng),h=Rv.WGS84.cartographicToCartesian([qf(a),qf(r),c],zg),d=(new wm).addVectors(u,h).multiplyScalar(.5),p=(new wm).subVectors(u,h).len()/2;return jg([d[0],d[1],d[2],p],new Vm)}if(e.sphere)return jg(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function jg(e,t,n){var i=new wm(e[0],e[1],e[2]);t.transform(i,i);var o=t.getScale(Ug),r=Math.max(Math.max(o[0],o[1]),o[2]),a=e[3]*r;return _g(n)?(n.center=i,n.radius=a,n):new Ov(i,a)}function Wg(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var n=e.dynamicScreenSpaceErrorComputedDensity,i=e.dynamicScreenSpaceErrorFactor;return function(e,t){var n=e*t;return 1-Math.exp(-n*n)}(t,n)*i}return 0}function qg(e,t){var n=t.viewport,i=new(0,n.constructor)({longitude:n.longitude,latitude:n.latitude,height:n.height,width:n.width,bearing:n.bearing,zoom:n.zoom,pitch:0}),o=e.header.mbs[1],r=e.header.mbs[0],a=e.header.mbs[2],s=e.header.mbs[3],l=H(e.boundingVolume.center),c=i.unprojectPosition(i.cameraPosition),u=Rv.WGS84.cartographicToCartesian(c,new wm),h=new wm(u).subtract(l).normalize(),d=new Vm;Rv.WGS84.eastNorthUpToFixedFrame(l,d);var p=new Vm(d).invert(),f=new wm(u).transform(p),m=Math.sqrt(f[0]*f[0]+f[1]*f[1]),v=m*m/f[2],g=new wm([f[0],f[1],v]).transform(d),A=new wm(g).subtract(l).normalize(),y=h.cross(A).normalize().scale(s),E=new wm(l).add(y),w=Rv.WGS84.cartesianToCartographic(E),b=i.project([r,o,a]),C=i.project(w);return new wm(b).subtract(C).magnitude()}new wm,new wm,new Vm,new wm,new wm,new wm;var Jg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;o(this,e),Xh(this,"_map",new Map),Xh(this,"_array",void 0),Xh(this,"_length",void 0),this._array=new Array(t),this._length=t}return u(e,[{key:"length",get:function(){return this._length},set:function(e){this._length=e,e>this._array.length&&(this._array.length=e)}},{key:"values",get:function(){return this._array}},{key:"get",value:function(e){return _h(e<this._array.length),this._array[e]}},{key:"set",value:function(e,t){_h(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}},{key:"delete",value:function(e){var t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}},{key:"peek",value:function(){return this._array[this._length-1]}},{key:"push",value:function(e){if(!this._map.has(e)){var t=this.length++;this._array[t]=e,this._map.set(e,t)}}},{key:"pop",value:function(){var e=this._array[--this.length];return this._map.delete(e),e}},{key:"reserve",value:function(e){_h(e>=0),e>this._array.length&&(this._array.length=e)}},{key:"resize",value:function(e){_h(e>=0),this.length=e}},{key:"trim",value:function(e){null==e&&(e=this.length),this._array.length=e}},{key:"reset",value:function(){this._array=[],this._map=new Map,this._length=0}},{key:"find",value:function(e){return this._map.has(e)}}]),e}(),Yg={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:function(){},viewportTraversersMap:{},basePath:""},Zg=function(){function e(t){o(this,e),Xh(this,"options",void 0),Xh(this,"root",void 0),Xh(this,"requestedTiles",void 0),Xh(this,"selectedTiles",void 0),Xh(this,"emptyTiles",void 0),Xh(this,"_traversalStack",void 0),Xh(this,"_emptyTraversalStack",void 0),Xh(this,"_frameNumber",void 0),this.options=Hh(Hh({},Yg),t),this._traversalStack=new Jg,this._emptyTraversalStack=new Jg,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return u(e,[{key:"traverse",value:function(e,t,n){this.root=e,this.options=Hh(Hh({},this.options),n),this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}},{key:"reset",value:function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}},{key:"executeTraversal",value:function(e,t){var n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){var i=n.pop(),o=!1,r="all"==i.tileset.options.currentFloorId||null==i.floorIndex||i.floorIndex==i.tileset.options.currentFloorId;this.canTraverse(i,t)&&r&&(this.updateChildTiles(i,t),o=this.updateAndPushChildren(i,t,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));var a=i.parent,s=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Rg?(this.loadTile(i,t),this.selectTile(i,t)):i.refine===Mg&&(this.loadTile(i,t),l&&this.selectTile(i,t)):(this.emptyTiles[i.id]=i,this.loadTile(i,t),l&&this.selectTile(i,t)),this.touchTile(i,t),i._shouldRefine=o&&s}this.options.onTraversalEnd(t)}},{key:"updateChildTiles",value:function(e,t){var n,i=Dh(e.children);try{for(i.s();!(n=i.n()).done;){var o=n.value;this.updateTile(o,t)}}catch(e){i.e(e)}finally{i.f()}return!0}},{key:"updateAndPushChildren",value:function(e,t,n,i){var o=this.options,r=o.loadSiblings,a=o.skipLevelOfDetail,s=e.children;s.sort(this.compareDistanceToCamera.bind(this)).reverse();var l,c=e.refine===Mg&&e.hasRenderContent&&!a,u=!1,h=!0,d=Dh(s);try{for(d.s();!(l=d.n()).done;){var p=l.value;if(p._selectionDepth=i,n.find(p)&&n.delete(p),n.push(p),p.isVisibleAndInRequestVolume?u=!0:(c||r)&&(this.loadTile(p,t),this.touchTile(p,t)),c){var f=void 0;if(f=!!p._inRequestVolume&&(p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t)),!(h=h&&f))return!1}}}catch(e){d.e(e)}finally{d.f()}return u||(h=!1),h}},{key:"updateTile",value:function(e,t){this.updateTileVisibility(e,t)}},{key:"selectTile",value:function(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}},{key:"loadTile",value:function(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}},{key:"touchTile",value:function(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}},{key:"canTraverse",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e.hasChildren)return!1;var i=e.tileset.options.modelSize;return!(Ce.detectIOS()&&i&&i.x*i.y*i.z>1e6&&!e.children[0].hasChildren)&&(e.hasTilesetContent?!e.contentExpired:this.shouldRefine(e,t,n))}},{key:"shouldLoadTile",value:function(e){return e.hasUnloadedContent||e.contentExpired}},{key:"shouldSelectTile",value:function(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}},{key:"shouldRefine",value:function(e,t,n){var i=e._screenSpaceError;return n&&(i=e.getScreenSpaceError(t,!0)),i>this.options.maximumScreenSpaceError}},{key:"updateTileVisibility",value:function(e,t){var n=[];if(this.options.viewportTraversersMap)for(var i in this.options.viewportTraversersMap){this.options.viewportTraversersMap[i]===t.viewport.id&&n.push(i)}else n.push(t.viewport.id);e.updateVisibility(t,n)}},{key:"compareDistanceToCamera",value:function(e,t){return e._distanceToCamera-t._distanceToCamera}},{key:"anyChildrenVisible",value:function(e,t){var n,i=!1,o=Dh(e.children);try{for(o.s();!(n=o.n()).done;){var r=n.value;r.updateVisibility(t),i=i||r.isVisibleAndInRequestVolume}}catch(e){o.e(e)}finally{o.f()}return i}},{key:"executeEmptyTraversal",value:function(e,t){var n=!0,i=this._emptyTraversalStack;for(i.push(e);i.length>0&&n;){var o=i.pop();if(this.updateTile(o,t),o.isVisibleAndInRequestVolume||this.loadTile(o,t),this.touchTile(o,t),!o.hasRenderContent&&this.canTraverse(o,t,!1,!0)){var r,a=Dh(o.children);try{for(a.s();!(r=a.n()).done;){var s=r.value;i.find(s)&&i.delete(s),i.push(s)}}catch(e){a.e(e)}finally{a.f()}}else o.contentAvailable||(n=!1)}return n}}]),e}(),Xg=new wm;var Kg=function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";o(this,e),Xh(this,"tileset",void 0),Xh(this,"header",void 0),Xh(this,"id",void 0),Xh(this,"url",void 0),Xh(this,"parent",void 0),Xh(this,"refine",void 0),Xh(this,"type",void 0),Xh(this,"contentUrl",void 0),Xh(this,"lodMetricType",void 0),Xh(this,"lodMetricValue",void 0),Xh(this,"boundingVolume",void 0),Xh(this,"content",void 0),Xh(this,"contentState",void 0),Xh(this,"gpuMemoryUsageInBytes",void 0),Xh(this,"children",void 0),Xh(this,"depth",void 0),Xh(this,"viewportIds",void 0),Xh(this,"transform",void 0),Xh(this,"extensions",void 0),Xh(this,"userData",void 0),Xh(this,"computedTransform",void 0),Xh(this,"hasEmptyContent",void 0),Xh(this,"hasTilesetContent",void 0),Xh(this,"traverser",void 0),Xh(this,"_cacheNode",void 0),Xh(this,"_frameNumber",void 0),Xh(this,"_lodJudge",void 0),Xh(this,"_expireDate",void 0),Xh(this,"_expiredContent",void 0),Xh(this,"_shouldRefine",void 0),Xh(this,"_distanceToCamera",void 0),Xh(this,"_centerZDepth",void 0),Xh(this,"_screenSpaceError",void 0),Xh(this,"_visibilityPlaneMask",void 0),Xh(this,"_visible",void 0),Xh(this,"_inRequestVolume",void 0),Xh(this,"_stackLength",void 0),Xh(this,"_selectionDepth",void 0),Xh(this,"_touchedFrame",void 0),Xh(this,"_visitedFrame",void 0),Xh(this,"_selectedFrame",void 0),Xh(this,"_requestedFrame",void 0),Xh(this,"_priority",void 0),Xh(this,"_contentBoundingVolume",void 0),Xh(this,"_viewerRequestVolume",void 0),Xh(this,"_initialTransform",void 0),Xh(this,"floorIndex",void 0),this.header=n,this.tileset=t,this.id=r||n.id,this.url=n.url,this.parent=i,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=Ig,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new Zg({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Vm,this.transform=new Vm,this.controller=null,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}var t;return u(e,[{key:"destroy",value:function(){this.header=null}},{key:"isDestroyed",value:function(){return null===this.header}},{key:"selected",get:function(){return this._selectedFrame===this.tileset._frameNumber}},{key:"isVisible",get:function(){return this._visible}},{key:"isVisibleAndInRequestVolume",get:function(){return this._visible&&this._inRequestVolume}},{key:"hasRenderContent",get:function(){return!this.hasEmptyContent&&!this.hasTilesetContent}},{key:"hasChildren",get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0}},{key:"contentReady",get:function(){return this.contentState===Bg||this.hasEmptyContent}},{key:"contentAvailable",get:function(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}},{key:"hasUnloadedContent",get:function(){return this.hasRenderContent&&this.contentUnloaded}},{key:"contentUnloaded",get:function(){return this.contentState===Ig}},{key:"contentExpired",get:function(){return this.contentState===kg}},{key:"contentFailed",get:function(){return this.contentState===Pg}},{key:"getScreenSpaceError",value:function(e,t){switch(this.tileset.type){case Hg:return qg(this,e);case Qg:return function(e,t,n){var i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,r=n?o:e.lodMetricValue;if(0===r)return 0;var a=Math.max(e._distanceToCamera,1e-7),s=t.height,l=t.sseDenominator,c=r*s*(i.options.viewDistanceScale||1)/(a*l);return c-Wg(i,a)}(this,e,t);default:throw new Error("Unsupported tileset type")}}},{key:"_getPriority",value:function(){var e=this.tileset._traverser,t=e.options.skipLevelOfDetail,n=this.refine===Rg||t;if(n&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===Ig)return-1;var i=this.parent,o=i&&(!n||0===this._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,r=e.root?e.root._screenSpaceError:0;return Math.max(r-o,0)}},{key:"loadContent",value:(t=k(S.mark((function e(){var t,n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.hasEmptyContent){e.next=2;break}return e.abrupt("return",!1);case 2:if(!this.content){e.next=4;break}return e.abrupt("return",!0);case 4:return this.contentExpired&&(this._expireDate=null),this.contentState=Tg,e.next=9,this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));case 9:if(t=e.sent){e.next=13;break}return this.contentState=Ig,e.abrupt("return",!1);case 13:return e.prev=13,this.controller=new AbortController,n=this.tileset.getTileUrl(this.contentUrl)+"?_=".concat(this.tileset.options.imageVersion),i=this.tileset.loader,o=Hh(Hh({},this.tileset.loadOptions),{},{fetch:{signal:this.controller.signal},[i.id]:Hh(Hh({},this.tileset.loadOptions[i.id]),{},{isTileset:"json"===this.type},this._getLoaderSpecificOptions(i.id))}),e.next=20,Lf(n,i,o);case 20:if(this.content=e.sent,"glTF"==this.content.type&&(this.content.byteLength=this.content.gltf.buffers[0].byteLength),!this.tileset.options.contentLoader){e.next=25;break}return e.next=25,this.tileset.options.contentLoader(this);case 25:return this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Bg,this._onContentLoaded(),e.abrupt("return",!0);case 31:if(e.prev=31,e.t0=e.catch(13),!(e.t0.message.indexOf("The user aborted a request")>-1)){e.next=36;break}return this.contentState=Ig,e.abrupt("return",!1);case 36:throw this.contentState=Pg,e.t0;case 38:return e.prev=38,t.done(),e.finish(38);case 41:case"end":return e.stop()}}),e,this,[[13,31,38,41]])}))),function(){return t.apply(this,arguments)})},{key:"unloadContent",value:function(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=Ig,!0}},{key:"updateVisibility",value:function(e,t){if(this._frameNumber!==e.frameNumber){var n=this.parent,i=n?n._visibilityPlaneMask:lg.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){var o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,i),this._visible=this._visibilityPlaneMask!==lg.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}}},{key:"visibility",value:function(e,t){var n=e.cullingVolume,i=this.boundingVolume;return n.computeVisibilityWithPlaneMask(i,t)}},{key:"contentVisibility",value:function(){return!0}},{key:"distanceToTile",value:function(e){var t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}},{key:"cameraSpaceZDepth",value:function(e){var t=e.camera,n=this.boundingVolume;return Xg.subVectors(n.center,t.position),t.direction.dot(Xg)}},{key:"insideViewerRequestVolume",value:function(e){var t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}},{key:"updateExpiration",value:function(){if(function(e){return null!=e}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){var e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=kg,this._expiredContent=this.content)}}},{key:"extras",get:function(){return this.header.extras}},{key:"_initializeLodMetric",value:function(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}},{key:"_initializeTransforms",value:function(e){this.transform=e.transform?new Vm(e.transform):new Vm;var t=this.parent,n=this.tileset,i=t&&t.computedTransform?t.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new Vm(i).multiplyRight(this.transform);var o=t&&t._initialTransform?t._initialTransform.clone():new Vm;this._initialTransform=new Vm(o).multiplyRight(this.transform)}},{key:"_initializeBoundingVolumes",value:function(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}},{key:"_initializeContent",value:function(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Ig,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}},{key:"_initializeRenderingState",value:function(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=lg.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}},{key:"_getRefine",value:function(e){return e||this.parent&&this.parent.refine||Mg}},{key:"_isTileset",value:function(){return-1!==this.contentUrl.indexOf(".json")}},{key:"_onContentLoaded",value:function(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}},{key:"_updateBoundingVolume",value:function(e){this.boundingVolume=Gg(e.boundingVolume,this.computedTransform,this.boundingVolume);var t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Gg(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Gg(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}},{key:"_updateTransform",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vm,t=e.clone().multiplyRight(this.transform),n=!t.equals(this.computedTransform);n&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}},{key:"_getLoaderSpecificOptions",value:function(e){switch(e){case"i3s":return Hh(Hh({},this.tileset.options.i3s),{},{tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1});case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}]),e}(),$g=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"compareDistanceToCamera",value:function(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}},{key:"updateTileVisibility",value:function(e,t){if(At(w(n.prototype),"updateTileVisibility",this).call(this,e,t),this.options.ingoreVisibleCompute)e._visible=!0;else if(e.isVisibleAndInRequestVolume){var i=e.children.length>0;if(e.hasTilesetContent&&i){var o=e.children[0];return this.updateTileVisibility(o,t),void(e._visible=o._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))e._visible=!1;else{var r=e.refine===Mg,a=e._optimChildrenWithinParent===Vg;r&&a&&i&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}}}},{key:"meetsScreenSpaceErrorEarly",value:function(e,t){var n=e.parent;return!(!n||n.hasTilesetContent||n.refine!==Rg)&&!this.shouldRefine(e,t,!0)}}]),n}(Zg),eA="REQUESTED",tA="COMPLETED",nA="ERROR",iA=function(){function e(){o(this,e),Xh(this,"_statusMap",void 0),this._statusMap={}}return u(e,[{key:"add",value:function(e,t,n,i){var o=this;this._statusMap[t]||(this._statusMap[t]={request:e,callback:n,key:t,frameState:i,status:eA},e().then((function(e){o._statusMap[t].status=tA,o._statusMap[t].callback(e,i)})).catch((function(e){o._statusMap[t].status=nA,n(e)})))}},{key:"update",value:function(e,t){this._statusMap[e]&&(this._statusMap[e].frameState=t)}},{key:"find",value:function(e){return this._statusMap[e]}}]),e}(),oA=function(e){f(i,e);var t,n=Ph(i);function i(e){var t;return o(this,i),Xh(h(t=n.call(this,e)),"_tileManager",void 0),t._tileManager=new iA,t}return u(i,[{key:"shouldRefine",value:function(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";var n=2*qg(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}},{key:"updateChildTiles",value:function(e,t){var n,i=this,o=e.header.children||[],r=e.children,a=e.tileset,s=Dh(o);try{var l=function(){var o=n.value,s="".concat(o.id,"-").concat(t.viewport.id),l=r&&r.find((function(e){return e.id===s}));if(l)l&&i.updateTile(l,t);else{var c=function(){return i._loadTile(o.id,a)};i._tileManager.find(s)?i._tileManager.update(s,t):(a.tileset.nodePages&&(c=function(){return a.tileset.nodePagesTile.formTileFromNodePages(o.id)}),i._tileManager.add(c,s,(function(t){return i._onTileLoad(t,e,s)}),t))}};for(s.s();!(n=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}return!1}},{key:"_loadTile",value:(t=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.loader,o=n.getTileUrl("".concat(n.url,"/nodes/").concat(t)),r=Hh(Hh({},n.loadOptions),{},{i3s:Hh(Hh({},n.loadOptions.i3s),{},{isTileHeader:!0,loadContent:!1})}),e.next=5,Lf(o,i,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"_onTileLoad",value:function(e,t,n){var i=new Kg(t.tileset,e,t,n);t.children.push(i);var o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&this.executeTraversal(i,o)}}]),i}(Zg),rA={description:"",ellipsoid:Rv.WGS84,modelMatrix:new Vm,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:function(){},onTileUnload:function(){},onTileError:function(){},onTraversalComplete:function(e){return e},contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},aA="Tiles In Tileset(s)",sA="Tiles In Memory",lA="Tiles In View",cA="Tiles To Render",uA="Tiles Loaded",hA="Tiles Loading",dA="Tiles Unloaded",pA="Failed Tile Loads",fA="Points",mA="Tile Memory Use",vA=function(e){f(i,e);var t,n=Ph(i);function i(e,t){var r;return o(this,i),Xh(h(r=n.call(this)),"options",void 0),Xh(h(r),"loadOptions",void 0),Xh(h(r),"type",void 0),Xh(h(r),"tileset",void 0),Xh(h(r),"loader",void 0),Xh(h(r),"url",void 0),Xh(h(r),"basePath",void 0),Xh(h(r),"modelMatrix",void 0),Xh(h(r),"ellipsoid",void 0),Xh(h(r),"lodMetricType",void 0),Xh(h(r),"lodMetricValue",void 0),Xh(h(r),"refine",void 0),Xh(h(r),"root",void 0),Xh(h(r),"roots",void 0),Xh(h(r),"asset",void 0),Xh(h(r),"description",void 0),Xh(h(r),"properties",void 0),Xh(h(r),"extras",void 0),Xh(h(r),"attributions",void 0),Xh(h(r),"credits",void 0),Xh(h(r),"stats",void 0),Xh(h(r),"traverseCounter",void 0),Xh(h(r),"geometricError",void 0),Xh(h(r),"selectedTiles",void 0),Xh(h(r),"cartographicCenter",void 0),Xh(h(r),"cartesianCenter",void 0),Xh(h(r),"zoom",void 0),Xh(h(r),"boundingVolume",void 0),Xh(h(r),"gpuMemoryUsageInBytes",void 0),Xh(h(r),"dynamicScreenSpaceErrorComputedDensity",void 0),Xh(h(r),"_traverser",void 0),Xh(h(r),"_cache",void 0),Xh(h(r),"_requestScheduler",void 0),Xh(h(r),"_frameNumber",void 0),Xh(h(r),"_queryParamsString",void 0),Xh(h(r),"_queryParams",void 0),Xh(h(r),"_extensionsUsed",void 0),Xh(h(r),"_tiles",void 0),Xh(h(r),"_pendingCount",void 0),Xh(h(r),"lastUpdatedVieports",void 0),Xh(h(r),"_requestedTiles",void 0),Xh(h(r),"_emptyTiles",void 0),Xh(h(r),"frameStateData",void 0),Xh(h(r),"maximumMemoryUsage",void 0),Xh(h(r),"loadingTiles",void 0),_h(e),r.options=Hh(Hh({},rA),t),r.tileset=e,r.loader=e.loader,r.type=e.type,r.url=e.url,r.basePath=e.basePath||qd(r.url),r.modelMatrix=r.options.modelMatrix,r.ellipsoid=r.options.ellipsoid,r.lodMetricType=e.lodMetricType,r.lodMetricValue=e.lodMetricValue,r.refine=e.root.refine,r.loadOptions=r.options.loadOptions||{},r.root=null,r.roots={},r.cartographicCenter=null,r.cartesianCenter=null,r.zoom=1,r.boundingVolume=null,r.traverseCounter=0,r.geometricError=0,r._traverser=r._initializeTraverser(),r._cache=new Fv,r._requestScheduler=new Gd({throttleRequests:r.options.throttleRequests,maxRequests:r.options.maxRequests}),r._frameNumber=0,r._pendingCount=0,r._tiles={},r.selectedTiles=[],r._emptyTiles=[],r._requestedTiles=[],r.frameStateData={},r.lastUpdatedVieports=null,r._queryParams={},r._queryParamsString="",r.maximumMemoryUsage=r.options.maximumMemoryUsage||32,r.gpuMemoryUsageInBytes=0,r.stats=new Qd({id:r.url}),r.loadingTiles=[],r._initializeStats(),r._extensionsUsed=void 0,r.dynamicScreenSpaceErrorComputedDensity=0,r.extras=null,r.asset={},r.credits={},r.description=r.options.description||"",r._initializeTileSet(e),r}return u(i,[{key:"destroy",value:function(){this._destroy()}},{key:"isLoaded",value:function(){return 0===this._pendingCount&&0!==this._frameNumber}},{key:"tiles",get:function(){return Object.values(this._tiles)}},{key:"frameNumber",get:function(){return this._frameNumber}},{key:"queryParams",get:function(){return this._queryParamsString||(this._queryParamsString=function(e){for(var t=[],n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];t.push("".concat(o,"=").concat(e[o]))}switch(t.length){case 0:return"";case 1:return"?".concat(t[0]);default:return"?".concat(t.join("&"))}}(this._queryParams)),this._queryParamsString}},{key:"setProps",value:function(e){this.options=Hh(Hh({},this.options),e)}},{key:"setOptions",value:function(e){this.options=Hh(Hh({},this.options),e)}},{key:"getTileUrl",value:function(e){return e.startsWith("data:")?e:"".concat(e).concat(this.queryParams)}},{key:"hasExtension",value:function(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}},{key:"update",value:function(e){if((!("loadTiles"in this.options)||this.options.loadTiles)&&!(this.traverseCounter>0)){!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e instanceof Array||(e=[e]),this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;var t,n=[],i=Dh(e);try{for(i.s();!(t=i.n()).done;){var o=t.value.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}}catch(e){i.e(e)}finally{i.f()}var r,a=Dh(e);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=s.id;if(this.roots[l]||(this.roots[l]=this._initializeTileHeaders(this.tileset,null)),n.includes(l)){var c=wg(s,this._frameNumber);this._traverser.traverse(this.roots[l],c,this.options)}}}catch(e){a.e(e)}finally{a.f()}}}},{key:"_needTraverse",value:function(e){var t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}},{key:"_onTraversalEnd",value:function(e){var t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});var n=this.frameStateData[t],i=Object.values(this._traverser.selectedTiles);n.selectedTiles=i,n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}},{key:"_updateTiles",value:function(){for(var e in this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[],this.frameStateData){var t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);var n,i=Dh(this.selectedTiles);try{for(i.s();!(n=i.n()).done;){var o=n.value;this._tiles[o.id]=o}}catch(e){i.e(e)}finally{i.f()}this._loadTiles(),this._unloadTiles(),this._updateStats()}},{key:"_tilesChanged",value:function(e,t){if(e.length!==t.length)return!0;var n=new Set(e.map((function(e){return e.id}))),i=new Set(t.map((function(e){return e.id}))),o=e.filter((function(e){return!i.has(e.id)})).length>0;return o=o||t.filter((function(e){return!n.has(e.id)})).length>0}},{key:"_loadTiles",value:function(){var e,t=Dh(this._requestedTiles);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.contentUnloaded&&this._loadTile(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"_unloadTiles",value:function(){this._cache.unloadTiles(this,(function(e,t){return e._unloadTile(t)}))}},{key:"_updateStats",value:function(){var e,t=0,n=0,i=Dh(this.selectedTiles);try{for(i.s();!(e=i.n()).done;){var o=e.value;o.contentAvailable&&o.content&&(t++,o.content.pointCount&&(n+=o.content.pointCount))}}catch(e){i.e(e)}finally{i.f()}this.stats.get(lA).count=this.selectedTiles.length,this.stats.get(cA).count=t,this.stats.get(fA).count=n}},{key:"_initializeTileSet",value:function(e){this.root=this._initializeTileHeaders(e,null),this.type===Qg&&this._initializeCesiumTileset(e),this.type===Hg&&this._initializeI3STileset(),this._calculateViewProps()}},{key:"_calculateViewProps",value:function(){var e=this.root;_h(e);var t=e.boundingVolume.center;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new wm,void(this.zoom=1);this.cartographicCenter=Rv.WGS84.cartesianToCartographic(t,new wm),this.cartesianCenter=t,this.zoom=xg(e.boundingVolume)}},{key:"_initializeStats",value:function(){this.stats.get(aA),this.stats.get(hA),this.stats.get(sA),this.stats.get(lA),this.stats.get(cA),this.stats.get(uA),this.stats.get(dA),this.stats.get(pA),this.stats.get(fA,"memory"),this.stats.get(mA,"memory")}},{key:"_initializeTileHeaders",value:function(e,t){var n=new Kg(this,e.root,t);if(t&&(t.children.push(n),n.depth=t.depth+1),this.type===Qg){var i=[];for(i.push(n);i.length>0;){var o=i.pop();this.stats.get(aA).incrementCount();var r,a=Dh(o.header.children||[]);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=new Kg(this,s,o);o.children.push(l),l.depth=o.depth+1,i.push(l)}}catch(e){a.e(e)}finally{a.f()}}}return n}},{key:"_initializeTraverser",value:function(){var e;switch(this.type){case Qg:e=$g;break;case Hg:e=oA;break;default:e=Zg}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}},{key:"_destroyTileHeaders",value:function(e){this._destroySubtree(e)}},{key:"_loadTile",value:(t=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this._onStartTileLoading(t),e.next=4,t.loadContent();case 4:n=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),this._onTileLoadError(t,e.t0);case 10:return e.prev=10,this._onEndTileLoading(t),this._onTileLoad(t,n),e.finish(10);case 14:case"end":return e.stop()}}),e,this,[[0,7,10,14]])}))),function(e){return t.apply(this,arguments)})},{key:"_onTileLoadError",value:function(e,t){this.stats.get(pA).incrementCount();var n=t.message||t.toString(),i=e.url;console.error("A 3D tile failed to load: ".concat(e.url," ").concat(n)),this.options.onTileError(e,n,i)}},{key:"_onTileLoad",value:function(e,t){t&&(e&&e.content&&function(e,t){_h(e),_h(t);var n=t.rtcCenter,i=t.gltfUpAxis,o=e.computedTransform,r=e.boundingVolume.center,a=new Vm(o);switch(n&&a.translate(n),i){case"Z":break;case"Y":var s=(new Vm).rotateX(Math.PI/2);a=a.multiplyRight(s);break;case"X":var l=(new Vm).rotateY(-Math.PI/2);a=a.multiplyRight(l)}t.isQuantized&&a.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);var c=new wm(r);t.cartesianModelMatrix=a,t.cartesianOrigin=c;var u=Rv.WGS84.cartesianToCartographic(c,new wm),h=Rv.WGS84.eastNorthUpToFixedFrame(c).invert();t.cartographicModelMatrix=h.multiplyRight(a),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e))}},{key:"_onStartTileLoading",value:function(e){this.loadingTiles.push(e),this._pendingCount++,this.stats.get(hA).incrementCount()}},{key:"_onEndTileLoading",value:function(e){this.loadingTiles=this.loadingTiles.filter((function(t){return t!=e})),this._pendingCount--,this.stats.get(hA).decrementCount(),this.emit("endTileLoading",{tile:e,loadingCount:this._pendingCount})}},{key:"_addTileToCache",value:function(e){this._cache.add(this,e,(function(t){return t._updateCacheStats(e)}))}},{key:"_updateCacheStats",value:function(e){this.stats.get(uA).incrementCount(),this.stats.get(sA).incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get(mA).count=this.gpuMemoryUsageInBytes}},{key:"_unloadTile",value:function(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get(sA).decrementCount(),this.stats.get(dA).incrementCount(),this.stats.get(mA).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}},{key:"_destroy",value:function(){var e=[];for(this.root&&e.push(this.root);e.length>0;){var t,n=e.pop(),i=Dh(n.children);try{for(i.s();!(t=i.n()).done;){var o=t.value;e.push(o)}}catch(e){i.e(e)}finally{i.f()}this._destroyTile(n)}this.root=null}},{key:"_destroySubtree",value:function(e){var t=e,n=[];for(n.push(t);n.length>0;){var i,o=Dh((e=n.pop()).children);try{for(o.s();!(i=o.n()).done;){var r=i.value;n.push(r)}}catch(e){o.e(e)}finally{o.f()}e!==t&&this._destroyTile(e)}t.children=[]}},{key:"_destroyTile",value:function(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}},{key:"_initializeCesiumTileset",value:function(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed,this.extras=e.extras}},{key:"_initializeI3STileset",value:function(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}]),i}(vo);var gA="3.1.4",AA="cmpt",yA="pnts",EA="b3dm",wA="i3dm",bA="glTF";function CA(e,t,n){_h(e instanceof ArrayBuffer);var i=new TextDecoder("utf8"),o=new Uint8Array(e,t,n);return i.decode(o)}function xA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(e);return"".concat(String.fromCharCode(n.getUint8(t+0))).concat(String.fromCharCode(n.getUint8(t+1))).concat(String.fromCharCode(n.getUint8(t+2))).concat(String.fromCharCode(n.getUint8(t+3)))}var IA={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.4",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function TA(e){for(var t=1/0,n=1/0,i=1/0,o=-1/0,r=-1/0,a=-1/0,s=e.POSITION?e.POSITION.value:[],l=s&&s.length,c=0;c<l;c+=3){var u=s[c],h=s[c+1],d=s[c+2];t=u<t?u:t,n=h<n?h:n,i=d<i?d:i,o=u>o?u:o,r=h>r?h:r,a=d>a?d:a}return[[t,n,i],[o,r,a]]}var BA=function(){function e(t,n){o(this,e),Xh(this,"fields",void 0),Xh(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(t)),function(e){var t,n={},i=Dh(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;n[o.name]&&console.warn("Schema: duplicated field name",o.name,o),n[o.name]=!0}}catch(e){i.e(e)}finally{i.f()}}(t),this.fields=t,this.metadata=n||new Map}return u(e,[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}},{key:"select",value:function(){for(var t=Object.create(null),n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];for(var r=0,a=i;r<a.length;r++){var s=a[r];t[s]=!0}var l=this.fields.filter((function(e){return t[e.name]}));return new e(l,this.metadata)}},{key:"selectAt",value:function(){for(var t=this,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var r=i.map((function(e){return t.fields[e]})).filter(Boolean);return new e(r,this.metadata)}},{key:"assign",value:function(t){var n,i=this.metadata;if(t instanceof e){var o=t;n=o.fields,i=kA(kA(new Map,this.metadata),o.metadata)}else n=t;var r,a=Object.create(null),s=Dh(this.fields);try{for(s.s();!(r=s.n()).done;){var l=r.value;a[l.name]=l}}catch(e){s.e(e)}finally{s.f()}var c,u=Dh(n);try{for(u.s();!(c=u.n()).done;){var h=c.value;a[h.name]=h}}catch(e){u.e(e)}finally{u.f()}return new e(Object.values(a),i)}}]),e}();function kA(e,t){return new Map([].concat(H(e||new Map),H(t||new Map)))}var PA,RA=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;o(this,e),Xh(this,"name",void 0),Xh(this,"type",void 0),Xh(this,"nullable",void 0),Xh(this,"metadata",void 0),this.name=t,this.type=n,this.nullable=i,this.metadata=r}return u(e,[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}]),e}();!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(PA||(PA={}));var MA=function(){function e(){o(this,e)}return u(e,[{key:"typeId",get:function(){return PA.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===PA.Null}},{key:"isInt",value:function(e){return e&&e.typeId===PA.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===PA.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===PA.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===PA.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===PA.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===PA.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===PA.Date}},{key:"isTime",value:function(e){return e&&e.typeId===PA.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===PA.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===PA.Interval}},{key:"isList",value:function(e){return e&&e.typeId===PA.List}},{key:"isStruct",value:function(e){return e&&e.typeId===PA.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===PA.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===PA.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===PA.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===PA.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===PA.Dictionary}}]),e}(),SA=function(e,t){f(i,e);var n=Ph(i);function i(e,t){var r;return o(this,i),Xh(h(r=n.call(this)),"isSigned",void 0),Xh(h(r),"bitWidth",void 0),r.isSigned=e,r.bitWidth=t,r}return u(i,[{key:"typeId",get:function(){return PA.Int}},{key:t,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),i}(MA,Symbol.toStringTag),DA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!0,8)}return n}(SA),FA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!0,16)}return n}(SA),LA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!0,32)}return n}(SA),HA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!1,8)}return n}(SA),QA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!1,16)}return n}(SA),OA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,!1,32)}return n}(SA),VA=32,_A=64,UA=function(e,t){f(i,e);var n=Ph(i);function i(e){var t;return o(this,i),Xh(h(t=n.call(this)),"precision",void 0),t.precision=e,t}return u(i,[{key:"typeId",get:function(){return PA.Float}},{key:t,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),i}(MA,Symbol.toStringTag),NA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,VA)}return n}(UA),zA=function(e){f(n,e);var t=Ph(n);function n(){return o(this,n),t.call(this,_A)}return n}(UA),GA=function(e,t){f(i,e);var n=Ph(i);function i(e,t){var r;return o(this,i),Xh(h(r=n.call(this)),"listSize",void 0),Xh(h(r),"children",void 0),r.listSize=e,r.children=[t],r}return u(i,[{key:"typeId",get:function(){return PA.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:t,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),i}(MA,Symbol.toStringTag);function jA(e,t,n){var i=function(e){switch(e.constructor){case Int8Array:return new DA;case Uint8Array:return new HA;case Int16Array:return new FA;case Uint16Array:return new QA;case Int32Array:return new LA;case Uint32Array:return new OA;case Float32Array:return new NA;case Float64Array:return new zA;default:throw new Error("array type not supported")}}(t.value),o=n||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new RA(e,new GA(t.size,new RA("value",i)),!1,o)}function WA(e,t,n){var i=JA(t.metadata),o=[],r=function(e){var t={};for(var n in e){var i=e[n];t[i.name||"undefined"]=i}return t}(t.attributes);for(var a in e){var s=qA(a,e[a],r[a]);o.push(s)}if(n){var l=qA("indices",n);o.push(l)}return new BA(o,i)}function qA(e,t,n){return jA(e,t,n?JA(n.metadata):void 0)}function JA(e){var t=new Map;for(var n in e)t.set("".concat(n,".string"),JSON.stringify(e[n]));return t}var YA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},ZA={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},XA=function(){function e(t){o(this,e),Xh(this,"draco",void 0),Xh(this,"decoder",void 0),Xh(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}return u(e,[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);var i=this.decoder.GetEncodedGeometryType(n),o=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{var r;switch(i){case this.draco.TRIANGULAR_MESH:r=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:r=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!r.ok()||!o.ptr){var a="DRACO decompression failed: ".concat(r.error_msg());throw new Error(a)}var s=this._getDracoLoaderData(o,i,t),l=this._getMeshData(o,s,t),c=TA(l.attributes),u=WA(l.attributes,s,l.indices),h=Hh(Hh({loader:"draco",loaderData:s,header:{vertexCount:o.num_points(),boundingBox:c}},l),{},{schema:u});return h}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}},{key:"_getDracoLoaderData",value:function(e,t,n){var i=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:i,attributes:o}}},{key:"_getDracoAttributes",value:function(e,t){for(var n={},i=0;i<e.num_attributes();i++){var o=this.decoder.GetAttribute(e,i),r=this._getAttributeMetadata(e,i);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:i,metadata:r};var a=this._getQuantizationTransform(o,t);a&&(n[o.unique_id()].quantization_transform=a);var s=this._getOctahedronTransform(o,t);s&&(n[o.unique_id()].octahedron_transform=s)}return n}},{key:"_getMeshData",value:function(e,t,n){var i=this._getMeshAttributes(t,e,n);if(!i.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:i,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:i}}},{key:"_getMeshAttributes",value:function(e,t,n){for(var i={},o=0,r=Object.values(e.attributes);o<r.length;o++){var a=r[o],s=this._deduceAttributeName(a,n);a.name=s;var l=this._getAttributeValues(t,a),c=l.value,u=l.size;i[s]={value:c,size:u,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}return i}},{key:"_getTriangleListIndices",value:function(e){var t=3*e.num_faces(),n=4*t,i=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(e,n,i),new Uint32Array(this.draco.HEAPF32.buffer,i,t).slice()}finally{this.draco._free(i)}}},{key:"_getTriangleStripIndices",value:function(e){var t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){for(var t=e.size(),n=new Int32Array(t),i=0;i<t;i++)n[i]=e.GetValue(i);return n}(t)}finally{this.draco.destroy(t)}}},{key:"_getAttributeValues",value:function(e,t){var n,i=ZA[t.data_type],o=t.num_components,r=e.num_points()*o,a=r*i.BYTES_PER_ELEMENT,s=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,i),l=this.draco._malloc(a);try{var c=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,c,s,a,l),n=new i(this.draco.HEAPF32.buffer,l,r).slice()}finally{this.draco._free(l)}return{value:n,size:o}}},{key:"_deduceAttributeName",value:function(e,t){for(var n=e.unique_id,i=0,o=Object.entries(t.extraAttributes||{});i<o.length;i++){var r=ce(o[i],2),a=r[0];if(r[1]===n)return a}var s=e.attribute_type;for(var l in YA){if(this.draco[l]===s)return YA[l]}var c=t.attributeNameEntry||"name";return e.metadata[c]?e.metadata[c].string:"CUSTOM_ATTRIBUTE_".concat(n)}},{key:"_getTopLevelMetadata",value:function(e){var t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}},{key:"_getAttributeMetadata",value:function(e,t){var n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}},{key:"_getDracoMetadata",value:function(e){if(!e||!e.ptr)return{};for(var t={},n=this.metadataQuerier.NumEntries(e),i=0;i<n;i++){var o=this.metadataQuerier.GetEntryName(e,i);t[o]=this._getDracoMetadataField(e,o)}return t}},{key:"_getDracoMetadataField",value:function(e,t){var n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);var i=function(e){for(var t=e.size(),n=new Int32Array(t),i=0;i<t;i++)n[i]=e.GetValue(i);return n}(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:i}}finally{this.draco.destroy(n)}}},{key:"_disableAttributeTransforms",value:function(e){var t,n=e.quantizedAttributes,i=void 0===n?[]:n,o=e.octahedronAttributes,r=void 0===o?[]:o,a=Dh([].concat(H(i),H(r)));try{for(a.s();!(t=a.n()).done;){var s=t.value;this.decoder.SkipAttributeTransform(this.draco[s])}}catch(e){a.e(e)}finally{a.f()}}},{key:"_getQuantizationTransform",value:function(e,t){var n=this,i=t.quantizedAttributes,o=void 0===i?[]:i,r=e.attribute_type();if(o.map((function(e){return n.decoder[e]})).includes(r)){var a=new this.draco.AttributeQuantizationTransform;try{if(a.InitFromAttribute(e))return{quantization_bits:a.quantization_bits(),range:a.range(),min_values:new Float32Array([1,2,3]).map((function(e){return a.min_value(e)}))}}finally{this.draco.destroy(a)}}return null}},{key:"_getOctahedronTransform",value:function(e,t){var n=this,i=t.octahedronAttributes,o=void 0===i?[]:i,r=e.attribute_type();if(o.map((function(e){return n.decoder[e]})).includes(r)){var a=new this.draco.AttributeQuantizationTransform;try{if(a.InitFromAttribute(e))return{quantization_bits:a.quantization_bits()}}finally{this.draco.destroy(a)}}return null}}]),e}();var KA,$A="1.4.1",ey="https://www.gstatic.com/draco/versioned/decoders/".concat($A,"/draco_decoder.js"),ty="https://www.gstatic.com/draco/versioned/decoders/".concat($A,"/draco_wasm_wrapper.js"),ny="https://www.gstatic.com/draco/versioned/decoders/".concat($A,"/draco_decoder.wasm");function iy(e){return oy.apply(this,arguments)}function oy(){return(oy=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.modules||{},KA=n.draco3d?KA||n.draco3d.createDecoderModule({}).then((function(e){return{draco:e}})):KA||ry(t),e.next=4,KA;case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ry(e){return ay.apply(this,arguments)}function ay(){return(ay=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.draco&&t.draco.decoderType,e.next="js"===e.t0?3:(e.t0,7);break;case 3:return e.next=5,md(ey,"draco",t);case 5:return n=e.sent,e.abrupt("break",22);case 7:return e.t1=Promise,e.next=11,md(ty,"draco",t);case 11:return e.t2=e.sent,e.next=14,md(ny,"draco",t);case 14:return e.t3=e.sent,e.t4=[e.t2,e.t3],e.next=18,e.t1.all.call(e.t1,e.t4);case 18:o=e.sent,r=ce(o,2),n=r[0],i=r[1];case 22:return n=n||Oh.DracoDecoderModule,e.next=25,sy(n,i);case 25:return e.abrupt("return",e.sent);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sy(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(Hh(Hh({},n),{},{onModuleLoaded:function(e){return t({draco:e})}}))}))}var ly=Hh(Hh({},IA),{},{parse:function(e,t){return cy.apply(this,arguments)}});function cy(){return(cy=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,iy(n);case 2:return i=e.sent,o=i.draco,r=new XA(o),e.prev=5,e.abrupt("return",r.parseSync(t,null==n?void 0:n.draco));case 7:return e.prev=7,r.destroy(),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[5,,7,10]])})))).apply(this,arguments)}var uy={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},hy=Hh(Hh({},{POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6}),uy),dy={[uy.DOUBLE]:Float64Array,[uy.FLOAT]:Float32Array,[uy.UNSIGNED_SHORT]:Uint16Array,[uy.UNSIGNED_INT]:Uint32Array,[uy.UNSIGNED_BYTE]:Uint8Array,[uy.BYTE]:Int8Array,[uy.SHORT]:Int16Array,[uy.INT]:Int32Array},py={DOUBLE:uy.DOUBLE,FLOAT:uy.FLOAT,UNSIGNED_SHORT:uy.UNSIGNED_SHORT,UNSIGNED_INT:uy.UNSIGNED_INT,UNSIGNED_BYTE:uy.UNSIGNED_BYTE,BYTE:uy.BYTE,SHORT:uy.SHORT,INT:uy.INT},fy="Failed to convert GL type",my=function(){function e(){o(this,e)}return u(e,null,[{key:"fromTypedArray",value:function(e){for(var t in e=ArrayBuffer.isView(e)?e.constructor:e,dy){if(dy[t]===e)return t}throw new Error(fy)}},{key:"fromName",value:function(e){var t=py[e];if(!t)throw new Error(fy);return t}},{key:"getArrayType",value:function(e){switch(e){case uy.UNSIGNED_SHORT_5_6_5:case uy.UNSIGNED_SHORT_4_4_4_4:case uy.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:var t=dy[e];if(!t)throw new Error(fy);return t}}},{key:"getByteSize",value:function(t){return e.getArrayType(t).BYTES_PER_ELEMENT}},{key:"validate",value:function(t){return Boolean(e.getArrayType(t))}},{key:"createTypedArray",value:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0;void 0===o&&(o=(n.byteLength-i)/e.getByteSize(t));var r=e.getArrayType(t);return new r(n,i,o)}}]),e}();function vy(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=e>>11&31,i=e>>5&63,o=31&e;return t[0]=n<<3,t[1]=i<<2,t[2]=o<<3,t}function gy(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return Jf(e,0,t)/t*2-1}function Ay(e){return e<0?-1:1}function yy(e,t,n,i){if(function(e,t){if(!e)throw new Error("math.gl assertion failed. ".concat(t))}(i),e<0||e>n||t<0||t>n)throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(n));if(i.x=gy(e,n),i.y=gy(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){var o=i.x;i.x=(1-Math.abs(i.y))*Ay(o),i.y=(1-Math.abs(o))*Ay(i.y)}return i.normalize()}function Ey(e,t,n){return yy(e,t,255,n)}new um,new wm,new um,new um;var wy=function(){function e(t,n){o(this,e),Xh(this,"json",void 0),Xh(this,"buffer",void 0),Xh(this,"featuresLength",0),Xh(this,"_cachedTypedArrays",{}),this.json=t,this.buffer=n}return u(e,[{key:"getExtension",value:function(e){return this.json.extensions&&this.json.extensions[e]}},{key:"hasProperty",value:function(e){return Boolean(this.json[e])}},{key:"getGlobalProperty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hy.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=this.json[e];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(e,t,n,1,i.byteOffset):i}},{key:"getPropertyArray",value:function(e,t,n){var i=this.json[e];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(t=my.fromName(i.componentType)),this._getTypedArrayFromBinary(e,t,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(e,t,i)}},{key:"getProperty",value:function(e,t,n,i,o){var r=this.json[e];if(!r)return r;var a=this.getPropertyArray(e,t,n);if(1===n)return a[i];for(var s=0;s<n;++s)o[s]=a[n*i+s];return o}},{key:"_getTypedArrayFromBinary",value:function(e,t,n,i,o){var r=this._cachedTypedArrays,a=r[e];return a||(a=my.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+o,i*n),r[e]=a),a}},{key:"_getTypedArrayFromArray",value:function(e,t,n){var i=this._cachedTypedArrays,o=i[e];return o||(o=my.createTypedArray(t,n),i[e]=o),o}}]),e}(),by={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Cy={SCALAR:function(e,t){return e[t]},VEC2:function(e,t){return[e[2*t+0],e[2*t+1]]},VEC3:function(e,t){return[e[3*t+0],e[3*t+1],e[3*t+2]]},VEC4:function(e,t){return[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]]},MAT2:function(e,t){return[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]]},MAT3:function(e,t){return[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]]},MAT4:function(e,t){return[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]}},xy={SCALAR:function(e,t,n){t[n]=e},VEC2:function(e,t,n){t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:function(e,t,n){t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:function(e,t,n){t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:function(e,t,n){t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:function(e,t,n){t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:function(e,t,n){t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};var Iy=function(e){return void 0!==e};function Ty(e,t,n){if(!t)return null;var i=e.getExtension("3DTILES_batch_table_hierarchy"),o=t.HIERARCHY;return o&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=o,i=o),i?function(e,t){var n,i,o,r=e.instancesLength,a=e.classes,s=e.classIds,l=e.parentCounts,c=e.parentIds,u=r;Iy(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,s=getBinaryAccessor(s).createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,r));if(Iy(l))for(Iy(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,l=getBinaryAccessor(l).createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,r)),o=new Uint16Array(r),u=0,n=0;n<r;++n)o[n]=u,u+=l[n];Iy(c)&&Iy(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,c=getBinaryAccessor(c).createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,u));var h=a.length;for(n=0;n<h;++n){var d=a[n].length,p=a[n].instances,f=getBinaryProperties(d,p,t);a[n].instances=combine(f,p)}var m=new Array(h).fill(0),v=new Uint16Array(r);for(n=0;n<r;++n)i=s[n],v[n]=m[i],++m[i];var g={classes:a,classIds:s,classIndexes:v,parentCounts:l,parentIndexes:o,parentIds:c};return function(e){for(var t=e.classIds.length,n=0;n<t;++n)ky(e,n,stack)}(g),g}(i,n):null}function By(e,t,n){if(e){var i=e.parentCounts;return e.parentIds?n(e,t):i>0?function(e,t,n){var i=e.classIds,o=e.parentCounts,r=e.parentIds,a=e.parentIndexes,s=i.length,l=scratchVisited;l.length=Math.max(l.length,s);var c=++marker,u=scratchStack;u.length=0,u.push(t);for(;u.length>0;)if(l[t=u.pop()]!==c){l[t]=c;var h=n(e,t);if(Iy(h))return h;for(var d=o[t],p=a[t],f=0;f<d;++f){var m=r[p+f];m!==t&&u.push(m)}}return null}(e,t,n):function(e,t,n){var i=!0;for(;i;){var o=n(e,t);if(Iy(o))return o;var r=e.parentIds[t];i=r!==t,t=r}throw new Error("traverseHierarchySingleParent")}(e,t,n)}}function ky(e,t,n){var i=e.parentCounts,o=e.parentIds,r=e.parentIndexes,a=e.classIds.length;if(Iy(o)){assert(t<a,"Parent index ".concat(t," exceeds the total number of instances: ").concat(a)),assert(-1===n.indexOf(t),"Circular dependency detected in the batch table hierarchy."),n.push(t);for(var s=Iy(i)?i[t]:1,l=Iy(i)?r[t]:t,c=0;c<s;++c){var u=o[l+c];u!==t&&ky(e,u,n)}n.pop(t)}}function Py(e){return null!=e}var Ry=function(e,t){return e},My={HIERARCHY:!0,extensions:!0,extras:!0},Sy=function(){function e(t,n,i){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(var s in o(this,e),Xh(this,"json",void 0),Xh(this,"binary",void 0),Xh(this,"featureCount",void 0),Xh(this,"_extensions",void 0),Xh(this,"_properties",void 0),Xh(this,"_binaryProperties",void 0),Xh(this,"_hierarchy",void 0),_h(i>=0),this.json=t||{},this.binary=n,this.featureCount=i,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={},this.json)My[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),a["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Ty(this,this.json,this.binary))}return u(e,[{key:"getExtension",value:function(e){return this.json&&this.json.extensions&&this.json.extensions[e]}},{key:"memorySizeInBytes",value:function(){return 0}},{key:"isClass",value:function(e,t){return this._checkBatchId(e),_h("string"==typeof t,t),!!this._hierarchy&&Py(By(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return e.classes[i].name===t})))}},{key:"isExactClass",value:function(e,t){return _h("string"==typeof t,t),this.getExactClassName(e)===t}},{key:"getExactClassName",value:function(e){if(this._checkBatchId(e),this._hierarchy){var t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}},{key:"hasProperty",value:function(e,t){return this._checkBatchId(e),_h("string"==typeof t,t),Py(this._properties[t])||this._hasPropertyInHierarchy(e,t)}},{key:"getPropertyNames",value:function(e,t){var n;this._checkBatchId(e),(t=Py(t)?t:[]).length=0;var i=Object.keys(this._properties);return(n=t).push.apply(n,H(i)),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}},{key:"getProperty",value:function(e,t){if(this._checkBatchId(e),_h("string"==typeof t,t),this._binaryProperties){var n=this._binaryProperties[t];if(Py(n))return this._getBinaryProperty(n,e)}var i=this._properties[t];if(Py(i))return Ry(i[e]);if(this._hierarchy){var o=this._getHierarchyProperty(e,t);if(Py(o))return o}}},{key:"setProperty",value:function(e,t,n){var i=this.featureCount;if(this._checkBatchId(e),_h("string"==typeof t,t),this._binaryProperties){var o=this._binaryProperties[t];if(o)return void this._setBinaryProperty(o,e,n)}if(!this._hierarchy||!this._setHierarchyProperty(this,e,t,n)){var r=this._properties[t];Py(r)||(this._properties[t]=new Array(i),r=this._properties[t]),r[e]=Ry(n)}}},{key:"_checkBatchId",value:function(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}},{key:"_getBinaryProperty",value:function(e,t){return e.unpack(e.typedArray,t)}},{key:"_setBinaryProperty",value:function(e,t,n){e.pack(n,e.typedArray,t)}},{key:"_initializeBinaryProperties",value:function(){var e=null;for(var t in this._properties){var n=this._properties[t],i=this._initializeBinaryProperty(t,n);i&&((e=e||{})[t]=i)}return e}},{key:"_initializeBinaryProperty",value:function(e,t){if("byteOffset"in t){var n=t;_h(this.binary,"Property ".concat(e," requires a batch table binary.")),_h(n.type,"Property ".concat(e," requires a type."));var i=function(e,t,n,i){var o=e.componentType;_h(e.componentType);var r="string"==typeof o?my.fromName(o):o,a=by[e.type],s=Cy[e.type],l=xy[e.type];return n+=e.byteOffset,{values:my.createTypedArray(r,t,n,a*i),type:r,size:a,unpacker:s,packer:l}}(n,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}},{key:"_hasPropertyInHierarchy",value:function(e,t){if(!this._hierarchy)return!1;var n=By(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return Py(e.classes[i].instances[t])}));return Py(n)}},{key:"_getPropertyNamesInHierarchy",value:function(e,t){By(this._hierarchy,e,(function(e,n){var i=e.classIds[n],o=e.classes[i].instances;for(var r in o)o.hasOwnProperty(r)&&-1===t.indexOf(r)&&t.push(r)}))}},{key:"_getHierarchyProperty",value:function(e,t){var n=this;return By(this._hierarchy,e,(function(e,i){var o=e.classIds[i],r=e.classes[o],a=e.classIndexes[i],s=r.instances[t];return Py(s)?Py(s.typedArray)?n._getBinaryProperty(s,a):Ry(s[a]):null}))}},{key:"_setHierarchyProperty",value:function(e,t,n,i){var o=this,r=By(this._hierarchy,t,(function(e,r){var a=e.classIds[r],s=e.classes[a],l=e.classIndexes[r],c=s.instances[n];return!!Py(c)&&(_h(r===t,'Inherited property "'.concat(n,'" is read-only.')),Py(c.typedArray)?o._setBinaryProperty(c,l,i):c[l]=Ry(i),!0)}));return Py(r)}}]),e}();function Dy(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new DataView(t);if(e.magic=i.getUint32(n,!0),n+=4,e.version=i.getUint32(n,!0),n+=4,e.byteLength=i.getUint32(n,!0),n+=4,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return n}var Fy="b3dm tile in legacy format.";function Ly(e,t,n){var i,o=new DataView(t);e.header=e.header||{};var r=o.getUint32(n,!0);n+=4;var a=o.getUint32(n,!0);n+=4;var s=o.getUint32(n,!0);n+=4;var l=o.getUint32(n,!0);return n+=4,s>=570425344?(n-=8,i=r,s=a,l=0,r=0,a=0,console.warn(Fy)):l>=570425344&&(n-=4,i=s,s=r,l=a,r=0,a=0,console.warn(Fy)),e.header.featureTableJsonByteLength=r,e.header.featureTableBinaryByteLength=a,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=l,e.header.batchLength=i,n}function Hy(e,t,n,i){return n=function(e,t,n,i){var o=e.header,r=o.featureTableJsonByteLength,a=o.featureTableBinaryByteLength,s=o.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},r>0){var l=CA(t,n,r);e.featureTableJson=JSON.parse(l)}return n+=r,e.featureTableBinary=new Uint8Array(t,n,a),n+=a}(e,t,n),n=function(e,t,n,i){var o=e.header,r=o.batchTableJsonByteLength,a=o.batchTableBinaryByteLength;if(r>0){var s=CA(t,n,r);e.batchTableJson=JSON.parse(s),n+=r,a>0&&(e.batchTableBinary=new Uint8Array(t,n,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=a)}return n}(e,t,n)}function Qy(e,t,n){if(!(t||e&&e.batchIds&&n))return null;var i=e.batchIds,o=e.isRGB565,r=e.pointCount;if(i&&n){for(var a=new Uint8ClampedArray(3*r),s=0;s<r;s++){var l=i[s],c=n.getProperty(l,"dimensions").map((function(e){return 255*e}));a[3*s]=c[0],a[3*s+1]=c[1],a[3*s+2]=c[2]}return{type:hy.UNSIGNED_BYTE,value:a,size:3,normalized:!0}}if(o){for(var u=new Uint8ClampedArray(3*r),h=0;h<r;h++){var d=vy(t[h]);u[3*h]=d[0],u[3*h+1]=d[1],u[3*h+2]=d[2]}return{type:hy.UNSIGNED_BYTE,value:u,size:3,normalized:!0}}return t&&t.length===3*r?{type:hy.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:hy.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}var Oy=new wm;function Vy(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){for(var n=new wm,i=new Float32Array(3*e.pointCount),o=0;o<e.pointCount;o++)n.set(t[3*o],t[3*o+1],t[3*o+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(i,3*o);return i}(e,t)):{type:hy.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function _y(e,t,n,i,o){return Uy.apply(this,arguments)}function Uy(){return(Uy=k(S.mark((function e(t,n,i,o,r){var a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Dy(t,n,i),i=Ly(t,n,i),i=Hy(t,n,i),Ny(t),a=zy(t),s=a.featureTable,l=a.batchTable,e.next=7,qy(t,s,l,o,r);case 7:return Gy(t,s,o),jy(t,s,l),Wy(t,s),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ny(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function zy(e){var t=new wy(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",hy.FLOAT,3);var i=function(e,t){var n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",hy.UNSIGNED_SHORT,1),e.batchIds)){var i=t.getGlobalProperty("BATCH_LENGTH");if(!i)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");var o=e.batchTableJson,r=e.batchTableBinary;n=new Sy(o,r,i)}return n}(e,t);return{featureTable:t,batchTable:i}}function Gy(e,t,n){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",hy.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){var i=t.getPropertyArray("POSITION_QUANTIZED",hy.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",hy.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",hy.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Vy(e,i,n)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function jy(e,t,n){if(!e.attributes.colors){var i=null;t.hasProperty("RGBA")?(i=t.getPropertyArray("RGBA",hy.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?i=t.getPropertyArray("RGB",hy.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(i=t.getPropertyArray("RGB565",hy.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Qy(e,i,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",hy.UNSIGNED_BYTE,4))}function Wy(e,t){if(!e.attributes.normals){var n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",hy.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",hy.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){for(var n=new Float32Array(3*e.pointsLength),i=0;i<e.pointsLength;i++)Ey(t[2*i],t[2*i+1],Oy),Oy.toArray(n,3*i);return{type:hy.FLOAT,size:2,value:n}}return{type:hy.FLOAT,size:2,value:t}}(e,n)}}function qy(e,t,n,i,o){return Jy.apply(this,arguments)}function Jy(){return(Jy=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h,d,p;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"])&&(l=c.properties),!(u=n.getExtension("3DTILES_draco_point_compression"))){e.next=15;break}if(s=u.properties,h=u.byteOffset,d=u.byteLength,s&&Number.isFinite(h)&&d){e.next=9;break}throw new Error("Draco properties, byteOffset, and byteLength must be defined");case 9:a=t.featureTableBinary.slice(h,h+d),t.hasPositions=Number.isFinite(s.POSITION),t.hasColors=Number.isFinite(s.RGB)||Number.isFinite(s.RGBA),t.hasNormals=Number.isFinite(s.NORMAL),t.hasBatchIds=Number.isFinite(s.BATCH_ID),t.isTranslucent=Number.isFinite(s.RGBA);case 15:if(a){e.next=17;break}return e.abrupt("return",!0);case 17:return p={buffer:a,properties:Hh(Hh({},s),l),featureTableProperties:s,batchTableProperties:l,dequantizeInShader:!1},e.next=20,Yy(t,p,o,r);case 20:return e.abrupt("return",e.sent);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yy(e,t,n,i){return Zy.apply(this,arguments)}function Zy(){return(Zy=k(S.mark((function e(t,n,i,o){var r,a,s,l,c,u,h,d,p,f,m,v,g,A,y;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.parse,delete(a=Hh(Hh({},i),{},{draco:Hh(Hh({},i.draco),{},{extraAttributes:n.batchTableProperties||{}})}))["3d-tiles"],e.next=5,r(n.buffer,ly,a);case 5:if(s=e.sent,l=s.attributes.POSITION&&s.attributes.POSITION.value,c=s.attributes.COLOR_0&&s.attributes.COLOR_0.value,u=s.attributes.NORMAL&&s.attributes.NORMAL.value,h=s.attributes.BATCH_ID&&s.attributes.BATCH_ID.value,d=l&&s.attributes.POSITION.value.quantization,p=u&&s.attributes.NORMAL.value.quantization,d&&(f=s.POSITION.data.quantization,m=f.range,t.quantizedVolumeScale=new wm(m,m,m),t.quantizedVolumeOffset=new wm(f.minValues),t.quantizedRange=(1<<f.quantizationBits)-1,t.isQuantizedDraco=!0),p&&(t.octEncodedRange=(1<<s.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0),v={},n.batchTableProperties)for(g=0,A=Object.keys(n.batchTableProperties);g<A.length;g++)y=A[g],s.attributes[y]&&s.attributes[y].value&&(v[y.toLowerCase()]=s.attributes[y].value);t.attributes=Hh({positions:l,colors:Qy(t,c,void 0),normals:u,batchIds:h},v);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Xy,Ky,$y="3.1.4",eE="https://unpkg.com/@loaders.gl/textures@".concat($y,"/dist/libs/basis_encoder.wasm"),tE="https://unpkg.com/@loaders.gl/textures@".concat($y,"/dist/libs/basis_encoder.js");function nE(e){return iE.apply(this,arguments)}function iE(){return(iE=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.modules||{}).basis){e.next=3;break}return e.abrupt("return",n.basis);case 3:return Xy=Xy||oE(t),e.next=6,Xy;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oE(e){return rE.apply(this,arguments)}function rE(){return(rE=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,md("basis_transcoder.js","textures",t);case 5:return e.t1=e.sent,e.next=8,md("basis_transcoder.wasm","textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return o=e.sent,r=ce(o,2),n=r[0],i=r[1],n=n||Oh.BASIS,e.next=19,aE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function aE(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(n).then((function(e){var n=e.BasisFile;(0,e.initializeBasis)(),t({BasisFile:n})}))}))}function sE(e){return lE.apply(this,arguments)}function lE(){return(lE=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.modules||{}).basisEncoder){e.next=3;break}return e.abrupt("return",n.basisEncoder);case 3:return Ky=Ky||cE(t),e.next=6,Ky;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cE(e){return uE.apply(this,arguments)}function uE(){return(uE=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,md(tE,"textures",t);case 5:return e.t1=e.sent,e.next=8,md(eE,"textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return o=e.sent,r=ce(o,2),n=r[0],i=r[1],n=n||Oh.BASIS,e.next=19,hE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hE(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(n).then((function(e){var n=e.BasisFile,i=e.KTX2File,o=e.initializeBasis,r=e.BasisEncoder;o(),t({BasisFile:n,KTX2File:i,BasisEncoder:r})}))}))}var dE,pE,fE,mE,vE,gE,AE,yE,EE=33776,wE=33779,bE=35840,CE=35842,xE=36196,IE=37808,TE=["","WEBKIT_","MOZ_"],BE={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},kE=null;function PE(e){if(!kE){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,kE=new Set;var t,n=Dh(TE);try{for(n.s();!(t=n.n()).done;){var i=t.value;for(var o in BE)if(e&&e.getExtension("".concat(i).concat(o))){var r=BE[o];kE.add(r)}}}catch(e){n.e(e)}finally{n.f()}}return kE}!function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"}(dE||(dE={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(pE||(pE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(fE||(fE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(mE||(mE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(vE||(vE={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(gE||(gE={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(AE||(AE={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(yE||(yE={}));var RE=[171,75,84,88,32,50,48,187,13,10,26,10];function ME(e){var t=new Uint8Array(e);return!(t.byteLength<RE.length||t[0]!==RE[0]||t[1]!==RE[1]||t[2]!==RE[2]||t[3]!==RE[3]||t[4]!==RE[4]||t[5]!==RE[5]||t[6]!==RE[6]||t[7]!==RE[7]||t[8]!==RE[8]||t[9]!==RE[9]||t[10]!==RE[10]||t[11]!==RE[11])}var SE={etc1:{basisFormat:0,compressed:!0,format:xE},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:EE},bc3:{basisFormat:3,compressed:!0,format:wE},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:bE},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:CE},"astc-4x4":{basisFormat:10,compressed:!0,format:IE},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function DE(){return(DE=k(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("auto"!==n.basis.containerFormat){e.next=11;break}if(!ME(t)){e.next=6;break}return e.next=4,sE(n);case 4:return i=e.sent,e.abrupt("return",HE(i.KTX2File,t,n));case 6:return e.next=8,nE(n);case 8:return o=e.sent,r=o.BasisFile,e.abrupt("return",FE(r,t,n));case 11:e.t0=n.basis.module,e.next="encoder"===e.t0?14:(e.t0,22);break;case 14:return e.next=16,sE(n);case 16:a=e.sent,e.t1=n.basis.containerFormat,e.next="ktx2"===e.t1?20:(e.t1,21);break;case 20:return e.abrupt("return",HE(a.KTX2File,t,n));case 21:return e.abrupt("return",FE(a.BasisFile,t,n));case 22:return e.next=24,nE(n);case 24:return s=e.sent,l=s.BasisFile,e.abrupt("return",FE(l,t,n));case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function FE(e,t,n){var i=new e(new Uint8Array(t));try{if(!i.startTranscoding())return null;for(var o=i.getNumImages(),r=[],a=0;a<o;a++){for(var s=i.getNumLevels(a),l=[],c=0;c<s;c++)l.push(LE(i,a,c,n));r.push(l)}return r}finally{i.close(),i.delete()}}function LE(e,t,n,i){var o=e.getImageWidth(t,n),r=e.getImageHeight(t,n),a=e.getHasAlpha(),s=OE(i,a),l=s.compressed,c=s.format,u=s.basisFormat,h=e.getImageTranscodedSizeInBytes(t,n,u),d=new Uint8Array(h);return e.transcodeImage(d,t,n,u,0,0)?{width:o,height:r,data:d,compressed:l,hasAlpha:a,format:c}:null}function HE(e,t,n){var i=new e(new Uint8Array(t));try{if(!i.startTranscoding())return null;for(var o=i.getLevels(),r=[],a=0;a<o;a++){r.push(QE(i,a,n));break}return r}finally{i.close(),i.delete()}}function QE(e,t,n){var i=e.getImageLevelInfo(t,0,0),o=i.alphaFlag,r=i.height,a=i.width,s=OE(n,o),l=s.compressed,c=s.format,u=s.basisFormat,h=e.getImageTranscodedSizeInBytes(t,0,0,u),d=new Uint8Array(h);return e.transcodeImage(d,t,0,0,u,0,-1,-1)?{width:a,height:r,data:d,compressed:l,alphaFlag:o,format:c}:null}function OE(e,t){var n=e&&e.basis&&e.basis.format;return"auto"===n&&(n=VE()),"object"==typeof n&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),SE[n]}function VE(){var e=PE();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var _E=Hh(Hh({},{name:"Basis",id:"basis",module:"textures",version:"3.1.4",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}}),{},{parse:function(e,t){return DE.apply(this,arguments)}}),UE=Oh._parseImageNode,NE="undefined"!=typeof Image,zE="undefined"!=typeof ImageBitmap,GE=Boolean(UE),jE=!!Uh||GE;function WE(e){var t=function(e){if("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)return"imagebitmap";if("undefined"!=typeof Image&&e instanceof Image)return"image";if(e&&"object"==typeof e&&e.data&&e.width&&e.height)return"data";return null}(e);if(!t)throw new Error("Not an image");return t}function qE(e){switch(WE(e)){case"data":return e;case"image":case"imagebitmap":var t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}var JE=/^data:image\/svg\+xml/,YE=/\.svg((\?|#).*)?$/;function ZE(e){return e&&(JE.test(e)||YE.test(e))}function XE(e,t){if(ZE(t)){var n=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(n=unescape(encodeURIComponent(n)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,".concat(btoa(n))}return KE(e,t)}function KE(e,t){if(ZE(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}function $E(e,t,n){return ew.apply(this,arguments)}function ew(){return(ew=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=XE(t,i),r=self.URL||self.webkitURL,a="string"!=typeof o&&r.createObjectURL(o),e.prev=3,e.next=6,tw(a||o,n);case 6:return e.abrupt("return",e.sent);case 7:return e.prev=7,a&&r.revokeObjectURL(a),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[3,,7,10]])})))).apply(this,arguments)}function tw(e,t){return nw.apply(this,arguments)}function nw(){return(nw=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=new Image).src=t,!(n.image&&n.image.decode&&i.decode)){e.next=6;break}return e.next=5,i.decode();case 5:return e.abrupt("return",i);case 6:return e.next=8,new Promise((function(e,n){try{i.onload=function(){return e(i)},i.onerror=function(e){return n(new Error("Could not load image ".concat(t,": ").concat(e)))}}catch(e){n(e)}}));case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var iw={},ow=!0;function rw(e,t,n){return aw.apply(this,arguments)}function aw(){return(aw=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ZE(i)){e.next=7;break}return e.next=3,$E(t,n,i);case 3:r=e.sent,o=r,e.next=8;break;case 7:o=KE(t,i);case 8:return a=n&&n.imagebitmap,e.next=11,sw(o,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sw(e){return lw.apply(this,arguments)}function lw(){return(lw=k(S.mark((function e(t){var n,i=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!cw(n=i.length>1&&void 0!==i[1]?i[1]:null)&&ow||(n=null),!n){e.next=13;break}return e.prev=3,e.next=6,createImageBitmap(t,n);case 6:return e.abrupt("return",e.sent);case 9:e.prev=9,e.t0=e.catch(3),console.warn(e.t0),ow=!1;case 13:return e.next=15,createImageBitmap(t);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,null,[[3,9]])})))).apply(this,arguments)}function cw(e){for(var t in e||iw)return!1;return!0}var uw=!1,hw=!0;function dw(e){var t=pw(e);return function(e){var t=pw(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,uw)))return null;return{mimeType:"image/png",width:t.getUint32(16,uw),height:t.getUint32(20,uw)}}(t)||function(e){var t=pw(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,uw)&&255===t.getUint8(2)))return null;var n=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var n=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:n}}(),i=n.tableMarkers,o=n.sofMarkers,r=2;for(;r+9<t.byteLength;){var a=t.getUint16(r,uw);if(o.has(a))return{mimeType:"image/jpeg",height:t.getUint16(r+5,uw),width:t.getUint16(r+7,uw)};if(!i.has(a))return null;r+=2,r+=t.getUint16(r,uw)}return null}(t)||function(e){var t=pw(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,uw)))return null;return{mimeType:"image/gif",width:t.getUint16(6,hw),height:t.getUint16(8,hw)}}(t)||function(e){var t=pw(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,uw)&&t.getUint32(2,hw)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,hw),height:t.getUint32(22,hw)}}(t)}function pw(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}function fw(e,t){return mw.apply(this,arguments)}function mw(){return(mw=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=dw(t)||{},o=i.mimeType,_h(r=Oh._parseImageNode),e.next=5,r(t,o);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vw(){return(vw=k(S.mark((function e(t,n,i){var o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=(n=n||{}).image||{},r=o.type||"auto",a=(i||{}).url,s=gw(r),e.t0=s,e.next="imagebitmap"===e.t0?8:"image"===e.t0?12:"data"===e.t0?16:20;break;case 8:return e.next=10,rw(t,n,a);case 10:return l=e.sent,e.abrupt("break",21);case 12:return e.next=14,$E(t,n,a);case 14:return l=e.sent,e.abrupt("break",21);case 16:return e.next=18,fw(t);case 18:return l=e.sent,e.abrupt("break",21);case 20:_h(!1);case 21:return"data"===r&&(l=qE(l)),e.abrupt("return",l);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gw(e){switch(e){case"auto":case"data":return function(){if(zE)return"imagebitmap";if(NE)return"image";if(jE)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return zE||NE||jE;case"imagebitmap":return zE;case"image":return NE;case"data":return jE;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}var Aw={id:"image",module:"images",name:"Images",version:"3.1.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:function(e,t,n){return vw.apply(this,arguments)},tests:[function(e){return Boolean(dw(new DataView(e)))}],options:{image:{type:"auto",decode:!0}}},yw=["image/png","image/jpeg","image/gif"],Ew={};function ww(e){return void 0===Ew[e]&&(Ew[e]=function(e){switch(e){case"image/webp":return function(){if(!Uh)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch(e){return!1}}();case"image/svg":return Uh;default:if(!Uh){var t=Oh._parseImageNode;return Boolean(t)&&yw.includes(e)}return!0}}(e)),Ew[e]}function bw(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function Cw(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;var n=t.baseUri||t.uri;if(!n)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return n.substr(0,n.lastIndexOf("/")+1)+e}function xw(e,t,n){var i=e.bufferViews[n];bw(i);var o=t[i.buffer];bw(o);var r=(i.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,r,i.byteLength)}var Iw=["SCALAR","VEC2","VEC3","VEC4"],Tw=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Bw=new Map(Tw),kw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Pw={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Rw={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Mw(e){return Iw[e-1]||Iw[0]}function Sw(e){var t=Bw.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Dw(e,t){var n=Rw[e.componentType],i=kw[e.type],o=Pw[e.componentType],r=e.count*i,a=e.count*i*o;return bw(a>=0&&a<=t.byteLength),{ArrayType:n,length:r,byteLength:a}}var Fw,Lw={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]},Hw=function(){function e(t){o(this,e),Xh(this,"gltf",void 0),Xh(this,"sourceBuffers",void 0),Xh(this,"byteLength",void 0),this.gltf=t||{json:Hh({},Lw),buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}return u(e,[{key:"json",get:function(){return this.gltf.json}},{key:"getApplicationData",value:function(e){return this.json[e]}},{key:"getExtraData",value:function(e){return(this.json.extras||{})[e]}},{key:"getExtension",value:function(e){var t=this.getUsedExtensions().find((function(t){return t===e})),n=this.json.extensions||{};return t?n[e]||!0:null}},{key:"getRequiredExtension",value:function(e){return this.getRequiredExtensions().find((function(t){return t===e}))?this.getExtension(e):null}},{key:"getRequiredExtensions",value:function(){return this.json.extensionsRequired||[]}},{key:"getUsedExtensions",value:function(){return this.json.extensionsUsed||[]}},{key:"getObjectExtension",value:function(e,t){return(e.extensions||{})[t]}},{key:"getScene",value:function(e){return this.getObject("scenes",e)}},{key:"getNode",value:function(e){return this.getObject("nodes",e)}},{key:"getSkin",value:function(e){return this.getObject("skins",e)}},{key:"getMesh",value:function(e){return this.getObject("meshes",e)}},{key:"getMaterial",value:function(e){return this.getObject("materials",e)}},{key:"getAccessor",value:function(e){return this.getObject("accessors",e)}},{key:"getTexture",value:function(e){return this.getObject("textures",e)}},{key:"getSampler",value:function(e){return this.getObject("samplers",e)}},{key:"getImage",value:function(e){return this.getObject("images",e)}},{key:"getBufferView",value:function(e){return this.getObject("bufferViews",e)}},{key:"getBuffer",value:function(e){return this.getObject("buffers",e)}},{key:"getObject",value:function(e,t){if("object"==typeof t)return t;var n=this.json[e]&&this.json[e][t];if(!n)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return n}},{key:"getTypedArrayForBufferView",value:function(e){var t=(e=this.getBufferView(e)).buffer,n=this.gltf.buffers[t];bw(n);var i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}},{key:"getTypedArrayForAccessor",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,i=Dw(e,t),o=i.ArrayType,r=i.length;return new o(n,t.byteOffset+e.byteOffset,r)}},{key:"getTypedArrayForImageData",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(n,i,t.byteLength)}},{key:"addApplicationData",value:function(e,t){return this.json[e]=t,this}},{key:"addExtraData",value:function(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}},{key:"addObjectExtension",value:function(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}},{key:"setObjectExtension",value:function(e,t,n){(e.extensions||{})[t]=n}},{key:"removeObjectExtension",value:function(e,t){var n=e.extensions||{},i=n[t];return delete n[t],i}},{key:"addExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return bw(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}},{key:"addRequiredExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return bw(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}},{key:"registerUsedExtension",value:function(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((function(t){return t===e}))||this.json.extensionsUsed.push(e)}},{key:"registerRequiredExtension",value:function(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((function(t){return t===e}))||this.json.extensionsRequired.push(e)}},{key:"removeExtension",value:function(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}},{key:"setDefaultScene",value:function(e){this.json.scene=e}},{key:"addScene",value:function(e){var t=e.nodeIndices;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}},{key:"addNode",value:function(e){var t=e.meshIndex,n=e.matrix;this.json.nodes=this.json.nodes||[];var i={mesh:t};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}},{key:"addMesh",value:function(e){var t=e.attributes,n=e.indices,i=e.material,o=e.mode,r=void 0===o?4:o,a={primitives:[{attributes:this._addAttributes(t),mode:r}]};if(n){var s=this._addIndices(n);a.primitives[0].indices=s}return Number.isFinite(i)&&(a.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}},{key:"addPointCloud",value:function(e){var t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}},{key:"addImage",value:function(e,t){var n=dw(e),i=t||(null==n?void 0:n.mimeType),o={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}},{key:"addBufferView",value:function(e){var t=e.byteLength;bw(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);var n={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=Sd(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(n),this.json.bufferViews.length-1}},{key:"addAccessor",value:function(e,t){var n={bufferView:e,type:Mw(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}},{key:"addBinaryBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3},n=this.addBufferView(e),i={min:t.min,max:t.max};i.min&&i.max||(i=this._getAccessorMinMax(e,t.size));var o={size:t.size,componentType:Sw(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(o,t))}},{key:"addTexture",value:function(e){var t={source:e.imageIndex};return this.json.textures=this.json.textures||[],this.json.textures.push(t),this.json.textures.length-1}},{key:"addMaterial",value:function(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}},{key:"createBinaryChunk",value:function(){var e,t;this.gltf.buffers=[];var n,i=this.byteLength,o=new ArrayBuffer(i),r=new Uint8Array(o),a=0,s=Dh(this.sourceBuffers||[]);try{for(s.s();!(n=s.n()).done;){a=Dd(n.value,r,a)}}catch(e){s.e(e)}finally{s.f()}null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=i:this.json.buffers=[{byteLength:i}],this.gltf.binary=o,this.sourceBuffers=[o]}},{key:"_removeStringFromArray",value:function(e,t){for(var n=!0;n;){var i=e.indexOf(t);i>-1?e.splice(i,1):n=!1}}},{key:"_addAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};for(var n in e){var i=e[n],o=this._getGltfAttributeName(n),r=this.addBinaryBuffer(i.value,i);t[o]=r}return t}},{key:"_addIndices",value:function(e){return this.addBinaryBuffer(e,{size:1})}},{key:"_getGltfAttributeName",value:function(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}},{key:"_getAccessorMinMax",value:function(e,t){var n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];var i,o=Dh(e.subarray(0,t));try{for(o.s();!(i=o.n()).done;){var r=i.value;n.min.push(r),n.max.push(r)}}catch(e){o.e(e)}finally{o.f()}for(var a=t;a<e.length;a+=t)for(var s=0;s<t;s++)n.min[0+s]=Math.min(n.min[0+s],e[a+s]),n.max[0+s]=Math.max(n.max[0+s],e[a+s]);return n}}]),e}(),Qw="object"!=typeof WebAssembly,Ow="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",Vw="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",_w=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),Uw=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Nw={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},zw={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};function Gw(e,t,n,i,o){return jw.apply(this,arguments)}function jw(){return(jw=k(S.mark((function e(t,n,i,o,r){var a,s,l=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>5&&void 0!==l[5]?l[5]:"NONE",e.next=3,Ww();case 3:Xw(s=e.sent,s.exports[zw[r]],t,n,i,o,s.exports[Nw[a||"NONE"]]);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ww(){return qw.apply(this,arguments)}function qw(){return(qw=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Fw||(Fw=Jw()),e.abrupt("return",Fw);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Jw(){return Yw.apply(this,arguments)}function Yw(){return(Yw=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Ow,WebAssembly.validate(_w)&&(t=Vw,console.log("Warning: meshopt_decoder is using experimental SIMD support")),e.next=4,WebAssembly.instantiate(Zw(t),{});case 4:return n=e.sent,e.next=7,n.instance.exports.__wasm_call_ctors();case 7:return e.abrupt("return",n.instance);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Zw(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}for(var o=0,r=0;r<e.length;++r)t[o++]=t[r]<60?Uw[t[r]]:64*(t[r]-60)+t[++r];return t.buffer.slice(0,o)}function Xw(e,t,n,i,o,r,a){var s=e.exports.sbrk,l=i+3&-4,c=s(l*o),u=s(r.length),h=new Uint8Array(e.exports.memory.buffer);h.set(r,u);var d=t(c,i,o,u,r.length);if(0===d&&a&&a(c,l,o),n.set(h.subarray(c,c+i*o)),s(c-s(0)),0!==d)throw new Error("Malformed buffer data: ".concat(d))}var Kw="EXT_meshopt_compression";function $w(){return($w=k(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=new Hw(t),null!=n&&null!==(i=n.gltf)&&void 0!==i&&i.decompressMeshes){e.next=3;break}return e.abrupt("return");case 3:r=[],a=Dh(t.json.bufferViews||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,r.push(eb(o,l))}catch(e){a.e(e)}finally{a.f()}return e.next=8,Promise.all(r);case 8:o.removeExtension(Kw);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function eb(e,t){return tb.apply(this,arguments)}function tb(){return(tb=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.getObjectExtension(n,Kw))){e.next=9;break}return o=n.buffer,r=i.byteOffset,a=void 0===r?0:r,s=i.byteLength,l=void 0===s?0:s,c=i.byteStride,u=i.count,h=i.mode,d=i.filter,p=void 0===d?"NONE":d,f=new Uint8Array(o,a,l),m=new ArrayBuffer(u*c),e.next=8,Gw(new Uint8Array(m),u,c,f,h,p);case 8:return e.abrupt("return",m);case 9:return e.abrupt("return",null);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var nb="EXT_texture_webp";var ib="KHR_texture_basisu";function ob(e){var t={};for(var n in e){var i=e[n];if("indices"!==n){var o=rb(i);t[n]=o}}return t}function rb(e){var t=function(e){var t=e,n=1,i=0;e&&e.value&&(t=e.value,n=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return null;if(Array.isArray(e))return new t(e);if(n&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),i=t.length/n);return{buffer:t,size:n,count:i}}(e),n=t.buffer,i=t.size;return{value:n,size:i,byteOffset:0,count:t.count,type:Mw(i),componentType:Sw(n)}}var ab="KHR_draco_mesh_compression";function sb(){return(sb=k(S.mark((function e(t,n,i){var o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.decompressMeshes){e.next=2;break}return e.abrupt("return");case 2:r=new Hw(t),a=[],s=Dh(db(r));try{for(s.s();!(l=s.n()).done;)c=l.value,r.getObjectExtension(c,ab)&&a.push(lb(r,c,n,i))}catch(e){s.e(e)}finally{s.f()}return e.next=8,Promise.all(a);case 8:r.removeExtension(ab);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lb(e,t,n,i){return cb.apply(this,arguments)}function cb(){return(cb=k(S.mark((function e(t,n,i,o){var r,a,s,l,c,u,h,d,p,f,m,v,g,A;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.getObjectExtension(n,ab)){e.next=3;break}return e.abrupt("return");case 3:return a=t.getTypedArrayForBufferView(r.bufferView),s=Md(a.buffer,a.byteOffset),l=o.parse,delete(c=Hh({},i))["3d-tiles"],e.next=10,l(s,ly,c,o);case 10:for(u=e.sent,h=ob(u.attributes),d=0,p=Object.entries(h);d<p.length;d++)f=ce(p[d],2),m=f[0],v=f[1],m in n.attributes&&(g=n.attributes[m],null!=(A=t.getAccessor(g))&&A.min&&null!=A&&A.max&&(v.min=A.min,v.max=A.max));n.attributes=h,u.indices&&(n.indices=rb(u.indices)),hb(n);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ub(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!o.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");var a=o.DracoWriter.encodeSync({attributes:e}),s=null==r||null===(n=r.parseSync)||void 0===n?void 0:n.call(r,{attributes:e}),l=o._addFauxAttributes(s.attributes),c=o.addBufferView(a),u={primitives:[{attributes:l,mode:i,extensions:{[ab]:{bufferView:c,attributes:l}}}]};return u}function hb(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function db(e){var t,n,i,o,r,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:t=Dh(e.json.meshes||[]),s.prev=1,t.s();case 3:if((n=t.n()).done){s.next=24;break}i=n.value,o=Dh(i.primitives),s.prev=6,o.s();case 8:if((r=o.n()).done){s.next=14;break}return a=r.value,s.next=12,a;case 12:s.next=8;break;case 14:s.next=19;break;case 16:s.prev=16,s.t0=s.catch(6),o.e(s.t0);case 19:return s.prev=19,o.f(),s.finish(19);case 22:s.next=3;break;case 24:s.next=29;break;case 26:s.prev=26,s.t1=s.catch(1),t.e(s.t1);case 29:return s.prev=29,t.f(),s.finish(29);case 32:case"end":return s.stop()}}),Sh,null,[[1,26,29,32],[6,16,19,22]])}var pb="KHR_lights_punctual";function fb(){return(fb=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Hw(t),i=n.json,(o=n.getExtension(pb))&&(n.json.lights=o.lights,n.removeExtension(pb)),r=Dh(i.nodes||[]);try{for(r.s();!(a=r.n()).done;)s=a.value,(l=n.getObjectExtension(s,pb))&&(s.light=l.light),n.removeObjectExtension(s,pb)}catch(e){r.e(e)}finally{r.f()}case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mb(){return(mb=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new Hw(t),(i=n.json).lights&&(bw(!(o=n.addExtension(pb)).lights),o.lights=i.lights,delete i.lights),n.json.lights){r=Dh(n.json.lights);try{for(r.s();!(a=r.n()).done;)s=a.value,l=s.node,n.addObjectExtension(l,pb,s)}catch(e){r.e(e)}finally{r.f()}delete n.json.lights}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var vb="KHR_materials_unlit";function gb(){return(gb=k(S.mark((function e(t){var n,i,o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Hw(t),i=n.json,n.removeExtension(vb),o=Dh(i.materials||[]);try{for(o.s();!(r=o.n()).done;)a=r.value,a.extensions&&a.extensions.KHR_materials_unlit&&(a.unlit=!0),n.removeObjectExtension(a,vb)}catch(e){o.e(e)}finally{o.f()}case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ab="KHR_techniques_webgl";function yb(){return(yb=k(S.mark((function e(t){var n,i,o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new Hw(t),i=n.json,o=n.getExtension(Ab)){r=wb(o,n),a=Dh(i.materials||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,(c=n.getObjectExtension(l,Ab))&&(l.technique=Object.assign({},c,r[c.technique]),l.technique.values=bb(l.technique,n)),n.removeObjectExtension(l,Ab)}catch(e){a.e(e)}finally{a.f()}n.removeExtension(Ab)}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Eb(){return(Eb=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wb(e,t){var n=e.programs,i=void 0===n?[]:n,o=e.shaders,r=void 0===o?[]:o,a=e.techniques,s=void 0===a?[]:a,l=new TextDecoder;return r.forEach((function(e){if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=l.decode(t.getTypedArrayForBufferView(e.bufferView))})),i.forEach((function(e){e.fragmentShader=r[e.fragmentShader],e.vertexShader=r[e.vertexShader]})),s.forEach((function(e){e.program=i[e.program]})),s}function bb(e,t){var n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((function(t){e.uniforms[t].value&&!(t in n)&&(n[t]=e.uniforms[t].value)})),Object.keys(n).forEach((function(e){"object"==typeof n[e]&&void 0!==n[e].index&&(n[e].texture=t.getTexture(n[e].index))})),n}var Cb=[Object.freeze({__proto__:null,name:"EXT_meshopt_compression",preprocess:function(e){if(new Hw(e).getRequiredExtensions().includes(Kw)&&!Qw)throw new Error("gltf: Required extension ".concat(Kw," not supported by browser"))},decode:function(e,t){return $w.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"EXT_texture_webp",preprocess:function(e,t){var n=new Hw(e);if(ww("image/webp")){var i,o=Dh(n.json.textures||[]);try{for(o.s();!(i=o.n()).done;){var r=i.value,a=n.getObjectExtension(r,nb);a&&(r.source=a.source),n.removeObjectExtension(r,nb)}}catch(e){o.e(e)}finally{o.f()}n.removeExtension(nb)}else if(n.getRequiredExtensions().includes(nb))throw new Error("gltf: Required extension ".concat(nb," not supported by browser"))}}),Object.freeze({__proto__:null,name:"KHR_texture_basisu",preprocess:function(e,t){var n,i=new Hw(e),o=Dh(i.json.textures||[]);try{for(o.s();!(n=o.n()).done;){var r=n.value,a=i.getObjectExtension(r,ib);a&&(r.source=a.source),i.removeObjectExtension(r,ib)}}catch(e){o.e(e)}finally{o.f()}i.removeExtension(ib)}}),Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,n){var i,o=new Hw(e),r=Dh(db(o));try{for(r.s();!(i=r.n()).done;){var a=i.value;o.getObjectExtension(a,ab)}}catch(e){r.e(e)}finally{r.f()}},decode:function(e,t,n){return sb.apply(this,arguments)},encode:function(e){var t,n=new Hw(e),i=Dh(n.json.meshes||[]);try{for(i.s();!(t=i.n()).done;){ub(t.value),n.addRequiredExtension(ab)}}catch(e){i.e(e)}finally{i.f()}}}),Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:function(e){return fb.apply(this,arguments)},encode:function(e){return mb.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:function(e){return gb.apply(this,arguments)},encode:function(e){var t=new Hw(e),n=t.json;if(t.materials){var i,o=Dh(n.materials||[]);try{for(o.s();!(i=o.n()).done;){var r=i.value;r.unlit&&(delete r.unlit,t.addObjectExtension(r,vb,{}),t.addExtension(vb))}}catch(e){o.e(e)}finally{o.f()}}}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:function(e){return yb.apply(this,arguments)},encode:function(e,t){return Eb.apply(this,arguments)}})];function xb(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,o=Cb.filter((function(e){return Bb(e.name,n)})),r=Dh(o);try{for(r.s();!(t=r.n()).done;){var a,s=t.value;null===(a=s.preprocess)||void 0===a||a.call(s,e,n,i)}}catch(e){r.e(e)}finally{r.f()}}function Ib(e){return Tb.apply(this,arguments)}function Tb(){return(Tb=k(S.mark((function e(t){var n,i,o,r,a,s,l,c=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2?c[2]:void 0,o=Cb.filter((function(e){return Bb(e.name,n)})),r=Dh(o),e.prev=4,r.s();case 6:if((a=r.n()).done){e.next=12;break}return s=a.value,e.next=10,null===(l=s.decode)||void 0===l?void 0:l.call(s,t,n,i);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),r.e(e.t0);case 17:return e.prev=17,r.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})))).apply(this,arguments)}function Bb(e,t){var n,i=(null==t||null===(n=t.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(e in i&&!i[e])}var kb="KHR_binary_glTF";var Pb={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Rb={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Mb=function(){function e(){o(this,e),Xh(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Xh(this,"json",void 0)}return u(e,[{key:"normalize",value:function(e,t){this.json=e.json;var n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(n.asset.version))}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(e){var t,n=new Hw(e),i=n.json,o=Dh(i.images||[]);try{for(o.s();!(t=o.n()).done;){var r=t.value,a=n.getObjectExtension(r,kb);a&&Object.assign(r,a),n.removeObjectExtension(r,kb)}}catch(e){o.e(e)}finally{o.f()}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,n.removeExtension(kb)}(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}},{key:"_addAsset",value:function(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}},{key:"_convertTopLevelObjectsToArrays",value:function(e){for(var t in Pb)this._convertTopLevelObjectToArray(e,t)}},{key:"_convertTopLevelObjectToArray",value:function(e,t){var n=e[t];if(n&&!Array.isArray(n))for(var i in e[t]=[],n){var o=n[i];o.id=o.id||i;var r=e[t].length;e[t].push(o),this.idToIndexMap[t][i]=r}}},{key:"_convertObjectIdsToArrayIndices",value:function(e){for(var t in Pb)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));var n,i=Dh(e.textures);try{for(i.s();!(n=i.n()).done;){var o=n.value;this._convertTextureIds(o)}}catch(e){i.e(e)}finally{i.f()}var r,a=Dh(e.meshes);try{for(a.s();!(r=a.n()).done;){var s=r.value;this._convertMeshIds(s)}}catch(e){a.e(e)}finally{a.f()}var l,c=Dh(e.nodes);try{for(c.s();!(l=c.n()).done;){var u=l.value;this._convertNodeIds(u)}}catch(e){c.e(e)}finally{c.f()}var h,d=Dh(e.scenes);try{for(d.s();!(h=d.n()).done;){var p=h.value;this._convertSceneIds(p)}}catch(e){d.e(e)}finally{d.f()}}},{key:"_convertTextureIds",value:function(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}},{key:"_convertMeshIds",value:function(e){var t,n=Dh(e.primitives);try{for(n.s();!(t=n.n()).done;){var i=t.value,o=i.attributes,r=i.indices,a=i.material;for(var s in o)o[s]=this._convertIdToIndex(o[s],"accessor");r&&(i.indices=this._convertIdToIndex(r,"accessor")),a&&(i.material=this._convertIdToIndex(a,"material"))}}catch(e){n.e(e)}finally{n.f()}}},{key:"_convertNodeIds",value:function(e){var t=this;e.children&&(e.children=e.children.map((function(e){return t._convertIdToIndex(e,"node")}))),e.meshes&&(e.meshes=e.meshes.map((function(e){return t._convertIdToIndex(e,"mesh")})))}},{key:"_convertSceneIds",value:function(e){var t=this;e.nodes&&(e.nodes=e.nodes.map((function(e){return t._convertIdToIndex(e,"node")})))}},{key:"_convertIdsToIndices",value:function(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);var n,i=Dh(e[t]);try{for(i.s();!(n=i.n()).done;){var o=n.value;for(var r in o){var a=o[r],s=this._convertIdToIndex(a,r);o[r]=s}}}catch(e){i.e(e)}finally{i.f()}}},{key:"_convertIdToIndex",value:function(e,t){var n=Rb[t];if(n in this.idToIndexMap){var i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return i}return e}},{key:"_updateObjects",value:function(e){var t,n=Dh(this.json.buffers);try{for(n.s();!(t=n.n()).done;){delete t.value.type}}catch(e){n.e(e)}finally{n.f()}}},{key:"_updateMaterial",value:function(e){var t,n=Dh(e.materials);try{var i=function(){var n=t.value;n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var i=n.values&&n.values.tex,o=e.textures.findIndex((function(e){return e.id===i}));-1!==o&&(n.pbrMetallicRoughness.baseColorTexture={index:o})};for(n.s();!(t=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}}]),e}();function Sb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new Mb).normalize(e,t)}var Db={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Fb={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lb=10240,Hb=10241,Qb=10242,Ob=10243,Vb=10497,_b={magFilter:Lb,minFilter:Hb,wrapS:Qb,wrapT:Ob},Ub={[Lb]:9729,[Hb]:9986,[Qb]:Vb,[Ob]:Vb};var Nb=function(){function e(){o(this,e),Xh(this,"baseUri",""),Xh(this,"json",{}),Xh(this,"buffers",[]),Xh(this,"images",[])}return u(e,[{key:"postProcess",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.json,i=e.buffers,o=void 0===i?[]:i,r=e.images,a=void 0===r?[]:r,s=e.baseUri,l=void 0===s?"":s;return bw(n),this.baseUri=l,this.json=n,this.buffers=o,this.images=a,this._resolveTree(this.json,t),this.json}},{key:"_resolveTree",value:function(e){var t=this;e.bufferViews&&(e.bufferViews=e.bufferViews.map((function(e,n){return t._resolveBufferView(e,n)}))),e.images&&(e.images=e.images.map((function(e,n){return t._resolveImage(e,n)}))),e.samplers&&(e.samplers=e.samplers.map((function(e,n){return t._resolveSampler(e,n)}))),e.textures&&(e.textures=e.textures.map((function(e,n){return t._resolveTexture(e,n)}))),e.accessors&&(e.accessors=e.accessors.map((function(e,n){return t._resolveAccessor(e,n)}))),e.materials&&(e.materials=e.materials.map((function(e,n){return t._resolveMaterial(e,n)}))),e.meshes&&(e.meshes=e.meshes.map((function(e,n){return t._resolveMesh(e,n)}))),e.nodes&&(e.nodes=e.nodes.map((function(e,n){return t._resolveNode(e,n)}))),e.skins&&(e.skins=e.skins.map((function(e,n){return t._resolveSkin(e,n)}))),e.scenes&&(e.scenes=e.scenes.map((function(e,n){return t._resolveScene(e,n)}))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}},{key:"getScene",value:function(e){return this._get("scenes",e)}},{key:"getNode",value:function(e){return this._get("nodes",e)}},{key:"getSkin",value:function(e){return this._get("skins",e)}},{key:"getMesh",value:function(e){return this._get("meshes",e)}},{key:"getMaterial",value:function(e){return this._get("materials",e)}},{key:"getAccessor",value:function(e){return this._get("accessors",e)}},{key:"getCamera",value:function(e){return null}},{key:"getTexture",value:function(e){return this._get("textures",e)}},{key:"getSampler",value:function(e){return this._get("samplers",e)}},{key:"getImage",value:function(e){return this._get("images",e)}},{key:"getBufferView",value:function(e){return this._get("bufferViews",e)}},{key:"getBuffer",value:function(e){return this._get("buffers",e)}},{key:"_get",value:function(e,t){if("object"==typeof t)return t;var n=this.json[e]&&this.json[e][t];return n||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),n}},{key:"_resolveScene",value:function(e,t){var n=this;return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((function(e){return n.getNode(e)})),e}},{key:"_resolveNode",value:function(e,t){var n=this;return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((function(e){return n.getNode(e)}))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((function(e,t){var i=n.getMesh(t);return e.id=i.id,e.primitives=e.primitives.concat(i.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}},{key:"_resolveSkin",value:function(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}},{key:"_resolveMesh",value:function(e,t){var n=this;return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((function(e){var t=(e=Hh({},e)).attributes;for(var i in e.attributes={},t)e.attributes[i]=n.getAccessor(t[i]);return void 0!==e.indices&&(e.indices=n.getAccessor(e.indices)),void 0!==e.material&&(e.material=n.getMaterial(e.material)),e}))),e}},{key:"_resolveMaterial",value:function(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture=Hh({},e.normalTexture),e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture=Hh({},e.occlustionTexture),e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture=Hh({},e.emmisiveTexture),e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness=Hh({},e.pbrMetallicRoughness);var n=e.pbrMetallicRoughness;n.baseColorTexture&&(n.baseColorTexture=Hh({},n.baseColorTexture),n.baseColorTexture.texture=this.getTexture(n.baseColorTexture.index)),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture=Hh({},n.metallicRoughnessTexture),n.metallicRoughnessTexture.texture=this.getTexture(n.metallicRoughnessTexture.index))}return e}},{key:"_resolveAccessor",value:function(e,t){var n,i;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(n=e.componentType,Fb[n]),e.components=(i=e.type,Db[i]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){var o=e.bufferView.buffer,r=Dw(e,e.bufferView),a=r.ArrayType,s=r.byteLength,l=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+o.byteOffset,c=o.arrayBuffer.slice(l,l+s);e.bufferView.byteStride&&(c=this._getValueFromInterleavedBuffer(o,l,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new a(c)}return e}},{key:"_getValueFromInterleavedBuffer",value:function(e,t,n,i,o){for(var r=new Uint8Array(o*i),a=0;a<o;a++){var s=t+a*n;r.set(new Uint8Array(e.arrayBuffer.slice(s,s+i)),a*i)}return r.buffer}},{key:"_resolveTexture",value:function(e,t){return e.id=e.id||"texture-".concat(t),e.sampler="sampler"in e?this.getSampler(e.sampler):Ub,e.source=this.getImage(e.source),e}},{key:"_resolveSampler",value:function(e,t){for(var n in e.id=e.id||"sampler-".concat(t),e.parameters={},e){var i=this._enumSamplerParameter(n);void 0!==i&&(e.parameters[i]=e[n])}return e}},{key:"_enumSamplerParameter",value:function(e){return _b[e]}},{key:"_resolveImage",value:function(e,t){e.id=e.id||"image-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));var n=this.images[t];return n&&(e.image=n),e}},{key:"_resolveBufferView",value:function(e,t){var n=e.buffer,i=Hh(Hh({id:"bufferView-".concat(t)},e),{},{buffer:this.buffers[n]}),o=this.buffers[n].arrayBuffer,r=this.buffers[n].byteOffset||0;return"byteOffset"in e&&(r+=e.byteOffset),i.data=new Uint8Array(o,r,e.byteLength),i}},{key:"_resolveCamera",value:function(e,t){return e.id=e.id||"camera-".concat(t),e.perspective,e.orthographic,e}}]),e}();function zb(e,t){return(new Nb).postProcess(e,t)}var Gb=1735152710,jb=1313821514,Wb=5130562,qb=!0;function Jb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"".concat(String.fromCharCode(e.getUint8(t+0))).concat(String.fromCharCode(e.getUint8(t+1))).concat(String.fromCharCode(e.getUint8(t+2))).concat(String.fromCharCode(e.getUint8(t+3)))}function Yb(e,t,n){_h(e.header.byteLength>20);var i=t.getUint32(n+0,qb),o=t.getUint32(n+4,qb);return n+=8,_h(0===o),Xb(e,t,n,i),n+=i,n+=Kb(e,t,n,e.header.byteLength)}function Zb(e,t,n,i){return _h(e.header.byteLength>20),function(e,t,n,i){for(;n+8<=e.header.byteLength;){var o=t.getUint32(n+0,qb),r=t.getUint32(n+4,qb);switch(n+=8,r){case jb:Xb(e,t,n,o);break;case Wb:Kb(e,t,n,o);break;case 0:i.strict||Xb(e,t,n,o);break;case 1:i.strict||Kb(e,t,n,o)}n+=Sd(o,4)}}(e,t,n,i),n+e.header.byteLength}function Xb(e,t,n,i){var o=new Uint8Array(t.buffer,n,i),r=new TextDecoder("utf8").decode(o);return e.json=JSON.parse(r),Sd(i,4)}function Kb(e,t,n,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:i,arrayBuffer:t.buffer}),Sd(i,4)}function $b(e,t){return eC.apply(this,arguments)}function eC(){return(eC=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=p.length>2&&void 0!==p[2]?p[2]:0,o=p.length>3?p[3]:void 0,r=p.length>4?p[4]:void 0,tC(t,n,i,o),Sb(t,{normalize:null==o||null===(a=o.gltf)||void 0===a?void 0:a.normalize}),xb(t,o,r),u=[],null==o||null===(s=o.gltf)||void 0===s||!s.loadBuffers||!t.json.buffers){e.next=10;break}return e.next=10,nC(t,o,r);case 10:return null!=o&&null!==(l=o.gltf)&&void 0!==l&&l.loadImages&&(h=oC(t,o,r),u.push(h)),d=Ib(t,o,r),u.push(d),e.next=15,Promise.all(u);case 15:return t.json.gltfArrayBuffer=n,e.abrupt("return",null!=o&&null!==(c=o.gltf)&&void 0!==c&&c.postProcess?zb(t,o):t);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tC(e,t,n,i){(i.uri&&(e.baseUri=i.uri),t instanceof ArrayBuffer&&!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new DataView(e),o=n.magic,r=void 0===o?Gb:o,a=i.getUint32(t,!1);return a===r||a===Gb}(t,n,i))&&(t=(new TextDecoder).decode(t));if("string"==typeof t)e.json=Bd(t);else if(t instanceof ArrayBuffer){var o={};n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new DataView(t),o=Jb(i,n+0),r=i.getUint32(n+4,qb),a=i.getUint32(n+8,qb);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:o,version:r,json:{},binChunks:[]}),n+=12,e.version){case 1:return Yb(e,i,n);case 2:return Zb(e,i,n,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}(o,t,n,i.glb),bw("glTF"===o.type,"Invalid GLB magic string ".concat(o.type)),e._glb=o,e.json=o.json}else bw(!1,"GLTF: must be ArrayBuffer or string");var r=e.json.buffers||[];if(e.buffers=new Array(r.length).fill(null),e._glb&&e._glb.header.hasBinChunk){var a=e._glb.binChunks;e.buffers[0]={arrayBuffer:a[0].arrayBuffer,byteOffset:a[0].byteOffset,byteLength:a[0].byteLength}}var s=e.json.images||[];e.images=new Array(s.length).fill({})}function nC(e,t,n){return iC.apply(this,arguments)}function iC(){return(iC=k(S.mark((function e(t,n,i){var o,r,a,s,l,c,u,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=t.json.buffers||[],r=0;case 2:if(!(r<o.length)){e.next=19;break}if(!(a=o[r]).uri){e.next=16;break}return bw(i.fetch),c=Cw(a.uri,n),e.next=10,null==i||null===(s=i.fetch)||void 0===s?void 0:s.call(i,c);case 10:return u=e.sent,e.next=13,null==u||null===(l=u.arrayBuffer)||void 0===l?void 0:l.call(u);case 13:h=e.sent,t.buffers[r]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri;case 16:++r,e.next=2;break;case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oC(e,t,n){return rC.apply(this,arguments)}function rC(){return(rC=k(S.mark((function e(t,n,i){var o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=aC(t),r=t.json.images||[],a=[],s=Dh(o);try{for(s.s();!(l=s.n()).done;)c=l.value,a.push(sC(t,r[c],c,n,i))}catch(e){s.e(e)}finally{s.f()}return e.next=7,Promise.all(a);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function aC(e){var t,n=new Set,i=Dh(e.json.textures||[]);try{for(i.s();!(t=i.n()).done;){var o=t.value;void 0!==o.source&&n.add(o.source)}}catch(e){i.e(e)}finally{i.f()}return Array.from(n).sort()}function sC(e,t,n,i,o){return lC.apply(this,arguments)}function lC(){return(lC=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h,d;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.fetch,s=r.parse,!n.uri){e.next=9;break}return c=Cw(n.uri,o),e.next=5,a(c);case 5:return u=e.sent,e.next=8,u.arrayBuffer();case 8:l=e.sent;case 9:return Number.isFinite(n.bufferView)&&(h=xw(t.json,t.buffers,n.bufferView),l=Md(h.buffer,h.byteOffset,h.byteLength)),bw(l,"glTF image has no data"),e.next=13,s(l,[Aw,_E],{mimeType:n.mimeType,basis:o.basis||{format:VE()}},r);case 13:(d=e.sent)&&d[0]&&(d={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}),t.images=t.images||[],t.images[i]=d;case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var cC={name:"glTF",id:"gltf",module:"gltf",version:"3.1.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:function(e){return uC.apply(this,arguments)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};function uC(){return(uC=k(S.mark((function e(t){var n,i,o,r,a,s=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2?s[2]:void 0,(n=Hh(Hh({},cC.options),n)).gltf=Hh(Hh({},cC.options.gltf),n.gltf),o=n.byteOffset,r=void 0===o?0:o,a={},e.next=8,$b(a,t,r,n,i);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var hC=0,dC=1;function pC(e,t,n,i){e.rotateYtoZ=!0;var o=e.byteOffset+e.byteLength-n;if(0===o)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=i["3d-tiles"]&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Md(t,n,o),e.gltfByteOffset=0,e.gltfByteLength=o,n%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function fC(e,t,n,i){return mC.apply(this,arguments)}function mC(){return(mC=k(S.mark((function e(t,n,i,o){var r,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i["3d-tiles"]||{},vC(t,n),!r.loadGLTF){e.next=16;break}if(a=o.parse,s=o.fetch,!t.gltfUrl){e.next=9;break}return e.next=7,s(t.gltfUrl,i);case 7:t.gltfArrayBuffer=e.sent,t.gltfByteOffset=0;case 9:if(!t.gltfArrayBuffer){e.next=16;break}return e.next=12,a(t.gltfArrayBuffer,cC,i,o);case 12:t.gltf=e.sent,delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vC(e,t,n){switch(t){case hC:var i=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),o=(new TextDecoder).decode(i);e.gltfUrl=o.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case dC:break;default:throw new Error("b3dm: Illegal glTF format field")}}function gC(e,t,n,i,o){return AC.apply(this,arguments)}function AC(){return(AC=k(S.mark((function e(t,n,i,o,r){var a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=yC(t,n,i,o),e.next=3,fC(t,dC,o,r);case 3:return(s=null==t||null===(a=t.gltf)||void 0===a?void 0:a.extensions)&&s.CESIUM_RTC&&(t.rtcCenter=s.CESIUM_RTC.center),e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yC(e,t,n,i,o){n=pC(e,t,n=Hy(e,t,n=Ly(e,t,n=Dy(e,t,n))),i);var r=new wy(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=r.getGlobalProperty("RTC_CENTER",hy.FLOAT,3),n}function EC(e,t,n,i,o){return wC.apply(this,arguments)}function wC(){return(wC=k(S.mark((function e(t,n,i,o,r){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=bC(t,n,i,o),e.next=3,fC(t,t.gltfFormat,o,r);case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bC(e,t,n,i,o){if(n=Dy(e,t,n),1!==e.version)throw new Error("Instanced 3D Model version ".concat(e.version," is not supported"));n=Ly(e,t,n);var r=new DataView(t);if(e.gltfFormat=r.getUint32(n,!0),n=pC(e,t,n=Hy(e,t,n+=4),i),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");var a=new wy(e.featureTableJson,e.featureTableBinary),s=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",hy.FLOAT,3);new Sy(e.batchTableJson,e.batchTableBinary,s);return function(e,t,n,i){var o=[new Array(i),e._batchTable][0],r=new wm;new wm,new wm,new wm;for(var a=new Pm,s=new iv,l=new wm,c={},u=new Vm,h=[],d=[],p=new wm,f=new wm,m=0;m<i;m++){var v=void 0;if(t.hasProperty("POSITION"))v=t.getProperty("POSITION",hy.FLOAT,3,m,r);else if(t.hasProperty("POSITION_QUANTIZED")){v=t.getProperty("POSITION_QUANTIZED",hy.UNSIGNED_SHORT,3,m,r);var g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",hy.FLOAT,3,p);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");var A=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",hy.FLOAT,3,f);if(!A)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(var y=65535,E=0;E<3;E++)v[E]=v[E]/y*A[E]+g[E]}if(!v)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");if(r.copy(v),c.translation=r,e.normalUp=t.getProperty("NORMAL_UP",hy.FLOAT,3,m,h),e.normalRight=t.getProperty("NORMAL_RIGHT",hy.FLOAT,3,m,d),e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",hy.UNSIGNED_SHORT,2,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",hy.UNSIGNED_SHORT,2,d),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(Rv.WGS84.eastNorthUpToFixedFrame(r,u),u.getRotationMatrix3(a)):a.identity()}s.fromMatrix3(a),c.rotation=s,l.set(1,1,1);var w=t.getProperty("SCALE",hy.FLOAT,1,m);Number.isFinite(w)&&l.multiplyByScalar(w);var b=t.getProperty("SCALE_NON_UNIFORM",hy.FLOAT,3,m,h);b&&l.scale(b),c.scale=l;var C=t.getProperty("BATCH_ID",hy.UNSIGNED_SHORT,1,m);void 0===C&&(C=m);var x=(new Vm).fromQuaternion(c.rotation);u.identity(),u.translate(c.translation),u.multiplyRight(x),u.scale(c.scale);var I=u.clone();o[m]={modelMatrix:I,batchId:C}}e.instances=o}(e,a,0,s),n}function CC(e,t,n,i,o,r){return xC.apply(this,arguments)}function xC(){return(xC=k(S.mark((function e(t,n,i,o,r,a){var s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Dy(t,n,i),s=new DataView(n),t.tilesLength=s.getUint32(i,!0),i+=4,t.tiles=[];case 5:if(!(t.tiles.length<t.tilesLength&&t.byteLength-i>12)){e.next=13;break}return l={},t.tiles.push(l),e.next=10,a(n,i,o,r,l);case 10:i=e.sent,e.next=5;break;case 13:return e.abrupt("return",i);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IC(e,t,n,i){return TC.apply(this,arguments)}function TC(){return(TC=k(S.mark((function e(t,n,i,o){var r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.rotateYtoZ=!0,t.gltfUpAxis=i["3d-tiles"]&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",r=o.parse,e.next=5,r(n,cC,i,o);case 5:t.gltf=e.sent;case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BC(e){return kC.apply(this,arguments)}function kC(){return(kC=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>1&&void 0!==a[1]?a[1]:0,i=a.length>2?a[2]:void 0,o=a.length>3?a[3]:void 0,(r=a.length>4&&void 0!==a[4]?a[4]:{}).byteOffset=n,r.type=xA(t,n),e.t0=r.type,e.next=e.t0===AA?9:e.t0===EA?12:e.t0===bA?15:e.t0===wA?18:e.t0===yA?21:24;break;case 9:return e.next=11,CC(r,t,n,i,o,BC);case 11:return e.abrupt("return",e.sent);case 12:return e.next=14,gC(r,t,n,i,o);case 14:return e.abrupt("return",e.sent);case 15:return e.next=17,IC(r,t,i,o);case 17:return e.abrupt("return",e.sent);case 18:return e.next=20,EC(r,t,n,i,o);case 20:return e.abrupt("return",e.sent);case 21:return e.next=23,_y(r,t,n,i,o);case 23:return e.abrupt("return",e.sent);case 24:throw new Error("3DTileLoader: unknown type ".concat(r.type));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var PC=1952609651;function RC(){return(RC=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(new Uint32Array(t.slice(0,4))[0]===PC){e.next=3;break}throw new Error("Wrong subtree file magic number");case 3:if(1===new Uint32Array(t.slice(4,8))[0]){e.next=6;break}throw new Error("Wrong subtree file verson, must be 1");case 6:if(n=DC(t.slice(8,16)),i=new Uint8Array(t,24,n),o=new TextDecoder("utf8"),r=o.decode(i),a=JSON.parse(r),s=DC(t.slice(16,24)),l=new ArrayBuffer(0),s&&(l=t.slice(24+n)),!("bufferView"in a.tileAvailability)){e.next=18;break}return e.next=17,MC(a,"tileAvailability",l);case 17:a.tileAvailability.explicitBitstream=e.sent;case 18:if(!("bufferView"in a.contentAvailability)){e.next=22;break}return e.next=21,MC(a,"contentAvailability",l);case 21:a.contentAvailability.explicitBitstream=e.sent;case 22:if(!("bufferView"in a.childSubtreeAvailability)){e.next=26;break}return e.next=25,MC(a,"childSubtreeAvailability",l);case 25:a.childSubtreeAvailability.explicitBitstream=e.sent;case 26:return e.abrupt("return",a);case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MC(e,t,n){return SC.apply(this,arguments)}function SC(){return(SC=k(S.mark((function e(t,n,i){var o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t[n].bufferView,r=t.bufferViews[o],!(a=t.buffers[r.buffer]).uri){e.next=11;break}return e.next=6,yp(a.uri);case 6:return s=e.sent,e.next=9,s.arrayBuffer();case 9:return l=e.sent,e.abrupt("return",new Uint8Array(l,r.byteOffset,r.byteLength));case 11:return e.abrupt("return",new Uint8Array(i,r.byteOffset,r.byteLength));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function DC(e){var t=new DataView(e),n=t.getUint32(0,!0),i=t.getUint32(4,!0);return n+Math.pow(2,32)*i}var FC={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:gA,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:function(e){return RC.apply(this,arguments)},options:{}},LC={QUADTREE:4,OCTREE:8};function HC(e,t){return QC.apply(this,arguments)}function QC(){return(QC=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m,v,g,A,y,E,w,b,C,x,I,T,B,k,P,R,M,D,F,L,H,Q,O=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=O.length>2&&void 0!==O[2]?O[2]:{mortonIndex:0,x:0,y:0,z:0},o=O.length>3&&void 0!==O[3]?O[3]:0,r=O.length>4&&void 0!==O[4]?O[4]:0,a=O.length>5&&void 0!==O[5]?O[5]:{level:0,mortonIndex:0,x:0,y:0,z:0},s=n.subdivisionScheme,l=n.subtreeLevels,c=n.maximumLevel,u=n.contentUrlTemplate,h=n.subtreesUriTemplate,d=n.basePath,p={children:[],lodMetricValue:0,contentUrl:""},f=LC[s],m=1&o,v=o>>1&1,g=o>>2&1,A=(Math.pow(f,r)-1)/(f-1),y=_C(i.mortonIndex,o),E=A+y,w=_C(i.x,m),b=_C(i.y,v),C=_C(i.z,g),x=!1,r+1>l&&(x=OC(t.childSubtreeAvailability,y)),I=_C(a.x,w),T=_C(a.y,b),B=_C(a.z,C),k=r+a.level,!x){e.next=40;break}return P="".concat(d,"/").concat(h),R=UC(P,k,I,T,B),e.next=27,Lf(R,FC);case 27:M=e.sent,t=M,a.mortonIndex=y,a.x=w,a.y=b,a.z=C,a.level=r,y=0,E=0,w=0,b=0,C=0,r=0;case 40:if(OC(t.tileAvailability,E)&&!(r>c)){e.next=43;break}return e.abrupt("return",p);case 43:OC(t.contentAvailability,E)&&(p.contentUrl=UC(u,k,I,T,B)),D=r+1,F={mortonIndex:y,x:w,y:b,z:C},L=0;case 48:if(!(L<f)){e.next=56;break}return e.next=51,HC(t,n,F,L,D,a);case 51:((H=e.sent).contentUrl||H.children.length)&&(Q=VC(H,k+1,{childTileX:w,childTileY:b,childTileZ:C},n),p.children.push(Q));case 53:L++,e.next=48;break;case 56:return e.abrupt("return",p);case 57:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function OC(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&(n=t,i=e.explicitBitstream,o=Math.floor(n/8),r=n%8,1==(i[o]>>r&1));var n,i,o,r}function VC(e,t,n,i){var o=i.basePath,r=i.refine,a=i.getRefine,s=i.lodMetricType,l=i.getTileType,c=i.rootLodMetricValue,u=i.rootBoundingVolume,h=e.contentUrl&&e.contentUrl.replace("".concat(o,"/"),""),d=c/Math.pow(2,t),p=function(e,t,n){if(t.region){var i=n.childTileX,o=n.childTileY,r=n.childTileZ,a=ce(t.region,6),s=a[0],l=a[1],c=a[2],u=a[3],h=a[4],d=a[5],p=Math.pow(2,e),f=(c-s)/p,m=(u-l)/p,v=(d-h)/p;return{region:[s+f*i,l+m*o,s+f*(i+1),l+m*(o+1),h+v*r,h+v*(r+1)]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,u,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:a(r),type:l(e),lodMetricType:s,lodMetricValue:d,boundingVolume:p}}function _C(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function UC(e,t,n,i,o){var r=function(e){var t={};for(var n in e)t["{".concat(n,"}")]=e[n];return t}({level:t,x:n,y:i,z:o});return e.replace(/{level}|{x}|{y}|{z}/gi,(function(e){return r[e]}))}function NC(e){if(!e.contentUrl)return Sg;var t=e.contentUrl.split(".").pop();switch(t){case"pnts":return Fg;case"i3dm":case"b3dm":case"glb":case"gltf":return Dg;default:return t}}function zC(e){switch(e){case"REPLACE":case"replace":return Mg;case"ADD":case"add":return Rg;default:return e}}function GC(e,t){if(!e)return null;if(e.content){var n=e.content.uri||e.content.url;e.contentUrl="".concat(t.basePath,"/").concat(n)}return e.id=e.contentUrl,e.lodMetricType=Og,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=NC(e),e.refine=zC(e.refine),e}function jC(e){var t=e.basePath,n=GC(e.root,e),i=[];for(i.push(n);i.length>0;){var o,r=Dh((i.pop()||{}).children||[]);try{for(r.s();!(o=r.n()).done;){var a=o.value;GC(a,{basePath:t}),i.push(a)}}catch(e){r.e(e)}finally{r.f()}}return n}function WC(e){return qC.apply(this,arguments)}function qC(){return(qC=k(S.mark((function e(t){var n,i,o,r,a,s,l,c,u,h,d,p,f,m;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.root){e.next=2;break}return e.abrupt("return",null);case 2:return n=t.basePath,i=t.root.extensions["3DTILES_implicit_tiling"],o=i.subdivisionScheme,r=i.maximumLevel,a=i.subtreeLevels,s=i.subtrees.uri,l=UC(s,0,0,0,0),c="".concat(n,"/").concat(l),e.next=9,Lf(c,FC);case 9:return u=e.sent,h="".concat(n,"/").concat(t.root.content.uri),d=t.root.refine,p=t.root.geometricError,f=t.root.boundingVolume,m={contentUrlTemplate:h,subtreesUriTemplate:s,subdivisionScheme:o,subtreeLevels:a,maximumLevel:r,refine:d,basePath:n,lodMetricType:Og,rootLodMetricValue:p,rootBoundingVolume:f,getTileType:NC,getRefine:zC},e.next=17,JC(t.root,u,m);case 17:return e.abrupt("return",e.sent);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JC(e,t,n){return YC.apply(this,arguments)}function YC(){return(YC=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return t.lodMetricType=Og,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,e.next=7,HC(n,i);case 7:return o=e.sent,r=o.children,(a=o.contentUrl)&&(t.contentUrl=a,t.content={uri:a.replace("".concat(i.basePath,"/"),"")}),t.refine=zC(t.refine),t.type=NC(t),t.children=r,t.id=t.contentUrl,e.abrupt("return",t);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ZC="3DTILES_implicit_tiling",XC={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:gA,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:function(e,t,n){return ix.apply(this,arguments)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function KC(e){return qd(e.url)}function $C(e,t,n){return ex.apply(this,arguments)}function ex(){return(ex=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={content:{featureIds:null}},0,e.next=4,BC(t,0,n,i,o.content);case 4:return e.abrupt("return",o.content);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tx(e,t,n){return nx.apply(this,arguments)}function nx(){return(nx=k(S.mark((function e(t,n,i){var o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=JSON.parse((new TextDecoder).decode(t))).loader=n.loader||XC,r.url=i.url,r.basePath=KC(r),!ox(r)){e.next=10;break}return e.next=7,WC(r);case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=jC(r);case 11:return r.root=e.t0,r.type=Qg,r.lodMetricType=Og,r.lodMetricValue=(null===(o=r.root)||void 0===o?void 0:o.lodMetricValue)||0,e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ix(){return(ix=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n["3d-tiles"]||{},!("auto"===o.isTileset?i.url&&-1!==i.url.indexOf(".json"):o.isTileset)){e.next=8;break}return e.next=5,tx(t,n,i);case 5:t=e.sent,e.next=11;break;case 8:return e.next=10,$C(t,n,i);case 10:t=e.sent;case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ox(e){var t,n;return(null==e||null===(t=e.extensionsRequired)||void 0===t?void 0:t.includes(ZC))&&(null==e||null===(n=e.extensionsUsed)||void 0===n?void 0:n.includes(ZC))}var rx="https://api.cesium.com/v1/assets";function ax(e,t){return sx.apply(this,arguments)}function sx(){return(sx=k(S.mark((function e(t,n){var i,o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=6;break}return e.next=3,lx(t);case 3:i=e.sent,o=Dh(i.items);try{for(o.s();!(r=o.n()).done;)"3DTILES"===(a=r.value).type&&(n=a.id)}catch(e){o.e(e)}finally{o.f()}case 6:return e.next=8,ux(t,n);case 8:return s=e.sent,l=s.type,c=s.url,_h("3DTILES"===l&&c),s.headers={Authorization:"Bearer ".concat(s.accessToken)},e.abrupt("return",s);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lx(e){return cx.apply(this,arguments)}function cx(){return(cx=k(S.mark((function e(t){var n,i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _h(t),rx,n={Authorization:"Bearer ".concat(t)},e.next=5,yp("https://api.cesium.com/v1/assets",{fetch:{headers:n}});case 5:if((i=e.sent).ok){e.next=8;break}throw new Error(i.statusText);case 8:return e.next=10,i.json();case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ux(e,t){return hx.apply(this,arguments)}function hx(){return(hx=k(S.mark((function e(t,n){var i,o,r,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _h(t,n),i={Authorization:"Bearer ".concat(t)},o="".concat(rx,"/").concat(n),e.next=5,yp("".concat(o),{fetch:{headers:i}});case 5:if((r=e.sent).ok){e.next=8;break}throw new Error(r.statusText);case 8:return e.next=10,r.json();case 10:return a=e.sent,e.next=13,yp("".concat(o,"/endpoint"),{fetch:{headers:i}});case 13:if((r=e.sent).ok){e.next=16;break}throw new Error(r.statusText);case 16:return e.next=18,r.json();case 18:return s=e.sent,a=Hh(Hh({},a),s),e.abrupt("return",a);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dx(){return(dx=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(n=a.length>1&&void 0!==a[1]?a[1]:{})["cesium-ion"]||{},i=n.accessToken,o=n.assetId,Number.isFinite(o)||(r=t.match(/\/([0-9]+)\/tileset.json/),o=r&&r[1]),e.abrupt("return",ax(i,o));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var px,fx=Hh(Hh({},XC),{},{id:"cesium-ion",name:"Cesium Ion",preload:function(e){return dx.apply(this,arguments)},parse:(px=k(S.mark((function e(t,n,i){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Hh({},n))["3d-tiles"]=n["cesium-ion"],n.loader=fx,e.abrupt("return",XC.parse(t,n,i));case 4:case"end":return e.stop()}}),e)}))),function(e,t,n){return px.apply(this,arguments)}),options:{"cesium-ion":Hh(Hh({},XC.options["3d-tiles"]),{},{accessToken:null})}});function mx(t){var n=64,i=document.createElement("canvas");i.width=n,i.height=n;var o=i.getContext("2d");o.rect(0,0,n,n);for(var r=o.createLinearGradient(0,0,n,n),a=0;a<t.length;a++){var s=t[a];r.addColorStop(s[0],"#"+s[1].getHexString())}o.fillStyle=r,o.fill();var l=new e.CanvasTexture(i);return l.needsUpdate=!0,l.minFilter=e.LinearFilter,l.wrapS=e.RepeatWrapping,l.wrapT=e.RepeatWrapping,l.repeat.set(2,2),l}function vx(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorldInverse.copy(t.matrixWorld).invert();var n=new e.Frustum;return n.setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse)),n}function gx(t){var n=new e.Group,i=new e.PlaneGeometry(10,5),o=V(e.Vector3,H(t.projectPointOntoPlane([0,0,0]))),r=new e.Vector3(t.normal.x,t.normal.y,t.normal.z),a=(new e.Vector3).copy(o).add(r);i.lookAt(a),i.translate(o.x,o.y,o.z);var s=new e.MeshBasicMaterial({color:65535,side:e.DoubleSide}),l=new e.Mesh(i,s),c=new e.ArrowHelper(r,o,5,16776960);return n.add(c),n.add(l),n}function Ax(t){var n=t.boundingVolume,i=0;t.content&&(i=Math.min(t.content.byteLength/5e5,1));var o=new e.Color(i,1,0),r=new e.BoxGeometry(1,1,1),a=new e.Matrix4;n.halfAxes?a.copy(yx(n.halfAxes)):n.radius&&r.scale(2*n.radius,2*n.radius,2*n.radius),r.applyMatrix4(a);var s=new e.EdgesGeometry(r),l=new e.LineSegments(s,new e.LineBasicMaterial({color:o}));return l.position.copy(V(e.Vector3,H(n.center))),l}function yx(t){var n=t;return(new e.Matrix4).fromArray([2*n[0],2*n[1],2*n[2],0,2*n[3],2*n[4],2*n[5],0,2*n[6],2*n[7],2*n[8],0,0,0,0,1])}function Ex(t,n){var i=2*Math.PI*6378137/2,o=n*i/180,r=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return r=r*i/180,new e.Vector2(o,r)}var wx,bx,Cx,xx={SPECTRAL:[[0,new e.Color(.3686,.3098,.6353)],[.1,new e.Color(.1961,.5333,.7412)],[.2,new e.Color(.4,.7608,.6471)],[.3,new e.Color(.6706,.8667,.6431)],[.4,new e.Color(.902,.9608,.5961)],[.5,new e.Color(1,1,.749)],[.6,new e.Color(.9961,.8784,.5451)],[.7,new e.Color(.9922,.6824,.3804)],[.8,new e.Color(.9569,.4275,.2627)],[.9,new e.Color(.8353,.2431,.3098)],[1,new e.Color(.6196,.0039,.2588)]],PLASMA:[[0,new e.Color(.241,.015,.61)],[.1,new e.Color(.387,.001,.654)],[.2,new e.Color(.524,.025,.653)],[.3,new e.Color(.651,.125,.596)],[.4,new e.Color(.752,.227,.513)],[.5,new e.Color(.837,.329,.431)],[.6,new e.Color(.907,.435,.353)],[.7,new e.Color(.963,.554,.272)],[.8,new e.Color(.992,.681,.195)],[.9,new e.Color(.987,.822,.144)],[1,new e.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new e.Color(.1647,.2824,.3451)],[.1,new e.Color(.1338,.3555,.4227)],[.2,new e.Color(.061,.4319,.4864)],[.3,new e.Color(0,.5099,.5319)],[.4,new e.Color(0,.5881,.5569)],[.5,new e.Color(.137,.665,.5614)],[.6,new e.Color(.2906,.7395,.5477)],[.7,new e.Color(.4453,.8099,.5201)],[.8,new e.Color(.6102,.8748,.485)],[.9,new e.Color(.7883,.9323,.4514)],[1,new e.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new e.Color(.267,.005,.329)],[.1,new e.Color(.283,.141,.458)],[.2,new e.Color(.254,.265,.53)],[.3,new e.Color(.207,.372,.553)],[.4,new e.Color(.164,.471,.558)],[.5,new e.Color(.128,.567,.551)],[.6,new e.Color(.135,.659,.518)],[.7,new e.Color(.267,.749,.441)],[.8,new e.Color(.478,.821,.318)],[.9,new e.Color(.741,.873,.15)],[1,new e.Color(.993,.906,.144)]],INFERNO:[[0,new e.Color(.077,.042,.206)],[.1,new e.Color(.225,.036,.388)],[.2,new e.Color(.373,.074,.432)],[.3,new e.Color(.522,.128,.42)],[.4,new e.Color(.665,.182,.37)],[.5,new e.Color(.797,.255,.287)],[.6,new e.Color(.902,.364,.184)],[.7,new e.Color(.969,.516,.063)],[.8,new e.Color(.988,.683,.072)],[.9,new e.Color(.961,.859,.298)],[1,new e.Color(.988,.998,.645)]],GRAYSCALE:[[0,new e.Color(0,0,0)],[1,new e.Color(1,1,1)]],TURBO:[[0,new e.Color(.18995,.07176,.23217)],[.07,new e.Color(.25107,.25237,.63374)],[.13,new e.Color(.27628,.42118,.89123)],[.2,new e.Color(.25862,.57958,.99876)],[.27,new e.Color(.15844,.73551,.92305)],[.33,new e.Color(.09267,.86554,.7623)],[.4,new e.Color(.19659,.94901,.59466)],[.47,new e.Color(.42778,.99419,.38575)],[.53,new e.Color(.64362,.98999,.23356)],[.6,new e.Color(.80473,.92452,.20459)],[.67,new e.Color(.93301,.81236,.22667)],[.73,new e.Color(.99314,.67408,.20348)],[.8,new e.Color(.9836,.49291,.12849)],[.87,new e.Color(.92105,.31489,.05475)],[.93,new e.Color(.81608,.18462,.01809)],[1,new e.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new e.Color(.278,0,.714)],[1/6,new e.Color(0,0,1)],[2/6,new e.Color(0,1,1)],[.5,new e.Color(0,1,0)],[4/6,new e.Color(1,1,0)],[5/6,new e.Color(1,.64,0)],[1,new e.Color(1,0,0)]],CONTOUR:[[0,new e.Color(0,0,0)],[.03,new e.Color(0,0,0)],[.04,new e.Color(1,1,1)],[1,new e.Color(1,1,1)]]};!function(e){e[e.Intensity=1]="Intensity",e[e.Classification=2]="Classification",e[e.Elevation=3]="Elevation",e[e.RGB=4]="RGB",e[e.White=5]="White"}(wx||(wx={})),function(e){e[e.FlatTexture=1]="FlatTexture",e[e.ShadedTexture=2]="ShadedTexture",e[e.ShadedNoTexture=3]="ShadedNoTexture"}(bx||(bx={})),function(e){e[e.Reset=1]="Reset",e[e.Mercator=2]="Mercator",e[e.WGS84Cartesian=3]="WGS84Cartesian"}(Cx||(Cx={}));var Ix="undefined"!=typeof document?mx(xx.RAINBOW):null,Tx="undefined"!=typeof document?mx(xx.GRAYSCALE):null,Bx={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,maximumMemoryUsage:32,viewDistanceScale:1,skipLevelOfDetail:!1,updateTransforms:!0,shading:bx.FlatTexture,transparent:!1,pointCloudColoring:wx.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,basisTranscoderPath:null,dracoDecoderPath:null,material:null,computeNormals:!1,shaderCallback:null,geoTransform:Cx.Reset,preloadTilesCount:null,isLowestDepth:!1},kx=function(){function t(){o(this,t)}return u(t,null,[{key:"load",value:function(t){return Vh(this,void 0,void 0,S.mark((function n(){var i,o,r,a,s,l,c,u,h,d,p,f,m,v,g,A,y,E,w,b,C,x,I,T,B,k,P,R,M,D,F,L,Q,O,_,U,N,z,G,j,W,q,J,Y=this;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(J=function(n,o,r,a){if(!F&&!i.pauseTilesetUpdate){if(!N||a.aspect!=_){var s=new vg({fov:a.fov/180*Math.PI,aspectRatio:a.aspect,near:a.near,far:a.far});N=s.sseDenominator,_=a.aspect,i.debug&&console.log("Updated sse denonimator:",N)}var l=vx(a).planes.map((function(e){return new og(e.normal.toArray(),e.constant)})),c=new lg(l),u=new e.Vector2;r.getSize(u);var h={camera:{position:i.isLowestDepth?[0,100,0]:U.toArray()},height:u.y,frameNumber:n._frameNumber,sseDenominator:N,cullingVolume:c,viewport:{id:0}};n.options.currentFloorId=void 0===v.currentFloorId?"all":v.currentFloorId,n._cache.reset(),n._traverser.traverse(n.root,h,n.options);var d,p=Dh(n.tiles);try{for(p.s();!(d=p.n()).done;){var A=d.value;A.selected?o[A.id]?o[A.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",A.id):o[A.id]&&(o[A.id].visible=!1)}}catch(e){p.e(e)}finally{p.f()}for(;m.length>0;){var y=m.pop();o[y.id]&&y.contentState==Ig&&("4dkk"==i.type?v.removeTile(o[y.id]):v.remove(o[y.id]),Sx(o[y.id]),delete o[y.id]),f[y.id]&&(Sx(f[y.id]),g.remove(f[y.id]),delete f[y.id])}var E=n.stats.get("Tiles Loaded").count,w=n.stats.get("Tiles Loading").count;return t.onProgress&&t.onProgress(E,E+w),t.loadingManager&&!L&&0==w&&(null==i.preloadTilesCount||E>=i.preloadTilesCount)&&(L=!0,t.loadingManager.itemEnd(t.url)),h}},q=function(){i.geoTransform!=Cx.WGS84Cartesian&&(k.copy(P).invert(),k.premultiply(z),k.copy(z).multiply((new e.Matrix4).copy(P).invert()),B.modelMatrix=new Vm(k.toArray()))},W=function(t){if(t.boundingVolume.halfAxes){var n=t.boundingVolume.halfAxes,i=(new e.Matrix4).extractRotation(yx(n)).premultiply((new e.Matrix4).extractRotation(G));if(!(new e.Euler).setFromRotationMatrix(i).equals(new e.Euler)){M=!0;var o=new e.Vector3(P.elements[12],P.elements[13],P.elements[14]);P.extractRotation(i),P.setPosition(o),q()}}},i=Object.assign(Object.assign({},Bx),t.options),o=t.url,r=i.updateInterval,a=2,s={},!i.cesiumIONToken){n.next=14;break}return s["cesium-ion"]={accessToken:i.cesiumIONToken},n.next=12,fx.preload(o,s);case 12:l=n.sent,s.fetch={headers:l.headers};case 14:return t.loadingManager&&t.loadingManager.itemStart(o),n.next=17,Lf(o,XC,Object.assign({},s));case 17:for(c=n.sent,u=0,h=[0,1,2];u<h.length;u++)d=h[u],c.root.boundingVolume.box[d]=0;return p={},f={},m=[],v=t.model||new e.Group,g=new e.Group,i.debug?v.add(g):g.visible=!1,A={pointSize:{type:"f",value:i.pointSize},gradient:{type:"t",value:Ix},grayscale:{type:"t",value:Tx},rootCenter:{type:"vec3",value:new e.Vector3},rootNormal:{type:"vec3",value:new e.Vector3},coloring:{type:"i",value:i.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new e.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},y=new e.ShaderMaterial({uniforms:A,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:i.transparent,vertexColors:!0}),E=null,w=null,b=new Qh,C=void 0,x=void 0,i.basisTranscoderPath&&((C=new Ch).detectSupport(t.renderer),C.setTranscoderPath(i.basisTranscoderPath+"/"),C.setWorkerLimit(1),b.setKTX2Loader(C)),i.dracoDecoderPath&&((x=new qa).setDecoderPath(i.dracoDecoderPath+"/"),x.setWorkerLimit(i.maxConcurrency),b.setDRACOLoader(x)),I=new e.MeshBasicMaterial({transparent:i.transparent}),T={maximumMemoryUsage:i.maximumMemoryUsage,maximumScreenSpaceError:i.maximumScreenSpaceError,viewDistanceScale:i.viewDistanceScale,skipLevelOfDetail:i.skipLevelOfDetail,updateTransforms:i.updateTransforms,throttleRequests:i.throttleRequests,maxRequests:i.maxRequests,type:i.type,imageVersion:i.imageVersion,ingoreVisibleCompute:!!i.ingoreVisibleCompute,contentLoader:function(e){return Vh(Y,void 0,void 0,S.mark((function t(){var n,o,r;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=null,t.t0=e.type,t.next=t.t0===Fg?4:t.t0===Dg||t.t0===Lg?6:10;break;case 4:return n=Rx(e,y,i,G),t.abrupt("break",10);case 6:return t.next=8,Px(b,e,I,i,G);case 8:return n=t.sent,t.abrupt("break",10);case 10:n&&(n.visible=!1,n.name="tileContent",p[e.id]=n,"4dkk"==i.type?(o=e.contentUrl.match(/floor_([0-9]+)./),e.floorIndex=o?parseInt(o[1]):0,v.addTile(e.floorIndex,n)):v.add(n),i.debug&&(r=Ax(e),g.add(r),f[e.id]=r));case 11:case"end":return t.stop()}}),t)})))},onTileLoad:function(e){return Vh(Y,void 0,void 0,S.mark((function t(){return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:B&&(!M&&(null==e?void 0:e.depth)<=a&&W(e),B._frameNumber++,J(B,p,w,E));case 1:case"end":return t.stop()}}),t)})))},onTileUnload:function(e){m.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)}},B=new vA(c,Object.assign(Object.assign({},T),{loadOptions:Object.assign(Object.assign({},s),{maxConcurrency:i.maxConcurrency,worker:i.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})})),k=new e.Matrix4,P=new e.Matrix4,R=new e.Vector3,M=!1,B.root.boundingVolume?(B.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),i.geoTransform=Cx.WGS84Cartesian),P.setPosition(B.root.boundingVolume.center[0],B.root.boundingVolume.center[1],B.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),i.debug&&(D=Ax(B.root),g.add(D),f[B.root.id]=D),F=!1,L=!1,A.rootCenter.value.copy(R),A.rootNormal.value.copy(new e.Vector3(0,0,1).normalize()),B.stats.get("Loader concurrency").count=i.maxConcurrency,B.stats.get("Maximum SSE").count=i.maximumScreenSpaceError,B.stats.get("Maximum mem usage").count=i.maximumMemoryUsage,Q=r,O=null,_=null,U=new e.Vector3(1/0,1/0,1/0),N=null,v.updateMatrixWorld(!0),z=(new e.Matrix4).copy(v.matrixWorld),G=(new e.Matrix4).copy(z).invert(),W(B.root),q(),i.debug&&(f[B.root.id].applyMatrix4(k),g.matrixWorld.copy(v.matrixWorld)),i.geoTransform==Cx.Mercator?(j=Ex(B.cartographicCenter[1],B.cartographicCenter[0]),R.set(j.x,0,-j.y),v.position.copy(R),v.rotation.set(-Math.PI/2,0,0),v.updateMatrixWorld(!0)):i.geoTransform==Cx.WGS84Cartesian&&(v.applyMatrix4(P),v.updateMatrixWorld(!0),R.copy(v.position)),n.abrupt("return",{model:v,runtime:{getTileset:function(){return B},getStats:function(){return B.stats},showTiles:function(e){g.visible=e},setWireframe:function(t){i.wireframe=t,v.traverse((function(n){n instanceof e.Mesh&&(n.material.wireframe=t)}))},setDebug:function(e){i.debug=e,g.visible=e},setShading:function(e){i.shading=e},getTileBoxes:function(){return g},setViewDistanceScale:function(e){B.options.viewDistanceScale=e,B._frameNumber++,J(B,p,w,E)},setHideGround:function(e){A.hideGround.value=e},setPointCloudColoring:function(e){A.coloring.value=e},setElevationRange:function(e){A.elevationRange.value.set(e[0],e[1])},setMaxIntensity:function(e){A.maxIntensity.value=e},setIntensityContrast:function(e){A.intensityContrast.value=e},setPointAlpha:function(e){A.alpha.value=e},getLatLongHeightFromPosition:function(t){var n=B.ellipsoid.cartesianToCartographic((new e.Vector3).copy(t).applyMatrix4((new e.Matrix4).copy(k).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:function(t){var n=B.ellipsoid.cartographicToCartesian([t.long,t.lat,t.height]);return V(e.Vector3,H(n)).applyMatrix4(k)},getCameraFrustum:function(t){var n,i=vx(t).planes.map((function(e){return new og(e.normal.toArray(),e.constant)})).map((function(e){return gx(e)})),o=new e.Group,r=Dh(i);try{for(r.s();!(n=r.n()).done;){var a=n.value;o.add(a)}}catch(e){r.e(e)}finally{r.f()}return o},update:function(t,n,o,a){if(E=o,w=n,Q+=a?9999:t,B&&Q>=r){if(!z.equals(v.matrixWorld)){Q=0,z.copy(v.matrixWorld),q();var s=(new e.Vector3).setFromMatrixPosition(z);A.rootCenter.value.copy(s),A.rootNormal.value.copy(new e.Vector3(0,0,1).applyMatrix4(z).normalize()),G.copy(z).invert(),i.debug&&(f[B.root.id].matrixWorld.copy(k),f[B.root.id].applyMatrix4(z))}if(null==O)O=(new e.Matrix4).copy(o.matrixWorld);else(!(o.matrixWorld.equals(O)&&o.aspect==_)||a)&&(Q=0,B._frameNumber++,o.getWorldPosition(U),O.copy(o.matrixWorld),J(B,p,n,o))}},dispose:function(){for(F=!0,B._destroy();v.children.length>0;){var e=v.children[0];Sx(e),v.remove(e)}for(;g.children.length>0;){var t=g.children[0];g.remove(t),t.geometry.dispose(),t.material.dispose()}C&&C.dispose(),x&&x.dispose()},ingoreVisibleCompute:function(e){B.options.ingoreVisibleCompute=e,B._frameNumber++,J(B,p,w,E)},pauseTilesetUpdate:function(e){i.pauseTilesetUpdate=e,e||(B._frameNumber++,J(B,p,w,E))},limit2lowestDepth:function(e){i.isLowestDepth=!!e,E&&(B._frameNumber++,J(B,p,w,E))},clearLoadingTiles:function(){B.loadingTiles.forEach((function(e){return e.controller&&e.controller.abort()}))},setModelSize:function(e){B.options.modelSize=e,console.error(e)},getRenderMap:function(){return p}}});case 63:case"end":return n.stop()}}),n)})))}}]),t}();function Px(t,n,i,o,r){return Vh(this,void 0,void 0,S.mark((function a(){return S.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise((function(a,s){var l=n.tileset.asset&&"Z"!==n.tileset.asset.gltfUpAxis,c=(new e.Matrix4).fromArray(n.computedTransform).premultiply(r);if(l){var u=(new e.Matrix4).makeRotationAxis(new e.Vector3(1,0,0),Math.PI/2);c.multiply(u)}t.parse("glTF"==n.content.type?n.content.gltf.gltfArrayBuffer:n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):"",(function(e){var t=e.scenes[0],r=[];t.traverse((function(e){"Mesh"==e.type&&r.push(e)})),t.clear(),r.forEach((function(e){var r=e.material,a=r.map;if(o.material?(e.material=o.material.clone(),r.dispose()):o.shading==bx.FlatTexture&&(e.material=i.clone(),r.dispose()),o.shading!=bx.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:a}:e.material.map=a:(a&&a.dispose(),e.material.map=null),o.shaderCallback&&(e.onBeforeRender=o.shaderCallback),e.material.wireframe=o.wireframe,o.computeNormals&&e.geometry.computeVertexNormals(),e.geometry.applyMatrix4(c),n.content.rtcCenter?e.geometry.translate(n.content.rtcCenter[0],n.content.rtcCenter[1],n.content.rtcCenter[2]):e.geometry.scale(1,1,-1),"4dkk"==n.tileset.options.type){e.geometry.computeBoundingBox(),e.material.dispose();var s=new Xu({geometry:e.geometry,texture:e.material.map,name:e.name,meshUrl:n.contentUrl,tileId:n.id});t.add(s)}else t.add(e)})),a(t)}),(function(e){s(new Error("error parsing gltf in tile ".concat(n.id,": ").concat(e)))}))})));case 1:case"end":return a.stop()}}),a)})))}function Rx(t,n,i,o){var r={rtc_center:t.content.rtcCenter,points:t.content.attributes.positions,intensities:t.content.attributes.intensity,classifications:t.content.attributes.classification,rgb:null,rgba:null},a=t.content.attributes.colors;a&&3===a.size&&(r.rgb=a.value),a&&4===a.size&&(r.rgba=a.value);var s=new e.BufferGeometry;s.setAttribute("position",new e.Float32BufferAttribute(r.points,3));var l=(new e.Matrix4).fromArray(t.computedTransform).premultiply(o);r.rgba?s.setAttribute("color",new e.Float32BufferAttribute(r.rgba,4)):r.rgb&&s.setAttribute("color",new e.Uint8BufferAttribute(r.rgb,3,!0)),r.intensities&&s.setAttribute("intensity",new e.BufferAttribute(r.intensities,1,!0)),r.classifications&&s.setAttribute("classification",new e.Uint8BufferAttribute(r.classifications,1,!1));var c=new e.Points(s,i.material||n);if(r.rtc_center){var u=r.rtc_center;l.multiply((new e.Matrix4).makeTranslation(u[0],u[1],u[2]))}return c.applyMatrix4(l),c}function Mx(e){var t,n,i,o;(null===(t=null==e?void 0:e.uniforms)||void 0===t?void 0:t.map)?null===(i=null===(n=null==e?void 0:e.uniforms)||void 0===n?void 0:n.map.value)||void 0===i||i.dispose():e.map&&(null===(o=e.map)||void 0===o||o.dispose()),e.dispose()}function Sx(e){e.traverse((function(e){if(e.isMesh)if(e.geometry.dispose(),e.material.isMaterial)Mx(e.material);else{var t,n=Dh(e.material);try{for(n.s();!(t=n.n()).done;){Mx(t.value)}}catch(e){n.e(e)}finally{n.f()}}}));for(var t=e.children.length-1;t>=0;t--){var n=e.children[t];e.remove(n)}}var Dx=ae(),Fx=function(e){return e.floors||(e={floors:[e]}),e.floors.map((function(e){return e.column=e.column||[],e.window=e.window||[],e.door=e.door||[],e.groundCase=e.groundCase||[],e.bayCase=e.bayCase||[],e.slideDoor=e.slideDoor||[],e.tagging=e.tagging||[],e.furnColumn=e.furnColumn||[],e.furnFlue=e.furnFlue||[],(e.rooms||e.room||e.points)&&(e.room=e.rooms||e.room||e.points,e.room.forEach((function(t){isNumber(t.top)||(t.top=isNumber(e.top)?e.top:1),isNumber(t.bottom)||(t.bottom=isNumber(e.bottom)?e.bottom:1),!t.ground&&t.points&&(t.ground=t.points),t.hole||(t.hole=[]),t.close=!0}))),e})),e};function Lx(e,t){for(var n=Object.create(null),i=e.split(","),o=0;o<i.length;o++)n[i[o]]=!0;return t?function(e){return!!n[e.toLowerCase()]}:function(e){return!!n[e]}}Xe("resource",(function(){return function(){function e(){o(this,e),this.reload=!1,this.version=Date.now(),this.nowTime=Date.now(),this.imageVersion=0,this.linkVersion=0}var t,n,i,r,a,s,l,c,h,d,p,f,m,v,g,A,y,E,w,b;return u(e,[{key:"num",get:function(){return this.$app.config.num}},{key:"mode",get:function(){return this.$app.config.view?"view":"edit"}},{key:"time",get:function(){return this.reload||this.refresh?(this.reload&&(this.reload=!1,this.refresh=Date.now()),this.refresh):this.version}},{key:"base",value:function(e){return Dx+e}},{key:"auth",value:(b=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("edit"==this.mode){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.$app.remote_editor.getAuth({num:this.num});case 5:return(t=e.sent).success&&this.$app.store.set("auth",t.data),e.abrupt("return",t);case 10:throw e.prev=10,e.t0=e.catch(2),e.t0;case 13:case"end":return e.stop()}}),e,this,[[2,10]])}))),function(){return b.apply(this,arguments)})},{key:"metadata",value:(w=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nt.time("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),t=null,n=null,!this.$app.config.view){e.next=19;break}if("local"!=this.$app.config.deploy||this.$app.config.server){e.next=10;break}return e.next=7,Xn.get(this.getViewResourceURL("data/scene.json?_=".concat(this.time)));case 7:n=e.sent,e.next=17;break;case 10:if(!window.__KANKAN_DATA){e.next=14;break}n=window.__KANKAN_DATA,e.next=17;break;case 14:return e.next=16,Xn.get("/service/scene/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 16:n=e.sent;case 17:e.next=22;break;case 19:return e.next=21,Xn.get("/service/scene/edit/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 21:n=e.sent;case 22:if(null==n.success){e.next=31;break}if(!n.success){e.next=27;break}t=n.data,e.next=29;break;case 27:return this.$app.Scene.emit("error",{type:"network",code:n.code,message:n.message}),e.abrupt("return");case 29:e.next=32;break;case 31:t=n;case 32:return t.entry&&"string"==typeof t.entry&&(t.entry=JSON.parse(t.entry)),t.boxVideos&&"string"==typeof t.boxVideos&&(t.boxVideos=JSON.parse(t.boxVideos)),t.boxPhotos&&"string"==typeof t.boxPhotos&&(t.boxPhotos=JSON.parse(t.boxPhotos)),t.boxModels&&"string"==typeof t.boxModels&&(t.boxModels=JSON.parse(t.boxModels)),t.videos&&"string"==typeof t.videos&&(t.videos=JSON.parse(t.videos)),t.version&&(this.version=t.version,this.imageVersion=t.imgVersion||0,this.linkVersion=t.linkVersion||0),null==t.sns&&(t.sns={},null==t.sns.share&&(t.sns.share={},t.sns.share={__init__:!0,title:t.title,keywords:"",description:t.description,image:t.entry?"thumb-1k.jpg":null})),nt.timeEnd("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),this.$app.store.set("metadata",t),e.abrupt("return",t);case 42:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"visions",value:(E=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return nt.time("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),e.next=3,Xn.getBueffer(this.getResourceURL("scene_view_data/{num}/images/vision.modeldata?_=".concat(this.version)));case 3:return t=e.sent,e.next=6,this.$app.store.get("metadata");case 6:n=e.sent,nt.timeEnd("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),function(e){nt.time("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid));var t=Yu.decompressModeldata(e);"ajk"==n.dataSync&&i.$app.DataSYNC.use("DataAJK",{sweepLocations:t});var o=Ku.visionModeldata(t);nt.timeEnd("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid)),i.$app.core.get("Player").model.panos=Ku.panos(i.$app,o,n),i.$app.core.get("Player").model.dispatchEvent({type:"gotPanos"})}(t);case 10:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"visions2",value:(y=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.$app.core.get("Player").model,nt.time("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),e.next=4,Xn.getBueffer(this.getResourceURL("scene_view_data/{num}/images/vision2.modeldata?_=".concat(this.version)));case 4:n=e.sent,nt.timeEnd("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),function(e){nt.time("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid));var n=Yu.decompressModeldata(e),o=Ku.visionModeldata(n);nt.timeEnd("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid)),Ku.panosAssist(o,i.$app).forEach((function(e){t.panos.index[e.id-1].assistPano=e}))}(n);case 8:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"modelmesh3dTiles",value:(A=k(S.mark((function e(){var t,n,i,o,r=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return nt.time("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),t=this.$app.core.get("Player"),n=this.$app.core.get("SceneRenderer"),e.next=5,kx.load({url:this.getResourceURL("scene_view_data/{num}/images/3dtiles/tileset.json?_=".concat(Date.now())),renderer:n.renderer,options:{dracoDecoderPath:$n.getImageURL("images/loaders/DRACOLoader/draco"),basisTranscoderPath:$n.getImageURL("images/loaders/KTX2Loader/basis"),maximumScreenSpaceError:Ce.isMobile()?16/3:16,isLowestDepth:!0,ingoreVisibleCompute:!0,maximumMemoryUsage:Ce.detectIOS()?.1:32,imageVersion:this.imageVersion,type:"4dkk"},model:t.model});case 5:i=e.sent,o=i.runtime,t.model._3dTilesRuntime=o,n.autoUpdate3dTiles=!0,o.getTileset().on("endTileLoading",(function(e){if(0==e.loadingCount&&!t.model.mesh3dTilesLoaded){if(t.model.mesh3dTilesLoaded=!0,t.model.floors.sort(),Ce.detectIOS()){var n=new THREE.Box3;t.model.floors.forEach((function(e){return n.union(e.boundingBox)})),t.model._3dTilesRuntime.setModelSize(n.getSize(new THREE.Vector3))}r.$app.Scene.emit("3dTilesLoaded"),t.model._3dTilesRuntime.pauseTilesetUpdate(!1),t.model._3dTilesRuntime.pauseTilesetUpdate(!0),nt.timeEnd("".concat(r.$app.config.num,"[load modelmesh]").concat(r.$app.uid))}}));case 10:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"modelmeshDam",value:(g=k(S.mark((function e(){var t,n,i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=function(e,t){if(0===e.length){nt.warn("No geometry found for model, loading faux geometry, disabling outside mode"),t.model.supportedModes[ht.DOLLHOUSE]=!1,t.model.supportedModes[ht.FLOORPLAN]=!1;var n=new Xu({geometry:new THREE.PlaneBufferGeometry(5,5,1,1)});n.material.visible=!1,n.rotateX(-Math.PI/2),n.geometry.computeBoundingBox(),e=[n]}e.forEach((function(e){var n=0;t.model.floorsEnabled&&(n=$u.parseFloor(e.name)),t.model.addChunk(n,e)})),t.model.floors.sort()},t=Je.job+Je.format,this.$app.config.model.name&&(t=this.$app.config.model.name),nt.time("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),e.next=6,Xn.getBueffer(this.getResourceURL("scene_view_data/{num}/images/".concat(t,"?_=").concat(this.imageVersion)));case 6:n=e.sent,nt.timeEnd("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),function(e){nt.time("".concat(o.$app.config.num,"[parse dam]").concat(o.$app.uid));var t=Yu.decompressMesh(e),n=Ku.convertProtobufToSceneObject(o.$app,t);nt.timeEnd("".concat(o.$app.config.num,"[parse dam]").concat(o.$app.uid)),i(n,o.$app.core.get("Player"))}(n);case 10:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"textures",value:(v=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return nt.time("".concat(this.$app.config.num,"[load textures]").concat(this.$app.uid)),e.next=3,eh.load(this.$app.core.get("Player").model,this.$app.core.get("Player").model.meshTextures,this);case 3:nt.timeEnd("".concat(this.$app.config.num,"[load textures]").concat(this.$app.uid)),this.$app.core.get("Player").model.meshTexturesLoaded=!0;case 5:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"floor",value:(m=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,nt.time("".concat(this.$app.config.num,"[load floor]").concat(this.$app.uid)),e.next=5,Xn.get(this.getResourceURL("scene_view_data/{num}/data/floor.json?_=".concat(this.time)));case 5:t=e.sent,nt.timeEnd("".concat(this.$app.config.num,"[load floor]").concat(this.$app.uid)),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),nt.warn("loaded [floor] error");case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(){return m.apply(this,arguments)})},{key:"floorcad",value:(f=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,nt.time("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=5,Xn.get(this.getResourceURL("scene_view_data/{num}/data/floorplan_cad.json?_=".concat(this.time)));case 5:(t=e.sent).floors||(t=Fx(t)),t&&t.floors&&(t.floors=t.floors.filter((function(e){return e.segment&&e.segment.length>0}))),nt.timeEnd("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),nt.warn("loaded [floorcad] error");case 14:return this.$app.store.set("floorcad",t),e.abrupt("return",t);case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return f.apply(this,arguments)})},{key:"flooruser",value:(p=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=null,n=this.$app.store.getValue("metadata"),e.prev=2,nt.time("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),!n.floorPlanUser){e.next=10;break}return e.next=7,Xn.get(this.getUserResourceURL("floorplan.json",this.reload));case 7:t=e.sent,e.next=13;break;case 10:return e.next=12,Xn.get(this.getViewDataURL("floorplan.json"));case 12:t=e.sent;case 13:nt.timeEnd("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),e.next=30;break;case 16:if(e.prev=16,e.t0=e.catch(2),nt.warn("loaded [flooruser] error"),!n.floorPlanUser){e.next=29;break}return e.prev=20,e.next=23,Xn.get(this.getViewDataURL("floorplan.json"));case 23:t=e.sent,e.next=29;break;case 26:e.prev=26,e.t1=e.catch(20),nt.warn("loaded [flooruser] error");case 29:t||(t={unit:"m",floors:[{walls:{Wall7:{important:!1,geoType:"Wall",children:[],start:"Point3",vectorId:"Wall7",width:.2,end:"Point0",out:!1},Wall6:{important:!1,geoType:"Wall",children:[],start:"Point2",vectorId:"Wall6",width:.2,end:"Point3",out:!1},Wall5:{important:!1,geoType:"Wall",children:[],start:"Point1",vectorId:"Wall5",width:.2,end:"Point2",out:!1},Wall4:{important:!1,geoType:"Wall",children:[],start:"Point0",vectorId:"Wall4",width:.2,end:"Point1",out:!1}},subgroup:0,name:"1楼",id:0,points:{Point1:{parent:{Wall5:"start",Wall4:"end"},geoType:"Point",vectorId:"Point1",x:5.531,y:5.777},Point0:{parent:{Wall7:"end",Wall4:"start"},geoType:"Point",vectorId:"Point0",x:5.531,y:-6.046},Point3:{parent:{Wall7:"start",Wall6:"end"},geoType:"Point",vectorId:"Point3",x:-2.663,y:-6.046},Point2:{parent:{Wall6:"start",Wall5:"end"},geoType:"Point",vectorId:"Point2",x:-2.663,y:5.777}}}],currentId:8,angle:0,type:"cad",version:"v4.0"});case 30:return this.$app.store.set("flooruser",t),e.abrupt("return",t);case 32:case"end":return e.stop()}}),e,this,[[2,16],[20,26]])}))),function(){return p.apply(this,arguments)})},{key:"billboards",value:(d=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(t=e.sent,n=null,"view"!==this.mode){e.next=14;break}if(t.billboards){e.next=8;break}return e.abrupt("return");case 8:return e.next=10,Xn.get(this.getUserResourceURL("billboards.json"));case 10:n=e.sent,this.$app.store.set("billboards",n),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.billboards_list({num:this.num});case 16:n=e.sent,this.$app.store.set("billboards",n.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),nt.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return d.apply(this,arguments)})},{key:"tags",value:(h=k(S.mark((function e(t){var n,i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.$app.config.isLoadTags||t){e.next=2;break}return e.abrupt("return");case 2:return n={data:{icons:[],tags:[]}},e.prev=3,e.next=6,this.$app.store.get("metadata");case 6:if(i=e.sent,nt.time("".concat(this.num,"[load tags]").concat(this.$app.uid)),"view"!=this.mode){e.next=24;break}if(i.tags){e.next=11;break}return e.abrupt("return");case 11:if(n.success=!0,!t){e.next=18;break}return e.next=15,Xn.get(t);case 15:e.t0=e.sent,e.next=21;break;case 18:return e.next=20,Xn.get(this.getUserResourceURL("hot.json"));case 20:e.t0=e.sent;case 21:n.data.tags=e.t0,e.next=27;break;case 24:return e.next=26,this.$app.remote_editor.tag_list({num:this.num});case 26:n=e.sent;case 27:n.success&&n.data&&n.data.tags&&n.data.tags.map((function(e){return e.position&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos?e.visiblePanos=Array.from(new Set(e.visiblePanos)).map((function(e){return o.$app.core.get("Player").model.panos.index[e]})):e.visiblePanos=o.$app.TagManager.getVisiblePano(e.position,{maxDis:5})),e})),nt.timeEnd("".concat(this.num,"[load tags]").concat(this.$app.uid)),e.next=34;break;case 31:e.prev=31,e.t1=e.catch(3),nt.error("loaded [tags] error",e.t1);case 34:return this.$app.store.set("tags",n.data),e.abrupt("return",n.data);case 36:case"end":return e.stop()}}),e,this,[[3,31]])}))),function(e){return h.apply(this,arguments)})},{key:"tours",value:(c=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this.$app.store.get("metadata");case 4:if(!e.sent.tours){e.next=9;break}return e.next=8,Xn.get(this.getUserResourceURL("tour.json"));case 8:t=e.sent;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),nt.error("loaded [tour] error",e.t0);case 14:return this.$app.store.set("tours",t),e.abrupt("return",t);case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return c.apply(this,arguments)})},{key:"links",value:(l=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(t=e.sent,n=null,"view"!==this.mode){e.next=15;break}if(t.links){e.next=8;break}return e.abrupt("return");case 8:return e.next=10,Xn.get(this.getUserResourceURL("links.json"));case 10:n=(n=e.sent).filter((function(e){return i.$app.core.get("Player").model.panos.get(e.nearestPano)})),this.$app.store.set("links",n),e.next=20;break;case 15:return e.next=17,this.$app.remote_editor.linkPan_list({num:this.num});case 17:(n=e.sent).data.tags=n.data.tags.filter((function(e){return i.$app.core.get("Player").model.panos.get(e.nearestPano)})),this.$app.store.set("links",n.data);case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(0),nt.error("loaded [tour] error",e.t0);case 25:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(){return l.apply(this,arguments)})},{key:"cameras",value:(s=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.surveillances){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,Xn.get(this.getUserResourceURL("surveillance.json"));case 10:t=e.sent,this.$app.store.set("cameras",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.surveillance_list({num:this.num});case 16:t=e.sent,this.$app.store.set("cameras",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),nt.error("loaded [cameras] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return s.apply(this,arguments)})},{key:"mosaics",value:(a=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.mosaic){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,Xn.get(this.getUserResourceURL("mosaic.json"));case 10:t=e.sent,this.$app.store.set("mosaics",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.mosaics_list({num:this.num});case 16:t=e.sent,this.$app.store.set("mosaics",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),nt.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return a.apply(this,arguments)})},{key:"filters",value:(r=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.filters){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,Xn.get(this.getUserResourceURL("filter.json"));case 10:t=e.sent,this.$app.store.set("filters",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.filter_list({num:this.num});case 16:t=e.sent,this.$app.store.set("filters",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),nt.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return r.apply(this,arguments)})},{key:"getImage",value:(i=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xn.getImage("".concat(this.$app.config.resource).concat(t));case 2:return n=e.sent,this.$app.store.set(t,n),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserImage",value:(n=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Xn.getImage(this.getUserResourceURL(t)),this.$app.store.set(t,n),e.abrupt("return",n);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getAppImage",value:(t=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xn.getImage(this.base(t));case 2:return n=e.sent,this.$app.store.set(t,n),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getAppURL",value:function(e){return this.base(e)}},{key:"getServerURL",value:function(e){return this.$app.config.server+e}},{key:"getResourceURL",value:function(e){return this.$app.config.resource+e.replace(/\{num\}/g,this.num)}},{key:"getUserResourceURL",value:function(e,t,n){return e&&e.trim()?0===e.indexOf("blob:")||0===e.indexOf("http")||0===e.indexOf("file")?e:(t&&(this.reload=!0),n?this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/").concat(e,"?_=").concat(this.nowTime):this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/").concat(e,"?_=").concat(this.time)):e}},{key:"getUserModelResourceURL",value:function(e,t){return e&&e.trim()?0===e.indexOf("blob:")||0===e.indexOf("http")||0===e.indexOf("file")?e:(t&&(this.reload=!0),this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/boxModels/").concat(e,"?_=").concat(this.time)):e}},{key:"getTourVideoURL",value:function(e,t){return t&&(this.reload=!0),this.$app.config.resource+"".concat(e,"?_=").concat(this.time)}},{key:"getViewResourceURL",value:function(e){return this.$app.config.resource+"scene_view_data/".concat(this.num,"/").concat(e)}},{key:"getViewDataURL",value:function(e){return this.$app.config.resource+"scene_view_data/".concat(this.num,"/data/").concat(e,"?_=").concat(this.version)}},{key:"getEditDataURL",value:function(e){return this.$app.config.resource+"scene_edit_data/".concat(this.num,"/data/").concat(e,"?_=").concat(this.version)}},{key:"getViewImagesURL",value:function(e){if(-1!==e.indexOf("&_="))return e;var t=-1!==e.indexOf("/panorama/")?this.linkVersion:this.imageVersion;return-1!==e.indexOf("?")?this.$app.config.resource+"scene_view_data/".concat(this.num,"/images/").concat(e,"&_=").concat(t):this.$app.config.resource+"scene_view_data/".concat(this.num,"/images/").concat(e,"?_=").concat(t)}},{key:"getUserImagesURL",value:function(e){var t;return t="view"==this.mode?"scene_view_data":"scene_edit_data",-1!==e.indexOf("&_=")?e:-1!==e.indexOf("?")?this.$app.config.resource+"".concat(t,"/").concat(this.num,"/images/").concat(e,"&_=").concat(this.version):this.$app.config.resource+"".concat(t,"/").concat(this.num,"/images/").concat(e,"?_=").concat(this.version)}}]),e}()}));var Hx,Qx=Object.assign,Ox=Object.prototype.hasOwnProperty,Vx=function(e,t){return Ox.call(e,t)},_x=Array.isArray,Ux=function(e){return"[object Map]"===jx(e)},Nx=function(e){return"symbol"==typeof e},zx=function(e){return null!==e&&"object"==typeof e},Gx=Object.prototype.toString,jx=function(e){return Gx.call(e)},Wx=function(e){return"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e},qx=function(e,t){return!Object.is(e,t)};function Jx(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yx(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Yx(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Zx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hx;t&&t.active&&t.effects.push(e)}var Xx,Kx=function(e){var t=new Set(e);return t.w=0,t.n=0,t},$x=function(e){return(e.w&iI)>0},eI=function(e){return(e.n&iI)>0},tI=new WeakMap,nI=0,iI=1,oI=Symbol(""),rI=Symbol(""),aI=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;o(this,e),this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,Zx(this,i)}return u(e,[{key:"run",value:function(){if(!this.active)return this.fn();for(var e=Xx,t=cI;e;){if(e===this)return;e=e.parent}try{return this.parent=Xx,Xx=this,cI=!0,iI=1<<++nI,nI<=30?function(e){var t=e.deps;if(t.length)for(var n=0;n<t.length;n++)t[n].w|=iI}(this):sI(this),this.fn()}finally{nI<=30&&function(e){var t=e.deps;if(t.length){for(var n=0,i=0;i<t.length;i++){var o=t[i];$x(o)&&!eI(o)?o.delete(e):t[n++]=o,o.w&=~iI,o.n&=~iI}t.length=n}}(this),iI=1<<--nI,Xx=this.parent,cI=t,this.parent=void 0}}},{key:"stop",value:function(){this.active&&(sI(this),this.onStop&&this.onStop(),this.active=!1)}}]),e}();function sI(e){var t=e.deps;if(t.length){for(var n=0;n<t.length;n++)t[n].delete(e);t.length=0}}function lI(e){e.effect.stop()}var cI=!0,uI=[];function hI(){uI.push(cI),cI=!1}function dI(){var e=uI.pop();cI=void 0===e||e}function pI(e,t,n){if(cI&&Xx){var i=tI.get(e);i||tI.set(e,i=new Map);var o=i.get(n);o||i.set(n,o=Kx()),function(e,t){var n=!1;nI<=30?eI(e)||(e.n|=iI,n=!$x(e)):n=!e.has(Xx);n&&(e.add(Xx),Xx.deps.push(e))}(o)}}function fI(e,t,n,i,o,r){var a=tI.get(e);if(a){var s=[];if("clear"===t)s=H(a.values());else if("length"===n&&_x(e))a.forEach((function(e,t){("length"===t||t>=i)&&s.push(e)}));else switch(void 0!==n&&s.push(a.get(n)),t){case"add":_x(e)?Wx(n)&&s.push(a.get("length")):(s.push(a.get(oI)),Ux(e)&&s.push(a.get(rI)));break;case"delete":_x(e)||(s.push(a.get(oI)),Ux(e)&&s.push(a.get(rI)));break;case"set":Ux(e)&&s.push(a.get(oI))}if(1===s.length)s[0]&&mI(s[0]);else{var l,c=[],u=Jx(s);try{for(u.s();!(l=u.n()).done;){var h=l.value;h&&c.push.apply(c,H(h))}}catch(e){u.e(e)}finally{u.f()}mI(Kx(c))}}}function mI(e,t){var n,i=Jx(_x(e)?e:H(e));try{for(i.s();!(n=i.n()).done;){var o=n.value;(o!==Xx||o.allowRecurse)&&(o.scheduler?o.scheduler():o.run())}}catch(e){i.e(e)}finally{i.f()}}var vI=Lx("__proto__,__v_isRef,__isVue"),gI=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter(Nx)),AI=bI(),yI=bI(!0),EI=wI();function wI(){var e={};return["includes","indexOf","lastIndexOf"].forEach((function(t){e[t]=function(){for(var e=iT(this),n=0,i=this.length;n<i;n++)pI(e,0,n+"");for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];var s=e[t].apply(e,r);return-1===s||!1===s?e[t].apply(e,H(r.map(iT))):s}})),["push","pop","shift","unshift","splice"].forEach((function(t){e[t]=function(){hI();for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var o=iT(this)[t].apply(this,n);return dI(),o}})),e}function bI(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n,i,o){if("__v_isReactive"===i)return!e;if("__v_isReadonly"===i)return e;if("__v_isShallow"===i)return t;if("__v_raw"===i&&o===(e?t?ZI:YI:t?JI:qI).get(n))return n;var r=_x(n);if(!e&&r&&Vx(EI,i))return Reflect.get(EI,i,o);var a=Reflect.get(n,i,o);return(Nx(i)?gI.has(i):vI(i))?a:(e||pI(n,0,i),t?a:aT(a)?!r||!Wx(i)?a.value:a:zx(a)?e?$I(a):KI(a):a)}}function CI(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,n,i,o){var r=t[n];if(tT(r)&&aT(r)&&!aT(i))return!1;if(!e&&!tT(i)&&(nT(i)||(i=iT(i),r=iT(r)),!_x(t)&&aT(r)&&!aT(i)))return r.value=i,!0;var a=_x(t)&&Wx(n)?Number(n)<t.length:Vx(t,n),s=Reflect.set(t,n,i,o);return t===iT(o)&&(a?qx(i,r)&&fI(t,"set",n,i):fI(t,"add",n,i)),s}}var xI={get:AI,set:CI(),deleteProperty:function(e,t){var n=Vx(e,t);e[t];var i=Reflect.deleteProperty(e,t);return i&&n&&fI(e,"delete",t,void 0),i},has:function(e,t){var n=Reflect.has(e,t);return Nx(t)&&gI.has(t)||pI(e,0,t),n},ownKeys:function(e){return pI(e,0,_x(e)?"length":oI),Reflect.ownKeys(e)}},II={get:yI,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},TI=function(e){return e},BI=function(e){return Reflect.getPrototypeOf(e)};function kI(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=iT(e=e.__v_raw),r=iT(t);t!==r&&!n&&pI(o,0,t),!n&&pI(o,0,r);var a=BI(o),s=a.has,l=i?TI:n?rT:oT;return s.call(o,t)?l(e.get(t)):s.call(o,r)?l(e.get(r)):void(e!==o&&e.get(t))}function PI(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.__v_raw,i=iT(n),o=iT(e);return e!==o&&!t&&pI(i,0,e),!t&&pI(i,0,o),e===o?n.has(e):n.has(e)||n.has(o)}function RI(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.__v_raw,!t&&pI(iT(e),0,oI),Reflect.get(e,"size",e)}function MI(e){e=iT(e);var t=iT(this);return BI(t).has.call(t,e)||(t.add(e),fI(t,"add",e,e)),this}function SI(e,t){t=iT(t);var n=iT(this),i=BI(n),o=i.has,r=i.get,a=o.call(n,e);a||(e=iT(e),a=o.call(n,e));var s=r.call(n,e);return n.set(e,t),a?qx(t,s)&&fI(n,"set",e,t):fI(n,"add",e,t),this}function DI(e){var t=iT(this),n=BI(t),i=n.has,o=n.get,r=i.call(t,e);r||(e=iT(e),r=i.call(t,e)),o&&o.call(t,e);var a=t.delete(e);return r&&fI(t,"delete",e,void 0),a}function FI(){var e=iT(this),t=0!==e.size,n=e.clear();return t&&fI(e,"clear",void 0,void 0),n}function LI(e,t){return function(n,i){var o=this,r=o.__v_raw,a=iT(r),s=t?TI:e?rT:oT;return!e&&pI(a,0,oI),r.forEach((function(e,t){return n.call(i,s(e),s(t),o)}))}}function HI(e,t,n){return function(){var i=this.__v_raw,o=iT(i),r=Ux(o),a="entries"===e||e===Symbol.iterator&&r,s="keys"===e&&r,l=i[e].apply(i,arguments),c=n?TI:t?rT:oT;return!t&&pI(o,0,s?rI:oI),{next(){var e=l.next(),t=e.value,n=e.done;return n?{value:t,done:n}:{value:a?[c(t[0]),c(t[1])]:c(t),done:n}},[Symbol.iterator](){return this}}}}function QI(e){return function(){return"delete"!==e&&this}}function OI(){var e={get(e){return kI(this,e)},get size(){return RI(this)},has:PI,add:MI,set:SI,delete:DI,clear:FI,forEach:LI(!1,!1)},t={get(e){return kI(this,e,!1,!0)},get size(){return RI(this)},has:PI,add:MI,set:SI,delete:DI,clear:FI,forEach:LI(!1,!0)},n={get(e){return kI(this,e,!0)},get size(){return RI(this,!0)},has(e){return PI.call(this,e,!0)},add:QI("add"),set:QI("set"),delete:QI("delete"),clear:QI("clear"),forEach:LI(!0,!1)},i={get(e){return kI(this,e,!0,!0)},get size(){return RI(this,!0)},has(e){return PI.call(this,e,!0)},add:QI("add"),set:QI("set"),delete:QI("delete"),clear:QI("clear"),forEach:LI(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((function(o){e[o]=HI(o,!1,!1),n[o]=HI(o,!0,!1),t[o]=HI(o,!1,!0),i[o]=HI(o,!0,!0)})),[e,n,t,i]}var VI=ce(OI(),4),_I=VI[0],UI=VI[1],NI=VI[2],zI=VI[3];function GI(e,t){var n=t?e?zI:NI:e?UI:_I;return function(t,i,o){return"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(Vx(n,i)&&i in t?n:t,i,o)}}var jI={get:GI(!1,!1)},WI={get:GI(!0,!1)},qI=new WeakMap,JI=new WeakMap,YI=new WeakMap,ZI=new WeakMap;function XI(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(function(e){return jx(e).slice(8,-1)}(e))}function KI(e){return tT(e)?e:eT(e,!1,xI,jI,qI)}function $I(e){return eT(e,!0,II,WI,YI)}function eT(e,t,n,i,o){if(!zx(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;var r=o.get(e);if(r)return r;var a=XI(e);if(0===a)return e;var s=new Proxy(e,2===a?i:n);return o.set(e,s),s}function tT(e){return!(!e||!e.__v_isReadonly)}function nT(e){return!(!e||!e.__v_isShallow)}function iT(e){var t=e&&e.__v_raw;return t?iT(t):e}var oT=function(e){return zx(e)?KI(e):e},rT=function(e){return zx(e)?$I(e):e};function aT(e){return!(!e||!0!==e.__v_isRef)}function sT(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return lT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lT(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function lT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}Promise.resolve();var cT=!1,uT=[],hT=Promise.resolve(),dT=function(e){return hT.then(e)},pT=function(e){uT.includes(e)||uT.push(e),cT||(cT=!0,dT(fT))},fT=function(){var e,t=sT(uT);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}uT.length=0,cT=!1};function mT(e){if(bT(e)){for(var t={},n=0;n<e.length;n++){var i=e[n],o=xT(i)?AT(i):mT(i);if(o)for(var r in o)t[r]=o[r]}return t}return xT(e)||IT(e)?e:void 0}var vT=/;(?![^(]*\))/g,gT=/:(.+)/;function AT(e){var t={};return e.split(vT).forEach((function(e){if(e){var n=e.split(gT);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function yT(e){var t="";if(xT(e))t=e;else if(bT(e))for(var n=0;n<e.length;n++){var i=yT(e[n]);i&&(t+=i+" ")}else if(IT(e))for(var o in e)e[o]&&(t+=o+" ");return t.trim()}function ET(e,t){if(e===t)return!0;var n=CT(e),i=CT(t);if(n||i)return!(!n||!i)&&e.getTime()===t.getTime();if(n=bT(e),i=bT(t),n||i)return!(!n||!i)&&function(e,t){if(e.length!==t.length)return!1;for(var n=!0,i=0;n&&i<e.length;i++)n=ET(e[i],t[i]);return n}(e,t);if(n=IT(e),i=IT(t),n||i){if(!n||!i)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var o in e){var r=e.hasOwnProperty(o),a=t.hasOwnProperty(o);if(r&&!a||!r&&a||!ET(e[o],t[o]))return!1}}return String(e)===String(t)}function wT(e,t){return e.findIndex((function(e){return ET(e,t)}))}var bT=Array.isArray,CT=function(e){return e instanceof Date},xT=function(e){return"string"==typeof e},IT=function(e){return null!==e&&"object"==typeof e},TT=function(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}},BT=/-(\w)/g,kT=TT((function(e){return e.replace(BT,(function(e,t){return t?t.toUpperCase():""}))})),PT=/\B([A-Z])/g,RT=TT((function(e){return e.replace(PT,"-$1").toLowerCase()})),MT=function(e){var t=parseFloat(e);return isNaN(t)?e:t},ST=/^(spellcheck|draggable|form|list|type)$/,DT=function(e){var t,n=e.el,i=e.get,o=e.effect,r=e.arg,a=e.modifiers;"class"===r&&(n._class=n.className),o((function(){var e=i();if(r)(null==a?void 0:a.camel)&&(r=kT(r)),FT(n,r,e,t);else{for(var o in e)FT(n,o,e[o],t&&t[o]);for(var s in t)e&&s in e||FT(n,s,null)}t=e}))},FT=function(e,t,n,i){if("class"===t)e.setAttribute("class",yT(e._class?[e._class,n]:n)||"");else if("style"===t){n=mT(n);var o=e.style;if(n)if(xT(n))n!==i&&(o.cssText=n);else{for(var r in n)HT(o,r,n[r]);if(i&&!xT(i))for(var a in i)null==n[a]&&HT(o,a,"")}else e.removeAttribute("style")}else e instanceof SVGElement||!(t in e)||ST.test(t)?"true-value"===t?e._trueValue=n:"false-value"===t?e._falseValue=n:null!=n?e.setAttribute(t,n):e.removeAttribute(t):(e[t]=n,"value"===t&&(e._value=n))},LT=/\s*!important$/,HT=function e(t,n,i){bT(i)?i.forEach((function(i){return e(t,n,i)})):n.startsWith("--")?t.setProperty(n,i):LT.test(i)?t.setProperty(RT(n),i.replace(LT,""),"important"):t[n]=i},QT=function(e,t){var n=e.getAttribute(t);return null!=n&&e.removeAttribute(t),n},OT=function(e,t,n,i){e.addEventListener(t,n,i)},VT=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,_T=["ctrl","shift","alt","meta"],UT={stop:function(e){return e.stopPropagation()},prevent:function(e){return e.preventDefault()},self:function(e){return e.target!==e.currentTarget},ctrl:function(e){return!e.ctrlKey},shift:function(e){return!e.shiftKey},alt:function(e){return!e.altKey},meta:function(e){return!e.metaKey},left:function(e){return"button"in e&&0!==e.button},middle:function(e){return"button"in e&&1!==e.button},right:function(e){return"button"in e&&2!==e.button},exact:function(e,t){return _T.some((function(n){return e["".concat(n,"Key")]&&!t[n]}))}},NT=function(e){var t=e.el,n=e.get,i=e.exp,o=e.arg,r=e.modifiers;if(o){var a=VT.test(i)?n("(e => ".concat(i,"(e))")):n("($event => { ".concat(i," })"));if("vue:mounted"!==o){if("vue:unmounted"===o)return function(){return a()};if(r){"click"===o&&(r.right&&(o="contextmenu"),r.middle&&(o="mouseup"));var s=a;a=function(e){if(!("key"in e)||RT(e.key)in r){for(var t in r){var n=UT[t];if(n&&n(e,r))return}return s(e)}}}OT(t,o,a,r)}else dT(a)}},zT=function(e){var t=e.el,n=e.get;(0,e.effect)((function(){t.textContent=GT(n())}))},GT=function(e){return null==e?"":IT(e)?JSON.stringify(e,null,2):String(e)},jT=function(e){return"_value"in e?e._value:e.value},WT=function(e,t){var n=t?"_trueValue":"_falseValue";return n in e?e[n]:t},qT=function(e){e.target.composing=!0},JT=function(e){var t=e.target;t.composing&&(t.composing=!1,YT(t,"input"))},YT=function(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)},ZT=Object.create(null),XT=function(e,t,n){return KT(e,"return(".concat(t,")"),n)},KT=function(e,t,n){var i=ZT[t]||(ZT[t]=$T(t));try{return i(e,n)}catch(e){console.error(e)}},$T=function(e){try{return new Function("$data","$el","with($data){".concat(e,"}"))}catch(t){return console.error("".concat(t.message," in expression: ").concat(e)),function(){}}},eB={bind:DT,on:NT,show:function(e){var t=e.el,n=e.get,i=e.effect,o=t.style.display;i((function(){t.style.display=n()?o:"none"}))},text:zT,html:function(e){var t=e.el,n=e.get;(0,e.effect)((function(){t.innerHTML=n()}))},model:function(e){var t=e.el,n=e.exp,i=e.get,o=e.effect,r=e.modifiers,a=t.type,s=i("(val) => { ".concat(n," = val }")),l=r||{},c=l.trim,u=l.number,h=void 0===u?"number"===a:u;if("SELECT"===t.tagName){var d=t;OT(t,"change",(function(){var e=Array.prototype.filter.call(d.options,(function(e){return e.selected})).map((function(e){return h?MT(jT(e)):jT(e)}));s(d.multiple?e:e[0])})),o((function(){for(var e=i(),t=d.multiple,n=0,o=d.options.length;n<o;n++){var r=d.options[n],a=jT(r);if(t)bT(e)?r.selected=wT(e,a)>-1:r.selected=e.has(a);else if(ET(jT(r),e))return void(d.selectedIndex!==n&&(d.selectedIndex=n))}t||-1===d.selectedIndex||(d.selectedIndex=-1)}))}else if("checkbox"===a){var p;OT(t,"change",(function(){var e=i(),n=t.checked;if(bT(e)){var o=jT(t),r=wT(e,o),a=-1!==r;if(n&&!a)s(e.concat(o));else if(!n&&a){var l=H(e);l.splice(r,1),s(l)}}else s(WT(t,n))})),o((function(){var e=i();bT(e)?t.checked=wT(e,jT(t))>-1:e!==p&&(t.checked=ET(e,WT(t,!0))),p=e}))}else if("radio"===a){OT(t,"change",(function(){s(jT(t))})),o((function(){var e=i();undefined!==e&&(t.checked=ET(e,jT(t)))}))}else{var f=function(e){return c?e.trim():h?MT(e):e};OT(t,"compositionstart",qT),OT(t,"compositionend",JT),OT(t,(null==r?void 0:r.lazy)?"change":"input",(function(){t.composing||s(f(t.value))})),c&&OT(t,"change",(function(){t.value=t.value.trim()})),o((function(){if(!t.composing){var e=t.value,n=i();document.activeElement===t&&f(e)===n||e!==n&&(t.value=n)}}))}},effect:function(e){var t=e.el,n=e.ctx,i=e.exp,o=e.effect;dT((function(){return o((function(){return KT(n.scope,i,t)}))}))}},tB=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,nB=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,iB=/^\(|\)$/g,oB=/^[{[]\s*((?:[\w_$]+\s*,?\s*)+)[\]}]$/,rB=function(e,t,n){var i=t.match(tB);if(i){var o=e.nextSibling,r=e.parentElement,a=new Text("");r.insertBefore(a,e),r.removeChild(e);var s,l,c,u,h=i[2].trim(),d=i[1].trim().replace(iB,"").trim(),p=!1,f="key",m=e.getAttribute(f)||e.getAttribute(f=":key")||e.getAttribute(f="v-bind:key");m&&(e.removeAttribute(f),"key"===f&&(m=JSON.stringify(m))),(u=d.match(nB))&&(d=d.replace(nB,"").trim(),l=u[1].trim(),u[2]&&(c=u[2].trim())),(u=d.match(oB))&&(s=u[1].split(",").map((function(e){return e.trim()})),p="["===d[0]);var v,g,A,y=!1,E=function(e,t,i,o){var r={};s?s.forEach((function(e,n){return r[e]=t[p?n:e]})):r[d]=t,o?(l&&(r[l]=o),c&&(r[c]=i)):l&&(r[l]=i);var a=vB(n,r),u=m?XT(a.scope,m):i;return e.set(u,i),a.key=u,a},w=function(t,n){var i=new AB(e,t);return i.key=t.key,i.insert(r,n),i};return n.effect((function(){var e=XT(n.scope,h),t=A,i=ce(function(e){var t=new Map,n=[];if(bT(e))for(var i=0;i<e.length;i++)n.push(E(t,e[i],i));else if("number"==typeof e)for(var o=0;o<e;o++)n.push(E(t,o+1,o));else if(IT(e)){var r=0;for(var a in e)n.push(E(t,e[a],r++,a))}return[n,t]}(e),2);if(g=i[0],A=i[1],y){for(var o=0;o<v.length;o++)A.has(v[o].key)||v[o].remove();for(var s,l,c=[],u=g.length;u--;){var d=g[u],p=t.get(d.key),f=void 0;null==p?f=w(d,s?s.el:a):(f=v[p],Object.assign(f.ctx.scope,d.scope),p!==u&&(v[p+1]===s&&l!==s||(l=f,f.insert(r,s?s.el:a)))),c.unshift(s=f)}v=c}else v=g.map((function(e){return w(e,a)})),y=!0})),o}},aB=function(e){var t,n=e.el,i=e.ctx.scope.$refs,o=e.get;return(0,e.effect)((function(){var e=o();i[e]=n,t&&e!==t&&delete i[t],t=e})),function(){t&&delete i[t]}},sB=/^(?:v-|:|@)/,lB=/\.([\w-]+)/g,cB=!1,uB=function(e,t){var n=e.nodeType;if(1===n){var i,o=e;if(o.hasAttribute("v-pre"))return;if(QT(o,"v-cloak"),i=QT(o,"v-if"))return function(e,t,n){var i=e.parentElement,o=new Comment("v-if");i.insertBefore(o,e);for(var r,a,s=[{exp:t,el:e}];(r=e.nextElementSibling)&&(a=null,""===QT(r,"v-else")||(a=QT(r,"v-else-if")));)i.removeChild(r),s.push({exp:a,el:r});var l,c=e.nextSibling;i.removeChild(e);var u=-1,h=function(){l&&(i.insertBefore(o,l.el),l.remove(),l=void 0)};return n.effect((function(){for(var e=0;e<s.length;e++){var t=s[e],r=t.exp,a=t.el;if(!r||XT(n.scope,r))return void(e!==u&&(h(),(l=new AB(a,n)).insert(i,o),i.removeChild(o),u=e))}u=-1,h()})),c}(o,i,t);if(i=QT(o,"v-for"))return rB(o,i,t);if((i=QT(o,"v-scope"))||""===i){var r=i?XT(t.scope,i):{};t=vB(t,r),r.$template&&fB(o,r.$template)}var a=null!=QT(o,"v-once");a&&(cB=!0),(i=QT(o,"ref"))&&pB(o,aB,'"'.concat(i,'"'),t),hB(o,t);for(var s=[],l=0,c=H(o.attributes);l<c.length;l++){var u=c[l],h=u.name,d=u.value;sB.test(h)&&"v-cloak"!==h&&("v-model"===h?s.unshift([h,d]):"@"===h[0]||/^v-on\b/.test(h)?s.push([h,d]):dB(o,h,d,t))}for(var p=0,f=s;p<f.length;p++){var m=ce(f[p],2),v=m[0],g=m[1];dB(o,v,g,t)}a&&(cB=!1)}else if(3===n){var A=e.data;if(A.includes(t.delimiters[0])){for(var y,E=[],w=0;y=t.delimitersRE.exec(A);){var b=A.slice(w,y.index);b&&E.push(JSON.stringify(b)),E.push("$s(".concat(y[1],")")),w=y.index+y[0].length}w<A.length&&E.push(JSON.stringify(A.slice(w))),pB(e,zT,E.join("+"),t)}}else 11===n&&hB(e,t)},hB=function(e,t){for(var n=e.firstChild;n;)n=uB(n,t)||n.nextSibling},dB=function(e,t,n,i){var o,r,a;if(":"===(t=t.replace(lB,(function(e,t){return(a||(a={}))[t]=!0,""})))[0])o=DT,r=t.slice(1);else if("@"===t[0])o=NT,r=t.slice(1);else{var s=t.indexOf(":"),l=s>0?t.slice(2,s):t.slice(2);o=eB[l]||i.dirs[l],r=s>0?t.slice(s+1):void 0}o&&(o===DT&&"ref"===r&&(o=aB),pB(e,o,n,i,r,a),e.removeAttribute(t))},pB=function(e,t,n,i,o,r){var a=t({el:e,get:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n;return XT(i.scope,t,e)},effect:i.effect,ctx:i,exp:n,arg:o,modifiers:r});a&&i.cleanups.push(a)},fB=function(e,t){if("#"!==t[0])e.innerHTML=t;else{var n=document.querySelector(t);e.appendChild(n.content.cloneNode(!0))}},mB=function(e){var t=Object.assign(Object.assign({delimiters:["{{","}}"],delimitersRE:/\{\{([^]+?)\}\}/g},e),{scope:e?e.scope:KI({}),dirs:e?e.dirs:{},effects:[],blocks:[],cleanups:[],effect:function(e){if(cB)return pT(e),e;var n=function(e,t){e.effect&&(e=e.effect.fn);var n=new aI(e);t&&(Qx(n,t),t.scope&&Zx(n,t.scope)),t&&t.lazy||n.run();var i=n.run.bind(n);return i.effect=n,i}(e,{scheduler:function(){return pT(n)}});return t.effects.push(n),n}});return t},vB=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.scope,i=Object.create(n);Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)),i.$refs=Object.create(n.$refs);var o=KI(new Proxy(i,{set:(e,t,i,r)=>r!==o||e.hasOwnProperty(t)?Reflect.set(e,t,i,r):Reflect.set(n,t,i)}));return gB(o),Object.assign(Object.assign({},e),{scope:o})},gB=function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];"function"==typeof e[i]&&(e[i]=e[i].bind(e))}},AB=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];o(this,e),this.isFragment=t instanceof HTMLTemplateElement,i?this.template=t:this.isFragment?this.template=t.content.cloneNode(!0):this.template=t.cloneNode(!0),i?this.ctx=n:(this.parentCtx=n,n.blocks.push(this),this.ctx=mB(n)),uB(this.template,this.ctx)}return u(e,[{key:"el",get:function(){return this.start||this.template}},{key:"insert",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isFragment)if(this.start)for(var n,i=this.start;i&&(n=i.nextSibling,e.insertBefore(i,t),i!==this.end);)i=n;else this.start=new Text(""),this.end=new Text(""),e.insertBefore(this.end,t),e.insertBefore(this.start,this.end),e.insertBefore(this.template,this.end);else e.insertBefore(this.template,t)}},{key:"remove",value:function(){if(this.parentCtx&&function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)}(this.parentCtx.blocks,this),this.start)for(var e,t=this.start.parentNode,n=this.start;n&&(e=n.nextSibling,t.removeChild(n),n!==this.end);)n=e;else this.template.parentNode.removeChild(this.template);this.teardown()}},{key:"teardown",value:function(){this.ctx.blocks.forEach((function(e){e.teardown()})),this.ctx.effects.forEach(lI),this.ctx.cleanups.forEach((function(e){return e()}))}}]),e}(),yB=function(e){return e.replace(/[-.*+?^${}()|[\]\/\\]/g,"\\$&")},EB=function(e){var t,n=mB();if(e&&(n.scope=KI(e),gB(n.scope),e.$delimiters)){var i=ce(n.delimiters=e.$delimiters,2),o=i[0],r=i[1];n.delimitersRE=new RegExp(yB(o)+"([^]+?)"+yB(r),"g")}return n.scope.$s=GT,n.scope.$nextTick=dT,n.scope.$refs=Object.create(null),{directive(e,t){return t?(n.dirs[e]=t,this):n.dirs[e]},mount(e){var i;if("string"!=typeof e||(e=document.querySelector(e)))return(i=(e=e||document.documentElement).hasAttribute("v-scope")?[e]:H(e.querySelectorAll("[v-scope]")).filter((function(e){return!e.matches("[v-scope] [v-scope]")}))).length||(i=[e]),t=i.map((function(e){return new AB(e,n,!0)})),this},unmount(){t.forEach((function(e){return e.teardown()}))}}},wB=document.currentScript;wB&&wB.hasAttribute("init")&&EB().mount();var bB=Object.freeze({__proto__:null,createApp:EB,nextTick:dT,reactive:KI}),CB=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})};function xB(e,t){return new File([e],t,{type:e.type})}function IB(e,t){if(e&&t){var n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.download=t,i.click(),i.remove(),window.URL.revokeObjectURL(n)}}var TB=Object.freeze({__proto__:null,base64ToBlob:CB,convertBlob2File:xB,download:IB,downloadFromURL:function(e,t){return new Promise(function(){var n=k(S.mark((function n(i,o){var r,a;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e&&t){n.next=2;break}return n.abrupt("return",o("url or name is null"));case 2:if(!(e instanceof Blob)){n.next=7;break}IB(e,t),i(!0),n.next=19;break;case 7:if(0!==e.indexOf("data:")){n.next=12;break}IB(CB(e),t),i(!0),n.next=19;break;case 12:return n.next=14,fetch(e);case 14:return r=n.sent,n.next=17,r.blob();case 17:(a=n.sent)?(IB(a,t),i(!0)):o(!1);case 19:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}())}});function BB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var kB,PB=new THREE.Vector3,RB=new THREE.Vector3,MB=new THREE.Vector3,SB=new THREE.Quaternion,DB=new THREE.Quaternion,FB=new THREE.Color(1,1,1),LB=new THREE.Color(2,2,2),HB=function(e){f(n,THREE.PerspectiveCamera);var t=BB(n);function n(e,i,r){var a,s,l,c,u;return o(this,n),(a=t.call(this,i.fov||na.clampVFOV(ke.dollhouseFOV),i.aspect||e.player.cameraControls.cameras.dollhouse.aspect,ke.dollhouseNear,ke.dollhouseFar)).shake=(l=pe.getUniqueId(),c=pe.getUniqueId(),u=h(a),function e(t){s=s&&s.equals(u.shakingRange.to)?u.shakingRange.from:u.shakingRange.to,t?(pe.start(It.quaternion(u.quaternion,s),u.shakingDuration,null,0,null,null,l),pe.start(It.quaternion(u.cylinder.quaternion,s),u.shakingDuration,(function(){return e(!0)}),0,null,null,c)):(pe.cancelById(l),pe.cancelById(c))}),a.options=i,a.control=e,a.player=a.control.player,a.videoPlayer=r,a.sid=i.sid,a.name=i.name||"",a.type="SecurityCamera",a.panoId=i.panoId,a.videoSrc=i.video,a.videoActive=!1,a.shakingDuration=i.duration||2e3,a.shakingRange={from:new THREE.Quaternion,to:(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),Math.PI/2)},i.from&&a.shakingRange.from.setFromEuler(i.from),i.to&&a.shakingRange.to.setFromEuler(i.to),a.posOri=i.posOri||new THREE.Vector3,a.posOffset=i.posOffset||new THREE.Vector3,a.position.copy(a.posOri).add(a.posOffset),i.target?(a.target=i.target,a.lookAt(i.target)):(i.rotation&&a.quaternion.setFromEuler(i.rotation),a.target=new THREE.Vector3(0,0,-1).applyQuaternion(a.quaternion).add(a.position)),a.cylinderNear=i.near||.03,a.cylinderFar=i.far||3,a.roll=0,a.init(),a.layers.enable(kt),a.layers.enable(Pt),a.player.model.add(h(a)),a}return u(n,[{key:"setRoll",value:function(e){this.roll=e%360,this.obj3d.quaternion.setFromAxisAngle(PB.set(0,0,-1),THREE.MathUtils.degToRad(e))}},{key:"yaw",get:function(){var e=PB.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion).setY(0),t=RB.set(0,0,1),n=MB.set(1,0,0),i=(THREE.MathUtils.radToDeg(e.angleTo(t)*Math.sign(e.dot(n)))+180)%360;return i>180&&(i-=360),i},set:function(e){var t=this.pitch,n=PB.set(0,1,0),i=RB.set(1,0,0),o=SB.setFromAxisAngle(n,THREE.MathUtils.degToRad(e)),r=DB.setFromAxisAngle(i,THREE.MathUtils.degToRad(t));this.quaternion.multiplyQuaternions(o,r),this.updateTarget()}},{key:"pitch",get:function(){var e=PB.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion),t=RB.copy(e).projectOnPlane(MB.set(0,1,0)),n=THREE.MathUtils.radToDeg(e.angleTo(t)*Math.sign(e.y))%180;return n>90&&(n=90-n),n},set:function(e){e=Math.min(Math.max(e,-89.9),89.9);var t=this.yaw<0?this.yaw+360:this.yaw,n=PB.set(0,1,0),i=RB.set(1,0,0),o=SB.setFromAxisAngle(n,THREE.MathUtils.degToRad(t)),r=DB.setFromAxisAngle(i,THREE.MathUtils.degToRad(e));this.quaternion.multiplyQuaternions(o,r),this.updateTarget()}},{key:"init",value:function(){var e=this;this.normalMat=new THREE.MeshBasicMaterial({color:51375,transparent:!0,opacity:.1,side:THREE.DoubleSide,depthTest:!1}),this.build(),this.options.pitch&&(this.pitch=this.options.pitch),this.options.yaw&&(this.yaw=this.options.yaw),this.options.roll&&this.setRoll(this.options.roll),this.updateInfo(!0);var t=this.createVideo();if(this.videoSrc){t.onloadedmetadata=function(){t.canPlayed=!0,t.masters.forEach((function(e){e.dispatchEvent({type:"loadedmetadata"})}))};var n=function(t){e.player.$app.Camera.emit("SecurityCamera.videoActive",e.sid),e.videoActive=!0,e.updateInfo(!0)};if(t.canPlayed?n():this.addEventListener("loadedmetadata",n),Hls.isSupported()){var i=new Hls;i.loadSource(this.videoSrc),i.attachMedia(t),i.on(Hls.Events.ERROR,(function(e,t){return console.log("HLS加载失败",e,t)})),this.hlsVideoPlayer=i}else t.src=this.videoSrc;this.play(),this.pause()}this.videoMat=new THREE.MeshBasicMaterial({map:new THREE.VideoTexture(t),side:THREE.DoubleSide,depthTest:!1,transparent:!0}),this.events={setSize:function(t,n){e.isWatching&&e.updateAspect()}},this.player.on("setSize",this.events.setSize)}},{key:"updateAspect",value:function(){var e=this.player.cameraControls.cameras.dollhouse.aspect;e!=this.aspect&&(this.aspect=e,this.updateMesh())}},{key:"updateMesh",value:function(){var e,t,n,i;t=(e=Math.tan(THREE.MathUtils.degToRad(this.fov/2))*this.cylinderNear)*this.aspect,i=(n=Math.tan(THREE.MathUtils.degToRad(this.fov/2))*this.cylinderFar)*this.aspect;var o=[],r=[];o.push(-t,e,-this.cylinderNear),o.push(t,e,-this.cylinderNear),o.push(t,-e,-this.cylinderNear),o.push(-t,-e,-this.cylinderNear),r.push(-i,n,-this.cylinderFar),r.push(i,n,-this.cylinderFar),r.push(i,-n,-this.cylinderFar),r.push(-i,-n,-this.cylinderFar),o=o.concat(r);var a=!this.cylinder;if(a){var s=[];s.push(0,1,1,1,1,0,0,0),s.push(0,1,1,1,1,0,0,0);var l=[];l.push(0,1,3,2,3,1),l.push(0,1,4,5,4,1),l.push(1,2,5,6,5,2),l.push(2,3,6,7,6,3),l.push(3,0,7,4,7,0);var c=new THREE.BufferGeometry;c.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(s),2)),c.setIndex(new THREE.BufferAttribute(new Uint16Array(l),1)),this.cylinder=new THREE.Mesh(c,this.normalMat),this.obj3d.add(this.cylinder)}this.cylinder.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3));var u=new THREE.PlaneGeometry(2*i,2*n);a?(this.cylinder.bottom=new THREE.Mesh(u,this.normalMat),this.cylinder.add(this.cylinder.bottom)):(this.cylinder.bottom.geometry.dispose(),this.cylinder.bottom.geometry=u),this.cylinder.bottom.position.set(0,0,this.cylinderNear-this.cylinderFar),a?(this.cylinder.line=new THREE.LineSegments(new THREE.EdgesGeometry(this.cylinder.geometry),new THREE.LineBasicMaterial({color:16777215,opacity:.6,transparent:!0})),this.cylinder.add(this.cylinder.line)):(this.cylinder.line.geometry.dispose(),this.cylinder.line.geometry=new THREE.EdgesGeometry(this.cylinder.geometry))}},{key:"createVideo",value:function(e){e&&(this.videoSrc=e);var t=this.videoPlayer.getVideo(this.videoSrc,this);return this.video=t,t}},{key:"build",value:function(){if(this.obj3d=new THREE.Group,this.obj3d.camera=this,this.add(this.obj3d),kB)this.tag=kB.clone(),this.obj3d.add(this.tag);else{var e=this;Xa($n.getImageURL("images/camera.glb"),(function(t){e.tag=t.scene.children[0].children[0],e.tag.geometry.translate(30,50,-10),e.tag.quaternion.setFromEuler(new THREE.Euler(Math.PI/2,Math.PI,0)),e.obj3d.add(e.tag),kB=e.tag.clone()}))}this.updateMesh(),this.titleLabel=new Ki({text:this.name,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:5,margin:{x:12,y:10},player:this.player,sizeInfo:{scale:.4,nearBound:3}}),this.titleLabel.sprite.material.depthTest=this.titleLabel.sprite.material.depthWrite=!0,this.titleLabel.position.set(0,-.2,.1),this.add(this.titleLabel),this.dispatchEvent({type:"build"})}},{key:"showVideo",value:function(e){this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!e||this.control.isEdit),this.videoActive&&(e?(this.play(),this.normalMat.opacity=0,Ae.updateVisible(this.cylinder,"watch",!0,1,"add"),this.cylinder.bottom.material=this.videoMat,this.cylinder.bottom.renderOrder=ze):(this.pause(),this.normalMat.opacity=.08,Ae.updateVisible(this.cylinder,"watch",!1,1,"cancel"),this.cylinder.bottom.material=this.normalMat,this.cylinder.bottom.renderOrder=Re))}},{key:"play",value:function(){var e=this;if(this.shouldPlay=!0,Ce.detectWeixin())try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(t){e.video.play()}),!1)}catch(e){this.video.play()}else this.video.play(),this.video.paused&&console.log("播放不了")}},{key:"pause",value:function(){this.shouldPlay=!1,this.video.pause()}},{key:"watch",value:function(e){var t=this;this.player.$app.config.view||this.player.compass.switch("axis"),this.updateAspect(),this.isWatching=!0;var n=this.player.cameraControls.controls.dollhouse;n.minDistance=0,n.minPolarAngle=-Math.PI,n.maxPolarAngle=Math.PI,n.mode="security",n.forbitSetRanges=!0,this.target.set(0,0,-1).applyQuaternion(this.quaternion).add(this.position),this.videoActive||this.isNew||this.player.$app.Camera.emit("SecurityCamera.cannotWatchVideo",this.sid);var i=function(){var e=t.player.model.panos.get(t.panoId).floorIndex;t.player.model.currentFloorId!=e&&t.player.$app.Scene.emit("Scene.gotoFloor",e)};if(pe.cancelById("leaveMonitor"),this.player.mode==ht.DOLLHOUSE){i();var o=this.player.cameraControls.activeControl;pe.start(It.property(n.camera,"fov",this.fov,(function(e){n.camera.staticFov=e})),1e3),pe.start(It.vector(o.target,this.target),1e3,null,0,de[Je.flydown.rotationEasing],null,Je.freeze.LookRotationForPlay),pe.start(It.vector(o.camera.position,e||this.position),1e3,(function(){t.player.mode==ht.DOLLHOUSE&&(t.showVideo(!0),t.tag.material.color.copy(LB),n.camera.near=.09)}),0,de[Je.flydown.movementEasing],null,Je.freeze.LookRotationForPlay)}else n.camera.staticFov=n.camera.fov=this.fov,n.camera.updateProjectionMatrix(),this.player.flyToNewMode({mode:ht.DOLLHOUSE,position:e||this.position,target:this.target,callback:function(){i(),t.showVideo(!0),t.tag.material.color.copy(LB),n.camera.near=.09}});this.player.emit("beginShowMonitor")}},{key:"leave",value:function(){var e=this;this.player.$app.config.view||this.player.compass.switch("direction"),this.showVideo(!1),this.isWatching=!1,this.tag.material.color.copy(FB);var t=this.player.cameraControls.controls.dollhouse;t.camera.near=1,t.minPolarAngle=25/180*Math.PI,t.maxPolarAngle=Math.PI/2,t.mode="model",pe.cancelById("leaveMonitor"),pe.cancelById(Je.freeze.LookRotationForPlay);var n=this.player.baseFov*(1/this.player.zoomLevel);pe.start(It.property(t.camera,"fov",n,(function(e){t.camera.staticFov=e})),1e3,(function(){t.camera.staticFov=null,t.camera.fov=n,t.camera.updateProjectionMatrix(),t.forbitSetRanges=!1,t.updateDistance(t.camera.aspect),e.player.emit("leavedShowMonitor")}),null,null,null,"leaveMonitor")}},{key:"updatePosition",value:function(e){this.position.set(e.x,e.y,e.z),this.updateTarget()}},{key:"updateRotation",value:function(e){this.rotation.set(e.x,e.y,e.z),this.updateTarget()}},{key:"updateTarget",value:function(e){e?(this.target.set(e.x,e.y,e.z),this.lookAt(this.target)):this.target.set(0,0,-1).applyQuaternion(this.quaternion).add(this.position)}},{key:"updateInfo",value:function(e){var t={sid:this.sid,name:this.name,panoId:this.panoId,posOri:{x:this.posOri.x,y:this.posOri.y,z:this.posOri.z},posOffset:{x:this.posOffset.x,y:this.posOffset.y,z:this.posOffset.z},fov:this.fov,aspect:this.aspect,far:this.cylinderFar,roll:Math.round(this.roll),pitch:Math.round(this.pitch),yaw:Math.round(this.yaw),video:this.videoSrc};return e&&(this.info=t),t}},{key:"dispose",value:function(){this.parent.remove(this),pe.cancelById("cameraHighlight"+this.sid),this.tag.geometry.dispose(),this.tag.material.dispose(),this.cylinder.line.geometry.dispose(),this.cylinder.line.material.dispose(),this.cylinder.geometry.dispose(),this.normalMat.dispose(),this.videoMat.dispose(),this.player.off("setSize",this.events.setSize),this.titleLabel.dispose(),this.hlsVideoPlayer&&this.hlsVideoPlayer.destroy()}},{key:"highlight",value:function(e){this.hightlighted!=e&&(this.hightlighted=e,pe.cancelById("cameraHighlight"+this.sid),pe.start(It.color(this.tag.material.color,e?LB:FB),100,null,null,null,null,"cameraHighlight"+this.sid))}}]),n}(),QB=function(){function e(t){o(this,e),this.app=t.$app,this.player=t,this.isEdit=!1,this.unbindDollhouse=!1,this.cameras=[],this.hoverCamera=null,this.watchingCamera=null,this.editingCamera=null,this.selectType=null,this.transformType=0,this.hideCylinder=!0,this.isFloorplan=t.mode===ht.FLOORPLAN,this.maxVisiAngle=Math.PI/6,this.maxVisiZoom=2,this.maxVisiDistance=1,this.bindEvents()}var t;return u(e,[{key:"currentCamera",get:function(){return this.isEdit?this.editingCamera:this.watchingCamera}},{key:"editingCamera",get:function(){return this._editingCamera},set:function(e){e!=this._editingCamera&&(this._editingCamera&&Ae.updateVisible(this._editingCamera,"edit",!1,2,"cancel"),e&&Ae.updateVisible(e,"edit",!0,2,"add"),this._editingCamera=e)}},{key:"addCamera",value:function(e){this.cameras.push(e)}},{key:"removeCamera",value:function(e){e.isWatching&&this.stopWatch(),this.cameras=this.cameras.filter((function(t){return t!=e})),e.dispose()}},{key:"watch",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("transitioning"!=this.player.mode){e.next=2;break}return e.abrupt("return");case 2:if(!this.app.Camera.monitor.locked||!this.app.Camera.monitor.locked.then){e.next=5;break}return e.next=5,this.app.Camera.monitor.locked;case 5:this.watchingCamera?this.watchingCamera!=t&&this.stopWatch():this.lastViewState={mode:this.player.mode,floorIndex:this.player.model.allFloorsVisible?"all":this.player.model.currentFloorId,quaternion:this.player.quaternion.clone(),position:this.player.position.clone(),target:this.player.cameraControls.activeControl.target.clone(),currentScale:this.player.cameraControls.activeControl.currentScale},t.watch(n),this.watchingCamera=t,this.player.$app.Camera.emit("SecurityCamera.watch",{sid:t.sid,supportPlay:Hls.isSupported()||t.videoActive}),this.isEdit&&(this.unbindDollhouse=!!n,this.editingCamera=t,this.selectType="camera",this.player.$app.Camera.emit("SecurityCamera.select",this.currentCamera.updateInfo()));case 10:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"stopWatch",value:function(){this.watchingCamera&&(this.watchingCamera.isWatching&&this.watchingCamera.leave(),this.player.$app.Camera.emit("SecurityCamera.stopWatch",this.watchingCamera.sid),this.watchingCamera=null,this.isEdit&&(this.editingCamera=null,this.selectType=null,this.player.$app.Camera.emit("SecurityCamera.unselect")))}},{key:"hideAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"common",i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.cameras.forEach((function(r){null!=e&&t.player.model.panos.get(r.panoId).floorIndex!==e||Ae.updateVisible(r,n,!1,i,o)}))}},{key:"showAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"common",i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.isFloorplan||this.cameras.forEach((function(r){null!=e&&t.player.model.panos.get(r.panoId).floorIndex!==e||Ae.updateVisible(r,n,!0,i,o)}))}},{key:"bindEvents",value:function(){var e=this;this.player.on("pointerUp",this.onMouseUp.bind(this)),this.player.on("touchend",this.onMouseUp.bind(this)),this.player.on("pointerMove",this.onMouseMove.bind(this)),this.player.domElement.addEventListener("mousewheel",this.onMouseWheel.bind(this));var t=[];this.player.on("collectIntersectMesh",(function(n,i){t=e.cameras.filter((function(e){return e.tag&&e.obj3d.visible})).map((function(e){return e.tag})),n.push.apply(n,H(t))})),this.player.on("judgeIntersect",(function(n,i){i.getConsumed()||(n&&t.includes(n.object)?(e.hoverCamera=n.object.parent.camera,e.player.$app.Camera.emit("SecurityCamera.hover",e.hoverCamera.sid),e.hoverCamera.highlight(!0),os.add("hoverMonitor"),i.consume()):e.hoverCamera&&(e.hoverCamera.highlight(!1),e.hoverCamera=null,e.player.$app.Camera.emit("SecurityCamera.nothover"),os.remove("hoverMonitor")))})),this.player.on(zr,(function(){e.isEdit||e.stopWatch()})),this.player.on(Nr,(function(t,n){e.isEdit||e.stopWatch(),t===ht.FLOORPLAN&&(e.isFloorplan=!1,e.isEdit||e.cameras.forEach((function(e){return Ae.updateVisible(e,"common",!0)}))),n===ht.FLOORPLAN&&(e.isFloorplan=!0,e.isEdit||e.cameras.forEach((function(e){return Ae.updateVisible(e,"common",!1)})))}))}},{key:"onMouseUp",value:function(e){this.hoverCamera||this.onMouseMove(),this.hoverCamera&&(e.consume(),this.watch(this.hoverCamera))}},{key:"onMouseMove",value:function(){this.watchingCamera&&this.watchingCamera.isWatching&&this.isEdit&&this.player.mouseDown&&(this.unbindDollhouse=!0)}},{key:"onMouseWheel",value:function(){this.watchingCamera&&this.watchingCamera.isWatching&&this.isEdit&&(this.unbindDollhouse=!0)}}]),e}();function OB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var VB=function(e){f(n,THREE.Group);var t=OB(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.renderOrder=Le,i.name="TagSpot3d",i.visible=!1,i.height=new THREE.Vector3(0,0,.12),e.model.add(h(i)),i.build(),i}return u(n,[{key:"build",value:function(){var e=new THREE.Mesh(new THREE.PlaneBufferGeometry(.15,.15,1,1),new THREE.MeshLambertMaterial({transparent:!0,depthTest:!1,map:Ae.loadTextureFromCache($n.getImageURL("images/tag_icon_default.svg"))}));e.renderOrder=He,e.position.copy(this.height),this.topMesh=e,this.add(e);var t=ui.createLine([this.height,new THREE.Vector3(0,0,0)],{width:2,color:"#eee"});this.line=t,this.add(t);var n=new THREE.Mesh(new THREE.PlaneBufferGeometry(.35,.35,1,1),new THREE.MeshLambertMaterial({transparent:!0,depthTest:!1,map:Ae.loadTextureFromCache($n.getImageURL("images/tag_pointer.png"))}));this.bottomMesh=n,this.add(n)}},{key:"updateSize",value:function(){var e=he.getScaleForConstantSize({width2d:500,position:this.position,camera:this.player.camera,dom:this.player.$app.dom});this.topMesh.scale.set(e,e,e)}}]),n}();function _B(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var UB=function(){function e(t){var n,i,r=this;o(this,e),this.app=t,this.edit={},this.isSingleView=!1,this.locked=null,this.deferred=vt(),Hls.isSupported()||console.error("Hls is not Supported, 部分监控视频可能不支持"),this.app.Scene.on("loaded",(function(){var e=r.app.core.get("Player");r.control=new QB(e);var t=!r.app.config.view&&!r.app.config.mobile,n=Ce.detectAndroidMobile();r.videoPlayer=n?new NB(e):new zB(e);var i=function(e){r.control.hideCylinder=t,e.forEach((function(e){var t=new HB(r.control,{sid:e.sid,name:e.name,panoId:e.panoId,video:e.playUrl,posOri:new THREE.Vector3(parseFloat(e.data["posOri-x"]),parseFloat(e.data["posOri-y"]),parseFloat(e.data["posOri-z"])),posOffset:new THREE.Vector3(parseFloat(e.data["posOffset-x"]),parseFloat(e.data["posOffset-y"]),parseFloat(e.data["posOffset-z"])),fov:parseInt(e.data.fov),far:parseFloat(e.data.far),yaw:parseInt(e.data.yaw),roll:parseInt(e.data.roll),pitch:parseInt(e.data.pitch)},r.videoPlayer);t.cylinder.visible=!r.control.hideCylinder,r.control.addCamera(t)})),r.app.store.getValue("metadata").controls.showCameraTitle||r.changeTitlesShow(!1),r.deferred&&r.deferred.resolve()},o=r.app.store.getValue("cameras");o?i(o):r.app.store.on("cameras",(function(e){return i(e)}));var a=r.app.store.getValue("metadata");if(a?r.isSingleView="laser"==a.sceneFrom:r.app.store.on("metadata",(function(e){return r.isSingleView="laser"==e.sceneFrom})),r.isSingleView){var s;r.spot3d=new VB(e),r.spot3d.visible=!1;var l=new THREE.Vector3;e.on("pointerStart",(function(t){r.isSingleView&&r.editingCamera&&s&&(r.updateTagPos=!0,e.cameraControls.activeControl.enabled=!1)})),e.on("pointerMove",(function(t){if(r.isSingleView&&(r.editingCamera||r.updateTagPos)&&((s=e.getMouseIntersect(null,[r.spot3d.topMesh,r.spot3d.bottomMesh]))?e.domElement.style.cursor="move":r.editingCamera&&!r.updateTagPos&&(e.domElement.style.cursor="default"),r.updateTagPos)){var n=e.getMouseIntersect(null,e.OverlayManager.group.children.concat(e.model.colliders));n?(r.spot3d.visible=!0,r.spot3d.position.copy(n.point),r.spot3d.lookAt(l.addVectors(n.point,n.normal)),r.spot3d.topMesh.lookAt(e.camera.position),r.spot3d.updateSize()):r.spot3d.visible=!1}})),e.on("pointerUp",(function(t){r.isSingleView&&r.spot3d&&r.spot3d.visible&&(e.cameraControls.activeControl.enabled=!0,e.cameraControls.activeControl.pointerDragOn=!1,r.updateTagPos=!1,r.editingCamera||(r.editingCamera={position:r.spot3d.position,sid:Ae.getRandomSid()}))}))}e.on("update",(function(){r.camPosChosing||r.control.isEdit||r.app.TagManager.tagPosChosing||r.app.TagManager.tagInfoEditing||r.app.TourManager.editing||r.app.ViewLinkEdit.markView||"360view"==e.currentPano.panoType||e.paintEditor&&e.paintEditor.painting||e.linkEditor&&e.linkEditor.setPanoVisible||e.linkEditor&&e.linkEditor.setTagVisible?r.control.cameras.forEach((function(e){Ae.updateVisible(e,"hideAtSomePage",!!e.isWatching)})):r.control.cameras.forEach((function(e){Ae.updateVisible(e,"hideAtSomePage",!0)}))}))})),this.edit.enterModule=function(e){r.control?(r.edit.hideCylinder(!e),setTimeout((function(){r.control.cameras.forEach((function(e){e.videoActive&&r.app.Camera.emit("SecurityCamera.videoActive",e.sid)}))}),1)):r.deferred.then((function(){return r.edit.enterModule(e)}))},this.edit.leaveModule=function(){r.control?r.edit.hideCylinder(!0):r.deferred=null},this.edit.enter=function(e){if(r.editingCamera=e,r.camPosChosing=!0,r.isSingleView){r.app.TagManager.hideAll();var t=r.app.core.get("Player");t.reticule.visible=!1,e?t.flyToPano({pano:t.model.panos.get(e.panoId),lookAtPoint:e.position.clone(),aimDuration:500,checkAlone:!0},(function(){t.locked=!0,r.updateTagPos=!1,r.spot3d.position.set(e.position.x,e.position.y,e.position.z),r.spot3d.updateSize(),setTimeout((function(){var n=new THREE.Vector3(0,0,0),i=new THREE.Vector3(0,0,.5);he.projectPositionToCanvas(e.position,t.camera,n,t.domElement),he.convertScreenPositionToNDC(n.x,n.y,i,t.domElement);var o=t.getMouseIntersect(i,t.OverlayManager.group.children.concat(t.model.colliders));o&&(r.spot3d.lookAt(o.normal.add(r.spot3d.position)),r.spot3d.topMesh.lookAt(t.camera.position)),r.spot3d.visible=!0}),10)})):(t.locked=!0,r.updateTagPos=!0,r.spot3d.position.set(0,1e3,0),r.spot3d.updateSize(),r.spot3d.visible=!0)}else r.app.core.get("Scene").getSplit("TAG").then((function(t){null==r.editHandle&&(r.editHandle=r.app.withNewComponent("TagEditManager",t,{spotA:r.app.dom.querySelector('.player[name="main"] .player-mark'),spotB:r.app.dom.querySelector('.player[name="copy"] .player-mark')})),e?r.editHandle.reSetPos(e.position):r.editHandle.enter()}));e&&Ae.updateVisible(e.titleLabel,"editPos",!1)},this.edit.modify=function(e){r.checkMonitorExist(e,(function(e){r.edit.enter(e)}))},this.edit.exit=function(){var e=r.app.core.get("Player");if(r.isSingleView)e.domElement.style.cursor="default",e.locked=!1,e.reticule.visible=!0,r.spot3d.visible=!1,r.updateTagPos=!1,r.app.TagManager.showAll();else{if(!r.editHandle)return;t.core.get("Scene").restore("TAG"),r.editHandle.exit({cancel:!0}),setTimeout((function(){e.cameraControls.activeControl.camera.fov=70,e.camera.fov=e.baseFov*(1/e.zoomLevel)}),50)}r.editingCamera&&r.editingCamera.titleLabel&&Ae.updateVisible(r.editingCamera.titleLabel,"editPos",!0),r.editingCamera=null,r.camPosChosing=!1},this.edit.confirm=function(e){var t=r.app.core.get("Player");if(r.isSingleView){if(!r.editingCamera)return;if(!r.spot3d.visible)return r.edit.exit(),null;var n=r.editingCamera.sid,i=r.spot3d.position;if("SecurityCamera"!=r.editingCamera.type){var o=t.currentPano.id,a=new HB(r.control,{sid:n,posOri:i,panoId:o,target:t.currentPano.position.clone()},r.videoPlayer);a.isNew=!0,r.control.addCamera(a),r.control.editingCamera=a}else r.editingCamera.updatePosition(i),r.editingCamera.posOri.copy(i),r.editingCamera.posOffset.set(0,0,0);return r.edit.exit(),r.edit.watch(n,!0,!0),n}if(!r.editHandle)return null;var s=r.editHandle.confirmPos(),l=s.position,c=s.sid;if(!l)return e||r.edit.exit(),null;if(r.editingCamera)c=r.editingCamera.sid,r.editingCamera.updatePosition(l),r.editingCamera.posOri.copy(l),r.editingCamera.posOffset.set(0,0,0),r.control.editingCamera=r.editingCamera;else{var u=t.currentPano.id,h=new HB(r.control,{sid:c,posOri:l,panoId:u,target:t.currentPano.position.clone()},r.videoPlayer);h.isNew=!0,r.control.addCamera(h),r.control.editingCamera=h}return r.edit.exit(),setTimeout((function(){r.edit.watch(c,!0,!0)}),100),c},this.edit.watch=(n=new THREE.Vector3,function(e,t,i){r.checkMonitorExist(e,(function(e){r.control.isEdit=!!t,t&&(r.app.core.get("Player").locked=!0,r.app.core.get("Player").cameraControls.activeControl.enabled=!0,Ae.updateVisible(e.cylinder,"enterEdit",!0,1,"add")),i?(n.set(-1.5,0,.2).applyQuaternion(e.quaternion).add(e.position),r.control.watch(e,n)):r.control.watch(e)}))}),this.edit.save=function(){return r.control.currentCamera.isNew=!1,r.control.currentCamera.updateInfo(!0)},this.edit.cancel=function(){var e=r.app.core.get("Player");r.control.editingCamera&&Ae.updateVisible(r.control.editingCamera.cylinder,"enterEdit",!1,1,"cancel"),r.control.editingCamera||r.edit.cancelWatching(),r.control.isEdit=!1,r.control.editingCamera=null,r.control.selectType=null,e.locked=!1,r.control.watchingCamera&&r.control.watch(r.control.watchingCamera)},this.edit.cancelWatching=function(){var e=r.app.core.get("Player");if(r.control.watchingCamera){r.control.stopWatch();var t=r.control.lastViewState,n=t.mode,i=t.floorIndex,o=t.target,a=t.quaternion,s=t.position,l=t.currentScale;if(n==ht.DOLLHOUSE&&e.mode==ht.DOLLHOUSE){(e.model.allFloorsVisible?"all":e.model.currentFloorId)!=i&&e.$app.Scene.gotoFloor(i);var c=e.cameraControls.activeControl;pe.start(It.vector(c.target,o),1e3,null,0,de[Je.flydown.rotationEasing],null,Je.freeze.LookRotationForPlay),pe.start(It.vector(c.camera.position,s),1e3,(function(){}),0,de[Je.flydown.movementEasing],null,Je.freeze.LookRotationForPlay)}else n==ht.PANORAMA?e.flyToNewMode({mode:ht.PANORAMA,pano:e.currentPano,quaternion:a,callback:function(){}}):e.flyToNewMode({mode:n,quaternion:a,target:o,position:s,currentScale:l,floor:i,callback:function(){}})}},this.edit.delete=function(e){r.checkMonitorExist(e,(function(e){e.isWatching&&r.edit.cancelWatching(),r.control.removeCamera(e)}))},this.edit.hideCylinder=function(e){r.control.hideCylinder=e,r.control.cameras.forEach((function(t){Ae.updateVisible(t.cylinder,"force",!e)}))},this.edit.setName=function(e){r.control.currentCamera.name=e,r.control.currentCamera.titleLabel.setText(e)},this.edit.setPosition=function(e){if(r.control.currentCamera.updatePosition(e),!r.control.unbindDollhouse){var t=r.app.core.get("Player").cameraControls.controls.dollhouse;t.camera.position.copy(r.control.currentCamera.position),t.target.copy(r.control.currentCamera.target)}},this.edit.setSeparatePosition=(i=new THREE.Vector3,function(e,t){isNaN(parseFloat(t))||(r.control.currentCamera.posOffset[e]=parseFloat(t),i.copy(r.control.currentCamera.posOri).add(r.control.currentCamera.posOffset),r.edit.setPosition(i))}),this.edit.setFov=function(e){r.control.currentCamera.isWatching&&!r.control.unbindDollhouse&&(r.app.core.get("Player").cameraControls.cameras.dollhouse.fov=e),r.control.currentCamera.fov=e,r.control.currentCamera.updateProjectionMatrix(),r.control.currentCamera.updateMesh()},this.edit.setAspect=function(e){r.control.currentCamera.updateAspect(e)},this.edit.setOpacity=function(e){r.control.currentCamera.videoMat.opacity=e/100},this.edit.setRoll=function(e){r.control.currentCamera.setRoll(e)},this.edit.setYaw=function(e){(r.control.currentCamera.yaw=e,r.control.watchingCamera&&!r.control.unbindDollhouse)&&r.app.core.get("Player").cameraControls.controls.dollhouse.target.copy(r.control.currentCamera.target)},this.edit.setPitch=function(e){(r.control.currentCamera.pitch=e,r.control.watchingCamera&&!r.control.unbindDollhouse)&&r.app.core.get("Player").cameraControls.controls.dollhouse.target.copy(r.control.currentCamera.target)},this.edit.setVideoSrc=function(e,t){var n=r.control.currentCamera;n.videoActive=!1,n.showVideo(!1);var i=setTimeout((function(){t||(console.error("reload"),r.edit.setVideoSrc(e,!0))}),1e3),o=n.createVideo(e);if(o.onloadedmetadata=function(){clearTimeout(i),r.app.Camera.emit("SecurityCamera.videoActive",n.sid),n.videoActive=!0,n.showVideo(!0)},n.hlsVideoPlayer&&n.hlsVideoPlayer.destroy(),Hls.isSupported()){var a=new Hls;a.loadSource(e),a.attachMedia(o),a.on(Hls.Events.ERROR,(function(e,t){return console.log("HLS加载失败",e,t)})),n.hlsVideoPlayer=a}else o.src=e;n.play(),n.videoMat.map=new THREE.VideoTexture(n.video)},this.edit.setCylinderFar=function(e){r.control.currentCamera.cylinderFar=e,r.control.currentCamera.cylinder.bottom.position.set(0,0,-e),r.control.currentCamera.updateMesh()},this.edit.undoTransform=function(){r.edit.setRoll(0),r.edit.setPitch(0),r.edit.setYaw(0),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())},this.edit.undoScope=function(){r.edit.setCylinderFar(3),r.edit.setFov(70),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())},this.edit.undoEdit=function(){var e=r.control.currentCamera;if(e.isNew)r.control.removeCamera(e);else{var t=e.info;t.far!=e.cylinderFar&&r.edit.setCylinderFar(t.far),e.posOri.x=t.posOri.x,e.posOri.y=t.posOri.y,e.posOri.z=t.posOri.z,r.edit.setSeparatePosition("x",t.posOffset.x),r.edit.setSeparatePosition("y",t.posOffset.y),r.edit.setSeparatePosition("z",t.posOffset.z),t.fov!=e.fov&&r.edit.setFov(t.fov),t.roll!=e.roll&&r.edit.setRoll(t.roll),t.pitch!=e.pitch&&r.edit.setPitch(t.pitch),t.yaw!=e.yaw&&r.edit.setYaw(t.yaw),t.video!=e.videoSrc&&r.edit.setVideoSrc(t.video),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())}}}return u(e,[{key:"showAll",value:function(e,t,n){var i=this;this.waitSecurityControls((function(){i.control.showAll(null,e,t,n)}),this.showAll.bind(this))}},{key:"hideAll",value:function(e,t,n){var i=this;this.waitSecurityControls((function(){i.control.hideAll(null,e,t,n)}),this.hideAll.bind(this))}},{key:"showRange",value:function(e){this.edit.hideCylinder(!e)}},{key:"changeTitlesShow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onShow";this.control.showTitles=!!e,this.control.cameras.forEach((function(n){Ae.updateVisible(n.titleLabel,t,!!e)}))}},{key:"waitSecurityControls",value:function(e,t){this.control?e&&e():this.deferred.then((function(){return t()}))}},{key:"checkMonitorExist",value:function(e,t){var n=this.control.cameras.find((function(t){return t.sid==e}));n?t(n):console.error("监控sid不存在!")}},{key:"watch",value:function(e){var t=this.app.store.getValue("cameras");null!=t&&t.length&&(null!=t.find((function(t){return t.sid==e}))&&this.edit.watch(e))}},{key:"lock",value:function(){this.locked=vt()}},{key:"unlock",value:function(){this.locked&&this.locked.resolve&&this.locked.resolve(),this.locked=null}},{key:"highlight",value:function(e){var t=this.control.cameras.find((function(t){return t.sid==e}));this.control.cameras.forEach((function(e){return e.highlight(!1)})),t&&t.highlight(!0)}}]),e}(),NB=function(e){f(n,e);var t=_B(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(as),zB=function(e){f(n,e);var t=_B(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(us);function GB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var jB=function(e){f(n,e);var t=GB(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.state={scale:1.78,range:{min:.7,max:3,current:0},defaults:{zoomMax:0,zoomMin:0,zoomEnabled:0,zoomToDefaultWhenToPano:0},options:{padding:{},beforeExport:null,afterExport:null}},i.player=null,i.__is_enter=!1,i.__on_zoom=function(e){return i.emit("zoom",e)},i.__on_size=function(){var e=i.player.domElement,t=i.state.options.padding.top||0,n=i.state.options.padding.bottom||0,o=(i.state.options.padding.left||0)+(i.state.options.padding.right||0),r=t+n,a=window.innerWidth-o,s=window.innerHeight-r;if(a/s<i.state.scale){var l=a/i.state.scale;e.style.height="".concat(l,"px"),e.style.top=(s-l)/2+r+"px"}else e.style.top="".concat(r,"px"),e.style.height="calc(100% - ".concat(r,"px)")},i.__on_update=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hasChanged,n=void 0!==t&&t,o=arguments.length>1?arguments[1]:void 0;if(i.__is_enter&&(i.player.lastFrameChanged||o)){var r=i.player.cameraControls.activeControl;if("dollhouse"==i.player.mode){var a=r.camera.position.distanceTo(r.target),s=he.linearClamp(a,r.minDistance,Math.max(r.maxDistance/2,r.minDistance+3),i.state.range.max,i.state.range.min);i.emit("zoom",s)}else if("floorplan"==i.player.mode&&n.cameraProjectionChanged){var l=r.getDefaultAbsoluteScale(i.player.model.size),c=Math.max(Je.zoomNearLimit,.5*l),u=Math.min(Je.zoomFarLimit,2.5*l),h=he.linearClamp(r.absoluteScale,c,u,i.state.range.max,i.state.range.min);i.emit("zoom",h)}}},i}return u(n,[{key:"options",value:function(e){return this.state.options=Object.assign(this.state.options,e||{}),this}},{key:"enter",value:function(){if(!this.__is_enter)return null===this.player&&(this.player=this.app.core.get("Player")),this.__is_enter=!0,this.__on_size(),this.state.defaults.zoomMax=Je.zoom.max,this.state.defaults.zoomMin=Je.zoom.min,this.state.defaults.zoomEnabled=Je.zoom.enabled,this.state.defaults.zoomToDefaultWhenToPano=Je.zoom.zoomToDefaultWhenToPano,Je.zoom.max=this.state.range.max,Je.zoom.min=this.state.range.min,Je.zoom.enabled=!0,Je.zoom.zoomToDefaultWhenToPano=!1,Je.highestQualityTile=!0,this.player.on("zoomTo",this.__on_zoom),this.player.on("setSize",this.__on_size),this.player.on("update",this.__on_update),this.__on_zoom(this.player.zoomLevel),this.__on_update(0,!0),this}},{key:"leave",value:function(){if(!1!==this.__is_enter)return this.__is_enter=!1,this.player.zoomTo(1),Je.zoom.max=this.state.defaults.zoomMax,Je.zoom.min=this.state.defaults.zoomMin,Je.zoom.enabled=this.state.defaults.zoomEnabled,Je.zoom.zoomToDefaultWhenToPano=this.state.defaults.zoomToDefaultWhenToPano,Je.highestQualityTile=!1,this.player.off("zoomTo",this.__on_zoom),this.player.off("setSize",this.__on_size),this.player.off("update",this.__on_update),this.player.domElement.style.top=0,this.player.domElement.style.height="100%",this}},{key:"reset",value:function(e){var t=this;if(!this.__is_enter)return this;if("camera"===e)"panorama"==this.player.mode&&(this.player.cameraControls.activeControl.lat=0);else if("scale"==e){var n=this.player.cameraControls.activeControl;if("transitioning"==this.player.mode)return player.once("mode.changed",(function(n,i){t.__is_enter&&t.reset(e)}));"panorama"==this.player.mode?this.player.zoomTo(1):"dollhouse"==this.player.mode?n.target.copy(this.player.model.center):"floorplan"==this.player.mode&&(n.target.setX(this.player.model.center.x),n.target.setZ(this.player.model.center.z),n.camera.position.setX(this.player.model.center.x),n.camera.position.setZ(this.player.model.center.z),n.rotateToView(this.player.model.size,this.player.getDirection()),n.zoomToContain(this.player.model.size))}return this}},{key:"scale",value:function(e){if(!this.__is_enter)return this;(e=e>1?parseInt(e)/100:e)<this.state.range.min?e=this.state.range.min:e>this.state.range.max&&(e=this.state.range.max),this.state.range.current=e;var t=this.player.cameraControls.activeControl,n=e;if("panorama"==this.player.mode)Je.zoom.enabled=!0,this.player.zoomTo(n);else if("dollhouse"==this.player.mode){var i=he.linearClamp(n,this.state.range.min,this.state.range.max,Math.max(t.maxDistance/2,t.minDistance+3),t.minDistance);t.camera.position.copy(t.target).add(this.player.getDirection().multiplyScalar(-i))}else if("floorplan"==this.player.mode){var o=t.getDefaultAbsoluteScale(this.player.model.size),r=Math.max(Je.zoomNearLimit,.5*o),a=Math.min(Je.zoomFarLimit,2.5*o);t.absoluteScale=he.linearClamp(n,this.state.range.min,this.state.range.max,a,r)}return this}},{key:"ready",value:function(){var e=this,t=vt();if(0==this.__is_enter)t.reject("please call enter before");else if("panorama"==this.player.mode)var n=setInterval((function(){if(e.player.currentPano&&!e.player.flying){clearInterval(n),"function"==typeof e.state.options.beforeExport&&e.state.options.beforeExport();var i=e.getTileSize(),o=new THREE.Vector3(0,0,-1).applyQuaternion(e.player.quaternion),r=e.player.cameraControls.activeControl.camera,a=r.fov,s=na.getHFOVForCamera(r,r.aspect,1);e.player.currentPano.loadTiledPano(i,o,{hFov:s,vFov:a},!1,!1,!0).done((function(){return t.resolve()})).fail((function(){return t.resolve()}))}}),200);else t.resolve();return t}},{key:"export",value:function(e){var t=this;return"function"!=typeof e||this.ready().done(k(S.mark((function n(){var i,o,r,a;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=t.getViewSize(),o=i.width,r=i.height,n.next=3,t.app.Camera.screenshot([{width:o,height:r,name:"capture"}]);case 3:(a=n.sent).length?e(a[0]):e(null),"function"==typeof t.state.options.afterExport&&t.state.options.afterExport();case 6:case"end":return n.stop()}}),n)})))).fail((function(){e(null),"function"==typeof t.state.options.afterExport&&t.state.options.afterExport()})),this}},{key:"exportFile",value:function(e){return this.export((function(t){var n=window.URL.createObjectURL(t.data),i=document.createElement("a");i.href=n,i.download=e,i.click()})),this}},{key:"getMaxHeight",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?4096:"4k"==this.app.core.get("QualityManager").tileClass?8192:1024}},{key:"getTileSize",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?2048:"4k"==this.app.core.get("QualityManager").tileClass?4096:512}},{key:"getViewSize",value:function(){if("panorama"!=this.player.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=this.player.cameraControls.activeControl.camera.fov/180*e,n=t*this.state.scale;return{width:Math.round(n),height:Math.round(t)}}}]),n}(vo);function WB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var qB=function(e){f(n,e);var t=WB(n);function n(e){var i;return o(this,n),(i=t.call(this)).adjustControlAngel=function(e,t){var n=this.app.core.get("Player");if("panorama"==n.mode){var i=new THREE.Vector3(0,0,-1).applyQuaternion(t||n.quaternion).add(n.position);this.cameraControls.activeControl.lookAt(i)}else{if(!e)return;this.cameraControls.activeControl&&n.cameraControls.activeControl.target.copy(e)}},i.app=e,i.app.Scene.on("loaded",(function(){var e=i.app.core.get("Player");e.on(zr,(function(e){i.emit(zr,e)})),e.on(Wr,(function(e){i.emit(Wr,e)})),e.on(qr,(function(e){i.emit(qr,e)})),e.on(Qr,(function(e){i.emit(Qr,e)})),e.on(Vr,(function(e){i.emit(Vr,e)})),e.on(Or,(function(e){i.emit(Or,e)})),e.on(_r,(function(e){i.emit(_r,e)})),e.on(Nr,(function(e,t){return i.emit(Nr,{fromMode:e,toMode:t})}));var t=i.app.core.get("Player").model;t.on("floor.changed",(function(e,n,o){i.emit("floor.changed",{toMode:n,floorIndex:e.floorIndex,allVisible:t.allFloorsVisible})}))})),i.monitor=new UB(e),i.extract=new jB(e),i}return u(n,[{key:"mode",get:function(){return this.app.core.get("Player").mode}},{key:"locked",get:function(){return this.app.core.get("Player").locked}},{key:"isCurrentPanoHasVideo",get:function(){return this.app.core.get("Player").currentPano.hasVideo}},{key:"panorama",value:function(){return this.app.Scene.ready?this.app.core.get("Player").insideMode():Promise.resolve()}},{key:"floorplan",value:function(){var e=vt();return this.app.core.get("Player").flyToNewMode({mode:ht.FLOORPLAN},e),e}},{key:"dollhouse",value:function(){var e=vt();return this.app.core.get("Player").flyToNewMode({mode:ht.DOLLHOUSE},e)}},{key:"vr",value:function(){var e=this.app.core.get("Player");return e.vrEnabled=!e.vrEnabled,e.flyToMode("panorama",(function(){return e.vrModeChange()}))}},{key:"zoom",value:function(e){this.app.core.get("Player").zoomTo(e)}},{key:"rotate",value:function(e){var t=this,n=this.app.core.get("Player");if(function(e,t){return e.mode==t.mode&&e.mode==ht.PANORAMA&&e.currentPanoId==t.currentPano.id}(e,n)){n.cameraControls.activeControl.locked=!0,n.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var i=new THREE.Vector3(0,0,-1).applyQuaternion(n.cameraControls.activeControl.camera.quaternion).add(n.cameraControls.activeControl.camera.position);n.cameraControls.activeControl.lookAt(i),e.rotationSpeed&&setTimeout((function(){t.rotateEnd(e)}),100)}}},{key:"rotateEnd",value:function(e){var t=this.app.core.get("Player");t.cameraControls.activeControl.locked=!1,e.rotationSpeed&&(t.cameraControls.activeControl.rotationSpeed=new THREE.Vector2(e.rotationSpeed.x,e.rotationSpeed.y))}},{key:"getPose",value:function(){var e=this.app.core.get("Player");return JSON.parse(JSON.stringify({mode:e.mode,position:e.position,quaternion:e.quaternion,zoomLevel:e.zoomLevel,panoId:e.currentPano&&e.currentPano.id,currentScale:e.cameraControls.controls.floorplan.currentScale,modeTran:e.modeTran,flying:e.flying,nextPano:null}))}},{key:"getPoseUrlParams",value:function(){return function(e){return"pose=pano:".concat(e.metadata.scan_id,",qua:").concat(he.toPrecision(e.metadata.camera_quaternion.toArray(),4))}(this.app.core.get("Player").getSnapAngleInfo())}},{key:"setPose",value:function(e){var t=this.app.core.get("Player");if(!t.flying&&!e.flying){e.position&&e.position instanceof THREE.Vector3==!1&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.quaternion&&e.quaternion instanceof THREE.Quaternion==!1&&(e.quaternion.hasOwnProperty("_x")?e.quaternion=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):e.quaternion=new THREE.Quaternion(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w));var n=t.model.panos.index[e.panoId],i={mode:e.mode,pano:n,quaternion:e.quaternion,zoomLevel:e.zoomLevel,position:e.position,currentScale:e.currentScale,duration:e.duration,aimDuration:e.duration};if(t.mode!=e.mode)t.flyToNewMode(i);else if("panorama"==e.mode)n&&t.flyToPano(i);else{var o=t.cameraControls.controls[e.mode],r=o.camera;e.target&&o.target.copy(e.target),e.position&&r.position.copy(e.position),o.offset.copy(r.position).sub(o.target),"floorplan"==e.mode&&(e.zoom&&(e.currentScale=$e.convertWorkshopOrthoZoom(e.zoom)),e.currentScale&&(o.currentScale=o.absoluteScale=e.currentScale,o.updateZoom()))}}}},{key:"flyToMode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mode=t,this.mode==t?e&&e():("panorama"!=t||n.pano||(n.pano=this.currentPano),"transitioning"==this.mode&&this.modeTran.split("-")[1]!=t?this.afterCModeFuc.unique=function(){this.afterCModeFuc.unique=e,this.flyToNewMode(n)}.bind(this):(this.afterCModeFuc.unique=e,this.flyToNewMode(n)))}},{key:"flyToPano",value:function(e,t,n){var i=this.app.core.get("Player").model.panos.index[e];i&&this.app.core.get("Player").flyToPano({mode:"panorama",pano:i,lookAtPoint:t,duration:n,aimDuration:n})}},{key:"flyToTag",value:function(e,t){objects.tagManager.activeTag&&objects.tagManager.activeTag!=e&&this.tagManager.dismissActiveTag(),objects.tagManager.navigatingViaTag=!0,objects.tagManager.activateTag(e,"examine"),e.updateBoardOrient=!0,e.examine(this,t,function(){this.following&&(this.play.control.noFly=!0)}.bind(this))}},{key:"flyToPoint",value:function(e,t){var n;t.dealDistance&&this.app.core.get("Player").position.distanceTo(e)<t.dealDistance&&(n=this.app.core.get("Player").currentPano),n||(n=this.app.core.get("Player").model.panos.closestPanoTowardPoint({point:e,require:t&&t.require,rank:t&&t.rank})||this.currentPano||this.app.core.get("Player").currentPano),this.app.core.get("Player").flyToPano({pano:n,lookAtPoint:e,duration:t&&t.dur,aimDuration:t&&t.aimDur},t&&t.done)}},{key:"setCompassDisplay",value:function(e,t){this.app.core.get("Player").compass.setDisplay(e,t)}},{key:"getScreenshotInfo",value:function(){var e=function(e){return{camera:{quaternion:he.toPrecision(e.metadata.camera_quaternion.toArray(),4),zoom:e.metadata.ortho_zoom||-1},mode:e.metadata.camera_mode||0,pano:e.metadata.scan_id||"",lon:e.metadata.lon,lat:e.metadata.lat}}(this.app.core.get("Player").getSnapAngleInfo());return this.app.core.get("Scene").firstView.updateByEntry(e,this.app.core.get("Player").model.panos),e}},{key:"lock",value:function(){this.app.core.get("Player").locked=!0}},{key:"unlock",value:function(){this.app.core.get("Player").locked=!1}},{key:"autoRotate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1,n=this.app.core.get("Player").cameraControls.activeControl,i=this.app.core.get("Player").mode;e?("dollhouse"==i&&(n.autoRotateSpeed=10*t,n.autoRotate=!0),"panorama"==i&&n.startRotating(t,0)):("dollhouse"==i&&(n.autoRotate=!1),"panorama"==i&&n.stopRotating(!0))}},{key:"screenshot",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.length||(t=[{width:2048,height:1024,name:"2k"},{width:1024,height:512,name:"1k"},{width:128,height:128,name:"128"}]),new Promise((function(o){var r=t.length,a=[],s=e.app.core.get("Player"),l=setInterval((function(){s.path&&s.path.currentPanoMarker&&(clearInterval(l),e.app.core.get("Screenshot").capture(Object.assign({tasks:{unFish:t},snapshotTopview:!0,notHideTags:!0,done:function(e,t,i){n?a.push({data:CB(e),name:t,type:"blob"}):a.push({data:e,name:t,type:"base64"}),a.length==r&&(a.name=t,a.o=i,o(a))}},i)))}),50)}))}},{key:"screenshot2",value:function(){var e=this.app.core.get("SceneRenderer"),t=document.createElement("a"),n=e.renderer.domElement;e.render(),t.href=n.toDataURL().replace("image/png","image/octet-stream"),t.download="screenshot2.png",t.click()}},{key:"setFastTransition",value:function(e){this.app.core.get("Player").setPanoTaskEnable(e)}},{key:"checkXRSupport",value:function(){return au.isSupportXR()}}]),n}(vo);function JB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}qB.MODE=ht;var YB=function(e){f(n,e);var t=JB(n);function n(e){var i,r;return o(this,n),(i=t.call(this)).app=e.app,i.edit={},i.deferred=vt(),e.on("loaded",(function(){(r=i.app.core.get("Player")).GLTFEditor=new vl(r);var e=function(e){e.boxModels&&e.boxModels.forEach((function(e){r.GLTFEditor.add(e)}))},t=i.app.store.getValue("metadata");t?e(t):i.app.store.on("metadata",e),i.deferred.resolve()})),i.edit.enterModule=function(){i.waitGLTFEditor((function(){r.GLTFEditor.editing=!0}),i.edit.enterModule.bind(h(i)))},i.edit.leaveModule=function(){r.GLTFEditor.editing=!1},i.edit.addGLTF=function(){r.GLTFEditor.add(),r.mode===ht.FLOORPLAN&&r.model.floorplanCadImg.hideCadPlane()},i.edit.deleteGLTF=function(e){var t=r.GLTFEditor.group.children.find((function(t){return t.sid===e}));r.GLTFEditor.delete(t)},i.edit.focusGLTF=function(e,t){var n=r.GLTFEditor.group.children.find((function(t){return t.sid===e}));t&&(r.GLTFEditor.select(n),r.mode===ht.FLOORPLAN&&r.model.floorplanCadImg.hideCadPlane()),r.flyToPano({pano:r.model.panos.get(n.panoId),lookAtPoint:n.position,checkAlone:!0})},i.edit.confirmGLTFEdit=function(){return r.GLTFEditor.save((function(){r.mode===ht.FLOORPLAN&&r.model.floorplanCadImg.showCadPlane()}))},i.edit.cancelGLTFEdit=function(){r.GLTFEditor.unselect(),r.GLTFEditor.group.children.forEach((function(e){e.isNew?r.GLTFEditor.delete(e):e.setFromInfo(e.info)})),r.mode===ht.FLOORPLAN&&r.model.floorplanCadImg.showCadPlane()},i.edit.resetGLTFTranform=function(){r.GLTFEditor.selecting.rotation.set(0,0,0),r.GLTFEditor.selecting.axisAngle={x:0,y:0,z:0},r.GLTFEditor.selecting.scale.set(1,1,1),i.emit("Decoration.GLTF.select",r.GLTFEditor.selecting.updateInfo())},i.edit.setGLTFUrl=function(e){r.GLTFEditor.selecting.zipName=e.zipName,r.GLTFEditor.selecting.load(e.url)},i.edit.setGLTFPosition=function(e,t){r.GLTFEditor.selecting.position[e]=t},i.edit.setGLTFScale=function(e,t){r.GLTFEditor.selecting.scale[e]=t},i.edit.setGLTFRotation=function(e,t){r.GLTFEditor.selecting.setAxisAngle(e,THREE.MathUtils.degToRad(t))},i.edit.setGLTFVisible=function(e){r.GLTFEditor.selecting.visible=!!e,e?r.model.transformControls.attach(r.GLTFEditor.selecting):r.model.transformControls.detach()},i.edit.switchTransformControlsMode=function(e){0==parseInt(e)&&(e="translate"),1==parseInt(e)&&(e="rotate"),2==parseInt(e)&&(e="scale"),r.model.transformControls.mode=e},i}return u(n,[{key:"showAll",value:function(){var e=this;this.waitGLTFEditor((function(){e.app.core.get("Player").GLTFEditor.group.visible=!0}),this.showAll.bind(this))}},{key:"hideAll",value:function(){var e=this;this.waitGLTFEditor((function(){e.app.core.get("Player").GLTFEditor.group.visible=!1}),this.hideAll.bind(this))}},{key:"waitGLTFEditor",value:function(e,t){var n=this.app.core.get("Player");n&&n.GLTFEditor?e&&e():this.deferred.then((function(){return t()}))}}]),n}(vo);function ZB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var XB,KB,$B,ek,tk,nk,ik,ok=new THREE.Box3,rk=new THREE.Raycaster,ak=new THREE.Plane,sk=0,lk=[],ck={cabinet:{widthNormal:{min:.6,max:.7},height:{min:.7,max:2.5,standard:2},findRestRatio:1},fire:{widthNormal:{min:.12,max:.15},height:{min:.4,max:.55},widthSame:!0,findRestRatio:3,tinyXZ:!0},air:{widthNormal:{min:.35,max:.7},width:{min:.6,max:.75},thick:{min:.3,max:.4},height:{min:1.2,max:2,standard:1.8},atWall:.8,findRestRatio:2},airSmart:{widthNormal:{min:.35,max:.7},width:{min:.6,max:.75},thick:{min:.3,max:.4},height:{min:1.2,max:2,standard:1.8},atWall:.8,findRestRatio:2},"air-hanging":{widthNormal:{min:.3,max:1},width:{min:.8,max:1.1},thick:{min:.2,max:.3},height:{min:.3,max:.5,standard:.4},bottom:{min:.8,max:2},atWall:1,findRestRatio:1.5},battery:{widthNormal:{min:.4,max:1.2},width:{min:.7,max:1.4},thick:{min:.35,max:.5},height:{min:.3,max:2.5},atWall:.9,findRestRatio:1},groundBar:{widthNormal:{min:.06,max:.4},width:{min:.3,max:.5},thick:{min:.05,max:.08},height:{min:.15,max:.25},bottom:{min:1.2,max:3},atWall:1,findRestRatio:2},hlkcWindow:{widthNormal:{min:.08,max:.5},width:{min:.4,max:.6},thick:{min:.05,max:.1},height:{min:.4,max:.6},bottom:{min:1.2,max:3},atWall:1,findRestRatio:2},electric:{widthNormal:{min:.2,max:.7},width:{min:.4,max:.7},thick:{min:.2,max:.3},height:{min:.5,max:1},bottom:{min:.8,max:1.8},atWall:1,findRestRatio:2},monitor:{widthNormal:{min:.08,max:.11},height:{min:.1,max:.2,standard:.15},bottom:{min:1.2,max:3},atWall:1,findRestRatio:3,tiny:!0},rowBigBox:{widthNormal:{min:.5,max:1/0},height:{min:.7,max:2.4,standard:2}}},uk={fire:"extinguisher",monitor:"surveillance_camera",hlkcWindow:"hlkc",groundBar:"grounding_bar",cabinet:"equipment_cabinet",battery:"accumulator",electric:["ac_switchboard","dc_distribution"],air:"sdkt",airSmart:"ventilation_installation"},hk=function(e,t,n,i){var o=ui.createLine([e,e.clone().add(t.clone().multiplyScalar(n||1))],{color:i});return $B.add(o),o},dk=function(e){var t=xk(e);return ck[e.boxType].bottom?t:t.clone().setY(ek+e.size.y/2)},pk=[new THREE.Vector3(-1,1,-1),new THREE.Vector3(1,1,-1),new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1),new THREE.Vector3(1,-1,1),new THREE.Vector3(-1,-1,1)],fk=function(){function e(t){o(this,e),this.setFromInfo(t),this.name=this.boxType+"-"+this.name,nk&&this.draw(),lk.push(this)}return u(e,[{key:"setFromInfo",value:function(e){for(var t in e)this[t]=e[t];this.position=dk(this);var n=(new THREE.Box3).setFromCenterAndSize(this.position,this.size);this.bound=n}},{key:"draw",value:function(){sk=Math.random();var e=(new THREE.Color).setHSL(sk,.9,.85);this.boxHelper=new THREE.Box3Helper(this.bound,e),this.boxHelper.material.depthTest=!1,this.boxHelper.material.transparent=!0,this.boxHelper.renderOrder=30,this.label=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.bgcolor,o=n.a;new THREE.Vector3(0,-.2,0),i=i?new THREE.Color(i):{r:1,g:1,b:1},t instanceof Array||(t=[t]);for(var r=Math.round(6*Math.random())+1,a=[];r-- >0;)a.push("|");t=[].concat(H(t),a,["o"]);var s=new Ki({text:t,textColor:{r:0,g:0,b:0,a:1},backgroundColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||0},textBorderColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||.7},textBorderThick:3,margin:{x:0,y:0},borderRadius:0,player:XB,sizeInfo:{minSize:30,maxSize:300,nearBound:.7,farBound:12}});return s.position.copy(e),$B.add(s),s.sprite.position.y+=.4*s.sprite.scale.y,s}(this.position,this.score?[this.name,this.score.toFixed(1)]:this.name,{bgcolor:e}),$B.add(this.boxHelper)}},{key:"dispose",value:function(){var e=lk.indexOf(this);e>-1&&(lk.splice(e,1),this.label.sprite.material.opacity=.2,this.boxHelper.material.opacity=.1)}},{key:"traversePair",value:function(e){e(this),this.list&&this.list.forEach((function(t){return e(t)})),this.mixedFrom&&this.mixedFrom.forEach((function(t){return e(t)}))}},{key:"toJson",value:function(){var e=this;return{points:pk.map((function(t){return(new THREE.Vector3).addVectors(e.position,e.size.clone().multiply(t).multiplyScalar(.5)).toArray()})),category:this.boxType,sid:this.name}}}]),e}(),mk=function(e,t){var n=-e.x*(2*Math.PI),i=Math.PI/2-e.y*Math.PI,o=new THREE.Vector3;return o.copy($i.RIGHT).applyAxisAngle($i.BACK,i).applyAxisAngle($i.UP,n).applyQuaternion(t.quaternion),o},vk=function(e){if(!e.centerDir){var t=e.bbox2,n={x:Ek(t[0],t[2]),y:(t[1]+t[3])/2};e.bbox2CenterX=n.x;var i=mk(n,e.pano);e.centerDir=i;var o={x:n.x,y:t[1]};e.centerTopDir=mk(o,e.pano);var r={x:n.x,y:t[3]};e.centerBtmDir=mk(r,e.pano);var a={x:t[0],y:t[3]};e.leftBtmDir=mk(a,e.pano);var s={x:t[2],y:t[3]};e.rightBtmDir=mk(s,e.pano)}},gk=function(e){e.bbox2||(e.bbox2=e.bbox.map((function(e,t){return t%2==0?e/4096:e/2048})))},Ak=function(e){Tk(e),gk(e),vk(e),function(e){if(e.boxType){var t=ck[e.boxType];if(nk){if(!e.posAtWall&&t.atWall>0){var n=t.thick?t.thick.min:t.widthNormal.min;rk.set(e.pano.position,e.centerDir);var i=rk.intersectObjects([KB]);e.posAtWall=(new THREE.Vector3).addVectors(e.pano.position,e.centerDir.clone().multiplyScalar(i[0].distance-n))}e.btmPos||bk(e),e.topPos||wk(e)}else if(!t.bottom&&(rk.set(e.pano.position,e.centerBtmDir),e.btmPosPredict=rk.ray.intersectPlane(ak,new THREE.Vector3),e.btmPosPredict)){var o=new THREE.Vector2(e.centerBtmDir.x,e.centerBtmDir.z).normalize(),r=ck[e.boxType].widthNormal,a=r.min,s=r.max;a*=.4,s*=.4;var l=he.linearClamp(Math.abs(o.y),0,1,a,s);o=o.clone().multiplyScalar(l),e.btmPosPredict.x+=o.x,e.btmPosPredict.z+=o.y}}}(e)},yk=function(e,t){return Math.abs(e-t)<.5||(e>t?e-=1:t-=1),e-t},Ek=function(e,t){return Math.abs(e-t)>.5?(e+t+1)/2:(e+t)/2},wk=function(e){if(e.box1){var t=Ck(e.box0.pano.position,e.box0.centerTopDir,e.box1.pano.position,e.box1.centerTopDir);e.topPos=t.pos3d,e.diffHeight=t.mid2?t.mid2.distanceTo(t.mid1):1,e.box0.topPos&&e.box1.topPos&&(e.topPos.y=(e.box0.topPos.y+e.box1.topPos.y)/2)}else{var n=e.box0||e,i=n.btmPos;i||(i=bk(e)),n.topPos=i.clone();var o,r=i.x-n.pano.position.x,a=i.z-n.pano.position.z;o=Math.abs(r)<Math.abs(a)?a*n.centerTopDir.y/n.centerTopDir.z:r*n.centerTopDir.y/n.centerTopDir.x,n.topPos.y=o+n.pano.position.y;var s=ck[Tk(n)].height.min,l=Math.max(n.topPos.y-i.y,s);n.topPos.y=i.y+l,e.topPos=n.topPos}return e.topPos},bk=function(e){if(e.box1){var t=Ck(e.box0.pano.position,e.box0.centerBtmDir,e.box1.pano.position,e.box1.centerBtmDir);e.btmPos=t.pos3d}else{var n=e.box0||e;if(!n.btmPos){if("pano14-3"==n.sid&&console.log(3),!nk)return n.btmPosPredict;rk.set(n.pano.position,n.centerBtmDir);var i,o=rk.intersectObjects([KB]);n.btmPosOri=o[0].point.clone(),n.btmPos=o[0].point.clone(),Tk(n);var r=new THREE.Vector2(n.centerBtmDir.x,n.centerBtmDir.z).normalize();if(ck[n.boxType].thick&&ck[n.boxType].atWall){var a=ck[n.boxType].widthNormal,s=a.min,l=a.max;s*=.4,l*=.4,n.xProp||Bk(n),i="width"==n.xProp?he.linearClamp(Math.abs(r.x),0,1,s,l):he.linearClamp(Math.abs(r.y),0,1,s,l)}else{var c=ck[n.boxType].thick||ck[n.boxType].widthNormal,u=(c.min+c.max)/2,h=.4*u,d=.8*u,p=Math.min(Math.abs(n.centerBtmDir.x),Math.abs(n.centerBtmDir.z));i=he.linearClamp(p,0,.707,h,d)}Math.abs(o[0].face.normal.y)<.9&&(ck[n.boxType].atWall||o[0].point.y-ek>.3)&&(i*=-1);var f=r.clone().multiplyScalar(i);n.btmPos.x+=f.x,n.btmPos.z+=f.y}e.btmPos=n.btmPos}return e.btmPos},Ck=function(e,t,n,i){var o=(new THREE.Vector3).addVectors(e,t),r=(new THREE.Vector3).addVectors(n,i),a=he.getLineIntersect2({A:e.clone(),B:n.clone(),p1:o,p2:r,dir0:t,dir1:i});return a.pos3d||console.error("getIntersect2 no result? ?"),a},xk=function(e){var t=Tk(e);return e.preDealRes&&e.preDealRes.position||e.center||t&&(ck[t].atWall>.5&&ck[t].bottom?e.posAtWall:e.btmPos||e.btmPosPredict)||e.posAtWall},Ik=function(e,t){return uk[t]instanceof Array?uk[t].includes(e.category):uk[t]==e.category},Tk=function(e){if(e.boxType)return e.boxType;var t=e.category||e.box0.category;if("rowBigBox"==t)e.boxType="rowBigBox";else{var n;for(var i in"ac_switchboard"==t&&console.log(1),uk)if(uk[i]instanceof Array?uk[i].includes(t):uk[i]==t){n=i;break}e.boxType=n}return e.boxType},Bk=function(e){var t,n;if(ck[e.boxType].atWall&&ck[e.boxType].thick){var i=xk(e),o=tk,r=Math.min(i.x-o.min.x,o.max.x-i.x),a=Math.min(i.z-o.min.z,o.max.z-i.z),s={"x+":0,"x-":0,"z+":0,"z-":0,got:!1},l=0==s["x+"]||0==s["x-"],c=0==s["z+"]||0==s["z-"];if(!s.got&&e.btmPos&&(XB.model.panos.list.forEach((function(t){var n=(new THREE.Vector3).subVectors(t.position,e.btmPos);n.x>0?s["x+"]+=n.x:s["x-"]+=n.x,n.z>0?s["z+"]+=n.z:s["z-"]+=n.z})),s.got=!0),he.closeTo(r,a,.2)||(r<a?(r<.7||l&&!c)&&(t="thick",n="width"):(a<.7||!l&&c)&&(t="width",n="thick")),!t&&e.box0){var u=0,h=0;e.category?(e.pose||(e.pose=Pk(e,e.btmPos)),u=e.pose.xWidthPossible,h=e.pose.yWidthPossible):e.boxposes.forEach((function(e){u+=e.xWidthPossible,h+=e.yWidthPossible})),u>h?(t="width",n="thick"):(t="thick",n="width")}t&&(e.xProp=t,e.yProp=n)}},kk=function(e){if(!e.preDealRes&&e.center){e.preDealRes={},e.boxType||Tk(e);var t,n=ck[e.boxType];if(n.widthNormal.min,tk.distanceToPoint(e.center)>.1&&!n.tiny&&!n.tinyXZ){var i=e.center.clone().clamp(tk.min,tk.max);e.preDealRes.position=i,Tk(e),t=!0}var o=xk(e);!t&&e.boxposes||(e.boxposes=[],[e.box0,e.box1].forEach((function(t){t&&e.boxposes.push(Pk(t,o))}))),Bk(e)}},Pk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=ck[e.boxType],o=yk(e.bbox2[2],e.bbox2[0])*Math.PI,r=(new THREE.Vector3).subVectors(e.pano.position,t).setY(0).length()+n,a=2*Math.tan(o)*r,s=e.centerDir.clone().setY(0).normalize(),l=he.getNormal({points:[{x:0,y:0},{x:s.x,y:s.z}]});l.x=Math.abs(l.x),l.y=Math.abs(l.y),"pano4-6"==e.sid&&console.log(7);var c,u,h=i.widthNormal.max,d=i.widthNormal.min;if(ck[e.boxType].thick){var p=i.thick.min,f=i.width.min,m=i.thick.max,v=i.width.max,g=l.x*v+l.y*m,A=l.x*m+l.y*v,y=l.x*f+l.y*p,E=l.x*p+l.y*f;c=Math.min(y,E),u=Math.max(g,A),l.x,l.y}else c=(l.x+l.y)*d,u=(l.x+l.y)*h;var w=a/l.x,b=a/l.y,C={box:e,projectWidth:a,camTangent:l,maxProjectWidth:u,minProjectWidth:c,dis:r,maxX:w,maxY:b};return i.atWall>0&&(C.xWidthPossible=-Math.abs(a-l.x*h-l.y*d),C.yWidthPossible=-Math.abs(a-l.x*d-l.y*h)),C},Rk=function(e,t){var n=0;if(e.forEach((function(e){if(e.lowR=e.dis<1.5?Math.pow(e.dis/1.5,1.4):1,e.projectWidth>e.maxProjectWidth?n+=500*Math.pow((e.projectWidth/e.maxProjectWidth-1)*e.lowR,2):e.projectWidth<e.minProjectWidth&&(n+=500*Math.pow((e.minProjectWidth/e.projectWidth-1)*e.lowR,2)),1==ck[t].atWall){var i=ck[t].widthNormal,o=i.min,r=i.max,a=Math.max(.01,(e.projectWidth-o)/(r-o));o<.3&&a<.5&&(n+=(r-o)/a/o*5)}})),n=Math.min(n,1300),2==e.length){var i=new THREE.Vector2(Math.abs(e[0].camTangent.x),Math.abs(e[0].camTangent.y)),o=new THREE.Vector2(Math.abs(e[1].camTangent.x),Math.abs(e[1].camTangent.y)),r=i.dot(o);if(r>.75){var a=Math.abs(e[0].projectWidth-e[1].projectWidth);e.score2=r*a*4e3*e[0].lowR*e[1].lowR,n+=e.score2}e.camTangentCos=r}return-(n=Math.min(n,1200))},Mk=function(e){if("groundBar"==e.boxType&&console.log(1),!e.size){var t,n,i="",o="";"pano2-0"==e.name&&console.log(6);var r,a,s,l=xk(e);if(e.predictSize)t=r=e.predictSize.x,n=a=e.predictSize.y;else if(e.box1){var c=e.boxposes[0].camTangent.x,u=e.boxposes[1].camTangent.x,h=e.boxposes[0].camTangent.y,d=e.boxposes[1].camTangent.y,p=e.boxposes[0].projectWidth,f=e.boxposes[1].projectWidth;((t=0==c?(f-d*(n=p))/u:(p-h*(n=(f-u/c*p)/(d-u/c*h)))/c)<.3||t>1.4)&&(i+=" x:"+he.toPrecision(t,2)),(n<.3||n>1.4)&&(i+=" y:"+he.toPrecision(n,2)),(n<0||t<0)&&(o=t<0?"x<0!":"y<0!"),r=t,a=n}else if(e.xProp){var m=ck[e.boxType].width,v=ck[e.boxType].thick;"width"==e.xProp?(t=r=THREE.MathUtils.clamp(e.boxposes[0].maxX,m.min,m.max),n=a=THREE.MathUtils.clamp(e.boxposes[0].maxY,v.min,v.max)):(t=r=THREE.MathUtils.clamp(e.boxposes[0].maxX,v.min,v.max),n=a=THREE.MathUtils.clamp(e.boxposes[0].maxY,m.min,m.max))}else{var g=ck[e.boxType].widthNormal;t=r=THREE.MathUtils.clamp(e.boxposes[0].maxX,g.min,g.max),n=a=THREE.MathUtils.clamp(e.boxposes[0].maxY,g.min,g.max)}if(ck[e.boxType].bottom)if(s=ck[e.boxType].height.standard,bk(e),s){var A=l.y-e.btmPos.y;l.y-=THREE.MathUtils.clamp((A-s/2)/2,-.1,.1)}else{var y=e.btmPos.y;s=2*(l.y-y)}else e.topPos||wk(e),s=e.topPos.y-ek;var E=Sk(t,s,n,e);t=E.x,s=E.y,n=E.z,ck[e.boxType].widthSame&&(t=n=(t+n)/2),e.size=new THREE.Vector3(t,s,n),e.sizeAdjust=Math.pow(Math.abs(t-r),1.3)+Math.pow(Math.abs(n-a),1.3),e.sizeAdjust&&(e.score=(e.score||0)-Math.min(100*e.sizeAdjust,400)),e.size.oriX=r,e.size.oriY=a,e.exStr=i,e.warnStr=o}},Sk=function(e,t,n,i){var o,r=i.xProp,a=i.yProp;if(null!=r){var s=ck[i.boxType][r],l=s.min,c=s.max;e=THREE.MathUtils.clamp(e,l,c);var u=ck[i.boxType][a];l=u.min,c=u.max;n=THREE.MathUtils.clamp(n,l,c),o=!0}if(!o){var h=ck[i.boxType].widthNormal;l=h.min,c=h.max;e=THREE.MathUtils.clamp(e,l,c),n=THREE.MathUtils.clamp(n,l,c)}var d=ck[i.boxType].height;l=d.min,c=d.max;return{x:e,y:t=THREE.MathUtils.clamp(t,l,c),z:n}},Dk=function(e,t){var n=new THREE.Box2;return n.min.set(Math.max(e.min.x,t.min.x),Math.max(e.min.y,t.min.y)),n.max.set(Math.min(e.max.x,t.max.x),Math.min(e.max.y,t.max.y)),n},Fk=function(e){var t=e.map((function(e){return e.bbox2[0]})),n=e.map((function(e){return e.bbox2[2]}));return t.sort((function(e,t){return yk(e,t)})),n.sort((function(e,t){return yk(t,e)})),{leftX:t[0],rightX:n[0]}},Lk=function e(t,n,i,o,r){var a=[];if(o){var s=r.indexOf(o);r.splice(s,1)}for(var l=0;l<i.length;l++){a=[t,i[l]];var c=void 0;o?(c=o.slice(0)).push(a):c=[a],r.push(c);var u=n.slice(0),h=i.slice(0),d=u.indexOf(a[0]);u.splice(d,1),d=h.indexOf(a[1]),h.splice(d,1),u.length>0&&h.length>0&&e(u[0],u,h,c,r)}},Hk=function(e){f(i,THREE.Group);var t,n=ZB(i);function i(e,t,r){var a;return o(this,i),a=n.call(this),(XB=e).model.add(h(a)),a.ifAnalyze=t,a.wireframes=new THREE.Object3D,a.wireframes.name="wireframes",a.add(a.wireframes),a.matchScoreMap={},a.bindEvents(),($B=new THREE.Object3D).name="testBox",a.add($B),a.compute(r),a}return u(i,[{key:"compute",value:(t=k(S.mark((function e(t){var n,i,o,r,a,s=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=function(){return(r=k(S.mark((function e(t){var n,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xn.post("/service/scene/sceneMarkShape/getInfo",{num:XB.$app.config.num,imagePath:t+".jpg"});case 2:if((n=e.sent).data&&n.success){e.next=5;break}return e.abrupt("return",this.datas[t]=null);case 5:this.datas[t]=n.data,Object.keys(this.datas).length!=a||XB.model.panos.list.some((function(e){return e.isAligned()&&!(t in o.datas)}))||i();case 7:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)},o=function(e){return r.apply(this,arguments)},ik=Date.now(),this.datas={},this.datasMixed={},this.boxesSolid=lk,n=function(){var e=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.isSingle,r=i.center,a=i.onlyGet,l=i.dontCheckDis,c=e.sid+"&"+t.sid,u=t.sid+"&"+e.sid,h=Tk(e),d=s.matchScoreMap[h][c],p=s.matchScoreMap[h][u],f=d||p;if(a)return f;if(f)return f;f={name:n=c,box0:e,box1:t,center:r},s.matchScoreMap[h][n]=f,"pano2-2&pano4-4"==n&&console.log(5),Ak(e),Ak(t);var m=e.pano.position.clone(),v=t.pano.position.clone(),g=(new THREE.Vector3).subVectors(v,m),A=new THREE.Vector2(g.x,g.z).normalize(),y=r?new THREE.Vector2(r.x-m.x,r.z-m.z).normalize():new THREE.Vector2(e.centerDir.x,e.centerDir.z).normalize(),E=r?new THREE.Vector2(r.x-v.x,r.z-v.z).normalize():new THREE.Vector2(t.centerDir.x,t.centerDir.z).normalize(),w=Math.acos(A.dot(y)),b=Math.PI-Math.acos(A.dot(E)),C=100,x=[];if(w+b>Math.PI+.2)return Object.assign(f,{score:-5e3,str:["angle>180"]});if(e.type!=t.type)return Object.assign(f,{score:-5e3,str:["typeNotSame"]});if(null==f.dirAngleXZ&&(f.dirAngleXZ=THREE.MathUtils.radToDeg(Math.acos(y.dot(E))),f.minAng=Math.min(180-f.dirAngleXZ,f.dirAngleXZ),o)){var I=2;C+=300*Math.sin(THREE.MathUtils.degToRad(f.dirAngleXZ)),C+=f.dirAngleXZ,C-=10*Math.abs(xk(e).distanceToSquared(e.pano.position)-I),C-=10*Math.abs(xk(t).distanceToSquared(t.pano.position)-I)}var T=1,B=e.btmPos||e.btmPosPredict,k=t.btmPos||t.btmPosPredict;if(!l){var P=THREE.MathUtils.clamp(.8/ck[h].widthNormal.max,.5,1.5);if(!ck[h].bottom&&B&&k){var R=B.distanceToSquared(k);if(f.btmPosPreDis=R,C-=1300*R*P*T,t.topPos){var M=e.topPos.distanceToSquared(t.topPos);f.topPosPreDis=M;var S=700*M*P*T,D=new THREE.Vector2(B.x-m.x,B.z-m.z).lengthSq(),F=new THREE.Vector2(k.x-v.x,k.z-v.z).lengthSq();(D<.4||F<.4)&&(S*=.3),C-=S}}else if(e.posAtWall&&t.posAtWall){var L=e.posAtWall.distanceToSquared(t.posAtWall);f.wallPosPreDis=L,C-=500*L*P,L=e.btmPosOri.distanceToSquared(t.btmPosOri),f.btmPosPreDis=L,C-=500*L*P*T}}if(!f.center){var H=Ck(m,e.centerDir,v,t.centerDir);f.center=H.pos3d.clone(),"pano2-2&pano4-4"==n&&(hk(m,e.centerBtmDir,10),hk(v,t.centerBtmDir,10));var Q=(new THREE.Vector3).subVectors(H.pos3d,m).normalize(),O=(new THREE.Vector3).subVectors(H.pos3d,v).normalize(),V=Q.dot(e.centerDir)+O.dot(t.centerDir),_=V<1.95;if(C-=1e4*(2-V),_)return x.push("wrongDir"),Object.assign(f,{score:C-5e3,str:x});if(!l&&!ck[h].bottom&&B&&k){var U=new THREE.Vector2(B.x,B.z),N=new THREE.Vector2(k.x,k.z),z=new THREE.Vector2(f.center.x,f.center.z),G=U.distanceToSquared(z)+N.distanceToSquared(z),j=he.linearClamp(f.minAng,0,10,0,1);C-=1e3*G*j,f.centerDrift=G}bk(f);var W=!ck[h].bottom&&e.btmPos||f.topPos,q=!ck[h].bottom&&t.btmPos||f.topPos,J=he.linearClamp(f.minAng,0,10,.05,.4),Y=.5,Z=(new THREE.Vector3).addVectors(f.center.clone().multiplyScalar(1-Y),f.btmPos.clone().multiplyScalar(Y)).setY(H.pos3d.y);f.center=W&&q?(new THREE.Vector3).addVectors(Z.multiplyScalar(J),W.clone().add(q).multiplyScalar(.5*(1-J))).setY(H.pos3d.y):Z}Tk(f);var X,K=(new THREE.Vector3).subVectors(e.pano.position,f.center),$=(new THREE.Vector3).subVectors(t.pano.position,f.center);if(K.x*$.x>0&&K.z*$.z>0&&(C-=200),!tk.containsPoint(f.center)){var ee=tk.distanceToPoint(f.center);if(C-=1e3*ee*ee,x.push("outsideBound"),Object.assign(f,{score:C,str:x,center:f.center,disToBound:ee}),ee>.5)return f}var te=function(){X=[],[e,t].forEach((function(e){var t=Pk(e,f.center);X.push(t)}))};return te(),C+=Rk(X,h),Object.assign(f,{score:C,str:x,boxposes:X})};s.rows={};var t=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.reason,o=void 0===i?"row":i,r=e[0].pano,a=e[0].category,l=a+"|"+o;if(s.rows[l]||(s.rows[l]={}),s.rows[l][r.id])return s.rows[l][r.id];for(var c={sid:"pano"+r.id+("mix"==o?"-mix":"-row"),pano:r,category:"mix"==o?a:"rowBigBox",boxType:"mix"==o?e[0].boxType:"rowBigBox"},u=[],h=0;h<e.length;h++){var d=e[h];Ak(d);for(var p=[d.bbox2[0],d.bbox2[2]],f=p[0],m=p[1],v=h+1;v<e.length;v++){var g=e[v];if(Ak(g),d.boxType==d.boxType){var A=[g.bbox2[0],g.bbox2[2]],y=A[0],E=A[1],w=yk(y,m),b=yk(y,f),C=yk(f,E),x="mix"==o?.004:.003;if(w<=x&&b>=x||C<=x&&b<=x){var I=y<.001&&m>.999?[y,m]:f<.001&&E>.999?[f,E]:null;if("mix"==o&&d.category==uk.cabinet&&!I)continue;var T=ck[d.boxType].widthNormal,B=T.min,k=T.max,P=(B+k)/2,R=P*P*("mix"==o?.8:1.5),M=1==ck[d.boxType].atWall?d.posAtWall:"mix"==o?d.btmPosOri||d.btmPosPredict:d.btmPos,S=1==ck[g.boxType].atWall?g.posAtWall:"mix"==o?g.btmPosOri||g.btmPosPredict:g.btmPos,D=M.distanceToSquared(S);if("mix"==o){var F=d.bbox2[3]-d.bbox2[1]+(g.bbox2[3]-g.bbox2[1]),L=Math.max(d.bbox2[3],g.bbox2[3])-Math.min(d.bbox2[1],g.bbox2[1]),H=F-L,Q=4*(1-H/L+3.5*(L-H))*R;D+=Q;var O=I?.002/(I[0]+(1-I[1])):0;D-=(O=Math.min(6,O))*R}D<R&&Ae.pushToGroupAuto([d,g],u)}}}}return u.forEach((function(e){e.sort((function(e,t){return yk(e.bbox2CenterX,t.bbox2CenterX)}))})),"row"==o&&(u.slice(0).forEach((function(e){if(e.length>=2){for(var t=[],n=new THREE.Box2,i=new THREE.Vector2,o=0,r=e.length;o<r;o++){var a=e[o],s=new THREE.Vector2(a.btmPos.x,a.btmPos.z);n.expandByPoint(s),n.getSize(i),Math.min(i.x,i.y)>.6&&(t.push([e[o],e[o-1]]),(n=new THREE.Box2).expandByPoint(s),console.log("removes",i))}t.length&&(console.log("去除错误row连接",t.map((function(e){return e.map((function(e){return e.sid}))}))),Ae.disconnectGroup(t,u).newGroups)}})),u.forEach((function(e){e.sort((function(e,t){return yk(e.bbox2CenterX,t.bbox2CenterX)}))}))),u.sort((function(e,t){return t.length-e.length})),t=u.map((function(e,t){var n=Fk(e),i=n.leftX,o=n.rightX,r=e.slice().sort((function(e,t){return e.bbox2[1]-t.bbox2[1]}))[0].bbox2[1],a=e.slice().sort((function(e,t){return t.bbox2[3]-e.bbox2[3]}))[0].bbox2[3],s=Object.assign({},c,{boxes:e,bbox2:[i,r,o,a],left:e.find((function(e){return e.bbox2[0]==i})),right:e.find((function(e){return e.bbox2[2]==o}))}),l=xk(s.left),u=xk(s.right),h=new THREE.Vector2(l.x-u.x,l.z-u.z);return s.k=Math.abs(h.x/h.y),s.predictLen=(s.k>1?Math.abs(h.x):Math.abs(h.y))+.6,s})),"mix"!=o&&e.forEach((function(e){if(!u.some((function(t){return t.includes(e)}))){var n=Object.assign({},c,{bbox2:e.bbox2,boxes:[e],left:e,right:e});t.push(n)}})),t.forEach((function(e){e.sid+="-"+e.boxes.map((function(e){return e.index})).join(","),"row"==o&&(e.boxes[0].btmPos&&(e.btmPos=e.boxes.reduce((function(e,t){return e.add(t.btmPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].topPos&&(e.topPos=e.boxes.reduce((function(e,t){return e.add(t.topPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].posAtWall&&(e.posAtWall=e.boxes.reduce((function(e,t){return e.add(t.posAtWall)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)))})),s.rows[l][r.id]=t,t},n=function(n,i){s.matchScoreMap.rowBigBox={};var o=[],r=function(t,n,i){if(t.sid+"&"+n.sid in o)return o[t.sid+"&"+n.sid];if(t.boxes.length==n.boxes.length||i){var r;if("pano0-row-1,2,6"==t.sid&&"pano2-row-0,2,6"==n.sid&&console.log(4),t.boxes.length>1&&n.boxes.length>1){var a,s,l=[t.left,n.left],c=[t.right,n.right],u=function(e,t){var n,i,o=!1,r=[e.left,t.left],a=[e.right,t.right];r[0].btmPos.distanceToSquared(r[1].btmPos)+a[0].btmPos.distanceToSquared(a[1].btmPos)>r[0].btmPos.distanceToSquared(a[1].btmPos)+a[0].btmPos.distanceToSquared(r[1].btmPos)?(o=!0,n=(new THREE.Vector3).addVectors(r[0].btmPos,a[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,r[1].btmPos).multiplyScalar(.5)):(n=(new THREE.Vector3).addVectors(r[0].btmPos,r[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,a[1].btmPos).multiplyScalar(.5));var s=new THREE.Vector2(n.x-i.x,n.z-i.z);return{reversed:o,k:Math.abs(s.x/s.y)}}(t,n),h=t.predictLen,d=n.predictLen,p=Math.abs(h-d);if(p>1)return console.warn("overLen> 1",p,t.sid,"和",n.sid),M();u.reversed?(a=e(l[0],c[1],{isSingle:!0}),s=e(c[0],l[1],{isSingle:!0})):(a=e(l[0],l[1],{isSingle:!0}),s=e(c[0],c[1],{isSingle:!0}));var f=xk(a),m=xk(s);if(!f||!m||a.score<-4e3||s.score<-4e3)return M();kk(a),kk(s),f=xk(a),m=xk(s);var v=new THREE.Vector2(f.x-m.x,f.z-m.z),g=Math.abs(v.x/v.y);if(u.k>1&&g<1||u.k<1&&g>1)return console.error("请检查!info2.k > 1 && k < 1 || info2.k < 1 && k > 1",t.sid,"和",n.sid),M();var A=0;if((t.k>1&&n.k<1||t.k<1&&n.k>1)&&(A=t.k/n.k)<1&&(A=1/A),g<1&&f.z>m.z||g>1&&f.x>m.x){var y=m;m=f,f=y}var E=(new THREE.Vector3).addVectors(f,m).multiplyScalar(.5);E.add(t.btmPos).add(n.btmPos).multiplyScalar(1/3);var w=e(t,n,{isSingle:!0,center:E}),b=w.score-1e3*p-100*A+a.score+s.score;if(b<-4e3)return console.log("放弃,匹配分过低,可能不是一组",t.sid,"和",n.sid,b),M();r={rowBigBox0:t,rowBigBox1:n,match:w,k:g,posLeft:f,posRight:m,score:b/3+500,reversed:u.reversed}}else if(1==t.boxes.length&&1==n.boxes.length)r=e(t.boxes[0],n.boxes[0]);else{var C=t.boxes.length>1?t:n,x=1==t.boxes.length?t:n;(r=e(t,n,{dontCheckDis:!0})).k=C.k,r.center&&r.center.add(xk(C)).multiplyScalar(.5),r.predictSize=r.k>1?{x:C.predictLen,y:.6}:{y:C.predictLen,x:.6};var I=xk(C.left).distanceToSquared(x.pano.position)<xk(C.right).distanceToSquared(x.pano.position)?C.left:C.right,T=xk(x),B=xk(I).distanceToSquared(T);r.score-=1e3*B;var k=xk(C),P=new THREE.Vector2(k.x-x.pano.position.x,k.z-x.pano.position.z),R=new THREE.Vector2(x.centerDir.x,x.centerDir.z);r.score+=1e3*(P.dot(R)-1)}return M(r),r}function M(e){e&&o.push(e),o[t.sid+"&"+n.sid]=e}},a=[],l=1==n.filter((function(e){return e.length>1})).length,c=function(e){"second"==e&&(l=!0);for(var i=0;i<n.length-1;i++){var s=t(n[i]);n[i][0].pano,"second"==e&&(s=s.filter((function(e){return!a.some((function(t){return t.includes(e)}))})));for(var c=function(i){var c=t(n[i]);"second"==e&&(c=c.filter((function(e){return!a.some((function(t){return t.includes(e)}))}))),n[i][0].pano;var u=[],h=void 0,d=void 0;for(s.length<c.length?(h=c.slice(),d=s.slice()):(h=s.slice(),d=c.slice());d.length<h.length;)d.push({sid:"void"});if(!h[0])return"continue";Lk(h[0],h,d,null,u),(u=u.map((function(e){var t=e.map((function(e){return e.some((function(e){return"void"==e.sid}))?null:r(e[0],e[1],l)})),n=t.reduce((function(e,t){return e+(t&&t.score>-2e3?t.score:-1e3)}),0);return{pairs:e,infos:t,score:n,name:e.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}}))).sort((function(e,t){return t.score-e.score})),u[0].pairs.forEach((function(e,t){var n=u[0].infos[t];if(n&&n.score>-2e3){var i=e.filter((function(e){return"void"!=e.sid}));Ae.pushToGroupAuto(i,a,null,(function(e){if(!n.k)return!0;var t=e.relationships[0],i=t[0].sid+"&"+t[1].sid;return!o[i].k||o[i].k<1&&n.k<1||o[i].k>1&&n.k>1||void console.log("k不一致无法匹配",n,e)}))}}))},u=i+1;u<n.length;u++)c(u)}};c(),l||c("second"),console.log("matchGroups",a);var u=[],h=function e(t){var n=new THREE.Vector3,i=new THREE.Vector3,r=0,s=[],l={};if(t.relationships.forEach((function(e){var t=e[0].sid+"&"+e[1].sid,a=o[t];a.posLeft?(n.add(a.posLeft),i.add(a.posRight),r++):(s.push(a),kk(a),Mk(a))})),r>0){n.multiplyScalar(1/r),i.multiplyScalar(1/r);var c=(new THREE.Vector3).addVectors(n,i).multiplyScalar(.5);l.left=n,l.right=i,l.center=c,l.pointsLen=r}if(s.length>0){var h=function(e){var t=new THREE.Vector3,o=new THREE.Vector3;if(e.forEach((function(e){var n=xk(e);t.add(n),o.add(e.size)})),r>0){var a=new THREE.Vector3(Math.abs(n.x-i.x),o.y,Math.abs(n.z-i.z));o.add(a.multiplyScalar(r)).multiplyScalar(1/(r+e.length)),t.add(l.center.clone().multiplyScalar(r)).multiplyScalar(1/(r+e.length))}else o.multiplyScalar(1/e.length),t.multiplyScalar(1/e.length);return{center1:t,size:o}},d=function(e,t){s.forEach((function(e){e.sc=-e.center.distanceToSquared(f)-.5*t.distanceToSquared(e.size)}))},p=h(s),f=p.center1;d(0,p.size),s.sort((function(e,t){return t.sc-e.sc}));var m=s[Math.floor(s.length/2)];d(m.center,m.size);var v=s.filter((function(e){return e.sc<-8}));if(v.length){var g=Ae.disconnectGroup(v.map((function(e){return[e.box0,e.box1]})),a).newGroups;if(console.log("去除错误数据",v),g.length>1)return void g.forEach((function(t){e(t)}));s=s.filter((function(e){return e.sc>=-8}))}if(s.length){var A=h(s);l.center=A.center1,l.size=A.size}}l.k=function(e){var t;if(e.left){var n=new THREE.Vector2(e.left.x-e.right.x,e.left.z-e.right.z);t=Math.abs(n.x/n.y)}else t=Math.abs(Math.max(e.size.x,.6)/Math.max(e.size.z,.6));return t}(l),l.bigBoxes=s,l.group=t,u.push(l)};a.slice(0).forEach((function(e){h(e)}));var d=function(e){return e.size?e.k>1?e.size.x:e.size.z:e.k>1?e.right.x-e.left.x:e.right.z-e.left.z+.6},p=function(){for(var e=[],t=function(e,t){var n=[];e.forEach((function(e){n.push.apply(n,H(e.group.map((function(e){return e.boxes.length}))))})),n.sort((function(e,t){return e-t}));var i=[];n.slice(Math.floor(.3*n.length),Math.floor(.7*n.length)+1).forEach((function(e){i.includes(e)||i.push(e)}));var o=ck.cabinet.widthNormal,r=o.min,a=o.max,s=(r+a)/2,l=i.map((function(e){return{aveW:t/e,count:e}}));l.sort((function(e,t){return Math.abs(e.aveW-s)-Math.abs(t.aveW-s)}));var c=l[0].aveW,u=l[0].count;return(c>a||c<r)&&(c=THREE.MathUtils.clamp(c,r,a)),{aveW:c,count:u}},n=function(e,t,n,i){var o=new THREE.Box2;o.expandByPoint(new THREE.Vector2(e.x,e.z));var r=i>1?new THREE.Vector2(t/2,n/2):new THREE.Vector2(n/2,t/2);return o.expandByVector(r),o},i=function(i){for(var o=u[i],r=function(i){var r,a,s=u[i];if("pano4-row-4&pano6-row-5,1"==(null===(r=s.bigBoxes[0])||void 0===r?void 0:r.name)&&"pano4-row-2,5&pano6-row-3"==(null===(a=o.bigBoxes[0])||void 0===a?void 0:a.name)&&console.log(4),(o.k>1&&s.k<1||o.k<1&&s.k>1)&&d(o)>1.5&&d(s)>1.5)return"continue";var l=(o.k+s.k)/2>1?"z":"x";if(Math.abs(o.center[l]-s.center[l])>.6*1.5)return"continue";var c=t([o],d(o)),h=t([s],d(s)),p=o.predictLen=c.aveW*c.count,f=s.predictLen=h.aveW*h.count,m=o.area=p*c.aveW,v=s.area=f*h.aveW,g=function(e,t){var i=n(o.center,p+e,c.aveW+t,o.k),r=n(s.center,f+e,h.aveW+t,s.k),a=Dk(i,r).getSize(new THREE.Vector2);return{box0:i,box1:r,areaMix:Math.max(0,a.x)*Math.max(0,a.y)}}(.1,.3).areaMix;if(g/m<.65&&g/v<.65)return"continue";console.log("两个合并",o,s),Ae.pushToGroupAuto([o,s],e)},a=i+1;a<u.length;a++)r(a)},o=0;o<u.length-1;o++)i(o);return u.forEach((function(t){e.some((function(e){return e.includes(t)}))||e.push([t])})),console.log("realGroups",e),e.forEach((function(e,n){var i,o=e.reduce((function(e,t){return e+(t.pointsLen||t.bigBoxes.length)}),0),r={"<1":{count:0,sum:0},">1":{count:0,sum:0}};e.forEach((function(e){e.k<1?(r["<1"].count++,r["<1"].sum+=1/e.k):(r[">1"].count++,r[">1"].sum+=e.k)})),r["<1"].count&&(r["<1"].ave=r["<1"].sum/r["<1"].count),r[">1"].count&&(r[">1"].ave=r[">1"].sum/r[">1"].count),i=r["<1"].ave>r[">1"].ave?1/r["<1"].ave:r[">1"].ave;var a=e.reduce((function(e,t){return e.add(t.center.clone().multiplyScalar(t.pointsLen||t.bigBoxes.length))}),new THREE.Vector3).multiplyScalar(1/o),s=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.left?e.left[n]-.3:e.center[n]-e.size[n]/2}(e,i)})).sort((function(e,t){return e-t})).filter((function(e){return e<a[i>1?"x":"z"]})).slice(0,3),l=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.right?e.right[n]+.3:e.center[n]+e.size[n]/2}(e,i)})).sort((function(e,t){return t-e})).filter((function(e){return e>a[i>1?"x":"z"]})).slice(0,3),c=0,u=0,h=(s.length+1)*s.length/2;s.forEach((function(e,t){c+=e*((s.length-t)/h)})),h=(l.length+1)*l.length/2,l.forEach((function(e,t){u+=e*((l.length-t)/h)})),a[i>1?"x":"z"]=(c+u)/2;var d=u-c,p=e.filter((function(e){return!e.predictLen||e.predictLen/d>.7}));0==p.length&&(p=e.sort((function(e,t){return t.predictLen-e.predictLen})).slice(0,1));var f,m=t(p,d),v=m.aveW,g=m.count,A=[],y=[];e.forEach((function(e){y.push.apply(y,H(e.group.filter((function(e){return!y.includes(e)&&e.boxes.length==g}))))})),(f=y.map((function(e){var t=e.boxes.map((function(e){var t={box0:e};return wk(t),t.topPos}));return(i<1&&t[0].z>t[g-1].z||i>1&&t[0].x>t[g-1].x)&&t.reverse(),t.map((function(e){return e.y-ek}))}))).forEach((function(e){for(var t=0;t<g;t++)A[t]=(A[t]||0)+e[t]})),A=A.map((function(e){return e/f.length}));var E=new THREE.Vector3(v,2,v),w=0;for(e.box=[];w<g;){var b=void 0;if(i>1){var C=a.x-(g-1)/2*v;b=new THREE.Vector3(C+w*v,a.y,a.z)}else{var x=a.z-(g-1)/2*v;b=new THREE.Vector3(a.x,a.y,x+w*v)}var I=A[w]?E.clone().setY(A[w]):E,T=new fk({name:"row"+n+"-"+w,center:b,size:I,boxType:"cabinet",infos:e});w++,e.box.push(T)}})),{v:e.length>0}}();if("object"==typeof p)return p.v},i=[],o=function(o){console.error("开始search",o);var r=s.matchScoreMap[o]={},a={},c=[];for(var u in s.datas)a[u]=s.datas[u].shapes.filter((function(e){return Ik(e,o)})),a[u].length&&c.push(u);var p=function(e){(function(e){var t=e.length;if(!(t<2)){for(var n=0;n<t-1;n++){var i=e[n];Ak(i),i.contains=i.contains||[];for(var o=n+1;o<t;o++){var r=e[o];if(Ak(r),r.contains=r.contains||[],!(Math.abs(r.bbox2CenterX-i.bbox2CenterX)>.4)){var a=yk(r.bbox2[0],i.bbox2[0]),s=yk(i.bbox2[2],r.bbox2[2]),l=.005;s>=0&&Math.abs(a)<l||a>=0&&Math.abs(s)<l||s>=0&&a>=0?i.contains.push(r):(a<=0&&Math.abs(s)<l||s<=0&&Math.abs(a)<l||s<=0&&a<=0)&&r.contains.push(i)}}}var c=function(e,t){var n=Pk(e,xk(e),.1),i=n.projectWidth,o=(n.maxProjectWidth+n.minProjectWidth)/2,r="out"==t?i-o:o-i;return 10*-Math.pow(r,2)};e.slice().forEach((function(t){if(t.contains.length>1){var n=Fk(t.contains),i=n.leftX,o=n.rightX;if(Math.abs(yk(t.bbox2[0],i))>.005||Math.abs(yk(t.bbox2[2],o))>.005)return;var r=!0,a=t.contains.map((function(e){return c(e,"in")})),s=a.reduce((function(e,t){return e+t}),0)/a.length;s<-4&&(r=s>c(t,"out")),r?(t.state="因嵌套其他被删除",console.log("因嵌套其他被删除",t),e.splice(e.indexOf(t),1)):t.contains.forEach((function(n){var i;n.state="因被嵌套被删除",n.containBy=t,e.splice(e.indexOf(n),1),(i=console).log.apply(i,["因被嵌套被删除"].concat(H(t.contains)))}))}}))}})(a[e]),a[e].length&&t(a[e],{reason:"mix"}).forEach((function(t){if(t.boxes.length>1){t.boxes.forEach((function(n){n.state="被删除",n.mixTo=t;var i=a[e].indexOf(n);a[e].splice(i,1),i=s.datasMixed[e].shapes.findIndex((function(e){return e.sid==n.sid})),s.datasMixed[e].shapes.splice(i,1)})),console.log("因融合而删除",t.boxes),a[e].push(t),s.datasMixed[e].shapes.push(t);var n=s.datas[e].shapes;t.index=n.length>1?n[n.length-2].index+1:0;var i=t.sid.split("mix-");t.sid=i[0]+t.index+"(mix"+i[1]+")"}}))};for(var f in s.datas)p(f);if(0!=c.length){c.sort((function(e,t){return a[t].length-a[e].length}));var m=c.map((function(e){return a[e]}));console.log("按box个数排序:",m.slice());var v=m[0],g=v.length;if(1==m.length)return ck[o].tinyXZ&&s.expandModelBound(o),v.forEach((function(e){return d(e)})),h(o);var A=function(e){i.push({type:o,args:[e]}),ck[o].tinyXZ&&s.confirmGroundY(o),ck[o].tiny&&s.expandModelBound2(o)};if(1==g){c.forEach((function(e){return Ak(a[e][0])}));for(var y=0;y<c.length;y++)for(var E=a[c[y]][0],w=y+1;w<c.length;w++){var b=a[c[w]][0];e(E,b,{isSingle:!0})}var C=Object.keys(r);C.sort((function(e,t){return r[t].score-r[e].score}));var x=r[C[0]];if(kk(x),x.score>-100&&(Mk(x),x.score>0&&x.sizeAdjust<.1))return new fk(r[C[0]]),void A(m);var I=[];C.forEach((function(e){var t=r[e];I.includes(t.box0.pano.id)||I.push(t.box0.pano.id),I.includes(t.box1.pano.id)||I.push(t.box1.pano.id)}));var T=I.map((function(e){return a[e]}));return l([x],T),void A(T)}var B={};m.forEach((function(e){e.forEach((function(e){return Ak(e)})),B[e.length]||(B[e.length]=[]),B[e.length].push(e)})),m=[];var k=Object.keys(B);if(k.reverse(),k.forEach((function(e){var t,n=B[e];n.length>1&&(n.forEach((function(e){e.disSc=e.reduce((function(e,t){var n=xk(t);return e+t.pano.position.distanceToSquared(n)}),0)})),n.sort((function(e,t){return e.disSc-t.disSc}))),(t=m).push.apply(t,H(n))})),console.log("按距离和个数排序:",m),g=(v=m[0]).length,"cabinet"==o&&n(m))i.push({type:o,args:[m,0]});else{for(var P=function(t,n){for(var i=t.length,o=n.length,a=0;a<i;a++)for(var s=0;s<o;s++){var c=t[a],u=n[s];e(c,u)}for(var h=[],d=t.slice(0),p=n.slice(0);p.length<d.length;)p.push({sid:"void"});Lk(t[0],d,p,null,h),console.log("resultPairs",h.map((function(e){return e.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}))),h=h.map((function(e){var t=e.map((function(e){return r[e[0].sid+"&"+e[1].sid]})),n=t.reduce((function(e,t){return e+(t?t.score:0)}),0);return{infos:t,score:n,pairs:e,name:e.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}})),console.log("resultPairs",h.slice()),console.log("resultPairs按分数高低",h.sort((function(e,t){return t.score-e.score})));var f=[],v=[];h[0]&&h[0].infos.forEach((function(e,t){if(e)if(e.score<-2e3)v.push(e);else if(kk(e),Mk(e),e.sizeAdjust&&ck[e.boxType].tiny||e.sizeAdjust>.2)v.push(e);else{if(e.box0.category==uk.battery&&e.size.x<1&&e.size.z<1){var n=(new THREE.Vector3).subVectors(e.box0.pano.position,xk(e)),i=(new THREE.Vector3).subVectors(e.box1.pano.position,xk(e));if(n.x*i.x>0&&n.z*i.z>0)return void v.push(e)}new fk(e)}else f.push(h[0].pairs[t].find((function(e){return"void"!=e.sid})))})),f.length&&l(f.map((function(e){return{box0:e}})),m),l(v,m)},R=0;R<m.length-1;R++){P(m[R],m[R+1]);break}A(m)}}else ck[o].tinyXZ&&s.expandModelBound()};function r(e){var t=.1,n=.5,i=[],o=new Map;e.forEach((function(e){var t;(t=i).push.apply(t,H(e))})),(i=i.filter((function(e){return!a(e)}))).forEach((function(e){Ak(e);var t=new THREE.Vector2(e.pano.position.x,e.pano.position.z),n=new THREE.Vector2(e.btmPos.x,e.btmPos.z),i=t.distanceToSquared(n),r=Math.abs(i-2);o.set(e,r)})),(i=i.sort((function(e,t){return o.get(e)-o.get(t)}))).forEach((function(i){a(i)||function(e){if("pano12-4"==e.sid&&(console.log(1),hk(e.pano.position,e.centerBtmDir,20)),e.blocked)return!0;var t=["centerBtmDir","leftBtmDir","rightBtmDir"],n=lk.find((function(n){if(!t.find((function(t){if(rk.set(e.pano.position,e[t]),!rk.ray.intersectsBox(n.bound))return!0})))return!0}));return n?(e.blocked=n,!0):void 0}(i)||("pano12-4"==i.sid&&console.log(3),lk.find((function(e){if("battery-pano0-10"==e.name&&console.log(3),e.boxType==i.boxType||"air-hanging"!=e.boxType&&"air-hanging"!=i.boxType){var o=xk(e),r=xk(i);new THREE.Vector2(o.x,o.z),new THREE.Vector2(r.x,r.z);var a=ck[i.boxType].widthNormal.max/2;a=THREE.MathUtils.clamp(a,t,n);var s=e.bound.distanceToPoint(r),l=ck[i.boxType].findRestRatio,c=he.linearClamp(i.pano.position.distanceTo(r),3,6,1,2),u=a*((e.boxType==i.boxType?1:.5)*l*c)-.7*s;return u>0&&console.log(1),u>0}}))||l([{box0:i,log:"findRest"}],e,0))}))}function a(e){var t=function t(n){return function(t){return t.box0==e||t.box1==e}(n)||n.list&&n.list.some((function(e){return t(e)}))||n.mixedFrom&&n.mixedFrom.some((function(e){return t(e)}))||n.infos&&n.infos.some((function(t){return t.group.some((function(t){return t.boxes.some((function(t){return t==e}))}))}))};return lk.some((function(e){return t(e)}))}function l(t,n){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,r=[],s=function(t,n){var i=function(t,n){if(t!=n)return t.pano==n.pano||e(t,n,{isSingle:!0,restMatch:!0}).score<-2e3||void 0};if(!(i(t.box0,n.box0)||i(t.box1,n.box1)||i(t.box0,n.box1)||i(t.box1,n.box0)))return!0};t.length&&((i=console).warn.apply(i,[t[0].log||(t[0].box1?"低分重新匹配":"剩余匹配"),t[0].box0.boxType].concat(H(t))),t[0].box1&&t.sort((function(e,t){return e.score-t.score})),t.forEach((function(i){var l=i.box0,h=i.box1,p=[];h&&p.push(i);for(var f=function(t){var i=n[t],o=[],r=[];i.forEach((function(t){if(!a(t)){if(t.pano!=l.pano){var n=e(l,t,{isSingle:!0,restMatch:!0});n.score>-4e3&&o.push(n)}if(h&&t.pano!=h.pano){var i=e(h,t,{isSingle:!0,restMatch:!0});i.score>-4e3&&r.push(i)}}})),o.sort((function(e,t){return t.score-e.score})),r.sort((function(e,t){return t.score-e.score})),o[0]&&p.push(o[0]),r[0]&&p.push(r[0])},m=o;m<n.length;m++)f(m);p.sort((function(e,t){return t.score-e.score}));var v=p.slice(0,10).map((function(e){return xk(e)?(kk(e),Mk(e),e):e})).sort((function(e,t){return t.score-e.score})).slice(0,3);if(0==v.length)return d(l,.6);if(!(v[0].score>-1200))return h?(console.warn("分数过低,是否有匹配错误?",v[0]),r.push(v[0])):void(("findRest"==i.log||l.btmPos.distanceTo(l.pano.position)<2.5)&&d(l));if((v=v.filter((function(e){return e.score>-1200}))).length){for(var g=[],A=[],y=function(e,t){var n=v[e];if(g.some((function(e){return e.includes(n)})))return"continue";for(var i=[n],o=e+1;o<t;o++){var r=v[o];s(n,r)&&i.push(r)}g.push(i)},E=0,w=v.length;E<w;E++)y(E,w);console.log("lowScores subGroups",g),g.forEach((function(e){A.push(c(e,t[0].log))})),u(A)}})))}function c(e,t){var n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Box3;e.forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(dk(e),e.size);o.union(t)})),o.getCenter(n),o.getSize(i);var r={name:("findRest"==t?"rest:":"low:")+e.map((function(e){return e.name})),boxType:e[0].boxType,center:n,size:i,list:e,xProp:e.find((function(e){return e.xProp}))&&e.find((function(e){return e.xProp})).xProp,yProp:e.find((function(e){return e.yProp}))&&e.find((function(e){return e.xProp})).yProp},a=Sk(i.x,i.y,i.z,r);i.x=a.x,i.y=a.y,i.z=a.z;var s=new fk(r);return console.log("mixMatchBox",s),s}function u(e,t){var n=[];if(e.length>1){var i=e[0].boxType,o=ck[i].widthNormal;o.min;for(var r=o.max,a=0,s=e.length;a<s-1;a++)for(var l=e[a],c=a+1;c<s;c++){var u=e[c],h=l.bound.clone().union(u.bound).getSize(new THREE.Vector3),d=l.bound.intersectsBox(u.bound),p=r,f=r;l.xProp&&u.xProp&&l.xProp==u.xProp&&(p=ck[i][l.xProp].max,f=ck[i][l.yProp].max,l.boxType!=u.boxType&&(p=Math.max(p,ck[u.boxType][u.xProp].max),f=Math.max(f,ck[u.boxType][u.yProp].max))),p=Math.max(p,l.size.x,u.size.x),f=Math.max(f,l.size.z,u.size.z);var m=d?1.4:1.1;"battery"==l.boxType&&(m*=1.6),h.x-p<.4&&h.x<p*m&&h.z<f*m&&h.z-f<.4&&Ae.pushToGroupAuto([l,u],n)}n.length&&n.forEach((function(e){var n=[],o=new THREE.Box3;e.forEach((function(e){if(o.union(e.bound),e.dispose(),t>1){var i=n.find((function(t){return t.boxType==e.boxType})),r=0,a=function(e){e&&(r+=e.score)};e.traversePair((function(e){a(e.box0),a(e.box1)})),i?i.score+=r:n.push({score:r,boxType:e.boxType})}})),t>1&&(n.sort((function(e,t){return t.score-e.score})),i=n[0].boxType);var r=o.getSize(new THREE.Vector3),a=o.getCenter(new THREE.Vector3),s=e.find((function(e){return e.xProp}))||{},l=s.xProp,c=s.yProp;l&&e.find((function(e){return e.xProp&&e.xProp!=l}))&&(l=c=null);var u={name:"mix:"+e.map((function(e){return" "+e.name})),mixedFrom:e,boxType:i,center:a,size:r,xProp:l,yProp:c};l||Bk(u);var h=Sk(r.x,r.y,r.z,u);r.x=h.x,r.y=h.y,r.z=h.z;var d=new fk(u);console.error("混合",i,e,d)}))}}function h(e){e instanceof Array||(e=[e]),u(lk.filter((function(t){return e.includes(t.boxType)})),e.length)}var d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(e.score<.65)return console.error("取消createSinglePano: 线框识别分数低,可能错误",e);Ak(e);var n=xk(e);if(tk.distanceToPoint(n)>.5)return console.log("取消createSinglePano:超出safebound",e);var i={name:e.sid,box0:e,center:n,topPos:e.topPos,btmPos:e.btmPos};kk(i);var o=-500*t,r=Rk(i.boxposes,e.boxType);!ck[e.boxType].bottom&&e.btmPos&&(r-=3e3*(e.btmPos.y-ek));var a=r<o;console.log("createSinglePano",a?"失败":"成功","pose score:",r,e.sid,e),a||(i.score=r,Mk(i),new fk(i))};s.removedDatas={};for(var p=Object.keys(s.datas),f=p.length,m=0;m<f;m++)for(var v=XB.model.panos.index[p[m]],g=m+1;g<f;g++){var A=XB.model.panos.index[p[g]];if(v.position.distanceToSquared(A.position)<.01){var y=void 0;y=s.datas[p[m]].shapes.length>s.datas[p[g]].shapes.length?p[g]:p[m],console.log("删除pano".concat(y,"的data,因pano").concat(p[m],"和pano").concat(p[g],"很近")),s.removedDatas[y]=s.datas[y],delete s.datas[y]}}for(var E in s.datasMixed=Ae.CloneObject(s.datas,null,void 0,(function(e){return e.category})),uk)o(E);console.log("----FindRest----"),i.forEach((function(e){r.apply(void 0,H(e.args)),"air"!=e.type&&"airSmart"!=e.type&&"cabinet"!=e.type&&h(e.type)})),h(["air","airSmart"]),console.log("cost:",Date.now()-ik,"ms, boxSolid:",s.boxesSolid)},i=function(){var e=function(e){s.datas[e].shapes=s.datas[e].shapes.map((function(t,n){return Object.assign({sid:"pano"+e+"-"+n,category:t.category,pano:XB.model.panos.index[e],index:n},t)}))};for(var t in s.datas)e(t);XB.model.chunks.forEach((function(e){ok.union(e.geometry.boundingBox)}));var i=1/0,o=[];XB.model.panos.list.filter((function(e){return e.isAligned()})).forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(e.position,new THREE.Vector3(.1,.1,.1));ok.union(t),i=Math.min(e.floorPosition.y,i),o.push(e.floorPosition.y)})),ek=ok.min.y,o.sort((function(e,t){return e-t})),console.log(o);var r=o[Math.floor(o.length/2)];console.error("minY",i,"midFloorY",r,"原groundY",ek),s.minY=i,ek=ok.min.y=r,tk=s.safeBound=ok,ak.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,ek,0)),s.ifAnalyze&&n(),s.load(XB.currentPano.id)},a=0,t?(t.forEach((function(e){var t=e.imagePath.split(".jpg")[0];s.datas[t]=e})),i()):XB.model.panos.list.forEach((function(e){e.isAligned()&&(a++,o.bind(s)(e.id))}));case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"expandModelBound",value:function(){var e=ok.clone(),t=[];for(var n in this.datas)this.datas[n].shapes.forEach((function(e){if(Ak(e),e.btmPosPredict){if(e.pano.position.distanceToSquared(e.btmPosPredict)>16)return;var n=ok.distanceToPoint(e.btmPosPredict);n>0&&n<3&&t.push({box:e,dis:n})}}));t.sort((function(e,t){return e.dis-t.dis}));for(var i=t.length,o=0;o<i;o++){var r=t[o].box.btmPosPredict;if(t[o].dis>1){var a=r.clone().clamp(ok.min,ok.max),s=(new THREE.Vector3).subVectors(r,a).normalize().multiplyScalar(1);r=(new THREE.Vector3).addVectors(a,s)}var l=(new THREE.Box3).setFromCenterAndSize(r,new THREE.Vector3(.2,0,.2));e.union(l)}(KB=new co(e,new THREE.MeshBasicMaterial({side:THREE.DoubleSide,wireframe:!0,transparent:!0,opacity:.05}),0)).updateMatrixWorld(),$B.add(KB),this.skyBoxTight=KB,this.safeBound=tk=e,nk=!0,console.log("bound1:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"expandModelBound2",value:function(e){var t=this,n=KB.material;KB.geometry.dispose(),lk.forEach((function(n){n.boxType==e&&t.safeBound.union(n.bound)})),(KB=new co(this.safeBound,n,0)).updateMatrixWorld(),$B.add(KB),this.skyBoxTight=KB,console.log("bound2:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"confirmGroundY",value:function(e){if(!nk){var t=[],n=0,i=function(e){if(e.btmPos&&e.box1){var i=e.btmPos.y,o=e.size.x/2,r=o/Math.tan(Math.acos(-e.box0.centerBtmDir.y)),a=o/Math.tan(Math.acos(-e.box1.centerBtmDir.y));i+=Math.min(r,a)*he.linearClamp(e.minAng,0,90,0,1),t.push(i),n+=i}};lk.forEach((function(t){t.boxType==e&&t.traversePair(i)})),n/=t.length,t.length&&(console.error("confirmGroundY",n,"样本数",t.length),ek=this.safeBound.min.y=n,ak.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,ek,0)));var o=ck[e].height,r=o.min,a=o.max;lk.forEach((function(t){if(t.boxType==e){var n=t.topPos?t.topPos.y:t.list.reduce((function(e,t){return e+t.topPos.y}),0)/t.list.length;t.size.y=THREE.MathUtils.clamp(n-ek,r,a),t.setFromInfo(t),t.draw()}})),this.expandModelBound()}}},{key:"bindEvents",value:function(){var e=this;XB.on(Wr,(function(t){e.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())})),e.wireframes.clear(),e.currentId=null})),XB.on(qr,(function(){XB.mode==ht.PANORAMA&&e.load(XB.currentPano.id)})),window.boxFrame=this,this.ifAnalyze&&setTimeout((function(){var t=document.createElement("button");t.innerHTML="点击切换box显示",t.onclick=function(){e.boxesSolid.forEach((function(e){return e.boxHelper.visible=!e.boxHelper.visible,e.label.visible=!e.label.visible}))},document.querySelector("#app").appendChild(t),t.id="boxWire",t.style.position="fixed",t.style["z-index"]="100",t.style.background="#e00472",t.style.padding="10px",t.style.bottom="80px";var n=document.createElement("button");n.innerHTML="点击切换矩形框显示",n.onclick=function(){e.wireframes.visible=!e.wireframes.visible},document.querySelector("#app").appendChild(n),n.id="wireframes",n.style.position="fixed",n.style["z-index"]="100",n.style.background="#419aff",n.style.padding="10px",n.style.bottom="130px"}),1e3)}},{key:"load",value:function(e){var t=this,n=this.datasMixed[e]||this.datas[e];if(n){if(XB.currentPano.id==e&&!XB.flying&&this.currentId!=e){this.currentId=e;var i=n.shapes,o=n.imageHeight,r=n.imageWidth,a=i.slice();i.forEach((function(e){e.boxes&&a.push.apply(a,H(e.boxes))})),a.forEach((function(e){gk(e),vk(e,XB.currentPano);var n=e.fill_color,i=e.color,a=[].concat(H(void 0===i?[56,56,255]:i),[255]);n||(n=[255,255,255,0]),a||(a=[255,0,0,255]),e.boxes&&(a=[20,205,255,255]);var s=xk(e)?e.pano.position.distanceTo(xk(e)):1,l=("fire"==e.boxType?0:-.2)/s;t.showSignalFrom2d(e.category+"-"+e.sid,e.bbox2,r,o,{fill:{color:(new THREE.Color).setRGB(n[0]/255,n[1]/255,n[2]/255),opacity:n[3]/255},line:{color:(new THREE.Color).setRGB(a[0]/255,a[1]/255,a[2]/255),opacity:"cabling_rack"==e.category?.4:a[3]/255}},e.centerDir,l,"被删除"==e.state)}))}}else e in this.datas||setTimeout((function(){t.load(e)}),100)}},{key:"showSignalFrom2d",value:function(e,t,n,i,o,r,a,s){for(var l=[new THREE.Vector2(t[0],t[1]),new THREE.Vector2(t[2],t[1]),new THREE.Vector2(t[2],t[3]),new THREE.Vector2(t[0],t[3])],c=[],u=0;u<l.length;u++){var h=l[u];c.push(h)}var d=[];c.forEach((function(e){var t=mk(e,XB.currentPano);d.push(t)}));var p=(new THREE.BufferGeometry).setFromPoints(d),f=new THREE.LineBasicMaterial({color:o.line.color,opacity:o.line.opacity,transparent:!0,depthTest:!1}),m=new THREE.LineLoop(p,f);m.renderOrder=100;var v=p.clone().setIndex(new THREE.BufferAttribute(new Uint16Array([0,1,3,2,3,1]),1)),g=new THREE.MeshBasicMaterial({color:o.fill.color,opacity:o.fill.opacity,transparent:!0,side:THREE.DoubleSide,depthTest:!1}),A=new THREE.Mesh(v,g);A.renderOrder=m.renderOrder-1,m.add(A);var y=new Ki({text:e,backgroundColor:{r:255*o.line.color.r,g:255*o.line.color.g,b:255*o.line.color.b,a:.5*o.line.opacity},textColor:{r:255,g:255,b:255,a:1.1*o.line.opacity},borderRadius:15,renderOrder:m.renderOrder+1,player:XB});y.position.copy(r),y.lookAt(0,0,0),y.scale.set(.12,.12,.12);var E=new THREE.Group;E.position.copy(XB.currentPano.position),E.add(m),E.add(y),this.wireframes.add(E),s&&(y.sprite.material.opacity=.4,f.opacity*=.6,f.color.set("#efe"))}}]),i}();function Qk(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ok=function(e){f(n,e);var t=Qk(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.ready=!1,i.loaded=!1,i.locked=null,i.Decoration=new YB(h(i)),i.on("ready",(function(){return i.ready=!0})),i.on("loaded",(function(){i.loaded=!0;var e=i.app.core.get("PanoVideoRenderer");e.on(Tt.CanPlayVideo,(function(){return i.emit(Tt.CanPlayVideo)})),e.on(Tt.StartPlay,(function(){return i.emit(Tt.StartPlay)})),e.on(Tt.SuspendRender,(function(){return i.emit(Tt.SuspendRender)})),e.on(Tt.ResumeRender,(function(){return i.emit(Tt.ResumeRender)})),"ids"==Ce.valueFromUrl("ai")?new Hk(i.app.core.get("Player")):"sds"==Ce.valueFromUrl("ai")&&new Hk(i.app.core.get("Player"),!0)})),i}return u(n,[{key:"panos",get:function(){return this.app.core.get("Player").model.panos}},{key:"panoId",get:function(){return this.app.core.get("Player").currentPano.id}},{key:"floors",get:function(){return this.app.core.get("Player").model.floors}},{key:"floorId",get:function(){return this.app.core.get("Player").currentPano.floorIndex}},{key:"currentFloorId",get:function(){return this.app.core.get("Player").model.currentFloor.floorIndex}},{key:"panoCount",get:function(){return this.app.core.get("Player").model.panos.list.length}},{key:"videoCount",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.length:0}},{key:"videoList",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.map((function(e){return e.id})):[]}},{key:"isCurrentPanoHasVideo",get:function(){return this.app.core.get("Player").currentPano.hasVideo}},{key:"showFloorCadImage",value:function(){this.app.core.get("Player").model.floorplanCadImg.displayCadPlane(!0)}},{key:"hideFloorCadImage",value:function(){var e=this;this.app.core.get("Player")?this.app.core.get("Player").model.floorplanCadImg.displayCadPlane(!1):setTimeout((function(){e.hideFloorCadImage()}),100)}},{key:"setFloorLogo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.ready&&this.app.core.get("Player").model.floorLogos.changeFloorLogo(e)}},{key:"gotoFloor",value:function(e){if("all"==e)this.app.core.get("Player").model.toggleAllFloors(!0);else{var t=parseInt(e)-this.app.core.get("Player").model.currentFloor.floorIndex;this.app.core.get("Player").changeFloor(t)}this.app.core.get("Player").model.currentFloorId=e}},{key:"lock",value:function(){this.locked=vt()}},{key:"unlock",value:function(){this.locked&&(this.locked.resolve(),this.locked=null)}},{key:"showRule",value:function(){this.app.core.get("Player").model.wallManager.switchDisplay(!0)}},{key:"hideRule",value:function(){this.app.core.get("Player").model.wallManager.switchDisplay(!1)}}]),n}(vo),Vk=function(){function e(t){o(this,e),this.app=t,this.plugin=null,this.display=null,this.hidden=!1,this.deferred=vt()}return u(e,[{key:"install",value:function(e){this.plugin=e,this.deferred.resolve(this.plugin)}},{key:"use",value:function(){return this.plugin?Promise.resolve(this.plugin):this.deferred}},{key:"show",value:function(e){var t=this;return this.display=!0,e&&(this.hidden=!1),this.hidden?Promise.resolve():this.use().then((function(){return t.plugin.show()}))}},{key:"hide",value:function(e){var t=this;return this.display=!1,e&&(this.hidden=!0),this.use().then((function(){return t.plugin.hide()}))}},{key:"reload",value:function(){var e=this;return this.use().then((function(){return e.plugin.data(!0)}))}}]),e}(),_k=function(){function e(t){o(this,e),this.app=t}var t;return u(e,[{key:"use",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.app.CadManager.use();case 2:e.sent.sync.use(t,n);case 4:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})}]),e}();function Uk(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Nk=K("render"),zk=function(e){f(n,e);var t=Uk(n);function n(e){var i;return o(this,n),i=t.call(this),Object.defineProperty(h(i),Nk,{value:Gk}),i.app=e,i.marks=[],i.player=null,i.enable=!0,i.app.Scene.on("ready",(function(){i.player=i.app.core.get("Player"),i.player.on(Xr,Z(h(i),Nk)[Nk].bind(h(i)))})),i}return u(n,[{key:"add",value:function(e){e&&e.position&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.position.y=-1,this.marks.push(e))}},{key:"filter",value:function(e){}}]),n}(vo);function Gk(){var e=this,t=this.marks||[];if(t.length){var n=this.player.mode,i=this.player.model.currentFloor.floorIndex;t.forEach((function(t){if(t.position){var o=tt.getPos2d(t.position,e.player);o.trueSide?tt.ifShelter(t.position,e.player,{x:o.vector.x,y:o.vector.y},null,e.player.model.allFloorsVisible?null:i)||t.mode&&t.mode!=n?t.visible=!1:null==t.floorId||t.floorId==i?(t.x=o.pos.x,t.y=o.pos.y,t.visible=!0):t.visible=!1:t.visible=!1}})),this.emit("render",{marks:t,mode:n,floorId:i})}}z('@-webkit-keyframes ruler-point {\n 0% {\n height: 0\n }\n\n to {\n height: 11.375px\n }\n}\n\n@keyframes ruler-point {\n 0% {\n height: 0\n }\n\n to {\n height: 11.375px\n }\n}\n\n@-webkit-keyframes ruler-label {\n 0% {\n max-width: 0\n }\n\n to {\n max-width: 131.25px\n }\n}\n\n@keyframes ruler-label {\n 0% {\n max-width: 0\n }\n\n to {\n max-width: 131.25px\n }\n}\n\n@-webkit-keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@-webkit-keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@-webkit-keyframes ruler-line {\n 0% {\n width: 0\n }\n\n to {\n width: 100%\n }\n}\n\n@keyframes ruler-line {\n 0% {\n width: 0\n }\n\n to {\n width: 100%\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n.widgets-design-option {\n width: 100%;\n height: 100%;\n z-index: 4;\n position: absolute;\n user-select: none;\n overflow: hidden;\n pointer-events: none;\n left: 0;\n top: 0;\n }\n .widgets-design-option i {\n margin: 0 5px;\n }\n .widgets-design-option i:before {\n font-family: "iconfont" !important;\n font-size: 32px;\n line-height: 36px;\n font-style: normal;\n }\n .widgets-design-option li {\n cursor: pointer;\n }\n .widgets-design-option > div {\n height: 36px;\n background: #262729;\n position: absolute;\n transform: translate(-100%, -50%) translateX(-15px);\n border-top-left-radius: 18px;\n border-bottom-left-radius: 18px;\n padding-left: 10px;\n pointer-events: auto;\n box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.4);\n }\n .widgets-design-option > div:after {\n position: absolute;\n right: -15px;\n top: 0;\n content: "";\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 18px 0 18px 15px;\n border-color: transparent transparent transparent #262729;\n }\n .widgets-design-option.right > div {\n transform: translate(15px, -50%);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 18px;\n border-bottom-right-radius: 18px;\n padding: 0 10px 0 0;\n }\n .widgets-design-option.right > div:after {\n right: auto;\n left: -15px;\n border-width: 18px 15px 18px 0;\n border-color: transparent #262729 transparent transparent;\n }\n .widgets-design-option .delete-ruler li {\n line-height: 36px;\n padding: 0 10px;\n word-break: keep-all;\n list-style: none;\n }\n \n .widgets-rulers {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.widgets-rulers .ruler-line {\n position: absolute;\n -webkit-transform-origin: left 0.875px;\n transform-origin: left 0.875px;\n width: 0;\n height: 1.75px;\n}\n\n.widgets-rulers .ruler-line em {\n background: linear-gradient(90deg, hsla(0, 0%, 100%, 0.5), hsla(0, 0%, 100%, 0.3));\n display: block;\n height: 100%;\n -webkit-animation: ruler-line 0.5s ease 1s;\n animation: ruler-line 0.5s ease 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n}\n\n.widgets-rulers .ruler-label {\n position: absolute;\n /* width: 0; */\n height: 0;\n top: 0.875px;\n left: 38%;\n color: #fff;\n}\n\n.widgets-rulers .ruler-label .ruler-label-point {\n position: absolute;\n width: 28px;\n height: 11.375px;\n right: 0;\n bottom: 0;\n background-position: bottom;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzRweCIgaGVpZ2h0PSIxNXB4IiB2aWV3Qm94PSIwIDAgMzQgMTUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ4LjIgKDQ3MzI3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cCA3PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+CiAgICAgICAgPGNpcmNsZSBpZD0icGF0aC0xIiBjeD0iMS41IiBjeT0iMS41IiByPSIxLjUiPjwvY2lyY2xlPgogICAgICAgIDxmaWx0ZXIgeD0iLTEwMC4wJSIgeT0iLTEwMC4wJSIgd2lkdGg9IjMwMC4wJSIgaGVpZ2h0PSIzMDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlT2Zmc2V0IGR4PSIwIiBkeT0iMCIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMSIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4yOTkzNjU5NDIgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9IuWbuuWumueKtuaAgS3liqDovb0iIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00MjcuMDAwMDAwLCAtMjY3LjAwMDAwMCkiPgogICAgICAgIDxnIGlkPSJHcm91cC03IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MjkuMDAwMDAwLCAyNjkuMDAwMDAwKSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zMS41LDEyLjUgTDIxLjUsMS41IiBpZD0iTGluZS1Db3B5LTExIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMC41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTIxLjUsMS41IEwyLjUsMS41IiBpZD0iTGluZS1Db3B5LTEyIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMC41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgPGcgaWQ9Ik92YWwtNi1Db3B5LTYiPgogICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgIDx1c2UgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+");\n background-size: 28px 11.375px;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transform-origin: right center;\n -webkit-animation: ruler-point 0.3s ease 1.3s;\n animation: ruler-point 0.3s ease 1.3s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n}\n\n.widgets-rulers .ruler-label .ruler-label-name {\n position: absolute;\n height: 15.75px;\n font-size: 12px;\n line-height: 15.75px;\n right: 28px;\n bottom: 0.875px;\n white-space: nowrap;\n /* max-width: 0; */\n overflow: hidden;\n -webkit-animation: ruler-label 1s ease 1.6s;\n animation: ruler-label 1s ease 1.6s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n}\n\n.widgets-rulers .ruler-label.reverse .ruler-label-point {\n -webkit-transform: rotateY(180deg);\n transform: rotateY(180deg);\n}\n\n.widgets-rulers .ruler-label.reverse .ruler-label-name {\n /* -webkit-transform: rotateY(-180deg); */\n /* transform: rotateY(-180deg); */\n right: auto;\n left: 28px;\n}\n\n.widgets-rulers .measure .ruler-label .ruler-label-name {\n color: #f0ff00;\n}\n\n.widgets-rulers .ruler-intersection {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.widgets-rulers .ruler-intersection .ruler-intersection-point {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 18.375px;\n height: 7px;\n background-repeat: no-repeat;\n background-size: 18.375px 7px;\n background-position: 50%;\n}\n\n.widgets-rulers .ruler-intersection .ruler-intersection-text {\n position: absolute;\n left: 18.375px;\n bottom: 0;\n font-size: 12px;\n line-height: 12px;\n white-space: nowrap;\n color: #12fffb;\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.3);\n -webkit-transform-origin: left center;\n transform-origin: left center;\n -webkit-transform: scale(0.85);\n transform: scale(0.85);\n}\n\n.measure .ruler-label .ruler-label-name {\n font-size: 14px;\n line-height: 14px;\n}\n\n.measure .ruler-label {\n position: absolute;\n}\n\n.measure .ruler-label .ruler-label-point {\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMzQgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM0IDE1OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0YwRkYwMDtzdHJva2Utd2lkdGg6MC41O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDt9Cgkuc3Qxe2ZpbHRlcjp1cmwoI2ZpbHRlci0yKTt9Cgkuc3Qye2ZpbGw6I0YwRkYwMDt9Cjwvc3R5bGU+CjxmaWx0ZXIgIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaGVpZ2h0PSIzMDAuMCUiIGlkPSJmaWx0ZXItMiIgd2lkdGg9IjMwMC4wJSIgeD0iLTEwMC4wJSIgeT0iLTEwMC4wJSI+Cgk8ZmVPZmZzZXQgIGR4PSIwIiBkeT0iMCIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KCTxmZUdhdXNzaWFuQmx1ciAgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIiBzdGREZXZpYXRpb249IjEiPjwvZmVHYXVzc2lhbkJsdXI+Cgk8ZmVDb2xvck1hdHJpeCAgaW49InNoYWRvd0JsdXJPdXRlcjEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMjk5MzY1OTQyIDAiPgoJCTwvZmVDb2xvck1hdHJpeD4KPC9maWx0ZXI+Cjx0aXRsZT5Hcm91cCA3PC90aXRsZT4KPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CjxwYXRoIGlkPSJMaW5lLUNvcHktMTEiIGNsYXNzPSJzdDAiIGQ9Ik0zMy41LDE0LjVsLTEwLTExIi8+CjxwYXRoIGlkPSJMaW5lLUNvcHktMTIiIGNsYXNzPSJzdDAiIGQ9Ik0yMy41LDMuNWgtMTkiLz4KPGcgaWQ9Ik92YWwtNi1Db3B5LTYiPgoJPGcgY2xhc3M9InN0MSI+CgkJPGNpcmNsZSBpZD0icGF0aC0xXzJfIiBjbGFzcz0ic3QyIiBjeD0iMy41IiBjeT0iMy41IiByPSIxLjUiLz4KCTwvZz4KCTxnPgoJCTxjaXJjbGUgaWQ9InBhdGgtMV8xXyIgY2xhc3M9InN0MiIgY3g9IjMuNSIgY3k9IjMuNSIgcj0iMS41Ii8+Cgk8L2c+CjwvZz4KPC9zdmc+Cg==");\n animation-delay: 0.3s;\n}\n\n.measure .ruler-label .ruler-label-name {\n animation-delay: 0.6s;\n}\n',{});var jk="#f0ff00",Wk=new THREE.Mesh(new THREE.SphereBufferGeometry(.01,10,10),new THREE.MeshBasicMaterial({color:jk,depthTest:!1,transparent:!0})),qk=ui.createFatLineMat({linewidth:3,color:jk});function Jk(e,t){var n=this;this.player=t,this.setPoints(e.points),this.state=e.state||"active",this.visiblePanos=e.visiblePanos,this.initVisiblePanos(),this.elem=document.createElement("div"),this.elem.className="ruler measure",this.elem.setAttribute("data-name",""),this.elem.style.display="none",document.querySelector(".widgets-rulers").append(this.elem),this.text=e.text||"",this.length=Math.round(100*this.points[0].distanceTo(this.points[1]))/100,this.text=W.i18n("common.about")+this.length+W.i18n("common.meter"),this.elem.innerHTML='\n\t\t<div class="ruler-label">\n\t\t\t<div class="ruler-label-point"></div>\n\t\t\t<span class="ruler-label-name">'.concat(this.text,"</span>\n\t\t</div>\n\t"),this.player.measureRulers.push(this);var i,o=new THREE.Object3D;o.name="measure",this.balls=[Wk.clone(),Wk.clone()],this.balls[0].position.copy(this.points[0]),this.balls[1].position.copy(this.points[1]),this.balls[0].renderOrder=this.balls[1].renderOrder=Ue,o.add(this.balls[0]),o.add(this.balls[1]),this.line=ui.createFatLine([this.points[0],this.points[1]],{material:qk}),this.line.renderOrder=Ue,o.add(this.line),this.boldLine=ui.createBoldLine(this.points,{mat:new THREE.MeshBasicMaterial({wireframe:!0,opacity:0,transparent:!0,depthTest:!1,color:"#991111"}),type:"init"},this.player),this.boldLine.parentRuler=this,o.add(this.boldLine),this.player.model.add(o),this.group=o,this.player.$app.config.vrFishTemp&&(this.getPosAtSphere(this.player.currentPano.position),this.updateBoldLine()),this.events={updatePano:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.updateVisible(e.targetPano),"active"==n.state&&n.updateBoldLine()},updateVR:function(e){var t=Je.vrEnabled&&Je.vrSplitScreen;t!=i&&(t?(n.state="vrSplitScreen",n.update()):n.events.updatePano(),i=t)}},this.player.on("flying.ended",this.events.updatePano),this.player.on("vrStateChanged",this.events.updateVR)}Jk.prototype.setPoints=function(e){this.points=e},Jk.prototype.initVisiblePanos=function(){var e=this,t=this.player.model.wallManager.roomInfo;if(t)if(2==this.player.model.wallManager.version)for(var n=this.points[0].clone().setY(0),i=this.points[1].clone().setY(0),o=new THREE.Raycaster(n.clone(),i.clone().sub(n).normalize(),0,n.distanceTo(i)).intersectObjects(this.player.model.chunks),r=0;r<o.length;r++){var a=o[r].point.clone(),s=tt.getVisiblePano(a,this.player.model);this.visiblePanos=this.visiblePanos.concat(s.filter((function(t){return-1==e.visiblePanos.indexOf(t)})))}else for(var l=[new THREE.Vector2(this.points[0].x,this.points[0].z),new THREE.Vector2(this.points[1].x,this.points[1].z)],c=0;c<t.length;c++)for(var u=0,h=t[c].points.length;u<h;u++){var d=[{x:t[c].points[u].x,y:t[c].points[u].y},{x:t[c].points[(u+1)%h].x,y:t[c].points[(u+1)%h].y}];if(he.isLineIntersect(l,d)){t[c].panos.forEach((function(t){-1==e.visiblePanos.indexOf(t)&&e.visiblePanos.push(t)})),console.log("加入房间 "+c);break}}},Jk.prototype.remove=function(){var e=this.player.measureRulers.indexOf(this);this.player.measureRulers.splice(e,1),this.group.parent.remove(this.group),this.elem.remove(),this.player.off("flying.ended",this.events.updatePano),this.player.off("vrStateChanged",this.events.updateVR)},Jk.prototype.updateBoldLine=function(){this.player.$app.config.vrFishTemp?ui.updateBoldLine(this.boldLine,this.fishPoints,"moveAndRotate"):ui.updateBoldLine(this.boldLine,this.points,"update")},Jk.prototype.showOptionLabel=function(e,t){if(e){this.player.chosenMeasureRuler=this;t=he.getFootPoint(t,this.points[0],this.points[1]);this.optionLabelPos=t,document.querySelector(".widgets-design-option").style.display="",this.updateOptionPos()}else this.player.chosenMeasureRuler=null,document.querySelector(".widgets-design-option").style.display="none",this.optionLabelPos=null},Jk.prototype.updateOptionPos=function(){if(this.optionLabelPos){var e=tt.getPos2d(this.optionLabelPos,this.player,this.player.camera),t=document.querySelector(".widgets-design-option"),n=document.querySelector(".widgets-design-option div");e.trueSide?(n.className.replace("hide",""),n.style.left=e.pos.x+"px",n.style.top=e.pos.y+"px",e.vector.x>0?t.className.replace("right",""):t.className.indexOf("right")<0&&(t.className+=" right")):n.className.indexOf("hide")<0&&(n.className+=" hide")}},Jk.prototype.getCrossPoint=function(e,t){var n,i,o,r=this.player.domElement.clientWidth,a=this.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},Jk.prototype.getPosInCrossPoint=function(e,t){var n=this.player.domElement.clientWidth,i=this.player.domElement.clientHeight;return he.getCrossPointAtRect(e,t,n,i,0,0)},Jk.prototype.getPosAtSphere=function(e,t){this.fishPoints=[];var n=[];this.points.forEach(function(t,i){var o=tt.getPosAtSphere(t.clone(),e);this.fishPoints.push(o),n.push(o.x,o.y,o.z),this.balls[i].position.copy(o);var r=Constants.skyRadius/e.distanceTo(t);this.balls[i].scale.set(r,r,r)}.bind(this)),ui.moveFatLine(this.line,n)};function Yk(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Jk.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=tt.getPos2d(i,this.player);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},Jk.prototype.updateVisible=function(e){this.visiblePanos.indexOf(e||this.player.currentPano)>-1?this.state="active":this.state="unable"},Jk.prototype.update=function(){if("panorama"!=this.player.mode||"active"!=this.state)return this.elem.style.display="none",void(this.group.visible=!1);var e,t,n=tt.getPos2d(this.points[0],this.player),i=tt.getPos2d(this.points[1],this.player),o=this.player.domElement.clientWidth,r=this.player.domElement.clientHeight;if(!n.trueSide||!i.trueSide){if(!n.trueSide&&!i.trueSide)return void(this.elem.style.display="none");var a=this.getPosInScreen({point:this.points[0],pos2d:n},{point:this.points[1],pos2d:i},0);if(!a)return void(this.elem.style.display="none");n=a.p1,i=a.p2}var s=n.pos,l=i.pos;if(0!=s.distanceTo(l)){if(n.inSight&&i.inSight)e=(s.x+l.x)/2,t=(s.y+l.y)/2;else{var c,u;c=n.inSight?s.clone():this.getCrossPoint(l,s),u=i.inSight?l.clone():this.getCrossPoint(s,l);var h,d=c.clone().add(u).multiplyScalar(.5);if(e=d.x,t=d.y,d.x>o||d.x<0||d.y>r||d.y<0)return this.elem.style.display="none",void(this.group.visible=!1);if(l.x==s.x){if(l.y==s.y)return void console.warn("pos1和2一样???");h=l.y<s.y?(t-l.y)/(s.y-l.y):(l.y-t)/(l.y-s.y)}else h=l.x<s.x?(e-l.x)/(s.x-l.x):(l.x-e)/(l.x-s.x);if(h<0||h>1)return void(this.elem.style.display="none")}this.elem.style.display="",this.group.visible=!0;var p=this.elem.querySelector(".ruler-label");"left"!=this.dir&&e<o/2||"right"==this.dir?p.className.indexOf("reverse")<0&&(p.className+=" reverse"):p.className.indexOf("reverse")>=0&&(p.className=p.className.replace("reverse","")),p.style.left=e+"px",p.style.top=t+"px"}else console.warn("ruler间距为0!")};var Zk=function(e,t){if(!e)return 0;var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(t=t.replace(/\-(\w)/g,(function(e,t){return t.toUpperCase()})),n=e.currentStyle[t]),n||0},Xk=function(e){f(n,e);var t=Yk(n);function n(e){var i;o(this,n),(i=t.call(this)).focusBeforeModify=function(e){var t=i.app.core.get("Player");i.editTag=i.tags.find((function(t){return t.sid==e}));var n=i.findBestPanoForWatching(i.editTag);t.flyToPano({pano:n,lookAtPoint:i.editTag.position,aimDuration:0,duration:1,checkAlone:!0},(function(){i.edit.enter(i.editTag,(function(){i.editHandle.markTagPos=i.editTag.position,i.editHandle.markSpotA.elem.style.display="block",i.editHandle.markSpotB.elem.style.display="block"}))}))},i.focus=function(e,t,n){var o=i.app.core.get("Player"),r=new THREE.Vector3,a=i.tags.find((function(t){return t.sid==e.sid}))||e.tag,s=i.findBestPanoForWatching(a),l=function(){o.mode===ht.PANORAMA&&i.app.Camera.emit(Qr,{panoId:o.currentPano?o.currentPano.id:null,quaternion:o.cameraControls.activeControl.camera.quaternion,mode:ht.PANORAMA,type:"flyToPano"})},c=function(){a.x=i.convertPositionTo2D(a.position).pos.x,a.y=i.convertPositionTo2D(a.position).pos.y,r.set(0,0,0);var t=a.x-("left"==n?e.arrowBox.width+e.tagBox.width/2:0),s=a.y-("top"==n?e.arrowBox.height+e.tagBox.height/2:0);he.convertScreenPositionToNDC(t,s,r,i.app.dom),r.unproject(o.camera)};if("board"==t){if(!i.app.config.mobile){var u=document.querySelector('[tag-sid="'.concat(a.sid,'"]'));if(u){var h=u.querySelector(".move-layer");h&&(h.style.transform="translateY(0)",setTimeout((function(){var e=h.getBoundingClientRect(),t=e.top+e.height;t>window.innerHeight?h.style.transform="translateY(".concat(window.innerHeight-t,"px)"):e.height/2>a.y&&(h.style.transform="translateY(175px)")}),1500))}}if(s.id==o.currentPano.id&&"panorama"==o.mode){c();var d=new THREE.Vector3(0,0,1).applyQuaternion(o.camera.quaternion).normalize(),p=o.camera.position.clone().sub(a.position).normalize();if(d.dot(p)<0){var f=o.camera.position.clone().sub(r).multiplyScalar(-1);r=o.camera.position.clone().sub(f)}var m=a.x;o.flyToPano({pano:s,lookAtPoint:r,checkAlone:!0,isTagFlying:!0},(function(){m>window.innerWidth/4&&m<window.innerWidth/4*3?l():(c(),o.flyToPano({pano:s,aimDuration:600,lookAtPoint:r},(function(){l()})))}))}else o.flyToPano({pano:s,lookAtPoint:a.position,duration:1e3,checkAlone:!0,isTagFlying:!0},(function(){return setTimeout((function(){c(),o.flyToPano({pano:s,aimDuration:600,lookAtPoint:r})}),10)}))}else o.flyToPano({pano:s,lookAtPoint:a.position,checkAlone:!0,isTagFlying:!0})},i.startMeasure=function(){var e=i.app.core.get("Player");document.querySelector(".widgets-design-option").style.display="none",i.edit.enter(),e.measureRulers.forEach((function(e){e.state="unable"})),e.chosenMeasureRuler&&e.chosenMeasureRuler.showOptionLabel(!1)},i.confirmMeasure=function(e){var t=i.app.core.get("Player");if(1==e){var n;i.isSingleView?(n=i.spot3d.position.clone(),i.updateTagPos=!0,i.spot3d.visible=!1):(n=i.editHandle.confirmPos().position,i.editHandle.enter(),t.locked=!1),i.lastPosition=n,i.measureStep=1;var o=n.clone().setY(t.model.currentFloor.boundingBox.min.y),r=Ae.sortByScore(t.model.panos.list,[ro.filters.isPanoAligned()],[ro.scoreFunctions.distanceSquared(i.currentPano,-.6)]);r[0]&&o.setY(r[0].item.floorPosition.y);var a=ui.createLine([n,o],{width:2,color:"#09e1c0"});t.model.add(a);var s=new THREE.Mesh(new THREE.CircleGeometry(.08,32),new THREE.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.6,depthTest:!1}));s.position.copy(o),s.position.y+=.002,s.lookAt(o.clone().add(new THREE.Vector3(0,1,0))),t.model.add(s);var l=document.createElement("div");l.className="visible",l.id="measureTag",l.innerHTML='<span class="point zoom" style="background-image: url('.concat($n.getImageURL("images/tag_icon_default.svg"),');"></span>');var c=i.convertPositionTo2D(n).pos;l.style.left=c.x+"px",l.style.top=c.y+"px",l.style.setProperty("display","block","important"),document.querySelector("div[xui_tags]").appendChild(l),i.measurePointTemp={measureTag:l,stemLine:a,shadow:s}}else if(2==e){var u,h=(u=i.isSingleView?i.spot3d.position.clone():i.editHandle.confirmPos().position).distanceTo(i.lastPosition),d=Math.max(5,6*h),p=i.getVisiblePano(i.lastPosition,d,.3),f=i.getVisiblePano(u,d,.3),m=Ae.getUnionSet(p,f),v=new Jk({points:[i.lastPosition,u],visiblePanos:m,state:"active"},t);t.chosenMeasureRuler=v,-1==v.visiblePanos.indexOf(t.currentPano)&&v.visiblePanos.push(t.currentPano),t.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine()}))}},i.cancelMeasure=function(){var e=i.app.core.get("Player");if(i.measurePointTemp){var t=i.measurePointTemp,n=t.measureTag,o=t.stemLine,r=t.shadow;document.querySelector("div[xui_tags]").removeChild(n),o.geometry.dispose(),o.material.dispose(),e.model.remove(o),r.geometry.dispose(),r.material.dispose(),e.model.remove(r),i.measurePointTemp=null}e.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine()})),i.edit.exit()},i.app=e,i.root="[xui_tags_view]",i.view=vt(),i.editor=vt(),i.plugin=vt(),i.loaded=!1,i.editTag=null,i.tags=[],i.labels=[],i.showTags=!0,i.showTagsVisible=!1,i.app.store.on("tags",(function(t){i.tags=t.tags||[];var n=e.core.get("Player"),o=new THREE.Vector3(0,-1,0),r=new THREE.Raycaster(new THREE.Vector3(0,0,0),o,.001,9999);i.tags.forEach((function(e){if(null==e.floorIndex){r.set(e.position,o);var t=r.intersectObjects(n.model.chunks);if(t.length)e.floorIndex=t[0].object.parent.floorIndex;else{var i=n.model.floors.list.find((function(t){return e.position.y>=t.boundingBox.min.y&&e.position.y<=t.boundingBox.max.y}));e.floorIndex=i&&i.floorIndex}}})),i.view.then((function(e){return e.render()})),i.loaded=!0,i.emit("loaded",i.tags)})),i.edit={},i.edit.enter=function(t,n){if(i.tagPosChosing=!0,i.isSingleView){i.hideAll();var o=e.core.get("Player");o.locked=!0,o.reticule.visible=!1,i.spot3d.visible=!0,t?(i.updateTagPos=!1,i.spot3d.position.set(t.position.x,t.position.y,t.position.z),setTimeout((function(){var e=new THREE.Vector3(0,0,0),n=new THREE.Vector3(0,0,.5);he.projectPositionToCanvas(t.position,o.camera,e,o.domElement),he.convertScreenPositionToNDC(e.x,e.y,n,o.domElement);var r=o.getMouseIntersect(n,o.OverlayManager.group.children.concat(o.model.colliders));r&&(i.spot3d.lookAt(r.normal.add(i.spot3d.position)),i.spot3d.topMesh.lookAt(o.camera.position))}),10)):(i.updateTagPos=!0,i.spot3d.position.set(0,1e3,0))}else e.core.get("Scene").getSplit("TAG").then((function(o){null==i.editHandle&&(i.editHandle=e.withNewComponent("TagEditManager",o,{spotA:e.dom.querySelector('.player[name="main"] .player-mark'),spotB:e.dom.querySelector('.player[name="copy"] .player-mark')})),t?i.editHandle.reSetPos(t.position):i.editHandle.enter(),n&&n()}))},i.edit.exit=function(){var t=i.app.core.get("Player");if(t.cameraControls.activeControl.enabled=!0,i.isSingleView)t.domElement.style.cursor="default",t.locked=!1,t.reticule.visible=!0,i.spot3d.visible=!1,i.updateTagPos=!1;else{if(!i.editHandle)return;e.core.get("Scene").restore("TAG"),i.editHandle.exit({cancel:!0})}i.editTag=null,i.tagPosChosing=!1,setTimeout((function(){t.cameraControls.activeControl.camera.fov=70,t.camera.fov=t.baseFov*(1/t.zoomLevel)}),50)};var r=new THREE.Raycaster(new THREE.Vector3,new THREE.Vector3,.001,9999);return i.edit.confirm=function(t){var n=i.app.core.get("Player"),o=i.editTag;if(i.isSingleView){if(!o)return;if(i.showAll(),i.spot3d.visible=!0,o.position=i.spot3d.topMesh.getWorldPosition(new THREE.Vector3),!o.visiblePanos&&(o.visiblePanos=i.getVisiblePano(o.position),0==o.visiblePanos.length)){var a=n.currentPano.id;o.visiblePanos.push(n.model.panos.index[a])}}else{if(!i.editHandle)return;var s=i.editHandle.confirmPos(),l=s.position,c=s.sid,u=s.panoId;if(!l)return t||i.edit.exit(),null;var h=i.getVisiblePano(l);0==h.length&&h.push(n.model.panos.index[u]),null==o?o={position:l,visiblePanos:h,sid:c,panoId:u,icon:e.resource.base("images/tag_icon_default.svg")}:(o.position=l,o.visiblePanos=h)}var d=n.cameraControls.activeControl.camera,p=(new THREE.Vector3).subVectors(o.position,d.position).normalize();r.set(d.position,p);var f=r.intersectObjects(n.model.chunks);return f.length?o.floorIndex=f[0].object.parent.floorIndex:o.floorIndex=n.currentPano.floorIndex,i.edit.exit(),o},i.edit.editTag=function(){i.tagInfoEditing=!0},i.edit.cancelTagEdit=function(){i.tagInfoEditing=!1},i.edit.beginTagVisiSetting=function(){i.showTagsVisible=!0;var e=i.app.core.get("Player");e&&e.linkEditor&&(e.linkEditor.enterSet("tagVisible"),e.linkEditor.beginSetTagVisible()),e.model.floorplanCadImg.hideCadPlane(),e.emit("beginTagVisiSetting")},i.edit.setTagVisi=function(e){var t=i.tags.find((function(t){return t.sid==e}));i.app.core.get("Player").linkEditor.SetOneTagVisible(t)},i.edit.resetTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.tagVsetting=null,e.SetOneTagVisible(t)},i.edit.checkNeedSaveTagVisi=function(){return i.app.core.get("Player").linkEditor.checkTagVisiChange()},i.edit.saveTagVisi=function(){var e=i.app.core.get("Player"),t=e.linkEditor.saveTagVisibles(),n=i.app.store.getValue("tags");return t.forEach((function(t){i.tags.find((function(e){return e.sid==t.sid})).visiblePanos=t.value.map((function(t){return e.model.panos.index[t]}))})),n.tags=i.tags,i.app.store.set("tags",n),{data:t,func:e.linkEditor.afterSaveTagVisibles.bind(e.linkEditor)}},i.edit.cancelTagVisiSetting=function(){var e=i.app.core.get("Player");i.showTagsVisible=!1,i.app.core.get("Player").linkEditor.finishSetTagVisible(),i.app.core.get("Player").model.floorplanCadImg.showCadPlane(),e.emit("exitTagVisiSetting")},i.edit.hideAllTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.setTagHideAll(t)},i.edit.showAllTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.setTagShowAll(t)},i.app.Scene.on("loaded",(function(){var t=e.core.get("Player"),n=document.createElement("div");n.className="widgets-rulers",t.domElement.append(n);var o=document.querySelector(".widgets-design-option div");o&&o.addEventListener("pointerup",(function(e){e.stopPropagation(),t.chosenMeasureRuler.remove(),t.chosenMeasureRuler.showOptionLabel(!1)}));var r=i.app.store.getValue("metadata");r?i.isSingleView="laser"==r.sceneFrom:i.app.store.on("metadata",(function(e){return i.isSingleView="laser"==e.sceneFrom})),i.isSingleView&&(i.spot3d=new VB(t));var a=i.app.config.tag.showIn,s={};if(e.core.get("SceneRenderer").on(aa,(function(){if(i.measurePointTemp){var n=i.convertPositionTo2D(i.lastPosition),o=i.measurePointTemp.measureTag;o.style.left=n.pos.x+"px",o.style.top=n.pos.y+"px",o.className=n.trueSide&&n.inSight?"visible":""}if(i.labels.length&&i.labels.forEach((function(n){if(t.mode!=ht.PANORAMA||n.visiblePanos&&!n.visiblePanos.includes(t.currentPano))return n.visible=!1;if(n.floorIndex!=t.model.currentFloor.floorIndex)return n.visible=!1;var i=e.TagManager.convertPositionTo2D(n.position);if(!i.trueSide||!i.inSight)return n.visible=!1;n.x=i.pos.x,n.y=i.pos.y,n.visible=!0})),i.tags&&i.tags.length){var r=function(e,t){e.visible!=t&&(e.visible=t,console.log(e.sid,t))};i.tags.forEach((function(n){if(n.isLose||!1===i.showTags)return r(n,!1);if(0==i.showTagsVisible){if(a)if("all"===a){if(i.editTag||t.paintEditor&&t.paintEditor.painting||t.mode==ht.PANORAMA&&!n.visiblePanos.includes(t.currentPano))return r(n,!1)}else if(-1==a.indexOf(t.mode))return r(n,!1);if(Je.vrEnabled&&Je.vrSplitScreen)return r(n,!1);if((!a||"all"!=a&&a==ht.PANORAMA)&&(i.editTag||t.mode!=ht.PANORAMA||n.visiblePanos&&!n.visiblePanos.includes(t.currentPano)||t.paintEditor&&t.paintEditor.painting))return r(n,!1)}if(t.linkEditor.setTagVisible&&n.floorIndex!=t.model.currentFloor.floorIndex&&t.linkEditor.tagVsetting!=n)return r(n,!1);var o=e.TagManager.convertPositionTo2D(n.position);if(!o.trueSide||!o.inSight)return r(n,!1);n.x=o.pos.x,n.y=o.pos.y,r(n,!0)})),s.lastFrameChanged=t.lastFrameChanged,i.emit("update",s)}})),i.isSingleView){var l=new THREE.Vector3;t.on("pointerStart",(function(e){i.editTag&&t.getMouseIntersect(null,[i.spot3d.topMesh,i.spot3d.bottomMesh])&&(i.updateTagPos=!0,t.cameraControls.activeControl.enabled=!1)})),t.on("pointerMove",(function(e){if((i.editTag||i.updateTagPos)&&(t.getMouseIntersect(null,[i.spot3d.topMesh,i.spot3d.bottomMesh])?t.domElement.style.cursor="move":i.editTag&&!i.updateTagPos&&(t.domElement.style.cursor="default"),i.updateTagPos)){var n=t.getMouseIntersect(null,t.OverlayManager.group.children.concat(t.model.colliders));if(n){i.spot3d.visible=!0,i.spot3d.position.copy(n.point),i.spot3d.lookAt(l.addVectors(n.point,n.normal)),i.spot3d.topMesh.lookAt(t.camera.position);var o=he.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(o,o,o)}else i.spot3d.visible=!1}})),t.on("pointerUp",(function(e){if(i.spot3d&&i.updateTagPos){var n=t.getMouseIntersect(null,t.OverlayManager.group.children.concat(t.model.colliders));if(!n)return;i.spot3d.visible=!0,i.spot3d.position.copy(n.point),i.spot3d.lookAt(l.addVectors(n.point,n.normal)),i.spot3d.topMesh.lookAt(t.camera.position);var o=he.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(o,o,o),t.cameraControls.activeControl.enabled=!0,t.cameraControls.activeControl.pointerDragOn=!1,i.updateTagPos=!1,i.editTag?i.editTag.position=i.spot3d.position:i.editTag={position:i.spot3d.position,sid:Ae.getRandomSid(),icon:i.app.resource.base("images/tag_icon_default.svg")},i.emit("tagManager.markTagPos")}}))}})),i}return u(n,[{key:"tag",value:function(){return this.ready?Promise.resolve(this):this.plugin.promise()}},{key:"load",value:function(e){var t=this;if(!this.app.Scene.loaded)return setTimeout((function(){t.load(e)}),100);e&&(e.forEach((function(e){e.position&&e.position instanceof THREE.Vector3==0&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos&&e.visiblePanos.length?e.visiblePanos=e.visiblePanos.map((function(e){return t.app.core.get("Player").model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position))})),this.tags=e)}},{key:"install",value:function(e,t){this.ready=!0,this.plugin.resolve(this),this[e]&&(this[e].resolve(t),this.loaded&&"function"==typeof t.render&&t.render())}},{key:"convertPositionTo2D",value:function(e){return tt.getPos2d(e,this.app.core.get("Player"))}},{key:"ifShelter",value:function(e,t){var n=this.app.core.get("Player"),i=n.model.allFloorsVisible?null:n.model.currentFloor.floorIndex;return tt.ifShelter(e,n,t,null,i)}},{key:"getVisiblePano",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.15,i=tt.getVisiblePano(e,this.app.core.get("Player").model,{maxDis:t,tolerance:n});return i}},{key:"add",value:function(e){var t=this;return e&&e.length?(e.forEach((function(e){e.position&&e.position instanceof THREE.Vector3==0&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos&&e.visiblePanos.length?e.visiblePanos=e.visiblePanos.map((function(e){return t.app.core.get("Player").model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position)),t.tags.push(e)})),this.view.then((function(e){return e.refresh()}))):Promise.resolve()}},{key:"remove",value:function(e){var t=this.tags.findIndex((function(t){return t.sid==e}));return-1!=t?(this.tags.splice(t,1),this.view.then((function(t){return t.remove(e)}))):Promise.resolve()}},{key:"removeAll",value:function(){return this.tags=[],this.view.then((function(e){return e.removeAll()}))}},{key:"update",value:function(e){e&&e.length&&(this.tags=e)}},{key:"updatePosition",value:function(e){this.tags=e}},{key:"focusTag",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{direction:"",checkSameTag:!1,attrs:null};return new Promise((function(i){"object"!=typeof n&&(n={});var o=t.tags.find((function(t){return t.sid==e}));if(!o)return i();if(t.emit("focus",e,t.focusId),e==t.focusId&&n.checkSameTag)return t.focusId="",i();t.focusId=e;var r=t.player||t.app.core.get("Player"),a=r.model.panos.closestPanoTowardPoint({point:o.position,getAll:!0}).map((function(e){return e.item})).filter((function(e){return o.visiblePanos.indexOf(e)>-1&&e.position.clone().setY(o.position.y).sub(o.position).length()>1.5})),s=a[0],l=a.filter((function(e){return e.floorIndex==r.model.currentFloor.floorIndex}));if(l.length>0&&(s=l[0]),s||(console.warn("该热点无可视点位"),s=r.currentPano),t.__is_aimat=!0,n.direction){var c;if(n.attrs)c=n.attrs;else{var u=document.querySelector(t.root).querySelector('[data-tag-id="'.concat(e,'"]')).querySelector(".tag-body");if(!u)return i();c={width:(u.clientWidth||0)+parseInt(Zk(u,"margin-left"))+parseInt(Zk(u,"margin-right")),height:(u.clientHeight||0)+parseInt(Zk(u,"margin-top"))+parseInt(Zk(u,"margin-bottom"))}}var h=new THREE.Vector3,d=function(){o.x=t.app.TagManager.convertPositionTo2D(o.position).pos.x,o.y=t.app.TagManager.convertPositionTo2D(o.position).pos.y,h.set(0,0,0);var e=o.x-("left"==n.direction?c.width/2:0),i=o.y-("top"==n.direction?c.height/2:0);t.app.TagManager.convertScreenPositionToNDC(e,i,h,t.app.dom),h.unproject(r.camera)};if(s.id==r.currentPano.id&&"panorama"==r.mode){d();var p=new THREE.Vector3(0,0,1).applyQuaternion(r.camera.quaternion).normalize(),f=r.camera.position.clone().sub(o.position).normalize();if(p.dot(f)<0){var m=r.camera.position.clone().sub(h).multiplyScalar(-1);h=r.camera.position.clone().sub(m)}o.x,r.flyToPano({pano:s,lookAtPoint:h,duration:1e3,isTagFlying:!0},(function(){setTimeout((function(){d(),r.flyToPano({pano:s,aimDuration:500,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else r.flyToPano({pano:s,lookAtPoint:o.position,duration:1e3,isTagFlying:!0},(function(){return setTimeout((function(){d(),r.flyToPano({pano:s,aimDuration:400,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else r.flyToPano({pano:s,lookAtPoint:o.position,isTagFlying:!0},(function(){i(),t.__is_aimat=!1}))}))}},{key:"unfocusTag",value:function(){this.focusId=""}},{key:"closeTag",value:function(e){this.unfocusTag(),this.emit("close")}},{key:"openTag",value:function(e){this.emit("open",e)}},{key:"open",value:function(e){if(this.tags.find((function(t){return t.sid==e})).visible){var t=document.querySelector('[tag-sid="'.concat(e,'"]'));if(t){var n=t.querySelector(".point"),i=document.createEvent("HTMLEvents");this.app.config.mobile?i.initEvent("click",!0,!0):i.initEvent("mouseenter",!0,!0),i.fixed=!0,n.dispatchEvent(i)}}}},{key:"close",value:function(e){if(this.tags.find((function(t){return t.sid==e})).visible){var t=document.querySelector('[tag-sid="'.concat(e,'"]'));if(t){var n=document.createEvent("HTMLEvents");this.app.config.mobile?(t=t.querySelector(".arrow i"),n.initEvent("click",!0,!0)):n.initEvent("mouseleave",!0,!0),n.relatedTarget=!0,n.unfixed=!0,t&&t.dispatchEvent(n)}}}},{key:"findBestPanoForWatching",value:function(e){var t=this.app.core.get("Player"),n=t.model.panos.closestPanoTowardPoint({point:e.position,getAll:!0,require:[function(t){return e.visiblePanos.indexOf(t)>-1}]}).map((function(e){return e.item})),i=n.filter((function(e){return e.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}));i.length>0&&(n=i);var o=n.filter((function(e){return e.floorIndex==t.model.currentFloor.floorIndex}));o.length>0&&(n=o);var r=n[0];return t.mode===ht.PANORAMA&&(n=n.filter((function(n){var i=new THREE.Vector3(e.position.x-n.position.x,e.position.y-n.position.y,e.position.z-n.position.z),o=new THREE.Vector3(e.position.x-t.currentPano.position.x,e.position.y-t.currentPano.position.y,e.position.z-t.currentPano.position.z);return i.angleTo(o)<Math.PI/4}))),n.length>0&&(r=n[0]),r||(console.warn("该热点无可视点位"),r=t.currentPano),r}},{key:"showAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!0,e&&(this.showTagsVisible=!0)}},{key:"hideAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!1,e&&(this.showTagsVisible=!1)}},{key:"convertScreenPositionToNDC",value:function(e,t,n){return he.convertScreenPositionToNDC(e,t,n,this.app.dom)}},{key:"toJSON",value:function(e){var t=JSON.stringify(e||this.tags,(function(e,t){return"visiblePanos"===e&&t?t.map((function(e){return e.id})):t}));return JSON.parse(t)}}]),n}(vo),Kk=function(){function e(t){var n=this;o(this,e),this.app=t,this.edit={},this.labels=[{key:"porch",text:"玄关",type:"hall"},{key:"masterGuard",text:"主卫",type:"hall"},{key:"aisle",text:"过道",type:"hall"},{key:"guestGuard",text:"客卫",type:"hall"},{key:"kitchen",text:"厨房",type:"hall"},{key:"garage",text:"车库",type:"hall"},{key:"garden",text:"花园",type:"hall"},{key:"balcony",text:"阳台",type:"hall"},{key:"masterBedroom",text:"主卧",type:"room"},{key:"guestBedroom",text:"次卧",type:"room"},{key:"study",text:"书房",type:"room"},{key:"lockerRoom",text:"储物间",type:"room"},{key:"cloakroom",text:"衣帽间",type:"room"},{key:"elderlyRoom",text:"老人房",type:"room"},{key:"childrenRoom",text:"儿童房",type:"room"},{key:"petRoom",text:"宠物房",type:"room"},{key:"livingRoom",text:"客厅",type:"other"},{key:"restaurant",text:"餐厅",type:"other"}],this.plugin=vt(),this.deferred=vt(),this.app.Scene.on("loaded",(function(){n.deferred.resolve()})),this.edit.enter=function(){n.app.VideoManager.BoxVideo.hideAll(),n.app.Scene.Decoration.hideAll(),n.waitLoaded((function(){n.app.core.get("Player").model.floorplanCadImg.isEdit=!0}))},this.edit.exit=function(){n.app.VideoManager.BoxVideo.showAll(),n.app.Scene.Decoration.showAll();var e=n.app.core.get("Player");e&&(e.model.floorplanCadImg.isEdit=!1)}}return u(e,[{key:"install",value:function(e){this.target=e,this.plugin.resolve(e)}},{key:"use",value:function(){return this.target?Promise.resolve(this.target):this.plugin.promise()}},{key:"cad",value:function(){return this.target}},{key:"waitLoaded",value:function(e){e&&(this.app.core.get("Player")?e():this.deferred.then(e))}}]),e}();function $k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var eP=function(){function e(t){var n=this;o(this,e),this.getOverlayBySid=function(e){var t=n.app.core.get("Player"),i=t.OverlayManager.group.children.find((function(t){return t.sid==e}));return i||(i=t.OverlayManager.group.children[0],console.warn("无效sid:",e,i)),i},this.app=t,this.edit={},this.deferred=vt();var i=null;this.app.Scene.on("loaded",(function(){(i=n.app.core.get("Player")).EditOverlay=new vs(i),i.OverlayManager=new fs(i),n.deferred.resolve(),n.app.Scene.emit("BoxVideo.loaded")})),this.edit.enter=function(){n.waitOverlayManager((function(){var e=function(){i.EditOverlay.transformControls?i.EditOverlay.enter():i.EditOverlay.init(),setTimeout((function(){var e=i.OverlayManager.group.children.filter((function(e){return"video"==e.overlayType}))[0];e&&i.OverlayManager.clickOverlay(e,{dontEmit:!0})}),0)};"panorama"==i.model.mode?e():n.app.Camera.once("mode.afterChange",e)}),n.edit.enter.bind(n))},this.edit.exit=function(){i&&i.EditOverlay.leave()},this.edit.save=function(){var e;try{e=i.EditOverlay.getOverlaySavingInfo()}catch(e){console.error(e)}return e},this.edit.undoEdit=function(){i.EditOverlay.undoEdit()},this.edit.add=function(){i.EditOverlay.beginToAddPlane(),i.mode===ht.FLOORPLAN&&i.model.floorplanCadImg.hideCadPlane()},this.edit.upload=function(e,t){t.videoWidth||t.width?i.EditOverlay.overlayUploaded(e,t):t.onloadedmetadata=function(){i.EditOverlay.overlayUploaded(e,t)}},this.edit.delete=function(e,t){var o=n.getOverlayBySid(e);i.EditOverlay.DeleteOverlay(o,t)},this.edit.lookAt=function(e){var t=n.getOverlayBySid(e);i.OverlayManager.clickOverlay(t,{dontEmit:!0})},this.edit.select=function(e){var t=n.getOverlayBySid(e);i.OverlayManager.clickOverlay(t),i.mode===ht.FLOORPLAN&&i.model.floorplanCadImg.hideCadPlane()},this.edit.unselect=function(){var e=i.EditOverlay.editPlane;e&&(e.raycastToFindFloor(),e.updateVisibleOnFloor(),i.EditOverlay.controlSelectOverlay(null),i.EditOverlay.editPlane=null),i.mode===ht.FLOORPLAN&&i.model.floorplanCadImg.showCadPlane(),i.emit("endEditOverlay")},this.edit.setVisible=function(e,t){var o=n.getOverlayBySid(e);t?o.show("forceHide"):o.hide("forceHide"),i.EditOverlay.editPlane&&i.EditOverlay.controlSelectOverlay(o.visible?o:null)},this.edit.reverse=function(e){var t=i.EditOverlay.editPlane;t.scale.x=Math.abs(t.scale.x)*(e?-1:1)},this.edit.transfrom=function(e){if(i.EditOverlay.editing){var t=i.EditOverlay.transformControls;setTimeout((function(){t.mode=0==e?"translate":1==e?"scale":"rotate";var n=i.EditOverlay.editPlane;n.visible&&n.frame.switchTranformControls(t)}),0)}},this.edit.setPlaneWH=function(e,t){var n=i.EditOverlay.editPlane;return t.value=THREE.MathUtils.clamp(t.value,t.min,t.max),"W"==e&&(n.scale.x*=t.value/n.width,n.width=t.value),"H"==e&&(n.scale.y*=t.value/n.height,n.height=t.value),n.frame&&n.frame.update({mode:"scale"}),t.value},this.edit.setThinkness=function(e){var t=i.EditOverlay.editPlane;if(e.value=THREE.MathUtils.clamp(e.value,e.min,e.max),!t.frame)return 0==e.value?(t.addBox(!1),t.depth=.001,t.scale.z=.001):(t.addBox(!0),t.depth=e.value/100,t.scale.z=e.value/100/Je.overlay.depth),e.value;t.depth=e.value/100,t.frame.setFrameThickness(t.depth)},this.edit.resetRatio=function(){var e=i.EditOverlay.editPlane;e.overlayType&&(e.width/=e.scale.x,e.height/=e.scale.y,e.scale.setX(1),e.scale.setY(1),i.EditOverlay.updateOverlayScaleDisplay(),i.EditOverlay.useImgRatio(),e.frame&&e.frame.update({mode:"scale"}))},this.edit.getCurentPanoVisi=function(){return i.OverlayManager.group.children.filter((function(e){return e.visiblePanos.find((function(e){return e==i.currentPano}))}))},this.edit.setOverlayFrame=function(e){var t=i.EditOverlay.editPlane;if(t.addFrame(e.type),t.visible){var n=i.EditOverlay.transformControls;t.frame?t.frame.switchTranformControls(n):n.attach(t)}},this.edit.limitToCurrentPano=function(e){var t=i.EditOverlay.editPlane;t.limitToOnlyPano=!!e&&i.currentPano,t.show("limitToOnlyPano")}}return u(e,[{key:"showAll",value:function(){var e=this;this.waitOverlayManager((function(){e.app.core.get("Player").OverlayManager.setGroupVisible(!0)}),this.showAll.bind(this))}},{key:"hideAll",value:function(){var e=this;this.waitOverlayManager((function(){e.app.core.get("Player").OverlayManager.setGroupVisible(!1)}),this.hideAll.bind(this))}},{key:"waitOverlayManager",value:function(e,t){var n=this.app.core.get("Player");n&&n.OverlayManager&&n.EditOverlay?e&&e():this.deferred.then((function(){return t()}))}},{key:"operable",value:function(e){var t=this.app.core.get("Player");t.OverlayManager&&t.OverlayManager.group.children.forEach((function(t){var n=e?Bt:Pt;t.layers.set(n),t.children.forEach((function(e){return e.layers.set(n)}))}))}}]),e}(),tP=function(e){f(n,e);var t=$k(n);function n(e){var i;return o(this,n),(i=t.call(this)).BoxVideo=new eP(e),i}return n}(vo);function nP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var iP=function(e){f(n,e);var t=nP(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=vt();return i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).linkEditor=new bs(r),a.resolve()})),i.edit.enter=function(){r&&r.linkEditor?setTimeout((function(){r.linkEditor.enterSet("panoVisible"),r.labelManager.updateEntryVisi(!1)}),0):a.then((function(){return i.edit.enter()}))},i.edit.exit=function(){r&&r.linkEditor.finishSetPanoVisible()},i.edit.undoEdit=function(){var e=r.linkEditor.startEditPano;r.linkEditor.pauseSetPanoVisible(!1,r.model.currentFloor),e&&e.floorIndex==r.model.currentFloor.floorIndex&&(r.linkEditor.SetOnePanoVisible(e),i.emit("walkManager.active",r.linkEditor.checkLinkStatus()))},i.edit.checkNeedSave=function(){return r.linkEditor.checkPanoVisiChange()},i.edit.save=function(e){e(r.linkEditor.savePanoVisibles(),r.linkEditor.afterSavePanoVisibles.bind(r.linkEditor))},i.edit.toggle=function(e){return r.linkEditor.toggle(e)},i.edit.linkToUpperFloor=function(){var e=r.linkEditor;e.startEditPano||(e.startEditPano=e.activePano);var t=e.getFloor(e.activePano.floorIndex,"upper");null!=window.jumpFloor&&(lowerFloorIndex=jumpFloor),r.model.once("floor.changed",(function(t,n){setTimeout((function(){e.actionIcons.forEach((function(e){return e.visible=!1}));var t=e.lastFloorActivePano;t.footIcon.visible=!0,e.changeIconLinkState(t.footIcon,"floorLinked")}),10)})),i.edit.unlinkToOtherFloor(null,{checkMainFirstView:!1}),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="upper"},i.edit.linkToLowerFloor=function(){var e=r.linkEditor;e.startEditPano||(e.startEditPano=e.activePano);var t=e.getFloor(e.activePano.floorIndex,"lower");null!=window.jumpFloor&&(t=jumpFloor),r.model.once("floor.changed",(function(t,n){setTimeout((function(){e.actionIcons.forEach((function(e){return e.visible=!1}));var t=e.lastFloorActivePano;t.footIcon.visible=!0,e.changeIconLinkState(t.footIcon,"floorLinked")}),10)})),i.edit.unlinkToOtherFloor(null,{checkMainFirstView:!1}),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="lower"},i.edit.floorLinkConfirm=function(){var e=r.linkEditor,t=e.lastFloorActivePano,n=e.linkToFloorPano;if(!n)return console.log("没有选择漫游点");i.edit.unlinkToOtherFloor(n),n&&(e.savePanoVisiChange(t.id,[{type:"add",id:n.id}]),e.changeIconVisiState(t.footIcon,e.checkHasNeighbor(t)))},i.edit.unlinkToOtherFloor=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.checkMainFirstView,o=void 0===i||i,a=r.linkEditor,s=r.$app.core.get("Scene").firstView.pano;a.startEditPano||(a.startEditPano=a.activePano);var l=e||a.activePano;a.saveLastPanoVi();var c=a.panoVTemp[l.id]&&a.panoVTemp[l.id].neighbourPanos||r.model.panos.index[l.id].neighbourPanos,u=Object.keys(c).map((function(e){return r.model.panos.index[e]})),h=[];u.forEach((function(e){e.floorIndex!=l.floorIndex&&h.push({type:"sub",id:e.id})})),h.length&&(a.savePanoVisiChange(l.id,h),o&&l==s&&!a.checkHasNeighbor(s)&&(t=!0,h=[{type:"add",id:h[0].id}],a.savePanoVisiChange(l.id,h)),a.changeIconVisiState(l.footIcon,a.checkHasNeighbor(l)),a.delVisibleLines(),a.showFootIcons(l,!0),a.createPanoVisiLines(l)),t&&(r.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Es.WalkManger.firstPointLimit}),setTimeout((function(){a.checkFloorLinkStatus()}),1))},i.edit.cancelFloorLink=function(){var e=r.linkEditor;i.app.Scene.gotoFloor(e.lastFloorActivePano.floorIndex),e.actionIcons.forEach((function(e){return e.visible=!0})),e.linkToFloorPano=null,e.setMultiFloorPanoVisible=!1,r.$app.WalkManager.emit("walkManager.multiFloorLinking",!1)},i.edit.checkFirstView=function(e,t){var n,i=r.$app.core.get("Scene").firstView.pano;if(i==e)n=t;else{if(i!=t)return!1;n=e}var o=r.linkEditor.getCurNeighbors(i);return 1==o.length&&o.includes(n.id)},i}return n}(vo);function oP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var rP=function(e){f(n,e);var t=oP(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={},i.mosaic=vt(),i.mosaics=[];var a=vt();return i.app.Scene.on("loaded",(function(){i.mosaics=i.app.store.getValue("metadata").mosaicList||[],r=i.app.core.get("Player"),a.resolve()})),i.edit.focusVideo=function(e){var t=r.model.panos.index[e];r.flying?r.once("flying.ended",(function(){i.edit.focusVideo(e)})):r.flyToPano({pano:t},(function(){}))},i.edit.startPaint=function(){r.flyToNewMode({mode:"panorama",pano:r.currentPano,callback:function(){r.paintEditor.start(),r.OverlayManager.hide("all"),r.viewLinkManager.hideAllViews()}})},i.edit.cancelPaint=function(){r.paintEditor.cancel(),r.OverlayManager.show("all"),r.viewLinkManager.showAllViews()},i.edit.selectBrush=function(e){r.paintEditor.changeBrush(e)},i.edit.setBrushSize=function(e){r.paintEditor.setBrushSize(e)},i.edit.savePaint=function(){return r.paintEditor.save()},i.edit.deletePaint=function(e){r.paintEditor.paintData=r.paintEditor.paintData.filter((function(t){return t.panoId!=e})),r.currentPano.id==e&&r.paintEditor.updatePanoPaint(e,e)},i.edit.checkPaintEdit=function(){return r.paintEditor.hasEdit},i}return u(n,[{key:"install",value:function(e,t){this[e]&&this[e].resolve(t)}}]),n}(vo);function aP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var sP,lP=window.navigator.userAgent,cP=function(){function e(t){o(this,e),this.app=t}return u(e,[{key:"add",value:function(e,t){e.audio&&this.remove(e);var n=e.music;if(!e.music){if(!t)return;n=""}e.audio=new Howl({preload:!0,src:[this.app.resource.getUserResourceURL(n,!0)],loop:!1,html5:!t&&-1==lP.indexOf("VivoBrowser"),format:["mp3"],onloaderror(e,t){console.log(e,t)},onplayerror:function(e){console.log(e)},onload(){}}),e.audio.on("play",(function(){})),e.audio.on("end",(function(){t&&(e.audio.play(),e.audio.pause())}))}},{key:"remove",value:function(e){e.audio&&(e.audio.unload(),e.audio=null,delete e.audio)}},{key:"play",value:function(){}}]),e}(),uP=function(e){f(i,e);var t,n=aP(i);function i(e){var t;return o(this,i),(t=n.call(this)).app=e,t.partId=0,t.frameId=0,t.playing=!1,t.tours=[],t.player=vt(),t.recorder=vt(),t.audioPlayer=new cP(e),t.app.store.on("tours",(function(e){e.forEach((function(e){e.list=e.list.filter((function(e){return"panorama"!==e.enter.mode||t.app.core.get("Player").model.panos.get(e.enter.panoId)}))}));for(var n=e.length;n--;n>=0)0==e[n].list.length&&e.splice(n,1);t.tours=e,t.load(),t.emit("loaded",t.tours)})),t.edit={},t.edit.enterModule=function(){t.editing=!0},t.edit.leaveModule=function(){t.editing=!1},t}return u(i,[{key:"uuid",value:function(){return Ae.getRandomSid()}},{key:"load",value:function(e,t){var n=this,i=null;e&&(this.tours=e),this.tours.forEach((function(e){n.audioPlayer.add(e,t),e.list.forEach((function(e){delete e._trans,null==i||"panorama"==i.enter.mode&&"panorama"==e.enter.mode&&i.enter.panoId!=e.enter.panoId||(i._notrans=!0),i=e}))}))}},{key:"reload",value:(t=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.partId=0,this.frameId=0,this.playing=!1,e.next=5,this.app.store.get("tours",!0);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"install",value:function(e,t){this[e]&&this[e].resolve(t)}},{key:"toJSON",value:function(){for(var e=[],t=JSON.parse(JSON.stringify(this.tours,(function(e,t){return"audio"===e?null:t}))),n=t.length-1;n>=0;n--){var i=t[n];i.list&&i.list.length?(delete i.audio,delete i._uploaded,i.music&&0===i.music.indexOf("blob:")&&(i.music=i.musicName.replace(/(.+)\.(.+)/,"tour-audio-".concat(i.sid,".$2"))),i.list.forEach((function(e,t){delete e._notrans,delete e.enter._uploaded,delete e.exit._uploaded,e.enter&&e.enter.cover&&0===e.enter.cover.indexOf("data:image")&&(e.enter.cover="tour-enter-".concat(e.sid,".jpg")),e.exit&&e.exit.cover&&0===e.exit.cover.indexOf("data:image")&&(e.exit.cover="tour-exit-".concat(e.sid,".jpg"))}))):t.splice(n,1)}return this.tours.forEach((function(t,n){t.list.forEach((function(t,n){t.enter&&t.enter.cover&&0===t.enter.cover.indexOf("data:image")&&e.push(xB(CB(t.enter.cover),"tour-enter-".concat(t.sid,".jpg"))),t.exit&&t.exit.cover&&0===t.exit.cover.indexOf("data:image")&&e.push(xB(CB(t.enter.cover),"tour-exit-".concat(t.sid,".jpg")))}))})),{tours:t,files:e}}}]),i}(vo);function hP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var dP=.7,pP=3,fP=1.78,mP=function(e){f(n,e);var t=hP(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.editing=!1,i.temp={onRangeChange:0},i}return u(n,[{key:"enter",value:function(e){var t=this;if(!this.editing){if(this.editing=!0,!(sP=this.app.core.get("Player")))return this.app.Scene.on("loaded",(function(){t.editing&&t.enter(e)}));this.setPlayerSize(!0),this.oldStates={zoomMax:Je.zoom.max,zoomMin:Je.zoom.min,zoomEnabled:Je.zoom.enabled,zoomToDefaultWhenToPano:Je.zoom.zoomToDefaultWhenToPano},Je.zoom.max=3,Je.zoom.min=.7,Je.zoom.enabled=!0,Je.zoom.zoomToDefaultWhenToPano=!1,this.eventList={zoomTo:e.bind(this),setSize:this.setPlayerSize.bind(this),update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.hasChanged,i=void 0!==n&&n,o=arguments.length>1?arguments[1]:void 0;if(sP.lastFrameChanged||o){var r=sP.cameraControls.activeControl;if("dollhouse"==sP.mode){var a=r.camera.position.distanceTo(r.target),s=he.linearClamp(a,r.minDistance,Math.max(r.maxDistance/2,r.minDistance+3),pP,dP);e(s)}else if("floorplan"==sP.mode&&i.cameraProjectionChanged){var l=r.getDefaultAbsoluteScale(sP.model.size),c=Math.max(Je.zoomNearLimit,.5*l),u=Math.min(Je.zoomFarLimit,2.5*l),h=he.linearClamp(r.absoluteScale,c,u,pP,dP);e(h)}}}},sP.on("zoomTo",this.eventList.zoomTo),sP.on("setSize",this.eventList.setSize),sP.on("update",this.eventList.update),this.eventList.zoomTo(sP.zoomLevel),this.eventList.update(0,!0),Je.highestQualityTile=!0}}},{key:"leave",value:function(){this.editing=!1,console.log("退出,恢复"),sP&&(sP.zoomTo(1),Je.zoom.enabled=this.oldStates.zoomEnabled,Je.zoom.max=this.oldStates.zoomMax,Je.zoom.min=this.oldStates.zoomMin,Je.zoom.zoomToDefaultWhenToPano=this.oldStates.zoomToDefaultWhenToPano,sP.off("zoomTo",this.eventList.zoomTo),sP.off("setSize",this.eventList.setSize),sP.off("update",this.eventList.update),Je.highestQualityTile=!1,this.setPlayerSize(!1))}},{key:"setPlayerSize",value:function(e){if(e){var t=document.querySelector(".ui-editor-head").offsetHeight,n=window.innerHeight-t,i=window.innerWidth;if(i/n<fP){var o=i/fP;sP.domElement.style.height="".concat(o,"px"),sP.domElement.style.top=(n-o)/2+t+"px"}else sP.domElement.style.top="".concat(t,"px"),sP.domElement.style.height="calc(100% - ".concat(t,"px)")}else sP.domElement.style.top=0,sP.domElement.style.height="100%"}},{key:"waitTexLoaded",value:function(e){var t=this;if("panorama"==sP.mode){if(!sP.currentPano||sP.flying)return console.log("延迟"),e||(e=vt()),setTimeout((function(){t.waitTexLoaded(e)}),100),e.promise();var n=this.getTileSize(),i=new THREE.Vector3(0,0,-1).applyQuaternion(sP.quaternion),o=sP.cameraControls.activeControl.camera,r=o.fov,a=na.getHFOVForCamera(o,o.aspect,1),s=sP.currentPano.loadTiledPano(n,i,{hFov:a,vFov:r},!1,!1,!0);return s.done((function(){console.log("加载完成"),e&&e.resolve()})),s}return vt().resolve().promise()}},{key:"getMaxHeight",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?4096:"4k"==this.app.core.get("QualityManager").tileClass?8192:1024}},{key:"getTileSize",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?2048:"4k"==this.app.core.get("QualityManager").tileClass?4096:512}},{key:"getPicSize",value:function(){if("panorama"!=sP.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=sP.cameraControls.activeControl.camera.fov/180*e,n=t*fP;return{width:Math.round(n),height:Math.round(t)}}},{key:"listenZoomLevel",value:function(e){}},{key:"onResetCamera",value:function(){"panorama"==sP.mode&&(sP.cameraControls.activeControl.lat=0)}},{key:"onResumeSize",value:function(){var e=this;if(sP){var t=sP.cameraControls.activeControl;if("transitioning"==sP.mode)return sP.once("mode.changed",(function(t,n){e.editing&&e.onResumeSize()}));"panorama"==sP.mode?sP.zoomTo(1):"dollhouse"==sP.mode?(t.target.copy(sP.model.center),this.onRangeChange({value:100})):"floorplan"==sP.mode&&(t.target.setX(sP.model.center.x),t.target.setZ(sP.model.center.z),t.camera.position.setX(sP.model.center.x),t.camera.position.setZ(sP.model.center.z),t.rotateToView(sP.model.size,sP.getDirection()),t.zoomToContain(sP.model.size))}}},{key:"onRangeChange",value:function(e){var t=this;this.temp.onRangeChange=e;var n=sP.cameraControls.activeControl,i=parseInt(e.value)/100;if(i<dP?(i=dP,this.eventList.zoomTo(i)):i>pP&&(i=pP,this.eventList.zoomTo(i)),"transitioning"==sP.mode)return sP.once("mode.changed",(function(e,n){t.editing&&t.onRangeChange(t.temp.onRangeChange)}));if("panorama"==sP.mode)Je.zoom.enabled=!0,sP.zoomTo(i);else if("dollhouse"==sP.mode){var o=he.linearClamp(i,dP,pP,Math.max(n.maxDistance/2,n.minDistance+3),n.minDistance);n.camera.position.copy(n.target).add(sP.getDirection().multiplyScalar(-o))}else if("floorplan"==sP.mode){var r=n.getDefaultAbsoluteScale(sP.model.size),a=Math.max(Je.zoomNearLimit,.5*r),s=Math.min(Je.zoomFarLimit,2.5*r);n.absoluteScale=he.linearClamp(i,dP,pP,s,a)}}},{key:"imgAddLabel",value:function(e,t,n){var i=new Image,o=new Image;i.setAttribute("crossOrigin","Anonymous"),o.setAttribute("crossOrigin","Anonymous"),i.src=e,o.src=t;var r=0,a=vt();return i.onload=o.onload=function(){2==++r&&(n.opacity/=100,a.resolve(Ae.imgAddLabel(i,o,n)))},a.promise()}}]),n}(vo),vP=function(){function e(t){o(this,e),this.app=t,this.num=this.app.config.num}var t,n,i;return u(e,[{key:"setEntry",value:(i=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t={}).entry=this.app.Camera.getScreenshotInfo(),e.next=4,this.app.Camera.screenshot();case 4:return t.thumbs=e.sent,this.app.core.get("Scene").firstView.updateByEntry(t.entry,this.app.core.get("Player").model.panos),e.abrupt("return",t);case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"saveEntry",value:(n=k(S.mark((function e(){var t,n,i,o,r=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"thumb-1k.jpg",e.next=3,this.setEntry();case 3:return n=e.sent,i={num:this.num,bizType:"settings-thumb",files:n.thumbs.map((function(e){return xB(e.data,"thumb-".concat(e.name,".jpg"))}))},o=null,e.prev=6,e.next=9,this.app.remote_editor.upload_files(i);case 9:o=e.sent,e.next=15;break;case 12:return e.prev=12,e.t0=e.catch(6),e.abrupt("return",Promise.reject(e.t0));case 15:if(o.success){e.next=17;break}return e.abrupt("return",Promise.reject(o));case 17:return e.prev=17,e.next=20,this.app.remote_editor.saveInitialPage({num:this.num,fileName:t,data:JSON.stringify(n.entry)});case 20:return o=e.sent,e.abrupt("return",o);case 24:return e.prev=24,e.t1=e.catch(17),e.abrupt("return",Promise.reject(e.t1));case 27:case"end":return e.stop()}}),e,this,[[6,12],[17,24]])}))),function(){return n.apply(this,arguments)})},{key:"publish",value:(t=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.app.remote_editor.publicScene({num:this.num});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function gP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var AP=function(e){f(n,e);var t=gP(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.records=[],i.paints=[],i.isPaint=!0,i.isPainting=!1,i.isUndo=!1,i.role="leader",i.colors={leader:"#00c8af",follow:"#3A78E7"},i}return u(n,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.role,n=e.colors,i=e.paint,o=e.ele;this.player=this.app.core.get("Player"),this.$paint=this.elem(o),this.$paint.style.display="",this.isPainting=!0,this.role="leader"==t?"leader":"follow",n&&Object.assign(this.colors,n),this.isPaint=!1!==i,this.onStart()}},{key:"hide",value:function(){this.isPainting=!1,this.isUndo=!1,this.paints=[],this.records=[],this.$paint&&(this.$paint.style.display="none",this.context.clearRect(0,0,this.canvas.width,this.canvas.height));var e=this.app.core.get("Player").currentPano;e&&e.hasVideo&&this.app.core.get("PanoVideoRenderer").activatePanorama(e)}},{key:"elem",value:function(e){var t=this.app.$plugins.querySelector("[xui_sync_paint]");if(null==t){var n='<div xui_sync_paint style="display:none">\n <canvas></canvas>\n </div>\n <style>\n [xui_sync_paint] {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 1000;\n }\n [xui_sync_paint] canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: all;\n }\n </style>\n ';e?(document.querySelector(e).insertAdjacentHTML("afterbegin",n),t=document.querySelector(e).querySelector("[xui_sync_paint]")):(this.app.$plugins.insertAdjacentHTML("beforeend",n),t=this.app.$plugins.querySelector("[xui_sync_paint]")),this.bind(t)}return t}},{key:"bind",value:function(e){var t,n=this;this.mouse=new THREE.Vector2,this.canvas=e.querySelector("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.onmousedown=function(e){n.isPaint&&(e.preventDefault(),n.beginStroke({x:e.clientX,y:e.clientY}))},this.canvas.onmouseup=function(e){n.isPaint&&(e.preventDefault(),n.endStroke())},this.canvas.onmousemove=function(e){n.isPaint&&(e.preventDefault(),n._mouseDown&&n.moveStroke({x:e.clientX,y:e.clientY}))},this.canvas.addEventListener("touchstart",(function(e){n.isPaint&&(e.preventDefault(),t=e.touches[0],n.beginStroke({x:t.pageX,y:t.pageY}))})),this.canvas.addEventListener("touchmove",(function(e){n.isPaint&&(e.preventDefault(),n._mouseDown&&(t=e.touches[0],n.moveStroke({x:t.pageX,y:t.pageY})))})),this.canvas.addEventListener("touchend",(function(e){n.isPaint&&(e.preventDefault(),n.endStroke())}))}},{key:"onStart",value:function(){var e=window.devicePixelRatio||1,t=this.canvas.getBoundingClientRect();this.ratio=1,this.canvas.width=t.width*e,this.canvas.height=t.height*e,this.context.scale(e,e),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this._endTime=0,this._mouseDown=!1,this._lastTimestamp=0,this._lastLineWidth=-1,this._lastPosition={x:0,y:0},he.convertScreenPositionToNDC(0,0,this.mouse,this.app.dom);var n=tt.getMouseIntersect(this.player.camera,[this.player.model.skybox],this.mouse);this.placeIntersectPlane(n&&n.point)}},{key:"onRecord",value:function(e){this.transformTo3d(e),this.records.push(e),this.emit("data",{type:"paint",data:e})}},{key:"beginStroke",value:function(e){this._mouseDown=!0,this._lastTimestamp=Date.now(),this._lastPosition=this.windowToCanvas(e.x,e.y),this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:5})}},{key:"moveStroke",value:function(e){var t=Date.now(),n=this.windowToCanvas(e.x,e.y),i=this.calcDistance(n,this._lastPosition),o=t-this._lastTimestamp,r=this.calcLineWidth(o,i);this.context.beginPath(),this.context.moveTo(this._lastPosition.x,this._lastPosition.y),this.context.lineTo(n.x,n.y),this.paints.push({color:this.colors[this.role]||"#00c8af",width:r,x:n.x,y:n.y,t:5}),this.context.strokeStyle=this.colors[this.role]||"#00c8af",this.context.lineWidth=r,this.context.lineCap="round",this.context.linJoin="round",this.context.stroke(),this._lastPosition=n,this._lastTimestamp=t,this._lastLineWidth=r}},{key:"endStroke",value:function(){this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:0}),this.onRecord(this.paints),this.paints=[],this.isUndo=!0,this._mouseDown=!1,this._lastTimestamp=0,this._endTime=Date.now()}},{key:"calcDistance",value:function(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}},{key:"calcLineWidth",value:function(e,t){var n,i=t/e;return n=i<=.1?6:i>=3?2:6-(i-.1)/2.9*2,-1==this._lastLineWidth?n:2*this._lastLineWidth/3+1*n/3}},{key:"windowToCanvas",value:function(e,t){var n=this.canvas.getBoundingClientRect();return{x:Math.round(e-n.left),y:Math.round(t-n.top)}}},{key:"placeIntersectPlane",value:function(e){if(!this.intersectPlane){var t=new THREE.PlaneGeometry(8e3,8e4,1,1);this.intersectPlane=new THREE.Mesh(t,new THREE.MeshBasicMaterial({transparent:!0,wireframe:!1,opacity:0,side:THREE.DoubleSide,depthTest:!1})),this.intersectPlane.lookAt(new THREE.Vector3(0,1,0)),this.intersectPlane.name="intersectPlane",this.player.model.add(this.intersectPlane)}if(e){this.intersectPlane.position.copy(e);var n=this.player.getDirection(null,this.player.camera);this.intersectPlane.lookAt(e.clone().add(n))}}},{key:"transformTo3d",value:function(e){var t=this;0!=e.length&&e.forEach((function(e){he.convertScreenPositionToNDC(e.x,e.y,t.mouse,t.app.dom);var n=tt.getMouseIntersect(t.player.camera,[t.intersectPlane],t.mouse);n?e.pos3d=n.point:console.error("no intersect ??")}))}},{key:"transformTo2d",value:function(e){var t=this;e.forEach((function(e){var n=new THREE.Vector3(e.pos3d.x,e.pos3d.y,e.pos3d.z),i=tt.getPos2d(n,t.player,t.player.camera);e.x=i.pos.x,e.y=i.pos.y}))}},{key:"undo",value:function(){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var e=0;e<this.records.length;e++)this.paint(this.records[e],0);this.emit("data",{type:"undo"})}},{key:"paint",value:function(e){for(var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,i=function(i){n?e[i].t&&setTimeout((function(){t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke()}),n):e[i].t&&(t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke())},o=0;o<e.length-1;o++)i(o)}},{key:"receive",value:function(e){if("undo"==e.type){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var t=0;t<this.records.length;t++)this.paint(this.records[t],0)}else this.transformTo2d(e.data),this.paint(e.data),this.records.push(e.data)}}]),n}(vo);function yP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function EP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var wP="rotate",bP="zoom",CP="endRotation",xP="moveModel",IP="flying.started",TP=function(e){f(n,e);var t=EP(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.inited=!1,i.started=!1,i}return u(n,[{key:"init",value:function(){var e=this;this.app.Camera.on(IP,(function(t){return e.emitData(t)})),this.app.Camera.on(wP,(function(t){return e.emitData(t)})),this.app.Camera.on(CP,(function(t){return e.emitData(t)})),this.app.Camera.on(bP,(function(t){return e.emitData(t)})),this.app.Camera.on(xP,(function(t){return e.emitData(t)})),this.app.core.get("Player").viewLinkManager.addEventListener("loaded",(function(){e.started&&e.app.core.get("Player").viewLinkManager.hideAllViews()}))}},{key:"start",value:function(){this.started=!0,this.inited||(this.init(),this.app.core.get("Player").setPanoTaskEnable(!1),this.app.configSync||(this.app.VRScreenSYNC=!0,Je.zoom.enabled=!1),this.app.core.get("Player").viewLinkManager.loaded&&this.app.core.get("Player").viewLinkManager.hideAllViews())}},{key:"exit",value:function(){this.started=!1,this.app.core.get("Player").setPanoTaskEnable(!0),this.app.core.get("Player").locked=!1,this.app.VRScreenSYNC=!1,Je.zoom.enabled=!0,this.app.core.get("Player").viewLinkManager.loaded&&this.app.core.get("Player").viewLinkManager.showAllViews()}},{key:"sync",value:function(){var e=this.app.core.get("Player");if(this.app.Camera.mode===ht.PANORAMA){var t=null;e.currentPano&&(t=e.currentPano.id),this.emitData({panoId:t,quaternion:e.cameraControls.activeControl.camera.quaternion,mode:ht.PANORAMA,type:"flyToPano"})}else{var n={quaternion:e.quaternion,position:e.position,currentScale:e.cameraControls.activeControl.currentScale,mode:this.app.Camera.mode,type:"flyToNewMode"};e.cameraControls.activeControl&&(n.target={x:e.cameraControls.activeControl.target.x,y:e.cameraControls.activeControl.target.y,z:e.cameraControls.activeControl.target.z}),this.emitData(n)}}},{key:"emitData",value:function(e){var t=this.app.core.get("Player");if("receive"!=t.syncType){if(this.started&&"follow"!=this.role){if(e)for(var n in e){var i=e[n];i instanceof THREE.Vector2?e[n]=new THREE.Vector2(i.x,i.y):i instanceof THREE.Vector3&&(e[n]=new THREE.Vector3(i.x,i.y,i.z))}this.emit("data",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yP(Object(n),!0).forEach((function(t){th(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yP(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e))}}else t.syncType=null}},{key:"transform",value:function(e){e.target&&e.target instanceof THREE.Vector3==!1&&(e.target=new THREE.Vector3(e.target.x,e.target.y,e.target.z)),e.position&&e.position instanceof THREE.Vector3==!1&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.quaternion&&e.quaternion instanceof THREE.Quaternion==!1&&(e.quaternion.hasOwnProperty("_x")?e.quaternion=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):e.quaternion=new THREE.Quaternion(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w)),e.rotationSpeed&&e.rotationSpeed instanceof THREE.Vector2==!1&&(e.rotationSpeed=new THREE.Vector2(e.rotationSpeed.x,e.rotationSpeed.y)),e.info&&this.transform(e.info),e.modelInfo&&this.transform(e.modelInfo)}}]),n}(vo);function BP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var kP=function(e){f(n,e);var t=BP(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).toSame=function(e,t,n){if(e.mode==t.mode){if(e.mode==ht.PANORAMA){if(e.currentPanoId==t.currentPano.id)return!0;var i=t.model.panos.index[parseInt(e.currentPanoId)];return t.flyToPano({pano:i},n),!1}return!0}return t.mode==ht.TRANSITIONING?null:e.mode==ht.FLOORPLAN?(t.flyToNewMode({mode:ht.FLOORPLAN,callback:n}),!1):e.mode!=ht.DOLLHOUSE||(t.flyToNewMode({mode:ht.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){t.cameraControls.activeControl.locked=!0,t.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var n=new THREE.Vector3(0,0,-1).applyQuaternion(t.cameraControls.activeControl.camera.quaternion).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(n)},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i}return u(n,[{key:"receive",value:function(e){var t=this.app.core.get("Player"),n=!0;switch(this.transform(e),e.type){case"flyToPano":t.syncType="receive";var i=t.model.panos.index[parseInt(e.panoId)],o={};o.pano=i,e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(o);break;case"flyToNewMode":t.syncType="receive",e&&e.panoId&&(e.pano=t.model.panos.index[parseInt(e.panoId)]),"panorama"==t.model.mode&&this.app.configSync&&(this.app.dom.parentElement.style.width="100%",this.app.configSync.dom.style.width="0",this.app.dom.parentElement.style.height="100%",this.app.configSync.dom.style.height="0"),setTimeout((function(){return t.flyToNewMode(e)}),50);break;case"rotate":t.model.mode==ht.PANORAMA&&(n=this.toSame(e,t,function(){this.syncRotate(e,t)}.bind(this)))&&this.syncRotate(e,t);break;case"endRotation":t.cameraControls&&t.cameraControls.activeControl&&(t.cameraControls.activeControl.locked=!1,t.cameraControls.activeControl.rotationSpeed=e.rotationSpeed||new THREE.Vector2);break;case"zoom":t.syncType="receive",null==(n=this.toSame(e,t,function(){t.handleControlScroll(e.zoom)}.bind(this)))||n&&t.handleControlScroll(e.zoom);break;case"moveModel":null==(n=this.toSame(e,t,function(){this.copyCameraProp(t,e.info)}.bind(this)))||n&&this.copyCameraProp(t,e.info)}}}]),n}(TP);function PP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var RP,MP,SP=function(e){f(n,e);var t=PP(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).toSame=function(e,t,n){if(e.mode==t.mode){if(e.mode==ht.PANORAMA){if(e.currentPanoId==t.currentPano.id)return!0;var i=t.model.panos.index[parseInt(e.currentPanoId)];return t.flyToPano({pano:i},n),!1}return!0}return t.mode==ht.TRANSITIONING?null:e.mode==ht.FLOORPLAN?(t.flyToNewMode({mode:ht.FLOORPLAN,callback:n}),!1):e.mode!=ht.DOLLHOUSE||(t.flyToNewMode({mode:ht.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){t.cameraControls.activeControl.locked=!0,t.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var n=new THREE.Vector3(0,0,-1).applyQuaternion(t.cameraControls.activeControl.camera.quaternion).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(n)},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),console.log("同屏数据",t),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i.role="leader",i}return u(n,[{key:"start",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(At(w(n.prototype),"start",this).call(this),e.follow){this.role="follow";var t=this.app.core.get("Player");t.locked=!0}}},{key:"exit",value:function(){At(w(n.prototype),"exit",this).call(this),this.role="leader";var e=this.app.core.get("Player");e.locked&&(e.locked=!1)}},{key:"receive",value:function(e){var t=this.app.core.get("Player"),n=!0;switch(this.transform(e),e.type){case"flyToPano":var i=t.model.panos.index[parseInt(e.panoId)];t.locked=!1;var o={};o.pano=i,e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(o,(function(){t.locked=!0}));break;case"flyToNewMode":e.panoId&&(e.pano=t.model.panos.index[parseInt(e.panoId)]),t.locked=!1,e.callback=function(){t.locked=!0},t.flyToNewMode(e);break;case"rotate":t.model.mode==ht.PANORAMA&&(n=this.toSame(e,t,function(){this.syncRotate(e,t)}.bind(this)))&&this.syncRotate(e,t);break;case"endRotation":t.cameraControls&&t.cameraControls.activeControl&&(t.cameraControls.activeControl.locked=!1,t.cameraControls.activeControl.rotationSpeed=e.rotationSpeed||new THREE.Vector2);break;case"zoom":null==(n=this.toSame(e,t,function(){t.handleControlScroll(e.zoom)}.bind(this)))||n&&t.handleControlScroll(e.zoom);break;case"moveModel":null==(n=this.toSame(e,t,function(){this.copyCameraProp(t,e.info)}.bind(this)))||n&&(t.cameraControls.activeControl.locked=!0,t.locked=!0,this.copyCameraProp(t,e.info),t.cameraControls.activeControl.locked=!1,t.mode==ht.PANORAMA&&(t.locked=!1))}}}]),n}(TP),DP=function e(t){o(this,e),this.sync=new kP(t),this.follow=new SP(t),this.paint=new AP(t)};function FP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var LP,HP={},QP=function(e){f(n,THREE.EventDispatcher);var t=FP(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.app.Scene.on("loaded",(function(){RP=i.app.core.get("Player"),MP=i.app.core.get("SceneRenderer"),i.init(),i.editing&&i.enter()})),window.editView=h(i),i}return u(n,[{key:"init",value:function(){var e=this;LP=Math.max(2*Math.sqrt(RP.model.size.x*RP.model.size.x+RP.model.size.y*RP.model.size.y),30),RP.model.floors.list.forEach((function(e){var t=0;e.panos.forEach((function(e){t+=e.position.y})),t/=e.panos.length,HP[e.floorIndex]=t})),this.ground=new THREE.Mesh(new THREE.PlaneGeometry(8e4,8e4,1,1),new THREE.MeshBasicMaterial({transparent:!0,wireframe:!0,opacity:0,side:THREE.DoubleSide,depthTest:!1})),this.ground.lookAt(new THREE.Vector3(0,1,0)),this.ground.name="editviewLink-ground",this.ground.position.setY(RP.model.center.y);var t=[{x:0,y:0,z:0},{x:10,y:0,z:0}];this.linkLine=ui.createFatLine(t,{material:ui.createFatLineMat({lineWidth:3,color:"#00C8AF",dashed:!0,gapSize:.2,dashSize:.3})}),RP.model.add(this.linkLine),this.linkLine2=ui.createFatLine(t,{material:ui.createFatLineMat({lineWidth:3,opacity:.2,color:"#30FFDF"})}),RP.model.add(this.linkLine2),this.linkLine.visible=this.linkLine2.visible=!1,this.events={changeFloor:function(t,n){e.settingPos&&e.fadeMarkerByFloor(!0)},movePos:function(){e.movePos()},confirmPos:function(t){t.consume(),e.confirmPos()},dragStart:function(){e.markView&&(RP.viewLinkManager.hoverBalloon&&e.markView.balloon==RP.viewLinkManager.hoverBalloon&&e.dragBalloonStart(),RP.viewLinkManager.hoverExit?e.dragExitStart():RP.viewLinkManager.hoverCircle&&e.dragViewStart(RP.viewLinkManager.hoverCircle.mesh))},dragEnd:function(t){e.handelDragEnd(t)},lookAim:function(){RP.on("ifFocusPoint",(function(t){if(e.editing&&e.markView){t.importance<3&&(t.importance=3,t.aim=e.markView.circle.mesh.position.clone())}}))}},RP.viewLinkManager.dispatchEvent({type:"getViewLinkEdit",v:this}),RP.viewLinkManager.addEventListener("changeIntersect",(function(t){e.dispatchEvent({type:"changeIntersect",hovered:t.hovered})})),this.inited=!0}},{key:"enter",value:function(){this.editing=!0,MP&&(RP.model.on("floor.changed",this.events.changeFloor),RP.on("pointerStart",this.events.dragStart),RP.on("pointerMove",this.events.movePos),RP.on("pointerUp",this.events.dragEnd),RP.on("ifFocusPoint",this.events.lookAim))}},{key:"leave",value:function(){this.editing=!1,MP&&(MP.removeComponent(this),RP.model.off("floor.changed",this.events.changeFloor),RP.off("pointerStart",this.events.dragStart),RP.off("pointerUp",this.events.dragEnd),RP.off("pointerMove",this.events.movePos),RP.off("ifFocusPoint",this.events.lookAim))}},{key:"setSize",value:function(e,t){this.inited}},{key:"checkCanAddView",value:function(){return this.inited&&!RP.flying&&RP.viewLinkManager.inited}},{key:"addView",value:function(){var e=this;if(this.app.Camera.monitor.control&&this.app.Camera.monitor.control.watchingCamera){this.app.Camera.monitor.control.stopWatch();var t=RP.cameraControls.controls.dollhouse;t.target.set(0,0,0),t.camera.position.setY(50),t.resetRanges()}if(this.checkCanAddView()){RP.mode===ht.FLOORPLAN&&RP.model.floorplanCadImg.hideCadPlane(),this.markView=new rl({sid:"view360_"+Ae.getRandomSid()},this.app),RP.viewLinkManager.addView(this.markView);var n=function(){e.markView.balloon.showOrHide(!0,0),RP.updateFromControls(),e.beginSetPos(),e.setEditState(!0),os.add("viewChoosePos")};RP.isOutsideMode()?n():RP.flyToMode("floorplan",n)}else var i=setInterval((function(){e.checkCanAddView()&&(e.addView(),clearInterval(i))}),50)}},{key:"reEditView",value:function(e){this.markView=RP.viewLinkManager.views[e],this.oldData=this.getData(),this.reEdit=!0,this.setEditState(!0),this.markView.circle.mesh.visible=!0,RP.viewLinkManager.focusOn(this.markView),"dollhouse"!=RP.mode&&"floorplan"!=RP.mode||this.markView.balloon.showOrHide(!0,0),RP.mode===ht.FLOORPLAN&&RP.model.floorplanCadImg.hideCadPlane()}},{key:"setEditState",value:function(e){e=!!e,this.markView.setSelect(e),this.markView.balloon.setStrictScale(e),e||(this.reEdit=!1,this.markView=null),RP.emit("editViewStateChange",e)}},{key:"exit",value:function(){this.markView&&(this.stopSetPos(),this.cancelSetExit(),this.cancelSetEntry(),this.markView.circle.setSelect(!1),"panorama"!=RP.modeTran.split("-")[1]&&(this.markView.circle.mesh.visible=!1),this.markView.balloon.showOrHide(null,50,"auto"),this.setEditState(!1),RP.mode===ht.FLOORPLAN&&RP.model.floorplanCadImg.showCadPlane())}},{key:"cancelEdit",value:function(){this.markView&&(this.reEdit?(this.markView.titleLabel.setText(this.oldData.title),this.markView.circle.mesh.scale.set(this.oldData.circle.scale,this.oldData.circle.scale,this.oldData.circle.scale),this.markView.balloon.mesh.position.copy(this.oldData.balloon.pos),this.markView.circle.updatePos("normal",{position:this.oldData.circle.pos,quaternion:this.oldData.circle.qua}),this.markView.nearestPano=this.oldData.nearestPano,this.markView.linkType=this.oldData.linkType,this.markView.url=this.oldData.url,this.changeType(this.markView.linkType),this.markView.panoImgVersion=this.oldData.panoImgVersion,this.markView.setPano({thumbPanoTex:this.markView.thumbPanoTex!=this.oldData.thumbPanoTex&&this.oldData.thumbPanoTex}),this.markView.circle.setMapOut(this.oldData.circle.mapOut),this.markView.exitDoor.setMapOut(this.oldData.exit.mapOut),this.markView.enterQuaternion.equals(this.oldData.enterQuaternion)||(this.markView.enterQuaternion=this.oldData.enterQuaternion.clone(),"pano"==this.markView.linkType&&this.markView.mapChangeRot()),this.markView.exitDirection=this.oldData.exitDirection.clone(),this.cancelSetExit()):(RP.viewLinkManager.removeView(this.markView),this.markView.dispose()),this.exit())}},{key:"confirmEdit",value:function(){console.log("confirmEdit"),this.markView.floor!=this.markView.nearestPano.floor&&(this.markView.pano&&(this.markView.pano.floorIndex=this.markView.nearestPano.floorIndex,this.markView.pano.floor.removePano(this.markView.pano),this.markView.pano.floor=this.markView.nearestPano.floor,this.markView.pano.floor.addPano(this.markView.pano)),this.markView.floor&&this.markView.floor.removeView(this.markView),this.markView.floor=this.markView.nearestPano.floor,this.markView.floor.addView(this.markView)),this.exit()}},{key:"fadeMarkerByFloor",value:function(e){RP.model.panos.forEach((function(t){if(t.isAligned()){var n=e&&(RP.model.allFloorsVisible||!t.floor.hidden);t.marker.material.opacity=n?1:0}}))}},{key:"beginSetPos",value:function(e){this.settingPos=!0,this.markView.circle.state="sprite",this.fadeMarkerByFloor(!0),this.markView.circle.mesh.visible=!0,this.markView.update(RP.camera,!0),this.markView.circle.mesh.visible=!1,this.placeGround(),"reset"!=e&&this.movePos("init"),RP.on("click",this.events.confirmPos)}},{key:"stopSetPos",value:function(){this.settingPos&&(this.settingPos=!1,this.linkLine.visible=!1,this.linkLine2.visible=!1,this.markView.circle.state="3D",this.markView.circle.quaternion&&this.markView.circle.mesh.quaternion.copy(this.markView.circle.quaternion),this.fadeMarkerByFloor(!1),RP.off("click",this.events.confirmPos),os.remove("viewChoosePos"))}},{key:"confirmPos",value:function(){this.stopSetPos(),this.dispatchEvent({type:"confirm",info:{sid:this.markView.sid,balloon:{pos:this.markView.balloon.mesh.position.toArray()},circle:{pos:this.markView.circle.position.toArray(),qua:this.markView.circle.quaternion.toArray(),scale:parseInt(100*this.markView.circle.mesh.scale.x)},nearestPano:this.markView.nearestPano.id,enterQuaternion:this.markView.enterQuaternion.toArray(),exitDirection:this.markView.exitDirection.toArray()}})}},{key:"cancelPos",value:function(){this.dispatchEvent({type:"cancelPos"})}},{key:"reSetPos",value:function(){this.markView.balloon.setSelect(!0),RP.viewLinkManager.focusOn(this.markView)}},{key:"focusView",value:function(e){var t=RP.viewLinkManager.views[e];RP.viewLinkManager.focusOn(t)}},{key:"changeScale",value:function(e){console.log("changeScale",e),this.markView.circle.mesh.scale.set(e,e,e),this.markView.titleLabel.updatePos()}},{key:"movePos",value:function(e){if(this.settingPos){var t=RP.model.center.clone();if(!(d=RP.getMouseIntersect(null,[this.ground])))return void console.error("no intersect");if(RP.model.allFloorsVisible)"init"!=e&&t.setY(this.markView.balloon.mesh.position.y);else{if(0==RP.model.currentFloor.panos.length)return console.warn("该层无漫游点!"),void this.stopSetPos();t.setY(HP[RP.model.currentFloor.floorIndex])}var n=tt.getPosAtPlane(d.point,RP,{y:t.y});n||((n=tt.getPosAtPlane(d.point,RP,{y:100})).y=t.y),n&&n.distanceTo(t)>LP&&(n=t.clone().add(n.clone().sub(t).normalize().multiplyScalar(LP)));var i=this.markView.circle.mesh.quaternion.clone(),o=Ae.sortByScore(RP.model.panos.list,[ro.filters.isPanoAligned(),function(e){return RP.model.allFloorsVisible||e.floor==RP.model.currentFloor}],[function(e){return-n.distanceTo(e.position)}])[0].item,r=o.position.clone();if(this.markView.nearestPano=o,n.setY(r.y),this.markView.balloon.mesh.position.copy(n),this.markView.balloon.update(),d=tt.ifIntersectChunks(r,n,RP.model,{InfinityLen:!0})){var a=d[0].face.normal.applyQuaternion(d[0].object.quaternion);p=d[0].point.add(a.multiplyScalar(.01*(1+Math.random()))),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().add(a))}else{var s=n.clone().sub(o.position).setY(0).normalize().multiplyScalar(Je.boundExpandLength);p=r.clone().add(s),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(s))}this.markView.circle.mesh.visible=!0,this.markView.circle.updatePos("normal",{position:p,quaternion:this.markView.circle.mesh.quaternion.clone()}),this.markView.circle.mesh.quaternion.copy(i);var l=n.clone().sub(p),c=l.length(),u=p.clone().add(l.multiplyScalar(Math.max(0,(c-.4)/c)));u.y-=.01;var h=[u,p];if(ui.moveFatLine(this.linkLine,h),r.distanceTo(p)<r.distanceTo(u))h=[r,p];else h=[r,u];ui.moveFatLine(this.linkLine2,h),this.linkLine.visible=!0,this.linkLine2.visible=!0}else if(this.draggingExit){var d=RP.getMouseIntersect(null,[RP.model.skybox]);this.markView.exitDoor.mesh.position.copy(d.point.clone().normalize().multiplyScalar(Je.view360.circleDisToCenter))}else if(this.draggingCircleAtView)if(this.settingVisibles){d=RP.getMouseIntersect(null,[RP.model.skybox]);this.draggingMesh.position.copy(d.point.clone().normalize().multiplyScalar(Je.view360.circleDisToCenter)),this.saveVisibleViews()}else{var p;r=RP.position.clone();if((d=tt.getMouseIntersect(RP.camera,RP.model.colliders.concat(RP.model.skybox),RP.mouse)).object==RP.model.skybox){s=d.point.clone().sub(r).normalize().multiplyScalar(Je.boundExpandLength);p=r.clone().add(s),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(s))}else{a=d.face.normal.applyQuaternion(d.object.quaternion);RP.getMouseDirection().angleTo(d.face.normal)<Math.PI/2&&(a=a.negate()),p=d.point.add(a.multiplyScalar(.01*(1+Math.random()))),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().add(a))}this.markView.circle.mesh.visible=!0,this.markView.circle.updatePos("normal",{position:p,quaternion:this.markView.circle.mesh.quaternion.clone()}),this.markView.nearestPano=RP.currentPano}}},{key:"placeGround",value:function(){this.ground.position.copy(this.markView.balloon.mesh.position),this.ground.lookAt(this.ground.position.clone().add(RP.getDirection(null,RP.camera)))}},{key:"changeType",value:function(e){console.log("changeType",e),this.markView.linkType=e,this.markView.setPano()}},{key:"changeTitle",value:function(e){this.markView.titleLabel.setText(e)}},{key:"uploadedPanoMap",value:function(e){console.log("uploadedPanoMap ",e),this.changeType("pano"),this.markView.pano,this.markView.setPano({reloadTex:!0,mapSrc:e.mapSrc,thumb:e.thumb})}},{key:"setLinkUrl",value:function(e){this.markView.url=e}},{key:"setCircleMap",value:function(e,t){console.log("setCircleMap",e,t),"object"==typeof t&&(t={style:{enter:t}}),RP.viewLinkManager.views[e].circle.setMapOut(t)}},{key:"setExitMap",value:function(e,t){console.log("setExitMap",e,t),"object"==typeof t&&(t={style:{exit:t}}),RP.viewLinkManager.views[e].exitDoor.setMapOut(t)}},{key:"deleteView",value:function(e){try{RP.viewLinkManager.views[e].dispose(),RP.viewLinkManager.removeView(RP.viewLinkManager.views[e])}catch(e){console.log(e)}}},{key:"enterView",value:function(e){var t=this,n=function(){e&&e()};RP.flying?RP.once("flying.ended",(function(){t.enterView(e)})):RP.currentPano==this.markView.pano&&"panorama"==RP.mode?n():this.markView.enter360Pano(n)}},{key:"exitView",value:function(){return new Promise((function(e,t){RP.viewLinkManager.exitView().then((function(){e("success")}))}))}},{key:"beginSetEntry",value:function(){var e=this,t=new vt;return console.log("beginSetEntry"),this.settingEntry=!0,this.enterView((function(){t.resolve(),RP.flyToPano({pano:RP.currentPano,quaternion:e.markView.enterQuaternion,rotSpeed:2})})),t.promise()}},{key:"confirmEntry",value:function(){RP.currentPano==this.markView.pano&&(this.markView.pano.quaternion.copy(RP.quaternion),this.markView.enterQuaternion.copy(RP.quaternion),this.markView.mapChangeRot(),this.dispatchEvent({type:"confirmEntry",sid:this.markView.sid,enterQuaternion:RP.quaternion.toArray()}),this.cancelSetEntry())}},{key:"cancelSetEntry",value:function(){this.settingEntry&&(this.settingEntry=!1,this.markView.backToPanorama())}},{key:"beginSetExit",value:function(){var e=this;console.log("beginSetExit");var t=new vt;return this.settingExit=!0,this.enterView((function(){t.resolve(),RP.flyToPano({pano:RP.currentPano,lookAtPoint:e.markView.exitDoor.mesh.position,rotSpeed:2})})),t.promise()}},{key:"confirmExit",value:function(){this.markView.exitDirection=this.markView.exitDoor.mesh.position.clone(),this.dispatchEvent({type:"confirmExit",sid:this.markView.sid,exitDirection:this.markView.exitDirection.toArray()}),"pano"!=this.markView.linkType&&(this.markView.thumbPanoTex&&this.markView.thumbPanoTex.dispose(),this.markView.thumbPanoTex=null),this.cancelSetExit(!0)}},{key:"cancelSetExit",value:function(e){this.settingExit&&(this.settingExit=!1,e||this.markView.exitDoor.mesh.position.copy(this.markView.exitDirection),this.markView.backToPanorama())}},{key:"beginSetVisibleViews",value:function(e){this.markView=RP.viewLinkManager.views[e],enterView((function(){})),this.settingVisibles=!0,this.oldVisibleData=JSON.parse(JSON.stringify(this.markView.visibleViews))}},{key:"addVisibleView",value:function(e,t){console.log("addVisibleView "+e);var n=RP.viewLinkManager.views[e];n.circle.mesh.visible=!0,RP.handleInputStart(t.offsetX,t.offsetY,!0,!0);var i=RP.getMouseIntersect(null,[RP.model.skybox]);n.circle.updatePos("at360View",{viewDir:i.point.clone()}),n.circle.update(RP.camera),this.saveVisibleViews()}},{key:"delVisibleView",value:function(e){delete this.markView.visibleViews[e],RP.viewLinkManager.views[e].circle.mesh.visible=!1,this.saveVisibleViews()}},{key:"saveVisibleViews",value:function(){var e={};for(var t in RP.viewLinkManager.views)RP.viewLinkManager.views[t].circle.mesh.visible&&(e[t]=RP.viewLinkManager.views[t].circle.mesh.position.toArray());this.markView.visibleViews=e}},{key:"cancelVisibleViews",value:function(e){this.markView.visibleViews=this.oldVisibleData,this.markView.backToPanorama(),bus.emit("link/tag/links",{sid:this.markView.sid,visibleViews:this.markView.visibleViews}),this.finishVisibleViews()}},{key:"finishVisibleViews",value:function(){this.settingVisibles=!1,this.markView=null}},{key:"handelClickView",value:function(){if(this.settingPos)return this.confirmPos(),!0}},{key:"dragBalloonStart",value:function(){this.settingPos||(this.beginSetPos("reset"),this.draggingBall=!0,RP.cameraControls.activeControl.enabled=!1)}},{key:"dragExitStart",value:function(){this.settingExit&&(this.draggingExit=!0,RP.cameraControls.activeControl.enabled=!1)}},{key:"dragViewStart",value:function(e){(this.settingVisibles||this.markView&&e==this.markView.circle.mesh)&&(this.draggingCircleAtView=!0,this.draggingMesh=e,RP.cameraControls.activeControl.enabled=!1)}},{key:"handelDragEnd",value:function(e){RP.flying||(this.draggingBall||this.draggingExit||this.draggingCircleAtView)&&(this.draggingBall?(this.draggingBall=!1,this.settingPos&&this.confirmPos(),e.consume()):this.draggingExit?(this.draggingExit=!1,RP.cameraControls.activeControl.pointerDragOn=!1,e.consume()):this.draggingCircleAtView&&(this.draggingCircleAtView=!1,RP.cameraControls.activeControl.pointerDragOn=!1,this.confirmPos(),e.consume()),this.draggingMesh=null,RP.cameraControls.activeControl.enabled=!0)}},{key:"getData",value:function(e){return{sid:this.markView.sid,title:this.markView.titleLabel.text,balloon:{pos:this.markView.balloon.mesh.position.clone()},circle:{pos:this.markView.circle.position.clone(),qua:this.markView.circle.quaternion.clone(),mapOut:this.markView.circle.mesh.material.uniforms.mapOut.value,scale:this.markView.circle.mesh.scale.x},exit:{mapOut:this.markView.exitDoor.mesh.material.uniforms.mapOut.value},exitDirection:this.markView.exitDirection.clone(),enterQuaternion:this.markView.enterQuaternion.clone(),panoImgVersion:this.markView.panoImgVersion,url:this.markView.url,thumbPanoTex:this.markView.thumbPanoTex,linkType:this.markView.linkType,nearestPano:this.markView.nearestPano}}},{key:"showAll",value:function(){var e=this;this.inited?RP.viewLinkManager.showAllViews():setTimeout((function(){e.showAll()}),200)}},{key:"hideAll",value:function(){var e=this;this.inited?RP.viewLinkManager.hideAllViews():setTimeout((function(){e.hideAll()}),200)}},{key:"highlight",value:function(e){var t=RP.viewLinkManager.views,n=t[e];if(!this.markView||n)if(n)n.setSelect(!0);else for(var i in t)t[i].setSelect(!1)}}]),n}();function OP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var VP=function(e){f(n,e);var t=OP(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=vt();return i.filterTemp={},i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).on(zr,(function(e,t){i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(i.filterTemp[t.id]||t.filterEffect)))})),a.resolve()})),i.edit.enter=function(){r?i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(r.currentPano.filterEffect))):a.then((function(){return i.edit.enter()}))},i.edit.startFilter=function(){r.flyToNewMode({mode:"panorama",pano:r.currentPano})},i.edit.brightness=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setX(e),t.uniforms.filterBase1.value.setX(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].brightness=e},i.edit.contrast=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setY(e),t.uniforms.filterBase1.value.setY(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].contrast=e},i.edit.saturation=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setZ(e),t.uniforms.filterBase1.value.setZ(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].saturation=e},i.edit.temperature=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterTemperature0.value=e,t.uniforms.filterTemperature1.value=e,t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].temperature=e},i.edit.clearCurrent=function(){i.edit.brightness(0),i.edit.contrast(0),i.edit.saturation(0),i.edit.temperature(0)},i.edit.applyCurrent2All=function(){var e=i.filterTemp[r.currentPano.id]||r.currentPano.filterEffect;r.model.panos.list.forEach((function(t){t.panoType||(i.filterTemp[t.id]=JSON.parse(JSON.stringify(e)))}))},i.edit.save=function(){var e=[];r.model.panos.list.forEach((function(t){i.filterTemp[t.id]?e.push(Object.assign({id:t.id},i.filterTemp[t.id])):0==t.filterEffect.brightness&&0==t.filterEffect.contrast&&0==t.filterEffect.saturation&&0==t.filterEffect.temperature||e.push(Object.assign({id:t.id},t.filterEffect))}));var t=h(i);return{data:e,successCallBack:function(){Object.keys(t.filterTemp).forEach((function(e){r.model.panos.index[e].filterEffect=t.filterTemp[e]})),i.getPanoMaterials().forEach((function(e){r.currentPano.hasFilter?e.defines.hasFilter=!0:delete e.defines.hasFilter,e.needsUpdate=!0})),t.filterTemp={}}}},i.edit.undoEdit=function(){i.filterTemp={};var e=r.currentPano.filterEffect;i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.set(e.brightness,e.contrast,e.saturation),t.uniforms.filterBase1.value.set(e.brightness,e.contrast,e.saturation),t.uniforms.filterTemperature0.value=e.temperature,t.uniforms.filterTemperature1.value=e.temperature,r.currentPano.hasFilter?t.defines.hasFilter=!0:delete t.defines.hasFilter,t.needsUpdate=!0})),i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(e)))},i}return u(n,[{key:"initFilters",value:function(){var e=this,t=function(t){t.forEach((function(t){var n=t.id,i=e.app.core.get("Player").model.panos.index[n];i&&(delete t.id,i.filterEffect=t)}))},n=this.app.store.getValue("filters");n?t(n):this.app.store.on("filters",(function(n){t(n);var i=e.app.core.get("Player");e.updatePanoFilters(i.currentPano,i.currentPano)}))}},{key:"updatePanoFilters",value:function(e,t){var n=this.filterTemp[e.id]||e.filterEffect,i=this.filterTemp[t.id]||t.filterEffect;this.getPanoMaterials().forEach((function(o){o.uniforms.filterBase0.value.set(n.brightness,n.contrast,n.saturation),o.uniforms.filterTemperature0.value=n.temperature,o.uniforms.filterBase1.value.set(i.brightness,i.contrast,i.saturation),o.uniforms.filterTemperature1.value=i.temperature,e.hasFilter||t.hasFilter?o.defines.hasFilter=!0:delete o.defines.hasFilter,o.needsUpdate=!0}))}},{key:"getPanoMaterials",value:function(){var e=this.app.core.get("Player"),t=[this.app.core.get("QuickstartManager").skybox.material].concat(H(e.model.chunks.map((function(e){return e.materialInside}))));return e.model.skybox&&t.push(e.model.skybox.material),e.model.highMapCube&&t.push.apply(t,H(e.model.highMapCube.tiles.map((function(e){return e.material})))),t}}]),n}(vo);function _P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var UP,NP,zP=function(e){f(n,e);var t=_P(n);function n(){var e;return o(this,n),(e=t.call(this)).sourceApp=null,e.targetApp=null,e.player1=null,e.player2=null,e}return u(n,[{key:"bind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{sourceApp:null,targetApp:null};e.sourceApp?(this.sourceApp=e.sourceApp,this.player1=this.sourceApp.core.get("Player")):e.targetApp&&(this.targetApp=e.targetApp,this.player2=this.targetApp.core.get("Player")),this.sourceApp&&this.targetApp&&this.init()}},{key:"init",value:function(){this.player1.model.panos.list.length&&this.player2.model.panos.list.length&&(this.diffLon=this.computeAveDiffLon(),this.diffQuaternion=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),this.diffLon),this.diffQuaternionInvert=this.diffQuaternion.clone().invert())}},{key:"computeAveDiffLon",value:function(){for(var e=this,t=0,n=[],i=Object.keys(this.panoMapping.mapping),o=i.map((function(t){return e.player1.model.panos.index[t].position})),r=i.map((function(t){var n=e.panoMapping.mapping[t];return e.player2.model.panos.index[n].position})),a=i.length,s=0;s<a;){var l=(new THREE.Vector3).copy([s]),c=(new THREE.Vector3).copy(o[(s+1)%a]),u=(new THREE.Vector3).copy(r[s]),h=(new THREE.Vector3).copy(r[(s+1)%a]),d=(new THREE.Vector3).subVectors(l,c).setY(0),p=(new THREE.Vector3).subVectors(u,h).setY(0),f=he.getAngle(d,p,"z");n.push(f),t+=f,s++}return console.log("diffLons",n),t/=a,console.log("diffLonAve",t),t}},{key:"applyDiff",value:function(e){if(this.player1&&this.player2&&this.targetApp.config.num!=this.sourceApp.config.num&&this.player1.mode==this.player2.mode){var t,n,i;e==this.sourceApp?(t=this.player1,n=this.player2,i=this.diffQuaternion):(t=this.player2,n=this.player1,i=this.diffQuaternionInvert);var o=t.cameraControls.activeControl,r=n.cameraControls.activeControl;if(t.quaternion.copy(n.quaternion).premultiply(i),"panorama"==t.mode){var a=(new THREE.Vector3).subVectors(r.target,n.position);a.applyQuaternion(i);var s=(new THREE.Vector3).addVectors(t.position,a);o.lookAt(s),o.target.copy(s)}else if(r){var l=(new THREE.Vector3).subVectors(r.target,n.model.panos.list[0].position);l.applyQuaternion(i),o.target.addVectors(t.model.panos.list[0].position,l),t.target.copy(o.target);var c=(new THREE.Vector3).subVectors(r.camera.position,r.target);c.applyQuaternion(i),t.position=(new THREE.Vector3).addVectors(o.target,c),o.camera.position.copy(t.position)}o.camera.quaternion.copy(t.quaternion)}}}]),n}(vo);function GP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var jP=function(e){f(n,EventEmitter);var t=GP(n);function n(e){var i;return o(this,n),(i=t.call(this)).ctx=e,i.app=e.app,i.player=null,i.events={movePos:function(e){if(e.reCompute)var t=NP;else{if(!i.dragging)return;if(!(t=UP.getMouseIntersect(null,UP.getColliders())))return}var n=i.getPoseByIntersect(t),o=n.position,r=n.quaternion,a=n.faceAngle2;i.editPlane.position.copy(o),i.editPlane.quaternion.copy(r),i.editPlane.faceAngle2=a,i.editPlane.getIsLieDown()&&i.editPlane.updateLabelPose(),i.editPlane.homePanoId=UP.currentPano.id,i.emit("dragPos",{panoId:UP.currentPano.id})},confirmPos:function(e){e.consume(),i.confirmPos()},dragStart:function(e){i.editPlane&&UP.OverlayManager.hoveringPlane==i.editPlane&&(UP.cameraControls.activeControl.enabled=!1,UP.cameraControls.activeControl.pointerDragOn=!1,i.dragging=!0,e.consume())},dragEnd:function(e){i.dragging&&(i.dragging=!1,e.consume(),UP.cameraControls.activeControl.enabled=!0)}},i}return u(n,[{key:"waitReady",value:function(e){UP?e():this.once("ready",e)}},{key:"enter",value:function(e){var t=this;this.entered||(this.entered=!0,this.waitReady((function(){e&&e(),t.entered&&(UP.on("pointerStart",t.events.dragStart),UP.on("pointerMove",t.events.movePos),UP.on("pointerUp",t.events.dragEnd))})))}},{key:"leave",value:function(){this.endAddPlane(),this.undoEdit(),this.editPlane&&(this.editPlane.isEditing=!1,UP.OverlayManager.highlight(null)),this.editPlane=null,this.entered=!1,UP.off("pointerStart",this.events.dragStart),UP.off("pointerUp",this.events.dragEnd),UP.off("pointerMove",this.events.movePos)}},{key:"reEdit",value:function(e){var t=this;this.enter((function(){var n=t.ctx.get(e);t.updateEditPlane(n),UP.OverlayManager.clickOverlay(n,{dontEmit:!0,forceFlyToPlane:!0})}))}},{key:"undoEdit",value:function(){if(this.editPlane){var e=this.editPlane;"new"==e.info.modified?this.dispose(e.sid):e.setFromInfo(e.info)}}},{key:"save",value:function(){var e=this;console.log("save");var t=this.editPlane;return{done:function(){t.info.modified="old",t.info.width=t.width,t.info.height=t.height,t.info.pos=t.position.clone(),t.info.qua=t.quaternion.clone(),t.info.faceAngle=t.faceAngle,t.info.scaleRatio=t.scaleRatio,t.info.title=t.titleLabel.text,t.info.media=t.plane.material.map.image,t.info.targetPano=t.targetPano,t.info.icon=t.getMapName(),t.info.panoId=t.homePanoId,t.raycastToFindFloor(),t.updateVisibleOnFloor(),e.leave()},info:{width:he.toPrecision(t.width,4),height:he.toPrecision(t.height,4),pos:he.toPrecision(t.position.toArray(),4),qua:he.toPrecision(t.quaternion.toArray(),4)}}}},{key:"add",value:function(e){e&&e.sid&&(this.ctx.list.push(e),Ae.updateVisible(e.titleLabel,"onShow",!!this.showTitles))}},{key:"clear",value:function(){this.ctx.list=[]}},{key:"dispose",value:function(e){var t=this.ctx.get(e);if(t){t.titleLabel.dispose(),t.dispose();var n=this.ctx.list.indexOf(t);this.ctx.list.splice(n,1)}}},{key:"changeTitlesShow",value:function(e){this.showTitles=!!e,this.ctx.list.forEach((function(t){Ae.updateVisible(t.titleLabel,"onShow",e)}))}},{key:"highlight",value:function(e){var t=this.ctx.get(e);UP.OverlayManager.highlight(t)}},{key:"beginToAddPlane",value:function(){var e=this;this.enter((function(){UP.viewLinkManager.exitView(),UP.reticule.visible=!1,e.isAdding=!0,os.add("addOverlay")}))}},{key:"endAddPlane",value:function(){this.isAdding=!1,os.remove("addOverlay"),UP.reticule.visible=!0}},{key:"updateEditPlane",value:function(e){this.editPlane=e,e.isEditing=!0,UP.OverlayManager.highlight(e)}},{key:"getPoseByIntersect",value:function(e){var t=e.face.normal.clone();UP.getMouseDirection().angleTo(e.face.normal)<Math.PI/2&&t.negate();var n,i=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(t,$i.ZERO,$i.UP)),o=e.point.clone().add(t.multiplyScalar(.01));if(ZP(i)){var r=e.face.normal.clone().setY(0),a=(new THREE.Vector3).subVectors(o,UP.position).setY(0).normalize();0==r.x&&0==r.z&&(r.z=1),n=he.getAngle(r,a,"y")-Math.PI/2;var s=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1),n);i.multiply(s)}return{position:o,quaternion:i,faceAngle2:n}}},{key:"startInsertion",value:function(e){var t=this,n=e.intersect,i=this.getPoseByIntersect(n),o=i.position,r=i.quaternion,a=i.faceAngle2,s=new qP(UP,{sid:Ae.getRandomSid(),pos:o,qua:r,modified:"new"});s.faceAngle=0,s.faceAngle2=a,s.updateMatrixWorld(),this.emit("createBill",{sid:s.sid,panoId:UP.currentPano.id}),UP.OverlayManager.clickOverlay(s,{dontEmit:!0,forceFlyToPlane:!0,afterFly:function(e){setTimeout((function(){t.events.movePos({reCompute:!0})}),1)}}),NP=n,this.updateEditPlane(s),this.add(s),this.endAddPlane()}},{key:"setScale",value:function(e){this.editPlane.setScale(e)}},{key:"setRotation",value:function(e){this.editPlane.setRotation(e)}},{key:"setJumpPano",value:function(e){console.log("setJumpPano",e),this.editPlane.targetPano=e}},{key:"setMap",value:function(e,t){var n=t?this.ctx.get(t):this.editPlane;n.setMap(e),this.editPlane&&this.editPlane==n||(n.info.icon=n.getMapName())}},{key:"setTitle",value:function(e){this.editPlane.setTitle(e)}},{key:"cancel",value:function(){this.leave()}},{key:"flyToBillBoard",value:function(e){var t=e?this.ctx.get(e):this.editPlane;UP.OverlayManager.clickOverlay(t,{dontEmit:!0,forceFlyToPlane:!0})}}]),n}(),WP=["style-1","style-2","style-3"],qP=function(e){f(n,e);var t=GP(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,n),r.media=["photo"],r.isBillboard=!0,r.faceAngle=r.faceAngle||0,r.scaleRatio=r.scaleRatio||100,(i=t.call(this,e,r)).plane.material.side=THREE.DoubleSide,i.titleLabel=new Ki({text:r.title,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:De-1,margin:{x:12,y:10},player:e,fixOrient:!0}),i.titleLabel.sprite.material.depthTest=!0;var a=.3;return i.titleLabel.scale.set(a,a,a),i.add(i.titleLabel),i.addEventListener("mapLoaded",(function(){var t=i.plane.material.map;t.needsUpdate=!0,i.setScale(),t.dispose();e.$app.core.get("SceneRenderer").on(aa,(function n(){t._listeners&&t._listeners.dispose&&t._listeners.dispose.length&&(t.anisotropy=4,t.needsUpdate=!0,e.$app.core.get("SceneRenderer").off(aa,n))}))})),i.addEventListener("lieDownChanged",(function(){i.updateLabelPose()})),i}return u(n,[{key:"setFromInfo",value:function(e){At(w(n.prototype),"setFromInfo",this).call(this,e),this.plane.scale.copy(this.scale),this.scale.set(1,1,1),this.setTitle(e.title),this.targetPano=e.targetPano,this.homePanoId=e.panoId,this.scaleRatio=e.scaleRatio,this.setRotation(e.faceAngle),this.setMap(e.icon)}},{key:"setRotation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.faceAngle=e,this.plane.quaternion.setFromAxisAngle(new THREE.Vector3(0,0,1),THREE.MathUtils.degToRad(-e)),this.updateLabelPose()}},{key:"setScale",value:function(e){if(null==e&&(e=this.scaleRatio),this.scaleRatio=e,this.plane.material.map.image.width){var t=this.plane.material.map.image,n=t.width,i=t.height;this.width=n/512*e/100,this.height=i/512*e/100,this.plane.scale.set(this.width/Je.overlay.width,this.height/Je.overlay.height),this.updateLabelPose()}}},{key:"getFaceAngle2",value:function(e){if(null!=this.faceAngle2)return this.faceAngle2;e||(e=new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion));var t=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(e,$i.ZERO,$i.UP)),n=this.quaternion.clone().premultiply(t.invert());this.faceAngle2=(new THREE.Euler).setFromQuaternion(n).z}},{key:"updateLabelPose",value:function(){if(this.titleLabel){if(this.titleLabel.rotation.z=0,this.getIsLieDown()){var e=THREE.MathUtils.degToRad(-this.faceAngle),t=UP.getDirection().negate(),n=Math.atan2(t.x,t.z),i=new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion),o=this.getFaceAngle2(i);e-=n-=Math.atan2(i.x,i.z)+o;var r=(this.height*Math.abs(Math.cos(e))+this.width*Math.abs(Math.sin(e)))/2+.1,a=-r*Math.sin(-n),s=-r*Math.cos(-n);this.titleLabel.position.set(a,s,0),this.titleLabel.rotation.z=n}else{var l=THREE.MathUtils.degToRad(-this.faceAngle),c=(this.height*Math.abs(Math.cos(l))+this.width*Math.abs(Math.sin(l)))/2+.1;this.titleLabel.position.set(0,-c,0)}}}},{key:"setTitle",value:function(e){this.titleLabel&&this.titleLabel.setText(e)}},{key:"setMap",value:function(e){this.plane.material.map.image.src=this.getMapSrc(e),this.plane.material.map.anisotropy=0}},{key:"getMapSrc",value:function(e){if(e&&"blob:"==e.slice(0,5))return e;var t=e||this.info.icon||WP[0];return WP.includes(t)?UP.$app.resource.getAppURL("images/billboard/".concat(t,".png")):(1==t.split(".").length&&(t+=".png"),UP.$app.resource.getUserResourceURL(t))}},{key:"getMapName",value:function(){var e=this.plane.material.map.image.src;return"blob:"==e.slice(0,5)?e:e.split("/").pop().split(".")[0]}},{key:"getIsLieDown",value:function(){var e=this.lieDown;return this.lieDown=ZP(this.quaternion),this.lieDown!=e&&this.dispatchEvent({type:"lieDownChanged"}),this.lieDown}}]),n}(is),JP=K("list"),YP=function(){function e(t){var n=this;o(this,e),Object.defineProperty(this,JP,{writable:!0,value:[]}),this.app=t,this.app.store.on("billboards",(function(e){console.error(e),(e.tags||e).forEach((function(e){e.panoId in UP.model.panos.index&&(e=Ae.CloneJson(e),n.manager.add(new qP(UP,e)))}))})),this.manager=new jP(this),this.app.Scene.on("loaded",(function(){(UP=n.app.core.get("Player")).billboardManager=n.manager,n.manager.emit("ready"),n.app.store.getValue("metadata").controls.showBillboardTitle&&n.manager.changeTitlesShow(!0),UP.on("view.changed",(function(e){"panorama"!=UP.mode&&"floorplan"!=UP.mode||!e.cameraWorldMatrixChanged||n.list.forEach((function(e){e.lieDown&&e.updateLabelPose()}))}))}))}return u(e,[{key:"list",get:function(){return Z(this,JP)[JP]}},{key:"get",value:function(e){return Z(this,JP)[JP].find((function(t){return t.sid==e}))}}]),e}();function ZP(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);return Math.abs(t.y)>.9}function XP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var KP=function(e){f(n,THREE.Mesh);var t=XP(n);function n(e,i){var r;o(this,n);var a=new THREE.BoxGeometry(i,i,i),s=new THREE.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.1,side:THREE.DoubleSide}),l=new THREE.MeshBasicMaterial({color:255,transparent:!0,opacity:.1,side:THREE.DoubleSide});r=e?t.call(this,a,l):t.call(this,a,s);var c=new THREE.EdgesGeometry(a),u=new THREE.LineSegments(c,new THREE.LineBasicMaterial({color:16777215}));return r.add(u),r.material0=s,r.material1=l,r.name=e?"clipOutSideBox":"clipInsideBox",r.clipType=e,r.isClipBox=!0,r.renderOrder=Ne,y(r)}return n}();function $P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var eR=function(e){f(n,e);var t=$P(n);function n(e){var i;return o(this,n),(i=t.call(this)).updateMaterials=function(){console.log("tileLoading"),i.materials.length=0,i.player.model.chunks.forEach((function(e){return i.materials.push(e.materialOutside)})),i.materials.forEach((function(e){return e.uniforms.clipBoxType.value=i.clipBoxType,e.needsUpdate=!0})),i.materials.forEach((function(e){return e.uniforms.clipBoxPoints.value=i.clipBoxPoints,e.needsUpdate=!0})),i.defineHasClip(!0)},i.bindEvents=function(){i.player.on("pointerStart",i.onMouseDown),i.player.on("pointerMove",i.onMouseMove),i.player.on("pointerUp",i.onMouseUp),i.player.on("moveModel",i.onZoom),i.player.model.transformControls.addEventListener("mousing",i.updateClipBox),i.player.model.transformControls.addEventListener("mouseUp",i.updateClipBox),i.player.model.transformControls.switchEditState("clipbox"),i.player.model._3dTilesRuntime&&i.player.model._3dTilesRuntime.getTileset().on("endTileLoading",i.updateMaterials)},i.unBindEvents=function(){i.player.off("pointerStart",i.onMouseDown),i.player.off("pointerMove",i.onMouseMove),i.player.off("pointerUp",i.onMouseUp),i.player.off("moveModel",i.onZoom),i.player.model.transformControls.removeEventListener("mousing",i.updateClipBox),i.player.model.transformControls.removeEventListener("mouseUp",i.updateClipBox)},i.onMouseDown=function(){i.mousedown.copy(i.player.mouse)},i.onMouseUp=function(){if(i.mouseup.copy(i.player.mouse),!Math.abs(i.mousedown.x-i.mouseup.x>0)&&!Math.abs(i.mousedown.y-i.mouseup.y>0))if(i.adding)i.adding=!1,i.player.model.transformControls.attach(i.activeBox),i.clipBoxType[i.clipBoxs.length-1]=i.activeBox.clipType,i.updateClipBox();else{var e=i.player.getMouseIntersect(null,i.clipBoxs);if(e){i.player.model.transformControls.attach(e.object),i.activeBox=e.object;for(var t=0;t<i.clipBoxs.length;t++)if(i.activeBox===i.clipBoxs[t]){i.activeBoxIndex=t;break}}}},i.onMouseMove=function(){if(i.adding)i.activeBox.position.copy(i.player.reticule.position);else{var e=i.player.getMouseIntersect(null,i.clipBoxs);e?null===i.touchBox?(i.touchBox=e.object,i.touchBox.material.opacity=.2):e.object!==i.touchBox&&(i.touchBox.material.opacity=.1,i.touchBox=e.object,i.touchBox.material.opacity=.2):i.touchBox&&(i.touchBox.material.opacity=.1,i.touchBox=null)}},i.onZoom=function(){if(i.adding){var e=i.player.camera.position.distanceTo(new THREE.Vector3(0,0,0))/(2.5*i.boxSize);i.activeBox.scale.set(e,e,e)}},i.app=e,i.player=null,i.boxSize=1,i.deferred=vt(),i.clipBoxs=[],i.clipBoxGroup=new THREE.Group,i.clipBoxType=new Array(10).fill(-1),i.clipBoxPoints=[],i.activeBoxIndex=null,i.activeBox=null,i.touchBox=null,i.adding=!1,i.materials=[],i.mousedown=new THREE.Vector3,i.mouseup=new THREE.Vector3,i.init=function(e){var t=new THREE.Vector3;i.boxSize=i.player.model.boundingBox.getSize(t).distanceTo(new THREE.Vector3(0,0,0))/10;for(var n=0;n<10;n++)i.clipBoxPoints.push(new THREE.Vector3(i.boxSize/2,-i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,i.boxSize/2));if(e.cutModelList){i.clipBoxType=e.cutModelList.clipBoxType;for(var o=e.cutModelList.clipMatrixs,r=0;r<o.length;r++){var a=new KP(i.clipBoxType[r],i.boxSize),s=new THREE.Matrix4;s.fromArray(o[r]),a.applyMatrix4(s),i.clipBoxPoints[4*i.activeBoxIndex]=new THREE.Vector3(i.boxSize/2,-i.boxSize/2,-i.boxSize/2).applyMatrix4(s),i.clipBoxPoints[4*i.activeBoxIndex+1]=new THREE.Vector3(-i.boxSize/2,i.boxSize/2,-i.boxSize/2).applyMatrix4(s),i.clipBoxPoints[4*i.activeBoxIndex+2]=new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,-i.boxSize/2).applyMatrix4(s),i.clipBoxPoints[4*i.activeBoxIndex+3]=new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,i.boxSize/2).applyMatrix4(s),i.clipBoxs.push(a),i.clipBoxGroup.add(a)}}i.player.model.add(i.clipBoxGroup),i.player.model.chunks.forEach((function(e){return i.materials.push(e.materialOutside)})),i.materials.forEach((function(e){return e.uniforms.clipBoxType.value=i.clipBoxType,e.needsUpdate=!0})),i.materials.forEach((function(e){return e.uniforms.clipBoxPoints.value=i.clipBoxPoints,e.needsUpdate=!0}))},i.app.Scene.on("loaded",(function(){i.player=i.app.core.get("Player");var e=i.app.store.getValue("metadata");e?i.init(e):i.app.store.on("metadata",i.init),i.deferred.resolve()})),i.enterModule=function(){i.player.mode!==ht.DOLLHOUSE&&i.player.flyToNewMode({mode:ht.DOLLHOUSE}),i.setAllClipBoxVisible(!0),i.bindEvents(),i.player.locked=!0},i.leaveModule=function(){i.setAllClipBoxVisible(!1),i.player.model.transformControls.detach(),i.unBindEvents(),i.player.locked=!1},i.addClipBox=function(e){if(!i.adding){i.defineHasClip(!0);var t=new KP(e,i.boxSize);i.activeBoxIndex=i.clipBoxs.length,i.activeBox=t,i.clipBoxs.push(t),i.clipBoxGroup.add(t),i.adding=!0,i.onZoom()}},i.deleteClipBox=function(e){console.log(e),void 0===e&&(e=i.activeBoxIndex),i.player.model.transformControls.detach(),setTimeout((function(){i.player.model.transformControls.detach()}),0),e===i.activeBoxIndex&&(i.activeBox=null,i.activeBoxIndex=null),i.clipBoxGroup.remove(i.clipBoxGroup.children[e]),i.clipBoxs.splice(e,1),i.clipBoxType.splice(e,1),i.clipBoxType.push(-1),i.clipBoxPoints.splice(4*e,4),i.clipBoxPoints.push(new THREE.Vector3(i.boxSize/2,-i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,-i.boxSize/2)),i.clipBoxPoints.push(new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,i.boxSize/2))},i.clearClipBoxs=function(){for(var e=i.clipBoxs.length,t=0;t<e;t++)i.deleteClipBox(0);i.clipBoxGroup.children=[]},i.changeClipBoxType=function(e){0===i.clipBoxType[e]?i.clipBoxType[e]=1:i.clipBoxType[e]=0,0===i.clipBoxType[e]?i.clipBoxs[e].material=i.clipBoxs[e].material0:i.clipBoxs[e].material=i.clipBoxs[e].material1},i.focusClipBox=function(e){i.activeBoxIndex=e,i.activeBox=i.clipBoxs[e],i.player.model.transformControls.attach(i.activeBox)},i.updateClipBox=function(){if(i.activeBox){var e=i.clipBoxs[i.activeBoxIndex].matrix;i.clipBoxPoints[4*i.activeBoxIndex]=new THREE.Vector3(i.boxSize/2,-i.boxSize/2,-i.boxSize/2).applyMatrix4(e),i.clipBoxPoints[4*i.activeBoxIndex+1]=new THREE.Vector3(-i.boxSize/2,i.boxSize/2,-i.boxSize/2).applyMatrix4(e),i.clipBoxPoints[4*i.activeBoxIndex+2]=new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,-i.boxSize/2).applyMatrix4(e),i.clipBoxPoints[4*i.activeBoxIndex+3]=new THREE.Vector3(-i.boxSize/2,-i.boxSize/2,i.boxSize/2).applyMatrix4(e)}},i.saveEdit=function(){console.log("save");for(var e=[],t=0;t<i.clipBoxs.length;t++)e.push(i.clipBoxs[t].matrix.toArray());return{clipBoxType:i.clipBoxType,clipMatrixs:e}},i.cancelEdit=function(){i.clipBoxs=[],i.clipBoxGroup.children=[],i.clipBoxPoints=[],i.clipBoxType=new Array(10).fill(-1);var e=i.app.store.getValue("metadata");i.init(e)},i.setAllClipBoxVisible=function(e){i.clipBoxGroup.visible=e},i.switchTransformControlsMode=function(e){0==parseInt(e)&&(e="translate"),1==parseInt(e)&&(e="rotate"),2==parseInt(e)&&(e="scale"),i.player.model.transformControls.mode=e},i}return u(n,[{key:"defineHasClip",value:function(e){var t=this;this.materials.length=0,this.player.model.chunks.forEach((function(e){return t.materials.push(e.materialOutside)})),e?this.materials.forEach((function(e){return e.defines.HasClip=!0,e.needsUpdate=!0})):this.materials.forEach((function(e){return delete e.defines.HasClip,e.needsUpdate=!0}))}}]),n}(vo),tR=function(e){return Xn.get("/service/scene/getInfo",e)},nR=Object.freeze({__proto__:null,uploadBodySegment:function(e){return Xn.postFile("/service/scene/uploadBodySegment",e)},downLoadZSData:function(e){return Xn.postFile("/service/scene/downLoadZSData",e)},getBodySegmentStatus:function(e){return Xn.postFile("/service/scene/getBodySegmentStatus",e)},check_key:function(e){return Xn.post("/service/scene/check/key",e)},getInfo:tR}),iR=function(e){return Xn.post("/service/scene/edit/base/save",e)},oR=function(e){return Xn.post("/service/scene/edit/cad/rename",e)},rR=function(e){return Xn.post("/service/scene/edit/publicScene",e)},aR=function(e){return Xn.get("/service/scene/edit/getInfo",e)},sR=function(e){return Xn.post("/service/scene/edit/cad/save",e)},lR=function(e){return Xn.postFile("/service/scene/edit/cad/reset",e)},cR=Object.freeze({__proto__:null,tour_video_upload:function(e){return Xn.postFile("/service/scene/edit/tour/video/upload",e)},tour_video_download:function(e){return Xn.postFile("/service/scene/edit/tour/video/download",e)},tour_save:function(e){return Xn.post("/service/scene/edit/tour/save",e)},tour_delete:function(e){return Xn.post("/service/scene/edit/tour/delete",e)},locales:function(e){return Xn.post("/service/scene/edit/locales",e)},upload_content:function(e){return Xn.post("/service/scene/edit/upload/content",e)},getAuth:function(e){return Xn.postFile("/service/scene/edit/getAuth",e)},getAsynOperLog:function(e){return Xn.post("/service/scene/edit/getAsynOperLog",e)},getServiceUpTip:function(e){return Xn.get("/service/scene/edit/getServiceUpTip",e)},saveInitialPage:function(e){return Xn.post("/service/scene/edit/saveInitialPage",e)},uploadShareLogo:function(e){return Xn.postFile("/service/scene/edit/uploadShareLogo",e)},waterMark_add:function(e){return Xn.post("/service/scene/edit/waterMark/add",e)},waterMark_delete:function(e){return Xn.post("/service/scene/edit/waterMark/delete",e)},linkPan_upload:function(e){return Xn.postFile("/service/scene/edit/linkPan/upload",e)},linkPan_save:function(e){return Xn.post("/service/scene/edit/linkPan/save",e)},linkPan_delete:function(e){return Xn.post("/service/scene/edit/linkPan/delete",e)},styles_delete:function(e){return Xn.post("/service/scene/edit/styles/delete",e)},linkPan_list:function(e){return Xn.postFile("/service/scene/edit/linkPan/list",e)},base_save:iR,cad_rename:oR,icons_delete:function(e){return Xn.post("/service/scene/edit/icons/delete",e)},filter_save:function(e){return Xn.post("/service/scene/edit/filter/save",e)},uploadROIFilter:function(e){return Xn.post("/service/scene/edit/uploadROIFilter",e)},filter_list:function(e){return Xn.post("/service/scene/edit/filter/list",e)},billboards_save:function(e){return Xn.post("/service/scene/edit/billboards/save",e)},billboards_list:function(e){return Xn.post("/service/scene/edit/billboards/list",e)},billboards_delete:function(e){return Xn.post("/service/scene/edit/billboards/delete",e)},billboards_styles_delete:function(e){return Xn.post("/service/scene/edit/billboards/styles/delete",e)},surveillance_save:function(e){return Xn.post("/service/scene/edit/surveillance/save",e)},surveillance_delete:function(e){return Xn.post("/service/scene/edit/surveillance/delete",e)},surveillance_list:function(e){return Xn.post("/service/scene/edit/surveillance/list",e)},model_box_upload:function(e){return Xn.postFile("/service/scene/edit/model/box/upload",e)},model_box_save:function(e){return Xn.post("/service/scene/edit/model/box/save",e)},photo_box_save:function(e){return Xn.post("/service/scene/edit/photo/box/save",e)},model_box_delete:function(e){return Xn.post("/service/scene/edit/model/box/delete",e)},photo_box_delete:function(e){return Xn.post("/service/scene/edit/photo/box/delete",e)},mosaics_delete:function(e){return Xn.post("/service/scene/edit/mosaics/delete",e)},mosaics_add:function(e){return Xn.post("/service/scene/edit/mosaics/add",e)},mosaics_list:function(e){return Xn.post("/service/scene/edit/mosaics/list",e)},publicScene:rR,upload_files:function(e){return Xn.postFile("/service/scene/edit/upload/files",e)},delete_file:function(e){return Xn.post("/service/scene/edit/delete/file",e)},saveUpload:function(e){return Xn.post("/service/scene/edit/saveUpload",e)},getInfo:aR,saveRoam:function(e){return Xn.post("/service/scene/edit/saveRoam",e)},saveTagsVisible:function(e){return Xn.post("/service/scene/edit/saveTagsVisible",e)},cad_save:sR,tag_save:function(e){return Xn.post("/service/scene/edit/tag/save",e)},tag_delete:function(e){return Xn.post("/service/scene/edit/tag/delete",e)},uploadPanorama:function(e){return Xn.postFile("/service/scene/edit/uploadPanorama",e)},uploadModel:function(e){return Xn.postFile("/service/scene/edit/uploadModel",e)},downloadModel:function(e){return Xn.postFile("/service/scene/edit/downloadModel",e)},tag_list:function(e){return Xn.postFile("/service/scene/edit/tag/list",e)},cad_reset:lR,downloadPanorama:function(e){return Xn.post("/service/scene/edit/downloadPanorama",e)},video_box_save:function(e){return Xn.post("/service/scene/edit/video/box/save",e)},video_box_delete:function(e){return Xn.post("/service/scene/edit/video/box/delete",e)},uploadBallScreenVideo:function(e){return Xn.postFile("/service/scene/edit/uploadBallScreenVideo",e)},downloadBallScreenVideo:function(e){return Xn.post("/service/scene/edit/downloadBallScreenVideo",e)},sceneSync:function(e){return Xn.postFile("/service/scene/edit/sceneSync",e)}});function uR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function hR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uR(Object(n),!0).forEach((function(t){th(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uR(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var dR=function(e){return{info:function(){return tR(e)}}},pR=function(e){return{info:function(){return aR(e)},publish:function(){return rR(e)},save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return iR(hR(hR({},e),t))},cad_save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return sR(hR(hR({},e),t))},cad_reset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return lR(hR(hR({},e),t))},cad_rename:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return oR(hR(hR({},e),t))}}};function fR(e){e.APIs=function(e){var t={num:e.config.num,get rnd(){return Date.now()}};return{viewer:dR(t),editor:pR(t)}}(e),e.Scene=new Ok(e),e.Camera=new qB(e),e.MinMap=new Vk(e),e.DataSYNC=new _k(e),e.MarkManager=new zk(e),e.TagManager=new Xk(e),e.CadManager=new Kk(e),e.VideoManager=new tP(e),e.WalkManager=new iP(e),e.RepairManager=new rP(e),e.ClipBoxManager=new eR(e),e.TourManager=new uP(e),e.Editor=new vP(e),e.Connect=new DP(e),e.Billboard=new YP(e),e.Screenshot=new mP(e),e.ViewLinkEdit=new QP(e),e.FilterManager=new VP(e),e.ConvertViews=new zP}var mR={pointFrom2DTo3D(e,t,n,i){var o=e.x,r=e.y;n||(n=t.camera),i||(i=t.domElement);var a=new THREE.Vector3(0,0,0);return he.convertScreenPositionToNDC(o,r,a,i),a.unproject(n),a.y=0,a},pointFrom3DTo2D(e,t,n,i){var o=e;return n||(n=t.camera),i||(i=t.domElement),e instanceof THREE.Vector3==!1&&(o=new THREE.Vector3(o.x||0,o.y||0,o.z||0)),tt.getPos2d(o,t,n,i).pos}};function vR(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return gR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gR(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function gR(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function AR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var yR=function(e){f(n,e);var t=AR(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).withComponent("store"),i.withComponent("resource"),i.withComponent("Scene"),i.config.dom&&i.withDom(),i.remote_editor=cR,i.remote_viewer=nR,fR(h(i)),function(e){e&&!Zn&&(Yn=e.config,Zn=e,(Jn=qn.create({baseURL:Yn.server||""})).interceptors.request.use((function(e){if(-1!=e.url.indexOf("/service/")){var t=Ce.valueFromUrl("token")||localStorage.getItem("token")||"";t&&(e.headers.token=t)}return e}),(function(e){return Promise.reject(e)})),Jn.interceptors.response.use((function(e){if(!/json/gi.test(e.headers["content-type"]))return e.data;if("arraybuffer"===e.request.responseType){var t=new TextDecoder("utf-8");return JSON.parse(t.decode(new Uint8Array(e.data)))}return Zn&&!1===e.data.success&&Zn.Scene.emit("error",{type:"network",code:e.data.code,message:e.data.message}),e.data}),(function(e){if(Zn){var t=null;t=e.response&&e.response.data?e.response.data:{code:500,message:e},e.config&&-1==e.config.url.indexOf("data/mapping")&&-1==e.config.url.indexOf("floorplan.json")&&Zn.Scene.emit("error",{type:"network",code:t.code,message:t.message})}return e.response&&e.response.data?Promise.reject(e.response):Promise.reject(e)})))}(h(i)),i.config.useStatistics&&(window._hmt=window._hmt||[],function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?aa59943d9a481ab824cf054f2d463ca2";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()),i}return u(n,[{key:"use",value:function(e,t){var n=this;return"string"==typeof e?this.Plugins[e]?Promise.resolve(this.Plugins[e]):function(e,t){return se(ae()+"plugins/"+e+".js",e,t)}(e,this.config.version+"-"+Date.now()).then((function(e){return n.Plugins.add(window[e],t)})):"function"==typeof e?this.Plugins.add(e,t):void 0}},{key:"mount",value:function(e){if(!e)throw new Error("el must be require");return this.config.dom=e,this.withDom(),this}},{key:"render",value:function(){return this.core.get("Scene").start(),this}},{key:"metadata",value:function(e){return void 0===e?(this.store.set("metadata"),this):this.store.get("metadata")}},{key:"destroy",value:function(){console.log("dispose renderer!");var e=this.core.get("SceneRenderer").scene;this.core.get("SceneRenderer").renderer.dispose(),this.core.get("SceneRenderer").started=!1;var t=function(e){console.log("dispose material!"),e.dispose();for(var t=0,n=Object.keys(e);t<n.length;t++){var i=e[n[t]];i&&"object"==typeof i&&"minFilter"in i&&(console.log("dispose texture!"),i.dispose())}};e.traverse((function(e){if(e.isMesh)if(console.log("dispose geometry!"),e.geometry.dispose(),e.material.isMaterial)t(e.material);else{var n,i=vR(e.material);try{for(i.s();!(n=i.n()).done;){var o=n.value;t(o)}}catch(e){i.e(e)}finally{i.f()}}}))}}]),n}(Ke);return yR.MITT={Emiter:vo},yR.Utils={file:TB,math:he,convert:mR,MathLight:$e},yR.Animate={transitions:pe,easing:de,lerp:It},yR.Viewmode=ht,yR.THREE=THREE,yR.Deferred=vt,window.PetiteVue=bB,yR}));
|