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,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function a(e){C(o,i,r,a,s,"next",e)}function s(e){C(o,i,r,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,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.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 r=t&&t.prototype instanceof v?t:v,o=Object.create(r.prototype),a=new k(i||[]);return o._invoke=function(e,t,n){var i=h;return function(r,o){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===r)throw o;return R()}for(n.method=r,n.arg=o;;){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),o}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,o,(function(){return this}));var E=Object.getPrototypeOf,w=E&&E(E(P([])));w&&w!==n&&i.call(w,o)&&(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(r,o,a,s){var l=u(e[r],e,o);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 r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}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 r=u(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;var o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):o:(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[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function n(){for(;++r<e.length;)if(i.call(e,r))return n.value=e[r],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,r,o){void 0===o&&(o=Promise);var a=new x(c(t,n,i,r),o);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,o,(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 r(i,r){return s.type="throw",s.arg=e,n.next=i,r&&(n.method="next",n.arg=t),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("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 r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.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 r=i.arg;B(n)}return r}}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 Q(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 H(){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=H()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&p(r,n.prototype),r}).apply(null,arguments)}var _=[],z=[];function U(e,t){if(e&&"undefined"!=typeof document){var n,i=!0===t.prepend?"prepend":"append",r=!0===t.singleTag,o="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(r){var a=_.indexOf(o);-1===a&&(a=_.push(o)-1,z[a]={}),n=z[a]&&z[a][i]?z[a][i]:z[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),r=0;r<n.length;r++)e.setAttribute(n[r],t.attributes[n[r]]);var a="prepend"===i?"afterbegin":"beforeend";return o.insertAdjacentElement(a,e),e}}U(":root {\r\n --main-color: #00c8af;\r\n --font-color: #999;\r\n}\r\n\r\n[x-cloak] {\r\n display: none !important;\r\n}\r\n\r\n*,\r\n::before,\r\n::after {\r\n -webkit-appearance: none;\r\n -moz-appearance: none;\r\n appearance: none;\r\n -webkit-tap-highlight-color: rgba(255, 255, 255, 0);\r\n text-rendering: optimizeLegibility !important;\r\n -webkit-font-smoothing: antialiased !important;\r\n}\r\n\r\n.kankan-app {\r\n position: relative;\r\n width: 100%;\r\n height: 100%;\r\n overflow: hidden;\r\n background-color: #292929;\r\n}\r\n\r\n.kankan-app .player {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n z-index: 1;\r\n overflow: hidden;\r\n outline: none;\r\n border: none;\r\n}\r\n\r\n.kankan-app .player[name='copy'] {\r\n display: none;\r\n}\r\n\r\n.kankan-app .player-mark {\r\n display: none;\r\n cursor: grab;\r\n position: absolute;\r\n left: calc(50% - 56px);\r\n top: calc(50% - 56px);\r\n z-index: 999;\r\n width: 102px;\r\n height: 102px;\r\n}\r\n\r\n.kankan-app__split .player {\r\n cursor: crosshair;\r\n}\r\n\r\n.kankan-app__split .player[name='main'] {\r\n width: calc(50% - 1px);\r\n}\r\n\r\n.kankan-app__split .player[name='copy'] {\r\n width: calc(50% - 1px);\r\n display: block;\r\n left: auto;\r\n right: 0;\r\n}\r\n\r\n.kankan-app__split .player-mark {\r\n display: block;\r\n}\r\n\r\n.kankan-app__split [xui_tags] div {\r\n display: none !important;\r\n}\r\n\r\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='main'] {\r\n width: 100%;\r\n height: calc(50% - 1px);\r\n}\r\n\r\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='copy'] {\r\n width: 100%;\r\n height: calc(50% - 1px);\r\n display: block;\r\n top: 50%;\r\n left: auto;\r\n right: 0;\r\n}\r\n\r\n.kankan-app__slide-right {\r\n will-change: transform;\r\n transition: all 0.2s ease-in-out;\r\n}\r\n\r\n.kankan-app__slide-right-enter {\r\n opacity: 1;\r\n transform: translate3d(0, 0, 0);\r\n}\r\n\r\n.kankan-app__slide-right-leave {\r\n opacity: 0;\r\n transform: translate3d(100%, 0, 0);\r\n}\r\n\r\n/* plugins */\r\n.kankan-plugins input {\r\n padding: 0 5px;\r\n width: 100%;\r\n height: 34px;\r\n background: rgba(255, 255, 255, 0.1);\r\n border-radius: 4px;\r\n border: 1px solid rgba(255, 255, 255, 0.2);\r\n outline: none;\r\n color: #fff;\r\n}\r\n\r\n.kankan-plugins input:focus {\r\n border: 1px solid var(--main-color);\r\n}\r\n\r\n.kankan-plugins button {\r\n cursor: pointer;\r\n width: 100%;\r\n height: 34px;\r\n outline: none;\r\n border-radius: 4px;\r\n font-size: 14px;\r\n background: none !important;\r\n transition: all 0.3s ease;\r\n color: var(--main-color);\r\n border: 1px solid var(--main-color);\r\n}\r\n\r\n/* xui */\r\n.kankan-app_combox {\r\n cursor: pointer;\r\n position: relative;\r\n background: #323233;\r\n border-radius: 4px;\r\n border: 1px solid rgba(255, 255, 255, 0.2);\r\n outline: none;\r\n color: #fff;\r\n height: 34px;\r\n width: 100%;\r\n}\r\n\r\n.kankan-app_combox .inner-icon {\r\n cursor: pointer;\r\n font-size: 12px;\r\n position: absolute;\r\n right: 5px;\r\n top: 50%;\r\n transform: translateY(-50%);\r\n color: var(--font-color);\r\n}\r\n\r\n.kankan-app_combox .inner-text {\r\n display: flex;\r\n align-items: center;\r\n padding: 0 5px;\r\n height: 100%;\r\n}\r\n\r\n.kankan-app_combox .inner-list {\r\n position: absolute;\r\n left: 0px;\r\n right: 0px;\r\n top: 100%;\r\n border: 1px solid rgba(255, 255, 255, 0.2);\r\n background: #323233;\r\n z-index: 1000;\r\n}\r\n\r\n.kankan-app_combox .inner-list>div {\r\n height: 34px;\r\n display: flex;\r\n align-items: center;\r\n padding: 0 5px;\r\n}\r\n\r\n.kankan-app_combox .inner-list>div:hover {\r\n color: var(--main-color);\r\n}",{});var j={"common.about":"约","common.meter":"米","cad.input":"请输入名称","model.enter":"入户门"},W={num:null,dom:null,env:"production",version:"4.10.7-alpha.12",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=[],r=0;r<e.length;r+=1)void 0!==e&&(null!==e[r]&&"object"==typeof e[r]?i[r]=n({},e[r]):i[r]=e[r]);for(var o=0;o<t.length;o+=1)void 0!==t[o]&&(null!==t[o]&&"object"==typeof t[o]?i[o]=n(e[o],t[o]):i[o]=t[o]);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(),r=0;r<t.length;r+=1){var o=t[r];if(null!==i&&null!==o&&void 0!==i&&void 0!==o){if("object"==typeof i&&"object"==typeof o)if(i instanceof Array&&o instanceof Array)i=J(i,o,Y);else for(var a=Object.keys(o),s=0;s<a.length;s+=1){var l=a[s];"__proto__"!==l&&("object"==typeof o[l]&&null!==o[l]?i[l]=Y(i[l],o[l]):void 0!==o[l]&&(i[l]=o[l]))}}else null!=o&&(i=o instanceof Array?J([],o,Y):o)}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,r=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?r[n.$name]?e(r[n.$name]):(n.$html&&(n.$scope?n.$scope.insertAdjacentHTML("beforeend",n.$html):r.app.$plugins.insertAdjacentHTML("beforeend",n.$html),delete n.$html),r[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}(),re=location.origin,oe=(document.currentScript||{}).src,ae=function(){if(!oe){try{({}).b()}catch(n){var e=n.stack||n.sourceURL||n.stacktrace,t=/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e);t&&(oe=t[0])}}var n=oe.split("/");return n.pop(),oe=n.join("/")+"/",function(){return oe}}();function se(e,t,n){return new Promise((function(i,r){var o=function(e){var t=document.createElement("script");return t.async=!0,e.indexOf(re+"/")&&(t.crossOrigin="anonymous"),t.src=e,t}(e+(n?"?v=".concat(n):""));o.addEventListener("error",(function(){console.error("load:"+e+" error"),r()})),o.addEventListener("load",(function(){document.head.removeChild(o),i(t)})),document.head.appendChild(o)}))}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,r,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return o}}(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 r=.5*i.clientWidth,o=.5*i.clientHeight;return n.project(t),n.x=n.x*r+r,n.y=-n.y*o+o,n},convertScreenPositionToNDC:function(e,t,i,r){return(i=i||new n.Vector2).x=e/r.clientWidth*2-1,i.y=-t/r.clientHeight*2+1,i},handelPadding:(ue=new Map,function(e,t,n){var i,r=ue.get(n);return r&&n.clientWidth==r.width&&n.clientHeight==r.height&&(i=r.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 r=e.clone().sub(t),o=t.clone().sub(n),a=o.length(),s=r.dot(o)/a,l=t.clone().add(o.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,r=1;r<=e.length;r++){var o=e[r%e.length].x,a=e[r%e.length].y,s=e[r-1].x,l=e[r-1].y,c=(o*l-a*s)/2;t+=c,n+=c*(o+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 r=!1,o=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-o)*(d-a)==(c-o)*(u-a)&&o>=Math.min(c,h)&&o<=Math.max(c,h)&&a>=Math.min(u,d)&&a<=Math.max(u,d))return!!n;u>a!=d>a&&o<(h-c)*(a-u)/(d-u)+c&&(r=!r)}return r},getArea:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].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,r=e[0].x-e[1].x,o=i*e[0].x+r*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*r;if(0==c)return!1;var u=(s*o-r*l)/c,h=(i*l-a*o)/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,r=e.points[1].y-e.points[0].y;if(0!=r)n=-i*(t=1)/r;else{if(0==i)return console.log("两个点一样"),null;t=-r*(n=1)/i}var o=new THREE.Vector3(t,0,n),a=new THREE.Vector3(i,0,r);return o.cross(a).y>0&&(t*=-1,n*=-1),new THREE.Vector2(t,n).normalize()},getQuaBetween2Vector:function(e,t,n){var i=e.angleTo(t),r=e.clone().cross(t).normalize();return 0==r.length()?(new THREE.Quaternion).setFromAxisAngle(n,i):(new THREE.Quaternion).setFromAxisAngle(r,i)},getScaleForConstantSize:function(){var e,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,r=new THREE.Vector3,o=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),r.set(2/a.dom.clientWidth,2/a.dom.clientHeight,1).multiply(i),o.copy(r).unproject(a.camera);var l=o.distanceTo(a.position);return l}}(),getCrossPointAtRect:function(e,t,n,i,r,o){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+r:r))<o||s>o+i)&&(a=function(t){return l*(t-e.y)+e.x}(s=s<o?o:o+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 r=Math.tan(i),o=Math.sqrt((1-n*n)/(1+r*r)),a=r*o;return o*t<0&&(o*=-1,a*=-1),a*=-1,new THREE.Vector3(a,n,o)},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 r=n.rot90Matrix.clone();else r=n.matrixWorld.clone();return(i=this.crossRight(i,r)).normalize(),i},getDirByLonLat:function(e,t){var n=new THREE.Vector3,i=THREE.MathUtils.degToRad(90-t),r=THREE.MathUtils.degToRad(e);return n.x=Math.sin(i)*Math.cos(r),n.y=Math.cos(i),n.z=Math.sin(i)*Math.sin(r),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),r=e.p2||(new THREE.Vector3).addVctors(n,e.dir1),o=e.dir0||(new THREE.Vector3).subVectors(i,t),a=e.dir1||(new THREE.Vector3).subVectors(r,n);if(t.equals(n))return{pos3d:i.clone()};var s=o.clone().cross(a),l=he.getQuaBetween2Vector(s,new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0)),c=[t,n,i,r].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,r=e.p2;if(t.equals(n))return{pos3d:i.clone()};var o=i.clone().sub(t).normalize(),a=r.clone().sub(n).normalize();o.angleTo(a);return function(){var e,o=i.x-t.x,a=i.y-t.y,s=i.z-t.z,l=r.x-n.x,c=r.y-n.y,u=r.z-n.z,h=t.x-n.x,d=t.y-n.y,p=t.z-n.z,f=o*o+a*a+s*s,m=o*l+a*c+s*u,v=l*l+c*c+u*u,g=o*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:r).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*o,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,r=e.length;i<r;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,r=e.length;i<r;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 r=this.getUnPosPlaneGeo().clone(),o=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 r.setAttribute("position",new THREE.BufferAttribute(o,3)),r.computeVertexNormals(),r.computeBoundingSphere(),r},drawPlane:function(e,t,n,i,r){return new THREE.Mesh(this.getPlaneGeo(e,t,n,i),r)},movePlane:function(e,t,n,i,r){var o=new Float32Array([t.x,t.y,t.z,n.x,n.y,n.z,i.x,i.y,i.z,r.x,r.y,r.z]);e.geometry.setAttribute("position",new THREE.BufferAttribute(o,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,r)=>i+(r-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,r){return e>2&&console.log(e),-i/Math.pow(-r,e)*Math.pow(t-r,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 r=1.70158,o=0,a=n;return 0===e?t:1==(e/=i)?t+n:(o||(o=.3*i),a<Math.abs(n)?(a=n,r=o/4):r=o/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*i-r)*(2*Math.PI)/o)+t)},easeOutElastic:function(e,t,n,i){var r=1.70158,o=0,a=n;return 0===e?t:1==(e/=i)?t+n:(o||(o=.3*i),a<Math.abs(n)?(a=n,r=o/4):r=o/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*i-r)*(2*Math.PI)/o)+n+t)},easeInOutElastic:function(e,t,n,i){var r=1.70158,o=0,a=n;return 0===e?t:2==(e/=i/2)?t+n:(o||(o=i*(.3*1.5)),a<Math.abs(n)?(a=n,r=o/4):r=o/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*i-r)*(2*Math.PI)/o)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*i-r)*(2*Math.PI)/o)*.5+n+t)},easeInBack:function(e,t,n,i,r){return void 0===r&&(r=1.70158),n*(e/=i)*e*((r+1)*e-r)+t},easeOutBack:function(e,t,n,i,r){return void 0===r&&(r=1.70158),n*((e=e/i-1)*e*((r+1)*e+r)+1)+t},easeInOutBack:function(e,t,n,i,r){return void 0===r&&(r=1.70158),(e/=i/2)<1?n/2*(e*e*((1+(r*=1.525))*e-r))+t:n/2*((e-=2)*e*((1+(r*=1.525))*e+r)+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,r,o,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:r||de.linearTween,cycling:t<0,running:!0,debug:i<0,name:o||"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 r=e.done||null,o=e.easing||de.linearTween,a=e.name||"R"+this.counter,s=void 0===e.id?this.counter:e.id;return this.start(n,i,r,t,o,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 r=n[i];r.duration/=t,r.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,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}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,r=0;r<e.length;r++){n+=t?e[r][t]:e[r],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,r=0;r<e.length;r++){var o=t?e[r][t]:e[r];n.add(o),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 r in i)i.hasOwnProperty(r)&&("object"==typeof i[r]?t[r]=e(t[r],i[r]):t[r]=i[r])}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 r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];e.apply(n,o),ge=i}}:function(){for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];n&&clearTimeout(n);var a=this;n=setTimeout((function(){e.apply(a,r)}),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 r=function(e,t){return e==t||n&&n(e,t)},o=t.filter((function(t){return t.find((function(n){return(r(n,e[0])||r(n,e[1]))&&(!i||i(t))}))}));if(o.length)if(e.forEach((function(e){o[0].includes(e)||o[0].push(e)})),o.length>1){var a=[];a.relationships=[e.slice()],o.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 o[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,r=t.find((function(t){var r=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(r)return i=r,!0}));if(r){t.splice(t.indexOf(r),1),r.relationships.splice(r.relationships.indexOf(i),1);var o=[];r.relationships.forEach((function(e){Ae.pushToGroupAuto(e,o,n)})),t.push.apply(t,o)}})),{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 r=[];return t.relationships.forEach((function(e){Ae.pushToGroupAuto(e,r,i)})),n.push.apply(n,r),{newGroups:r}}},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 r=ve.load(e,t,n,i);return r.magFilter=r.minFilter=THREE.LinearFilter,r.needsUpadte=!0,r});Ae.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),r=i.length,o=new Uint8Array(r);r--;)o[r]=i.charCodeAt(r);return new Blob([o],{type:n})},Ae.dataURLtoFile=function(e,t){for(var n=e.split(","),i=n[0].match(/:(.*?);/)[1],r=atob(n[1]),o=r.length,a=new Uint8Array(o);o--;)a[o]=r.charCodeAt(o);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 r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(r),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="",r=t,o=["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&&(r=Math.round(Math.random()*(n-t))+t);for(var a=0;a<r;a++){i+=o[Math.round(Math.random()*(o.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=Math.round(e/60);return n<10&&(t+="0"),t+=n,1==(e=Math.round(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]:[],r=arguments.length>3?arguments[3]:void 0;if(i.includes(THREE.Object3D)||i.push(THREE.Object3D),r||(r=function(){}),!e||"number"==typeof e||"string"==typeof e||e instanceof Function||i.some((function(t){return e instanceof t}))||r(e))return e;if(e instanceof Array)return e.map((function(e){return n.CloneObject(e,t,i,r)}));if(e.clone instanceof Function)return e.clone();var o={};for(var a in e)e[a]instanceof Object&&!t?o[a]=this.CloneObject(e[a],t,i,r):o[a]=e[a];return o},Ae.CloneClassObject=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.ignoreList,i=void 0===n?[]:n,r=t.simpleCopyList,o=void 0===r?[]:r,a=new e.constructor;return this.CopyClassObject(a,e,{ignoreList:i,simpleCopyList:o}),a},Ae.CopyClassObject=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.ignoreList,r=void 0===i?[]:i,o=n.simpleCopyList,a=void 0===o?[]:o;for(var s in t){if(s in t.__proto__)break;r.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==(o=n.find((function(n){return ifSame(e[t],n)})))&&!n.includes(o)&&!e.includes(o))return{v:!1};var i=n.indexOf(o);n.splice(i,1)},r=0;r<e.length;r++){var o,a=i(r);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",r=arguments.length>4?arguments[4]:void 0,o=e.toDataURL(i,t);return n&&this.saveTex(o,i,r),o};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"),r=i.getContext("2d");r.canvas.width=e.width,r.canvas.height=e.height,r.drawImage(e,0,0,e.width,e.height);var o=e.width*n.widthRatioToImg,a=o*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 r.globalAlpha=null!=n.opacity?n.opacity:1,r.drawImage(t,s,l,o,a),Ae.canvasToImg(i)},Ae.pixelsArrayToDataUrl=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.7,r=document.createElement("canvas");r.width=t,r.height=n;var o=r.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=o.createImageData(t,n);h.data.set(e),o.putImageData(h,0,0);var d=r.toDataURL(i);return d},Ae.renderTargetToDataUrl=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.7,o=t*n,a=new Uint8Array(4*o);i.readRenderTargetPixels(e,0,0,t,n,a);var s=this.pixelsArrayToDataUrl(a,t,n,r);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,r=arguments.length>4?arguments[4]:void 0;e.unvisibleReasons||(e.unvisibleReasons=[]),e.visibleReasons||(e.visibleReasons=[]);var o,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?((o=e.unvisibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(r="cancel",e.unvisibleReasons.splice(o,1)),"add"==r&&(e.visibleReasons.some((function(e){return e.reason==t}))||e.visibleReasons.push({reason:t,level:i}))):((o=e.visibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(r="cancel",e.visibleReasons.splice(o,1)),"cancel"!=r&&(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,r=this.list.find((function(t){return t.name==e}));if(r)r.requestUpdate=!0;else{var o=t();r={name:e},this.list.push(r),setTimeout((function(){var a=i.list.indexOf(r);i.list.splice(a,1),(r.requestUpdate||o)&&i.isWaiting(e,t,n)}),n)}}},Ae.batchHandling={lists:[],getSlice:function(e,t,n){var i=n.stopWhenAllUsed,r=n.minCount,o=void 0===r?5:r,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:o,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,r=e.maxCount;e.durBound1,e.durBound2,e.maxHistory;var o,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,o=null):(o||(o=Ae.getDifferenceSet(c,a)),l=o);var d=Ae.batchHandling.getSlice("ifVideoInsight",l,{stopWhenAllUsed:u,minCount:i,maxCount:r,durBound1:3,durBound2:13,maxHistory:3}).list;d.forEach(n),h||(o=Ae.getDifferenceSet(o,d)),a=d}}))}},Ae.getBestCount=(Ee={},function(e){var t,n=e.name,i=e.minCount,r=void 0===i?1:i,o=e.maxCount,a=void 0===o?6:o,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,r)),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],r=performance.now(),o=i&&(i.measures.length<i.minCount||r-i.lastAddTime>i.refreshTime);if(o||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)),o&&(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=r,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,r=fe(n);try{for(r.s();!(t=r.n()).done;){var o=t.value;i.add(o.name)}}catch(e){r.e(e)}finally{r.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},r=arguments.length>3?arguments[3]:void 0,o=this.animateTexs.find((function(t){return t.texture==e}));o?n=o:(n={texture:e,info:i},this.animateTexs.push(n),this.setRepeart(n));var a={animation:n,owner:t,id:r};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 r=n.duration+n.delay,o=n.delay/r;pe.start((function(t){var r=Math.floor((i-1)*t),o=r%n.cellXcount,a=n.cellYcount-Math.floor(r/n.cellXcount)-1;e.animation.texture.offset.x=o/n.cellXcount,e.animation.texture.offset.y=a/n.cellYcount}),r,(function(){e.started=!1,e.animation.started=!1,n.waitNextLoop=setTimeout((function(){t.start(e)}),n.waitNextTime||0)}),o,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,r=fe(t.split("."));try{for(r.s();!(n=r.n()).done;){var o=n.value;if(void 0===(i=Array.isArray(i)&&!isNaN(parseInt(o))?i[parseInt(o)]:i[o]))return}}catch(e){r.e(e)}finally{r.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 r=n[i].split("=");if(2===r.length&&r[0]===e)return r[1]}return""}for(var o=0;o<n.length;o++){if(n[o].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,Qe=9,He=9,Oe=10,Ve=11,_e=13,ze=14,Ne=14,Ue=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 r=document.createElement("div");r.className="player",r.setAttribute("name","copy");var o=document.createElement("div");o.className="player-mark",o.style.backgroundImage="url(".concat(this.resource.base("images/tag_pointer.png"),")"),i.appendChild(o),r.appendChild(o.cloneNode()),t.appendChild(n),t.appendChild(i),t.appendChild(r),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,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];this.core.add(e,V(n,r))}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,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return V(n,r)}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,r=this.elements;return e.x=r[0]*t+r[4]*n+r[8]*i+r[12],e.y=r[1]*t+r[5]*n+r[9]*i+r[13],e.z=r[2]*t+r[6]*n+r[10]*i+r[14],this},getInverse:function(e,t){var n=this.elements,i=e.elements,r=i[0],o=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=r*E+o*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+o*A*m+p*a*y-o*f*y)*T,n[2]=(c*A*s-g*u*s+g*a*h-o*A*h-c*a*y+o*u*y)*T,n[3]=(p*u*s-c*f*s-p*a*h+o*f*h+c*a*m-o*u*m)*T,n[4]=w*T,n[5]=(d*A*s-v*f*s+v*a*m-r*A*m-d*a*y+r*f*y)*T,n[6]=(v*u*s-l*A*s-v*a*h+r*A*h+l*a*y-r*u*y)*T,n[7]=(l*f*s-d*u*s+d*a*h-r*f*h-l*a*m+r*u*m)*T,n[8]=b*T,n[9]=(v*p*s-d*g*s-v*o*m+r*g*m+d*o*y-r*p*y)*T,n[10]=(l*g*s-v*c*s+v*o*h-r*g*h-l*o*y+r*c*y)*T,n[11]=(d*c*s-l*p*s-d*o*h+r*p*h+l*o*m-r*c*m)*T,n[12]=C*T,n[13]=(d*g*a-v*p*a+v*o*f-r*g*f-d*o*A+r*p*A)*T,n[14]=(v*c*a-l*g*a-v*o*u+r*g*u+l*o*A-r*c*A)*T,n[15]=(l*p*a-d*c*a+d*o*u-r*p*u-l*o*f+r*c*f)*T,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,o=e.w,a=n+n,s=i+i,l=r+r,c=n*a,u=n*s,h=n*l,d=i*s,p=i*l,f=r*l,m=o*a,v=o*s,g=o*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,r=e._z,o=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+o*a+i*l-r*s,this._y=i*c+o*s+r*a-n*l,this._z=r*c+o*l+n*s-i*a,this._w=o*c-n*a-i*s-r*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,r=e.y,o=e.z;n.x=r*t.z-o*t.y,n.y=o*t.x-i*t.z,n.z=i*t.y-r*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,r=t.z,o=e.x,a=e.y,s=e.z,l=e.w,c=l*n+a*r-s*i,u=l*i+s*n-o*r,h=l*r+o*i-a*n,d=-o*n-a*i-s*r;t.x=c*l+d*-o+u*-s-h*-a,t.y=u*l+d*-a+h*-o-c*-s,t.z=h*l+d*-s+c*-a-u*-o},$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)),r=Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i&&Math.abs(e.z-t.z)<i;return e.w?r&&Math.abs(e.w-t.w)<i:r};var et=new THREE.Raycaster,tt={getPos2d:function(e,t,n,i){n=n||t.camera,i=i||t.domElement;var r,o,a=e.clone().project(n);r=(a.x+1)/2*i.clientWidth,o=(1-(a.y+1)/2)*i.clientHeight;var s=r<=i.clientWidth&&r>=0&&o<=i.clientHeight&&o>=0;return{pos:new THREE.Vector2(r,o),vector:a,trueSide:a.z<1,inSight:s}},ifShelter:function(e,t,n,i,r){n||(n=this.getPos2d(e,t)),i=i||t.camera;var o=new THREE.Vector3(n.x,n.y,-1).unproject(i),a=e.clone().sub(o).normalize();et.set(o,a);var s=null==r?t.model.colliders:t.model.floors.index[r].collider.children,l=et.intersectObjects(s),c=e.distanceTo(o);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,r=t.mouse,o=new THREE.Vector3(r.x,r.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&&o.y<=i.y)return null;if(o.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");s=((p=(o.y-a)/(i.y-a))*i.x-o.x)/(p-1),l=(p*i.z-o.z)/(p-1)}}else{var c=n.normalVec,u=n.pullPos;if(0!=c.y)return void console.log("N.y != 0");if(o.z==i.z)return void console.log("O.z==A.z?");if(0!=c.z&&0!=c.x){var h=c.x*(i.x-o.x)+c.y*(i.y-o.y)+c.z*(i.z-o.z);if(0==h)return void console.log("分母为0?? return;");var d=-(c.x*o.x+c.y*o.y+c.z*o.z-(u.x*c.x+u.y*c.y+u.z*c.z))/h;s=d*(i.x-o.x)+o.x,a=d*(i.y-o.y)+o.y,l=d*(i.z-o.z)+o.z}else if(0==c.x){l=u.z;if(o.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=(o.z-l)/(i.z-l))*i.x-o.x)/(p-1),a=(p*i.y-o.y)/(p-1)}else if(0==c.z){s=u.x;if(o.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=(o.x-s)/(i.x-s))*i.y-o.y)/(p-1),l=(p*i.z-o.z)/(p-1)}}return new THREE.Vector3(s,a,l)},getMouseIntersect:function(e,t,n){var i=new THREE.Raycaster;e.updateMatrixWorld();var r=new THREE.Vector3(n.x,n.y,-1).unproject(e),o=new THREE.Vector3(n.x,n.y,1).unproject(e).sub(r).normalize();i.set(r,o),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]:{},r=t.clone().sub(e).normalize(),o=i.InfinityLen?1/0:e.distanceTo(t)+(i.extLen||0);if(0!=o){var a=new THREE.Raycaster(e.clone(),r,0,o),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,r);var d=a.intersectObjects(i.meshes||n.colliders);if(a.set(e.clone().add(u.negate()),r),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=[],r=e.clone(),o=n.panos||t.panos.list;return o.forEach((function(e){if(e.isAligned()){var o=e.position.clone(),a=o.distanceTo(r);if(!(null!=n.maxDis&&a>n.maxDis)){var s=new THREE.Raycaster(o.clone(),r.clone().sub(o).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=[],r=[],o=[];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),r.push.apply(r,Q(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(r);c.length&&function(){var e=c[0].object.parent.floor,t=o.find((function(t){return t.floor==e}));t?t.len++:o.push({floor:e,len:1})}()}return o.sort((function(e,t){t.len,e.len})),o[0]||(o=[],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)],r=0;i.forEach((function(e){return r+=e.distanceTo(n)})),o.push({floor:e,dis:r})})),o.sort((function(e,t){e.dis,t.dis}))),o[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){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new THREE.Vector3(0,0,-1),i=(new THREE.Quaternion).setFromUnitVectors(n,e.clone().sub(t).normalize());return i},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,rt=1,ot=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(r,o,a){if(r!==o){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:r,end:o};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=[],r=[],o=null,a={done:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(dt(arguments[e]))for(var i=arguments[e],r=0;r<i.length;r++)"resolved"===t&&i[r].apply(this,o),n.push(i[r]);else"resolved"===t&&arguments[e].apply(this,o),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],r=0;r<n.length;r++)"rejected"===t&&n[r].apply(this,o),i.push(n[r]);else"rejected"===t&&arguments[e].apply(this,o),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&&r.push(n[i]);else"pending"===t&&r.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],r=0;r<n.length;r++)"rejected"===t&&n[r].apply(this,o),i.push(n[r]);else"rejected"===t&&arguments[e].apply(this,o),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=o=arguments.length>1?arguments[1]:[],r=0;r<n.length;r++)n[r].apply(e,i)}return this},rejectWith:function(e){if("pending"===t){t="rejected";for(var n=o=arguments.length>1?arguments[1]:[],r=0;r<i.length;r++)i[r].apply(e,n)}return this},notifyWith:function(e){if("pending"===t)for(var n=o=arguments.length>1?arguments[1]:[],i=0;i<r.length;i++)r[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,r=new Array(n),o=0;o<e.length;o++)!function(o){var a=null;e[o].done?e[o].done((function(){r[o]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,r)})).fail((function(){t.reject(arguments)})):(a=e[o],e[o]=new Deferred,e[o].done((function(){r[o]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,r)})).fail((function(){t.reject(arguments)})).resolve(a))}(o);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 r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.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,r,o,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,r=n.length;i<r;i+=3){var p=3*n[i],f=3*n[i+1],m=3*n[i+2];o=(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(o/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,r=t.length;i<r;i+=9)o=(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(o/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 r=new THREE.Mesh(i,this.material);r.material.visible=!1,r.name="collider",e.add(r),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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}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 r=Je.floorMat[t];n.forEach((function(e){for(var t in r)"renderOrder"==t?e.renderOrder=r[t]:"depthTest"==t||"depthWrite"==t||"transparent"==t?e.materialOutside[t]=r[t]:e.materialOutside.extraValues[t]=e.materialOutside.uniforms[t].value=r[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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}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 r=this.list[i],o=r.distanceToPoint(e);(!t||n>o)&&(n=o,t=r)}return t}}]),n}(yt),It={vector:function(e,t,n){var i=e.clone();return t=t.clone(),function(r){e.set(i.x*(1-r)+t.x*r,i.y*(1-r)+t.y*r,i.z*(1-r)+t.z*r),n&&n(e,r)}},quaternion:function(e,t,n){var i=e.clone();return function(r){e.copy(i).slerp(t,r),n&&n(e,r)}},color:function(e,t,n){var i=e.clone();return function(r){e.copy(i).lerp(t,r),n&&n(e,r)}},property(e,t,n,i){var r=e[t];return function(o){e[t]=r*(1-o)+n*o,i&&i(e[t])}},uniform(e,t,n){var i=e.material.uniforms[t].value;return function(r){e.material.uniforms[t]&&(e.material.uniforms[t].value=i*(1-r)+n*r)}},matrix4(e,t){var n=e.clone();return function(i){for(var r=e.elements,o=n.elements,a=t.elements,s=0;s<16;s++)r[s]=o[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,Qt=4,Ht={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},zt={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 //裁剪模块(不加const有的会报错)\n varying const 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 //裁剪模块\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 "},Ut={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 "},rn={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 on(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=on(e.fragmentShader),e==_t&&(e.fragmentBufferShader=on(e.fragmentBufferShader)))}an(Ht),an(Ot),an(_t),an(zt),an(Nt),an(Ut),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(rn);var sn={cube:Ht,customDepth:Ot,model:_t,modelDebug:zt,modelOutside:Nt,ribbon:Ut,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:rn},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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,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,r=arguments.length;i<r;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 r=[];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)),r.push(gn(t)+"="+gn(e))})))})),i=r.join("&")}if(i){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),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,r){return function(e,t,n,i,r){return e.config=t,n&&(e.code=n),e.request=i,e.response=r,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,r)},In=vn.isStandardBrowserEnv()?{write:function(e,t,n,i,r,o){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(r)&&a.push("domain="+r),!0===o&&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,r=e.headers;vn.isFormData(i)&&delete r["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.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(o.open(e.method.toUpperCase(),An(l,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in o?function(e){var t,n,i,r={};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(r[t]&&Tn.indexOf(t)>=0)return;r[t]="set-cookie"===t?(r[t]?r[t]:[]).concat([n]):r[t]?r[t]+", "+n:n}})),r):r}(o.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:i,config:e,request:o};!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,r),o=null}},o.onabort=function(){o&&(n(xn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){n(xn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(xn(t,e,"ECONNABORTED",o)),o=null},vn.isStandardBrowserEnv()){var c=(e.withCredentials||Bn(l))&&e.xsrfCookieName?In.read(e.xsrfCookieName):void 0;c&&(r[e.xsrfHeaderName]=c)}if("setRequestHeader"in o&&vn.forEach(r,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete r[t]:o.setRequestHeader(t,e)})),vn.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),n(e),o=null)})),i||(i=null),o.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)}))},Qn=function(e,t){t=t||{};var n={},i=["url","method","data"],r=["headers","auth","proxy","params"],o=["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(r,l),vn.forEach(o,(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(r).concat(o).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 Hn(e){this.defaults=e,this.interceptors={request:new En,response:new En}}Hn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Qn(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},Hn.prototype.getUri=function(e){return e=Qn(this.defaults,e),An(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},vn.forEach(["delete","get","head","options"],(function(e){Hn.prototype[e]=function(t,n){return this.request(Qn(n||{},{method:e,url:t,data:(n||{}).data}))}})),vn.forEach(["post","put","patch"],(function(e){Hn.prototype[e]=function(t,n,i){return this.request(Qn(i||{},{method:e,url:t,data:n}))}}));var On=Hn;function Vn(e){this.message=e}Vn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Vn.prototype.__CANCEL__=!0;var _n=Vn;function zn(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))}))}zn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},zn.source=function(){var e;return{token:new zn((function(t){e=t})),cancel:e}};var Nn=zn;function Un(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=Un(Dn);Gn.Axios=On,Gn.create=function(e){return Un(Qn(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,r){e().then(i).catch((function(o){t<=1?r(o):setTimeout((function(){Xn.retry(e,t-1,n).then(i).catch(r)}),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 r in t.onUploadProgress&&(i=t.onUploadProgress,delete t.onUploadProgress),t)if("files"===r&&t[r].length>0)for(var o=0;o<t[r].length;o++){var a=t[r][o];a instanceof File?n.append(r,a):a.file?a.filename?n.append(r,a.file,a.filename):n.append(r,a.file):console.warn("file is wong !",t)}else"file"==r||"filename"===r?"file"==r&&(t.filename?n.append("file",t[r],t.filename):n.append("file",t[r])):n.append(r,t[r]);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}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 r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=$n.data[t.split("?")[0]])){e.next=6;break}return n&&n(r),e.abrupt("return",r);case 6:return r=new THREE.Texture,Je.minimalMemoryMode&&(r.minFilter=THREE.LinearFilter,r.magFilter=THREE.LinearFilter,r.generateMipmaps=!1),r.sourceFile=t,$n.data[t.split("?")[0]]=r,e.next=12,Xn.getImage(t).then((function(e){r.image=e,r.needsUpdate=!0,n&&n(r)})).catch(i);case 12:return e.abrupt("return",r);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=[],ri=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}(),oi=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),r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+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),r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+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}(oi),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 ri({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 oi,r.material=void 0!==i?i:new ri({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 r=new THREE.LineSegments(new THREE.BufferGeometry,t);return r.renderOrder=n.renderOrder||4,this.moveLine(r,e),r},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 ri(t)},createFatLine:function(e,t){var n=new ai;n.setColors(t.color||[1,1,1]);var i=t.material||this.createFatLineMat(t),r=new si(n,i);return r.scale.set(1,1,1),r.renderOrder=2,this.moveFatLine(r,e),r},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,r=e[1].clone().sub(e[0]),o=function(){i.lastVector=r;var e=new THREE.Vector3(0,-1,0),t=e.clone().cross(r).normalize(),n=e.angleTo(r);i.quaternion.setFromAxisAngle(t,n)};if(t&&"init"==t.type){if((i=new THREE.Mesh).material=t.mat,0==r.length())return i;o()}if(0==r.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&&r.angleTo(i.lastVector)>0&&o():o()}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,r){this.createBoldLine(t,{type:n,cylinder:e,standPos:i,constantBold:r},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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}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 Qi(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,Qi=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 Hi({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,r=Je.tags.disc.scale,o=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||o<=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:r.maxSize,minSize:"videoPanoFlag"==this.state&&e!=ht.PANORAMA?30:r.minSize,nearBound:r.nearBound,farBound:r.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}(),Hi=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}(),zi=0,Ni=1,Ui=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,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}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,r,o,a,s){var l=e/t,c=t/e*2,u=c/2,h=i/l*2-1+u,d=(r=l-1-r)/l*2-1+u;switch(o=o||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 zi:$e.setVector(s,-1,d,-h);break;case Ni:$e.setVector(s,1,d,h);break;case Ui:$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),r=i*i;return Math.floor(t/r)},qi.getTileLocation=function(e,t,n){var i=qi.TILE_SIZE;e<qi.TILE_SIZE&&(i=e);var r=qi.getFaceForTile(e,t),o=Math.floor(e/i),a=t-r*(o*o);return n.tileX=a%o,n.tileY=Math.floor(a/o),n.face=r,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})},r=function(){var e={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(t,n,r){for(var o=qi.getTileCountForSize(t),a=0,s=0;s<o;s++)qi.getTileLocation(t,s,e),n&&!n(e)||(a++,r&&i(r,e));return a}}();return function(i,o,a,s,l,c){var u=o<qi.TILE_SIZE?o:qi.TILE_SIZE;if(!s&&!l)return r(o,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 r(o,(function(e){return qi.isTileWithinFrustum(o,u,e.face,e.tileX,e.tileY,n,s,l)}),c)}return r(o,(function(t){return qi.isTileWithinFOV(o,u,t.face,t.tileX,t.tileY,e,s)}),c)}}(),qi.isTileWithinFrustum=function(){var e=new $e.Vector3;return function(t,n,i,r,o,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,r,o,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,r,o,a,s,l,c){var u=qi.mapFaceToCubemapFace(o);if($e.cross(l,t,n),qi.getTileVector(i,r,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,r,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,r,o){if($e.copyVector(n,t),o){$e.copyVector(o,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=r/2*$e.RADIANS_PER_DEGREE,l=Math.cos(s);return $e.dot(t,i)>=l}}(),qi.mapFaceToCubemapFace=function(){var e={0:Ui,1:ji,2:zi,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 r=this.root.parent.getWorldQuaternion(new THREE.Quaternion);this.root.quaternion.multiplyQuaternions(r.invert(),i.quaternion)}if(this.sizeInfo){var o=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(o,o,o)}}}},{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,r=[],o=Ji(this.text);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t.measureText(a),l=s.width;r.push(s),i=Math.max(i,l)}}catch(e){o.e(e)}finally{o.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+=(null==r[m].actualBoundingBoxAscent?.8*this.fontsize:r[m].actualBoundingBoxAscent)+p;var v=(i-r[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,r,o){e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+i-o,n),e.arcTo(t+i,n,t+i,n+o,o),e.lineTo(t+i,n+r-o),e.arcTo(t+i,n+r,t+i-o,n+r,o),e.lineTo(t+o,n+r),e.arcTo(t,n+r,t,n+r-o,o),e.lineTo(t,n+o),e.arcTo(t,n,t+o,n,o),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 er(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var tr=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),-Math.PI/2),nr={backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255,g:255,b:255,a:1},fixOrient:!0,renderOrder:Se,fontsize:30},ir={backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:Se},rr=Ce.urlHasValue("panoLabel"),or=function(e){f(n,EventEmitter);var t=er(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(),r=new THREE.Raycaster(this.position,i.clone(),0,t).intersectObjects(this.model.colliders);n.raycastsDone++,this.model.panos.setNeighbour(this,e,0===r.length),Je.showNeighbourRaycasts&&(r.length?this.floor.model.add(new THREE.ArrowHelper(i,this.position,r[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,r,o){null!=i||(i=!0),null!=r||(r=!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 r=qi.getTileLocation(e,t,{}),o=r.faceTileIndex,a=r.face;u[i].push({faceTileIndex:o,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==o&&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,o);var v=this.curTileQuality||this.qualityManager.getMaxNavPanoSize();this.tiledPanoRenderTarget=this.panoRenderer.activateTiledPano(this,v,i),this.panoRenderer.renderPanoTiles(this.id,t,r,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,tr),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,r=e.temperature;return 0!==t||0!==n||0!==i||0!==r}},{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(){rr&&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,r,o=this;if(this.hasVideo&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(this.videoInfo.dir)r=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);r=s.clone().sub(this.position),i=THREE.MathUtils.degToRad(32.5)}else this.panoVideo&&(r=this.panoVideo.dir.clone(),i=THREE.MathUtils.degToRad(this.panoVideo.hfov/2));return r&&(t="across"==e?function(e,t){var i=(new THREE.Vector3).subVectors(e,o.position).setY(0).normalize(),a=(new THREE.Vector3).subVectors(t,o.position).setY(0).normalize(),s=(new THREE.Vector3).addVectors(i,a).normalize(),l=i.angleTo(s),c=(new THREE.Vector3).addVectors(o.position,r);return n.filters.isInFanAngle(o.position,s,l)(c)}:n.filters.isInFanAngle(this.position,r,i)),t}},{key:"addLabel",value:function(){this.label=new Ki(Object.assign({player:this.$app.core.get("Player")},nr,{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}},ir,{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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}or.raycastsSkipped=0,or.raycastsDone=0,or.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 r=new THREE.Vector2(i.floorPosition.x,i.floorPosition.z),o=new THREE.Vector2(e.x,e.z);return r.sub(o).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 r=i.floorPosition.clone().sub(e).normalize(),o=i.position.clone().sub(e).normalize();return r.dot(t)>n||o.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 r=e.distanceToSquared(i.floorPosition);return r>t&&r<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 r=t.setY(0),o=i.clone().sub(e).setY(0);return r.angleTo(o)<=n}}},or.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}}},or.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 sr=function(e){f(n,e);var t=ar(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 r=Ae.sortByScore(this.list,t,n);return!r||0===r.length||e>=r.length?null:(i&&(i.candidates=r,i.pano=r[e].item),r[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=[or.filters.isPanoAligned()];return t&&n.push(or.filters.inDirection(e,t,.75)),this.find(n,[or.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,r=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,r=i+t*(e.toOp-i);n.marker&&(n.marker.material.opacity=r)}))}.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 o=0;o<i.length;o++)r(i[o],o)}}},{key:"closestPanoTowardPoint",value:function(e){var t=e.point,n=e.require||[],i={position:t},r=new THREE.Vector3,o=e.rank||[or.scoreFunctions.distanceSquared(i,-2)];e.force;var a=e.getAll,s=e.angleTolerDecrease||2;n.push(or.filters.isPanoAligned()),n.push((function(e){return e.hasNeighbor()})),n.push((function(e){r.copy(t).sub(e.position);var n=-THREE.MathUtils.radToDeg(Math.atan(r.y/Math.sqrt(r.x*r.x+r.z*r.z))),i=Je.insideFOV/2-s,o=Je.insideLookLimitDown-i,a=Je.insideLookLimitUp+i;return o<n&&n<a})),e.floor&&n.push(or.filters.atFloor(e.floor));var l=Ae.sortByScore(this.list,n,o);return a?l:l&&l.length>0&&l[0].item}}]),n}(yt);function lr(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var cr=function(e){f(n,THREE.Mesh);var t=lr(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 ur(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var hr=function(e){f(n,THREE.RawShaderMaterial);var t=ur(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 r=t.panoVideoRenderer.videoPlayer,o=r._resource?r._resource.get(t.id).video:r.instances.get(t.id).videoElement;0==o.readyState?o.addEventListener("resize",(function(e){i.uniforms.bFlag.value=o.videoWidth>o.videoHeight?1:0}),!1):this.uniforms.bFlag.value=o.videoWidth>o.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,r=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)};r(e,0),r(t,1),i&&(this.needsUpdate=!0)}}]),n}();function dr(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var pr=function(e){f(n,e);var t=dr(n);function n(e,i){var r;o(this,n),nt.time("Computing a nice bounding cubemap");var a=new hr({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}(cr);function fr(){}fr.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 r(){i.off(e,r),t.apply(n,arguments)}return r._=t,this.on(e,r,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,r=n.length;i<r;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],r=[];if(i&&t)for(var o=0,a=i.length;o<a;o++)i[o].fn!==t&&i[o].fn._!==t&&r.push(i[o]);return r.length?n[e]=r:delete n[e],this}};var mr=fr,vr=fr;mr.TinyEmitter=vr;var gr={map:{type:"t",value:null},opacity:{type:"f",value:1},opaRadius:{type:"f",value:.2}},Ar="\n varying vec2 vUv;\n void main() {\n vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",yr="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 Er(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var wr={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}},br=function(e){f(n,e);var t=Er(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 r=$n.load(n,(function(){var t=e.getTex(r);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(wr.floorLogo.position.x,wr.floorLogo.position.y,wr.floorLogo.position.z),e.lookAt(e.position.clone().add(new THREE.Vector3(0,1,0))),e.renderOrder=wr.floorLogo.renderOrder,e}},{key:"getTex",value:function(e){var t=THREE.UniformsUtils.clone(gr);t.map.value=e;var n=new THREE.ShaderMaterial({fragmentShader:yr,vertexShader:Ar,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 r=new THREE.Texture(e.image);r.needsUpdate=!0,i(r)}if(e.size){var o=e.size/100;this.firstLogo.scale.set(o,o,o),this.secondLogo.scale.set(o,o,o)}}}}]),n}(mr);function Cr(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var xr=THREE.BoxBufferGeometry,Ir=THREE.BufferGeometry,Tr=THREE.Color,Br=THREE.CylinderBufferGeometry,kr=THREE.DoubleSide,Pr=THREE.Euler,Rr=THREE.Float32BufferAttribute,Mr=THREE.Line;THREE.LineBasicMaterial;var Sr=THREE.Matrix4,Dr=THREE.Mesh,Fr=THREE.MeshBasicMaterial,Lr=THREE.Object3D,Qr=THREE.OctahedronBufferGeometry,Hr=THREE.PlaneBufferGeometry,Or=THREE.Quaternion;THREE.Raycaster;var Vr,_r,zr,Nr,Ur,Gr,jr,Wr=THREE.TorusBufferGeometry,qr=new THREE.Raycaster,Jr=new THREE.Vector3,Yr=new THREE.Vector3,Zr=new THREE.Quaternion,Xr={X:new THREE.Vector3(1,0,0),Y:new THREE.Vector3(0,1,0),Z:new THREE.Vector3(0,0,1)},Kr=new THREE.Vector3,$r=new THREE.Vector3,eo=new THREE.Vector3,to=new THREE.Vector3,no=new THREE.Vector3,io=new THREE.Vector3,ro=0,oo=new THREE.Vector3,ao=new THREE.Quaternion,so=new THREE.Vector3,lo=new THREE.Vector3,co=new THREE.Quaternion,uo=new THREE.Quaternion,ho=new THREE.Vector3,po=new THREE.Vector3,fo=new THREE.Quaternion,mo=new THREE.Vector3,vo=new THREE.Vector3,go=new THREE.Quaternion,Ao=new THREE.Quaternion,yo=new THREE.Vector3,Eo=new THREE.Vector3,wo=new THREE.Vector3,bo=new THREE.Quaternion,Co=new THREE.Vector3,xo=0,Io=function(e){f(n,THREE.Object3D);var t=Cr(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,Gr=new To(r),a.add(Gr),jr=new Lo(r),a.add(jr),a.player=r.player,a.options=r,Vr={type:"change"},_r={type:"mouseDown"},Nr={type:"mouseUp",mode:a.mode},zr={type:"mousing"},Ur={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",vo),a.defineProperty("worldPositionStart",po),a.defineProperty("worldQuaternion",go),a.defineProperty("worldQuaternionStart",fo),a.defineProperty("cameraPosition",oo),a.defineProperty("cameraQuaternion",ao),a.defineProperty("pointStart",Kr),a.defineProperty("pointEnd",$r),a.defineProperty("rotationAxis",to),a.defineProperty("rotationAngle",ro),a.defineProperty("eye",Eo),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){Gr.gizmo[e].removeFromParent(),Gr.picker[e].removeFromParent(),Gr.gizmo[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),Gr.picker[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}));var t=Gr["update"+e.charAt(0).toUpperCase()+e.slice(1)](),n=t.gizmo,i=t.picker;Gr.add(Gr.gizmo[e]=Gr.setupGizmo(n)),Gr.add(Gr.picker[e]=Gr.setupGizmo(i)),Gr.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,jr[e]=t,Gr[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(Vr))}}),this[e]=t,jr[e]=t,Gr[e]=t}},{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),this.object.parent.matrixWorld.decompose(lo,co,ho),this.object.matrixWorld.decompose(vo,go,yo),uo.copy(co).invert(),Ao.copy(go).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(oo,ao,so),Eo.copy(oo).sub(vo).normalize(),Lr.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);qr.set(t,this.player.getMouseDirection(e));var n=qr.intersectObjects(Gr.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);qr.set(t,this.player.getMouseDirection(e));var n=qr.intersectObjects([jr],!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 r=this.rotationSnap;"X"===this.axis&&r&&(this.object.rotation.x=Math.round(this.object.rotation.x/r)*r),"Y"===this.axis&&r&&(this.object.rotation.y=Math.round(this.object.rotation.y/r)*r),"Z"===this.axis&&r&&(this.object.rotation.z=Math.round(this.object.rotation.z/r)*r)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),wo.copy(this.object.position),bo.copy(this.object.quaternion),Co.copy(this.object.scale),this.object.matrixWorld.decompose(po,fo,mo),Kr.copy(n.point).sub(po),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!1)}this.dragging=!0,_r.mode=this.mode,this.dispatchEvent(_r)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,i=this.object,r=this.space;if("scale"===n?r="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(r="world"),void 0!==i&&null!==t&&!1!==this.dragging&&(void 0===e.button||0===e.button)){var o=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);qr.set(o,this.player.getMouseDirection(e));var a=qr.intersectObjects([jr],!0)[0]||!1;if(!1!==a){if($r.copy(a.point).sub(po),"translate"===n){if(eo.copy($r).sub(Kr),"local"===r&&"XYZ"!==t&&eo.applyQuaternion(Ao),-1===t.indexOf("X")&&(eo.x=0),-1===t.indexOf("Y")&&(eo.y=0),-1===t.indexOf("Z")&&(eo.z=0),"local"===r&&"XYZ"!==t?eo.applyQuaternion(bo).divide(ho):eo.applyQuaternion(uo).divide(ho),i.overlayType){var s=i.floor.boundingBox.min.y-eo.y-wo.y;s>0&&s<.024&&(eo.y=i.floor.boundingBox.min.y-wo.y)}eo.y*=Math.sign(i.scale.y),eo.z*=Math.sign(i.scale.z),i.position.copy(eo).add(wo),this.translationSnap&&("local"===r&&(i.position.applyQuaternion(Zr.copy(bo).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(bo)),"world"===r&&(i.parent&&i.position.add(Jr.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(Jr.setFromMatrixPosition(i.parent.matrixWorld))))}else if("scale"===n){if(-1!==t.search("XYZ")){var l=$r.length()/Kr.length();$r.dot(Kr)<0&&(l*=-1),this.options.NoScaleZ?Yr.set(l,l,1):Yr.set(l,l,l)}else if(-1!==t.search("XY")){l=$r.length()/Kr.length();$r.dot(Kr)<0&&(l*=-1),Yr.set(l,l,1)}else Jr.copy(Kr),Yr.copy($r),Jr.applyQuaternion(Ao),Yr.applyQuaternion(Ao),Yr.divide(Jr),-1===t.search("X")&&(Yr.x=1),-1===t.search("Y")&&(Yr.y=1),-1===t.search("Z")&&(Yr.z=1);if("overlay"==this.editState||"decoration"==this.editState){"overlay"==this.editState&&(Co.x*=Je.overlay.width,Co.y*=Je.overlay.height);var c,u=["x","y","z"],h={min:{v:1/0},max:{v:-1/0}};u.forEach((function(e){if(Yr[e]=Math.abs(Yr[e]),1!=Yr[e]){var t=Yr[e]*Co[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/Co[h.min.axis]:h.max.v>10&&(c=10/Co[h.max.axis]),c&&u.forEach((function(e){1!=Yr[e]&&(Yr[e]=c)})),"overlay"==this.editState&&(Co.x/=Je.overlay.width,Co.y/=Je.overlay.height)}this.editState,i.scale.copy(Co).multiply(Yr),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(eo.copy($r).sub(Kr),"floorplan"==this.player.mode)var d=this.player.cameraControls.cameras.floorplan,p=5/((d.right-d.left)/d.aspect);else p=5/vo.distanceTo(Jr.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(to.copy(Eo),ro=$r.angleTo(Kr),no.copy(Kr).normalize(),io.copy($r).normalize(),ro*=io.cross(no).dot(Eo)<0?1:-1):"XYZE"===t?(to.copy(eo).cross(Eo).normalize(),ro=eo.dot(Jr.copy(to).cross(this.eye))*p):"X"!==t&&"Y"!==t&&"Z"!==t||(to.copy(Xr[t]),Jr.copy(Xr[t]),"local"===r&&Jr.applyQuaternion(go),ro=eo.dot(Jr.cross(Eo).normalize())*p),this.rotationSnap&&(ro=Math.round(ro/this.rotationSnap)*this.rotationSnap),this.rotationAngle=ro;var f="local"===r;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(bo),i.quaternion.multiply(Zr.setFromAxisAngle(to,ro)).normalize()):(to.applyQuaternion(uo),i.quaternion.copy(Zr.setFromAxisAngle(to,ro)),i.quaternion.multiply(bo).normalize())}this.dispatchEvent(Object.assign(zr,{mode:this.mode,state:this.editState,axis:t,angle:ro,deltaAngle:ro-xo})),this.dispatchEvent(Vr),this.dispatchEvent(Ur),xo=ro}}}},{key:"pointerUp",value:function(e){void 0!==this.object&&(this.dragging&&null!==this.axis&&(Nr.mode=this.mode,this.dispatchEvent(Nr)),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),xo=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}(),To=function(e){f(n,THREE.Object3D);var t=Cr(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:kr,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 Br(0,.07,.2,12,1,!1),b=new xr(.125,.125,.125),C=new Ir;C.setAttribute("position",new Rr([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],r=ui.createFatLine(n,{material:i});return T[e]=r.geometry,r.renderOrder=4,r},P=function(e,t){for(var n=new Ir,i=[],r=0;r<=64*t;++r)i.push(0,Math.cos(r/32*Math.PI)*e,Math.sin(r/32*Math.PI)*e);return n.setAttribute("position",new Rr(i,3)),n},R={X:[[new Dr(w,c),[.5,0,0],[0,0,-Math.PI/2],null,"fwd"],[k("x+","x")]],Y:[[new Dr(w,u),[0,.5,0],null,null,"fwd"],[k("y+","y")]],Z:[[new Dr(w,h),[0,0,.5],[Math.PI/2,0,0],null,"fwd"],[k("z+","z")]]},M={X:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]]},S={START:[[new Dr(new Qr(.01,2),l),null,null,null,"helper"]],END:[[new Dr(new Qr(.01,2),l),null,null,null,"helper"]],DELTA:[[new Mr((x=new Ir,x.setAttribute("position",new Rr([0,0,0,1,1,1],3)),x),l),null,null,null,"helper"]],X:[[new Mr(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Mr(C,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Mr(C,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};i.updateRotate=function(){var t={X:[[new Mr(P(1,.5),v)],[new Dr(new Qr(.04,0),c),[0,0,.99],null,[1,3,1]]],Y:[[new Mr(P(1,.5),g),null,[0,0,-Math.PI/2]],[new Dr(new Qr(.04,0),u),[0,0,.99],null,[3,1,1]]],Z:[[new Mr(P(1,.5),A),null,[0,Math.PI/2,0]],[new Dr(new Qr(.04,0),h),[.99,0,0],null,[1,3,1]]],XYZE:[[new Mr(P(1,1),E),null,[0,Math.PI/2,0]]]},n={AXIS:[[new Mr(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},i={X:[[new Dr(new Wr(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Dr(new Wr(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Dr(new Wr(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 Dr(b,c),[.5,0,0],[0,0,-Math.PI/2]],[k("x-","x")]],Y:[[new Dr(b,u),[0,.5,0]],[k("y-","y")]],Z:[[new Dr(b,h),[0,0,.5],[Math.PI/2,0,0]],[k("z-","z"),null,[0,-Math.PI/2,0],[.5,1,1]]],XY:[[new Dr(b,p),[.5,.5,0]]],YZ:[[new Dr(b,f),[0,.5,.5]]],XZ:[[new Dr(b,m),[.5,0,.5]]],XYZX:[[new Dr(new xr(.125,.125,.125),d.clone()),[.5,.5,.5]]]},n={X:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Dr(new Br(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]],XY:[[new Dr(b,s),[.5,.5,0]]],YZ:[[new Dr(b,s),[0,.5,.5]]],XZ:[[new Dr(b,s),[.5,0,.5]]],XYZX:[[new Dr(new xr(.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 Mr(C,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Mr(C,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Mr(C,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]}}},i.setupGizmo=function(e){var t=new Lr;for(var n in e)for(var i=e[n].length;i--;){var r=e[n][i][0],o=e[n][i][1],a=e[n][i][2],s=e[n][i][3],l=e[n][i][4];if("Fatline"!=r.type&&(r=r.clone()),r.name=n,r.tag=l,o&&r.position.set(o[0],o[1],o[2]),a&&r.rotation.set(a[0],a[1],a[2]),s&&r.scale.set(s[0],s[1],s[2]),r.updateMatrix(),r.geometry.clone()){var c=r.geometry.clone();c.applyMatrix4(r.matrix),r.geometry=c}else r.geometry.applyMatrix4(r.matrix);r.renderOrder=1/0,r.position.set(0,0,0),r.rotation.set(0,0,0),r.scale.set(1,1,1),t.add(r)}return t};var D=new THREE.Vector3(0,0,0),F=new Pr,L=new THREE.Vector3(0,1,0),Q=new THREE.Vector3(0,0,0),H=new Sr,O=new Or,V=new Or,_=new Or,z=new THREE.Vector3(1,0,0),N=new THREE.Vector3(0,1,0),U=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 r=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){r=((o=this.player.cameraControls.cameras.floorplan).right-o.left)/o.aspect}}else{var o,a=((o=this.player.cameraControls.cameras.floorplan).right-o.left)/o.aspect;r=Math.min(r,a)}for(var s=r*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(z).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(U).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(U).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(z).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(U).applyQuaternion(n).dot(this.eye)<0&&(h=!0),-1!==c.name.search("X")&&(L.copy(z).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(H.lookAt(this.eye,Q,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(z,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(U,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 Tr(1,1,1),.5)):(c.material.opacity*=.25,c.material.color.lerp(new Tr(1,1,1),.5))):(c.material.opacity*=.5,c.material.color.lerp(new Tr(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(z).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(U).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(H.lookAt(Q,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)))}Lr.prototype.updateMatrixWorld.call(this)},i}return n}(),Bo=new THREE.Vector3(1,0,0),ko=new THREE.Vector3(0,1,0),Po=new THREE.Vector3(0,0,1),Ro=new THREE.Vector3,Mo=new THREE.Vector3,So=new THREE.Vector3,Do=new THREE.Matrix4,Fo=new THREE.Quaternion,Lo=(Bo=new THREE.Vector3(1,0,0),ko=new THREE.Vector3(0,1,0),Po=new THREE.Vector3(0,0,1),Ro=new THREE.Vector3,Mo=new THREE.Vector3,So=new THREE.Vector3,Do=new THREE.Matrix4,Fo=new THREE.Quaternion,function(e){f(n,THREE.Mesh);var t=Cr(n);function n(e){var i;return o(this,n),(i=t.call(this,new Hr(1e4,1e4,2,2),new Fr({color:"#ff0000",visible:!1,wireframe:!1,side:kr,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"),Bo.set(1,0,0).applyQuaternion("local"===e?this.worldQuaternion:Fo),ko.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:Fo),Po.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:Fo),So.copy(ko),this.mode){case"translate":case"scale":switch(this.axis){case"X":So.copy(this.eye).cross(Bo),Mo.copy(Bo).cross(So);break;case"Y":So.copy(this.eye).cross(ko),Mo.copy(ko).cross(So);break;case"Z":So.copy(this.eye).cross(Po),Mo.copy(Po).cross(So);break;case"XY":Mo.copy(Po);break;case"YZ":Mo.copy(Bo);break;case"XZ":So.copy(Po),Mo.copy(ko);break;case"XYZ":case"E":default:Mo.set(0,0,0)}break;case"rotate":default:Mo.set(0,0,0)}0===Mo.length()?this.quaternion.copy(this.cameraQuaternion):(Do.lookAt(Ro.set(0,0,0),Mo,So),this.quaternion.setFromRotationMatrix(Do)),Lr.prototype.updateMatrixWorld.call(this)}}]),n}()),Qo="move",Ho="rotate",Oo="zoom",Vo="endRotation",_o="moveModel",zo="mode.changed",No="mode.changing",Uo="pano.chosen",Go="closest.pano.changing",jo="flyin.finished",Wo="flying.started",qo="flying.ended",Jo="ready",Yo="start.inside",Zo="start.outside",Xo="view.changed",Ko="warp.interrupted.flyto",$o="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(No,(function(e,n,i,r){if(n==ht.FLOORPLAN){t.shouldShowPlane=!0,setTimeout((function(){t.shouldShowPlane&&t.showCadPlane()}),Math.min(1e3,r))}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],r=this.model.floors.index[e];if(console.log("开始加载floorplan_".concat(e,".png, imgUrl: ").concat(i)),i){var o=r.deferred=new vt;return n=this.player.modeTran&&"floorplan"==this.player.modeTran.split("-")[1]?1:0,$n.load(i,(function(a){if(a.image&&r.deferred==o){r.cadImg=a.image,r.shouldShowPlane?(a.needsUpdate=!0,console.warn("加载完毕floorplan_".concat(e,".png, ").concat(i))):(a.dispose(),console.error("dispose Tex"),a=null);var s=r.plane;if(s)s.material.map=a,s.material.needsUpdate=!0;else{var l=t.createCadPlaneMaterial(a,n);s=new THREE.Mesh(ea,l),r.shouldShowPlane||(s.visible=!1)}t.model.add(s),r.plane=s,t.setCadPlanePose(s,e),r.deferred=null,o.resolve(!0)}}),(function(n){r.deferred=null,r.imgLoadFailed=!0,o.resolve(!1),t.changeModelOpacity("hidePlane"),console.warn("没有floorplan_".concat(e,".png, ").concat(i))})),r.deferred}this.deleteCadPlane(r),r.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 r=e.floors.findIndex((function(e){return e.subgroup==i}));-1==r&&(r=i),t.floorPlanImgUrls[i]=t.app.resource.getUserResourceURL(e.floors[r].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,r=i.getCenter(this.center),o=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){o.x=n.bound.right-n.bound.left,o.z=n.bound.bottom-n.bound.top,r.x=(n.bound.right+n.bound.left)/2,r.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,o,r,!1,n)}},{key:"adjustModelForPlane",value:function(e,t,n,i,r,o){var a=this.model.floors.index[t];if(r)a.plane.position.y=e.max.y+.1;else if(n=n||e.getSize(new THREE.Vector3),i=i||e.getCenter(new THREE.Vector3),o){var s=a.cadImg.width,l=a.cadImg.height,c=a.cadImgRatio=n.x/(s-o.left-o.right),u=c*s,h=c*l;this.width=u,this.height=h;var d=(o.left-o.right)/2*c,p=(o.top-o.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 r=i.plane;if(!r&&!i.imgLoadFailed){var o=this.updateCadPlane(e);return o?o.then((function(){i.shouldShowPlane&&t.showCadPlane(e)})):this.changeModelOpacity()}this.changeModelOpacity(),r&&(r.material.opacity=1,r.visible=!0,r.material.map||(r.material.map=new THREE.Texture(i.cadImg),r.material.map.needsUpdate=!0,r.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 r=2*Math.atan(Math.tan(e*$e.RADIANS_PER_DEGREE/2)*(t/n));return i?r:r*$e.DEGREES_PER_RADIAN},getVFOVFromHFOV:function(e,t,n,i){var r=2*Math.atan(Math.tan(e*$e.RADIANS_PER_DEGREE/2)*(n/t));return i?r:r*$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,r,o=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>o||t.x<0?(r=t.x>o?o:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>o||n<0)&&(i=c(n=r)):i=c(n=r)):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),r=tt.getPos2d(i,this.player);if(r.trueSide){var o=e.pos2d.trueSide?e.pos2d:t.pos2d;return r.inSight&&(r.pos=this.getPosInCrossPoint(o.pos,r.pos),r.vector=null),{result:"p1p2",p1:o,p2:r}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:r},++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,r=t.pos,o=i.distanceTo(r);if(0!=o){var a=Math.acos((i.x-r.x)/o);a%=360,a*=180/Math.PI;var s=i.clone().sub(r),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=o+"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+r.x)/2;else{var v,g;v=e.inSight?i.clone():this.getCrossPoint(r,i),g=t.inSight?r.clone():this.getCrossPoint(i,r);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(r.x==i.x){if(r.y==i.y)return void console.warn("pos1和2一样???");p=r.y<i.y?(d-r.y)/(i.y-r.y):(r.y-d)/(r.y-i.y)}else p=r.x<i.x?(h-r.x)/(i.x-r.x):(r.x-h)/(r.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 ra,oa="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,ra=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){ra.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=ra.model.floors.index[n];if(i){var r=i.boundingBox.min.y,o=i.boundingBox.max.y;for(var a in e.bottom=r,e.top=o,e.points){var s=e.points[a],l=s.parent,c=t.getPos3dFrom2d(s,r),u=t.getPos3dFrom2d(s,o),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,r);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 r=e.split("Point")[1],o=t.split("Point")[1],a="f".concat(n,"-").concat(r,"-").concat(o,"-hor"),s="f".concat(n,"-").concat(o,"-").concat(r,"-hor"),l=ra.cornerRulers.find((function(e){return e.sid==a}));if(l)return{ruler:l,angle:l.angle};if(l=ra.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},ra)}},{key:"addLabel",value:function(e,t,n){var i=new Ki(Object.assign({},ca,{text:e.vectorId.split("Point")[1],player:ra}));i.sprite.material.depthTest=!0;var r=t.clone();r.y+=.2,i.position.copy(r),n.add(i),ca.scale||(ca.scale=he.linearClamp(this.model.size.length(),10,500,.5,7));var o=ca.scale;i.scale.set(o,o,o)}},{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,r=[t,n],o=[];return t.parent&&o.push.apply(o,Q(Object.keys(t.parent))),n.parent&&o.push.apply(o,Q(Object.keys(n.parent))),!!Object.values(e.walls).find((function(a){if(!o.some((function(e){return e==a.vectorId}))){var s=[e.points[a.start],e.points[a.end]];return(i=he.isLineIntersect(r,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),r=this.cad.floors[e.floorIndex];if(!r){if(ra.model.floors.index[e.floorIndex]||1!=ra.model.floors.length)return void console.error("ifPanoSeePoints 没找到楼层");r=ra.model.floors.list[0]}var o=r.bottom,a=1/(2*Math.sin(THREE.MathUtils.degToRad(5))),s=THREE.MathUtils.degToRad(5),l=function(l){var c=r.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,o);if(n&&n(A))return sa&&console.log("点在视频区域内",c),"continue";var y=[];if(m.forEach((function(a,s){y[s]={},a.anotherPoint2d=r.points[a.ruler.pointIds.find((function(e){return e!=l}))],a.anotherPoint=t.getPos3dFrom2d(a.anotherPoint2d,o);var u=(new THREE.Vector2).addVectors(a.anotherPoint2d,c).multiplyScalar(.5);return t.isShelter(r,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,Q(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 r.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=ra.currentPano;if(this.updateList=this.lastShowRulers||[],!this.showRulers||ra.flying||"panorama"!=ra.mode||!e.isAligned()||Je.vrEnabled&&Je.vrSplitScreen)this.lastShowRulers=[];else{e.visibleRulerInfos||this.ifPanoSeePoints(e);var t=ra.getDirection().setY(0).normalize();ra.position;var n=this.getPos2dFrom3d(ra.position),i=na.getHFOVForCamera(ra.cameraControls.activeControl.camera,null,null,!0),r=Ae.sortByScore(e.visibleRulerInfos,[],[function(e){var n=Math.acos(e.midVec.dot(t)),r=Math.min(e.coverRad/2+n,i/2)+Math.min(e.coverRad/2-n,i/2),o=.5*(Math.PI-n),a=5+e.disSquaredToPano/30,s=3*Math.pow(1+r+o,3),l=s/a;return e.logMsg="v ".concat(r,", v2 ").concat(o,", v复合").concat(s,", dis复合 ").concat(a,", "),l}]);if(sa&&console.log(r),r[0]){r[0].item.neibourHorizons.forEach((function(t){return t.ruler.points.forEach((function(t){return t.y=e.floorPosition.y}))})),r[0].item.point.pointRulerInfo.verti.points[0].y=e.floorPosition.y,r[0].item.point.pointRulerInfo.verti.updateText();var o=r[0].item.neibourHorizons.map((function(e){return e.ruler})).concat(r[0].item.point.pointRulerInfo.verti);if(o.forEach((function(e){e.dir=null,e.state="active"})),this.lastShowRulers=o,this.updateList=Ae.getUnionSet(this.updateList,o),2==r[0].item.neibourHorizons.length){var a=n.distanceTo(r[0].item.point),s=r[0].item.neibourHorizons[0].ruler,l=r[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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var da,pa=1.5,fa=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,3)]),n=new THREE.Mesh(new THREE.BoxGeometry(.1,.1,pa));n.position.set(0,0,4.25);var i=new THREE.Mesh(new THREE.CylinderBufferGeometry(0,.3,.5,12,1,!1));i.position.set(0,0,5.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]),r=e.arrowGroup.clone();r.children.forEach((function(e){e.material=e.material.clone(),e.material.color.copy(i)}));var o=e.createLabel(n,i);o.position.set(0,0,6*1.05),r.add(o);var a=e.createLabel("1m",i,20,.4);a.position.set(0,0,1),r.add(a),"y"==n?r.rotation.x=-Math.PI/2:"x"==n&&(r.rotation.y=Math.PI/2),e.add(r)}))}},{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]:1.2,r=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 r.scale.set(i,i,i),r}}]),n}();function ma(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var va=Ce.urlHasValue("highMapColor"),ga=be(da=function(e){f(n,THREE.Object3D);var t=ma(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 pr(this.boundingBox),this.skybox.matrixWorldNeedsUpdate=!0,this.add(this.skybox),this.skyBoxTight=new pr(this.boundingBox,2),nt.debug("Done building model"),or.raycastsDone>0&&(nt.warn("raycasts: "+or.raycastsDone),nt.warn("raycasts skipped: "+or.raycastsSkipped)),this.floorLogos.createFloorLogo(),this.add(this.floorLogos.firstLogo),this.add(this.floorLogos.secondLogo),Ce.urlHasValue("axis")&&this.add(new fa(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 r=i.parameters;this.updateVideoRenderParameters(r)}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 o=document.querySelector("#app .information .right");o&&o.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,r=e.texSizeBlock-Math.min(.5*e.texSizeBlock,i),o=[],a={update:function(){if("panorama"!=n.mode||n.flying||n.lastFrameChanged)o.length=0;else{t&&(delete t.material.defines.useModelMap,t.material.needsUpdate=!0,t=null);var i,a=e.getDrawedTexCount();if(a>r)(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<r){var s=Ae.sortByScore(e.chunks,[function(e){if(!o.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<=r}}],[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,o.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]:{},r=i.mode,o=i.hideVideoFlag;if(this.player){var 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?o||!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((r||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 sr(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 br(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,Q(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 Io(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(Q(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 r=new THREE.Object3D,o=0;o<8;o++)for(var a=0;a<8;a++){var s=new THREE.Mesh(t,new hr({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(o-3.5,a-3.5,-4),va){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=o,s.tileY=a,s.cubeFace=i,s.renderOrder=Me,n.tiles.push(s),r.add(s)}switch(i){case zi:r.rotation.set(0,Math.PI/2,0);break;case Ni:r.rotation.set(0,-Math.PI/2,0);break;case Ui: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);r.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);r.quaternion.copy(c).multiply(u);break;case ji:r.rotation.set(0,Math.PI,0);break;case Wi:r.rotation.set(0,0,0)}r.scale.set(1,-1,1),r.cubeFace=i,n.add(r)}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,r=THREE.MathUtils.degToRad(n.fov)/2,o=this.highMapCube.tiles;o.forEach((function(n){var o=n.getWorldPosition(new THREE.Vector3),a=(new THREE.Vector3).subVectors(o,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>r+.08?-100:-(l/i+c/r)),n.scores=l.toFixed(3)+", "+c.toFixed(3),-100==n.score&&t.resetTile(n)})),this.highMapCube.visibleTiles=o.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 r=this.highMapCube.children[t].children[8*n+i];e&&(r.image=e);var o=r.material.uniforms;if(!o.map.value&&(!this.highMapCube.visibleTiles||this.highMapCube.visibleTiles.includes(r))){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,o.map.value=a,va&&(o.opacity.value=1),r.visible=!0,r.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,va&&(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 Aa(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var ya=function(e){f(n,EventEmitter);var t=Aa(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 Ea(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var wa=function(e){f(n,THREE.Mesh);var t=Ea(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),r=1+.01*i;i<1&&(r-=1-i),this.show(),this.scale.set(r,r,r),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}(),ba="move",Ca="interaction.direct",xa="interaction.key",Ia="input.start",Ta="input.pinch",Ba="input.scroll",ka="autopan.interrupt",Pa="autopan.complete",Ra="autopan.clamped",Ma="longtap",Sa=Object.freeze({None:0,Queued:1,ForceQueued:2,Downloading:3,Downloaded:4,DownloadFailed:5}),Da=Object.freeze({None:0,DirectionalFOV:1}),Fa=function(){var e=function e(t,n){var i=e._panoSpaceDir,r=e._fovThreshold,o=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>=r&&s<r?-1:a<r&&s>=r?1:a>=o&&s<o?-1:a<o&&s>=o||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}(),La=function(){function e(t,n,i,r,a){o(this,e),this.filterAndPrioritize=function(){var t=[],n=[],i=[];return function(r,o,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;"360view"!=this.priorityCriteria.pano.panoType&&(this.populateNeighborPanos(this.priorityCriteria.pano,o,t),this.populateScoredPanos(this.priorityCriteria.pano,o,n,this.priorityCriteria.cameraDir,e.MAX_SCORED_PANOS_TOCONSIDER));var l=this.baseSize,c=this.standardSize,u=this.highSize,h=this.ultraHighSize;this.queueTilesForPano(r,a,this.priorityCriteria.pano,l),this.priorityCriteria.upcomingPanos&&this.queueTilesForPanos(r,this.priorityCriteria.upcomingPanos,a,l,e.MAX_UPCOMING_PANOS_TOADD),i.length=0,this.canDownloadSize(c)&&r.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(r,i),this.queueTilesForPanos(r,n,a,l,e.MAX_SCORED_PANOS_TOADD),i.length=0,r.length<s&&(this.canDownloadSize(u)&&r.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)&&r.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(r,i),i.length=0),r.length<s&&(this.canDownloadSize(c)&&r.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(u)&&r.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(h)&&r.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(r,i)),this.queueTilesForPanos(r,t,a,l)}}(),this.queueTilesForPano=function(){var e={filter:Da.None};return function(t,n,i,r){if(i.tiled)return this.filterAndQueueTileDownloadDescriptors(t,n,i,r,e)}}(),this.queueTilesForPanosInDirection=function(){var e=new THREE.Vector3;return function(t,n,i,r,o,a,s,l){for(var u=0,h=0;h<i.length;h++){var d=i[h];if(e.copy(d.position),e.sub(o),e.normalize(),Math.max(Math.min(a.dot(e),1),-1)>=c.getFOVDotThreshold(s))if(u+=this.queueTilesInDirectionForPano(t,n,d,r,o,a,s)>0?1:0,l&&u>=l)break}return u}}(),this.queueTilesInDirectionForPano=function(){var e={filter:Da.DirectionalFOV,direction:new THREE.Vector3,fov:60},t=new THREE.Vector3;return function(n,i,r,o,a,s,l){if(r.tiled)return t.copy(s),qi.getRelativeDirection(r.quaternion,t),e.direction.copy(t),e.fov=l,this.filterAndQueueTileDownloadDescriptors(n,i,r,o,e)}}(),this.filterAndQueueTileDownloadDescriptors=function(){var e=[];return function(t,n,i,r,o){var a=n.getTileDownloadDescriptors(i,r);e.length=0,this.filterTileDownloadDescriptors(i,a,e,o);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 r,o;switch(i.filter){case Da.DirectionalFOV:for(r=0;r<t.length;r++)o=t[r],qi.isTileWithinFOV(o.panoSize,o.tileSize,o.face,o.tileX,o.tileY,i.direction,i.fov)&&n.push(o);break;default:for(r=0;r<t.length;r++)o=t[r],n.push(o)}for(r=0;r<n.length;r++)o=n[r],this.canIncludeDescriptor(o)||(n[r]=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 r in i)if(i.hasOwnProperty(r)){var o=t.get(r);n.push(o)}return n}},{key:"populateScoredPanos",value:function(t,n,i,r,o){(i=i||[]).length=0;var a=[or.filters.inPanoDirection(t.position,r,e.DIRECTION_SCORE_STRICTNESS),or.filters.not(t)],s=[or.scoreFunctions.distanceSquared(t),or.scoreFunctions.direction(t.position,r)],l=Ae.sortByScore(n.list,a,s);if(l)for(var c=0;c<l.length&&c<o;c++){var u=l[c].item;i.push(u)}return i}},{key:"queueTilesForPanos",value:function(e,t,n,i,r){for(var o=0,a=0;a<t.length;a++){var s=t[a];if(o+=this.queueTilesForPano(e,n,s,i)>0?1:0,r&&o>=r)break}return o}},{key:"queueTilesInDirectionForPanos",value:function(e,t,n,i,r,o,a,s){for(var l=0,c=0;c<n.length;c++){var u=n[c];if(l+=this.queueTilesInDirectionForPano(e,t,u,i,o,a)>0?1:0,s&&l>=s)break}return l}},{key:"canIncludeDescriptor",value:function(e){return e.status!==Sa.Downloading&&e.status!==Sa.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,r){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=r,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=r},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){Fa._panoSpaceDir.copy(i),qi.getRelativeDirection(n.quaternion,Fa._panoSpaceDir),Fa._fovThresholdNarrow=he.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Fa._fovThreshold=he.getFOVDotThreshold(e.DIRECTIONAL_FOV),t.sort(Fa)}},{key:"insertSortedPanoTile",value:function(t,n,i,r){Fa._panoSpaceDir.copy(r),qi.getRelativeDirection(i.quaternion,Fa._panoSpaceDir),Fa._fovThresholdNarrow=he.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Fa._fovThreshold=he.getFOVDotThreshold(e.DIRECTIONAL_FOV);for(var o=-1,a=0;a<t.length;a++){if(Fa(n,t[a])<=0){o=a;break}}if(-1===o)t[t.length]=n;else{for(var s=t.length;s>o;s--)t[s]=t[s-1];t[o]=n}}}]),e}();La.DIRECTIONAL_FOV=180,La.DIRECTIONAL_FOV_NARROW=120,La.MAX_SCORED_PANOS_TOCONSIDER=6,La.MAX_SCORED_PANOS_TOADD=2,La.MAX_UPCOMING_PANOS_TOADD=3,La.DIRECTION_SCORE_STRICTNESS=.75;var Qa={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()&&(Qa.SEMICOLON=59,Qa.PLUSEQUALS=61,Qa.DASHUNDERSCORE=173);var Ha="model-added",Oa="active-model-changed";function Va(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var _a=function(e){f(n,e);var t=Va(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}(ya),za=function(){function e(t,n,i){o(this,e),this.flightStepWalk=function(e,t,n){var i=new THREE.Vector3,r=new THREE.Vector3,o=function(e,t){var n=Math.min(this.player.position.distanceTo(e.position),Je.transition.flytimeMaxDistanceThreshold)*Je.transition.flytimeDistanceMultiplier+Je.transition.flyTime;r.copy($i.FORWARD),this.player.getDirection(r),i.copy(t).sub(e.position).normalize();var o=i.dot(r),a=Math.acos(o),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=o.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,r=!1,o=0;o<this.nodes.length;o++){var a=this.nodes[o],s=n.get(a);this.nodes.length,r=i&&s.position.distanceTo(i.position)<Je.warp.walkMinDist,i&&r||(e.push(a),i=s)}r&&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,r=new THREE.Vector3;return function(o,a,s){var l=o.length;if(a>=l)return!1;var c=1,u=1;t.set(0,0,0),r.set(0,0,0);for(var h=null,d=a;d<a+3&&!(d>=l);d++){if(h=this.player.model.panos.get(o[d]),this.getOrientationForWalkingTourNode(o,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),r.lerp(h.position,u)}return t.normalize(),s.copy(r),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(Oa,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,r=new THREE.Vector3,o=t[t.length-1];if(n<1){i=n*o;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 r.copy(e[a]),r.sub(e[a-1]),r.multiplyScalar(s),r.add(e[a-1]),r}}else r.copy(e[e.length-1]);return r}},{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,r,o){return new _a({cameraMode:i,position:e,quaternion:t,panoId:n,orthoZoom:o,floorVisibility:r,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),r=new _a(i);if(r){var o=r.isPano()?r.panoId:r.cameraMode;nt.debug('ShowPath.getHeroDescriptorByHeroIndex() -> New brush/warp destination: "'+o+'" out of '+t+" choices.")}return r}},{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 r=t.id+":"+e.id+":"+n;if(this.shortPaths.hasOwnProperty(r))return this.shortPaths[r]?this.shortPaths[r].slice().reverse():null;var o=this.model.panos.aStarSearch(e,t);return this.model.panos.includeNodesNearPath(o,n),this.shortPaths[i]=o?o.slice():null,o}},{key:"makePathHulls",value:function(e){var t,n,i,r,o,a=0,s=[],l=[],c=[],u=this.model.panos;r=(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>r?Je.path.colorUp:i<r?Je.path.colorDown:Je.path.color),h>0&&((o=l[h].distanceTo(l[h-1]))>a&&(a=o));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,r=this.pointPathDistance(e)-2*i,o=e.slice(0),a=o[1].clone().sub(o[0]);a.y=0,a.normalize().multiplyScalar(i),o[0]=(new THREE.Vector3).copy(o[0]).add(a),(a=o[o.length-2].clone().sub(o[o.length-1])).y=0,a.normalize().multiplyScalar(i),o[o.length-1]=(new THREE.Vector3).copy(o[o.length-1]).add(a);var s=new THREE.CatmullRomCurve3(o),l=Math.floor(r/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:r,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,r=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(r.position)).clone().negate(),t.multiplyScalar(.15).add(r.position),n.multiplyScalar(.15).add(this.warpDestPano.position),t.y=r.position.y,n.y=this.warpDestPano.position.y,i=new THREE.CubicBezierCurve3(r.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 o=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){o.copy(this.warpPathPoints[c-1]).sub(this.warpPathPoints[c]);var u=o.length();o.y*=Je.warp.climbEffort;var h=o.length()/u;if(c>1){o.setY(0).normalize(),a.copy(this.warpPathPoints[c-2]).sub(this.warpPathPoints[c-1]).setY(0).normalize();var d=Math.min(1,o.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,r=new THREE.Vector3(0,this.pathHeight(),0),o=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(r);l.sub(i),o.vertices.push(l),(l=(new THREE.Vector3).copy(e[s]).add(r)).add(i),o.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)],o.faces.push(c),o.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)],o.faces.push(c),o.faceVertexUvs[0].push([new THREE.Vector2(0,m),new THREE.Vector2(1,f),new THREE.Vector2(1,m)])}o.computeFaceNormals(),o.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(o,u);return A.name="ribbon",this.player.mode===ht.PANORAMA&&(A.renderOrder=He),A}},{key:"drawPathPavement",value:function(e){for(var t,n=new THREE.Vector3,i=new THREE.BufferGeometry,r=new THREE.Vector3,o=0;o<e.length;o+=1)r.copy(e[o]),0===o?r.sub(e[o+1]).negate():r.sub(e[o-1]),r.normalize(),n.crossVectors(r,$i.UP),n.multiplyScalar(this.brushPrefs.paveWidth),(t=(new THREE.Vector3).copy(e[o])).sub(n),i.vertices.push(t),i.vertices.push((new THREE.Vector3).copy(e[o])),(t=(new THREE.Vector3).copy(e[o])).add(n),i.vertices.push(t);var a,s,l;for(o=0;o<e.length-1;o+=1)a=3*o+1,l=(s=.25*o)+.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(),r=new THREE.CylinderGeometry(n,n,i,32),o=THREE.UniformsUtils.clone(sn.waypoint.uniforms);o.map.value=e,o.opacity.value=0,o.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:o,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(r,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),r=this.makeWaypointObj(this.pathImg.pathStart,"Start");return r.rotateOnAxis(new THREE.Vector3(0,1,0),i),r.position.copy(e),r}},{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 r=this.getHeroDescriptorByHeroIndex(i);if(null===r)return n;if(!r.isPano())return n;var o=this.getHeroPano(r),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(o===this.player.currentPano)return c($i.FORWARD.clone().applyQuaternion(r.quaternion).setY(0).normalize());var u=this.findShortestPath(this.player.currentPano,o);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,r=new THREE.Vector3;nt.debug("Starting wait: "+(void 0!==t));var o=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*o/n;i.y+=c,r.set(0,0,-1),r.applyEuler(i),r.add(l.position),l.controls.lookAt(r),l.controls.lookVector.copy(r),l.lookAt(r)}else this.player.mode===ht.DOLLHOUSE?this.playerControls.controls[ht.DOLLHOUSE].rotationAcceleration.x=o: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!==ot&&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],r=new THREE.Vector3(0,0,1).applyQuaternion(n).normalize(),o=new THREE.Vector3(0,0,1).applyQuaternion(i.quaternion).normalize().dot(r),a=THREE.MathUtils.radToDeg(Math.acos(o)),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 r=i||0,o=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(o.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(o.position),o.controls.lookAt(h),o.controls.lookVector.copy(h),o.lookAt(h)}.bind(this);return pe.start(d,t,n,r,de[Je.warp.movementEasing])}},{key:"_warpStepCameraAim",value:function(e,t,n){var i=this.playerControls.cameras[ht.PANORAMA],r=new THREE.Euler(0,0,0,Je.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Je.warp.eOrder),o=(new THREE.Euler).setFromQuaternion(i.quaternion,Je.warp.eOrder),a=new THREE.Euler(r.x-o.x,r.y-o.y,r.z-o.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(o):s.copy(r),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 r=this.warpDestPano.position;if(null!==this.nodes&&this.cameraHull&&this.cameraHull.length>1){var o=new THREE.Vector3;t<.5?o.copy(this.cameraHull[1]).sub(i).normalize().multiplyScalar(Je.warp.softPushDist*t).add(i):o.copy(this.cameraHull[this.cameraHull.length-2]).sub(r).normalize().multiplyScalar(Je.warp.softPushDist*Je.warp.softPushEnd*(1-t)).add(r),n.position.copy(o)}else t<.5?n.position.copy(i):n.position.copy(r)}},{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=rt),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),r=(new THREE.Euler).setFromQuaternion(n.quaternion,Je.warp.eOrder),o=new THREE.Euler(i.x-r.x,i.y-r.y,i.z-r.z,Je.warp.eOrder);o.y=he.constrainedTurn(o.y);var a=1e3*Math.abs(o.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 r=It.uniform(this.model.skybox,"progress",1),o=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 r(e,t)}.bind(this),c=function(e,t){return n&&a?(o(0),!0):void o(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],r=(Math.min(.25,3/this.warpLength),Math.min(.35,7/this.warpLength)),o=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=r;return THREE.MathUtils.smoothstep(e,0,t)*(1-THREE.MathUtils.smoothstep(e,1-t,1))},x=function(){return p.lookAt(h,t,$i.UP),o.setFromRotationMatrix(p,Je.warp.eOrder),c.setFromQuaternion(i.quaternion,Je.warp.eOrder),f.set(o.x-c.x,o.y-c.y,o.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,r){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),o.setFromRotationMatrix(p,Je.warp.eOrder),c.setFromQuaternion(i.quaternion,Je.warp.eOrder),f.set(o.x-c.x,o.y-c.y,o.z-c.z,Je.warp.eOrder),f.y=he.constrainedTurn(f.y),o.x=c.x+l*f.x,o.y=c.y+l*f.y,o.z=c.z+l*f.z,f.set(o.x-u.x,o.y-u.y,o.z-u.z,Je.warp.eOrder),f.y=he.constrainedTurn(f.y);var m=THREE.MathUtils.degToRad(Je.warp.maxTurnPerSec)*r/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 r=e||0;null!=t||(t=Je.warp.teleportTime),this.warpCommonParameters(t,r,!1,n),this.model.chunks.forEach((function(e){e.material.uniforms.blackout.value=n})),this._warpBendAim(null,t,null,r);var o=function(){this.wrapupWarpShadingOnly(i,n)}.bind(this),a=this.player.position.clone();pe.start(this.stepWarpPath.bind(this,a),t,o,r,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 r=this.player.model.panos.get(e[t]),o=this.player.model.panos.get(e[t+1]);n.copy(o.position).sub(r.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 r=function(){this._wrapupTravel(i)}.bind(this),o={pano:this.warpDestPano,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(o,r)}}},{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 r=!(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),o=this.chooseWarpPath(r);if(o&&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(Uo,this.player.currentPano,this.warpDestPano),this.startWarpState();var s=function(){this.endWarpState(),i&&i()}.bind(this);o?this.warpCameraTravel(r,t,n,s):this.warpCameraAim(s),this.player.smoothZoomToDefault(Je.zoom.restoreTime)}}}]),e}(),Na="zoom.in",Ua="zoom.out",Ga="zoom.max",ja="zoom.min";function Wa(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var qa=new WeakMap,Ja=function(t){f(i,t);var n=Wa(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,r){var o=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){o.decodeDracoFile(e,n).catch(r)}),i,r)}},{key:"decodeDracoFile",value:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};return this.decodeGeometry(e,r).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,i=this,r=JSON.stringify(t);if(qa.has(e)){var o=qa.get(e);if(o.key===r)return o.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,r){n._callbacks[a]={resolve:i,reject:r},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)})),qa.set(e,{key:r,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 r=t.attributes[i],o=r.name,a=r.array,s=r.itemSize;n.setAttribute(o,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 r=Ya.toString(),o=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([o]))})),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 r=n.workerPool[n.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}},{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 Ya(){var e,t;function n(e,t,n,i,r,o){var a=o.num_components(),s=n.num_points()*a,l=s*r.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,r),u=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,o,c,l,u);var h=new r(e.HEAPF32.buffer,u,s).slice();return e._free(u),{name:i,array:h,itemSize:a}}onmessage=function(i){var r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var o=r.buffer,a=r.taskConfig;t.then((function(e){var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(o),o.byteLength);try{var l=function(e,t,i,r){var o,a,s=r.attributeIDs,l=r.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,a=t.DecodeBufferToMesh(i,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,a=t.DecodeBufferToPointCloud(i,o)}if(!a.ok()||0===o.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(r.useUniqueIDs)f=s[h],p=t.GetAttributeByUniqueId(o,f);else{if(-1===(f=t.GetAttributeId(o,e[s[h]])))continue;p=t.GetAttribute(o,f)}u.attributes.push(n(e,t,o,h,d,p))}c===e.TRIANGULAR_MESH&&(u.index=function(e,t,n){var i=3*n.num_faces(),r=4*i,o=e._malloc(r);t.GetTrianglesUInt32Array(n,r,o);var a=new Uint32Array(e.HEAPF32.buffer,o,i).slice();return e._free(o),{array:a,itemSize:1}}(e,t,o));return e.destroy(o),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:r.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}}))}}}var Za=new THREE.GLTFLoader,Xa=new Ja;Xa.setDecoderPath($n.getImageURL("images/loaders/DRACOLoader/draco/")),Za.setDRACOLoader(Xa);var Ka=function(e,t){Za.load(e,t)};function $a(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var es,ts={},ns=function(e){f(n,THREE.Object3D);var t=$a(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,r=n.quaternion;this.position.copy(i),this.quaternion.copy(r)}else{this.position.copy(this.overlay.position),this.quaternion.copy(this.overlay.quaternion);var o=this.computeOverlayTransform(),a=o.position,s=o.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,r=Je.overlay.height*this.overlay.scale.y;switch(this.type){case"ground_1":t.add(new THREE.Vector3(0,(ts[this.type].height+r/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,ts[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,(r/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 r=t.children[1].material;n.material=r,e.dispatchEvent({type:"createDone"})}))}else{this.parts.body=new THREE.Group,this.parts.body.rotateX(-Math.PI/6),this.add(this.parts.body);var r=new THREE.Mesh(new THREE.BoxGeometry(.02,Je.overlay.height,.02),t);r.position.z-=.01;var o=new THREE.Mesh(new THREE.BoxGeometry(.1,.01,.04),t);o.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=r,this.parts.body.top=o,this.parts.body.bottom=a,this.parts.body.backFace=s,this.parts.body.add(r,o,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;r.material=o.material=a.material=s.material=n,e.dispatchEvent({type:"createDone"})})),this.parts.body.position.y+=ts[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,r=t.uvs,o=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(r),2)),e.geometry.setIndex(new THREE.BufferAttribute(new Uint16Array(i),1)),o?e.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(o),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+ts[this.type].height,0).applyQuaternion(this.quaternion));break;case"ground_2":this.overlay.position.copy(this.position).add(new THREE.Vector3(0,ts[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,ts[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,ts[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+ts[this.type].height,0),this.overlay.position.copy(this.position).add(new THREE.Vector3(0,n/2+ts[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),r=i.vertices,o=i.normals;this.parts.body.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(r),3)),o&&this.parts.body.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(o),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],r=1;r<i.vertices.length;r+=3)i.vertices[r]+=t/2+i.border;i.uvs=[];for(var o=0;o<i.vertices.length*(2/3)/8;o++)i.uvs.push(0,1,1,1,1,0,0,0);return i}},{key:"initBracketMeshData",value:function(e){var t=this;if(ts[this.type]&&ts[this.type].loaded)e&&e(ts[this.type].object.clone());else{if("ground_1"==this.type){var n=.2;return ts[this.type]={object:null,height:.58*n,loaded:!1},Ka($n.getImageURL("images/brackets/bracket_1.glb"),(function(i){var r=i.scene;r.position.y*=n,r.rotateY(Math.PI/2),r.scale.set(n,n,1/2.44),r.children.forEach((function(e){"Plane"!==e.name&&e.material.color.setRGB(.3,.3,.3)})),ts[t.type].object=r,ts[t.type].loaded=!0,e&&e(r)})),ts[this.type]}if("ground_2"==this.type){var i=.5;ts[this.type]={object:null,height:.795,loaded:!1},Ka($n.getImageURL("images/brackets/bracket_2.glb"),(function(n){var r=n.scene;r.children.forEach((function(e){"dizuo001"==e.name?e.material.opacity=.6:e.material.color.setRGB(.3,.3,.3)})),r.scale.set(i,i,i),r.position.y+=.01,ts[t.type].object=r,ts[t.type].loaded=!0,e&&e(r)}))}}}},{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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var rs=function(e){f(n,THREE.Object3D);var t=is(n);function n(e,i,r){var a;o(this,n),a=t.call(this),es=!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=Q(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",es?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,!es){var r=i.needsUpdate;Object.defineProperty(i,"needsUpdate",{get:function(){return r},set:function(e){(r=!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 ns(e);n.setOverlay(this,t),this.player.OverlayManager.frameGroup.add(n)}}else{var i=this.frame.computeOverlayTransform({reverse:!0}),r=i.position,o=i.quaternion;this.frame.position.copy(r),this.frame.quaternion.copy(o)}}},{key:"dispose",value:function(){this.plane.material.dispose(),this.plane.material.map=null,this.parent.remove(this)}},{key:"inSight",value:function(){if(es)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,r=this.getCornerPoint(),o=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),o.multiplyScalar(a),r.diffLon<o.x||r.diffLat<o.y)return!1;for(var l=0,c=(i=r.diffLon<15&&r.diffLat<15?[r.cornerPoint[0]]:r.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 r=-1/0,o=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;r=Math.max(c,r),o=Math.min(c,o),a=Math.max(h,a),s=Math.min(h,s)}));var h=r-o,d=a-s;return d>180?t=e:(r+=u.lon,a+=u.lat,o+=u.lon,s+=u.lat,t=[he.getDirByLonLat(r,a),he.getDirByLonLat(o,s),he.getDirByLonLat(r,s),he.getDirByLonLat(o,a)].map((function(e){return e.negate().add(l)})),t=[n].concat(Q(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]})),r=e.priorityEvent.indexOf(n);r<i.index&&(i.index=r,i.cursor=n[t])})),this.currentCursorIndex=i.index,this.domElements.forEach((function(e){return e.style.cursor=i.cursor||""}))}}};function as(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var ss=function(e){f(n,EventEmitter);var t=as(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 ls(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var cs=function(e){f(n,e);var t=ls(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}(ss);function us(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var hs=function(e){f(n,EventEmitter);var t=us(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 ds(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var ps=function(e){f(n,e);var t=ds(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}(hs);function fs(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var ms=function(e){f(n,EventEmitter);var t=fs(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 cs(i.player):new ps(i.player),i.add(new rs(i.player,a,i.overlayVideoPlayer))}return r.boxPhotos&&r.boxPhotos.length&&r.boxPhotos.forEach((function(e){i.add(new rs(i.player,e))})),e.on("collectIntersectMesh",(function(e){e.push.apply(e,Q(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(Wo,(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(qo,(function(t){var n,r=t.currentPano;"panorama"==e.mode&&(n=r.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,r=new THREE.Object3D,o=[0,1,3,2],a=0;a<4;a++){var s=[{x:i[3*o[a]],y:i[3*o[a]+1],z:i[3*o[a]+2]},{x:i[3*o[(a+1)%4]],y:i[3*o[(a+1)%4]+1],z:i[3*o[(a+1)%4]+2]}];r.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=r,e.plane.add(r)}}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),r=-e.width*i/$("#player").width(),o=player.cameraControls.activeControl?player.cameraControls.activeControl.camera:player.camera,a=new THREE.Vector3(r,0,-1).unproject(o).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,r=n.forceFlyToPlane,o=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(!r){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),r=n.dot(i.normalize());return v[t.id]=r,200*r},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:o})}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 vs(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var gs=function(e){f(n,EventEmitter);var t=vs(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)),r=e.intersect.point.add(t.multiplyScalar(.01)),o=new rs(this.player,{sid:Ae.getRandomSid(),floorIndex:this.player.model.currentFloor.floorIndex,pos:r,qua:i,modified:"new",frameType:n+"_1"});o.updateMatrixWorld(),this.player.OverlayManager.clickOverlay(o),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),r=Math.round(Math.abs(e.width)*i),o=Math.round(Math.abs(e.height)*i);this.VideoManager.emit("videos/panel/changeSize",{wText:e.width.toFixed(2),hText:e.height.toFixed(2),width:r,height:o,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,r="video"==this.editPlane.overlayType?n.videoHeight:n.height;if("suitSize"==e){var o=Math.min(Math.max(i,r)/200,1);if(i>r)var a=o,s=o*r/i;else s=o,a=o*i/r}else{var l=Math.sqrt(Math.abs(this.editPlane.width*this.editPlane.height)/(i*r));a=l*i*(this.editPlane.width<0?-1:1),s=l*r*(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 As(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("store",(function(){return function(e){f(r,e);var t,n,i=As(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}(mr)}));var ys,Es,ws={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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Cs=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,ys=t.model.panos.list.filter((function(e){return e.isAligned()})),Es=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,Q(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:ws.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(ys,[function(e){return e.isAligned()}],[function(e){return-e.position.distanceTo(n.position)}]);if(1==i.length)return void console.log("仅有一个漫游点");var r=[],o=Math.max(2*-i[1].score,4);if("all"==e)(r=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<o)a(n,i[s].item)&&(i[s].block=!0),i[s].good=!0;else{if(r||(r=i.filter((function(e){return e.good&&!e.block}))),!(r.length<2))break;if(!a(n,i[s].item))if(0==r.length)r.push(i[s]);else{var l=r[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==r.length&&r.push(i[0]),r.forEach((function(e){return t.dealPanoVisible(e.pano.id)}))}console.log(r)}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:ws.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 r=e.id;this.savePanoVisiChange(r,t)}}}},{key:"savePanoVisiChange",value:function(e,t){for(var n=this.searchNeib(e),i=n.seeMarkers,r=n.neighbourUUIDs,o=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),r.push(t[a].id),o[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=r.indexOf(t[a].id))>-1&&r.splice(s,1),o[t[a].id]=!1;this.panoVTemp[t[a].id]={neighbourPanos:h,seeMarkers:c,neighbourUUIDs:u}}this.panoVTemp[e]={neighbourPanos:o,seeMarkers:i,neighbourUUIDs:r}}},{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),ys.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=Es[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 r=Ae.sortByScore(ys,[function(t){return e.checkHasNeighbor(t)}],[function(e){return-e.position.distanceTo(i.player.currentPano.position)}]);r&&r.length?(this.player.currentPano=r[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=Es[e].seeMarkers.slice(0),t.neighbourUUIDs=Es[e].neighbourUUIDs.slice(0),t.neighbourPanos=Ae.CloneObject(Es[e].neighbourPanos)),t}},{key:"turnToPanoIndex",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=Es[e[n]],r=ys.indexOf(i);t.push(r)}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(Es[n]),e=!0;else if(-1==i.name.indexOf("new")&&!i.visible){var r=t.map((function(e){return e.id})).indexOf(n);if(-1==r){console.log("visiblePanos删除error");continue}t.splice(r,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(Es[e.id].footIcon,"linked")}},{key:"dealTagVisible",value:function(e,t){this.tagsVLines[t]?(this.tagsVLines[t].visible=!this.tagsVLines[t].visible,this.changeIconLinkState(Es[t].footIcon,!!this.tagsVLines[t].visible&&"linked"),this.tagsVLines[t].visible||this.player.$app.gui.toast({event:"DialogList3D.TagManger.unLink",content:ws.TagManger.unLink,showClose:!0})):this.createTagSingleLine(Es[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(Es[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(Es[i].footIcon,"linked")):t.createTagSingleLine(Es[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=Es[n];if(!i.panoType){var r=i.floorPosition.clone(),o=ui.createLine([e.floorPosition.clone(),r],{color:xe.green,deshed:i.floorIndex!=e.floorIndex});this.meshGroup.add(o),o.name="PanoVL-"+t+"-"+n,i.floorIndex!=e.floorIndex&&(o.material.opacity=.5),this.panoVLines[n]=o,this.activePano&&(i.floorIndex!=e.floorIndex?this.changeIconLinkState(Es[n].footIcon,"otherFloorLink"):this.changeIconLinkState(Es[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:ws.WalkManger.deactive})):(this.lastFloorActivePano=null,this.pauseSetPanoVisible("unsaved"),this.SetOnePanoVisible(Es[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus())):(this.lastFloorActivePano=null,this.SetOnePanoVisible(Es[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus()));else if(!t||"ActionIcon"==t.type)if(this.activePano){var r;if(this.panoVLines[e]?(this.panoVLines[e].visible=!this.panoVLines[e].visible,r=this.panoVLines[e].visible,this.changeIconLinkState(Es[e].footIcon,Es[e].footIcon.visible?!!this.panoVLines[e].visible&&"linked":"otherFloorLink")):(this.createPanoSingleLine(this.activePano,"new",e),r=!0),this.startEditPano||(this.startEditPano=this.activePano),r)this.changeIconVisiState(Es[e].footIcon,!0),this.changeIconVisiState(this.activePano.footIcon,!0),t&&"ActionIcon"==t.type&&this.player.$app.WalkManager.emit(this.checkLinkStatus());else{var o=this.player.$app.core.get("Scene").firstView.pano;if(Es[e].floorIndex!=this.activePano.floorIndex)Es[e].footIcon.visible=!1;else{var a=this.checkHasNeighbor(Es[e]);this.changeIconVisiState(Es[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==o)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:ws.WalkManger.firstPointLimit}),void this.dealPanoVisible(e,t);s||this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:ws.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(Es[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(Es[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(ys,[function(e){return e.isAligned()}],[function(t){return-t.position.distanceTo(Es[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(Es[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:ws.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:ws.WalkManger.firstPointLimit}),!1;this.createPanoVisiLines(Es[e],!0),Object.values(this.panoVLines).forEach((function(e){e.visible=!1})),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:ws.WalkManger.hide}),this.saveLastPanoVi(Es[e]),this.delVisibleLines()}ys.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 r=.4;r*=40/Math.sqrt(Math.min(this.player.domElement.clientWidth,this.player.domElement.clientHeight)),r=THREE.MathUtils.clamp(r,.3,.7);var o=new THREE.PlaneGeometry(r,r,1,1),a=o.clone();a.scale(.5,.5,.5),ys.forEach((function(e){var t=new xs(o,e);t.material.uniforms.map.value=e.hasVideo?i.footTex1_v:i.footTex1,t.visible=!1,e.footIcon=t;var n=new Is(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,ys.forEach((function(r){if(r.label.parent!=r.footIcon){r.label._oriScale=r.label.scale.x;var o=1.65*r.label.scale.x;r.label.scale.set(o,o,o),r.footIcon.add(r.label),r.footIcon.label=r.label}if(r.floor==n)r.footIcon.visible=!0,i.changeIconLinkState(r.footIcon,!1),t&&i.changeIconVisiState(r.footIcon,i.checkHasNeighbor(Es[r.id],"beforeCreateLine")),e&&r==e?(r.footIcon.oriScale=new THREE.Vector3(1.5,1.5,1.5),t&&i.changeIconLinkState(r.footIcon,"center")):(r.footIcon.oriScale=new THREE.Vector3(1,1,1),r.footIcon.actionIcon.visible=!0);else{var a=(i.panoVTemp&&i.panoVTemp[r.id]?i.panoVTemp[r.id].neighbourUUIDs:r.neighbourUUIDs).filter((function(t){return e&&t==e.id}));r.footIcon.oriScale=new THREE.Vector3(1,1,1),a.length>0?(t&&i.changeFloorIconState(r.footIcon),i.changeIconLinkState(r.footIcon,"otherFloorLink")):r.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 Es)if(Es[e].isAligned()&&this.checkHasNeighbor(Es[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:ws.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=Es[e.name],i=(this.panoVTemp&&this.panoVTemp[n.id]?this.panoVTemp[n.id].neighbourUUIDs:n.neighbourUUIDs).filter((function(e){return Es[e].floorIndex!=n.floorIndex&&(!t.activePano||!t.panoVLines[e]||t.panoVLines[e].visible)})).map((function(e){return Es[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||Es[this.activePano.id].neighbourUUIDs).map((function(e){return Es[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})),r="upper"==t?i.id+1:i.id-1,o=n.find((function(e){return e.id==r}));return console.log("getFloor",t,e,o.subgroup),o.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)Es[i].floor.floorIndex==this.player.model.currentFloor.floorIndex&&this.tagsVLines[i].visible?(this.tagsVLines[i].material.opacity=1,this.changeIconLinkState(Es[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}(),xs=function(e){f(n,THREE.Mesh);var t=bs(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}(),Is=function(e){f(n,THREE.Mesh);var t=bs(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 Ts(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Bs=function(e){f(n,THREE.EventDispatcher);var t=Ts(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()),r=100/this.position.distanceTo(this.player.camera.position),o=e.pos.clone().add(i.multiplyScalar((r+i.length())/i.length()));this.elem.style.left=o.x+"px",this.elem.style.top=o.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 ks(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Ps,Rs=1.6,Ms=.2,Ss=new THREE.Vector3(0,0,-1),Ds=new THREE.MeshStandardMaterial({transparent:!0,color:new THREE.Color(1,1,1),opacity:.45,metalness:1,emissive:new THREE.Color(.85,.85,.85)}),Fs=Ds.clone();Fs.opacity=.9;var Ls=function(e){f(n,THREE.Object3D);var t=ks(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(Ms,Ms,Ms),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(!Ps){var e=[{x:0,y:0},{x:1,y:.8},{x:1,y:Rs},{x:0,y:.8},{x:-1,y:Rs},{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),Ps=new THREE.ExtrudeBufferGeometry(t,{depth:.4,bevelEnabled:!1})}var r=new THREE.Mesh(Ps,Ds);return r.rotation.x=Math.PI/2,r}},{key:"setPosition",value:function(e){var t=new THREE.Vector3(e.points2d[0].x,e.bottom+.4*Ms,-e.points2d[0].y),n=new THREE.Vector3(e.points2d[1].x,e.bottom+.4*Ms,-e.points2d[1].y),i=t.clone().add(n).multiplyScalar(.5),r=t.clone().sub(n).normalize(),o=new THREE.Matrix4;o.set(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1),r.applyMatrix4(o);var a="LEFT"==e.openSide?r.multiplyScalar(-1):r;"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(Ss,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 r=new Bs(this.player,{sid:"entry",pos:this.dollLabelOriPos,driftDir:t,noLine:!0,text:W.i18n("model.enter"),toPano:i,floorIndex:n});this.player.defaultRoomLabels.push(r),this.dollLabel=r}},{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*Ms))}},{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=Fs:t.material=Ds})),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){Ds.depthTest=e,Fs.depthTest=e}}]),n}(),Qs={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 Qs){var n=Qs[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}();U('#compass {\r\n display: none;\r\n position: absolute;\r\n width: 90px;\r\n height: 90px;\r\n pointer-events: none;\r\n}\r\n\r\n#compass .north {\r\n color: #02a0e9;\r\n top: 0;\r\n}\r\n#compass .south {\r\n color: #ff1414;\r\n bottom: 0;\r\n}\r\n\r\n#compass .dirText {\r\n text-align: center;\r\n font-size: 10px;\r\n position: absolute;\r\n line-height: 25px;\r\n\r\n color: rgb(255, 255, 255);\r\n top: 50%;\r\n left: 50%;\r\n width: 45%;\r\n height: 0px;\r\n transform-origin: left center;\r\n}\r\n\r\n#compass #dirTextX {\r\n color: rgb(255, 0, 0);\r\n}\r\n\r\n#compass #dirTextY {\r\n color: rgb(0, 255, 0);\r\n}\r\n\r\n#compass #dirTextZ {\r\n color: rgb(0, 0, 255);\r\n}\r\n\r\n#compass .dirText span {\r\n display: block;\r\n position: absolute;\r\n right: 5px;\r\n top: 0;\r\n width: 20px;\r\n height: 20px;\r\n line-height: 20px;\r\n margin-top: -10px;\r\n}\r\n\r\n#compass .center {\r\n width: 50px;\r\n height: 50px;\r\n background-size: contain;\r\n background-position: center;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n position: absolute;\r\n}\r\n#compass .center canvas{\r\n position: relative;\r\n left: 0;\r\n top: 0;\r\n width: 100%;\r\n height: 100%;\r\n display: block;\r\n background-color: transparent;\r\n}\r\n\r\n.widgets-doll-labels a, .widgets-plan-labels a, .widgets-doors a {\r\n color: #fff;\r\n font-size: 14px;\r\n line-height: normal;\r\n font-family: OpenSans,sans-serif;\r\n user-select: none;\r\n}\r\n\r\n.widgets-doll-labels .room-label {\r\n position: absolute;\r\n width: 0;\r\n height: 0;\r\n -webkit-transform: translateZ(0);\r\n transform: translateZ(0);\r\n -webkit-animation: room-label 0.3s ease 0.1s;\r\n animation: room-label 0.3s ease 0.1s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n cursor: pointer;\r\n}\r\n\r\n.widgets-doll-labels .room-label:not(.noLine):after {\r\n content: "";\r\n display: block;\r\n position: absolute;\r\n width: 4px;\r\n height: 68px;\r\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABQCAYAAADYxx/bAAAASElEQVQYlY2QwQoAIAhDR///x6Z2CCaGSpfHNoegcHdfAGwBCKVUMdAMK7IKm2Wh2oSOdkaUhVbG3u++x7aqPbX9lWVEdn9/AGvVUp4wTpLmAAAAAElFTkSuQmCC");\r\n background-size: contain;\r\n background-repeat: no-repeat;\r\n bottom: 0;\r\n left: 50%;\r\n -webkit-transform: translate(-50%);\r\n transform: translate(-50%);\r\n}\r\n.widgets-doll-labels .room-label a {\r\n display: block;\r\n position: absolute;\r\n line-height: 22px;\r\n top: -66px;\r\n transform: translate(-50%, -100%);\r\n text-align: center;\r\n white-space: nowrap;\r\n font-size: 12px;\r\n font-style: normal;\r\n pointer-events: auto;\r\n \r\n background-repeat: no-repeat;\r\n background-size: 100% 100%;\r\n background: rgba(210, 210, 210, 0.7);\r\n border: 1px solid rgba(255, 255, 255, 0.4);\r\n border-radius: 3px; \r\n text-shadow: 0px 1px 3px rgb(0,0, 0, 0.5);\r\n}\r\n .widgets-doll-labels .room-label a::before {\r\n content: "";\r\n position: absolute;\r\n left: -1px;\r\n top: -1px;\r\n width: 10px;\r\n height: 10px;\r\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiIHZpZXdCb3g9IjAgMCA2IDYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogICAgPHRpdGxlPm1hcF9jb3JuZXIgIDwvdGl0bGU+DQogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4NCiAgICAgICAgPGcgaWQ9IuWxleekuueVjOmdoi3kuInnu7QiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01Ni4wMDAwMDAsIC0yNzAuMDAwMDAwKSIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJub256ZXJvIj4NCiAgICAgICAgICAgIDxnIGlkPSLnvJbnu4QtMTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxLjAwMDAwMCwgMjcwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LDYgTDUsNiBMNSwyLjcwNSBMMy4zMDEsMSBMMCwxIEwwLDAgTDMuNzE1MjI2NDEsMCBMNiwyLjI5MzQ0Nzk1IEw2LDYgWiIgaWQ9Im1hcF9jb3JuZXItLSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4wMDAwMDAsIDMuMDAwMDAwKSBzY2FsZSgtMSwgMSkgdHJhbnNsYXRlKC0zLjAwMDAwMCwgLTMuMDAwMDAwKSAiPjwvcGF0aD4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=);\r\n background-repeat: no-repeat;\r\n background-position: top left;\r\n }\r\n .widgets-doll-labels .room-label a::after {\r\n content: "";\r\n position: absolute;\r\n left: -1px;\r\n bottom: -1px;\r\n width: 10px;\r\n height: 10px;\r\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiIHZpZXdCb3g9IjAgMCA2IDYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogICAgPHRpdGxlPm1hcF9jb3JuZXIgIDwvdGl0bGU+DQogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4NCiAgICAgICAgPGcgaWQ9IuWxleekuueVjOmdoi3kuInnu7QiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01Ni4wMDAwMDAsIC0yNzAuMDAwMDAwKSIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJub256ZXJvIj4NCiAgICAgICAgICAgIDxnIGlkPSLnvJbnu4QtMTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxLjAwMDAwMCwgMjcwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LDYgTDUsNiBMNSwyLjcwNSBMMy4zMDEsMSBMMCwxIEwwLDAgTDMuNzE1MjI2NDEsMCBMNiwyLjI5MzQ0Nzk1IEw2LDYgWiIgaWQ9Im1hcF9jb3JuZXItLSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4wMDAwMDAsIDMuMDAwMDAwKSBzY2FsZSgtMSwgMSkgdHJhbnNsYXRlKC0zLjAwMDAwMCwgLTMuMDAwMDAwKSAiPjwvcGF0aD4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=);\r\n background-repeat: no-repeat;\r\n background-position: top left;\r\n transform: rotate(270deg);\r\n }\r\n .widgets-doll-labels .room-label a > p {\r\n margin: 0;\r\n padding: 2px 10px;\r\n height: 100%;\r\n line-height: 1.5;\r\n }\r\n .widgets-doll-labels .room-label a > p::before {\r\n content: "";\r\n position: absolute;\r\n right: -1px;\r\n top: -1px;\r\n width: 10px;\r\n height: 10px;\r\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiIHZpZXdCb3g9IjAgMCA2IDYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogICAgPHRpdGxlPm1hcF9jb3JuZXIgIDwvdGl0bGU+DQogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4NCiAgICAgICAgPGcgaWQ9IuWxleekuueVjOmdoi3kuInnu7QiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01Ni4wMDAwMDAsIC0yNzAuMDAwMDAwKSIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJub256ZXJvIj4NCiAgICAgICAgICAgIDxnIGlkPSLnvJbnu4QtMTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxLjAwMDAwMCwgMjcwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LDYgTDUsNiBMNSwyLjcwNSBMMy4zMDEsMSBMMCwxIEwwLDAgTDMuNzE1MjI2NDEsMCBMNiwyLjI5MzQ0Nzk1IEw2LDYgWiIgaWQ9Im1hcF9jb3JuZXItLSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4wMDAwMDAsIDMuMDAwMDAwKSBzY2FsZSgtMSwgMSkgdHJhbnNsYXRlKC0zLjAwMDAwMCwgLTMuMDAwMDAwKSAiPjwvcGF0aD4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=);\r\n background-repeat: no-repeat;\r\n background-position: top left;\r\n transform: rotate(90deg);\r\n }\r\n .widgets-doll-labels .room-label a > p::after {\r\n content: "";\r\n position: absolute;\r\n right: -1px;\r\n bottom: -1px;\r\n width: 10px;\r\n height: 10px;\r\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiIHZpZXdCb3g9IjAgMCA2IDYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+DQogICAgPHRpdGxlPm1hcF9jb3JuZXIgIDwvdGl0bGU+DQogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4NCiAgICAgICAgPGcgaWQ9IuWxleekuueVjOmdoi3kuInnu7QiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01Ni4wMDAwMDAsIC0yNzAuMDAwMDAwKSIgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJub256ZXJvIj4NCiAgICAgICAgICAgIDxnIGlkPSLnvJbnu4QtMTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMxLjAwMDAwMCwgMjcwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LDYgTDUsNiBMNSwyLjcwNSBMMy4zMDEsMSBMMCwxIEwwLDAgTDMuNzE1MjI2NDEsMCBMNiwyLjI5MzQ0Nzk1IEw2LDYgWiIgaWQ9Im1hcF9jb3JuZXItLSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4wMDAwMDAsIDMuMDAwMDAwKSBzY2FsZSgtMSwgMSkgdHJhbnNsYXRlKC0zLjAwMDAwMCwgLTMuMDAwMDAwKSAiPjwvcGF0aD4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=);\r\n background-repeat: no-repeat;\r\n background-position: top left;\r\n transform: rotate(180deg);\r\n }\r\n\r\n.widgets-doll-labels .room-label.noLine a {\r\n top: 16px;\r\n}\r\n\r\n.widgets-doll-labels .room-label a span {\r\n white-space: nowrap;\r\n user-select: none;\r\n}\r\n\r\n.widgets-doll-labels .room-label.with-entrance:after {\r\n display: none;\r\n}\r\n\r\n.widgets-doll-labels .room-label.with-entrance a {\r\n top: 50%;\r\n width: 38.5px;\r\n height: 15.75px;\r\n background-size: 38.5px 15.75px;\r\n -webkit-transform: translate(-50%, -50%);\r\n transform: translate(-50%, -50%);\r\n}\r\n\r\n.widgets-doll-labels .room-label.with-entrance a span {\r\n margin-left: -0.875px;\r\n margin-top: -0.875px;\r\n}\r\n\r\n.widgets-plan-labels .room-label {\r\n position: absolute;\r\n -webkit-animation: room-label 0.3s ease 0.1s;\r\n animation: room-label 0.3s ease 0.1s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n}\r\n\r\n.widgets-plan-labels .room-label a {\r\n display: block;\r\n position: absolute;\r\n line-height: 24px;\r\n -webkit-transform: translate(-50%);\r\n transform: translate(-50%, -50%);\r\n text-align: center;\r\n white-space: nowrap;\r\n font-size: 14px;\r\n font-style: normal;\r\n}\r\n\r\n.widgets-doors {\r\n position: absolute;\r\n pointer-events: none;\r\n top: 0;\r\n left: 0;\r\n bottom: 0;\r\n right: 0;\r\n}\r\n\r\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\r\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\r\n margin-right: 3.5px;\r\n -webkit-transform: rotate(180deg);\r\n transform: rotate(180deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\r\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before,\r\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.left a:after,\r\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\r\n content: "";\r\n position: relative;\r\n display: inline-block;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n vertical-align: middle;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.left a:after {\r\n margin-left: 4px;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.back a:after,\r\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.left a:after {\r\n content: "";\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n margin-left: 4px;\r\n -webkit-transform: rotate(-90deg);\r\n transform: rotate(-90deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before ,\r\n.widgets-doors[data-camera-toward=right] .door.show-arrow.back a:before {\r\n margin-right: 3.5px;\r\n -webkit-transform: rotate(180deg);\r\n transform: rotate(180deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.back a:before,\r\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\r\n content: "";\r\n position: relative;\r\n display: inline-block;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n vertical-align: middle;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\r\n margin-left: 4px;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.right a:after {\r\n -webkit-transform: rotate(-90deg);\r\n transform: rotate(-90deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward=back] .door.show-arrow.back a:after,\r\n.widgets-doors[data-camera-toward=left] .door.show-arrow.left a:after,\r\n.widgets-doors[data-camera-toward=left] .door.show-arrow.back a:after,\r\n.widgets-doors[data-camera-toward=left] .door.show-arrow.right a:after {\r\n content: "";\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n margin-left: 4px;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.back a:after {\r\n position: relative;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\r\n position: relative;\r\n margin-right: 3.5px;\r\n -webkit-transform: rotate(180deg);\r\n transform: rotate(180deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after,\r\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\r\n content: "";\r\n display: inline-block;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n vertical-align: middle;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after {\r\n margin-left: 4px;\r\n -webkit-transform: rotate(-90deg);\r\n transform: rotate(-90deg);\r\n}\r\n\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\r\n margin-left: 4px;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before,\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\r\n content: "";\r\n position: relative;\r\n display: inline-block;\r\n width: 10.5px;\r\n height: 10.5px;\r\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4NCiAgPGcgaWQ9ImltZ19hcnJvdyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcyMSAtNTkzKSI+DQogICAgPHBhdGggaWQ9Iui3r+W+hF8xNDQ1IiBkYXRhLW5hbWU9Iui3r+W+hCAxNDQ1IiBkPSJNNTI1LjU4LDUxMC43NzNsLTQuNzM4LTQuNTg4YS42MjIuNjIyLDAsMCwwLS40MzQtLjE3M0g1MTcuN2EuNjI1LjYyNSwwLDAsMSwuNDM1LjE3M2w0LjczOCw0LjU4OGEuMzcuMzcsMCwwLDEsMCwuNTRsLTQuNzM5LDQuNTMyYS42MjEuNjIxLDAsMCwxLS40MzIuMTY3aDIuNzExYS42MjEuNjIxLDAsMCwwLC40MzEtLjE2N2w0LjczOS00LjUzMkEuMzcuMzcsMCwwLDAsNTI1LjU4LDUxMC43NzNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMDkuMzAzIDg2Ljk4OSkiIGZpbGw9IiNmZmYiLz4NCiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+DQogIDwvZz4NCjwvc3ZnPg0K) no-repeat 50%;\r\n background-size: 100% 100%;\r\n vertical-align: middle;\r\n}\r\n\r\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before {\r\n margin-right: 3.5px;\r\n -webkit-transform: rotate(180deg);\r\n transform: rotate(180deg);\r\n}\r\n\r\n.widgets-doors .door {\r\n position: absolute;\r\n width: 0;\r\n height: 0;\r\n /* display: none; */\r\n -webkit-animation: viewport-door-label 0.3s ease 1s;\r\n animation: viewport-door-label 0.3s ease 1s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n -webkit-transform: translateZ(0);\r\n transform: translateZ(0);\r\n cursor: pointer;\r\n}\r\n\r\n.widgets-doors .door a {\r\n display: block;\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n -webkit-transform: translate(-50%, -50%);\r\n transform: translate(-50%, -50%);\r\n border-radius: 1.75px;\r\n background: rgba(0, 0, 0, 0.5);\r\n line-height: 14px;\r\n padding: 8px 8px;\r\n border-radius: 4px;\r\n white-space: nowrap;\r\n font-size: 14px;\r\n font-style: normal;\r\n pointer-events: auto;\r\n -webkit-transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\r\n transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\r\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease;\r\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\r\n}\r\n\r\n.widgets-doors .door a:after {\r\n -webkit-transition: opacity 0.3s ease;\r\n transition: opacity 0.3s ease;\r\n}\r\n\r\n.widgets-doors .door a:active {\r\n background: rgba(0, 0, 0, 0.5);\r\n color: hsla(0, 0%, 100%, 0.5);\r\n}\r\n\r\n.widgets-doors .door a:active:after {\r\n opacity: 0.5;\r\n}\r\n\r\n@-webkit-keyframes room-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px;\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0;\r\n }\r\n}\r\n\r\n@keyframes room-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px;\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0;\r\n }\r\n}\r\n\r\n@-webkit-keyframes door-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px;\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0;\r\n }\r\n}\r\n\r\n@keyframes door-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px;\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0;\r\n }\r\n}',{});var Os=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 r=e.player.model.floors.index[i];if(r){r.entryArrow=[];var o=r.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=Vs(n.endPoint,t.angle,s),n.startPoint=Vs(n.startPoint,t.angle,s),n.points2d=(n.points2d||[]).map((function(e){return Vs(e,t.angle,s)}))})),a.tags&&Object.keys(a.tags).forEach((function(e){var n=a.tags[e];n.center=Vs(n.center,t.angle,s),n.points2d=n.points2d.map((function(e){return Vs(e,t.angle,s)}))})),a.rooms&&Object.keys(a.rooms).forEach((function(e){var n=a.rooms[e];n.center=Vs(n.center,t.angle,s)})),a.points&&Object.keys(a.points).forEach((function(e){var n=a.points[e],i=Vs({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=o+.1,l.floorIndex=i,r.entryArrow.push(new Ls(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=r.center.y;Object.keys(a.tags).forEach((function(t){var n=a.tags[t],o=n.des&&parseFloat(n.des).toFixed(2),s=n.title,l=o+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(r.children[0]);m[0]?(f=m[0].point).y+=.5:f.y=h;var v=e.player.model.panos.closestPanoTowardPoint({point:f,floor:r});v||console.error("what!!! no closetPano");var g=new Bs(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 r=this.player.model.floors.index[e],o=r.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}))})),r.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&&(r.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 r=t.tags[i];r._atRoom||n.searchAtRoom(t,e,r,{x:r.center.x,y:r.center.y},(function(e){r._atRoom=e,e.taggings.push(r),e.name+=r.title+" "}))}))),e.taggings.length&&e.panos.forEach((function(i){var r=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)}]);r&&r.length&&(r.slice(0,3).find((function(e){var r=e.item,o=new THREE.Vector2(i.position.x,i.position.z),a=new THREE.Vector2(r.center.x,-r.center.y);return!n.isShelter(t,a,o)}))||r[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)})),r.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=r.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),r=new THREE.Vector2(e.position.x,e.position.z);return-i.distanceTo(r)+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,o+.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 or.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),r=this.player.model.floors;null!=t&&(r=r.filter((function(e){return e.floorIndex==t}))),r.forEach((function(t){if(t.entryArrow.length){if(i)if(0==e)i=!1;else{var r=n.player.modeTran.split("-")[1];i="floorplan"==r||"panorama"!=r&&"dollhouse"==r}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,r){var o=this;if(he.isPointInArea(t.points,i)){if(t.closetChilds)t.closetChilds.find((function(t){return o.searchAtRoom(e,e.rooms.find((function(e){return e.roomId==t})),n,i,r)}))||r(t);else r(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 r=[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(r,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 Vs(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 r=(i.x-n.x)*Math.cos(t)-(i.y-n.z)*Math.sin(t)+n.x,o=(i.y-n.z)*Math.cos(t)+(i.x-n.x)*Math.sin(t)+n.z;return i.x=r,i.y=o,i}var _s,zs,Ns,Us,Gs,js,Ws,qs,Js,Ys,Zs,Xs,Ks,$s=new THREE.Vector3(0,0,-1),el=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,r=Math.min(n,i);if(r<450){var o=Math.round(r/450*1e3)/1e3;this.dom.transform=" scale(".concat(o,")")}}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=[],r=0,o=e.attributes.position.count;r<o;++r)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))},r=[20/255,146/255,170/255];i(e,[1/255,238/255,245/255],r),i(t,r,[40/255,60/255,103/255]);var o=new THREE.Mesh(e,n);o.position.setY(1),e.computeVertexNormals(),t.computeVertexNormals();var a=new THREE.Object3D;a.add(o);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=$s.clone();if("transitioning"==this.player.mode){var r=new THREE.Camera;r.position.copy(this.camera.position),r.lookAt(r.position.clone().add(n)),t=r.quaternion.invert().premultiply(e)}var o=new THREE.Vector3(0,1,0);t&&o.applyQuaternion(t),n.projectOnPlane(o),i.projectOnPlane(o);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 tl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var nl={},il=function(e,t,n){Xs.material.uniforms.tDiffuse.value=t;var i=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI/2);Ys.quaternion.copy((new THREE.Quaternion).multiplyQuaternions(i,n));var r=new THREE.Vector3(0,0,-8).applyQuaternion(Ys.quaternion);Ys.position.copy(r.clone().negate());var o=zs.renderer.autoClear;zs.renderer.autoClear=!1,zs.renderer.setRenderTarget(e),zs.renderer.render(Zs,Ys),zs.renderer.setRenderTarget(null),zs.renderer.autoClear=o},rl=function(e){return console.log(e),e&&!e.includes("/")?Ns.resource.getUserResourceURL(e):e},ol=function(e){f(n,THREE.EventDispatcher);var t=tl(n);function n(e,i){var r;return o(this,n),r=t.call(this),Ks=!(Ns=e).config.view,_s=i,zs=Ns.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){nl=e.v})),Ns.Scene.on("loadeddata",(function(){var e=Ns.store.getValue("links");if(e)return _s.model.builded?void r.init(e):_s.model.addEventListener("builded",r.init.bind(h(r),e));r.init()})),r}return u(n,[{key:"init",value:function(e){var t=this;al.init(),this.createViews(e),_s.model.add(this.ViewLinkCircles),_s.model.add(this.ViewLinkBalloons),_s.model.add(this.ViewLinkExits),_s.model.add(this.ViewTitles),this.inited=!0,_s.currentPano&&_s.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=[];_s.on("collectIntersectMesh",(function(e,r){if(t.inited&&t.enabled){var o=!0;if(_s.isOutsideMode()?i=nl.markView?[nl.markView.balloon.mesh]:t.ViewLinkBalloons.children:_s.is360View(_s.mode,_s.currentPano)?(i=nl.settingEntry?[]:nl.settingVisibles?t.ViewLinkCircles.children:t.ViewLinkExits.children.concat(t.ViewLinkCircles.children),o=!1):nl.markView?(i=[nl.markView.circle.mesh],o=!1):i=t.ViewLinkCircles.children,o)e.push.apply(e,Q(i));else{var a=tt.getMouseIntersect(_s.camera,i,_s.mouse);a&&i.includes(a.object)&&(n=a,t.dealwithIntersect(a),r.consume())}}})),_s.on("judgeIntersect",(function(e,r){r.getConsumed()||(e&&i.includes(e.object)?(n=e,r.consume()):n=null,t.dealwithIntersect(n))})),_s.on("click",(function(e){e.getConsumed()||t.dealWithClick()&&e.consume()})),_s.on("update",(function(e){e.hasChanged.cameraChanged&&t.update()})),_s.on("mode.changing",(function(e,n,i,r){if("panorama"==e)setTimeout((function(){for(var e in t.views)t.views[e].balloon.showOrHide(!0,r/2,"auto"),t.views[e].circle.setVisible(!1);nl.markView&&nl.markView.circle.setVisible(!0)}),r||500);else if("floorplan"==e)for(var o in t.views)t.views[o].balloon.mesh.material.depthTest=!0;if("floorplan"==n&&setTimeout((function(){for(var e in t.views)t.views[e].balloon.mesh.material.depthTest=!1}),r),"panorama"==n){for(var a in t.views)t.views[a].balloon.showOrHide(!1),t.views[a].circle.setVisible(!0);nl.cancelPos&&nl.cancelPos()}})),_s.model.on("floor.changed",(function(e,t,n){if("panorama"!=_s.mode||"panorama"==t){var i=_s.model.allFloorsVisible;_s.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){nl.markView!=e&&e.balloon.showOrHide(!1,500)}))}))}})),_s.$app.config.view&&_s.on(qo,(function(e){var n,i=e.currentPano;"panorama"==_s.mode&&(n=i.getVideoFilter()),t.ViewLinkCircles.children.forEach((function(e){n&&n(e.position)?Ae.updateVisible(e,"coveredPanoVideo",!1):Ae.updateVisible(e,"coveredPanoVideo",!0)}))})),Ns.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 al(e);this.addView(t)}}.bind(this)),"panorama"!=_s.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||nl.markView&&nl.markView.circle==this.hoverCircle||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverCircle.setSelect(!1)),!this.hoverBalloon||this.hoverBalloon.mesh==n||nl.markView&&nl.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})}nl.markView==t&&(_s.currentPano!=t.pano||nl.settingExit||nl.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(Ns.config.link&&"object"==typeof Ns.config.link){var n=t.url;"function"==typeof Ns.config.link.onAction&&(n=Ns.config.link.onAction(n)),n&&("blank"==Ns.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&&(_s.is360View(_s.mode,_s.currentPano)?_s.currentPano.view.backToPanorama():_s.enteringView&&_s.once("flying.ended",(function(){_s.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(_s.flying)return _s.once("flying.ended",(function(){t.focusOn(e)}));"panorama"==_s.mode?_s.flyToPano({pano:e.nearestPano,lookAtPoint:e.circle.mesh.position,checkAlone:!0}):_s.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 r in this.views)this.views[r].circle.at360View&&this.views[r].circle.updatePos("normal"),t.flyOut||this.views[r].circle.setVisible(!0);t.flyOut&&nl.markView&&nl.markView.circle.setVisible(!0)}}},{key:"exitView",value:function(){var e=new vt;return _s.is360View(_s.mode,_s.currentPano)?(_s.currentPano.view.backToPanorama(),_s.once(qo,(function(){e.resolve()}))):e.resolve(),e.promise()}}]),n}(),al=function(e){f(n,THREE.EventDispatcher);var t=tl(n);function n(e){var i;return o(this,n),(i=t.call(this)).sid=e.sid,i.pano=null,i.balloon=new cl(e,h(i)),i.circle=new ll(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,(Ks||"pano"==i.linkType)&&(i.exitDoor=new ll(Object.assign({},e,{circleType:"exitDoor",exitDirection:i.exitDirection}),h(i))),i.titleLabel=new ul(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=Ns.resource.getUserImagesURL("panorama/".concat(i.imgSid,"/low/").concat(e.thumb)),i.resolution=e.resolution),i.nearestPano=e.nearestPano&&_s.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(),_s.currentPano==this.pano?this.backToPanorama():this.entering&&_s.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=_s.model.panos.list.indexOf(this.pano);_s.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 or(_s.$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(_s.$app.core.get("PanoRenderer")),n.qualityManager=_s.$app.core.get("QualityManager"),n.tiled&&(n.tileDownloader=_s.$app.core.get("TileDownloader")),n.build1(),n.view=this,_s.model.panos.add(n),this.panoImgVersion=e.version,t&&_s.currentPano==this.pano){var i=function e(){_s.checkAndWaitForPanoLoad(n,"high","low",_s.basePanoSize,e)||(_s.model.setProjectedPanos(n,n),n.enter())};_s.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(){Ks&&(t.unDealTex=i),il(n,i,t.enterQuaternion)}));return i.flipY=!1,i.minFilter=THREE.LinearFilter,this.renderTarget=n,n.texture}},{key:"mapChangeRot",value:function(){il(this.renderTarget,this.unDealTex,this.enterQuaternion)}},{key:"enter360Pano",value:function(e){_s.isOutsideMode()?_s.flyToNewMode({mode:"panorama",pano:this.pano,callback:e}):(_s.cameraControls.activeControl&&(_s.cameraControls.activeControl.insideLookLimitUp=89.9,_s.cameraControls.activeControl.insideLookLimitDown=-89.9,_s.cameraControls.activeControl.limitAngleIsBound=!1),_s.flyToPano({pano:this.pano},(function(){"function"==typeof e&&e(),_s.model.floorLogos.changefloorLogoOpa({dur:0,index:0,opa:0})})))}},{key:"backToPanorama",value:function(){_s.cameraControls.activeControl&&(_s.cameraControls.activeControl.insideLookLimitUp=null,_s.cameraControls.activeControl.insideLookLimitDown=null,_s.cameraControls.activeControl.limitAngleIsBound=!0),_s.flyToPano({pano:_s.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,_s.currentPano!=this.pano&&_s.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}();al.init=function(){al.inited||(Us=new THREE.PlaneBufferGeometry(.4,.4),Gs=new THREE.PlaneBufferGeometry(1.5,1.5),js=$n.load($n.getImageURL("images/img_pamove.png")),Ws=$n.load($n.getImageURL("images/img_pamove_normal.png")),qs=$n.load($n.getImageURL("images/img_panorama_dot.png")),Js=$n.load($n.getImageURL("images/img_exit_dot.png")),Ws.minFilter=THREE.LinearMipmapNearestFilter,Ws.needsUpdate=!0,(Ys=new THREE.PerspectiveCamera).fov=80,Ys.aspect=1,Ys.updateProjectionMatrix(),(Zs=new THREE.Scene).add(Ys),Xs=new THREE.Mesh(new THREE.SphereBufferGeometry(10,25,25),new THREE.RawShaderMaterial({uniforms:THREE.UniformsUtils.clone(rn.uniforms),vertexShader:rn.vertexShader,fragmentShader:rn.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide})),Zs.add(Xs),al.inited=!0)};var sl=function(e){f(n,THREE.EventDispatcher);var t=tl(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(_s.camera.quaternion),t=!0),this.strictScale){var n="floorplan"==_s.mode?_s.cameraControls.activeControl.camera:_s.camera,i=he.getScaleForConstantSize({dom:_s.$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}(),ll=function(e){f(n,e);var t=tl(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(Us,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()}_s.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=Ns.resource.getAppURL("images/link/exit-style-".concat(e.style.exit.name,".png")):e.style.exit.url&&(n=rl(e.style.exit.url)),t=$n.load(n);else t=Js}else t=Js;else if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=$n.load(rl(e));else{var i;if(e.style)e.style.enter.name&&"custom"!=e.style.enter.name?i=Ns.resource.getAppURL("images/link/enter-style-".concat(e.style.enter.name,".png")):e.style.enter.url&&(i=rl(e.style.enter.url)),t=$n.load(i);else t=qs}else t=qs;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}(sl),cl=function(e){f(n,e);var t=tl(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=js,t.mapOut2.value=Ws,t.opacity.value=0;var n=new THREE.Mesh(Gs,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"!=_s.getToMode()&&(_s.model.allFloorsVisible||!this.view.floor||this.view.floor==_s.model.currentFloor));t=null!=t?t:500;var r=e?1:0;pe.cancelById("balloonOpa_"+this.sid),this.mesh.material.uniforms.opacity.value!=r&&(e&&(this.mesh.visible=!0),this.update(!0),pe.start(It.uniform(this.mesh,"opacity",r),t,(function(t){i.mesh.material.depthTest="floorplan"!=_s.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}(sl),ul=function(e){f(n,e);var t=tl(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:_s,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 hl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var dl=function(e){f(n,e);var t=hl(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 fl(this.sceneRenderer.renderer,{width:this.width,height:this.height}),this.bufferShader=new pl({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)),r=n.angleTo(i)*Math.sign(-n.y),o=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=o.angleTo(s)*Math.sign(o.dot(l));if(this.bufferShader.uniforms.iAngle.value=c,this.bufferShader.uniforms.iPitch.value=r,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)),r=this.paintData.find((function(e){return e.panoId==t})),o=r&&(r.data||this.app.resource.getUserResourceURL(r.fileName));this.currentPaintUrl=null!=t?o:i,this.setPaintImage(i,o)}}},{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,Q(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}(mr),pl=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)},fl=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 r=[this.writeBuffer,this.readBuffer];this.readBuffer=r[0],this.writeBuffer=r[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 r=this.height-1-i,o=t.createImageData(this.width,1),a=r*this.width*4,s=0;s<n;s++)o.data[s]=255*e[a+s];t.putImageData(o,0,i)}return this.base64=this.outputCanvas.toDataURL("image/png"),this.base64}}]),e}();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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var vl=function(e){f(n,THREE.Group);var t=ml(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,Ka("".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}(),gl=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(),r=e[i]+n.angle;t.selecting.axisAngle[i]=((r+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 vl(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 Al(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("Player",(function(){return function(e){f(n,EventEmitter);var t=Al(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(Uo,(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(Wo,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(Qo,e),this.mode===ht.PANORAMA&&this.emit(Ho,{quaternion:this.cameraControls.activeControl.camera.quaternion,mode:ht.PANORAMA,currentPanoId:this.nextPano?this.nextPano.id:this.currentPano?this.currentPano.id:null,type:"rotate"})},e.handleControlInputStart=function(e){this.emit($o,e)},e.onModeUpdated=function(e,t){this.cameraControls.activateControls(t),this.emit(zo,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(ba,this.handleControlMove.bind(this)),this.cameraControls.on(Ia,this.handleControlInputStart.bind(this)),this.cameraControls.on(Ta,this.handleControlPinch.bind(this)),this.cameraControls.on(Ba,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(Vo,{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(Vo,{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(Vo,{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(ba,"key")}.bind(this),n=e.which;switch(n){case Qa.F:t(),this.changeFloor(-1);break;case Qa.R:t(),this.changeFloor(1)}if(this.mode===ht.PANORAMA)switch(n){case Qa.UPARROW:case Qa.W:this.flyLocalDirection($i.FORWARD.clone());break;case Qa.DOWNARROW:case Qa.S:this.flyLocalDirection($i.BACK.clone());break;case Qa.A:this.flyLocalDirection($i.LEFT.clone());break;case Qa.D:this.flyLocalDirection($i.RIGHT.clone())}if(this.started)switch(n){case Qa.ONE:this.insideMode();break;case Qa.TWO:this.flyToNewMode({mode:ht.DOLLHOUSE});break;case Qa.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(Oo,{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 r,o={x:e,y:t};i||(o=he.handelPadding(e,t,this.domElement)),he.convertScreenPositionToNDC(o.x,o.y,this.mouse,this.domElement),he.convertScreenPositionToNDC(o.x,o.y,this.mouseAtMouseDown,this.domElement),this.mouseCouldBeClickToMove=!0,this.mouseDown=!0,this.updateIntersect();this.emit("pointerStart",{consume:function(){r=!0},getConsumed:function(){return r}}),r||(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,r=he.handelPadding(e,t,this.domElement);he.convertScreenPositionToNDC(r.x,r.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(r);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,r=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 o=[].concat(Q(this.linkEditor.actionIcons),Q(this.linkEditor.footIcons)).filter((function(e){return e.pano.floorIndex==r.model.currentFloor.floorIndex}));if(this.intersect=this.getMouseIntersect(null,o),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(ba,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(Ma,"touch"),!0},e.start=function(e){var t=this,n=e.mode,i=e.pano,r=e.position,o=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,r,o,a,l):(this.startOutside(e,l),this.once(qo,(function(e){t.emit(Jo,c,e,a),t.started=!0}))),this.compass=new el(this),this.linkEditor=new Cs(this),this.labelManager=new Os(this),l},e.startOutside=function(e,t){var n=e.mode,i=e.pano,r=e.position,o=e.quaternion,a=e.zoom,s=e.floorVisibility,l=e.tag;this.emit(Zo,Je[n].transitionTime),this.isOutsideMode(n)?(this.model.warpDestFloors(s,!0),pe.cancelById(Je.freeze.FlyToViewFloor),n===ht.FLOORPLAN?this.floorplanMode(r,o,a):this.dollhouseMode(r,o),t.resolve(!1)):this.startInsideWithFlyin(i,r,o,l,t),this.beforeChangeMode(null,n)},e.startInside=function(e,t,n,i,r){r=r||vt(),this.currentPano=e;var o=e&&!e.isAligned();if(t=o?e.position:t||e.position,n=n||e.quaternion,e){var a=this.startInside.bind(this,e,t,n,i,r);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(Uo,this.currentPano,this.currentPano),this.switchCameraMode(this.mode,n),this.emit(Yo,o);var s=this.$app.core.get("PanoVideoRenderer");return s.setMuted(!0),s.activatePanorama(this.currentPano),r.resolve(!0),r},e.startInsideWithFlyin=function(e,t,n,i,r){if(r=r||vt(),this.dollhouseMode(),!e)return nt.warn("Player.startInsideWithFlyin() -> targetPano is invalid."),r.resolve(!1),r;t=t||e.position;var o=n||this.cameraControls.activeControl.camera.quaternion,a=e.position;return this.fitDollhouse(a,t,o),setTimeout(function(t){this.cameraControls.activeControl&&(this.cameraControls.activeControl.maxDistance=t);var i={mode:ht.PANORAMA,pano:e,quaternion:n,callback:function(){this.emit(jo),r.resolve(!0)}.bind(this)};this.flyToNewMode(i)}.bind(this,this.cameraControls.activeControl.maxDistance),Je.startupFlyinDelay),r},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,r){Ae.delayOneFrame(function(){i[t]=!1,a[e.id]&&a[e.id](n,r),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,r){if(!e)throw new BasicException("Player.checkAndWaitForWholePanoLoad() -> Cannot load texture for null pano.");return r&&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,r,o,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 o&&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){r&&r(e,t,n)}.bind(this)),!0}),e.switchCameraMode=function(e,t,n,i,r){var o,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),o=t?$i.FORWARD.clone().applyQuaternion(t):this.getDirection().setY(0).normalize(),s.lookAt(o.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())}r?a.fitBoundSize?s.zoomToContain(this.fitBoundSize):s.currentScale=s.absoluteScale=r: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(Xo,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 r=this.panosTaskList.length>1?this.panosTaskList.map((function(e){return e.pano})):[];this.updateTileDownloader(r),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(){if(this.currentPano&&this.model.supportsTiles){var e=this.cameraControls.controls[ht.PANORAMA];e.locked=e.lockedForce||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 r=t[i+1];r.isLoaded(this.basePanoSize)||e[r.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,r),Je.tiling.panoPreRenderDelay),e[r.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 r,o=function(){r=!0},a=function(){return r},s=[];if(this.emit("collectIntersectMesh",s,{consume:o,getConsumed:a}),!r){var l=this.panoMarkers.filter((function(t){return t.visible&&or.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,Q(this.getColliders())),this.intersect=this.getMouseIntersect(null,s),this.emit("judgeIntersect",this.intersect,{consume:o,getConsumed:a}),!r))&&(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,r=void 0!==i&&i,o=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,r);if(0===s.length)return null;if("getAll"==o)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=[or.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(or.filters.not(this.currentPano)),i.push(or.filters.isNeighbourPanoTo(this.currentPano)),i.push(or.filters.inFloorDirection(this.currentPano.floorPosition,this.getDirection(),.25)),i.push(or.filters.isCloseEnoughTo(e.point,Je.panoFloorClickRadius)),i.push(or.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(or.filters.isOnVisibleFloor()),this.mode!==ht.FLOORPLAN&&i.push(or.filters.inDirection(this.position,this.getDirection(),.25));n=this.model.panos.find(i,[or.sortFunctions.floorDistanceToPoint(e.point)])}n!==this.closestPano?(n&&(this.isPanoHover=!0),this.emit(Go,this.closestPano,n,this.mode),this.closestPano=n):this.isPanoHover=!1}},e.dollhouseMode=function(e,t){this.modeTran="dollhouse-panorama",this.emit(No,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 r=$i.FORWARD.clone().applyQuaternion(t),o=(e=this.model.center.clone().sub(e)).dot(r);o>0?n=r.clone().multiplyScalar(o).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 r="Cannot change mode during mode transition";this.mode===ht.PANORAMA&&(r="Already in panorama mode"),n.reject(r)}return n.promise()},e.fitDollhouse=function(e,t,n){var i=this.model.boundingBox.max.y,r=$i.FORWARD.clone().applyQuaternion(n);n=r.clone().add(e),this.cameraControls.activeControl.target.copy(n),this.cameraControls.activeControl.camera.position.set(0,2.4*i,0).add(e).add(r.multiplyScalar(-10))},e.floorplanMode=function(e,t,n,i){this.mode=ht.FLOORPLAN;var r=this.cameraControls.controls[ht.FLOORPLAN];r.reset();var o=e||this.model.center;if(r.target.copy(o).setY(0),r.camera.position.copy(o).setY(Je.floorplan.cameraHeight),n?(r.currentScale=n/(this.domElement.clientWidth/this.domElement.clientHeight),r.absoluteScale=r.currentScale):r.zoomToContain(this.model.size,i),t){var a=$i.LEFT.clone().applyQuaternion(t);r.rotateLeft(-Math.atan2(a.x,a.z))}else r.rotateToView(this.model.size,this.getDirection());r.update(0)},e.getAimToNextPano=function(e,t,n){var i;if(!t&&!n){var r={importance:0,aim:null};this.emit("ifFocusPoint",r),r.aim&&r.importance>=3&&(t=r.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 o=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180));t=$i.FORWARD.clone().applyQuaternion(o.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,r=e.lookAtPoint,o=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&&r&&0==i.neighbourUUIDs.filter((function(e){return e!=i.id})).length){var f=this.model.panos.closestPanoTowardPoint({point:r,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,r,o);o=m.aimQua;m.hasVideo,e.quaternion=o,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)){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(o){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(o),C=w.angleTo(b),x=function(){g(!0),n.emit("flytopano.rotateEnd",{})};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 x();y.copy(e.quaOri),It.quaternion(y,o)(t),E.copy(tt.getAimByQua(y,this.cameraControls.activeControl.camera.position)),this.cameraControls.activeControl.lookAt(E)}.bind(this),s,x,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 I=this.currentPano;if(this.nextPano=i,this.emit(Uo,this.currentPano,i),this.emit(Wo,{panoId:i.id,quaternion:o,lastPanoId:I.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:r,aimQua:o},(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}),o&&!v&&(this.flyingWithRot=!0,e.aimQua=o),e.chunkProgress=this.judgeHideWall(i),this.startTransition(e)}}else t&&t(!1)}else this.flyToNewMode({mode:ht.PANORAMA,pano:i,duration:a,quaternion:o,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 r=this.currentPano.position.distanceTo(e.pano.position),o=THREE.MathUtils.clamp(1-2/r,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)*r/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>o&&1==e.flyCount&&e.easeFun==de.linearTween&&1==t.panosTaskList.length){e.easeFun=de.easeOutSine;var f=(1-d)*r;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),r=e.currentSpeed,o=this.computeDuration(n);r=Math.max(.002,r),n.duration=i/r,n.quaternion&&(n.duration=o),n.flySpeed=i/o,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 r=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){var n;return t.pano==e.pano&&(!t.lookAtPoint&&!e.lookAtPoint||(null===(n=t.lookAtPoint)||void 0===n?void 0:n.equals(e.lookAtPoint)))})))return;if(n>1)return;if(0==r.flyCount)return}if(this.panosTaskList.push(e),n++,e.pano.id,n>1){if(r.easeFun!=de.linearTween){var o=this.currentPano.position.distanceTo(r.pano.position),a=(1-r.progress)*o,s=Math.max(r.currentSpeed,.002),l=a/s;isNaN(l)&&console.error("newDur isNaN",s,r.progress,r),r.easeFun=de.linearTween,r.flySpeed=o/this.computeDuration(r),r.duration=l,this.startTransition(r)}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),r=t.clone().sub(i),o=n.clone().add(i),a=tt.ifIntersectChunks(r,o,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(qo,{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,r=t.duration||1500;this.path.warpDestPano=n;var o=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,o)?this.waitingToWarp=!0:(this.emit("pano.chosen",i,n),this.emit(Wo,{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,r,1,(function(){t.finalCallback=t.callback,e.afterFlyToPano(t)})))}},e.fade360View=function(e,t,n){var i=this,r=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),r,(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 o=!(!t.pano||!t.pano.view),a=!!(i.is360View(i.mode,i.currentPano)&&!t.flyIn||t.flyOut);if(o){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)}o||(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(Uo,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),r,(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 r=vt();this.history.invalidate();var o=this.closestPanoInDirection(e,t,n);return o?this.flyToPano({pano:o,canConstantlyWalk:this.canConstantlyWalk,byKey:i},r.resolve.bind(r,!0)):0==this.panosTaskList.length&&(this.bump(e),r.resolve(!1)),r.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 r=i?"angle":"direction",o=this.panosTaskList.length?this.panosTaskList[this.panosTaskList.length-1].pano:this.currentPano,a=[or.filters.not(o),or.filters.isPanoAligned(),or.filters.isNeighbourPanoTo(o),or.filters.inPanoDirection(o.position,t,n)],s=[or.scoreFunctions.distanceSquared(o),or.scoreFunctions[r](o.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,r,o=Je.transition,a=(o.flytimeMaxDistanceThreshold*o.flytimeDistanceMultiplier+o.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,r,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,r,0,de.easeInOutSine,"bumpTRelax")}.bind(this)}r=function(){"panorama"==t.mode&&(t.flying=!1,t.emit(qo,{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([or.filters.atFloor(i),or.filters.isPanoAligned(),function(e){return e.hasNeighbor()}],[or.scoreFunctions.distance(this.currentPano),or.scoreFunctions.direction(this.position,new THREE.Vector3(0,t,0)),or.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,r=e.pano,o=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(r&&this.checkAndWaitForPanoLoad(r,"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!==o&&(g=o),this.emit(No,f,i,r,g),r&&(this.currentPano=r),pe.cancelById(Je.freeze.LookTransition),i===ht.PANORAMA?(this.$app.core.get("PanoRenderer").switchPanoQuality(r,{size:2048}),this.emit(Uo,r,r),setTimeout(function(){r.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(Wo,{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,r)?(n.mode=i,v.pano=r,v.blackoutStyle=ot,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(qo,{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,r,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 r in i>Je.insideFOVMax?this.baseFov=na.getVFOVFromHFOV(Je.insideFOVMax,e,t):this.baseFov=Je.insideFOV,this.cameraControls.cameras){var o=this.cameraControls.cameras[r];o.fov=o.staticFov?o.staticFov:this.baseFov*(1/this.zoomLevel),o.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(Na),e===Je.zoom.max&&this.emit(Ga)):e<this.zoomLevel&&(this.emit(Ua),e===Je.zoom.min&&this.emit(ja)),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,r=function(e){e>1&&(e=1),n=i*(1-e)+e,this.zoomTo(n,!0)}.bind(this),o=function(){this.zoomDefault(),t&&window.setTimeout(t,50)}.bind(this);pe.start(r,e,o,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,r=this.zoomLevel,o=function(t){t>1&&(t=1),i=r*(1-t)+t*e,this.zoomTo(i,!0)}.bind(this);pe.start(o,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 r=1.8,o="2k"==t.navTileClass&&"4k"==t.tileClass?r:Je.zoom.activationThreshold,a=Je.highestQualityTile||this.zoomLevel>o,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>=r?"4k":this.zoomLevel>Je.zoom.activationThreshold?"2k":"1k",this.oldZoomLevel<r&&this.zoomLevel>=r?(u(),c(i,a)):this.oldZoomLevel<=Je.zoom.activationThreshold&&this.zoomLevel>Je.zoom.activationThreshold?u():this.oldZoomLevel>r&&this.zoomLevel<=r?(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(qo,(function(){i.flyToMode(e,t,n)}));else{t&&this.once(qo,(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,r=s.target.clone(),o=this.model.boundingBox.max.y+ke.orthoNear+.1,a=e.aim.clone().setY(o);pe.cancelById(Je.freeze.outsideFocus,!0),pe.start(function(e){s.absoluteScale=n*e+i*(1-e),s.target=a.clone().multiplyScalar(e).add(r.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=(r=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(r.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,r=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/r),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 ga(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 wa(h(e)),e.panoMarkers=[],e.quaternion=new THREE.Quaternion,e.position=new THREE.Vector3(15,10,15),e.previousState=null,e.lastInsideView=new ya,e.last360View=new ya,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 dl(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 za(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(Qt),this.$app.core.get("TileDownloader").processPriorityQueue=!1,this.$app.core.get("TileDownloader").tilePrioritizer=new La(this.$app.core.get("QualityManager"),this.basePanoSize,this.standardPanoSize,this.highPanoSize,this.ultraHighPanoSize),this.bindEvents(this.domElement),this.updateModel(),os.init(this),ri.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,r=e.flySpeed,o=e.callback;console.log("setTourPanoTask"),0!=i.length&&(this.panosTaskList.length=0,this.addTourPanoTask({panoList:i,flySpeed:r,callback:o},t))}},{key:"addTourPanoTask",value:function(e,t){var n=this,i=e.panoList,r=void 0===i?[]:i,o=e.flySpeed,a=void 0===o?Je.transition.flySpeed:o,s=e.callback;this.dontInterruptPanoTask=!0;var l=r.map((function(e,t){var i=Object.assign({flySpeed:a,easeType:"constant",gotQua:!0},e,{sid:Math.random(),dealingTask:!0,callback:t==r.length-1?function(){n.dontInterruptPanoTask=!1,e.callback&&e.callback(),s&&s()}:e.callback}),o=n.getAimToNextPano(e.pano,e.lookAtPoint,e.quaternion),l=o.aimQua;return o.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 r=e.maxRotSpeed||Je.transition.maxRotSpeed;e.flySpeed&&"constant"==e.easeType&&(r*=e.flySpeed/.002);var o=this.cameraControls.activeControl.camera.quaternion.clone(),a=$i.FORWARD.clone().applyQuaternion(o),s=$i.FORWARD.clone().applyQuaternion(e.quaternion),l=a.angleTo(s),c=Math.pow(l,.3)/r*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 r=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(r.panosTaskList.length){var e=r.$app.resource.num+Je.freeze.FlyToPano;pe.cancelById(e,!0),r.panosTaskList.forEach((function(e){e.pano.exit()}))}}),1)):e==ht.FLOORPLAN?Ls.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(Ls.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=[or.filters.isPanoAligned()],i=this.getDirection();n.push(or.filters.not(this.currentPano)),n.push(or.filters.isNeighbourPanoTo(this.currentPano)),n.push(or.filters.inFloorDirection(this.currentPano.position,i,.707)),n.push(or.filters.isClampDisSquaredTo(this.currentPano.floorPosition,.5,16));var r=Ae.sortByScore(this.model.panos.list,n,[or.scoreFunctions.distanceSquared(this.currentPano,-.6),or.scoreFunctions.directionFloor(this.currentPano.position,i)]);if(r.length>1){var o=r.slice(0,4).find((function(t){return tt.getPos2d(t.item.floorPosition,e).inSight}));o&&(t=o.item)}t||(t=r[0]&&r[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(Qt),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(Oa,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[Qt]=4096}},{key:"getPanoSize",value:function(e){return this.panoSizeClassMap[e]}},{key:"getMaxPossiblePanoSize",value:function(){return this.getPanoSize(Qt)}},{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(Qt):"1k"!=this.zoomLevelResolution&&this.useHighResolutionPanos?this.getPanoSize(Lt):this.getPanoSize(Ft):this.useHighResolutionPanos?this.useUltraHighResolutionPanos?this.getPanoSize(Qt):this.getPanoSize(Lt):this.getPanoSize(Ft)}}]),e}()}));var yl={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:Ui,1:ji,2:zi,3:Wi,4:Ni,5:Gi}[e]}},El="tiledownloader.download.success",wl="tiledownloader.download.failure",bl="tiledownloader.pano.download.complete";function Cl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}function xl(e,t){this.tree=e,this.parent=t,this.children=[],this.id=++Rl}function Il(e,t,n,i,r,o,a,s){if(e){a=a||TileTree.TraversalType.PreOrder;var l=i*kl+n;if(a===TileTree.TraversalType.PreOrder&&(r&&r(e,t,l,n,i),o&&o.push(e)),e.children&&0!==e.children.length){for(var c=i*kl,u=n*kl,h=0;h<kl;h++)for(var d=0;d<kl;d++)Il(e.children[d*kl+h],t+1,u+h,c+d,r,o,a);a===TileTree.TraversalType.PostOrder&&(r&&r(e,t,l,n,i),o&&o.push(e))}}}function Tl(e,t,n){if(n>e.levels)return null;var i=new xl(e,t);e.allNodes.push(i);for(var r=0;r<Pl;r++)i.children[r]=Tl(e,i,n+1);return i}function Bl(e,t,n,i,r){if(!e)return null;if(0===n)return e;if(!e.children||0===e.children.length)return null;var o=Math.pow(kl,n)/kl,a=i%o,s=r%o,l=Math.floor(r/o),c=Math.floor(i/o),u=l*kl+c;return Bl(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=Cl(n);function n(e){var i;return o(this,n),(i=t.call(this)).forceQueueTilesForPano=function(){var e=[],t=[];return function(n,i,r,o,a,s){e.length=0;for(var l=this.getTileDownloadDescriptors(n,i),c=0;c<l.length;c++){var u=l[c];u.status!==Sa.None&&u.status!==Sa.Queued||e.push(u)}if(r&&e.length>0){La.sortPanoTiles(e,n,r),t.length=0,qi.matchingTilesInDirection(n,i,r,o,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,Sa.ForceQueued),this.clearFromQueue(this.priorityQueue,Sa.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!==Sa.Downloaded&&n.status!==Sa.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,r,o,a){qi.getTileLocation(i,o,t);var s=Math.floor(i/r),l=s*s,c=Math.floor(o/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,Sa.None,!0),this.setStatusOrRemoveForAllDescriptors(this.priorityQueue,Sa.Queued)}}},{key:"clearQueue",value:function(e){this.setStatusForAllDescriptors(e,Sa.None),e.length=0}},{key:"clearFromQueue",value:function(e,t,n){for(var i=0;i<e.length;i++){var r=e[i];r&&(t===r.status&&!n||t!==r.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,r=0,o=0;r<i&&e.length>0;o++){var a=e.shift();a&&(this.startDownload(a),r++)}}}},{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 r=this.panos.list[0],o=this.getTileUrl(r,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(o,0,a,s)}}},{key:"startDownload",value:function(e){e.status=Sa.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(wl)}},{key:"downloadComplete",value:function(e,t){if(e.panoGroupId===this.panoGroupId){var n=this.getPanoLoadCallbacks(e.pano,e.panoSize);e.status=Sa.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(El,i),this.isPanoDownloaded(e.pano,e.panoSize)&&(i={panoId:e.pano.id,tileSize:e.tileSize,panoSize:e.panoSize},this.emit(bl,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!==Sa.Downloaded)return!1}return!0}},{key:"setPanoLoadCallbacks",value:function(e,t,n,i,r){var o=e.id+":"+this.$app.core.get("QualityManager").getPanoSize(t);this.panoLoadCallbacks[o]={onLoad:n,onFail:i,onProgress:r}}},{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 r=this.buildDownloadDescriptor();n.push(r)}return n}},{key:"buildDownloadDescriptor",value:function(){return{panoGroupId:null,pano:null,panoSize:-1,tileSize:-1,tileIndex:-1,totalTiles:-1,faceTileIndex:-1,status:Sa.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 r=e[i];this.initTileDownloadDescriptor(r,t,n,i)}}},{key:"initTileDownloadDescriptor",value:function(e,t,n,i){var r=n>=qi.TILE_SIZE?qi.TILE_SIZE:n;e.face=qi.getFaceForTile(n,i),e.cubeFace=yl.mapFaceToCubemapFace(e.face),e.panoGroupId=this.panoGroupId,e.pano=t,e.panoSize=n,e.tileSize=r,e.tileIndex=i,e.totalTiles=qi.getTileCountForSize(n),e.status=Sa.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=Tl(e,null,0)}(this)};var kl=2,Pl=kl*kl;TileTree.TraversalType=Object.freeze({PreOrder:0,PostOrder:1});var Rl=0;TileTree.getLevelCountForSize=function(e,t){var n=0;for(t<e&&(t=e);!((t/=kl)<e);)n++;return n},TileTree.getSizeForLevel=function(e,t){return Math.pow(kl,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 Bl(this.root,0,i,t,n)},TileTree.prototype.breadthFirst=function(e){var t=!!(e=e||{}).nullLevelEnd,n=e.maxLevel,i=e.minLevel,r=e.callback,o=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)&&(r&&t&&r(null),o&&t&&o.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)&&(r&&r(c,l,h),o&&o.push(c))}}},TileTree.prototype.getFaceIndexFromNode=function(e){if(!e)return-1;for(var t=1,n=e,i=0,r=0;;){var o=n.parent;if(!o)break;for(var a=-1,s=0;s<o.children.length;s++)o.children[s]===n&&(a=s);i=a%kl*t+i,r=Math.floor(a/kl)*t+r,t*=kl,n=o}return r*t+i},TileTree.prototype.depthFirst=function(e,t,n){Il(this.root,0,0,0,e,t,n,this.tileSize)};var Ml=TileTree;function Sl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}function Dl(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 Fl(){if(!this.uploadIntervalCancelled){Ll=!0;var e=Dl(this.$app);this.updateUploadQueue(2,6,e);this.peekNextFromUploadQueue()?this.refreshUploadInterval(16):this.uploadInterval=null}}var Ll=!1,Ql=Je.tiling.uploadIntervalDelay,Hl=Je.tiling.initialIntervalDelay,Ol=Je.tiling.maxNonBaseUploadsPerFrame,Vl=Je.tiling.maxBaseUploadsPerFrame,_l=0,zl=1;Xe("PanoRenderer",(function(){return function(e){f(n,EventEmitter);var t=Sl(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 r=this.activePanos[i],o=this.getActiveRenderTargetDescriptor(r.id);t&&r.id===t.id||!this.isRenderTargetDescriptorValid(o)||e.push(r)}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,r,o){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:o?512==o?0:1024==o?1:2048==o?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&&(r||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=Fl.bind(this)),null!=t||(t=Ql),Ll||(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=Dl(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=Vl,i.maxNonBaseUploadsPerFrame=Ol,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(El,this.onTileDownloaded.bind(this)):this.$app.core.get("TileDownloader").on(El,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,r=this.zoomRenderTarget.width;t.copyCubeMap(n.texture,this.zoomRenderTarget,i,i,r,r),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(Qt);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 r=0;r<qi.FACES_PER_PANO;r++)this.initTileTree(e.id,r,this.$app.core.get("QualityManager").getMaxPossiblePanoSize());this.linkAllTilesAndNodes(e)}var o=this.getActiveRenderTargetDescriptor(e.id),a=t;if(a>this.$app.core.get("QualityManager").getMaxNavPanoSize()&&(a=this.$app.core.get("QualityManager").getMaxNavPanoSize()),!o||a!==o.size){if(o&&this.deactiveDescripor(o.renderTarget),!(o=this.activeDescripor(a))){var s=this.initTiledPano(a,!this.$app.config.mobile);(o=this.initDescriptor(s.width)).renderTarget=s}o.pano=e,this.resetPanoDescriptor(e.id),i||(this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0))}this.setActiveRenderTargetDescriptor(e.id,o);var l=n?0:1;return this.updateActivePanos(e,l),o.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 r=null;i&&(r=Ml.getLevelCountForSize(qi.TILE_SIZE,i)+1);for(var o=function(e,i,r,o){n&&(i.tile.zoomUploaded=!1),t&&(i.tile.uploaded=!1)},a=0;a<qi.FACES_PER_PANO;a++){this.getTileTree(e,a).breadthFirst({callback:o.bind(this,a),minLevel:r})}}},{key:"copyBaseRenderStatusToZoomed",value:function(e){for(var t=Ml.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 r=i[t];if(!r){var o=Ml.getLevelCountForSize(qi.TILE_SIZE,n);r=new Ml(qi.TILE_SIZE,o),i[t]=r}}},{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 r=this.getUploadQueueForPano(e.panoId);n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?La.insertSortedPanoTile(r,e,i.pano,this.direction):r.push(e),e.uploadQueued=!0,this.uploadInterval||this.uploadIntervalCancelled||this.refreshUploadInterval(0))}}},{key:"shoulPushToFrontOfQueue",value:function(e){return 0===Ml.getLevelCountForSize(qi.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e=null,t=null,n=_l;n<=zl;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 _l:if(0===t[0].level)return t;break;case zl: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 r=e[i];(!n||n&&n===r.panoId)&&r.level>=t?(r.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t,n){for(var i=0,r=0,o=0;!(r>=t||i>=e||o>=n);){var a=this.getNextFromUploadQueue();if(!a)break;if(0!==a.level?i++:r++,o++,!(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);La.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,r,o){var a=this.getTileDirectoryEntry(e.id,n,r,o);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=Ml.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=yl.mapFaceToCubemapFace(e.face),n.panoId=e.panoId,n.tileSize=e.tileSize,n.direction=(new THREE.Vector3).copy(e.direction),n.node=null,n.level=Ml.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 r=this.tileDirectory[e];r||(r={},this.tileDirectory[e]=r);var o=16384*t+1024*n+i,a=r[o];return a||(a={downloaded:!1,uploaded:!1,zoomUploaded:!1},r[o]=a),a._key=e+":"+t+":"+n+":"+i,a._tileKey=o,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 r=Math.min(t.maxRenderTargetSize,t.getMaxZoomPanoSize()),o=i.renderTarget,a=i.size;n.copyCubeMap(o.texture,this.zoomRenderTarget,a,a,r,r)}this.copyBaseRenderStatusToZoomed(e.id)}}}},{key:"switchPanoQuality",value:function(e,t){var n,i=t.useIdel,r=t.size;i&&(r&&(n=this.activeDescripor(r,!0)),n||(n=this.activeDescripor(null,!0)),n&&(r=n.size));if(e.updateTileQuality(r),e.tiledPanoRenderTarget){var o=e.tiledPanoRenderTarget.width;if(r!=o){this.deactiveDescripor(this.tiledPanoRenderTarget);var a=this.activateTiledPano(e,r,!1,!0);this.$app.core.get("SceneRenderer").copyCubeMap(e.tiledPanoRenderTarget.texture,a,o,o,r,r),e.tiledPanoRenderTarget=a,this.renderPanoTiles(e.id,null,null,null,r),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 Nl="panorama.videorenderer.suspendrender",Ul="panorama.videorenderer.resumerender",Gl="panorama.videorenderer.textured",jl="panorama.videorenderer.canplayvideo",Wl="panorama.videorenderer.startvideo";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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}function Jl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("ModelManager",(function(){return function(e){f(n,EventEmitter);var t=ql(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(Gl,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Nl,this.onSuspendVideoRender.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ul,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(Oa,{oldModel:n,model:t})}},{key:"getActiveModel",value:function(){return this.activeModel}}]),n}()}));var Yl=function(e){f(n,THREE.PerspectiveCamera);var t=Jl(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 Zl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Xl=function(e){f(n,THREE.PerspectiveCamera);var t=Zl(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 Kl(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var $l=function(e){f(n,THREE.OrthographicCamera);var t=Kl(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}(),ec=0,tc=1,nc=2;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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var rc=function(e){f(n,EventEmitter);var t=ic(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 r=Math.sqrt(n.x*n.x+n.z*n.z),o=Math.atan(n.y/r);this.lat=-THREE.MathUtils.radToDeg(o)}},{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(Ia,"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(Ia,"pointer"))}},{key:"onMouseDown",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.button){case ec:this.startRotationFrom(e.clientX,e.clientY)}this.emit(Ia,"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),r=Math.atan2(e.y,n),o=Math.atan2(t.y,i);this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.rotationDifference.y=THREE.MathUtils.radToDeg(r-o),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(ba,"mouse")}}},{key:"onTouchMove",value:function(e){if(this.usable())switch(this.emit(ba,"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,r=this.pinchDistance-Math.sqrt(n*n+i*i);Math.abs(r)>.01&&(this.emit(Ca),this.emit(Ta,r),this.pinchDistance-=r)}}},{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(Ca),this.emit(Ba,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(xa);var n=!0;switch(e){case Qa.LEFTARROW:case Qa.J:t("x",-1);break;case Qa.RIGHTARROW:case Qa.L:t("x",1);break;case Qa.I:t("y",1);break;case Qa.K:t("y",-1);break;default:n=!1}n&&this.emit(ba,"key")}},{key:"onKeyUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case Qa.LEFTARROW:case Qa.J:case Qa.RIGHTARROW:case Qa.L:this.rotationAcc.x=0;break;case Qa.I:case Qa.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)}},{key:"startLookAt",value:function(e,t,n){var i=n&&(null!=n.lon||null!=n.lat);if(!i){var r=t?t.clone().sub(e):this.camera.position.clone().sub(e),o=Math.atan(r.z/r.x);o+=r.x<0?Math.PI:0,o+=r.x>0&&r.z<0?2*Math.PI:0;var a=THREE.MathUtils.radToDeg(o)+180,s=Math.sqrt(r.x*r.x+r.z*r.z),l=Math.atan(r.y/s),c=-THREE.MathUtils.radToDeg(l),u=(a-this.lon)%360;Math.abs(u)>180&&(u>0?u-=360:u+=360),a=this.lon+u;u=(c-this.lat)%360;Math.abs(u)>180&&(u>0?u-=360:u+=360),c=this.lat+u}var h=1200,d=de.easeInOutQuad;if(null!=n){if(n.soon)return this.lon=a,void(this.lat=c);if(n.speed){if(i)var p=(n.lon?Math.abs(n.lon-this.lon):0)+(n.lat?Math.abs(n.lat-this.lat):0);else p=Math.abs(a-this.lon)+Math.abs(c-this.lat);h=p/n.speed,n.time&&(h=Math.min(n.time,h))}else n.time&&(h=n.time);n.fuc&&setTimeout(n.fuc,h),n.constantSpeed&&(d=null)}i?(n.lon&&pe.start(It.property(this,"lon",n.lon),h,null,0,d),n.lat&&pe.start(It.property(this,"lat",n.lat),h,null,0,d)):(pe.start(It.property(this,"lon",a),h,null,0,d),pe.start(It.property(this,"lat",c),h,null,0,d))}}]),n}(),oc=-1,ac=0,sc=1,lc=2,cc=3,uc=4;function hc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var dc=function(e){f(n,EventEmitter);var t=hc(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 r=this.camera.position.distanceTo(this.target),o=Vector3.FORWARD.clone().applyQuaternion(this.camera.quaternion);this.targetClamped=!1,i.copy(n).addScaledVector(o,r),this.targetBounds.containsPoint(i)||(this.targetBounds.clampPoint(i,i),n.copy(i).addScaledVector(o,-r),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?Ra:e?ka:Pa)}},{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 r=Math.atan2(this.offset.x,this.offset.z),o=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()),r+=this.thetaDelta,o+=this.phiDelta,o=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,o)),o=Math.max(this.angle,Math.min(Math.PI-this.angle,o)),this.lon=r,this.lat=o;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(o)*Math.sin(r),this.offset.y=a*Math.cos(o),this.offset.z=a*Math.sin(o)*Math.cos(r),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 ac: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 sc:this.dollyStart.set(e.clientX,e.clientY);break;case lc:this.panStart.set(e.clientX,e.clientY)}this.emit(Ia,"mouse")}}},{key:"onMouseMove",value:function(e){if(this.enabled&&this.mouseDown&&0!==e.buttons){switch(e.preventDefault(),this.state){case ac: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 sc: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 lc: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(ba,"mouse"),this.lastMoveTime=e.timeStamp,this.update();var r={};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(_o,{info:r,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(ba,"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(_o,{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(_o,{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 Qa.UPARROW:case Qa.I:this.navRotationAcc("y",1);break;case Qa.DOWNARROW:case Qa.K:this.navRotationAcc("y",-1);break;case Qa.LEFTARROW:case Qa.J:this.navRotationAcc("x",-1);break;case Qa.RIGHTARROW:case Qa.L:this.navRotationAcc("x",1);break;case Qa.W:this.navPanAcc("y",1);break;case Qa.S:this.navPanAcc("y",-1);break;case Qa.A:this.navPanAcc("x",-1);break;case Qa.D:this.navPanAcc("x",1);break;default:t=!1}t&&this.emit(ba,"key")}},{key:"onKeyUp",value:function(e){this.enabled&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case Qa.I:case Qa.K:case Qa.UPARROW:case Qa.DOWNARROW:this.keyboardZoomSpeed=0,this.rotationAcceleration.y=0;break;case Qa.J:case Qa.L:case Qa.LEFTARROW:case Qa.RIGHTARROW:this.rotationAcceleration.x=0;break;case Qa.S:case Qa.W:this.panAcceleration.y=0;break;case Qa.A:case Qa.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 uc:t();case lc:n();break;case cc:t();case ac:i()}this.rotationSpeed.set(0,0),this.emit(Ia,"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),r=i.clone().rotateAround(this.rotateCenter,n).clone().sub(this.rotateCenter).multiplyScalar(1/t),o=this.rotateCenter.clone().sub(this.rotateStart);this.panDelta.addVectors(r,o),this.pan(this.panDelta.x,this.panDelta.y),this.rotateStart=i}.bind(this),r=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),r=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),o=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);return r.clone().cross(o).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 uc:t();case lc:n();break;case cc:i(t(),r());break;case sc:t();break;case ac:r();break;default:this.state=oc}this.lastMoveTime=e.timeStamp,this.emit(ba,"touch");var o={scale:this.absoluteScale};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(_o,{info:o,mode:this.player.mode,type:"moveModel"})}}},{key:"onTouchEnd",value:function(e){this.enabled&&(this.state===ac&&(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(Ia,"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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var fc=function(e){f(n,e);var t=pc(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[ec]=ac,a.mouseActions[tc]=sc,a.mouseActions[nc]=lc,a.touchActions[1]=ac,a.touchActions[2]=uc,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 dc.prototype.toJSON.call(this)}}]),n}(dc);function mc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var vc=function(e){f(n,e);var t=mc(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[ec]=lc,a.mouseActions[tc]=sc,a.mouseActions[nc]=ac,a.touchActions[1]=lc,a.touchActions[2]=cc,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),r=this.$app.core.get("Player"),o=Math.min(r.domElement.clientWidth-400,r.domElement.clientHeight-200),a=r.linkEditor&&(r.linkEditor.setTagVisible||r.linkEditor.setPanoVisible)?1.2:2;return t=null!=t?t:Math.max(o*a/800,a),i/2/Je.orthoBase*t}},{key:"rotateToView",value:function(e,t){var n=0,i=Ce.aspectRatio()<1,r=e.x<e.z,o=this.$app.store.getValue("metadata");n=void 0!==o.floorPlanAngle?2*Math.PI-1*parseFloat(o.floorPlanAngle):i===r?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 r=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;this.camera.left=-Je.orthoBase*this.currentScale*r,this.camera.right=Je.orthoBase*this.currentScale*r,this.camera.top=Je.orthoBase*this.currentScale*r/this.camera.aspect,this.camera.bottom=-Je.orthoBase*this.currentScale*r/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=dc.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}(dc);function gc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("CameraControls",(function(){return function(e){f(n,EventEmitter);var t=gc(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={},r=(t=t||[ht.PANORAMA,ht.DOLLHOUSE,ht.FLOORPLAN],[Yl,Xl,$l]),o=[rc,fc,vc];t.forEach(function(t,a){n[t]=new r[a](e),i[t]=new o[a](n[t],e,this.$app.core.get("Player")),i[t].on(ba,this.emit.bind(this,ba)),i[t].on(Ia,this.emit.bind(this,Ia)),i[t].on(Ca,this.emit.bind(this,Ca)),i[t].on(xa,this.emit.bind(this,xa)),i[t].on(Ta,this.emit.bind(this,Ta)),i[t].on(Ba,this.emit.bind(this,Ba))}.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(Oa,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 Ac="panovideo.canplay",yc="panovideo.start",Ec="panovideo.resume",wc="panovideo.pause",bc="panovideo.stop",Cc="panovideo.switch";function xc(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 Ic(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 Ic(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Ic(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 Tc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Bc=function(e){f(n,EventEmitter);var t=Tc(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(Ac)}},{key:"_onPlaying",value:function(){var e=this;this.emit(Cc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.5&&(e.emit(Ec),e.video.ontimeupdate=null,e.isFirstPlay=!1)},this.isFirstPlay&&this.emit(yc)}},{key:"_onPause",value:function(e){this.video&&(this.video._isPaused=!0),this.emit(wc)}},{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=xc(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=xc(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 kc(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 Pc(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 Pc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Pc(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 Rc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Bc.videoReady=!1;var Mc,Sc,Dc=function(e){f(n,EventEmitter);var t=Rc(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(Cc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.2&&(e.emit(Ec),e.isFirstPlay&&e.emit(yc),e.isFirstPlay=!1,e.video.ontimeupdate=null)}}},{key:"_onPause",value:function(){this.emit(wc),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=kc(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 Fc(){Sc={version:1,upPath:"",videoPath:Mc.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 Lc=null;function Qc(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){Mc=t,Sc||Fc();var n="";if(void 0!==e.version&&(n="?imagesVersion="+e.version),!e.videos)return e.videos={version:Sc.version,videos:Sc.videoInfos,parameters:Sc.parameters},void Qc(Sc,e.videosUser,n);try{var i=e.videos;if(!i.data||!i.data.length)return e.videos={version:Sc.version,videos:Sc.videoInfos,parameters:Sc.parameters},void Qc(Sc,e.videosUser,n)}catch(e){console.error(e)}var r,o=e.sceneFrom||"pro";if("pro"==o){var a=e.videos,s=a.version||0;return Sc.version=s,Sc.parameters.cameraType=8,1==s?a.data.forEach((function(e){Sc.videoInfos.set(e.id,{mp4:{url:Sc.videoPath+e.id+".mp4"+n},mpeg:{url:Sc.videoPath+e.id+".ts",size:e.tsSize+n},flv:{url:Sc.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){Sc.videoInfos.set(e.id,{mp4:{url:Sc.videoPath+e.id+".mp4"+n},mpeg:{url:Sc.videoPath+e.id+".ts"+n,size:e.tsSize},flv:{url:Sc.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:1,cameraType:8,blend_fov:e.blend_fov||5})})),(r=a.upPath,Lc||(Lc=new Promise((function(e,t){r||t("找不到参数请求地址"),/^http(s?)/.test(r)||(r=Mc.resource.getResourceURL(r)),Xn.getText(r).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]),r=t[2][1].trim().split(/\s+/).map((function(e){return Number(e)})),o=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 Sc.parameters.focal=n,Sc.parameters.pixel=i,Sc.parameters.centerX=r[0],Sc.parameters.centerY=r[1],Sc.parameters.translateX=o,Sc.parameters.translateY=a,Sc.parameters.translateZ=s,Sc})).catch((function(e){return console.warn("球幕视频【八目】:参数文件加载失败",e),Sc})).finally((function(){return Sc})))).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},Qc(t,e.videosUser,n),t})).catch((function(e){throw e}))}if("lite"==o){var l=e.videos,c=l.version||0;Sc.version=c,Sc.parameters.cameraType=2;var u="";return void 0!==e.version&&(u="?imagesVersion="+e.version),1==c&&l.data.forEach((function(e){Sc.videoInfos.set(e.id,{mp4:{url:Sc.videoPath+e.id+".mp4"+u},mpeg:{url:Sc.videoPath+e.id+".ts",size:e.tsSize+u},flv:{url:Sc.videoPath+e.id+".flv"+u},exposure:Number(e.value)||1,mapping:1,cameraType:2,blend_fov:e.blend_fov||5})})),function(e){return Lc||(Lc=new Promise((function(t,n){e||n("找不到参数请求地址"),/^http(s?)/.test(e)||(e=Mc.resource.getResourceURL(e)),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],r=n[1].trim().split(" ");t[i]=Number(r[0])}})),Sc.parameters.focal=t.focal,Sc.parameters.centerX=t.cx,Sc.parameters.centerY=t.cy,Sc.parameters.translateX=t.tx,Sc.parameters.translateY=t.ty,Sc.parameters.translateZ=t.tz,Sc})).catch((function(e){return console.warn("球幕视频【双目】:参数文件加载失败"),Sc})).finally((function(){return Sc})))}(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"==o){var h=e.videos,d=h.version||0;Sc.version=d,Sc.parameters.cameraType=3;var p="";return void 0!==e.version&&(p="?imagesVersion="+e.version),h.data.forEach((function(e){Sc.videoInfos.set(e.id,{mp4:{url:Sc.videoPath+e.id+".mp4"+p},mpeg:{url:Sc.videoPath+e.id+".ts",size:e.tsSize+p},flv:{url:Sc.videoPath+e.id+".flv"+p},exposure:Number(e.value)||1,mapping:1,cameraType:3,blend_fov:e.blend_fov||5})})),function(e){return Lc||(Lc=new Promise((function(t,n){e||n("找不到参数请求地址"),/^http(s?)/.test(e)||(e=Mc.resource.getResourceURL(e)),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],r=n[1].trim().split(" ");t[i]=Number(r[0])}})),Sc.parameters.focal=t.focal,Sc.parameters.centerX=t.cx,Sc.parameters.centerY=t.cy,Sc.parameters.translateX=t.rx,Sc.parameters.translateY=t.ry,Sc.parameters.translateZ=t.rz,Sc})).catch((function(e){return console.warn("球幕视频【转台】:参数文件加载失败",e),Sc})).finally((function(){return Sc})))}(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},Qc(t,e.videosUser,p),t})).catch((function(e){throw e}))}console.warn("有尚不支持的相机来源:",o)},getEnvironment:function(){Sc||Fc();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}}},Oc=0,Vc=1;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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("PanoVideoRenderer",(function(){return function(e){f(n,EventEmitter);var t=_c(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=Oc,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,r=n.environment;!window.MediaSource||"Android"!=i&&"WeChat"!=r?this.videoPlayer=new Bc(e,t):this.videoPlayer=new Dc(e,t),this.videoPlayer.on(Ac,this.onVideoCanPlay.bind(this)),this.videoPlayer.on(yc,this.onVideoStartPlay.bind(this)),this.videoPlayer.on(Cc,this.onVideoSwitch.bind(this)),this.videoPlayer.on(Ec,this.onVideoResume.bind(this)),this.videoPlayer.on(wc,this.onVideoPause.bind(this)),this.videoPlayer.on(bc,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(Nl)}},{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(jl)}},{key:"onVideoStartPlay",value:function(){this.emit(Wl)}},{key:"onVideoSwitch",value:function(e){this.texture&&this.texture.dispose(),this.texture=e,this.emit(Gl,e)}},{key:"onVideoResume",value:function(){this._state=Vc,this.emit(Ul),this.hideLoading()}},{key:"onVideoPause",value:function(){this._state=Oc,this.emit(Nl)}},{key:"onVideoStop",value:function(){this._state=Oc,this.emit(Nl)}},{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=zc(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(Wo,this.handlePlayerFlyingStarted.bind(this)),this.$app.core.get("Player").on(qo,this.handlePlayerFlyingEnded.bind(this)),this.$app.core.get("Player").on(No,this.handlePlayerModeChanging.bind(this)),this.$app.core.get("Player").on(zo,this.handlePlayerModeChanged.bind(this)),this.$app.core.get("Player").on(Go,this.handleClosestPanoChanging.bind(this)),this.$app.core.get("Player").on(Yo,this.handleStartInside.bind(this)),this.$app.core.get("Player").on(Zo,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,r=this.$app.core.get("ModelManager").getActiveModel();i=this.$app.core.get("Player").is360View(t,n)?0:Je[t].markerOpacity,r.fadePanoMarkers(i,0,{mode:t}),r.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 hr({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(Wl,this.onVideoStartPlay.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Gl,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ul,this.onVideoRenderResume.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Nl,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]"),r=this.qualityManager.getPanoSize(Dt),o=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(o,l,{hFov:a,vFov:s},!1,!1,!0),u=this.view.pano.loadTiledPano(r,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(),r=this.controls.lookVector.clone(),o=new THREE.Vector3;new THREE.Vector3;this.animFov=pe.start((function(e){o.lerpVectors(r,i,e),n.controls.lookAt(o.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 Nc={currentBlur:0,aspect:Je.aspect,blurStrength:1,hblurPass:Je.HorizontalBlurShader,vblurPass:Je.VerticalBlurShader,bindEvents(e){e.on(zo,(function(e,t){e===ht.PANORAMA&&(pe.cancel(Nc.blur),pe.cancel(Nc.addBlur),pe.start(Nc.removeBlur,500,null,0,null,"deblur"))}))},blur(e){Nc.currentBlur=e;var t=e*Nc.blurStrength;Je.VerticalBlurShader.uniforms.v.value=t/512*Nc.aspect,Je.HorizontalBlurShader.uniforms.h.value=t/512},addBlur(e){e=Math.max(e,Nc.currentBlur),Nc.blur(e)},removeBlur(e){e=Math.min(1-e,Nc.currentBlur),Nc.blur(e)}};Nc.blur(0);var Uc=function e(t){o(this,e),this.message=t};function Gc(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var jc,Wc,qc,Jc,Yc=function(e){f(n,e);var t=Gc(n);function n(e){return o(this,n),t.call(this,e)}return n}(Uc);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}window.screenFaceOrient=0;var Xc,Kc={},$c=function(e,t){"reset"==e?Kc={}:(Kc[e]=t,2!=Object.keys(Kc).length||"granted"==Kc.deviceMotion&&"granted"==Kc.deviceOrientation||console.error("运动和方向访问失败"))},eu=function(e){f(n,THREE.EventDispatcher);var t=Zc(n);function n(){return o(this,n),t.call(this)}return u(n,[{key:"Init",value:function(e,t){if(jc=e,(Wc=t).VR=this,jc.renderer&&!jc.newRenderer&&!qc){var n=Ae.loadTextureFromCache($n.getImageURL("images/circleMarker.png"));if(Wc.model.panos.list.forEach((function(e){e.createVrMarker(n,Wc)})),jc.newRenderer=new iu(jc.renderer,jc,jc.camera),jc.isHuawei5X=Ce.detectHUAWEI5X(),jc.oldRenderer=jc.renderer,au.init(jc.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 r=e[n];if(!r.words.some((function(e){return!t.includes(e)}))){Jc=r;break}}Jc||(Jc={name:"default",threshold:{min:.01,max:.3},useRatio:.5})}(),null!=Wc.$app.config.vr.markerHeight&&!isNaN(Wc.$app.config.vr.markerHeight)){var i=Wc.$app.config.vr.markerHeight;Wc.model.panos.forEach((function(e){e.vrMarker&&(e.vrMarker.position.y=e.floorPosition.y+i)}))}var r=!1,o=!1,a={setSize:function(e,t){jc.camera.aspect=e/t}};Object.defineProperty(Je,"vrEnabled",{get:function(){return r},set:function(e){if(e=!!e,Wc.cameraControls.controls.panorama.locked=e,Wc.model.chunks.forEach((function(t){return t.visible=!(e&&(au.xrType||Je.vrSplitScreen))})),au.xrType)return e?au.enterVR():au.leaveVR();if(e&&Je.vrSplitScreen?(jc.renderer=jc.newRenderer,Wc.cameraControls.cameras.panorama.staticFov=70):(jc.renderer=jc.oldRenderer,Wc.cameraControls.cameras.panorama.staticFov=null),r=e,window.VRScreenNotFull||(e?Ce.requestFullscreen(document.body):Ce.exitFullscreen()),Xc.cursor||tu(.5,!0,1,16777215,0),"portrait"!=window.VRScreenType&&(Xc.cursor.visible=e,jc.updateScreenSize({forceUpdateSize:!0}),Wc.model.updateVrMarker(e,Wc)),e)Wc.viewLinkManager.hideAllViews(),jc.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&&($c("reset"),window.DeviceMotionEvent&&window.DeviceMotionEvent.requestPermission&&"function"==typeof window.DeviceMotionEvent.requestPermission?(console.log("开始获取权限1"),window.DeviceMotionEvent.requestPermission().then((function(e){console.log("permissionState1: "+e),$c("deviceMotion",e)})).catch((function(e){$c("deviceMotion",!1),console.log(e)}))):(console.log("window.DeviceMotionEvent undefined"),$c("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),$c("deviceOrientation",e)})).catch((function(e){$c("deviceOrientation",!1),console.log(e)}))):(console.log("window.DeviceOrientationEvent undefined"),$c("deviceOrientation",!1)))}),t?0:150)}else console.log("陀螺仪似乎未能启用 ios "+e.major+"."+e.minor)}}),200);else{var t=Wc.position,n=(new THREE.Quaternion).copy(Wc.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"):Wc.cameraControls.activeControl.lookAt(i),Wc.viewLinkManager.showAllViews(),Xc.shiftQuaternion=null;var o=jc.resizeListeners.indexOf(a);jc.resizeListeners.splice(o,1)}Wc.emit("vrStateChanged")}}),Object.defineProperty(Je,"vrSplitScreen",{get:function(){return o},set:function(e){o!=(e=!!e)&&(o=e,Je.vrEnabled&&"portrait"!=window.VRScreenType&&(e?(jc.renderer=jc.newRenderer,Wc.cameraControls.cameras.panorama.staticFov=70):(jc.renderer=jc.oldRenderer,Wc.cameraControls.cameras.panorama.staticFov=null),Wc.model.chunks.forEach((function(t){return t.visible=!e})),jc.updateScreenSize({forceUpdateSize:!0}),Wc.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})),qc=!0}}},{key:"isSupportXR",value:function(){return!!au.xrType}}]),n}();window.VR=Xc=new eu;var tu=function(e,t,n,i,r){var o,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*r,0),a.map.repeat=new THREE.Vector2(1/17,1),a.depthTest=!1,a.blending=THREE.AdditiveBlending,(o=new THREE.Sprite(a)).scale.set(e,e,e),o.position.z=-5,o.visible=!1,o.name="cursor",o.renderOrder=Se,jc.camera.add(o),jc.scene.add(jc.camera),Xc.cursor=o;var s=new nu(jc.scene,o,jc.camera);Xc.cursor.triggerTargetEvent=s.triggerTargetEvent.bind(s),jc.updateListeners=[s].concat(jc.updateListeners)};window.orientEnable=0;var nu=function(e,t,n){var i=this;this.cursor=t,this.raycaster=new THREE.Raycaster,this.targetEventObj={},this.type=1,this.canStartAnimation=!0;var r=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(){r.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),r=THREE.MathUtils.degToRad(e.gamma);i.isHuawei5X?(-1e3===i.alpha&&(i.alpha=t),-1e3===i.beta&&(i.beta=n),-1e3===i.gamma&&(i.gamma=r),Math.abs(t-i.alpha)>.06&&(i.alpha=t),Math.abs(n-i.beta)>.006&&(i.beta=n),Math.abs(r-i.gamma)>.006&&(i.gamma=r)):(i.alpha=t,i.beta=n,i.gamma=r)}})),this.setObjectQuaternion=function(e,t,n,i,o){if(-1e3!=t){var a=e.clone();r.euler.set(n,t,-i,"YXZ"),a.setFromEuler(r.euler),a.multiply(r.q1),a.multiply(r.q0.setFromAxisAngle(r.zee,-o));var s=this.lastQua.angleTo(a);if(!(s<1e-7)){if(Jc&&Xc.shiftQuaternion){e.copy(this.lastQua);var l=he.linearClamp(s,Jc.threshold.min,Jc.threshold.max,Jc.useRatio,.9);It.quaternion(e,a)(l)}else e.copy(a);if(this.lastQua.copy(e),null==Xc.shiftQuaternion){var c=new THREE.Vector3(0,0,-1).applyQuaternion(Wc.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();Xc.shiftQuaternion=h.clone().premultiply(f)}e.premultiply(Xc.shiftQuaternion),function(e){if(!Je.vrSplitScreen){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);Wc.camera.lookAt(Wc.camera.position.clone().add(t));var n=new THREE.Vector3(1,0,0).applyQuaternion(e),i=new THREE.Vector3(1,0,0).applyQuaternion(Wc.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),o=THREE.MathUtils.degToRad(t.gamma);e?(-1e3===r.alpha&&(r.alpha=n),-1e3===r.beta&&(r.beta=i),-1e3===r.gamma&&(r.gamma=o),Math.abs(n-r.alpha)>.06&&(r.alpha=n),Math.abs(i-r.beta)>.006&&(r.beta=i),Math.abs(o-r.gamma)>.006&&(r.gamma=o)):(r.alpha=n,r.beta=i,r.gamma=o)}(n)}})),this.update=function(e){TWEEN.update(),window.ifTest&&Je.vrEnabled?this.triggerTargetEvent():Je.vrEnabled&&(this.setObjectQuaternion(Wc.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(Wc.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)}},iu=function(e,t,n){var i=new ru(n);window.VRCamera=i,i.bananaAspect=.8,this.width,this.height,this.name="vrRenderer";var r=this;this.setSize=function(t,n){e.setSize.call(this,t,n),r.width=t,r.height=n},this.render=function(t,n,r,o){var a,s;if(n.__RESS__SKIP__STEREO__){var l=e.autoClear;return e.autoClear=!1,e.setRenderTarget(r),o&&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,r,o),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,r,o),e.setScissorTest(!1)},this.__proto__={__proto__:e}},ru=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(),r=this.overlap/2,o=r*this.bananaNear/this.bananaFocus,a=this.bananaNear*Math.tan(Math.PI/180*this.bananaFov*.5);this.eyeLeft.elements[12]=-r,this.eyeRight.elements[12]=r,t=-a*this.bananaReal_aspect+o,n=a*this.bananaReal_aspect+o,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-o,n=a*this.bananaReal_aspect-o,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)},au={init(e){var t=this;this.renderer=e,e.xr.enabled=!0;var n=this.renderer.xr,i=n.getCamera(),r=function(){Xc.cursor.parent.remove(Xc.cursor),i.add(Xc.cursor),jc.scene.add(i),t.initHandler(),Wc.on("update",(function(e){t.entered&&(e.hasChanged.cameraChanged2||e.hasChanged.vrHandlerMoved)&&(t.setHandlerLength(Wc.intersect),Wc.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",r()):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 o=function(e){t.xrType="vr",t.device=e,t.renderer.xr.setDevice(e),r()};window.addEventListener("vrdisplayconnect",(function(e){o(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?o(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=Wc.camera.layers.mask})),a(e),e.quaternion.copy(i.quaternion),Wc.quaternion.copy(i.quaternion)},Wc.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",r=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 r=Object.assign({},i);return r.requiredFeatures=[n],i.requiredFeatures&&(r.requiredFeatures=r.requiredFeatures.concat(i.requiredFeatures)),r}(i);navigator.xr.requestSession(i,r).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(){jc.updateComponents(),jc.render()})),jc.started=!1):(this.renderer.setAnimationLoop(null),jc.started=!0,jc.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,Xc.dispatchEvent({type:"webxrEntered",isEnter:e})},xrNotFound(e){console.log("xrNotFound:",e)},getShiftQuaMat(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(Wc.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 r=(new THREE.Matrix4).lookAt(new THREE.Vector3,i,new THREE.Vector3(0,1,0));this.shiftQuaMat=n.clone().premultiply(r.clone().invert())},getShiftPosMat(e){this.shiftPosMat1=(new THREE.Matrix4).setPosition(e.clone().negate()),this.shiftPosMat2=(new THREE.Matrix4).setPosition(Wc.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 r=new THREE.MeshBasicMaterial({color:"#ffffff",opacity:.5,transparent:!0,depthTest:!1,depthWrite:!1}),o=new THREE.Mesh(new THREE.BoxBufferGeometry(.01,.01,1),r),a=(new THREE.Matrix4).makeTranslation(0,0,-.5);o.geometry.applyMatrix4(a);var s=new THREE.Mesh(new THREE.SphereBufferGeometry(.03,6,5),r);s.position.set(0,0,-1);var l=new THREE.Object3D;l.add(o),l.add(s),l.matrixAutoUpdate=!1,l.name="handler",l.visible=!1,jc.scene.add(l),this.handler=l,this.handler.lastMatrix=this.handler.matrix.clone();var c=n,u=function(n){var i,r;n.addEventListener("selectstart",(function(e){c!=n&&(c=n,console.log("切换control",n.name)),i=n.quaternion.clone(),r=Date.now()})),n.addEventListener("selectend",(function(e){var o=n.quaternion.clone();if(Date.now()-r<1e3&&o.angleTo(i)<t&&Wc.intersect)return Wc.flyToPanoClosestToMouse()})),n.addEventListener("connected",(function(e){console.log("connected",n.name)})),n.addEventListener("disconnected",(function(e){console.log("disconnected",n.name)}));var o=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",o),o()};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))}};Xc.webxr=au;var su=Xc;function lu(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}function cu(e){var t,n,i,r,o,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,r=new Array,o=1;o<=16;o++){for(var a=1;a<=e[o];a++)r[t[i]]=[],r[t[i]][0]=n,r[t[i]][1]=o,i++,n++;n*=2}return r}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 Q(e,t,n,i,r){for(var o,a=r[0],s=r[240],l=function(e,t){var n,i,r,o,a,s,l,c,u,h,d=0;for(u=0;u<8;++u){n=e[d],i=e[d+1],r=e[d+2],o=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=r+s,y=r-s,E=o+a,w=o-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],r=e[d+16],o=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,Q=i-l,H=r+s,O=r-s,V=o+a,_=o-a,z=D+V,N=D-V,U=L+H,G=L-H;e[d]=z+U,e[d+32]=z-U;var j=.707106781*(G+N);e[d+16]=N+j,e[d+48]=N-j;var W=.382683433*((z=_+O)-(G=Q+F)),q=.5411961*z+W,J=1.306562965*G+W,Y=.707106781*(U=O+Q),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[o=32767+u]]),D(h[o]));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}o=32767+f[g],D(r[(y<<4)+d[o]]),D(h[o]),g++}return 63!=m&&D(a),n}function H(e){if(e<=0&&(e=1),e>100&&(e=100),o!=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 r=[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],o=0;o<64;o++){var h=a((r[o]*e+50)/100);h<1?h=1:h>255&&(h=255),l[C[o]]=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)),o=e}}this.encode=function(e,o){(new Date).getTime(),o&&H(o),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 r=0;r<16;r++)F(k[r+1]);for(var o=0;o<=11;o++)F(P[o]);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,_,z,N=e.data,U=e.width,G=e.height,j=4*U,W=0;W<G;){for(p=0;p<j;){for(O=S=j*W+p,V=-1,_=0,z=0;z<64;z++)O=S+(_=z>>3)*j+(V=4*(7&z)),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[z]=(b[f]+b[w+256>>0]+b[C+512>>0]>>16)-128,y[z]=(b[f+768>>0]+b[w+1024>>0]+b[C+1280>>0]>>16)-128,E[z]=(b[f+1280>>0]+b[w+1536>>0]+b[C+1792>>0]>>16)-128;a=Q(A,c,a,t,i),h=Q(y,u,h,n,r),d=Q(E,u,d,n,r),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),r=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 r=-(t-1);r<=-e;r++)d[32767+r]=n,h[32767+r]=[],h[32767+r][1]=n,h[32767+r][0]=t-1+r;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}(),H(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=lu(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 Uc("Can't start SceneRenderer, already started");if(this.createContext(e),this.initComposer(),this.started=!0,this.$app.config.mobile)try{su.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(oa)}catch(e){throw new Yc("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,r){return e.width===i&&e.height===r||(e.width=i,e.height=r),t.drawImage(n,0,0,i,r),t.getImageData(0,0,i,r)}}(),e.initSizedTexture2D=function(e,t,n){var i=this.renderer,r=i.getContext(),o=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=r.createTexture();o.bindTexture(r.TEXTURE_2D,u),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,a.flipY),r.texImage2D(r.TEXTURE_2D,0,s,e,e,0,s,l,null);var h=i.paramThreeToGL(t);return r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,h),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,h),n?(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearMipMapLinearFilter,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.generateMipmap(r.TEXTURE_2D)):(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR)),o.bindTexture(r.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,r=null,o=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,o=new THREE.CubeCamera(.1,1e3,s),t.add(o),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),r=new THREE.Mesh(i,n),t.add(r),e=!0),o.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&&(r.scale.set(-1,-1,1),r.position.set(.5,0,0)),1==A&&(r.scale.set(-1,-1,1),r.position.set(-.5,0,0)),2==A&&(r.scale.set(1,1,1),r.position.set(0,.5,0)),3==A&&(r.scale.set(1,1,1),r.position.set(0,-.5,0)),4==A&&(r.scale.set(-1,-1,1),r.position.set(0,0,.5)),5==A&&(r.scale.set(-1,-1,1),r.position.set(0,0,-.5)),r.lookAt(o.position),s.viewport.set(0,0,s.width,s.height);var L=b.autoClear;b.autoClear=!1,o.update(b,t),b.autoClear=L}}(),e.copyCubeMap=function(){var e=!1,t=null,n=null,i=null,r=null,o=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}),r=new THREE.BoxGeometry(2,2,2),(o=new THREE.Mesh(r,i)).scale.set(-1,-1,1),t.add(o),e=!0}var v=this.oldRenderer||this.renderer;n.renderTarget=l;for(var g=0;g<6;g++){this.getCubeOrientationForCubeFace(g,a),o.rotation.copy(a),o.matrixWorldNeedsUpdate=!0,o.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 zi:t.set(0,-Math.PI/2,0);break;case Ni:t.set(0,Math.PI/2,0);break;case Ui: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=Nc,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}),window.addEventListener("unfocusPage",(function(t){console.log("unfocusPage",document.title),e.suspend(),e.$app.core.get("PanoRenderer").disposeIdelTargets()})),window.addEventListener("focusPage",(function(t){console.log("focusPage",document.title),e.resume()})),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();if(t.mode!==ht.PANORAMA&&n.getTileset().tiles.forEach((function(e){var r=n.getRenderMap()[e.id];r&&"remove"!==r.modified&&(i=9999,e.isVisibleAndInRequestVolume||t.mode===ht.TRANSITIONING?t.model.floors.get(e.floorIndex).add(r):(r.removeFromParent(),r.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)&&(t.lastFrameChanged||e.force)){var r=t.cameraControls.activeControl?t.cameraControls.activeControl.camera:this.camera;n.update(i,this.renderer,r,e.force),n.stats&&n.stats.update()}}}},{key:"uploadTexture2D",value:function(e,t,n,i,r,o){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 uu=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,r=2276,o=1567,a=3784,s=5793,l=2896;function c(){}function u(e,t){for(var n,i,r=0,o=[],a=16;a>0&&!e[a-1];)a--;o.push({children:[],index:0});var s,l=o[0];for(n=0;n<a;n++){for(i=0;i<e[n];i++){for((l=o.pop()).children[l.index]=t[r];l.index>0;){if(0===o.length)throw new Error("Could not recreate Huffman Table");l=o.pop()}for(l.index++,o.push(l);o.length<=n;)o.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;r++}n+1<a&&(o.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s)}return o[0].children}function h(t,n,i,r,o,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,r){var o=n%u,a=(n/u|0)*e.v+i,s=o*e.h+r;t(e,e.blocks[a][s])}function C(e,t,n){var i=n/e.blocksPerLine|0,r=n%e.blocksPerLine;t(e,e.blocks[i][r])}var x,I,T,B,k,P,R=r.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,r=s;i<=r;){var o=v(t.huffmanTableAC),l=15&o,u=o>>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,r=s,o=0;i<=r;){var l=e[i],u=n[l]<0?-1:1;switch(w){case 0:var h=v(t.huffmanTableAC),d=15&h;if(o=h>>4,0===d)o<15?(y=g(o)+(1<<o),w=4):(o=16,w=1);else{if(1!==d)throw new Error("invalid ACn encoding");E=A(d),w=o?2:3}continue;case 1:case 2:n[l]?n[l]+=(m()<<c)*u:0==--o&&(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),r=0===i?0:A(i);n[0]=t.pred+=r;for(var o=1;o<64;){var a=v(t.huffmanTableAC),s=15&a,l=a>>4;if(0!==s)n[e[o+=l]]=A(s),o++;else{if(l<15)break;o+=16}}};var M,S,D,F,L=0;for(S=1==R?r[0].blocksPerLine*r[0].blocksPerColumn:u*i.mcusPerColumn,o||(o=S);L<S;){for(I=0;I<R;I++)r[I].pred=0;if(y=0,1==R)for(x=r[0],k=0;k<o;k++)C(x,P,L),L++;else for(k=0;k<o;k++){for(I=0;I<R;I++)for(D=(x=r[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*o+128>>8,f=f*o-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*r+y*i+2048>>12,v=v*i-y*r+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*o+2048>>12,f=f*o-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*r+y*i+2048>>12,v=v*i-y*r+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 r(){var e=i(),r=t.subarray(n,n+e-2);return n+=r.length,r}function o(e){var t,n,i=0,r=0;for(n in e.components)e.components.hasOwnProperty(n)&&(i<(t=e.components[n]).h&&(i=t.h),r<t.v&&(r=t.v));var o=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/r);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/r),c=o*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=r,e.mcusPerLine=o,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=r();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(z=0;z<64;z++){w[e[z]]=t[n++]}else{if(E>>4!=1)throw new Error("DQT: invalid table spec");for(z=0;z<64;z++){w[e[z]]=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}o(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(z=0;z<16;z++,n++)R+=P[z]=t[n];var M=new Uint8Array(R);for(z=0;z<R;z++,n++)M[z]=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++],Q=t[n++],H=t[n++],O=h(t,n,a,D,s,L,Q,H>>4,15&H);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 z in _)_[z].quantizationTable=p[_[z].quantizationIdx],delete _[z].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,r,o,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],r=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=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],E=p(d+1.402*((m=l[0|u*r.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*r.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],r=this.components[2],o=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=r.lines[0|h*r.scaleY*I],c=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],m=l[0|u*r.scaleX*x],v=c[0|u*o.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*r.scaleX*x],v=c[0|u*o.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,r,o,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++)r=m[v++],f[g++]=r,f[g++]=r,f[g++]=r,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++],r=m[v++],l=255-p(a*(1-(o=m[v++])/255)+o),c=255-p(s*(1-o/255)+o),u=255-p(r*(1-o/255)+o),f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;default:throw new Error("Unsupported color mode")}}},c}();var hu={encode:function(e,t){return void 0===t&&(t=50),{data:new cu(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),r=new uu;r.parse(i),r.colorTransform=t.colorTransform;var o=t.formatAsRGBA?4:3,a=r.width*r.height*o;try{var s={width:r.width,height:r.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 r.copyToImageData(s,t.formatAsRGBA),s}};function du(e,t,n){e&&(e=e.toLowerCase().trim());var i=new I.UP.clone,r=Math.PI/3,o=Math.PI/2;switch(e){case"left":n.copy(t),n.applyAxisAngle(i,o);break;case"right":n.copy(t),n.applyAxisAngle(i,-o);break;case"forwardleft":n.copy(t),n.applyAxisAngle(i,r);break;case"forwardright":n.copy(t),n.applyAxisAngle(i,-r);break;case"forward":default:n.copy(t)}return n}function pu(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 fu(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 mu(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 vu(e,t){t.copy(I.FORWARD),e.getDirection(t)}var gu={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 r=e.pano,o=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(r);if(!s)return t({success:!1,error:r+" does not exist in this model"});if(!o)return t({sucess:!1,erorr:o+" is not a valid rotation"});n.set(c.Math.degToRad(o.x||0),c.Math.degToRad(o.y||0),c.Math.degToRad(o.z||0),"YXZ"),nt.info(o.z);var l={success:!0,message:r};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 r=this.sceneRenderer.renderer.getSize();n.resolution.width=r.width,n.resolution.height=r.height}e.layers.set(Bt),n.visibleObjects&&(n.visibleObjects.showPucks&&e.layers.enable(kt),n.visibleObjects.showReticule&&e.layers.enable(Pt));var o=n.resolution.width,a=n.resolution.height,s=o/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(o,a),this.sceneRenderer.renderer.setRenderTarget(t),this.sceneRenderer.renderer.render(this.sceneRenderer.scene,e),this.sceneRenderer.renderer.setRenderTarget(null);var l=new Uint8Array(o*a*4);this.sceneRenderer.renderer.readRenderTargetPixels(t,0,0,o,a,l);var c=hu.encode({data:l,width:o,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){vu(this.player,i),du(t,i,n);var r=this.player.rankedPanoInDirection(e,n);if(r){var o=this.objectToHandle[r.id];return o||(this.objectToHandle[r.id]=o=this.handleCount++,this.handleToObject[o]=r),o}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){vu(this.player,i),du(t,i,n);var r=this.player.rankedtagInDirection(e,n);if(r){var o=this.objectToHandle[r.sid];return o||(this.objectToHandle[r.sid]=o=this.handleCount++,this.handleToObject[o]=r),o}return R.warn("Showcase -> findRankedtag: Unable to find nearby tag."),-1}}(),clickNearesttag:function(e){this.clickRankedtag(0,e)},clickRankedtag:function(e,t){var n=mu.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=fu.call(this,e,t);i?pu.call(this,i,n):n(null)},clickPano:function(e,t){var n=this.handleTable[e];n?pu.call(this,n,t):t(null)},rotateDirection:function(e,t){var n=e.direction,i=e.angle;if(!P.active){var r=0,o=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),r=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}));o=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(r,o),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 r=n.xAngle,o=n.yAngle;if(!P.active){if(r=r||0,o=o||0,isNaN(r)||isNaN(o))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(r)<.01&&(r=0),Math.abs(o)<.01&&(o=0);var a=o;o=N.call(this,o);var s=a>0?"UP":"DOWN";if(!(r=-r)&&a&&!o)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>o&&R.warn("Showcase -> rotate: Reached maximum rotation in direction: "+s);var l=o;o=c.Math.degToRad(o),r=c.Math.degToRad(r),e.copy(this.player.mode===E.FLOORPLAN?I.UP:I.FORWARD),this.player.getDirection(e),t.copy(e).applyAxisAngle(I.UP,r),t.applyAxisAngle(I.RIGHT,o);var u=(e.angleTo(t),r>0?-1:r<0?1:0),h=o>0?1:o<0?-1:0;Math.abs(r)>Math.abs(o)?h*=Math.abs(o/r):Math.abs(o)>Math.abs(r)&&(u*=Math.abs(r/o));var d=this.controls.activeControl;d.startRotating(u,h),P.start(r,o,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(r.removeAllListeners(T.AutoPanComplete),r.removeAllListeners(T.AutoPanInterrupt),r.removeAllListeners(T.AutoPanClamped),e){case T.AutoPanInterrupt:t({success:!0,message:"Camera panning interrupted."});break;case T.AutoPanClamped:if(r.autoPanPosition.x!==i.x||r.autoPanPosition.z!==i.z){if(Math.abs(this.player.position.x-r.autoPanPosition.x)<.01&&Math.abs(this.player.position.z-r.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 "+o(r.target.x,r.target.z),console.warn(n)}case T.AutoPanComplete:t({success:!0,message:"Panned camera to position "+o(r.autoPanPosition.x,r.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,r=this.player.control;r.setAutoPanPosition(i.x,i.z),r.autoPan=!0;var o=function(e,t){return"("+e.toFixed(2)+", "+t.toFixed(2)+")"};r.on(T.AutoPanComplete,n.bind(this,T.AutoPanComplete)),r.on(T.AutoPanInterrupt,n.bind(this,T.AutoPanInterrupt)),r.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"})}},Au=function(e,t,n,i,r){gu.init(e,t,n,r)},yu=function(e,t){gu.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,r=n.clientHeight,o=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/r),t.changeBefore={fL0:o,fL1:a,notHideTags:t.notHideTags,notHideMonitors:t.notHideMonitors},Z(this,e)[e](t)}}]),a}();function r(r,o){var a,s,l=this;r.tasks.unFish&&r.tasks.unFish.length?(a=r.tasks.unFish.splice(0,1)[0],s="unFish"):r.tasks.fish&&r.tasks.fish.length?(a=r.tasks.fish.splice(0,1)[0],s="fish"):s="finish","unFish"==o&&"fish"==s?Z(this,n)[n](r.changeBefore):"fish"==o&&"finish"==s?(Z(this,i)[i](r.changeBefore),Z(this,t)[t](r.changeBefore)):"finish"==s?Z(this,t)[t](r.changeBefore):nt.info("other state:"+o+"|"+s),"finish"!=s&&yu({resolution:{width:a.width,height:a.height},quality:Je.isSafari?45:60},(function(t){r.done&&r.done(t.message,a.name,t),Z(l,e)[e](r,s)}))}}));var Eu=Object.freeze({Show:0,Hide:1,Retain:2}),wu=Object.freeze({Standard:0,Slow:1,Retain:2});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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xe("Director",(function(){return function(e){f(n,EventEmitter);var t=bu(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(Oa,this.updateModel.bind(this)),this.player.on(Ko,this.handleFlyToWarpInterruption.bind(this)),this.player.on(Qo,this.handlePlayerMove.bind(this)),this.player.on(Uo,this.handlePlayerPanoChosen.bind(this)),this.player.on(zo,this.handlePlayerModeChanged.bind(this)),this.player.on($o,this.handlePlayerInputStart.bind(this)),this.player.on(Wo,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,Eu.Retain,Eu.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 r=this.player.model.getHeroDescriptorByIndex(this.destinationItem),o=null,a=null;if(null!=r.pano&&void 0!==r.pano){var s=0===this.destinationItem||e?Ie:this.nextWarpStyle;a=this.player.warpToPanoByHeroIndex.bind(this.player,this.destinationItem,Eu.Show,wu.Slow,s,t,n,this.actionComplete.bind(this)),o=this.arrivedAtDestination.bind(this,!0)}else a=this.player.warpToNonPanoByHeroIndex.bind(this.player,this.destinationItem,this.actionComplete.bind(this)),o=this.arrivedAtDestination.bind(this,!1);this.transitionStage=this.C.Moving,this.player.model.fadePanoMarkers(0,null,{hideVideoFlag:!0}),this.awaitCompletion(function(){a()}.bind(this),o),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 Cu=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 xu(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Cu.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,r=this.elem.style.transform;if(r){var o=r.indexOf("("),a=r.indexOf(")");r=r.slice(o+1,a).split(","),n=parseFloat(r[0]),i=parseFloat(r[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()}},Cu.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")}},Cu.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})},Cu.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}},Cu.prototype.reportPos=function(){return{x:this.dragInfo.endElem.x+this.domParent.clientWidth/2,y:this.dragInfo.endElem.y+this.domParent.clientHeight/2}},Cu.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 Iu,Tu,Bu=function(e){f(n,EventEmitter);var t=xu(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()),r=100/this.pos3d.distanceTo(this.camera.position);this.pos2d=e.pos.clone().add(i.multiplyScalar((r+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("+Math.round(e)+"px,"+Math.round(t)+"px)"}else this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}}]),n}();function ku(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Pu,Ru,Mu,Su,Du=new THREE.Vector2,Fu={},Lu={};function Qu(e){Du=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?Tu?e.changedTouches[0].clientY-Iu.domElement.clientHeight:e.changedTouches[0].clientY:e.offsetY}}Xe("TagEditManager",(function(){return function(e){f(n,e);var t=ku(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||(Pu=this.$app.dom.querySelector('.player[name="copy"]'),Iu=this.$app.core.get("Player"),this.$app.core.get("TagManager"),Tu=this.$app.config.mobile,this.panosHistory=[],this.markSpotA=new Bu({name:"markSpotA",elem:e.spotA,domParent:Iu.domElement,camera:Iu.camera,useTransform:!0},Iu),this.markSpotB=new Bu({name:"markSpotB",elem:e.spotB,domParent:Pu,camera:this.splitView.panoramaCam,useTransform:!0},Iu),this.markSpotA.name="markSpotA",this.markSpotB.name="markSpotB",new Cu({elem:this.markSpotA.elem,domParent:Iu.domElement,useTransform:!0,cameraControls:Iu.cameraControls,beginMoveFuc:function(){t.editing&&(t.markSpotA.dragging=!0,Iu.cameraControls.controls.panorama.locked=!0,t.splitView.panoramaCtl.locked=!0)},moveDoneFuc:function(e){t.editing&&(t.markSpotA.dragging=!1,Iu.cameraControls.controls.panorama.locked=!1,t.splitView.panoramaCtl.locked=!1,e&&t.moveToReGetA(e),Iu.mouseCouldBeClickToMove=!1)}}),Ru=new Cu({elem:this.markSpotB.elem,domParent:Pu,useTransform:!0,beginMoveFuc:function(){t.markSpotB.dragging=!0,t.splitView.panoramaCtl.locked=!0,Iu.cameraControls.controls.panorama.locked=!0},moveDoneFuc:function(e){t.markSpotB.dragging=!1,t.splitView.panoramaCtl.locked=!1,Iu.cameraControls.controls.panorama.locked=!1,e&&t.moveToReGetB(e)}}),Pu.addEventListener("pointerdown",Qu),Pu.addEventListener("touchstart",Qu),Pu.addEventListener("pointerup",this.clickToReGetB.bind(this)),Pu.addEventListener("touchend",this.clickToReGetB.bind(this)),Iu.on("update",(function(e){t.editing&&(e.hasChanged.cameraChanged2&&t.markSpotA.update(),t.splitView.changed()&&t.markSpotB.update())})),Iu.on("pano.chosen",(function(e,n){t.changePano(n)})),Iu.on("click",(function(e){t.editing&&!t.clickA&&(e.intersect&&t.getA(e.intersect),e.consume())})),Iu.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;Iu.viewLinkManager.exitView().then((function(){if(Iu.flying||Iu.flyingToTag)return Iu.flyingToTag,void Iu.once(qo,(function(){e.enter()}));Iu.flyToMode("panorama",(function(){!function t(){Iu.currentPano?(e.editing=!0,e.setSpotPos||Iu.flying||(e.splitView.enter(),e.panosHistory=[],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,Iu.reticule.visible=!1,Iu.locked=!0,null==Mu&&(Mu=Je.insideLookLimitDown,Su=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),Iu.viewLinkManager.exitView().then((function(){return Iu.flying||Iu.flyingToTag?(Iu.flyingToTag,void Iu.once(qo,(function(){t.reSetPos(e)}))):(t.editing=!0,t.panosHistory=[],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==Mu&&(Mu=Je.insideLookLimitDown,Su=Je.insideLookLimitUp,Je.insideLookLimitDown=-35,Je.insideLookLimitUp=35),Iu.flyToPano({pano:Iu.currentPano,aimDuration:500,lookAtPoint:t.markTagPos}),!0)}))}},{key:"confirmPos",value:function(e){if(this.editing){var t=Ae.getRandomSid(),n=this.computeHotPos();return e&&Iu.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(),Iu.reticule.visible=!0,this.hideMarker&&(editSpot.hideMarker.visible=!0,editSpot.hideMarker=null),this.hotRePos=!1,this.editing=!1,Iu.locked=!1,null!=Mu&&(Je.insideLookLimitDown=Mu,Je.insideLookLimitUp=Su,Mu=Su=null)}},{key:"changePano",value:function(e){this.editing&&(this.splitView.changePano(e),this.markTagPos&&(this.markSpotA.pos3d=this.markTagPos.clone(),this.panosHistory.push(e),e.assistPano==this.splitView.panoB?this.splitView.pauseCameraBind=!1:this.splitView.pauseCameraBind||(this.splitView.pauseCameraBind=!0,this.splitView.panoramaCtl.startLookAt(this.markSpotB.pos3d))))}},{key:"getA",value:function(e){var t=this;if(!Iu.flying&&this.editing){if(this.panoA=Iu.currentPano,Iu.locked=!1,2!=Je.visions&&this.panoA==this.panoB){var n=Iu.model.matrixWorld.clone().invert(),i=e.point.clone().applyMatrix4(n);if(!this.clickA){this.clickA=this.clickB=i;var r=Iu.model.panos.find([function(e){return Iu.currentPano.neighbourPanos[e.id]&&Iu.currentPano!=e}],[or.sortFunctions.distanceToPoint(Iu.currentPano.position)]);r?Iu.flyToPano({pano:r,lookAtPoint:i.clone()}):console.log("当前场景只有一个pano,所以不走到下一个点")}this.clickA=this.clickB=i}else{if(Iu.currentPano.assistPano!=this.splitView.panoB||this.panosHistory.length>0){if(this.clickA){this.panoA=Iu.currentPano;n=Iu.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 o=this.panoA.id+"_"+this.panoB.id;if(Fu[o]=(Fu[o]||0)+1,!(Fu[o]>5))return void setTimeout((function(){t.getA(e)}),200);console.error("获取不到matchdata 放弃使用: "+o)}n=Iu.model.matrixWorld.clone().invert();if(this.clickA=e.point.clone().applyMatrix4(n),this.dirA=he.getNormalDir(this.clickA,Iu.model.supportsTiles,Iu.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=Iu.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){Iu.handleInputStart(e.x,e.y,!0,!0),Iu.updateIntersect({}),Iu.intersect?this.getA(Iu.intersect):this.markSpotA.update(),Iu.mouseDown=!1}},{key:"moveToReGetB",value:function(e){var t=new THREE.Vector2;he.convertScreenPositionToNDC(e.x,e.y,t,Pu),this.getB(t)}},{key:"clickToReGetB",value:function(e){if(!Ru.moving){var t=Hu(e);if(!(Math.abs(Du.x-t.x)>3||Math.abs(Du.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,Pu),this.getB(n)}}}},{key:"restricPosAtRoom",value:function(e){var t=Iu.currentPano.position,n=e,i=n.clone().sub(t).normalize(),r=new THREE.Raycaster(t,i,0,t.distanceTo(n)).intersectObjects(Iu.model.skyBoxTight);return r&&r.length&&(console.log("热点飘出skyBoxTight外,矫正:"+e.toArray()+" --\x3e "+r[0].point.toArray()),e.copy(r[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,r=this.clickB,o=he.getLineIntersect({A:t,B:n,p1:i,p2:r}),a=o.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(Lu[e])return Lu[e];Xn.get(this.$app.resource.getEditDataURL("mapping/".concat(e,".json"))).then((function(t){Lu[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,r=e.y,o={},a={},s={},l={},c={leftTop:o,rightTop:a,leftBot:s,rightBot:l};function u(e,t){var n=t[0],o=t[1],a=(n-i)*(n-i)+(o-r)*(o-r);(null==e.dis||e.dis>a)&&(e.dis=a,e.pair=t)}t["view pair"].uv.forEach((function(e){e[0]<i&&e[1]<=r?u(o,e):e[0]>=i&&e[1]<=r?u(a,e):e[0]<i&&e[1]>=r?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(o,s),t=f(a,l),n=f(o,a),c=f(s,l);return p.x=(i-e.pair[0])/(t.pair[0]-e.pair[0]),p.y=(r-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&&(o.pair&&l.pair||s.pair&&a.pair))&&(n=m()),n}}]),n}(mr)}));var Ou,Vu,_u,zu=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 r=e.entry;this.updateByEntry(r,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 Nu(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Uu,Gu={},ju=function(e){f(n,EventEmitter);var t=Nu(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;_u=this.$app.core.get("Player"),Vu=this.$app.dom.querySelector('.player[name="copy"]'),(Ou=new THREE.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),Ou.setSize(300,300,!1),Vu.appendChild(Ou.domElement);var t=this.$app.withNewComponent("CameraControls");if(t.init(Vu,["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||_u.model.panos.list[0].assistPano||(Je.visions=1,console.warn("自动更改 visions = 1")),2!=Je.visions&&_u.model.supportsTiles){var n=this.$app.withNewComponent("SceneRenderer",1),i=this.$app.withNewComponent("PanoRenderer",1),r=this.$app.withNewComponent("TileDownloader",1);r.index=1,n.renderer=Ou,r.processPriorityQueue=!0,i.init(n,r),(Uu=new sr).extend(_u.model.panos.list.map((function(t){var n=new or(e.$app,t.id,t);return n.attachToPanoRenderer(i),n.tileDownloader=r,n.qualityManager=e.$app.core.get("QualityManager"),n}))),r.setPanoData(Uu,[],this.$app.core.get("ModelManager").projectNum),r.setUrls(_u.model.urls),r.start()}this.cube=new THREE.Mesh(new THREE.BoxGeometry(10,10,10),new hr({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),_u.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=_u.cameraControls.cameras.panorama;e.fov=e.staticFov=60,this.zoomEnabled=Je.zoom.enabled,Je.zoom.enabled=!1,this.pauseCameraBind=!1,this.panoA=_u.currentPano,this.setSize(),this.setSceneB(),this.emit("enter"),_u.OverlayManager.hide("all"),_u.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,_u.OverlayManager.show("all",!0),_u.GLTFEditor.show("all",!0),_u.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&&_u.model.supportsTiles&&(e=Uu.index[e.id]);var n=function(){if(Gu[t.panoB.id]&&(clearTimeout(Gu[t.panoB.id]),delete Gu[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(_u.camera,_u.domElement.clientWidth/2,_u.domElement.clientHeight),r=_u.zoomFov,o=_u.getDirection();e.loadTiledPano(2048,o,{hFov:i,vFov:r},!1,!1,!0).then((function(){n()})),_u.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){}))}else _u.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){n()}))}},{key:"update",value:function(){this.editing&&Ou.render(this.$app.core.get("SceneRenderer").scene,this.panoramaCam)}},{key:"setSize",value:function(){this.editing&&(Ou.setSize(Vu.clientWidth,Vu.clientHeight,!0,Math.min(window.devicePixelRatio,2)),this.panoramaCam.updateAspect(Vu.clientWidth/Vu.clientHeight))}},{key:"changePano",value:function(e){this.panoA=e}}]),n}(),Wu=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 or}));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),or.filters.isNeighbourPanoTo(this.player.currentPano)],[or.scoreFunctions.distance(this.player.currentPano),or.scoreFunctions.direction(this.player.position,this.player.getDirection()),or.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 qu(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 Ju(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 Ju(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Ju(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 Yu(e){var t=e.core.get("Player"),n=e.TagManager.tags.length,i=t.model.chunks.length,r=t.model.chunks.reduce((function(e,t){return e+t.geometry.attributes.position.count}),0),o=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(r," )\n 模型贴图尺寸是512的 ").concat(o," 倍数 \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,r,o,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=qu(t.mosaicList),e.prev=32,i.s();case 34:if((r=i.n()).done){e.next=42;break}if(o=r.value,e.t1=o.fileName,!e.t1){e.next=40;break}return e.next=40,$n.loadWithoutUpdate(this.$app.resource.getUserResourceURL(o.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 Wu(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"),Yu(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 zu(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(),Nc.bindEvents(this.$app.core.get("Player")),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("Player")),Au(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&&su.Init(this.$app.core.get("SceneRenderer"),this.$app.core.get("Player"))}}},{key:"quickEnter",value:(n=k(S.mark((function e(t,n){var i,r,o=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),r=this.$app.core.get("QuickstartManager"),e.next=6,r.load(t);case 6:this.$app.core.get("SceneRenderer").addComponent(r),this.$app.core.get("SceneRenderer").once(aa,(function(){nt.info("".concat(o.$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 ju(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 Zu={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 Xu(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Ku=function(e){f(n,THREE.Mesh);var t=Xu(n);function n(e){var i;o(this,n);var r=new hr({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],r=this.materialInside;(e===ht.DOLLHOUSE||e===ht.FLOORPLAN||n!=ht.PANORAMA&&i!=ht.PANORAMA)&&(r=this.materialOutside),e===ht.PANORAMA?r.side=THREE.DoubleSide:r.side=THREE.FrontSide,this.material=r}}]),n}(),$u={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 r=Je.job+Je.format;return W.model.name&&(r=W.model.name),new Ku({geometry:n,textureName:t.material_name,name:t.chunk_name,meshUrl:e.resource.getViewImagesURL(r)})}))},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 r=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 r.forEach((function(e){e.neighbours=e.neighbours.filter((function(e){return r[e]})).map((function(e){return r[e].uuid}))})),r.forEach((function(e){e.noBlocks&&(e.noBlocks=e.noBlocks.map((function(e){return r[e].uuid})))})),r.forEach((function(e){e.seeMarkers&&(e.seeMarkers=e.seeMarkers.filter((function(e){return r[e]})).map((function(e){return r[e].uuid})))})),r},panos:function(e,t,n){var i=e.core.get("Player").model.panos,r=e.core.get("PanoVideoRenderer"),o=r.videosInfo.videos;if(e.config.view){var a=new Map;i.extend(t.map(function(t){if(t.neighbours.length){var n=o.get(t.uuid);return n&&a.set(t.uuid,n),new or(e,t.uuid,t,n)}return new or(e,t.uuid,t,null)}.bind(this)),"id"),r.initVideoPlayer(e.dom,a)}else i.extend(t.map(function(t){return new or(e,t.uuid,t,o.get(t.uuid))}.bind(this)),"id"),r.initVideoPlayer(e.dom,o);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 or(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))}},eh={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}}},th={load:(e,t,n)=>new Promise((function(n){function i(e,i){e||(t.push(i),++a===r&&n())}if(!e.chunks[0]||!e.chunks[0].meshUrl)return n();var r=Ae.countUnique(e.chunks.map((function(e){return e.textureName})));e.chunks[0].meshUrl.indexOf("_50k");var o="low";Je.minimalMemoryMode&&"high"===o&&(Ce.detectSamsungS6()?(nt.warn("Galaxy S6 cannot handle large textures, turning down quality."),o="low"):r>Je.maxMobileTextures&&(nt.warn("Model probably too large for mobile, turning down quality."),o="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 nh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ih(e){this.wrapped=e}function rh(e){return new ih(e)}function oh(e){var t,n;function i(t,n){try{var o=e[t](n),a=o.value,s=a instanceof ih;Promise.resolve(s?a.wrapped:a).then((function(e){s?i("return"===t?"return":"next",e):r(o.done?"return":"normal",e)}),(function(e){i("throw",e)}))}catch(e){r("throw",e)}}function r(e,r){switch(e){case"return":t.resolve({value:r,done:!0});break;case"throw":t.reject(r);break;default:t.resolve({value:r,done:!1})}(t=t.next)?i(t.key,t.arg):n=null}this._invoke=function(e,r){return new Promise((function(o,a){var s={key:e,arg:r,resolve:o,reject:a,next:null};n?n=n.next=s:(t=n=s,i(e,r))}))},"function"!=typeof e.return&&(this.return=void 0)}function ah(e){return function(){return new oh(e.apply(this,arguments))}}function sh(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 lh,ch,uh,hh=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(),r=i.resolve,o=i.msg,a=i.transfer;this.workersResolve[e]=r,this.workers[e].postMessage(o,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 r=n._getIdleWorker();-1!==r?(n._initWorker(r),n.workerStatus|=1<<r,n.workersResolve[r]=i,n.workers[r].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}(),dh=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},ph=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}(),fh=[171,75,84,88,32,50,48,187,13,10,26,10];function mh(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function vh(e){var t=new Uint8Array(e.buffer,e.byteOffset,fh.length);if(t[0]!==fh[0]||t[1]!==fh[1]||t[2]!==fh[2]||t[3]!==fh[3]||t[4]!==fh[4]||t[5]!==fh[5]||t[6]!==fh[6]||t[7]!==fh[7]||t[8]!==fh[8]||t[9]!==fh[9]||t[10]!==fh[10]||t[11]!==fh[11])throw new Error("Missing KTX 2.0 identifier.");var n=new dh,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new ph(e,fh.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();var o=r._nextUint32();n.supercompressionScheme=r._nextUint32();for(var a=r._nextUint32(),s=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),u=r._nextUint64(),h=r._nextUint64(),d=new ph(e,fh.length+i,3*o*8,!0),p=0;p<o;p++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});for(var f=new ph(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 ph(e,l,c,!0);y._offset<c;){var E=y._nextUint32(),w=y._scan(E),b=mh(w),C=y._scan(E-w.byteLength);n.keyValue[b]=b.match(/^ktx/i)?mh(C):C,y._offset%4&&y._skip(4-y._offset%4)}if(h<=0)return n;for(var x=new ph(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<o;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,Q=L+P,H=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+Q,R);return n.globalData={endpointCount:I,selectorCount:T,imageDescs:M,endpointsData:H,selectorsData:O,tablesData:V,extendedData:_},n}var gh={env:{emscripten_notify_memory_growth:function(e){uh=new Uint8Array(ch.exports.memory.buffer)}}},Ah=function(){function e(){o(this,e)}return u(e,[{key:"init",value:function(){return lh||(lh="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+yh).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,gh)})).then(this._init):WebAssembly.instantiate(Buffer.from(yh,"base64"),gh).then(this._init))}},{key:"_init",value:function(e){ch=e.instance,gh.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ch)throw new Error("ZSTDDecoder: Await .init() before decoding.");var n=e.byteLength,i=ch.exports.malloc(n);uh.set(e,i),t=t||Number(ch.exports.ZSTD_findDecompressedSize(i,n));var r=ch.exports.malloc(t),o=ch.exports.ZSTD_decompress(r,t,i,n),a=uh.slice(r,r+o);return ch.exports.free(i),ch.exports.free(r),a}}]),e}(),yh="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 Eh(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var wh,bh=new WeakMap,Ch=0,xh=function(t){f(i,t);var n=Eh(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 hh,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 r=n.loadAsync("basis_transcoder.js"),o=new e.FileLoader(this.manager);o.setPath(this.transcoderPath),o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials);var a=o.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,a]).then((function(e){var n=ce(e,2),r=n[0],o=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 */",r,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([s])),t.transcoderBinary=o,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}))})),Ch>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ch++}return this.transcoderPending}},{key:"load",value:function(t,n,i,r){var o=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(bh.has(e))return bh.get(e).promise.then(n).catch(r);o._createTexture(e).then((function(e){return n?n(e):null})).catch(r)}),i,r)}},{key:"_createTextureFrom",value:function(t){var n=t.mipmaps,i=t.width,r=t.height,o=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,r,o,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=vh(new Uint8Array(e));if(0!==i.vkFormat)return kh(i);var r=n,o=this.init().then((function(){return t.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e])})).then((function(e){return t._createTextureFrom(e.data)}));return bh.set(e,{promise:o}),o}},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ch--,this}}]),i}(e.Loader);xh.BasisFormat={ETC1S:0,UASTC_4x4:1},xh.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},xh.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},xh.BasisWorker=function(){var e,t,n,i=_EngineFormat,r=_TranscoderFormat,o=_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()?o.UASTC_4x4:o.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===o.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=r.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:[o.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.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 Ih={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},Th={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},Bh={43:e.sRGBEncoding,22:e.sRGBEncoding,15:e.sRGBEncoding};function kh(e){return Ph.apply(this,arguments)}function Ph(){return(Ph=k(S.mark((function t(n){var i,r,o,a,s,l,c,u;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.vkFormat,r=n.pixelWidth,o=n.pixelHeight,a=n.pixelDepth,void 0!==Ih[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 wh||(wh=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 Ah,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,wh;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=Th[i]===e.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Th[i]===e.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(u=0===a?new e.DataTexture(c,r,o):new e.Data3DTexture(c,r,o,a)).type=Th[i],u.format=Ih[i],u.encoding=Bh[i]||e.LinearEncoding,u.needsUpdate=!0,t.abrupt("return",Promise.resolve(u));case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Rh(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var Mh=S.mark(gf),Sh=S.mark(yf),Dh=S.mark(pb);function Fh(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 Lh(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 Lh(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Lh(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 Qh(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?Qh(Object(n),!0).forEach((function(t){nh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Oh=THREE.GLTFLoader,Vh=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 _h(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(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 zh(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Nh=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Uh="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Uh&&parseFloat(Uh[1]);var Gh="3.1.4";function jh(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Wh={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},qh=Wh.global||Wh.self||Wh.window||{},Jh="object"!=typeof process||"[object process]"!==String(process)||process.browser,Yh="function"==typeof importScripts,Zh="undefined"!=typeof window&&void 0!==window.orientation,Xh="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);function Kh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Xh&&parseFloat(Xh[1]);var $h=function(){function e(t,n){var i=this;o(this,e),Kh(this,"name",void 0),Kh(this,"workerThread",void 0),Kh(this,"isRunning",void 0),Kh(this,"result",void 0),Kh(this,"_resolve",void 0),Kh(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){jh(this.isRunning),this.isRunning=!1,this._resolve(e)}},{key:"error",value:function(e){jh(this.isRunning),this.isRunning=!1,this._reject(e)}}]),e}(),ed=new Map;function td(e){jh(e.source&&!e.url||!e.source&&e.url);var t=ed.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return nd((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),ed.set(e.url,t)),e.source&&(t=nd(e.source),ed.set(e.source,t))),jh(t),t}function nd(e){var t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function id(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(rd(e))i.add(e);else if(rd(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(var r in e)id(e[r],t,i)}else;return void 0===n?Array.from(i):[]}function rd(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(){},ad=function(){function e(t){o(this,e),Kh(this,"name",void 0),Kh(this,"source",void 0),Kh(this,"url",void 0),Kh(this,"terminated",!1),Kh(this,"worker",void 0),Kh(this,"onMessage",void 0),Kh(this,"onError",void 0),Kh(this,"_loadableURL","");var n=t.name,i=t.source,r=t.url;jh(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||id(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=td({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}(),sd=function(){function e(t){o(this,e),Kh(this,"name","unnamed"),Kh(this,"source",void 0),Kh(this,"url",void 0),Kh(this,"maxConcurrency",1),Kh(this,"maxMobileConcurrency",1),Kh(this,"onDebug",(function(){})),Kh(this,"reuseWorkers",!0),Kh(this,"props",{}),Kh(this,"jobQueue",[]),Kh(this,"idleQueue",[]),Kh(this,"count",0),Kh(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,r,o=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)},r=new Promise((function(e){return o.jobQueue.push({name:t,onMessage:n,onError:i,onStart:e}),o})),this._startQueuedJob(),e.next=6,r;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 $h(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 ad({name:e,source:this.source,url:this.url})}return null}},{key:"_getMaxConcurrency",value:function(){return Zh?this.maxMobileConcurrency:this.maxConcurrency}}]),e}(),ld={maxConcurrency:3,maxMobileConcurrency:1,onDebug:function(){},reuseWorkers:!0},cd=function(){function e(t){o(this,e),Kh(this,"props",void 0),Kh(this,"workerPools",new Map),this.props=Hh({},ld),this.setProps(t),this.workerPools=new Map}return u(e,[{key:"destroy",value:function(){var e,t=Fh(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=Fh(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,r=this.workerPools.get(t);return r||((r=new sd({name:t,source:n,url:i})).setProps(this._getWorkerPoolProps()),this.workerPools.set(t,r)),r}},{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 ad.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}();Kh(cd,"_workerFarm",void 0);var ud="latest";function hd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t[e.id]||{},i="".concat(e.id,"-worker.js"),r=n.workerUrl;if(r||"compression"!==e.id||(r=t.workerUrl),"test"===t._workerType&&(r="modules/".concat(e.module,"/dist/").concat(i)),!r){var o=e.version;"latest"===o&&(o=ud);var a=o?"@".concat(o):"";r="https://unpkg.com/@loaders.gl/".concat(e.module).concat(a,"/dist/").concat(i)}return jh(r),r}function dd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gh;jh(e,"no worker provided");var n=e.version;return!(!t||!n)}var pd={},fd=Object.freeze(Object.assign(Object.create(null),pd,{default:pd})),md={};function vd(e){return gd.apply(this,arguments)}function gd(){return(gd=k(S.mark((function e(t){var n,i,r=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:null,i=r.length>2&&void 0!==r[2]?r[2]:{},n&&(t=Ad(t,n,i)),md[t]=md[t]||yd(t),e.next=6,md[t];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ad(e,t,n){if(e.startsWith("http"))return e;var i=n.modules||{};return i[e]?i[e]:Jh?n.CDN?(jh(n.CDN.startsWith("http")),"".concat(n.CDN,"/").concat(t,"@").concat("3.1.4","/dist/libs/").concat(e)):Yh?"../src/libs/".concat(e):"modules/".concat(t,"/src/libs/").concat(e):"modules/".concat(t,"/dist/libs/").concat(e)}function yd(e){return Ed.apply(this,arguments)}function Ed(){return(Ed=k(S.mark((function e(t){var n,i,r;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(Jh){e.next=20;break}if(e.prev=8,e.t0=fd&&pd.requireFromFile,!e.t0){e.next=14;break}return e.next=13,pd.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(!Yh){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 r=e.sent,e.abrupt("return",wd(r,t));case 29:case"end":return e.stop()}}),e,null,[[8,17]])})))).apply(this,arguments)}function wd(e,t){if(!Jh)return pd.requireFromString&&pd.requireFromString(e,t);if(Yh)return eval.call(qh,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 bd(e,t){return!!cd.isSupported()&&(e.worker&&(null==t?void 0:t.worker))}function Cd(e,t,n,i,r){return xd.apply(this,arguments)}function xd(){return(xd=k(S.mark((function e(t,n,i,r,o){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=hd(t,i),l=cd.getWorkerFarm(i),c=l.getWorkerPool({name:a,url:s}),i=JSON.parse(JSON.stringify(i)),e.next=7,c.startJob("process-on-worker",Id.bind(null,o));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 Id(e,t,n,i){return Td.apply(this,arguments)}function Td(){return(Td=k(S.mark((function e(t,n,i,r){var o,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(r),e.abrupt("break",21);case 5:return n.error(new Error(r.error)),e.abrupt("break",21);case 7:return o=r.id,a=r.input,s=r.options,e.prev=8,e.next=11,t(a,s);case 11:l=e.sent,n.postMessage("done",{id:o,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:o,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 Bd(e,t,n){if(e.byteLength<=t+n)return"";for(var i=new DataView(e),r="",o=0;o<n;o++)r+=String.fromCharCode(i.getUint8(t+o));return r}function kd(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 Bd(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Bd(e,0,t)}return""}(e),'"'))}}function Pd(e){return e&&"object"==typeof e&&e.isBuffer}function Rd(e){if(Pd(e))return Pd(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 Md(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i,r=t.map((function(e){return e instanceof ArrayBuffer?new Uint8Array(e):e})),o=r.reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(o),s=0,l=Fh(r);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 Sd(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 Dd(e,t){return zh(e>=0),zh(t>0),e+(t-1)&~(t-1)}function Fd(e,t,n){var i;if(e instanceof ArrayBuffer)i=new Uint8Array(e);else{var r=e.byteOffset,o=e.byteLength;i=new Uint8Array(e.buffer||e.arrayBuffer,r,o)}return t.set(i,n),n+Dd(i.byteLength,4)}function Ld(e){var t,n,i,r,o,a,s;return S.async((function(l){for(;;)switch(l.prev=l.next){case 0:t=[],n=!1,i=!1,l.prev=3,o=sh(e);case 5:return l.next=7,S.awrap(o.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,r=l.t0;case 19:if(l.prev=19,l.prev=20,!n||null==o.return){l.next=24;break}return l.next=24,S.awrap(o.return());case 24:if(l.prev=24,!i){l.next=27;break}throw r;case 27:return l.finish(24);case 28:return l.finish(19);case 29:return l.abrupt("return",Md.apply(void 0,t));case 30:case"end":return l.stop()}}),null,null,[[3,15,19,29],[20,,24,28]],Promise)}function Qd(){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),Kh(this,"name",void 0),Kh(this,"type",void 0),Kh(this,"sampleSize",1),Kh(this,"time",void 0),Kh(this,"count",void 0),Kh(this,"samples",void 0),Kh(this,"lastTiming",void 0),Kh(this,"lastSampleTime",void 0),Kh(this,"lastSampleCount",void 0),Kh(this,"_count",0),Kh(this,"_time",0),Kh(this,"_samples",0),Kh(this,"_startTime",0),Kh(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=Qd(),this._timerPending=!0,this}},{key:"timeEnd",value:function(){return this._timerPending?(this.addTime(Qd()-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}(),Od=function(){function e(t){o(this,e),Kh(this,"id",void 0),Kh(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}(),Vd="Queued Requests",_d="Active Requests",zd="Cancelled Requests",Nd="Queued Requests Ever",Ud="Active Requests Ever",Gd={id:"request-scheduler",throttleRequests:!0,maxRequests:6},jd=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Kh(this,"props",void 0),Kh(this,"stats",void 0),Kh(this,"activeRequestCount",0),Kh(this,"requestQueue",[]),Kh(this,"requestMap",new Map),Kh(this,"deferredUpdate",null),this.props=Hh(Hh({},Gd),t),this.stats=new Od({id:this.props.id}),this.stats.get(Vd),this.stats.get(_d),this.stats.get(zd),this.stats.get(Nd),this.stats.get(Ud)}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,r=!1,o=function(){r||(r=!0,t.requestMap.delete(n),t.activeRequestCount--,t._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}},{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}(),Wd={};function qd(e){for(var t in Wd)if(e.startsWith(t)){var n=Wd[t];e=e.replace(t,n)}return e.startsWith("http://")||e.startsWith("https://")||(e="".concat("").concat(e)),e}function Jd(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}var Yd=function(e){return"function"==typeof e},Zd=function(e){return null!==e&&"object"==typeof e},Xd=function(e){return Zd(e)&&e.constructor==={}.constructor},Kd=function(e){return e&&"function"==typeof e[Symbol.iterator]},$d=function(e){return e&&"function"==typeof e[Symbol.asyncIterator]},ep=function(e){return"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json},tp=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},np=function(e){return function(e){return"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Zd(e)&&Yd(e.tee)&&Yd(e.cancel)&&Yd(e.getReader)}(e)||function(e){return Zd(e)&&Yd(e.read)&&Yd(e.pipe)&&function(e){return"boolean"==typeof e}(e.readable)}(e)},ip=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,rp=/^([-\w.]+\/[-\w.+]+)/;function op(e){var t=rp.exec(e);return t?t[1]:e}function ap(e){var t=ip.exec(e);return t?t[1]:""}var sp=/\?.*/;function lp(e){if(ep(e)){var t=up(e.url||"");return{url:t,type:op(e.headers.get("content-type")||"")||ap(t)}}return tp(e)?{url:up(e.name||""),type:e.type||""}:"string"==typeof e?{url:up(e),type:ap(e)}:{url:"",type:""}}function cp(e){return ep(e)?e.headers["content-length"]||-1:tp(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}function up(e){return e.replace(sp,"")}function hp(e){return dp.apply(this,arguments)}function dp(){return(dp=k(S.mark((function e(t){var n,i,r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ep(t)){e.next=2;break}return e.abrupt("return",t);case 2:return n={},(i=cp(t))>=0&&(n["content-length"]=String(i)),r=lp(t),o=r.url,(a=r.type)&&(n["content-type"]=a),e.next=9,gp(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:o}),e.abrupt("return",l);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pp(e){return fp.apply(this,arguments)}function fp(){return(fp=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,mp(t);case 3:throw n=e.sent,new Error(n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mp(e){return vp.apply(this,arguments)}function vp(){return(vp=k(S.mark((function e(t){var n,i,r;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"),r=t.statusText,!i.includes("application/json")){e.next=11;break}return e.t0=r,e.t1=" ",e.next=9,t.text();case 9:e.t2=e.sent,r=e.t0+=e.t1.concat.call(e.t1,e.t2);case 11:n=(n+=r).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 gp(e){return Ap.apply(this,arguments)}function Ap(){return(Ap=k(S.mark((function e(t){var n,i,r,o;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 r=t.slice(0,n),o=yp(r),e.abrupt("return","data:base64,".concat(o));case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yp(e){for(var t="",n=new Uint8Array(e),i=0;i<n.byteLength;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function Ep(e,t){return wp.apply(this,arguments)}function wp(){return(wp=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=qd(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,hp(t);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bp(){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 Cp={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},xp=Cp.window||Cp.self||Cp.global,Ip=Cp.process||{},Tp="4.10.7-alpha.12";function Bp(e){try{var t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch(e){return null}}bp();var kp,Pp=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";Kh(this,"storage",void 0),Kh(this,"id",void 0),Kh(this,"config",{}),this.storage=Bp(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 Rp(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(n=Math.min(n,i/e.width));var o=e.width*n,a=e.height*n,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}function Mp(e){return"string"==typeof e?kp[e.toUpperCase()]||kp.WHITE:e}function Sp(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],i=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(i),o=Fh(r);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(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}}function Dp(e,t){if(!e)throw new Error(t||"Assertion failed")}function Fp(){var e,t,n;if(bp&&"performance"in xp)e=null==xp||null===(t=xp.performance)||void 0===t||null===(n=t.now)||void 0===n?void 0:n.call(t);else if("hrtime"in Ip){var i,r=null==Ip||null===(i=Ip.hrtime)||void 0===i?void 0:i.call(Ip);e=1e3*r[0]+r[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"}(kp||(kp={}));var Lp={debug:bp&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Qp={enabled:!0,level:0};function Hp(){}var Op={},Vp={once:!0},_p=function(){function e(){o(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},n=t.id;Kh(this,"id",void 0),Kh(this,"VERSION",Tp),Kh(this,"_startTs",Fp()),Kh(this,"_deltaTs",Fp()),Kh(this,"_storage",void 0),Kh(this,"userData",{}),Kh(this,"LOG_THROTTLE_TIMEOUT",0),this.id=n,this._storage=new Pp("__probe-".concat(this.id,"__"),Qp),this.userData={},this.timeStamp("".concat(this.id," started")),Sp(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((Fp()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((Fp()-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){Dp(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,Lp.warn,arguments,Vp)}},{key:"error",value:function(e){return this._getLogFunction(0,e,Lp.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,Lp.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,Lp.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),r=2;r<n;r++)i[r-2]=arguments[r];return this._getLogFunction(e,t,Lp.debug||Lp.info,arguments,Vp)}},{key:"table",value:function(e,t,n){return t?this._getLogFunction(e,t,console.table||Hp,n&&[n],{tag:Up(t)}):Hp}},{key:"image",value:function(e){var t=e.logLevel,n=e.priority,i=e.image,r=e.message,o=void 0===r?"":r,a=e.scale,s=void 0===a?1:a;return this._shouldLog(t||n)?bp?function(e){var t=e.image,n=e.message,i=void 0===n?"":n,r=e.scale,o=void 0===r?1:r;if("string"==typeof t){var a=new Image;return a.onload=function(){var e,t=Rp(a,i,o);(e=console).log.apply(e,Q(t))},a.src=t,Hp}var s=t.nodeName||"";if("img"===s.toLowerCase()){var l;return(l=console).log.apply(l,Q(Rp(t,i,o))),Hp}if("canvas"===s.toLowerCase()){var c=new Image;return c.onload=function(){var e;return(e=console).log.apply(e,Q(Rp(c,i,o)))},c.src=t.toDataURL(),Hp}return Hp}({image:i,message:o,scale:s}):function(e){var t=e.image;e.message;var n=e.scale,i=void 0===n?1:n,r=null;try{r=module.require("asciify-image")}catch(e){}if(r)return function(){return r(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((function(e){return console.log(e)}))};return Hp}({image:i,message:o,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=Np({logLevel:e,message:t,opts:n}),r=n.collapsed;return i.method=(r?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()>=zp(e)}},{key:"_getLogFunction",value:function(e,t,n,i,r){if(this._shouldLog(e)){var o;r=Np({logLevel:e,message:t,args:i,opts:r}),Dp(n=n||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=Fp();var a=r.tag||r.message;if(r.once){if(Op[a])return Hp;Op[a]=Fp()}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),r=t,o=n.color,a=n.background,bp||"string"!=typeof r||(o&&(o=Mp(o),r="[".concat(o,"m").concat(r,"[39m")),a&&(o=Mp(a),r="[".concat(a+10,"m").concat(r,"[49m"))),t=r}var r,o,a;var s;return t}(this.id,r.message,r),(o=n).bind.apply(o,[console,t].concat(Q(r.args)))}return Hp}}]),e}();function zp(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 Dp(Number.isFinite(t)&&t>=0),t}function Np(e){var t=e.logLevel,n=e.message;e.logLevel=zp(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 r=typeof e.message;return Dp("string"===r||"object"===r),Object.assign(e,{args:i},e.opts)}function Up(e){for(var t in e)for(var n in e[t])return n||"untitled";return"empty"}Kh(_p,"VERSION",Tp);var Gp=new _p({id:"loaders.gl"}),jp=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}(),Wp={fetch:null,mimeType:void 0,nothrow:!1,log:new(function(){function e(){o(this,e),Kh(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:[]},qp={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 Jp(){Vh.loaders=Vh.loaders||{};var e=Vh.loaders;return e._state=e._state||{},e._state}var Yp=function(){var e=Jp();return e.globalOptions=e.globalOptions||Hh({},Wp),e.globalOptions};function Zp(e,t,n,i){return n=n||[],function(e,t){Kp(e,null,Wp,qp,t);var n,i=Fh(t);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=e&&e[r.id]||{},a=r.options&&r.options[r.id]||{},s=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};Kp(o,r.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 jp);return ef(i,Yp()),ef(i,t),i}(t,e,i)}function Xp(e,t){var n=Yp(),i=e||n;return"function"==typeof i.fetch?i.fetch:Zd(i.fetch)?function(e){return Ep(e,i)}:null!=t&&t.fetch?null==t?void 0:t.fetch:Ep}function Kp(e,t,n,i,r){var o=t||"Top level",a=t?"".concat(t,"."):"";for(var s in e){var l=!t&&Zd(e[s]);if(!(s in n)&&!("baseUri"===s&&!t)&&!("workerUrl"===s&&t))if(s in i)Gp.warn("".concat(o," loader option '").concat(a).concat(s,"' no longer supported, use '").concat(i[s],"'"))();else if(!l){var c=$p(s,r);Gp.warn("".concat(o," loader option '").concat(a).concat(s,"' not recognized. ").concat(c))()}}}function $p(e,t){var n,i=e.toLowerCase(),r="",o=Fh(t);try{for(o.s();!(n=o.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))&&(r=r||"Did you mean '".concat(a.id,".").concat(s,"'?"))}}}catch(e){o.e(e)}finally{o.f()}return r}function ef(e,t){for(var n in t)if(n in t){var i=t[n];Xd(i)&&Xd(e[n])?e[n]=Hh(Hh({},e[n]),t[n]):e[n]=t[n]}}function tf(e){var t;return!!e&&(Array.isArray(e)&&(e=e[0]),Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions))}function nf(e){var t,n,i;return zh(e,"null loader"),zh(tf(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 rf(){return(e=Jp()).loaderRegistry=e.loaderRegistry||[],e.loaderRegistry;var e}var of=/\.([^.]+)$/;function af(e){return sf.apply(this,arguments)}function sf(){return(sf=k(S.mark((function e(t){var n,i,r,o,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,r=a.length>3?a[3]:void 0,uf(t)){e.next=5;break}return e.abrupt("return",null);case 5:if(!(o=lf(t,n,Hh(Hh({},i),{},{nothrow:!0}),r))){e.next=8;break}return e.abrupt("return",o);case 8:if(!tp(t)){e.next=13;break}return e.next=11,t.slice(0,10).arrayBuffer();case 11:t=e.sent,o=lf(t,n,i,r);case 13:if(o||null!=i&&i.nothrow){e.next=15;break}throw new Error(hf(t));case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lf(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(!uf(e))return null;if(t&&!Array.isArray(t))return nf(t);var r,o=[];(t&&(o=o.concat(t)),null!=n&&n.ignoreRegisteredLoaders)||(r=o).push.apply(r,Q(rf()));df(o);var a=cf(e,o,n,i);if(!(a||null!=n&&n.nothrow))throw new Error(hf(e));return a}function cf(e,t,n,i){var r=lp(e),o=r.url,a=r.type,s=o||(null==i?void 0:i.url),l=null;return null!=n&&n.mimeType&&(l=pf(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=Fh(e);try{for(i.s();!(n=i.n()).done;){var r,o=n.value,a=Fh(o.extensions);try{for(a.s();!(r=a.n()).done;){if(r.value.toLowerCase()===t)return o}}catch(e){a.e(e)}finally{a.f()}}}catch(e){i.e(e)}finally{i.f()}return null}(e,i):null}(t,s))||pf(t,a))||function(e,t){if(!t)return null;var n,i=Fh(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;if("string"==typeof t){if(ff(t,r))return r}else if(ArrayBuffer.isView(t)){if(mf(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(mf(t,0,r))return r}}}catch(e){i.e(e)}finally{i.f()}return null}(t,e))||pf(t,null==n?void 0:n.fallbackMimeType)}function uf(e){return!(e instanceof Response&&204===e.status)}function hf(e){var t=lp(e),n=t.url,i=t.type,r="No valid loader found (";r+=n?"".concat(function(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(n),", "):"no url provided, ",r+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");var o=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 vf(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer)return vf(e,0,t);return""}(e):"";return r+=o?' first bytes: "'.concat(o,'"'):"first bytes: not available",r+=")"}function df(e){var t,n=Fh(e);try{for(n.s();!(t=n.n()).done;){nf(t.value)}}catch(e){n.e(e)}finally{n.f()}}function pf(e,t){var n,i=Fh(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.mimeTypes&&r.mimeTypes.includes(t))return r;if(t==="application/x.".concat(r.id))return r}}catch(e){i.e(e)}finally{i.f()}return null}function ff(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some((function(t){return e.startsWith(t)}))}function mf(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),r=new Uint8Array(t),o=0;o<i.length;++o)if(i[o]!==r[o])return!1;return!0}(i,e,i.byteLength);switch(typeof i){case"function":return i(e,n);case"string":return i===vf(e,t,i.length);default:return!1}}(e,t,n,i)}))}function vf(e,t,n){if(e.byteLength<t+n)return"";for(var i=new DataView(e),r="",o=0;o<n;o++)r+=String.fromCharCode(i.getUint8(t+o));return r}function gf(e,t){var n,i,r,o,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:n=(null==t?void 0:t.chunkSize)||262144,i=0,r=new TextEncoder;case 3:if(!(i<e.length)){s.next=11;break}return o=Math.min(e.length-i,n),a=e.slice(i,i+o),i+=o,s.next=9,r.encode(a);case 9:s.next=3;break;case 11:case"end":return s.stop()}}),Mh)}var Af=262144;function yf(e){var t,n,i,r,o,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?Af:n,r=0;case 3:if(!(r<e.byteLength)){c.next=14;break}return o=Math.min(e.byteLength-r,i),a=new ArrayBuffer(o),s=new Uint8Array(e,r,o),new Uint8Array(a).set(s),r+=o,c.next=12,a;case 12:c.next=3;break;case 14:case"end":return c.stop()}}),Sh)}var Ef=1048576;function wf(){return(wf=ah(S.mark((function e(t,n){var i,r,o,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=(null==n?void 0:n.chunkSize)||Ef,r=0;case 2:if(!(r<t.size)){e.next=12;break}return o=r+i,e.next=6,rh(t.slice(r,o).arrayBuffer());case 6:return a=e.sent,r=o,e.next=10,a;case 10:e.next=2;break;case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bf(e,t){return Nh?function(e,t){return Cf.apply(this,arguments)}(e,t):function(e,t){return xf.apply(this,arguments)}(e)}function Cf(){return(Cf=ah(S.mark((function e(t,n){var i,r,o,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 o=r||i.read(),null!=n&&n._streamReadAhead&&(r=i.read()),e.next=7,rh(o);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,Rd(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 xf(){return(xf=ah(S.mark((function e(t,n){var i,r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=!1,r=!1,e.prev=2,a=sh(t);case 4:return e.next=6,rh(a.next());case 6:if(!(i=!(s=e.sent).done)){e.next=13;break}return l=s.value,e.next=10,Rd(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),r=!0,o=e.t0;case 19:if(e.prev=19,e.prev=20,!i||null==a.return){e.next=24;break}return e.next=24,rh(a.return());case 24:if(e.prev=24,!r){e.next=27;break}throw o;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 If(e,t){if("string"==typeof e)return gf(e,t);if(e instanceof ArrayBuffer)return yf(e,t);if(tp(e))return function(e,t){return wf.apply(this,arguments)}(e,t);if(np(e))return bf(e,t);if(ep(e))return bf(e.body,t);throw new Error("makeIterator")}var Tf="Cannot convert supplied data type";function Bf(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 r=e.buffer,o=e.byteLength||e.length;return 0===e.byteOffset&&o===r.byteLength||(r=r.slice(e.byteOffset,e.byteOffset+o)),r}throw new Error(Tf)}function kf(e,t,n){return Pf.apply(this,arguments)}function Pf(){return(Pf=k(S.mark((function e(t,n,i){var r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t instanceof ArrayBuffer||ArrayBuffer.isView(t),"string"!=typeof t&&!r){e.next=3;break}return e.abrupt("return",Bf(t,n));case 3:if(!tp(t)){e.next=7;break}return e.next=6,hp(t);case 6:t=e.sent;case 7:if(!ep(t)){e.next=21;break}return o=t,e.next=11,pp(o);case 11:if(!n.binary){e.next=17;break}return e.next=14,o.arrayBuffer();case 14:e.t0=e.sent,e.next=20;break;case 17:return e.next=19,o.text();case 19:e.t0=e.sent;case 20:return e.abrupt("return",e.t0);case 21:if(np(t)&&(t=If(t,i)),!Kd(t)&&!$d(t)){e.next=24;break}return e.abrupt("return",Ld(t));case 24:throw new Error(Tf);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(n)return n;var i=Hh({fetch:Xp(t,e)},e);return Array.isArray(i.loaders)||(i.loaders=null),i}function Mf(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(Q(n),Q(i)):i}return n&&n.length?n:null}function Sf(e,t,n,i){return Df.apply(this,arguments)}function Df(){return(Df=k(S.mark((function e(t,n,i,r){var o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jh(!r||"object"==typeof r),!n||Array.isArray(n)||tf(n)||(r=void 0,i=n,n=void 0),e.next=4,t;case 4:return t=e.sent,i=i||{},o=lp(t),a=o.url,s=Mf(n,r),e.next=11,af(t,s,i);case 11:if(l=e.sent){e.next=14;break}return e.abrupt("return",null);case 14:return i=Zp(i,l,s,a),r=Rf({url:a,parse:Sf,loaders:s},i,r),e.next=18,Ff(l,t,i,r);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ff(e,t,n,i){return Lf.apply(this,arguments)}function Lf(){return(Lf=k(S.mark((function e(t,n,i,r){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dd(t),e.next=3,kf(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,r,t));case 7:if(!bd(t,i)){e.next=11;break}return e.next=10,Cd(t,n,i,r,Sf);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,r,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,r,t);case 18:return e.abrupt("return",e.sent);case 19:throw jh(!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 Qf(e,t,n,i){return Hf.apply(this,arguments)}function Hf(){return(Hf=k(S.mark((function e(t,n,i,r){var o,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Array.isArray(n)||tf(n)||(i=n,n=void 0),o=Xp(i),a=t,"string"!=typeof t){e.next=7;break}return e.next=6,o(t);case 6:a=e.sent;case 7:if(!tp(t)){e.next=11;break}return e.next=10,o(t);case 10:a=e.sent;case 11:return e.next=13,Sf(a,n,i);case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Of(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Vf=1/Math.PI*180,_f=1/180*Math.PI,zf={};function Nf(e){return Math.round(e/zf.EPSILON)*zf.EPSILON}function Uf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.precision,i=void 0===n?zf.precision||4:n;return e=Nf(e),"".concat(parseFloat(e.toPrecision(i)))}function Gf(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jf(e,t,n){if(Gf(e)){n=n||((r=e).clone?r.clone():new Array(r.length));for(var i=0;i<n.length&&i<e.length;++i)n[i]=t(e[i],i,n);return n}var r;return t(e)}function Wf(e){return function(e,t){return jf(e,(function(e){return e*_f}),t)}(e)}function qf(e){return Jf(e)}function Jf(e,t){return jf(e,(function(e){return e*Vf}),t)}function Yf(e,t,n){return jf(e,(function(e){return Math.max(t,Math.min(n,e))}))}function Zf(e,t,n){var i=zf.EPSILON;n&&(zf.EPSILON=n);try{if(e===t)return!0;if(Gf(e)&&Gf(t)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!Zf(e[r],t[r]))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)<=zf.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{zf.EPSILON=i}}zf.EPSILON=1e-12,zf.debug=!1,zf.precision=4,zf.printTypes=!1,zf.printDegrees=!1,zf.printRowMajor=!0;var Xf=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Of(!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:Gf(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(zf)}},{key:"formatString",value:function(e){for(var t="",n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+Uf(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(!Zf(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 r=e[i];this[i]=r+n*(t[i]-r)}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,r=t;i<r.length;i++)for(var o=r[i],a=0;a<this.ELEMENTS;++a)this[a]+=o[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,r=t;i<r.length;i++)for(var o=r[i],a=0;a<this.ELEMENTS;++a)this[a]-=o[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(zf.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 Kf(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 $f(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function em(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(zf.debug&&!Kf(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}var tm={};function nm(e,t){tm[e]||(tm[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}var im,rm=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Of(!1),0}},{key:"copy",value:function(e){return Of(!1),this}},{key:"x",get:function(){return this[0]},set:function(e){this[0]=$f(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=$f(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 $f(t)}},{key:"dot",value:function(e){for(var t=0,n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return $f(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,r=t;i<r.length;i++)for(var o=r[i],a=0;a<this.ELEMENTS;++a)this[a]*=o[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,r=t;i<r.length;i++)for(var o=r[i],a=0;a<this.ELEMENTS;++a)this[a]/=o[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 Of(e>=0&&e<this.ELEMENTS,"index is out of range"),$f(this[e])}},{key:"setComponent",value:function(e,t){return Of(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}(Xf),om=1e-6,am="undefined"!=typeof Float32Array?Float32Array:Array;function sm(e,t,n){var i=t[0],r=t[1];return e[0]=n[0]*i+n[3]*r+n[6],e[1]=n[1]*i+n[4]*r+n[7],e}function lm(e,t,n){var i=t[0],r=t[1];return e[0]=n[0]*i+n[4]*r+n[12],e[1]=n[1]*i+n[5]*r+n[13],e}function cm(e,t,n){var i=t[0],r=t[1],o=n[3]*i+n[7]*r||1;return e[0]=(n[0]*i+n[4]*r)/o,e[1]=(n[1]*i+n[5]*r)/o,e}function um(e,t,n){var i=t[0],r=t[1],o=t[2],a=n[3]*i+n[7]*r+n[11]*o||1;return e[0]=(n[0]*i+n[4]*r+n[8]*o)/a,e[1]=(n[1]*i+n[5]*r+n[9]*o)/a,e[2]=(n[2]*i+n[6]*r+n[10]*o)/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),im=new am(2),am!=Float32Array&&(im[0]=0,im[1]=0);var hm=function(e){f(n,e);var t=Rh(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),Gf(i)&&1===arguments.length?e.copy(i):(zf.debug&&($f(i),$f(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 zf.debug&&($f(e.x),$f(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 lm(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return cm(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return sm(this,this,e),this.check()}},{key:"transformByMatrix2x3",value:function(e){return function(e,t,n){var i=t[0],r=t[1];e[0]=n[0]*i+n[2]*r+n[4],e[1]=n[1]*i+n[3]*r+n[5]}(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],r=t[1];e[0]=n[0]*i+n[2]*r,e[1]=n[1]*i+n[3]*r}(this,this,e),this.check()}}]),n}(rm);function dm(){var e=new am(3);return am!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function pm(e){var t=e[0],n=e[1],i=e[2];return Math.hypot(t,n,i)}function fm(e,t,n){var i=new am(3);return i[0]=e,i[1]=t,i[2]=n,i}function mm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function vm(e,t,n){var i=t[0],r=t[1],o=t[2],a=n[0],s=n[1],l=n[2];return e[0]=r*l-o*s,e[1]=o*a-i*l,e[2]=i*s-r*a,e}function gm(e,t,n){var i=t[0],r=t[1],o=t[2],a=n[3]*i+n[7]*r+n[11]*o+n[15];return a=a||1,e[0]=(n[0]*i+n[4]*r+n[8]*o+n[12])/a,e[1]=(n[1]*i+n[5]*r+n[9]*o+n[13])/a,e[2]=(n[2]*i+n[6]*r+n[10]*o+n[14])/a,e}function Am(e,t,n){var i=t[0],r=t[1],o=t[2];return e[0]=i*n[0]+r*n[3]+o*n[6],e[1]=i*n[1]+r*n[4]+o*n[7],e[2]=i*n[2]+r*n[5]+o*n[8],e}var ym=pm;!function(){var e=dm()}();var Em=[0,0,0],wm={},bm=function(e){f(n,e);var t=Rh(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&&Gf(i)?e.copy(i):(zf.debug&&($f(i),$f(r),$f(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 zf.debug&&($f(e.x),$f(e.y),$f(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]=$f(e)}},{key:"angle",value:function(e){return function(e,t){var n=e[0],i=e[1],r=e[2],o=t[0],a=t[1],s=t[2],l=Math.sqrt(n*n+i*i+r*r)*Math.sqrt(o*o+a*a+s*s),c=l&&mm(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))}(this,e)}},{key:"cross",value:function(e){return vm(this,this,e),this.check()}},{key:"rotateX",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var r=[],o=[];r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],o[0]=r[0],o[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),o[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2]}(this,this,void 0===n?Em:n,t),this.check()}},{key:"rotateY",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var r=[],o=[];r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],o[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),o[1]=r[1],o[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2]}(this,this,void 0===n?Em:n,t),this.check()}},{key:"rotateZ",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var r=[],o=[];r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],o[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),o[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),o[2]=r[2],e[0]=o[0]+n[0],e[1]=o[1]+n[1],e[2]=o[2]+n[2]}(this,this,void 0===n?Em:n,t),this.check()}},{key:"transform",value:function(e){return this.transformAsPoint(e)}},{key:"transformAsPoint",value:function(e){return gm(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return um(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return Am(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],r=t[1];e[0]=n[0]*i+n[2]*r,e[1]=n[1]*i+n[3]*r,e[2]=t[2]}(this,this,e),this.check()}},{key:"transformByQuaternion",value:function(e){return function(e,t,n){var i=n[0],r=n[1],o=n[2],a=n[3],s=t[0],l=t[1],c=t[2],u=r*c-o*l,h=o*s-i*c,d=i*l-r*s,p=r*d-o*h,f=o*u-i*d,m=i*h-r*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 wm.ZERO=wm.ZERO||Object.freeze(new n(0,0,0,0))}}]),n}(rm),Cm=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return Of(!1),0}},{key:"RANK",get:function(){return Of(!1),0}},{key:"toString",value:function(){var e="[";if(zf.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]=$f(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}(Xf);function xm(e,t,n){var i=t[0],r=t[1],o=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*r+p*s+f*u,e[2]=d*o+p*l+f*h,e[3]=m*i+v*a+g*c,e[4]=m*r+v*s+g*u,e[5]=m*o+v*l+g*h,e[6]=A*i+y*a+E*c,e[7]=A*r+y*s+E*u,e[8]=A*o+y*l+E*h,e}function Im(e,t,n){var i=n[0],r=n[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}var Tm=Object.freeze([1,0,0,0,1,0,0,0,1]),Bm=Object.freeze([0,0,0,0,0,0,0,0,0]),km=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Pm={},Rm=function(e){f(n,e);var t=Rh(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 km}},{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,r,o,a,s,l){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=r,this[5]=o,this[6]=a,this[7]=s,this[8]=l,this.check()}},{key:"setRowMajor",value:function(e,t,n,i,r,o,a,s,l){return this[0]=e,this[1]=i,this[2]=a,this[3]=t,this[4]=r,this[5]=s,this[6]=n,this[7]=o,this[8]=l,this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*o-a*l)+n*(-c*r+a*s)+i*(l*r-o*s)}(this)}},{key:"identity",value:function(){return this.copy(Tm)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],a=n+n,s=i+i,l=r+r,c=n*a,u=i*a,h=i*s,d=r*a,p=r*s,f=r*l,m=o*a,v=o*s,g=o*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],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=i,e[7]=r}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],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=u*a-s*c,d=-u*o+s*l,p=c*o-a*l,f=n*h+i*d+r*p;f&&(f=1/f,e[0]=h*f,e[1]=(-u*i+r*c)*f,e[2]=(s*i-r*a)*f,e[3]=d*f,e[4]=(u*n-r*l)*f,e[5]=(-s*n+r*o)*f,e[6]=p*f,e[7]=(-c*n+i*l)*f,e[8]=(a*n-i*o)*f)}(this,this),this.check()}},{key:"multiplyLeft",value:function(e){return xm(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return xm(this,this,e),this.check()}},{key:"rotate",value:function(e){return function(e,t,n){var i=t[0],r=t[1],o=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*r+d*s,e[2]=p*o+d*l,e[3]=p*a-d*i,e[4]=p*s-d*r,e[5]=p*l-d*o,e[6]=c,e[7]=u,e[8]=h}(this,this,e),this.check()}},{key:"scale",value:function(e){return Array.isArray(e)?Im(this,this,e):Im(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i=t[0],r=t[1],o=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]=r,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=d*i+p*a+c,e[7]=d*r+p*s+u,e[8]=d*o+p*l+h}(this,this,e),this.check()}},{key:"transform",value:function(e,t){switch(e.length){case 2:t=sm(t||[-0,-0],e,this);break;case 3:t=Am(t||[-0,-0,-0],e,this);break;case 4:t=function(e,t,n){var i=t[0],r=t[1],o=t[2];return e[0]=n[0]*i+n[3]*r+n[6]*o,e[1]=n[1]*i+n[4]*r+n[7]*o,e[2]=n[2]*i+n[5]*r+n[8]*o,e[3]=t[3],e}(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return em(t,e.length),t}},{key:"transformVector",value:function(e,t){return nm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector2",value:function(e,t){return nm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector3",value:function(e,t){return nm("Matrix3.transformVector"),this.transform(e,t)}}],[{key:"IDENTITY",get:function(){return Pm.IDENTITY=Pm.IDENTITY||Object.freeze(new n(Tm)),Pm.IDENTITY}},{key:"ZERO",get:function(){return Pm.ZERO=Pm.ZERO||Object.freeze(new n(Bm)),Pm.ZERO}}]),n}(Cm);function Mm(e,t,n){var i=t[0],r=t[1],o=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*r+E*l+w*d+b*v,e[2]=y*o+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*r+E*l+w*d+b*v,e[6]=y*o+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*r+E*l+w*d+b*v,e[10]=y*o+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*r+E*l+w*d+b*v,e[14]=y*o+E*c+w*p+b*g,e[15]=y*a+E*u+w*f+b*A,e}function Sm(e,t,n){var i=n[0],r=n[1],o=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]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Dm(e,t,n,i,r){var o,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!=r&&r!==1/0?(o=1/(i-r),e[10]=(r+i)*o,e[14]=2*r*i*o):(e[10]=-1,e[14]=-2*i),e}function Fm(e,t,n,i){var r,o,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,r=A*(d*=p=1/Math.hypot(u,h,d))-y*(h*=p),o=y*(u*=p)-g*d,a=g*h-A*u,(p=Math.hypot(r,o,a))?(r*=p=1/p,o*=p,a*=p):(r=0,o=0,a=0),s=h*a-d*o,l=d*r-u*a,c=u*o-h*r,(p=Math.hypot(s,l,c))?(s*=p=1/p,l*=p,c*=p):(s=0,l=0,c=0),e[0]=r,e[1]=s,e[2]=u,e[3]=0,e[4]=o,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=c,e[10]=d,e[11]=0,e[12]=-(r*f+o*m+a*v),e[13]=-(s*f+l*m+c*v),e[14]=-(u*f+h*m+d*v),e[15]=1,e)}function Lm(e,t,n){var i=t[0],r=t[1],o=t[2],a=n[0],s=n[1],l=n[2],c=n[3],u=c*i+s*o-l*r,h=c*r+l*i-a*o,d=c*o+a*r-s*i,p=-a*i-s*r-l*o;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 am(4);return am!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}();var Qm=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]),Om=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}),Vm={},_m=function(e){f(n,e);var t=Rh(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 Om}},{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,r,o,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]=r,this[5]=o,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,r,o,a,s,l,c,u,h,d,p,f,m){return this[0]=e,this[1]=r,this[2]=l,this[3]=d,this[4]=t,this[5]=o,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(Qm)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],a=n+n,s=i+i,l=r+r,c=n*a,u=i*a,h=i*s,d=r*a,p=r*s,f=r*l,m=o*a,v=o*s,g=o*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,r=e.bottom,o=e.top,a=e.near,s=e.far;return s===1/0?n._computeInfinitePerspectiveOffCenter(this,t,i,r,o,a):function(e,t,n,i,r,o,a){var s=1/(n-t),l=1/(r-i),c=1/(o-a);e[0]=2*o*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(r+i)*l,e[10]=(a+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*c,e[15]=0}(this,t,i,r,o,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 Fm(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,r=e.top,o=e.near,a=void 0===o?.1:o,s=e.far;return function(e,t,n,i,r,o,a){var s=1/(t-n),l=1/(i-r),c=1/(o-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]=(r+i)*l,e[14]=(a+o)*c,e[15]=1}(this,t,n,i,r,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,r=e.aspect,o=void 0===r?1:r,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*o;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,r=void 0===i?45*Math.PI/180:i,o=e.aspect,a=void 0===o?1:o,s=e.near,l=void 0===s?.1:s,c=e.far,u=void 0===c?500:c;if((n=n||r)>2*Math.PI)throw Error("radians");return Dm(this,n,a,l,u),this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],r=e[3],o=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*o)*(h*v-d*m)-(t*s-i*o)*(u*v-d*f)+(t*l-r*o)*(u*m-h*f)+(n*s-i*a)*(c*v-d*p)-(n*l-r*a)*(c*m-h*p)+(i*l-r*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],r=1/n[1],o=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*r,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*r,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*r,e[10]=this[10]*o,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],r=1/n[1],o=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*r,e[2]=this[2]*o,e[3]=this[4]*i,e[4]=this[5]*r,e[5]=this[6]*o,e[6]=this[8]*i,e[7]=this[9]*r,e[8]=this[10]*o,e}},{key:"transpose",value:function(){return function(e,t){if(e===t){var n=t[1],i=t[2],r=t[3],o=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]=o,e[11]=t[14],e[12]=r,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],r=t[2],o=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-r*a,E=n*c-o*a,w=i*l-r*s,b=i*c-o*s,C=r*c-o*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]=(r*k-i*P-o*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-r*T+o*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-o*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+r*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 Mm(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return Mm(this,this,e),this.check()}},{key:"rotateX",value:function(e){return function(e,t,n){var i=Math.sin(n),r=Math.cos(n),o=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]=o*r+c*i,e[5]=a*r+u*i,e[6]=s*r+h*i,e[7]=l*r+d*i,e[8]=c*r-o*i,e[9]=u*r-a*i,e[10]=h*r-s*i,e[11]=d*r-l*i}(this,this,e),this.check()}},{key:"rotateY",value:function(e){return function(e,t,n){var i=Math.sin(n),r=Math.cos(n),o=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]=o*r-c*i,e[1]=a*r-u*i,e[2]=s*r-h*i,e[3]=l*r-d*i,e[8]=o*i+c*r,e[9]=a*i+u*r,e[10]=s*i+h*r,e[11]=l*i+d*r}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){var i=Math.sin(n),r=Math.cos(n),o=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]=o*r+c*i,e[1]=a*r+u*i,e[2]=s*r+h*i,e[3]=l*r+d*i,e[4]=c*r-o*i,e[5]=u*r-a*i,e[6]=h*r-s*i,e[7]=d*r-l*i}(this,this,e),this.check()}},{key:"rotateXYZ",value:function(e){var t=ce(e,3),n=t[0],i=t[1],r=t[2];return this.rotateX(n).rotateY(i).rotateZ(r)}},{key:"rotateAxis",value:function(e,t){return function(e,t,n,i){var r,o,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,r=Math.sin(n),a=1-(o=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+o,E=P*k*a+R*r,w=R*k*a-P*r,b=k*P*a-R*r,C=P*P*a+o,x=R*P*a+k*r,I=k*R*a+P*r,T=P*R*a-k*r,B=R*R*a+o,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)?Sm(this,this,e):Sm(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i,r,o,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],r=t[1],o=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]=r,e[2]=o,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]=r*m+l*v+d*g+t[13],e[14]=o*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?(em(t=function(e,t,n){var i=t[0],r=t[1],o=t[2],a=t[3];return e[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,e[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,e[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,e[3]=n[3]*i+n[7]*r+n[11]*o+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=lm(t||[-0,-0],e,this);break;case 3:t=gm(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return em(t,e.length),t}},{key:"transformAsVector",value:function(e,t){switch(e.length){case 2:t=cm(t||[-0,-0],e,this);break;case 3:t=um(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return em(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 nm("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}},{key:"transformVector",value:function(e,t){return nm("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}},{key:"transformDirection",value:function(e,t){return nm("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}],[{key:"IDENTITY",get:function(){return Vm.IDENTITY=Vm.IDENTITY||Object.freeze(new n(Qm)),Vm.IDENTITY}},{key:"ZERO",get:function(){return Vm.ZERO=Vm.ZERO||Object.freeze(new n(Hm)),Vm.ZERO}},{key:"_computeInfinitePerspectiveOffCenter",value:function(e,t,n,i,r,o){var a=2*o/(n-t),s=2*o/(r-i),l=(n+t)/(n-t),c=(r+i)/(r-i),u=-2*o;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}(Cm);function zm(){var e=new am(4);return am!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Nm(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 Um(e,t,n){var i=t[0],r=t[1],o=t[2],a=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=i*u+a*s+r*c-o*l,e[1]=r*u+a*l+o*s-i*c,e[2]=o*u+a*c+i*l-r*s,e[3]=a*u-i*s-r*l-o*c,e}function Gm(e,t,n,i){var r,o,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(o=c*p+u*f+h*m+d*v)<0&&(o=-o,p=-p,f=-f,m=-m,v=-v),1-o>om?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-i)*r)/a,l=Math.sin(i*r)/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 jm(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 r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;n=Math.sqrt(t[3*r+r]-t[3*o+o]-t[3*a+a]+1),e[r]=.5*n,n=.5/n,e[3]=(t[3*o+a]-t[3*a+o])*n,e[o]=(t[3*o+r]+t[3*r+o])*n,e[a]=(t[3*a+r]+t[3*r+a])*n}return e}var Wm,qm,Jm,Ym=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},Zm=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},Xm=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Km=function(e,t,n,i){var r=t[0],o=t[1],a=t[2],s=t[3];return e[0]=r+i*(n[0]-r),e[1]=o+i*(n[1]-o),e[2]=a+i*(n[2]-a),e[3]=s+i*(n[3]-s),e},$m=function(e){var t=e[0],n=e[1],i=e[2],r=e[3];return Math.hypot(t,n,i,r)},ev=function(e){var t=e[0],n=e[1],i=e[2],r=e[3];return t*t+n*n+i*i+r*r},tv=function(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],a=n*n+i*i+r*r+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=n*a,e[1]=i*a,e[2]=r*a,e[3]=o*a,e},nv=(Wm=dm(),qm=fm(1,0,0),Jm=fm(0,1,0),function(e,t,n){var i=mm(t,n);return i<-.999999?(vm(Wm,qm,t),ym(Wm)<1e-6&&vm(Wm,Jm,t),function(e,t){var n=t[0],i=t[1],r=t[2],o=n*n+i*i+r*r;o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o}(Wm,Wm),Nm(e,Wm,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(vm(Wm,t,n),e[0]=Wm[0],e[1]=Wm[1],e[2]=Wm[2],e[3]=1+i,tv(e,e))});zm(),zm(),function(){var e=new am(9);am!=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 iv=[0,0,0,1],rv=function(e){f(n,e);var t=Rh(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 jm(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 Nm(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]=$f(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=$f(e)}},{key:"z",get:function(){return this[2]},set:function(e){this[2]=$f(e)}},{key:"w",get:function(){return this[3]},set:function(e){this[3]=$f(e)}},{key:"len",value:function(){return $m(this)}},{key:"lengthSquared",value:function(){return ev(this)}},{key:"dot",value:function(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Xm(this,e)}},{key:"rotationTo",value:function(e,t){return nv(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 Ym(this,this,e),this.check()}},{key:"calculateW",value:function(){return function(e,t){var n=t[0],i=t[1],r=t[2];e[0]=n,e[1]=i,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r))}(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],r=t[2],o=t[3],a=n*n+i*i+r*r+o*o,s=a?1/a:0;e[0]=-n*s,e[1]=-i*s,e[2]=-r*s,e[3]=o*s}(this,this),this.check()}},{key:"lerp",value:function(e,t,n){return Km(this,e,t,n),this.check()}},{key:"multiplyRight",value:function(e,t){return Of(!t),Um(this,this,e),this.check()}},{key:"multiplyLeft",value:function(e,t){return Of(!t),Um(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],r=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+a*s,e[1]=r*l+o*s,e[2]=o*l-r*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],r=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l-o*s,e[1]=r*l+a*s,e[2]=o*l+i*s,e[3]=a*l-r*s}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){n*=.5;var i=t[0],r=t[1],o=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+r*s,e[1]=r*l-i*s,e[2]=o*l+a*s,e[3]=a*l-o*s}(this,this,e),this.check()}},{key:"scale",value:function(e){return Zm(this,this,e),this.check()}},{key:"slerp",value:function(e,t,n){switch(arguments.length){case 1:var i=arguments[0],r=i.start;e=void 0===r?iv:r,t=i.target,n=i.ratio;break;case 2:var o=Array.prototype.slice.call(arguments);t=o[0],n=o[1],e=this}return Gm(this,e,t,n),this.check()}},{key:"transformVector4",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return Lm(t,e,this),em(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}(Xf),ov=.1,av=1e-12,sv=1e-15,lv=(Math.PI,Math.PI,Math.PI,Math.PI,function(e){return e}),cv=new bm;function uv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lv;return Gf(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 hv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cv;return uv(e,t,zf._cartographicRadians?lv:Wf)}function dv(e,t){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lv;return Gf(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,zf._cartographicRadians?lv:qf)}var pv=new bm,fv=new bm,mv=new bm;var vv=new bm,gv={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"}},Av={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},yv={east:new bm,north:new bm,up:new bm,west:new bm,south:new bm,down:new bm},Ev=new bm,wv=new bm,bv=new bm;function Cv(e,t,n,i,r,o){var a,s,l,c=gv[t]&&gv[t][n];Of(c&&(!i||i===c));var u=vv.copy(r);if(Zf(u.x,0,1e-14)&&Zf(u.y,0,1e-14)){var h=Math.sign(u.z);a=Ev.fromArray(Av[t]),"east"!==t&&"west"!==t&&a.scale(h),s=wv.fromArray(Av[n]),"east"!==n&&"west"!==n&&s.scale(h),l=bv.fromArray(Av[i]),"east"!==i&&"west"!==i&&l.scale(h)}else{var d=yv.up,p=yv.east,f=yv.north;p.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,d),f.copy(d).cross(p);var m=yv.west,v=yv.south;yv.down.copy(d).scale(-1),m.copy(p).scale(-1),v.copy(f).scale(-1),a=yv[t],s=yv[n],l=yv[i]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=s.x,o[5]=s.y,o[6]=s.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=u.x,o[13]=u.y,o[14]=u.z,o[15]=1,o}var xv,Iv=new bm,Tv=new bm,Bv=new bm,kv=new bm,Pv=new bm,Rv=new bm,Mv=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),Of(t>=0),Of(n>=0),Of(i>=0),this.radii=new bm(t,n,i),this.radiiSquared=new bm(t*t,n*n,i*i),this.radiiToTheFourth=new bm(t*t*t*t,n*n*n*n,i*i*i*i),this.oneOverRadii=new bm(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),this.oneOverRadiiSquared=new bm(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=Tv,i=Bv,r=ce(e,3),o=r[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(o),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];Rv.from(e);var n=this.scaleToGeodeticSurface(Rv,kv);if(n){var i=this.geodeticSurfaceNormal(n,Tv),r=Pv;r.copy(Rv).subtract(n);var o=Math.atan2(i.y,i.x),a=Math.asin(i.z),s=Math.sign(mm(r,Rv))*pm(r);return dv([o,a,s],t)}}},{key:"eastNorthUpToFixedFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new _m;return Cv(this,"east","north","up",e,t)}},{key:"localFrameToFixedFrame",value:function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new _m;return Cv(this,e,t,n,i,r)}},{key:"geocentricSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Iv.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=hv(e),i=n[0],r=n[1],o=Math.cos(r);return Iv.set(o*Math.cos(i),o*Math.sin(i),Math.sin(r)).normalize(),Iv.to(t)}},{key:"geodeticSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Iv.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 bm,i=t.oneOverRadii,r=t.oneOverRadiiSquared,o=t.centerToleranceSquared;pv.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=fv;if(g.copy(e).scale(v),m<o)return g.to(n);var A=r.x,y=r.y,E=r.z,w=mv;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)>av);return pv.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];kv.from(e);var n=kv.x,i=kv.y,r=kv.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+i*i*o.y+r*r*o.z);return kv.multiplyScalar(a).to(t)}},{key:"transformPositionToScaledSpace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return kv.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 kv.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];Of(Zf(this.radii.x,this.radii.y,sv)),Of(this.radii.z>0),kv.from(e);var i=kv.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return kv.set(0,0,i).to(n)}}],[{key:"WGS84",get:function(){return xv=xv||new e(6378137,6378137,6356752.314245179)}}]),e}(),Sv=function e(t,n,i){o(this,e),Kh(this,"item",void 0),Kh(this,"previous",void 0),Kh(this,"next",void 0),this.item=t,this.previous=n,this.next=i},Dv=function(){function e(){o(this,e),Kh(this,"head",null),Kh(this,"tail",null),Kh(this,"_length",0)}return u(e,[{key:"length",get:function(){return this._length}},{key:"add",value:function(e){var t=new Sv(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 Fv(e){return null!=e}var Lv=function(){function e(){o(this,e),Kh(this,"_list",void 0),Kh(this,"_sentinel",void 0),Kh(this,"_trimTiles",void 0),this._list=new Dv,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;Fv(t)&&this._list.splice(this._sentinel,t)}},{key:"add",value:function(e,t,n){Fv(t._cacheNode)||(t._cacheNode=this._list.add(t),n&&n(e,t))}},{key:"unloadTile",value:function(e,t,n){var i=t._cacheNode;Fv(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,r=1024*e.maximumMemoryUsage*1024,o=this._sentinel,a=i.head;a!==o&&(e.gpuMemoryUsageInBytes>r||n);){var s=a.item;a=a.next,this.unloadTile(e,s,t)}}},{key:"trim",value:function(){this._trimTiles=!0}}]),e}();var Qv=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new bm,new bm;var Hv=new bm,Ov=new bm,Vv=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 bm,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 bm).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,r=e.radius,o=Hv.copy(i).subtract(t),a=o.magnitude();if(n>=a+r)return this.clone();if(r>=a+n)return e.clone();var s=.5*(n+a+r);return Ov.copy(o).scale((-n+s)/a).add(t),this.center.copy(Ov),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],r=t[2],o=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,i,r),e[1]=Math.hypot(o,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?Qv.OUTSIDE:i<n?Qv.INTERSECTING:Qv.INSIDE}}]),e}(),_v=new bm,zv=new bm,Nv=new bm,Uv=new bm,Gv=new bm,jv=new bm,Wv=new bm,qv=0,Jv=1,Yv=2,Zv=3,Xv=4,Kv=5,$v=6,eg=7,tg=8,ng=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 bm).from(t),this.halfAxes=new Rm(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 bm(e).len(),new bm(t).len(),new bm(n).len()]}},{key:"quaternion",get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new bm(e).normalize(),r=new bm(t).normalize(),o=new bm(n).normalize();return(new rv).fromMatrix3(new Rm([].concat(Q(i),Q(r),Q(o))))}},{key:"fromCenterHalfSizeQuaternion",value:function(e,t,n){var i=new rv(n),r=(new Rm).fromQuaternion(i);return r[0]=r[0]*t[0],r[1]=r[1]*t[0],r[2]=r[2]*t[0],r[3]=r[3]*t[1],r[4]=r[4]*t[1],r[5]=r[5]*t[1],r[6]=r[6]*t[2],r[7]=r[7]*t[2],r[8]=r[8]*t[2],this.center=(new bm).from(e),this.halfAxes=r,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 Vv,t=this.halfAxes,n=t.getColumn(0,Nv),i=t.getColumn(1,Uv),r=t.getColumn(2,Gv),o=_v.copy(n).add(i).add(r);return e.center.copy(this.center),e.radius=o.magnitude(),e}},{key:"intersectPlane",value:function(e){var t=this.center,n=e.normal,i=this.halfAxes,r=n.x,o=n.y,a=n.z,s=Math.abs(r*i[qv]+o*i[Jv]+a*i[Yv])+Math.abs(r*i[Zv]+o*i[Xv]+a*i[Kv])+Math.abs(r*i[$v]+o*i[eg]+a*i[tg]),l=n.dot(t)+e.distance;return l<=-s?Qv.OUTSIDE:l>=s?Qv.INSIDE:Qv.INTERSECTING}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceSquaredTo(e))}},{key:"distanceSquaredTo",value:function(e){var t=zv.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,Nv),r=n.getColumn(1,Uv),o=n.getColumn(2,Gv),a=i.magnitude(),s=r.magnitude(),l=o.magnitude();i.normalize(),r.normalize(),o.normalize();var c,u=0;return(c=Math.abs(t.dot(i))-a)>0&&(u+=c*c),(c=Math.abs(t.dot(r))-s)>0&&(u+=c*c),(c=Math.abs(t.dot(o))-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,r=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,s=a.getColumn(0,Nv),l=a.getColumn(1,Uv),c=a.getColumn(2,Gv),u=jv.copy(s).add(l).add(c).add(o),h=Wv.copy(u).subtract(e),d=t.dot(h);return i=Math.min(d,i),r=Math.max(d,r),u.copy(o).add(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),u.copy(o).add(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),u.copy(o).add(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),o.copy(u).subtract(s).add(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),o.copy(u).subtract(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),o.copy(u).subtract(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),o.copy(u).subtract(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),r=Math.max(d,r),n[0]=i,n[1]=r,n}},{key:"transform",value:function(e){this.center.transformAsPoint(e);var t=this.halfAxes.getColumn(0,Nv);t.transformAsPoint(e);var n=this.halfAxes.getColumn(1,Uv);n.transformAsPoint(e);var i=this.halfAxes.getColumn(2,Gv);return i.transformAsPoint(e),this.halfAxes=new Rm([].concat(Q(t),Q(n),Q(i))),this}},{key:"getTransform",value:function(){throw new Error("not implemented")}}]),e}(),ig=new bm,rg=new bm,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 bm,this.distance=-0,this.fromNormalDistance(t,n)}return u(e,[{key:"fromNormalDistance",value:function(e,t){return Of(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}},{key:"fromPointNormal",value:function(e,t){e=ig.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),Of(Zf(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 Zf(this.distance,e.distance)&&Zf(this.normal,e.normal)}},{key:"getPointDistance",value:function(e){return this.normal.dot(e)+this.distance}},{key:"transform",value:function(e){var t=rg.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=ig.from(e);var n=this.getPointDistance(e),i=rg.copy(this.normal).scale(n);return e.subtract(i).to(t)}}]),e}(),ag=[new bm([1,0,0]),new bm([0,1,0]),new bm([0,0,1])],sg=new bm,lg=new bm;new og(new bm(1,0,0),0);var cg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o(this,e),this.planes=t,Of(this.planes.every((function(e){return e instanceof og})))}return u(e,[{key:"fromBoundingSphere",value:function(e){this.planes.length=2*ag.length;var t,n=e.center,i=e.radius,r=0,o=Fh(ag);try{for(o.s();!(t=o.n()).done;){var a=t.value,s=this.planes[r],l=this.planes[r+1];s||(s=this.planes[r]=new og),l||(l=this.planes[r+1]=new og);var c=sg.copy(a).scale(-i).add(n);a.dot(c),s.fromPointNormal(c,a);var u=sg.copy(a).scale(i).add(n),h=lg.copy(a).negate();h.dot(u),l.fromPointNormal(u,h),r+=2}}catch(e){o.e(e)}finally{o.f()}return this}},{key:"computeVisibility",value:function(e){Of(e);var t,n=Qv.INSIDE,i=Fh(this.planes);try{for(i.s();!(t=i.n()).done;){var r=t.value;switch(e.intersectPlane(r)){case Qv.OUTSIDE:return Qv.OUTSIDE;case Qv.INTERSECTING:n=Qv.INTERSECTING}}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"computeVisibilityWithPlaneMask",value:function(t,n){if(Of(t,"boundingVolume is required."),Of(Number.isFinite(n),"parentPlaneMask is required."),n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;for(var i=e.MASK_INSIDE,r=this.planes,o=0;o<this.planes.length;++o){var a=o<31?1<<o:0;if(!(o<31&&0==(n&a))){var s=r[o],l=t.intersectPlane(s);if(l===Qv.OUTSIDE)return e.MASK_OUTSIDE;l===Qv.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}(),ug=new bm,hg=new bm,dg=new bm,pg=new bm,fg=new bm,mg=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 cg([new og,new og,new og,new og,new og,new og]),this._perspectiveMatrix=new _m,this._infinitePerspective=new _m}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 vg(this),this._perspectiveMatrix}},{key:"infiniteProjectionMatrix",get:function(){return vg(this),this._infinitePerspective}},{key:"computeCullingVolume",value:function(e,t,n){Of(e,"position is required."),Of(t,"direction is required."),Of(n,"up is required.");var i=this._cullingVolume.planes;n=ug.copy(n).normalize();var r=hg.copy(t).cross(n).normalize(),o=dg.copy(t).multiplyByScalar(this.near).add(e),a=pg.copy(t).multiplyByScalar(this.far).add(e),s=fg;return s.copy(r).multiplyByScalar(this.left).add(o).subtract(e).cross(n),i[0].fromPointNormal(e,s),s.copy(r).multiplyByScalar(this.right).add(o).subtract(e).cross(n).negate(),i[1].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.bottom).add(o).subtract(e).cross(r).negate(),i[2].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.top).add(o).subtract(e).cross(r),i[3].fromPointNormal(e,s),s=(new bm).copy(t),i[4].fromPointNormal(o,s),s.negate(),i[5].fromPointNormal(a,s),this._cullingVolume}},{key:"getPixelDimensions",value:function(e,t,n,i){vg(this),Of(Number.isFinite(e)&&Number.isFinite(t)),Of(e>0),Of(t>0),Of(n>0),Of(i);var r=1/this.near,o=this.top*r,a=2*n*o/t,s=2*n*(o=this.right*r)/e;return i.x=s,i.y=a,i}}]),e}();function vg(e){Of(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,r=e.left,o=e.near,a=e.far;t===e._top&&n===e._bottom&&r===e._left&&i===e._right&&o===e._near&&a===e._far||(Of(e.near>0&&e.near<e.far,"near must be greater than zero and less than far."),e._left=r,e._right=i,e._top=t,e._bottom=n,e._near=o,e._far=a,e._perspectiveMatrix=(new _m).frustum({left:r,right:i,bottom:n,top:t,near:o,far:a}),e._infinitePerspective=(new _m).frustum({left:r,right:i,bottom:n,top:t,near:o,far:1/0}))}var gg=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 mg,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&&(Ag(this),Ag(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 Ag(this),this._offCenterFrustum.projectionMatrix}},{key:"infiniteProjectionMatrix",get:function(){return Ag(this),this._offCenterFrustum.infiniteProjectionMatrix}},{key:"fovy",get:function(){return Ag(this),this._fovy}},{key:"sseDenominator",get:function(){return Ag(this),this._sseDenominator}},{key:"computeCullingVolume",value:function(e,t,n){return Ag(this),this._offCenterFrustum.computeCullingVolume(e,t,n)}},{key:"getPixelDimensions",value:function(e,t,n,i){return Ag(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i)}}]),e}();function Ag(e){Of(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||(Of(e.fov>=0&&e.fov<Math.PI),Of(e.aspectRatio>0),Of(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 bm,new bm,new bm,new bm,new bm,new bm,new bm,new bm,new bm,new bm,new bm,new bm,new Rm,new Rm,new Rm,new Rm,new Rm,new bm,new bm,new bm,new bm,new bm,new Rm,new Rm,new Rm;var yg=new bm,Eg=new bm,wg=new cg([new og,new og,new og,new og,new og,new og]);function bg(e,t){var n=e.cameraDirection,i=e.cameraUp,r=e.height,o=e.distanceScales.metersPerUnit,a=e.unprojectPosition(e.center),s=Mv.WGS84.cartographicToCartesian(a,new bm),l=Mv.WGS84.eastNorthUpToFixedFrame(s),c=e.unprojectPosition(e.cameraPosition),u=Mv.WGS84.cartographicToCartesian(c,new bm),h=new bm(l.transformAsVector(new bm(n).scale(o))).normalize(),d=new bm(l.transformAsVector(new bm(i).scale(o))).normalize();return function(e,t){var n=e.getFrustumPlanes(),i=0;for(var r in n){var o=n[r],a=o.normal.dot(e.center);Eg.copy(o.normal).scale(o.distance-a).add(e.center);var s=e.unprojectPosition(Eg),l=Mv.WGS84.cartographicToCartesian(s,new bm);wg.planes[i++].fromPointNormal(l,yg.copy(t).subtract(l))}}(e,s),{camera:{position:u,direction:h,up:d},viewport:e,height:r,cullingVolume:wg,frameNumber:t,sseDenominator:1.15}}var Cg=6356752.314245179,xg=new bm;function Ig(e){var t=e.halfAxes,n=e.radius,i=e.width,r=e.height;if(t){var o=function(e){e.getColumn(0,xg);var t=e.getColumn(1),n=e.getColumn(2);return xg.add(t).add(n).len()}(t);return Math.log2(Cg/o)}return n?Math.log2(Cg/n):r&&i?(Math.log2(6378137/i)+Math.log2(6378137/r))/2:1}var Tg=0,Bg=1,kg=3,Pg=4,Rg=5,Mg=1,Sg=2,Dg="empty",Fg="scenegraph",Lg="pointcloud",Qg="mesh",Hg="I3S",Og="TILES3D",Vg="geometricError",_g=1;function zg(e){return null!=e}var Ng=new bm,Ug=new bm,Gg=new bm;function jg(e,t,n){if(zh(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,n){var i=new bm(e[0],e[1],-e[2]);t.transform(i,i);var r=[];if(10===e.length){var o=e.slice(3,6),a=new rv;a.fromArray(e,6);var s=new bm([1,0,0]),l=new bm([0,1,0]),c=new bm([0,0,1]);s.transformByQuaternion(a),s.scale(o[0]),l.transformByQuaternion(a),l.scale(o[1]),c.transformByQuaternion(a),c.scale(o[2]),r=[].concat(Q(s.toArray()),Q(l.toArray()),Q(c.toArray()))}else r=[].concat(Q(e.slice(3,6)),Q(e.slice(6,9)),Q(e.slice(9,12)));var u=t.transformAsVector(r.slice(0,3)),h=t.transformAsVector(r.slice(3,6)),d=t.transformAsVector(r.slice(6,9)),p=new Rm([u[0],u[1],u[2],h[0],h[1],h[2],d[0],d[1],d[2]]);if(zg(n))return n.center=i,n.halfAxes=p,n;return new ng(i,p)}(e.box,t,n);if(e.region){var i=ce(e.region,6),r=i[0],o=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=Mv.WGS84.cartographicToCartesian([Jf(r),Jf(s),l],Ug),h=Mv.WGS84.cartographicToCartesian([Jf(a),Jf(o),c],Gg),d=(new bm).addVectors(u,h).multiplyScalar(.5),p=(new bm).subVectors(u,h).len()/2;return Wg([d[0],d[1],d[2],p],new _m)}if(e.sphere)return Wg(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Wg(e,t,n){var i=new bm(e[0],e[1],e[2]);t.transform(i,i);var r=t.getScale(Ng),o=Math.max(Math.max(r[0],r[1]),r[2]),a=e[3]*o;return zg(n)?(n.center=i,n.radius=a,n):new Vv(i,a)}function qg(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 Jg(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}),r=e.header.mbs[1],o=e.header.mbs[0],a=e.header.mbs[2],s=e.header.mbs[3],l=Q(e.boundingVolume.center),c=i.unprojectPosition(i.cameraPosition),u=Mv.WGS84.cartographicToCartesian(c,new bm),h=new bm(u).subtract(l).normalize(),d=new _m;Mv.WGS84.eastNorthUpToFixedFrame(l,d);var p=new _m(d).invert(),f=new bm(u).transform(p),m=Math.sqrt(f[0]*f[0]+f[1]*f[1]),v=m*m/f[2],g=new bm([f[0],f[1],v]).transform(d),A=new bm(g).subtract(l).normalize(),y=h.cross(A).normalize().scale(s),E=new bm(l).add(y),w=Mv.WGS84.cartesianToCartographic(E),b=i.project([o,r,a]),C=i.project(w);return new bm(b).subtract(C).magnitude()}new bm,new bm,new _m,new bm,new bm,new bm;var Yg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;o(this,e),Kh(this,"_map",new Map),Kh(this,"_array",void 0),Kh(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 zh(e<this._array.length),this._array[e]}},{key:"set",value:function(e,t){zh(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){zh(e>=0),e>this._array.length&&(this._array.length=e)}},{key:"resize",value:function(e){zh(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}(),Zg={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:function(){},viewportTraversersMap:{},basePath:""},Xg=function(){function e(t){o(this,e),Kh(this,"options",void 0),Kh(this,"root",void 0),Kh(this,"requestedTiles",void 0),Kh(this,"selectedTiles",void 0),Kh(this,"emptyTiles",void 0),Kh(this,"_traversalStack",void 0),Kh(this,"_emptyTraversalStack",void 0),Kh(this,"_frameNumber",void 0),this.options=Hh(Hh({},Zg),t),this._traversalStack=new Yg,this._emptyTraversalStack=new Yg,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(),r=!1,o="all"==i.tileset.options.currentFloorId||null==i.floorIndex||i.floorIndex==i.tileset.options.currentFloorId;this.canTraverse(i,t)&&o&&(this.updateChildTiles(i,t),r=this.updateAndPushChildren(i,t,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));var a=i.parent,s=Boolean(!a||a._shouldRefine),l=!r;i.hasRenderContent?i.refine===Mg?(this.loadTile(i,t),this.selectTile(i,t)):i.refine===Sg&&(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=r&&s}this.options.onTraversalEnd(t)}},{key:"updateChildTiles",value:function(e,t){var n,i=Fh(e.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;this.updateTile(r,t)}}catch(e){i.e(e)}finally{i.f()}return!0}},{key:"updateAndPushChildren",value:function(e,t,n,i){var r=this.options,o=r.loadSiblings,a=r.skipLevelOfDetail,s=e.children;s.sort(this.compareDistanceToCamera.bind(this)).reverse();var l,c=e.refine===Sg&&e.hasRenderContent&&!a,u=!1,h=!0,d=Fh(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||o)&&(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,r=Fh(e.children);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.updateVisibility(t),i=i||o.isVisibleAndInRequestVolume}}catch(e){r.e(e)}finally{r.f()}return i}},{key:"executeEmptyTraversal",value:function(e,t){var n=!0,i=this._emptyTraversalStack;for(i.push(e);i.length>0&&n;){var r=i.pop();if(this.updateTile(r,t),r.isVisibleAndInRequestVolume||this.loadTile(r,t),this.touchTile(r,t),!r.hasRenderContent&&this.canTraverse(r,t,!1,!0)){var o,a=Fh(r.children);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.find(s)&&i.delete(s),i.push(s)}}catch(e){a.e(e)}finally{a.f()}}else r.contentAvailable||(n=!1)}return n}}]),e}(),Kg=new bm;var $g=function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";o(this,e),Kh(this,"tileset",void 0),Kh(this,"header",void 0),Kh(this,"id",void 0),Kh(this,"url",void 0),Kh(this,"parent",void 0),Kh(this,"refine",void 0),Kh(this,"type",void 0),Kh(this,"contentUrl",void 0),Kh(this,"lodMetricType",void 0),Kh(this,"lodMetricValue",void 0),Kh(this,"boundingVolume",void 0),Kh(this,"content",void 0),Kh(this,"contentState",void 0),Kh(this,"gpuMemoryUsageInBytes",void 0),Kh(this,"children",void 0),Kh(this,"depth",void 0),Kh(this,"viewportIds",void 0),Kh(this,"transform",void 0),Kh(this,"extensions",void 0),Kh(this,"userData",void 0),Kh(this,"computedTransform",void 0),Kh(this,"hasEmptyContent",void 0),Kh(this,"hasTilesetContent",void 0),Kh(this,"traverser",void 0),Kh(this,"_cacheNode",void 0),Kh(this,"_frameNumber",void 0),Kh(this,"_lodJudge",void 0),Kh(this,"_expireDate",void 0),Kh(this,"_expiredContent",void 0),Kh(this,"_shouldRefine",void 0),Kh(this,"_distanceToCamera",void 0),Kh(this,"_centerZDepth",void 0),Kh(this,"_screenSpaceError",void 0),Kh(this,"_visibilityPlaneMask",void 0),Kh(this,"_visible",void 0),Kh(this,"_inRequestVolume",void 0),Kh(this,"_stackLength",void 0),Kh(this,"_selectionDepth",void 0),Kh(this,"_touchedFrame",void 0),Kh(this,"_visitedFrame",void 0),Kh(this,"_selectedFrame",void 0),Kh(this,"_requestedFrame",void 0),Kh(this,"_priority",void 0),Kh(this,"_contentBoundingVolume",void 0),Kh(this,"_viewerRequestVolume",void 0),Kh(this,"_initialTransform",void 0),Kh(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=Tg,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 Xg({}),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 _m,this.transform=new _m,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===kg||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===Tg}},{key:"contentExpired",get:function(){return this.contentState===Pg}},{key:"contentFailed",get:function(){return this.contentState===Rg}},{key:"getScreenSpaceError",value:function(e,t){switch(this.tileset.type){case Hg:return Jg(this,e);case Og:return function(e,t,n){var i=e.tileset,r=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=n?r:e.lodMetricValue;if(0===o)return 0;var a=Math.max(e._distanceToCamera,1e-7),s=t.height,l=t.sseDenominator,c=o*s*(i.options.viewDistanceScale||1)/(a*l);return c-qg(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===Mg||t;if(n&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===Tg)return-1;var i=this.parent,r=i&&(!n||0===this._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,o=e.root?e.root._screenSpaceError:0;return Math.max(o-r,0)}},{key:"loadContent",value:(t=k(S.mark((function e(){var t,n,i,r;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=Bg,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=Tg,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,r=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,Qf(n,i,r);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=kg,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=Tg,e.abrupt("return",!1);case 36:throw this.contentState=Rg,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=Tg,!0}},{key:"updateVisibility",value:function(e,t){if(this._frameNumber!==e.frameNumber){var n=this.parent,i=n?n._visibilityPlaneMask:cg.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){var r=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(r)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,i),this._visible=this._visibilityPlaneMask!==cg.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 Kg.subVectors(n.center,t.position),t.direction.dot(Kg)}},{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=Pg,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 _m(e.transform):new _m;var t=this.parent,n=this.tileset,i=t&&t.computedTransform?t.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new _m(i).multiplyRight(this.transform);var r=t&&t._initialTransform?t._initialTransform.clone():new _m;this._initialTransform=new _m(r).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=Tg,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=cg.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||Sg}},{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=jg(e.boundingVolume,this.computedTransform,this.boundingVolume);var t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=jg(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=jg(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}},{key:"_updateTransform",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new _m,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}(),eA=function(e){f(n,e);var t=Rh(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 r=e.children[0];return this.updateTileVisibility(r,t),void(e._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))e._visible=!1;else{var o=e.refine===Sg,a=e._optimChildrenWithinParent===_g;o&&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!==Mg)&&!this.shouldRefine(e,t,!0)}}]),n}(Xg),tA="REQUESTED",nA="COMPLETED",iA="ERROR",rA=function(){function e(){o(this,e),Kh(this,"_statusMap",void 0),this._statusMap={}}return u(e,[{key:"add",value:function(e,t,n,i){var r=this;this._statusMap[t]||(this._statusMap[t]={request:e,callback:n,key:t,frameState:i,status:tA},e().then((function(e){r._statusMap[t].status=nA,r._statusMap[t].callback(e,i)})).catch((function(e){r._statusMap[t].status=iA,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=Rh(i);function i(e){var t;return o(this,i),Kh(h(t=n.call(this,e)),"_tileManager",void 0),t._tileManager=new rA,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*Jg(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,r=e.header.children||[],o=e.children,a=e.tileset,s=Fh(r);try{var l=function(){var r=n.value,s="".concat(r.id,"-").concat(t.viewport.id),l=o&&o.find((function(e){return e.id===s}));if(l)l&&i.updateTile(l,t);else{var c=function(){return i._loadTile(r.id,a)};i._tileManager.find(s)?i._tileManager.update(s,t):(a.tileset.nodePages&&(c=function(){return a.tileset.nodePagesTile.formTileFromNodePages(r.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,r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.loader,r=n.getTileUrl("".concat(n.url,"/nodes/").concat(t)),o=Hh(Hh({},n.loadOptions),{},{i3s:Hh(Hh({},n.loadOptions.i3s),{},{isTileHeader:!0,loadContent:!1})}),e.next=5,Qf(r,i,o);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 $g(t.tileset,e,t,n);t.children.push(i);var r=this._tileManager.find(i.id).frameState;this.updateTile(i,r),this._frameNumber===r.frameNumber&&this.executeTraversal(i,r)}}]),i}(Xg),aA={description:"",ellipsoid:Mv.WGS84,modelMatrix:new _m,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:{}},sA="Tiles In Tileset(s)",lA="Tiles In Memory",cA="Tiles In View",uA="Tiles To Render",hA="Tiles Loaded",dA="Tiles Loading",pA="Tiles Unloaded",fA="Failed Tile Loads",mA="Points",vA="Tile Memory Use",gA=function(e){f(i,e);var t,n=Rh(i);function i(e,t){var r;return o(this,i),Kh(h(r=n.call(this)),"options",void 0),Kh(h(r),"loadOptions",void 0),Kh(h(r),"type",void 0),Kh(h(r),"tileset",void 0),Kh(h(r),"loader",void 0),Kh(h(r),"url",void 0),Kh(h(r),"basePath",void 0),Kh(h(r),"modelMatrix",void 0),Kh(h(r),"ellipsoid",void 0),Kh(h(r),"lodMetricType",void 0),Kh(h(r),"lodMetricValue",void 0),Kh(h(r),"refine",void 0),Kh(h(r),"root",void 0),Kh(h(r),"roots",void 0),Kh(h(r),"asset",void 0),Kh(h(r),"description",void 0),Kh(h(r),"properties",void 0),Kh(h(r),"extras",void 0),Kh(h(r),"attributions",void 0),Kh(h(r),"credits",void 0),Kh(h(r),"stats",void 0),Kh(h(r),"traverseCounter",void 0),Kh(h(r),"geometricError",void 0),Kh(h(r),"selectedTiles",void 0),Kh(h(r),"cartographicCenter",void 0),Kh(h(r),"cartesianCenter",void 0),Kh(h(r),"zoom",void 0),Kh(h(r),"boundingVolume",void 0),Kh(h(r),"gpuMemoryUsageInBytes",void 0),Kh(h(r),"dynamicScreenSpaceErrorComputedDensity",void 0),Kh(h(r),"_traverser",void 0),Kh(h(r),"_cache",void 0),Kh(h(r),"_requestScheduler",void 0),Kh(h(r),"_frameNumber",void 0),Kh(h(r),"_queryParamsString",void 0),Kh(h(r),"_queryParams",void 0),Kh(h(r),"_extensionsUsed",void 0),Kh(h(r),"_tiles",void 0),Kh(h(r),"_pendingCount",void 0),Kh(h(r),"lastUpdatedVieports",void 0),Kh(h(r),"_requestedTiles",void 0),Kh(h(r),"_emptyTiles",void 0),Kh(h(r),"frameStateData",void 0),Kh(h(r),"maximumMemoryUsage",void 0),Kh(h(r),"loadingTiles",void 0),zh(e),r.options=Hh(Hh({},aA),t),r.tileset=e,r.loader=e.loader,r.type=e.type,r.url=e.url,r.basePath=e.basePath||Jd(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 Lv,r._requestScheduler=new jd({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 Od({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 r=i[n];t.push("".concat(r,"=").concat(e[r]))}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=Fh(e);try{for(i.s();!(t=i.n()).done;){var r=t.value.id;this._needTraverse(r)?n.push(r):this.traverseCounter--}}catch(e){i.e(e)}finally{i.f()}var o,a=Fh(e);try{for(a.s();!(o=a.n()).done;){var s=o.value,l=s.id;if(this.roots[l]||(this.roots[l]=this._initializeTileHeaders(this.tileset,null)),n.includes(l)){var c=bg(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=Fh(this.selectedTiles);try{for(i.s();!(n=i.n()).done;){var r=n.value;this._tiles[r.id]=r}}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}))),r=e.filter((function(e){return!i.has(e.id)})).length>0;return r=r||t.filter((function(e){return!n.has(e.id)})).length>0}},{key:"_loadTiles",value:function(){var e,t=Fh(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=Fh(this.selectedTiles);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(n+=r.content.pointCount))}}catch(e){i.e(e)}finally{i.f()}this.stats.get(cA).count=this.selectedTiles.length,this.stats.get(uA).count=t,this.stats.get(mA).count=n}},{key:"_initializeTileSet",value:function(e){this.root=this._initializeTileHeaders(e,null),this.type===Og&&this._initializeCesiumTileset(e),this.type===Hg&&this._initializeI3STileset(),this._calculateViewProps()}},{key:"_calculateViewProps",value:function(){var e=this.root;zh(e);var t=e.boundingVolume.center;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new bm,void(this.zoom=1);this.cartographicCenter=Mv.WGS84.cartesianToCartographic(t,new bm),this.cartesianCenter=t,this.zoom=Ig(e.boundingVolume)}},{key:"_initializeStats",value:function(){this.stats.get(sA),this.stats.get(dA),this.stats.get(lA),this.stats.get(cA),this.stats.get(uA),this.stats.get(hA),this.stats.get(pA),this.stats.get(fA),this.stats.get(mA,"memory"),this.stats.get(vA,"memory")}},{key:"_initializeTileHeaders",value:function(e,t){var n=new $g(this,e.root,t);if(t&&(t.children.push(n),n.depth=t.depth+1),this.type===Og){var i=[];for(i.push(n);i.length>0;){var r=i.pop();this.stats.get(sA).incrementCount();var o,a=Fh(r.header.children||[]);try{for(a.s();!(o=a.n()).done;){var s=o.value,l=new $g(this,s,r);r.children.push(l),l.depth=r.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 Og:e=eA;break;case Hg:e=oA;break;default:e=Xg}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(fA).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){zh(e),zh(t);var n=t.rtcCenter,i=t.gltfUpAxis,r=e.computedTransform,o=e.boundingVolume.center,a=new _m(r);switch(n&&a.translate(n),i){case"Z":break;case"Y":var s=(new _m).rotateX(Math.PI/2);a=a.multiplyRight(s);break;case"X":var l=(new _m).rotateY(-Math.PI/2);a=a.multiplyRight(l)}t.isQuantized&&a.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);var c=new bm(o);t.cartesianModelMatrix=a,t.cartesianOrigin=c;var u=Mv.WGS84.cartesianToCartographic(c,new bm),h=Mv.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(dA).incrementCount()}},{key:"_onEndTileLoading",value:function(e){this.loadingTiles=this.loadingTiles.filter((function(t){return t!=e})),this._pendingCount--,this.stats.get(dA).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(hA).incrementCount(),this.stats.get(lA).incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get(vA).count=this.gpuMemoryUsageInBytes}},{key:"_unloadTile",value:function(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get(lA).decrementCount(),this.stats.get(pA).incrementCount(),this.stats.get(vA).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=Fh(n.children);try{for(i.s();!(t=i.n()).done;){var r=t.value;e.push(r)}}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,r=Fh((e=n.pop()).children);try{for(r.s();!(i=r.n()).done;){var o=i.value;n.push(o)}}catch(e){r.e(e)}finally{r.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}(mr);var AA="3.1.4",yA="cmpt",EA="pnts",wA="b3dm",bA="i3dm",CA="glTF";function xA(e,t,n){zh(e instanceof ArrayBuffer);var i=new TextDecoder("utf8"),r=new Uint8Array(e,t,n);return i.decode(r)}function IA(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 TA={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 BA(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,o=-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,r=u>r?u:r,o=h>o?h:o,a=d>a?d:a}return[[t,n,i],[r,o,a]]}var kA=function(){function e(t,n){o(this,e),Kh(this,"fields",void 0),Kh(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=Fh(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;n[r.name]&&console.warn("Schema: duplicated field name",r.name,r),n[r.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),r=0;r<n;r++)i[r]=arguments[r];for(var o=0,a=i;o<a.length;o++){var s=a[o];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),r=0;r<n;r++)i[r]=arguments[r];var o=i.map((function(e){return t.fields[e]})).filter(Boolean);return new e(o,this.metadata)}},{key:"assign",value:function(t){var n,i=this.metadata;if(t instanceof e){var r=t;n=r.fields,i=PA(PA(new Map,this.metadata),r.metadata)}else n=t;var o,a=Object.create(null),s=Fh(this.fields);try{for(s.s();!(o=s.n()).done;){var l=o.value;a[l.name]=l}}catch(e){s.e(e)}finally{s.f()}var c,u=Fh(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 PA(e,t){return new Map([].concat(Q(e||new Map),Q(t||new Map)))}var RA,MA=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),Kh(this,"name",void 0),Kh(this,"type",void 0),Kh(this,"nullable",void 0),Kh(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"}(RA||(RA={}));var SA=function(){function e(){o(this,e)}return u(e,[{key:"typeId",get:function(){return RA.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===RA.Null}},{key:"isInt",value:function(e){return e&&e.typeId===RA.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===RA.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===RA.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===RA.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===RA.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===RA.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===RA.Date}},{key:"isTime",value:function(e){return e&&e.typeId===RA.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===RA.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===RA.Interval}},{key:"isList",value:function(e){return e&&e.typeId===RA.List}},{key:"isStruct",value:function(e){return e&&e.typeId===RA.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===RA.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===RA.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===RA.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===RA.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===RA.Dictionary}}]),e}(),DA=function(e,t){f(i,e);var n=Rh(i);function i(e,t){var r;return o(this,i),Kh(h(r=n.call(this)),"isSigned",void 0),Kh(h(r),"bitWidth",void 0),r.isSigned=e,r.bitWidth=t,r}return u(i,[{key:"typeId",get:function(){return RA.Int}},{key:t,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),i}(SA,Symbol.toStringTag),FA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!0,8)}return n}(DA),LA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!0,16)}return n}(DA),QA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!0,32)}return n}(DA),HA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!1,8)}return n}(DA),OA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!1,16)}return n}(DA),VA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,!1,32)}return n}(DA),_A=32,zA=64,NA=function(e,t){f(i,e);var n=Rh(i);function i(e){var t;return o(this,i),Kh(h(t=n.call(this)),"precision",void 0),t.precision=e,t}return u(i,[{key:"typeId",get:function(){return RA.Float}},{key:t,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),i}(SA,Symbol.toStringTag),UA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,_A)}return n}(NA),GA=function(e){f(n,e);var t=Rh(n);function n(){return o(this,n),t.call(this,zA)}return n}(NA),jA=function(e,t){f(i,e);var n=Rh(i);function i(e,t){var r;return o(this,i),Kh(h(r=n.call(this)),"listSize",void 0),Kh(h(r),"children",void 0),r.listSize=e,r.children=[t],r}return u(i,[{key:"typeId",get:function(){return RA.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}(SA,Symbol.toStringTag);function WA(e,t,n){var i=function(e){switch(e.constructor){case Int8Array:return new FA;case Uint8Array:return new HA;case Int16Array:return new LA;case Uint16Array:return new OA;case Int32Array:return new QA;case Uint32Array:return new VA;case Float32Array:return new UA;case Float64Array:return new GA;default:throw new Error("array type not supported")}}(t.value),r=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 MA(e,new jA(t.size,new MA("value",i)),!1,r)}function qA(e,t,n){var i=YA(t.metadata),r=[],o=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=JA(a,e[a],o[a]);r.push(s)}if(n){var l=JA("indices",n);r.push(l)}return new kA(r,i)}function JA(e,t,n){return WA(e,t,n?YA(n.metadata):void 0)}function YA(e){var t=new Map;for(var n in e)t.set("".concat(n,".string"),JSON.stringify(e[n]));return t}var ZA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},XA={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},KA=function(){function e(t){o(this,e),Kh(this,"draco",void 0),Kh(this,"decoder",void 0),Kh(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),r=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{var o;switch(i){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,r);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,r);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!r.ptr){var a="DRACO decompression failed: ".concat(o.error_msg());throw new Error(a)}var s=this._getDracoLoaderData(r,i,t),l=this._getMeshData(r,s,t),c=BA(l.attributes),u=qA(l.attributes,s,l.indices),h=Hh(Hh({loader:"draco",loaderData:s,header:{vertexCount:r.num_points(),boundingBox:c}},l),{},{schema:u});return h}finally{this.draco.destroy(n),r&&this.draco.destroy(r)}}},{key:"_getDracoLoaderData",value:function(e,t,n){var i=this._getTopLevelMetadata(e),r=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:r}}},{key:"_getDracoAttributes",value:function(e,t){for(var n={},i=0;i<e.num_attributes();i++){var r=this.decoder.GetAttribute(e,i),o=this._getAttributeMetadata(e,i);n[r.unique_id()]={unique_id:r.unique_id(),attribute_type:r.attribute_type(),data_type:r.data_type(),num_components:r.num_components(),byte_offset:r.byte_offset(),byte_stride:r.byte_stride(),normalized:r.normalized(),attribute_index:i,metadata:o};var a=this._getQuantizationTransform(r,t);a&&(n[r.unique_id()].quantization_transform=a);var s=this._getOctahedronTransform(r,t);s&&(n[r.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={},r=0,o=Object.values(e.attributes);r<o.length;r++){var a=o[r],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=XA[t.data_type],r=t.num_components,o=e.num_points()*r,a=o*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,o).slice()}finally{this.draco._free(l)}return{value:n,size:r}}},{key:"_deduceAttributeName",value:function(e,t){for(var n=e.unique_id,i=0,r=Object.entries(t.extraAttributes||{});i<r.length;i++){var o=ce(r[i],2),a=o[0];if(o[1]===n)return a}var s=e.attribute_type;for(var l in ZA){if(this.draco[l]===s)return ZA[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 r=this.metadataQuerier.GetEntryName(e,i);t[r]=this._getDracoMetadataField(e,r)}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,r=e.octahedronAttributes,o=void 0===r?[]:r,a=Fh([].concat(Q(i),Q(o)));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,r=void 0===i?[]:i,o=e.attribute_type();if(r.map((function(e){return n.decoder[e]})).includes(o)){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,r=void 0===i?[]:i,o=e.attribute_type();if(r.map((function(e){return n.decoder[e]})).includes(o)){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 $A,ey="1.4.1",ty="https://www.gstatic.com/draco/versioned/decoders/".concat(ey,"/draco_decoder.js"),ny="https://www.gstatic.com/draco/versioned/decoders/".concat(ey,"/draco_wasm_wrapper.js"),iy="https://www.gstatic.com/draco/versioned/decoders/".concat(ey,"/draco_decoder.wasm");function ry(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||{},$A=n.draco3d?$A||n.draco3d.createDecoderModule({}).then((function(e){return{draco:e}})):$A||ay(t),e.next=4,$A;case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ay(e){return sy.apply(this,arguments)}function sy(){return(sy=k(S.mark((function e(t){var n,i,r,o;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,vd(ty,"draco",t);case 5:return n=e.sent,e.abrupt("break",22);case 7:return e.t1=Promise,e.next=11,vd(ny,"draco",t);case 11:return e.t2=e.sent,e.next=14,vd(iy,"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:r=e.sent,o=ce(r,2),n=o[0],i=o[1];case 22:return n=n||Vh.DracoDecoderModule,e.next=25,ly(n,i);case 25:return e.abrupt("return",e.sent);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ly(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 cy=Hh(Hh({},TA),{},{parse:function(e,t){return uy.apply(this,arguments)}});function uy(){return(uy=k(S.mark((function e(t,n){var i,r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ry(n);case 2:return i=e.sent,r=i.draco,o=new KA(r),e.prev=5,e.abrupt("return",o.parseSync(t,null==n?void 0:n.draco));case 7:return e.prev=7,o.destroy(),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[5,,7,10]])})))).apply(this,arguments)}var hy={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},dy=Hh(Hh({},{POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6}),hy),py={[hy.DOUBLE]:Float64Array,[hy.FLOAT]:Float32Array,[hy.UNSIGNED_SHORT]:Uint16Array,[hy.UNSIGNED_INT]:Uint32Array,[hy.UNSIGNED_BYTE]:Uint8Array,[hy.BYTE]:Int8Array,[hy.SHORT]:Int16Array,[hy.INT]:Int32Array},fy={DOUBLE:hy.DOUBLE,FLOAT:hy.FLOAT,UNSIGNED_SHORT:hy.UNSIGNED_SHORT,UNSIGNED_INT:hy.UNSIGNED_INT,UNSIGNED_BYTE:hy.UNSIGNED_BYTE,BYTE:hy.BYTE,SHORT:hy.SHORT,INT:hy.INT},my="Failed to convert GL type",vy=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,py){if(py[t]===e)return t}throw new Error(my)}},{key:"fromName",value:function(e){var t=fy[e];if(!t)throw new Error(my);return t}},{key:"getArrayType",value:function(e){switch(e){case hy.UNSIGNED_SHORT_5_6_5:case hy.UNSIGNED_SHORT_4_4_4_4:case hy.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:var t=py[e];if(!t)throw new Error(my);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,r=arguments.length>3?arguments[3]:void 0;void 0===r&&(r=(n.byteLength-i)/e.getByteSize(t));var o=e.getArrayType(t);return new o(n,i,r)}}]),e}();function gy(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=e>>11&31,i=e>>5&63,r=31&e;return t[0]=n<<3,t[1]=i<<2,t[2]=r<<3,t}function Ay(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return Yf(e,0,t)/t*2-1}function yy(e){return e<0?-1:1}function Ey(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=Ay(e,n),i.y=Ay(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){var r=i.x;i.x=(1-Math.abs(i.y))*yy(r),i.y=(1-Math.abs(r))*yy(i.y)}return i.normalize()}function wy(e,t,n){return Ey(e,t,255,n)}new hm,new bm,new hm,new hm;var by=function(){function e(t,n){o(this,e),Kh(this,"json",void 0),Kh(this,"buffer",void 0),Kh(this,"featuresLength",0),Kh(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]:dy.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=vy.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,r){var o=this.json[e];if(!o)return o;var a=this.getPropertyArray(e,t,n);if(1===n)return a[i];for(var s=0;s<n;++s)r[s]=a[n*i+s];return r}},{key:"_getTypedArrayFromBinary",value:function(e,t,n,i,r){var o=this._cachedTypedArrays,a=o[e];return a||(a=vy.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+r,i*n),o[e]=a),a}},{key:"_getTypedArrayFromArray",value:function(e,t,n){var i=this._cachedTypedArrays,r=i[e];return r||(r=vy.createTypedArray(t,n),i[e]=r),r}}]),e}(),Cy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xy={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]]}},Iy={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 Ty=function(e){return void 0!==e};function By(e,t,n){if(!t)return null;var i=e.getExtension("3DTILES_batch_table_hierarchy"),r=t.HIERARCHY;return r&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=r,i=r),i?function(e,t){var n,i,r,o=e.instancesLength,a=e.classes,s=e.classIds,l=e.parentCounts,c=e.parentIds,u=o;Ty(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,s=getBinaryAccessor(s).createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,o));if(Ty(l))for(Ty(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,l=getBinaryAccessor(l).createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,o)),r=new Uint16Array(o),u=0,n=0;n<o;++n)r[n]=u,u+=l[n];Ty(c)&&Ty(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(o);for(n=0;n<o;++n)i=s[n],v[n]=m[i],++m[i];var g={classes:a,classIds:s,classIndexes:v,parentCounts:l,parentIndexes:r,parentIds:c};return function(e){for(var t=e.classIds.length,n=0;n<t;++n)Py(e,n,stack)}(g),g}(i,n):null}function ky(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,r=e.parentCounts,o=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(Ty(h))return h;for(var d=r[t],p=a[t],f=0;f<d;++f){var m=o[p+f];m!==t&&u.push(m)}}return null}(e,t,n):function(e,t,n){var i=!0;for(;i;){var r=n(e,t);if(Ty(r))return r;var o=e.parentIds[t];i=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}(e,t,n)}}function Py(e,t,n){var i=e.parentCounts,r=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(Ty(r)){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=Ty(i)?i[t]:1,l=Ty(i)?o[t]:t,c=0;c<s;++c){var u=r[l+c];u!==t&&Py(e,u,n)}n.pop(t)}}function Ry(e){return null!=e}var My=function(e,t){return e},Sy={HIERARCHY:!0,extensions:!0,extras:!0},Dy=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),Kh(this,"json",void 0),Kh(this,"binary",void 0),Kh(this,"featureCount",void 0),Kh(this,"_extensions",void 0),Kh(this,"_properties",void 0),Kh(this,"_binaryProperties",void 0),Kh(this,"_hierarchy",void 0),zh(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)Sy[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),a["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=By(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),zh("string"==typeof t,t),!!this._hierarchy&&Ry(ky(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return e.classes[i].name===t})))}},{key:"isExactClass",value:function(e,t){return zh("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),zh("string"==typeof t,t),Ry(this._properties[t])||this._hasPropertyInHierarchy(e,t)}},{key:"getPropertyNames",value:function(e,t){var n;this._checkBatchId(e),(t=Ry(t)?t:[]).length=0;var i=Object.keys(this._properties);return(n=t).push.apply(n,Q(i)),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}},{key:"getProperty",value:function(e,t){if(this._checkBatchId(e),zh("string"==typeof t,t),this._binaryProperties){var n=this._binaryProperties[t];if(Ry(n))return this._getBinaryProperty(n,e)}var i=this._properties[t];if(Ry(i))return My(i[e]);if(this._hierarchy){var r=this._getHierarchyProperty(e,t);if(Ry(r))return r}}},{key:"setProperty",value:function(e,t,n){var i=this.featureCount;if(this._checkBatchId(e),zh("string"==typeof t,t),this._binaryProperties){var r=this._binaryProperties[t];if(r)return void this._setBinaryProperty(r,e,n)}if(!this._hierarchy||!this._setHierarchyProperty(this,e,t,n)){var o=this._properties[t];Ry(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=My(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;zh(this.binary,"Property ".concat(e," requires a batch table binary.")),zh(n.type,"Property ".concat(e," requires a type."));var i=function(e,t,n,i){var r=e.componentType;zh(e.componentType);var o="string"==typeof r?vy.fromName(r):r,a=Cy[e.type],s=xy[e.type],l=Iy[e.type];return n+=e.byteOffset,{values:vy.createTypedArray(o,t,n,a*i),type:o,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=ky(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return Ry(e.classes[i].instances[t])}));return Ry(n)}},{key:"_getPropertyNamesInHierarchy",value:function(e,t){ky(this._hierarchy,e,(function(e,n){var i=e.classIds[n],r=e.classes[i].instances;for(var o in r)r.hasOwnProperty(o)&&-1===t.indexOf(o)&&t.push(o)}))}},{key:"_getHierarchyProperty",value:function(e,t){var n=this;return ky(this._hierarchy,e,(function(e,i){var r=e.classIds[i],o=e.classes[r],a=e.classIndexes[i],s=o.instances[t];return Ry(s)?Ry(s.typedArray)?n._getBinaryProperty(s,a):My(s[a]):null}))}},{key:"_setHierarchyProperty",value:function(e,t,n,i){var r=this,o=ky(this._hierarchy,t,(function(e,o){var a=e.classIds[o],s=e.classes[a],l=e.classIndexes[o],c=s.instances[n];return!!Ry(c)&&(zh(o===t,'Inherited property "'.concat(n,'" is read-only.')),Ry(c.typedArray)?r._setBinaryProperty(c,l,i):c[l]=My(i),!0)}));return Ry(o)}}]),e}();function Fy(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 Ly="b3dm tile in legacy format.";function Qy(e,t,n){var i,r=new DataView(t);e.header=e.header||{};var o=r.getUint32(n,!0);n+=4;var a=r.getUint32(n,!0);n+=4;var s=r.getUint32(n,!0);n+=4;var l=r.getUint32(n,!0);return n+=4,s>=570425344?(n-=8,i=o,s=a,l=0,o=0,a=0,console.warn(Ly)):l>=570425344&&(n-=4,i=s,s=o,l=a,o=0,a=0,console.warn(Ly)),e.header.featureTableJsonByteLength=o,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 r=e.header,o=r.featureTableJsonByteLength,a=r.featureTableBinaryByteLength,s=r.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},o>0){var l=xA(t,n,o);e.featureTableJson=JSON.parse(l)}return n+=o,e.featureTableBinary=new Uint8Array(t,n,a),n+=a}(e,t,n),n=function(e,t,n,i){var r=e.header,o=r.batchTableJsonByteLength,a=r.batchTableBinaryByteLength;if(o>0){var s=xA(t,n,o);e.batchTableJson=JSON.parse(s),n+=o,a>0&&(e.batchTableBinary=new Uint8Array(t,n,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=a)}return n}(e,t,n)}function Oy(e,t,n){if(!(t||e&&e.batchIds&&n))return null;var i=e.batchIds,r=e.isRGB565,o=e.pointCount;if(i&&n){for(var a=new Uint8ClampedArray(3*o),s=0;s<o;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:dy.UNSIGNED_BYTE,value:a,size:3,normalized:!0}}if(r){for(var u=new Uint8ClampedArray(3*o),h=0;h<o;h++){var d=gy(t[h]);u[3*h]=d[0],u[3*h+1]=d[1],u[3*h+2]=d[2]}return{type:dy.UNSIGNED_BYTE,value:u,size:3,normalized:!0}}return t&&t.length===3*o?{type:dy.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:dy.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}var Vy=new bm;function _y(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){for(var n=new bm,i=new Float32Array(3*e.pointCount),r=0;r<e.pointCount;r++)n.set(t[3*r],t[3*r+1],t[3*r+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(i,3*r);return i}(e,t)):{type:dy.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function zy(e,t,n,i,r){return Ny.apply(this,arguments)}function Ny(){return(Ny=k(S.mark((function e(t,n,i,r,o){var a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Fy(t,n,i),i=Qy(t,n,i),i=Hy(t,n,i),Uy(t),a=Gy(t),s=a.featureTable,l=a.batchTable,e.next=7,Jy(t,s,l,r,o);case 7:return jy(t,s,r),Wy(t,s,l),qy(t,s),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Uy(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function Gy(e){var t=new by(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",dy.FLOAT,3);var i=function(e,t){var n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",dy.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 r=e.batchTableJson,o=e.batchTableBinary;n=new Dy(r,o,i)}return n}(e,t);return{featureTable:t,batchTable:i}}function jy(e,t,n){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",dy.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){var i=t.getPropertyArray("POSITION_QUANTIZED",dy.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",dy.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",dy.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=_y(e,i,n)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function Wy(e,t,n){if(!e.attributes.colors){var i=null;t.hasProperty("RGBA")?(i=t.getPropertyArray("RGBA",dy.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?i=t.getPropertyArray("RGB",dy.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(i=t.getPropertyArray("RGB565",dy.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Oy(e,i,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",dy.UNSIGNED_BYTE,4))}function qy(e,t){if(!e.attributes.normals){var n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",dy.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",dy.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++)wy(t[2*i],t[2*i+1],Vy),Vy.toArray(n,3*i);return{type:dy.FLOAT,size:2,value:n}}return{type:dy.FLOAT,size:2,value:t}}(e,n)}}function Jy(e,t,n,i,r){return Yy.apply(this,arguments)}function Yy(){return(Yy=k(S.mark((function e(t,n,i,r,o){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,Zy(t,p,r,o);case 20:return e.abrupt("return",e.sent);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Zy(e,t,n,i){return Xy.apply(this,arguments)}function Xy(){return(Xy=k(S.mark((function e(t,n,i,r){var o,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 o=r.parse,delete(a=Hh(Hh({},i),{},{draco:Hh(Hh({},i.draco),{},{extraAttributes:n.batchTableProperties||{}})}))["3d-tiles"],e.next=5,o(n.buffer,cy,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 bm(m,m,m),t.quantizedVolumeOffset=new bm(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:Oy(t,c,void 0),normals:u,batchIds:h},v);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ky,$y,eE="3.1.4",tE="https://unpkg.com/@loaders.gl/textures@".concat(eE,"/dist/libs/basis_encoder.wasm"),nE="https://unpkg.com/@loaders.gl/textures@".concat(eE,"/dist/libs/basis_encoder.js");function iE(e){return rE.apply(this,arguments)}function rE(){return(rE=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 Ky=Ky||oE(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 oE(e){return aE.apply(this,arguments)}function aE(){return(aE=k(S.mark((function e(t){var n,i,r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,vd("basis_transcoder.js","textures",t);case 5:return e.t1=e.sent,e.next=8,vd("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 r=e.sent,o=ce(r,2),n=o[0],i=o[1],n=n||Vh.BASIS,e.next=19,sE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sE(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 lE(e){return cE.apply(this,arguments)}function cE(){return(cE=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 $y=$y||uE(t),e.next=6,$y;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uE(e){return hE.apply(this,arguments)}function hE(){return(hE=k(S.mark((function e(t){var n,i,r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,vd(nE,"textures",t);case 5:return e.t1=e.sent,e.next=8,vd(tE,"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 r=e.sent,o=ce(r,2),n=o[0],i=o[1],n=n||Vh.BASIS,e.next=19,dE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dE(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,r=e.initializeBasis,o=e.BasisEncoder;r(),t({BasisFile:n,KTX2File:i,BasisEncoder:o})}))}))}var pE,fE,mE,vE,gE,AE,yE,EE,wE=33776,bE=33779,CE=35840,xE=35842,IE=36196,TE=37808,BE=["","WEBKIT_","MOZ_"],kE={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"},PE=null;function RE(e){if(!PE){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,PE=new Set;var t,n=Fh(BE);try{for(n.s();!(t=n.n()).done;){var i=t.value;for(var r in kE)if(e&&e.getExtension("".concat(i).concat(r))){var o=kE[r];PE.add(o)}}}catch(e){n.e(e)}finally{n.f()}}return PE}!function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"}(pE||(pE={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(fE||(fE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(mE||(mE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(vE||(vE={})),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"}(gE||(gE={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(AE||(AE={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(yE||(yE={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(EE||(EE={}));var ME=[171,75,84,88,32,50,48,187,13,10,26,10];function SE(e){var t=new Uint8Array(e);return!(t.byteLength<ME.length||t[0]!==ME[0]||t[1]!==ME[1]||t[2]!==ME[2]||t[3]!==ME[3]||t[4]!==ME[4]||t[5]!==ME[5]||t[6]!==ME[6]||t[7]!==ME[7]||t[8]!==ME[8]||t[9]!==ME[9]||t[10]!==ME[10]||t[11]!==ME[11])}var DE={etc1:{basisFormat:0,compressed:!0,format:IE},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:wE},bc3:{basisFormat:3,compressed:!0,format:bE},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:CE},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:xE},"astc-4x4":{basisFormat:10,compressed:!0,format:TE},"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 FE(){return(FE=k(S.mark((function e(t,n){var i,r,o,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(!SE(t)){e.next=6;break}return e.next=4,lE(n);case 4:return i=e.sent,e.abrupt("return",HE(i.KTX2File,t,n));case 6:return e.next=8,iE(n);case 8:return r=e.sent,o=r.BasisFile,e.abrupt("return",LE(o,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,lE(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",LE(a.BasisFile,t,n));case 22:return e.next=24,iE(n);case 24:return s=e.sent,l=s.BasisFile,e.abrupt("return",LE(l,t,n));case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function LE(e,t,n){var i=new e(new Uint8Array(t));try{if(!i.startTranscoding())return null;for(var r=i.getNumImages(),o=[],a=0;a<r;a++){for(var s=i.getNumLevels(a),l=[],c=0;c<s;c++)l.push(QE(i,a,c,n));o.push(l)}return o}finally{i.close(),i.delete()}}function QE(e,t,n,i){var r=e.getImageWidth(t,n),o=e.getImageHeight(t,n),a=e.getHasAlpha(),s=VE(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:r,height:o,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 r=i.getLevels(),o=[],a=0;a<r;a++){o.push(OE(i,a,n));break}return o}finally{i.close(),i.delete()}}function OE(e,t,n){var i=e.getImageLevelInfo(t,0,0),r=i.alphaFlag,o=i.height,a=i.width,s=VE(n,r),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:o,data:d,compressed:l,alphaFlag:r,format:c}:null}function VE(e,t){var n=e&&e.basis&&e.basis.format;return"auto"===n&&(n=_E()),"object"==typeof n&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),DE[n]}function _E(){var e=RE();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 zE=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 FE.apply(this,arguments)}}),NE=Vh._parseImageNode,UE="undefined"!=typeof Image,GE="undefined"!=typeof ImageBitmap,jE=Boolean(NE),WE=!!Nh||jE;function qE(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 JE(e){switch(qE(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 YE=/^data:image\/svg\+xml/,ZE=/\.svg((\?|#).*)?$/;function XE(e){return e&&(YE.test(e)||ZE.test(e))}function KE(e,t){if(XE(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 $E(e,t)}function $E(e,t){if(XE(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}function ew(e,t,n){return tw.apply(this,arguments)}function tw(){return(tw=k(S.mark((function e(t,n,i){var r,o,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=KE(t,i),o=self.URL||self.webkitURL,a="string"!=typeof r&&o.createObjectURL(r),e.prev=3,e.next=6,nw(a||r,n);case 6:return e.abrupt("return",e.sent);case 7:return e.prev=7,a&&o.revokeObjectURL(a),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[3,,7,10]])})))).apply(this,arguments)}function nw(e,t){return iw.apply(this,arguments)}function iw(){return(iw=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 rw={},ow=!0;function aw(e,t,n){return sw.apply(this,arguments)}function sw(){return(sw=k(S.mark((function e(t,n,i){var r,o,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!XE(i)){e.next=7;break}return e.next=3,ew(t,n,i);case 3:o=e.sent,r=o,e.next=8;break;case 7:r=$E(t,i);case 8:return a=n&&n.imagebitmap,e.next=11,lw(r,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lw(e){return cw.apply(this,arguments)}function cw(){return(cw=k(S.mark((function e(t){var n,i=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!uw(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 uw(e){for(var t in e||rw)return!1;return!0}var hw=!1,dw=!0;function pw(e){var t=fw(e);return function(e){var t=fw(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,hw)))return null;return{mimeType:"image/png",width:t.getUint32(16,hw),height:t.getUint32(20,hw)}}(t)||function(e){var t=fw(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,hw)&&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,r=n.sofMarkers,o=2;for(;o+9<t.byteLength;){var a=t.getUint16(o,hw);if(r.has(a))return{mimeType:"image/jpeg",height:t.getUint16(o+5,hw),width:t.getUint16(o+7,hw)};if(!i.has(a))return null;o+=2,o+=t.getUint16(o,hw)}return null}(t)||function(e){var t=fw(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,hw)))return null;return{mimeType:"image/gif",width:t.getUint16(6,dw),height:t.getUint16(8,dw)}}(t)||function(e){var t=fw(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,hw)&&t.getUint32(2,dw)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,dw),height:t.getUint32(22,dw)}}(t)}function fw(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 mw(e,t){return vw.apply(this,arguments)}function vw(){return(vw=k(S.mark((function e(t,n){var i,r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=pw(t)||{},r=i.mimeType,zh(o=Vh._parseImageNode),e.next=5,o(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gw(){return(gw=k(S.mark((function e(t,n,i){var r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=(n=n||{}).image||{},o=r.type||"auto",a=(i||{}).url,s=Aw(o),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,aw(t,n,a);case 10:return l=e.sent,e.abrupt("break",21);case 12:return e.next=14,ew(t,n,a);case 14:return l=e.sent,e.abrupt("break",21);case 16:return e.next=18,mw(t);case 18:return l=e.sent,e.abrupt("break",21);case 20:zh(!1);case 21:return"data"===o&&(l=JE(l)),e.abrupt("return",l);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Aw(e){switch(e){case"auto":case"data":return function(){if(GE)return"imagebitmap";if(UE)return"image";if(WE)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return GE||UE||WE;case"imagebitmap":return GE;case"image":return UE;case"data":return WE;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}var yw={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 gw.apply(this,arguments)},tests:[function(e){return Boolean(pw(new DataView(e)))}],options:{image:{type:"auto",decode:!0}}},Ew=["image/png","image/jpeg","image/gif"],ww={};function bw(e){return void 0===ww[e]&&(ww[e]=function(e){switch(e){case"image/webp":return function(){if(!Nh)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch(e){return!1}}();case"image/svg":return Nh;default:if(!Nh){var t=Vh._parseImageNode;return Boolean(t)&&Ew.includes(e)}return!0}}(e)),ww[e]}function Cw(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function xw(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 Iw(e,t,n){var i=e.bufferViews[n];Cw(i);var r=t[i.buffer];Cw(r);var o=(i.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,o,i.byteLength)}var Tw=["SCALAR","VEC2","VEC3","VEC4"],Bw=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],kw=new Map(Bw),Pw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Rw={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Mw={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Sw(e){return Tw[e-1]||Tw[0]}function Dw(e){var t=kw.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Fw(e,t){var n=Mw[e.componentType],i=Pw[e.type],r=Rw[e.componentType],o=e.count*i,a=e.count*i*r;return Cw(a>=0&&a<=t.byteLength),{ArrayType:n,length:o,byteLength:a}}var Lw,Qw={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]},Hw=function(){function e(t){o(this,e),Kh(this,"gltf",void 0),Kh(this,"sourceBuffers",void 0),Kh(this,"byteLength",void 0),this.gltf=t||{json:Hh({},Qw),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];Cw(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=Fw(e,t),r=i.ArrayType,o=i.length;return new r(n,t.byteOffset+e.byteOffset,o)}},{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 Cw(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 Cw(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,r=e.mode,o=void 0===r?4:r,a={primitives:[{attributes:this._addAttributes(t),mode:o}]};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=pw(e),i=t||(null==n?void 0:n.mimeType),r={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}},{key:"addBufferView",value:function(e){var t=e.byteLength;Cw(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);var n={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=Dd(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:Sw(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 r={size:t.size,componentType:Dw(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(r,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,r=new ArrayBuffer(i),o=new Uint8Array(r),a=0,s=Fh(this.sourceBuffers||[]);try{for(s.s();!(n=s.n()).done;){a=Fd(n.value,o,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=r,this.sourceBuffers=[r]}},{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],r=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);t[r]=o}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,r=Fh(e.subarray(0,t));try{for(r.s();!(i=r.n()).done;){var o=i.value;n.min.push(o),n.max.push(o)}}catch(e){r.e(e)}finally{r.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}(),Ow="object"!=typeof WebAssembly,Vw="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",_w="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",zw=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]),Nw=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]),Uw={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Gw={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};function jw(e,t,n,i,r){return Ww.apply(this,arguments)}function Ww(){return(Ww=k(S.mark((function e(t,n,i,r,o){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,qw();case 3:Kw(s=e.sent,s.exports[Gw[o]],t,n,i,r,s.exports[Uw[a||"NONE"]]);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qw(){return Jw.apply(this,arguments)}function Jw(){return(Jw=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Lw||(Lw=Yw()),e.abrupt("return",Lw);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yw(){return Zw.apply(this,arguments)}function Zw(){return(Zw=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Vw,WebAssembly.validate(zw)&&(t=_w,console.log("Warning: meshopt_decoder is using experimental SIMD support")),e.next=4,WebAssembly.instantiate(Xw(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 Xw(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 r=0,o=0;o<e.length;++o)t[r++]=t[o]<60?Nw[t[o]]:64*(t[o]-60)+t[++o];return t.buffer.slice(0,r)}function Kw(e,t,n,i,r,o,a){var s=e.exports.sbrk,l=i+3&-4,c=s(l*r),u=s(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,u);var d=t(c,i,r,u,o.length);if(0===d&&a&&a(c,l,r),n.set(h.subarray(c,c+i*r)),s(c-s(0)),0!==d)throw new Error("Malformed buffer data: ".concat(d))}var $w="EXT_meshopt_compression";function eb(){return(eb=k(S.mark((function e(t,n){var i,r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=new Hw(t),null!=n&&null!==(i=n.gltf)&&void 0!==i&&i.decompressMeshes){e.next=3;break}return e.abrupt("return");case 3:o=[],a=Fh(t.json.bufferViews||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,o.push(tb(r,l))}catch(e){a.e(e)}finally{a.f()}return e.next=8,Promise.all(o);case 8:r.removeExtension($w);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tb(e,t){return nb.apply(this,arguments)}function nb(){return(nb=k(S.mark((function e(t,n){var i,r,o,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,$w))){e.next=9;break}return r=n.buffer,o=i.byteOffset,a=void 0===o?0:o,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(r,a,l),m=new ArrayBuffer(u*c),e.next=8,jw(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 ib="EXT_texture_webp";var rb="KHR_texture_basisu";function ob(e){var t={};for(var n in e){var i=e[n];if("indices"!==n){var r=ab(i);t[n]=r}}return t}function ab(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:Sw(i),componentType:Dw(n)}}var sb="KHR_draco_mesh_compression";function lb(){return(lb=k(S.mark((function e(t,n,i){var r,o,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&null!==(r=n.gltf)&&void 0!==r&&r.decompressMeshes){e.next=2;break}return e.abrupt("return");case 2:o=new Hw(t),a=[],s=Fh(pb(o));try{for(s.s();!(l=s.n()).done;)c=l.value,o.getObjectExtension(c,sb)&&a.push(cb(o,c,n,i))}catch(e){s.e(e)}finally{s.f()}return e.next=8,Promise.all(a);case 8:o.removeExtension(sb);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cb(e,t,n,i){return ub.apply(this,arguments)}function ub(){return(ub=k(S.mark((function e(t,n,i,r){var o,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(o=t.getObjectExtension(n,sb)){e.next=3;break}return e.abrupt("return");case 3:return a=t.getTypedArrayForBufferView(o.bufferView),s=Sd(a.buffer,a.byteOffset),l=r.parse,delete(c=Hh({},i))["3d-tiles"],e.next=10,l(s,cy,c,r);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=ab(u.indices)),db(n);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hb(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");var a=r.DracoWriter.encodeSync({attributes:e}),s=null==o||null===(n=o.parseSync)||void 0===n?void 0:n.call(o,{attributes:e}),l=r._addFauxAttributes(s.attributes),c=r.addBufferView(a),u={primitives:[{attributes:l,mode:i,extensions:{[sb]:{bufferView:c,attributes:l}}}]};return u}function db(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function pb(e){var t,n,i,r,o,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:t=Fh(e.json.meshes||[]),s.prev=1,t.s();case 3:if((n=t.n()).done){s.next=24;break}i=n.value,r=Fh(i.primitives),s.prev=6,r.s();case 8:if((o=r.n()).done){s.next=14;break}return a=o.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),r.e(s.t0);case 19:return s.prev=19,r.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()}}),Dh,null,[[1,26,29,32],[6,16,19,22]])}var fb="KHR_lights_punctual";function mb(){return(mb=k(S.mark((function e(t){var n,i,r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Hw(t),i=n.json,(r=n.getExtension(fb))&&(n.json.lights=r.lights,n.removeExtension(fb)),o=Fh(i.nodes||[]);try{for(o.s();!(a=o.n()).done;)s=a.value,(l=n.getObjectExtension(s,fb))&&(s.light=l.light),n.removeObjectExtension(s,fb)}catch(e){o.e(e)}finally{o.f()}case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vb(){return(vb=k(S.mark((function e(t){var n,i,r,o,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&&(Cw(!(r=n.addExtension(fb)).lights),r.lights=i.lights,delete i.lights),n.json.lights){o=Fh(n.json.lights);try{for(o.s();!(a=o.n()).done;)s=a.value,l=s.node,n.addObjectExtension(l,fb,s)}catch(e){o.e(e)}finally{o.f()}delete n.json.lights}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var gb="KHR_materials_unlit";function Ab(){return(Ab=k(S.mark((function e(t){var n,i,r,o,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new Hw(t),i=n.json,n.removeExtension(gb),r=Fh(i.materials||[]);try{for(r.s();!(o=r.n()).done;)a=o.value,a.extensions&&a.extensions.KHR_materials_unlit&&(a.unlit=!0),n.removeObjectExtension(a,gb)}catch(e){r.e(e)}finally{r.f()}case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var yb="KHR_techniques_webgl";function Eb(){return(Eb=k(S.mark((function e(t){var n,i,r,o,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,r=n.getExtension(yb)){o=bb(r,n),a=Fh(i.materials||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,(c=n.getObjectExtension(l,yb))&&(l.technique=Object.assign({},c,o[c.technique]),l.technique.values=Cb(l.technique,n)),n.removeObjectExtension(l,yb)}catch(e){a.e(e)}finally{a.f()}n.removeExtension(yb)}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wb(){return(wb=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 bb(e,t){var n=e.programs,i=void 0===n?[]:n,r=e.shaders,o=void 0===r?[]:r,a=e.techniques,s=void 0===a?[]:a,l=new TextDecoder;return o.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=o[e.fragmentShader],e.vertexShader=o[e.vertexShader]})),s.forEach((function(e){e.program=i[e.program]})),s}function Cb(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 xb=[Object.freeze({__proto__:null,name:"EXT_meshopt_compression",preprocess:function(e){if(new Hw(e).getRequiredExtensions().includes($w)&&!Ow)throw new Error("gltf: Required extension ".concat($w," not supported by browser"))},decode:function(e,t){return eb.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"EXT_texture_webp",preprocess:function(e,t){var n=new Hw(e);if(bw("image/webp")){var i,r=Fh(n.json.textures||[]);try{for(r.s();!(i=r.n()).done;){var o=i.value,a=n.getObjectExtension(o,ib);a&&(o.source=a.source),n.removeObjectExtension(o,ib)}}catch(e){r.e(e)}finally{r.f()}n.removeExtension(ib)}else if(n.getRequiredExtensions().includes(ib))throw new Error("gltf: Required extension ".concat(ib," not supported by browser"))}}),Object.freeze({__proto__:null,name:"KHR_texture_basisu",preprocess:function(e,t){var n,i=new Hw(e),r=Fh(i.json.textures||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value,a=i.getObjectExtension(o,rb);a&&(o.source=a.source),i.removeObjectExtension(o,rb)}}catch(e){r.e(e)}finally{r.f()}i.removeExtension(rb)}}),Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,n){var i,r=new Hw(e),o=Fh(pb(r));try{for(o.s();!(i=o.n()).done;){var a=i.value;r.getObjectExtension(a,sb)}}catch(e){o.e(e)}finally{o.f()}},decode:function(e,t,n){return lb.apply(this,arguments)},encode:function(e){var t,n=new Hw(e),i=Fh(n.json.meshes||[]);try{for(i.s();!(t=i.n()).done;){hb(t.value),n.addRequiredExtension(sb)}}catch(e){i.e(e)}finally{i.f()}}}),Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:function(e){return mb.apply(this,arguments)},encode:function(e){return vb.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:function(e){return Ab.apply(this,arguments)},encode:function(e){var t=new Hw(e),n=t.json;if(t.materials){var i,r=Fh(n.materials||[]);try{for(r.s();!(i=r.n()).done;){var o=i.value;o.unlit&&(delete o.unlit,t.addObjectExtension(o,gb,{}),t.addExtension(gb))}}catch(e){r.e(e)}finally{r.f()}}}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:function(e){return Eb.apply(this,arguments)},encode:function(e,t){return wb.apply(this,arguments)}})];function Ib(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,r=xb.filter((function(e){return kb(e.name,n)})),o=Fh(r);try{for(o.s();!(t=o.n()).done;){var a,s=t.value;null===(a=s.preprocess)||void 0===a||a.call(s,e,n,i)}}catch(e){o.e(e)}finally{o.f()}}function Tb(e){return Bb.apply(this,arguments)}function Bb(){return(Bb=k(S.mark((function e(t){var n,i,r,o,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,r=xb.filter((function(e){return kb(e.name,n)})),o=Fh(r),e.prev=4,o.s();case 6:if((a=o.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),o.e(e.t0);case 17:return e.prev=17,o.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})))).apply(this,arguments)}function kb(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 Pb="KHR_binary_glTF";var Rb={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Mb={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Sb=function(){function e(){o(this,e),Kh(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Kh(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,r=Fh(i.images||[]);try{for(r.s();!(t=r.n()).done;){var o=t.value,a=n.getObjectExtension(o,Pb);a&&Object.assign(o,a),n.removeObjectExtension(o,Pb)}}catch(e){r.e(e)}finally{r.f()}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,n.removeExtension(Pb)}(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 Rb)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 r=n[i];r.id=r.id||i;var o=e[t].length;e[t].push(r),this.idToIndexMap[t][i]=o}}},{key:"_convertObjectIdsToArrayIndices",value:function(e){for(var t in Rb)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));var n,i=Fh(e.textures);try{for(i.s();!(n=i.n()).done;){var r=n.value;this._convertTextureIds(r)}}catch(e){i.e(e)}finally{i.f()}var o,a=Fh(e.meshes);try{for(a.s();!(o=a.n()).done;){var s=o.value;this._convertMeshIds(s)}}catch(e){a.e(e)}finally{a.f()}var l,c=Fh(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=Fh(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=Fh(e.primitives);try{for(n.s();!(t=n.n()).done;){var i=t.value,r=i.attributes,o=i.indices,a=i.material;for(var s in r)r[s]=this._convertIdToIndex(r[s],"accessor");o&&(i.indices=this._convertIdToIndex(o,"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=Fh(e[t]);try{for(i.s();!(n=i.n()).done;){var r=n.value;for(var o in r){var a=r[o],s=this._convertIdToIndex(a,o);r[o]=s}}}catch(e){i.e(e)}finally{i.f()}}},{key:"_convertIdToIndex",value:function(e,t){var n=Mb[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=Fh(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=Fh(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,r=e.textures.findIndex((function(e){return e.id===i}));-1!==r&&(n.pbrMetallicRoughness.baseColorTexture={index:r})};for(n.s();!(t=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}}]),e}();function Db(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new Sb).normalize(e,t)}var Fb={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Lb={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Qb=10240,Hb=10241,Ob=10242,Vb=10243,_b=10497,zb={magFilter:Qb,minFilter:Hb,wrapS:Ob,wrapT:Vb},Nb={[Qb]:9729,[Hb]:9986,[Ob]:_b,[Vb]:_b};var Ub=function(){function e(){o(this,e),Kh(this,"baseUri",""),Kh(this,"json",{}),Kh(this,"buffers",[]),Kh(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,r=void 0===i?[]:i,o=e.images,a=void 0===o?[]:o,s=e.baseUri,l=void 0===s?"":s;return Cw(n),this.baseUri=l,this.json=n,this.buffers=r,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,Lb[n]),e.components=(i=e.type,Fb[i]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){var r=e.bufferView.buffer,o=Fw(e,e.bufferView),a=o.ArrayType,s=o.byteLength,l=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+r.byteOffset,c=r.arrayBuffer.slice(l,l+s);e.bufferView.byteStride&&(c=this._getValueFromInterleavedBuffer(r,l,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new a(c)}return e}},{key:"_getValueFromInterleavedBuffer",value:function(e,t,n,i,r){for(var o=new Uint8Array(r*i),a=0;a<r;a++){var s=t+a*n;o.set(new Uint8Array(e.arrayBuffer.slice(s,s+i)),a*i)}return o.buffer}},{key:"_resolveTexture",value:function(e,t){return e.id=e.id||"texture-".concat(t),e.sampler="sampler"in e?this.getSampler(e.sampler):Nb,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 zb[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]}),r=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return"byteOffset"in e&&(o+=e.byteOffset),i.data=new Uint8Array(r,o,e.byteLength),i}},{key:"_resolveCamera",value:function(e,t){return e.id=e.id||"camera-".concat(t),e.perspective,e.orthographic,e}}]),e}();function Gb(e,t){return(new Ub).postProcess(e,t)}var jb=1735152710,Wb=1313821514,qb=5130562,Jb=!0;function Yb(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 Zb(e,t,n){zh(e.header.byteLength>20);var i=t.getUint32(n+0,Jb),r=t.getUint32(n+4,Jb);return n+=8,zh(0===r),Kb(e,t,n,i),n+=i,n+=$b(e,t,n,e.header.byteLength)}function Xb(e,t,n,i){return zh(e.header.byteLength>20),function(e,t,n,i){for(;n+8<=e.header.byteLength;){var r=t.getUint32(n+0,Jb),o=t.getUint32(n+4,Jb);switch(n+=8,o){case Wb:Kb(e,t,n,r);break;case qb:$b(e,t,n,r);break;case 0:i.strict||Kb(e,t,n,r);break;case 1:i.strict||$b(e,t,n,r)}n+=Dd(r,4)}}(e,t,n,i),n+e.header.byteLength}function Kb(e,t,n,i){var r=new Uint8Array(t.buffer,n,i),o=new TextDecoder("utf8").decode(r);return e.json=JSON.parse(o),Dd(i,4)}function $b(e,t,n,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:i,arrayBuffer:t.buffer}),Dd(i,4)}function eC(e,t){return tC.apply(this,arguments)}function tC(){return(tC=k(S.mark((function e(t,n){var i,r,o,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,r=p.length>3?p[3]:void 0,o=p.length>4?p[4]:void 0,nC(t,n,i,r),Db(t,{normalize:null==r||null===(a=r.gltf)||void 0===a?void 0:a.normalize}),Ib(t,r,o),u=[],null==r||null===(s=r.gltf)||void 0===s||!s.loadBuffers||!t.json.buffers){e.next=10;break}return e.next=10,iC(t,r,o);case 10:return null!=r&&null!==(l=r.gltf)&&void 0!==l&&l.loadImages&&(h=oC(t,r,o),u.push(h)),d=Tb(t,r,o),u.push(d),e.next=15,Promise.all(u);case 15:return t.json.gltfArrayBuffer=n,e.abrupt("return",null!=r&&null!==(c=r.gltf)&&void 0!==c&&c.postProcess?Gb(t,r):t);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nC(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),r=n.magic,o=void 0===r?jb:r,a=i.getUint32(t,!1);return a===o||a===jb}(t,n,i))&&(t=(new TextDecoder).decode(t));if("string"==typeof t)e.json=kd(t);else if(t instanceof ArrayBuffer){var r={};n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new DataView(t),r=Yb(i,n+0),o=i.getUint32(n+4,Jb),a=i.getUint32(n+8,Jb);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:r,version:o,json:{},binChunks:[]}),n+=12,e.version){case 1:return Zb(e,i,n);case 2:return Xb(e,i,n,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}(r,t,n,i.glb),Cw("glTF"===r.type,"Invalid GLB magic string ".concat(r.type)),e._glb=r,e.json=r.json}else Cw(!1,"GLTF: must be ArrayBuffer or string");var o=e.json.buffers||[];if(e.buffers=new Array(o.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 iC(e,t,n){return rC.apply(this,arguments)}function rC(){return(rC=k(S.mark((function e(t,n,i){var r,o,a,s,l,c,u,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.json.buffers||[],o=0;case 2:if(!(o<r.length)){e.next=19;break}if(!(a=r[o]).uri){e.next=16;break}return Cw(i.fetch),c=xw(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[o]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri;case 16:++o,e.next=2;break;case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oC(e,t,n){return aC.apply(this,arguments)}function aC(){return(aC=k(S.mark((function e(t,n,i){var r,o,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=sC(t),o=t.json.images||[],a=[],s=Fh(r);try{for(s.s();!(l=s.n()).done;)c=l.value,a.push(lC(t,o[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 sC(e){var t,n=new Set,i=Fh(e.json.textures||[]);try{for(i.s();!(t=i.n()).done;){var r=t.value;void 0!==r.source&&n.add(r.source)}}catch(e){i.e(e)}finally{i.f()}return Array.from(n).sort()}function lC(e,t,n,i,r){return cC.apply(this,arguments)}function cC(){return(cC=k(S.mark((function e(t,n,i,r,o){var a,s,l,c,u,h,d;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=o.fetch,s=o.parse,!n.uri){e.next=9;break}return c=xw(n.uri,r),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=Iw(t.json,t.buffers,n.bufferView),l=Sd(h.buffer,h.byteOffset,h.byteLength)),Cw(l,"glTF image has no data"),e.next=13,s(l,[yw,zE],{mimeType:n.mimeType,basis:r.basis||{format:_E()}},o);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 uC={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 hC.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 hC(){return(hC=k(S.mark((function e(t){var n,i,r,o,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({},uC.options),n)).gltf=Hh(Hh({},uC.options.gltf),n.gltf),r=n.byteOffset,o=void 0===r?0:r,a={},e.next=8,eC(a,t,o,n,i);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var dC=0,pC=1;function fC(e,t,n,i){e.rotateYtoZ=!0;var r=e.byteOffset+e.byteLength-n;if(0===r)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=Sd(t,n,r),e.gltfByteOffset=0,e.gltfByteLength=r,n%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function mC(e,t,n,i){return vC.apply(this,arguments)}function vC(){return(vC=k(S.mark((function e(t,n,i,r){var o,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i["3d-tiles"]||{},gC(t,n),!o.loadGLTF){e.next=16;break}if(a=r.parse,s=r.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,uC,i,r);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 gC(e,t,n){switch(t){case dC:var i=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),r=(new TextDecoder).decode(i);e.gltfUrl=r.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case pC:break;default:throw new Error("b3dm: Illegal glTF format field")}}function AC(e,t,n,i,r){return yC.apply(this,arguments)}function yC(){return(yC=k(S.mark((function e(t,n,i,r,o){var a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=EC(t,n,i,r),e.next=3,mC(t,pC,r,o);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 EC(e,t,n,i,r){n=fC(e,t,n=Hy(e,t,n=Qy(e,t,n=Fy(e,t,n))),i);var o=new by(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",dy.FLOAT,3),n}function wC(e,t,n,i,r){return bC.apply(this,arguments)}function bC(){return(bC=k(S.mark((function e(t,n,i,r,o){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=CC(t,n,i,r),e.next=3,mC(t,t.gltfFormat,r,o);case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CC(e,t,n,i,r){if(n=Fy(e,t,n),1!==e.version)throw new Error("Instanced 3D Model version ".concat(e.version," is not supported"));n=Qy(e,t,n);var o=new DataView(t);if(e.gltfFormat=o.getUint32(n,!0),n=fC(e,t,n=Hy(e,t,n+=4),i),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");var a=new by(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",dy.FLOAT,3);new Dy(e.batchTableJson,e.batchTableBinary,s);return function(e,t,n,i){var r=[new Array(i),e._batchTable][0],o=new bm;new bm,new bm,new bm;for(var a=new Rm,s=new rv,l=new bm,c={},u=new _m,h=[],d=[],p=new bm,f=new bm,m=0;m<i;m++){var v=void 0;if(t.hasProperty("POSITION"))v=t.getProperty("POSITION",dy.FLOAT,3,m,o);else if(t.hasProperty("POSITION_QUANTIZED")){v=t.getProperty("POSITION_QUANTIZED",dy.UNSIGNED_SHORT,3,m,o);var g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",dy.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",dy.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(o.copy(v),c.translation=o,e.normalUp=t.getProperty("NORMAL_UP",dy.FLOAT,3,m,h),e.normalRight=t.getProperty("NORMAL_RIGHT",dy.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",dy.UNSIGNED_SHORT,2,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",dy.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?(Mv.WGS84.eastNorthUpToFixedFrame(o,u),u.getRotationMatrix3(a)):a.identity()}s.fromMatrix3(a),c.rotation=s,l.set(1,1,1);var w=t.getProperty("SCALE",dy.FLOAT,1,m);Number.isFinite(w)&&l.multiplyByScalar(w);var b=t.getProperty("SCALE_NON_UNIFORM",dy.FLOAT,3,m,h);b&&l.scale(b),c.scale=l;var C=t.getProperty("BATCH_ID",dy.UNSIGNED_SHORT,1,m);void 0===C&&(C=m);var x=(new _m).fromQuaternion(c.rotation);u.identity(),u.translate(c.translation),u.multiplyRight(x),u.scale(c.scale);var I=u.clone();r[m]={modelMatrix:I,batchId:C}}e.instances=r}(e,a,0,s),n}function xC(e,t,n,i,r,o){return IC.apply(this,arguments)}function IC(){return(IC=k(S.mark((function e(t,n,i,r,o,a){var s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Fy(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,r,o,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 TC(e,t,n,i){return BC.apply(this,arguments)}function BC(){return(BC=k(S.mark((function e(t,n,i,r){var o;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",o=r.parse,e.next=5,o(n,uC,i,r);case 5:t.gltf=e.sent;case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kC(e){return PC.apply(this,arguments)}function PC(){return(PC=k(S.mark((function e(t){var n,i,r,o,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,r=a.length>3?a[3]:void 0,(o=a.length>4&&void 0!==a[4]?a[4]:{}).byteOffset=n,o.type=IA(t,n),e.t0=o.type,e.next=e.t0===yA?9:e.t0===wA?12:e.t0===CA?15:e.t0===bA?18:e.t0===EA?21:24;break;case 9:return e.next=11,xC(o,t,n,i,r,kC);case 11:return e.abrupt("return",e.sent);case 12:return e.next=14,AC(o,t,n,i,r);case 14:return e.abrupt("return",e.sent);case 15:return e.next=17,TC(o,t,i,r);case 17:return e.abrupt("return",e.sent);case 18:return e.next=20,wC(o,t,n,i,r);case 20:return e.abrupt("return",e.sent);case 21:return e.next=23,zy(o,t,n,i,r);case 23:return e.abrupt("return",e.sent);case 24:throw new Error("3DTileLoader: unknown type ".concat(o.type));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var RC=1952609651;function MC(){return(MC=k(S.mark((function e(t){var n,i,r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(new Uint32Array(t.slice(0,4))[0]===RC){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=FC(t.slice(8,16)),i=new Uint8Array(t,24,n),r=new TextDecoder("utf8"),o=r.decode(i),a=JSON.parse(o),s=FC(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,SC(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,SC(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,SC(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 SC(e,t,n){return DC.apply(this,arguments)}function DC(){return(DC=k(S.mark((function e(t,n,i){var r,o,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t[n].bufferView,o=t.bufferViews[r],!(a=t.buffers[o.buffer]).uri){e.next=11;break}return e.next=6,Ep(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,o.byteOffset,o.byteLength));case 11:return e.abrupt("return",new Uint8Array(i,o.byteOffset,o.byteLength));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function FC(e){var t=new DataView(e),n=t.getUint32(0,!0),i=t.getUint32(4,!0);return n+Math.pow(2,32)*i}var LC={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:AA,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:function(e){return MC.apply(this,arguments)},options:{}},QC={QUADTREE:4,OCTREE:8};function HC(e,t){return OC.apply(this,arguments)}function OC(){return(OC=k(S.mark((function e(t,n){var i,r,o,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,H,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},r=O.length>3&&void 0!==O[3]?O[3]:0,o=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=QC[s],m=1&r,v=r>>1&1,g=r>>2&1,A=(Math.pow(f,o)-1)/(f-1),y=zC(i.mortonIndex,r),E=A+y,w=zC(i.x,m),b=zC(i.y,v),C=zC(i.z,g),x=!1,o+1>l&&(x=VC(t.childSubtreeAvailability,y)),I=zC(a.x,w),T=zC(a.y,b),B=zC(a.z,C),k=o+a.level,!x){e.next=40;break}return P="".concat(d,"/").concat(h),R=NC(P,k,I,T,B),e.next=27,Qf(R,LC);case 27:M=e.sent,t=M,a.mortonIndex=y,a.x=w,a.y=b,a.z=C,a.level=o,y=0,E=0,w=0,b=0,C=0,o=0;case 40:if(VC(t.tileAvailability,E)&&!(o>c)){e.next=43;break}return e.abrupt("return",p);case 43:VC(t.contentAvailability,E)&&(p.contentUrl=NC(u,k,I,T,B)),D=o+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:((Q=e.sent).contentUrl||Q.children.length)&&(H=_C(Q,k+1,{childTileX:w,childTileY:b,childTileZ:C},n),p.children.push(H));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 VC(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&(n=t,i=e.explicitBitstream,r=Math.floor(n/8),o=n%8,1==(i[r]>>o&1));var n,i,r,o}function _C(e,t,n,i){var r=i.basePath,o=i.refine,a=i.getRefine,s=i.lodMetricType,l=i.getTileType,c=i.rootLodMetricValue,u=i.rootBoundingVolume,h=e.contentUrl&&e.contentUrl.replace("".concat(r,"/"),""),d=c/Math.pow(2,t),p=function(e,t,n){if(t.region){var i=n.childTileX,r=n.childTileY,o=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*r,s+f*(i+1),l+m*(r+1),h+v*o,h+v*(o+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(o),type:l(e),lodMetricType:s,lodMetricValue:d,boundingVolume:p}}function zC(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function NC(e,t,n,i,r){var o=function(e){var t={};for(var n in e)t["{".concat(n,"}")]=e[n];return t}({level:t,x:n,y:i,z:r});return e.replace(/{level}|{x}|{y}|{z}/gi,(function(e){return o[e]}))}function UC(e){if(!e.contentUrl)return Dg;var t=e.contentUrl.split(".").pop();switch(t){case"pnts":return Lg;case"i3dm":case"b3dm":case"glb":case"gltf":return Fg;default:return t}}function GC(e){switch(e){case"REPLACE":case"replace":return Sg;case"ADD":case"add":return Mg;default:return e}}function jC(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=Vg,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=UC(e),e.refine=GC(e.refine),e}function WC(e){var t=e.basePath,n=jC(e.root,e),i=[];for(i.push(n);i.length>0;){var r,o=Fh((i.pop()||{}).children||[]);try{for(o.s();!(r=o.n()).done;){var a=r.value;jC(a,{basePath:t}),i.push(a)}}catch(e){o.e(e)}finally{o.f()}}return n}function qC(e){return JC.apply(this,arguments)}function JC(){return(JC=k(S.mark((function e(t){var n,i,r,o,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"],r=i.subdivisionScheme,o=i.maximumLevel,a=i.subtreeLevels,s=i.subtrees.uri,l=NC(s,0,0,0,0),c="".concat(n,"/").concat(l),e.next=9,Qf(c,LC);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:r,subtreeLevels:a,maximumLevel:o,refine:d,basePath:n,lodMetricType:Vg,rootLodMetricValue:p,rootBoundingVolume:f,getTileType:UC,getRefine:GC},e.next=17,YC(t.root,u,m);case 17:return e.abrupt("return",e.sent);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function YC(e,t,n){return ZC.apply(this,arguments)}function ZC(){return(ZC=k(S.mark((function e(t,n,i){var r,o,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=Vg,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,e.next=7,HC(n,i);case 7:return r=e.sent,o=r.children,(a=r.contentUrl)&&(t.contentUrl=a,t.content={uri:a.replace("".concat(i.basePath,"/"),"")}),t.refine=GC(t.refine),t.type=UC(t),t.children=o,t.id=t.contentUrl,e.abrupt("return",t);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var XC="3DTILES_implicit_tiling",KC={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:AA,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:function(e,t,n){return rx.apply(this,arguments)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function $C(e){return Jd(e.url)}function ex(e,t,n){return tx.apply(this,arguments)}function tx(){return(tx=k(S.mark((function e(t,n,i){var r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={content:{featureIds:null}},0,e.next=4,kC(t,0,n,i,r.content);case 4:return e.abrupt("return",r.content);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nx(e,t,n){return ix.apply(this,arguments)}function ix(){return(ix=k(S.mark((function e(t,n,i){var r,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=JSON.parse((new TextDecoder).decode(t))).loader=n.loader||KC,o.url=i.url,o.basePath=$C(o),!ox(o)){e.next=10;break}return e.next=7,qC(o);case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=WC(o);case 11:return o.root=e.t0,o.type=Og,o.lodMetricType=Vg,o.lodMetricValue=(null===(r=o.root)||void 0===r?void 0:r.lodMetricValue)||0,e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rx(){return(rx=k(S.mark((function e(t,n,i){var r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n["3d-tiles"]||{},!("auto"===r.isTileset?i.url&&-1!==i.url.indexOf(".json"):r.isTileset)){e.next=8;break}return e.next=5,nx(t,n,i);case 5:t=e.sent,e.next=11;break;case 8:return e.next=10,ex(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(XC))&&(null==e||null===(n=e.extensionsUsed)||void 0===n?void 0:n.includes(XC))}var ax="https://api.cesium.com/v1/assets";function sx(e,t){return lx.apply(this,arguments)}function lx(){return(lx=k(S.mark((function e(t,n){var i,r,o,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,cx(t);case 3:i=e.sent,r=Fh(i.items);try{for(r.s();!(o=r.n()).done;)"3DTILES"===(a=o.value).type&&(n=a.id)}catch(e){r.e(e)}finally{r.f()}case 6:return e.next=8,hx(t,n);case 8:return s=e.sent,l=s.type,c=s.url,zh("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 cx(e){return ux.apply(this,arguments)}function ux(){return(ux=k(S.mark((function e(t){var n,i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zh(t),ax,n={Authorization:"Bearer ".concat(t)},e.next=5,Ep("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 hx(e,t){return dx.apply(this,arguments)}function dx(){return(dx=k(S.mark((function e(t,n){var i,r,o,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zh(t,n),i={Authorization:"Bearer ".concat(t)},r="".concat(ax,"/").concat(n),e.next=5,Ep("".concat(r),{fetch:{headers:i}});case 5:if((o=e.sent).ok){e.next=8;break}throw new Error(o.statusText);case 8:return e.next=10,o.json();case 10:return a=e.sent,e.next=13,Ep("".concat(r,"/endpoint"),{fetch:{headers:i}});case 13:if((o=e.sent).ok){e.next=16;break}throw new Error(o.statusText);case 16:return e.next=18,o.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 px(){return(px=k(S.mark((function e(t){var n,i,r,o,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,r=n.assetId,Number.isFinite(r)||(o=t.match(/\/([0-9]+)\/tileset.json/),r=o&&o[1]),e.abrupt("return",sx(i,r));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var fx,mx=Hh(Hh({},KC),{},{id:"cesium-ion",name:"Cesium Ion",preload:function(e){return px.apply(this,arguments)},parse:(fx=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=mx,e.abrupt("return",KC.parse(t,n,i));case 4:case"end":return e.stop()}}),e)}))),function(e,t,n){return fx.apply(this,arguments)}),options:{"cesium-ion":Hh(Hh({},KC.options["3d-tiles"]),{},{accessToken:null})}});function vx(t){var n=64,i=document.createElement("canvas");i.width=n,i.height=n;var r=i.getContext("2d");r.rect(0,0,n,n);for(var o=r.createLinearGradient(0,0,n,n),a=0;a<t.length;a++){var s=t[a];o.addColorStop(s[0],"#"+s[1].getHexString())}r.fillStyle=o,r.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 gx(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 Ax(t){var n=new e.Group,i=new e.PlaneGeometry(10,5),r=V(e.Vector3,Q(t.projectPointOntoPlane([0,0,0]))),o=new e.Vector3(t.normal.x,t.normal.y,t.normal.z),a=(new e.Vector3).copy(r).add(o);i.lookAt(a),i.translate(r.x,r.y,r.z);var s=new e.MeshBasicMaterial({color:65535,side:e.DoubleSide}),l=new e.Mesh(i,s),c=new e.ArrowHelper(o,r,5,16776960);return n.add(c),n.add(l),n}function yx(t){var n=t.boundingVolume,i=0;t.content&&(i=Math.min(t.content.byteLength/5e5,1));var r=new e.Color(i,1,0),o=new e.BoxGeometry(1,1,1),a=new e.Matrix4;n.halfAxes?a.copy(Ex(n.halfAxes)):n.radius&&o.scale(2*n.radius,2*n.radius,2*n.radius),o.applyMatrix4(a);var s=new e.EdgesGeometry(o),l=new e.LineSegments(s,new e.LineBasicMaterial({color:r}));return l.position.copy(V(e.Vector3,Q(n.center))),l}function Ex(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 wx(t,n){var i=2*Math.PI*6378137/2,r=n*i/180,o=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return o=o*i/180,new e.Vector2(r,o)}var bx,Cx,xx,Ix={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"}(bx||(bx={})),function(e){e[e.FlatTexture=1]="FlatTexture",e[e.ShadedTexture=2]="ShadedTexture",e[e.ShadedNoTexture=3]="ShadedNoTexture"}(Cx||(Cx={})),function(e){e[e.Reset=1]="Reset",e[e.Mercator=2]="Mercator",e[e.WGS84Cartesian=3]="WGS84Cartesian"}(xx||(xx={}));var Tx="undefined"!=typeof document?vx(Ix.RAINBOW):null,Bx="undefined"!=typeof document?vx(Ix.GRAYSCALE):null,kx={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,maximumMemoryUsage:32,viewDistanceScale:1,skipLevelOfDetail:!1,updateTransforms:!0,shading:Cx.FlatTexture,transparent:!1,pointCloudColoring:bx.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,basisTranscoderPath:null,dracoDecoderPath:null,material:null,computeNormals:!1,shaderCallback:null,geoTransform:xx.Reset,preloadTilesCount:null,isLowestDepth:!1},Px=function(){function t(){o(this,t)}return u(t,null,[{key:"load",value:function(t){return _h(this,void 0,void 0,S.mark((function n(){var i,r,o,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,O,_,z,N,U,G,j,W,q,J=this;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(q=function(n,r,o,a){if(!F&&!i.pauseTilesetUpdate){if(!z||a.aspect!=O){var s=new gg({fov:a.fov/180*Math.PI,aspectRatio:a.aspect,near:a.near,far:a.far});z=s.sseDenominator,O=a.aspect,i.debug&&console.log("Updated sse denonimator:",z)}var l=gx(a).planes.map((function(e){return new og(e.normal.toArray(),e.constant)})),c=new cg(l),u=new e.Vector2;o.getSize(u);var h={camera:{position:i.isLowestDepth?[0,100,0]:_.toArray()},height:u.y,frameNumber:n._frameNumber,sseDenominator:z,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=Fh(n.tiles);try{for(p.s();!(d=p.n()).done;){var A=d.value;A.selected?r[A.id]?r[A.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",A.id):r[A.id]&&(r[A.id].visible=!1)}}catch(e){p.e(e)}finally{p.f()}for(;m.length>0;){var y=m.pop();r[y.id]&&y.contentState==Tg&&("4dkk"==i.type?v.removeTile(r[y.id]):v.remove(r[y.id]),Dx(r[y.id]),delete r[y.id]),f[y.id]&&(Dx(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}},W=function(){i.geoTransform!=xx.WGS84Cartesian&&(k.copy(P).invert(),k.premultiply(N),k.copy(N).multiply((new e.Matrix4).copy(P).invert()),B.modelMatrix=new _m(k.toArray()))},j=function(t){if(t.boundingVolume.halfAxes){var n=t.boundingVolume.halfAxes,i=(new e.Matrix4).extractRotation(Ex(n)).premultiply((new e.Matrix4).extractRotation(U));if(!(new e.Euler).setFromRotationMatrix(i).equals(new e.Euler)){M=!0;var r=new e.Vector3(P.elements[12],P.elements[13],P.elements[14]);P.extractRotation(i),P.setPosition(r),W()}}},i=Object.assign(Object.assign({},kx),t.options),r=t.url,o=i.updateInterval,a=2,s={},!i.cesiumIONToken){n.next=14;break}return s["cesium-ion"]={accessToken:i.cesiumIONToken},n.next=12,mx.preload(r,s);case 12:l=n.sent,s.fetch={headers:l.headers};case 14:return t.loadingManager&&t.loadingManager.itemStart(r),n.next=17,Qf(r,KC,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:Tx},grayscale:{type:"t",value:Bx},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 Oh,C=void 0,x=void 0,i.basisTranscoderPath&&((C=new xh).detectSupport(t.renderer),C.setTranscoderPath(i.basisTranscoderPath+"/"),C.setWorkerLimit(1),b.setKTX2Loader(C)),i.dracoDecoderPath&&((x=new Ja).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 _h(J,void 0,void 0,S.mark((function t(){var n,r,o;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=null,t.t0=e.type,t.next=t.t0===Lg?4:t.t0===Fg||t.t0===Qg?6:10;break;case 4:return n=Mx(e,y,i,U),t.abrupt("break",10);case 6:return t.next=8,Rx(b,e,I,i,U);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?(r=e.contentUrl.match(/floor_([0-9]+)./),e.floorIndex=r?parseInt(r[1]):0,v.addTile(e.floorIndex,n)):v.add(n),i.debug&&(o=yx(e),g.add(o),f[e.id]=o));case 11:case"end":return t.stop()}}),t)})))},onTileLoad:function(e){return _h(J,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&&j(e),B._frameNumber++,q(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 gA(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=xx.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=yx(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,H=o,O=null,_=new e.Vector3(1/0,1/0,1/0),z=null,v.updateMatrixWorld(!0),N=(new e.Matrix4).copy(v.matrixWorld),U=(new e.Matrix4).copy(N).invert(),j(B.root),W(),i.debug&&(f[B.root.id].applyMatrix4(k),g.matrixWorld.copy(v.matrixWorld)),i.geoTransform==xx.Mercator?(G=wx(B.cartographicCenter[1],B.cartographicCenter[0]),R.set(G.x,0,-G.y),v.position.copy(R),v.rotation.set(-Math.PI/2,0,0),v.updateMatrixWorld(!0)):i.geoTransform==xx.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++,q(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,Q(n)).applyMatrix4(k)},getCameraFrustum:function(t){var n,i=gx(t).planes.map((function(e){return new og(e.normal.toArray(),e.constant)})).map((function(e){return Ax(e)})),r=new e.Group,o=Fh(i);try{for(o.s();!(n=o.n()).done;){var a=n.value;r.add(a)}}catch(e){o.e(e)}finally{o.f()}return r},update:function(t,n,r,a){if(E=r,w=n,H+=a?9999:t,B&&H>=o){if(!N.equals(v.matrixWorld)){H=0,N.copy(v.matrixWorld),W();var s=(new e.Vector3).setFromMatrixPosition(N);A.rootCenter.value.copy(s),A.rootNormal.value.copy(new e.Vector3(0,0,1).applyMatrix4(N).normalize()),U.copy(N).invert(),i.debug&&(f[B.root.id].matrixWorld.copy(k),f[B.root.id].applyMatrix4(N))}H=0,B._frameNumber++,r.getWorldPosition(_),q(B,p,n,r)}},dispose:function(){for(F=!0,B._destroy();v.children.length>0;){var e=v.children[0];Dx(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++,q(B,p,w,E)},pauseTilesetUpdate:function(e){i.pauseTilesetUpdate=e,e||(B._frameNumber++,q(B,p,w,E))},limit2lowestDepth:function(e){i.isLowestDepth=!!e,E&&(B._frameNumber++,q(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 62:case"end":return n.stop()}}),n)})))}}]),t}();function Rx(t,n,i,r,o){return _h(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(o);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],o=[];t.traverse((function(e){"Mesh"==e.type&&o.push(e)})),t.clear(),o.forEach((function(e){var o=e.material,a=o.map;if(r.material?(e.material=r.material.clone(),o.dispose()):r.shading==Cx.FlatTexture&&(e.material=i.clone(),o.dispose()),r.shading!=Cx.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:a}:e.material.map=a:(a&&a.dispose(),e.material.map=null),r.shaderCallback&&(e.onBeforeRender=r.shaderCallback),e.material.wireframe=r.wireframe,r.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 Ku({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 Mx(t,n,i,r){var o={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&&(o.rgb=a.value),a&&4===a.size&&(o.rgba=a.value);var s=new e.BufferGeometry;s.setAttribute("position",new e.Float32BufferAttribute(o.points,3));var l=(new e.Matrix4).fromArray(t.computedTransform).premultiply(r);o.rgba?s.setAttribute("color",new e.Float32BufferAttribute(o.rgba,4)):o.rgb&&s.setAttribute("color",new e.Uint8BufferAttribute(o.rgb,3,!0)),o.intensities&&s.setAttribute("intensity",new e.BufferAttribute(o.intensities,1,!0)),o.classifications&&s.setAttribute("classification",new e.Uint8BufferAttribute(o.classifications,1,!1));var c=new e.Points(s,i.material||n);if(o.rtc_center){var u=o.rtc_center;l.multiply((new e.Matrix4).makeTranslation(u[0],u[1],u[2]))}return c.applyMatrix4(l),c}function Sx(e){var t,n,i,r;(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===(r=e.map)||void 0===r||r.dispose()),e.dispose()}function Dx(e){e.traverse((function(e){if(e.isMesh)if(e.geometry.dispose(),e.material.isMaterial)Sx(e.material);else{var t,n=Fh(e.material);try{for(n.s();!(t=n.n()).done;){Sx(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 Fx=ae(),Lx=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 Qx(e,t){for(var n=Object.create(null),i=e.split(","),r=0;r<i.length;r++)n[i[r]]=!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 Fx+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=Zu.decompressModeldata(e);"ajk"==n.dataSync&&i.$app.DataSYNC.use("DataAJK",{sweepLocations:t});var r=$u.visionModeldata(t);nt.timeEnd("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid)),i.$app.core.get("Player").model.panos=$u.panos(i.$app,r,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=Zu.decompressModeldata(e),r=$u.visionModeldata(n);nt.timeEnd("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid)),$u.panosAssist(r,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,r,o=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,Px.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,r=i.runtime,t.model._3dTilesRuntime=r,n.autoUpdate3dTiles=!0,r.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))}o.$app.Scene.emit("3dTilesLoaded"),t.model._3dTilesRuntime.pauseTilesetUpdate(!1),t.model._3dTilesRuntime.pauseTilesetUpdate(!0),nt.timeEnd("".concat(o.$app.config.num,"[load modelmesh]").concat(o.$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,r=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 Ku({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=eh.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(r.$app.config.num,"[parse dam]").concat(r.$app.uid));var t=Zu.decompressMesh(e),n=$u.convertProtobufToSceneObject(r.$app,t);nt.timeEnd("".concat(r.$app.config.num,"[parse dam]").concat(r.$app.uid)),i(n,r.$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,th.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=Lx(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,r=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 r.$app.core.get("Player").model.panos.index[e]})):e.visiblePanos=r.$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("data:image")||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,Ox=Object.assign,Vx=Object.prototype.hasOwnProperty,_x=function(e,t){return Vx.call(e,t)},zx=Array.isArray,Nx=function(e){return"[object Map]"===Wx(e)},Ux=function(e){return"symbol"==typeof e},Gx=function(e){return null!==e&&"object"==typeof e},jx=Object.prototype.toString,Wx=function(e){return jx.call(e)},qx=function(e){return"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e},Jx=function(e,t){return!Object.is(e,t)};function Yx(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 Zx(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 Zx(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Zx(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 Xx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hx;t&&t.active&&t.effects.push(e)}var Kx,$x=function(e){var t=new Set(e);return t.w=0,t.n=0,t},eI=function(e){return(e.w&rI)>0},tI=function(e){return(e.n&rI)>0},nI=new WeakMap,iI=0,rI=1,oI=Symbol(""),aI=Symbol(""),sI=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,Xx(this,i)}return u(e,[{key:"run",value:function(){if(!this.active)return this.fn();for(var e=Kx,t=uI;e;){if(e===this)return;e=e.parent}try{return this.parent=Kx,Kx=this,uI=!0,rI=1<<++iI,iI<=30?function(e){var t=e.deps;if(t.length)for(var n=0;n<t.length;n++)t[n].w|=rI}(this):lI(this),this.fn()}finally{iI<=30&&function(e){var t=e.deps;if(t.length){for(var n=0,i=0;i<t.length;i++){var r=t[i];eI(r)&&!tI(r)?r.delete(e):t[n++]=r,r.w&=~rI,r.n&=~rI}t.length=n}}(this),rI=1<<--iI,Kx=this.parent,uI=t,this.parent=void 0}}},{key:"stop",value:function(){this.active&&(lI(this),this.onStop&&this.onStop(),this.active=!1)}}]),e}();function lI(e){var t=e.deps;if(t.length){for(var n=0;n<t.length;n++)t[n].delete(e);t.length=0}}function cI(e){e.effect.stop()}var uI=!0,hI=[];function dI(){hI.push(uI),uI=!1}function pI(){var e=hI.pop();uI=void 0===e||e}function fI(e,t,n){if(uI&&Kx){var i=nI.get(e);i||nI.set(e,i=new Map);var r=i.get(n);r||i.set(n,r=$x()),function(e,t){var n=!1;iI<=30?tI(e)||(e.n|=rI,n=!eI(e)):n=!e.has(Kx);n&&(e.add(Kx),Kx.deps.push(e))}(r)}}function mI(e,t,n,i,r,o){var a=nI.get(e);if(a){var s=[];if("clear"===t)s=Q(a.values());else if("length"===n&&zx(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":zx(e)?qx(n)&&s.push(a.get("length")):(s.push(a.get(oI)),Nx(e)&&s.push(a.get(aI)));break;case"delete":zx(e)||(s.push(a.get(oI)),Nx(e)&&s.push(a.get(aI)));break;case"set":Nx(e)&&s.push(a.get(oI))}if(1===s.length)s[0]&&vI(s[0]);else{var l,c=[],u=Yx(s);try{for(u.s();!(l=u.n()).done;){var h=l.value;h&&c.push.apply(c,Q(h))}}catch(e){u.e(e)}finally{u.f()}vI($x(c))}}}function vI(e,t){var n,i=Yx(zx(e)?e:Q(e));try{for(i.s();!(n=i.n()).done;){var r=n.value;(r!==Kx||r.allowRecurse)&&(r.scheduler?r.scheduler():r.run())}}catch(e){i.e(e)}finally{i.f()}}var gI=Qx("__proto__,__v_isRef,__isVue"),AI=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter(Ux)),yI=CI(),EI=CI(!0),wI=bI();function bI(){var e={};return["includes","indexOf","lastIndexOf"].forEach((function(t){e[t]=function(){for(var e=rT(this),n=0,i=this.length;n<i;n++)fI(e,0,n+"");for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var s=e[t].apply(e,o);return-1===s||!1===s?e[t].apply(e,Q(o.map(rT))):s}})),["push","pop","shift","unshift","splice"].forEach((function(t){e[t]=function(){dI();for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=rT(this)[t].apply(this,n);return pI(),r}})),e}function CI(){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,r){if("__v_isReactive"===i)return!e;if("__v_isReadonly"===i)return e;if("__v_isShallow"===i)return t;if("__v_raw"===i&&r===(e?t?XI:ZI:t?YI:JI).get(n))return n;var o=zx(n);if(!e&&o&&_x(wI,i))return Reflect.get(wI,i,r);var a=Reflect.get(n,i,r);return(Ux(i)?AI.has(i):gI(i))?a:(e||fI(n,0,i),t?a:sT(a)?!o||!qx(i)?a.value:a:Gx(a)?e?eT(a):$I(a):a)}}function xI(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,n,i,r){var o=t[n];if(nT(o)&&sT(o)&&!sT(i))return!1;if(!e&&!nT(i)&&(iT(i)||(i=rT(i),o=rT(o)),!zx(t)&&sT(o)&&!sT(i)))return o.value=i,!0;var a=zx(t)&&qx(n)?Number(n)<t.length:_x(t,n),s=Reflect.set(t,n,i,r);return t===rT(r)&&(a?Jx(i,o)&&mI(t,"set",n,i):mI(t,"add",n,i)),s}}var II={get:yI,set:xI(),deleteProperty:function(e,t){var n=_x(e,t);e[t];var i=Reflect.deleteProperty(e,t);return i&&n&&mI(e,"delete",t,void 0),i},has:function(e,t){var n=Reflect.has(e,t);return Ux(t)&&AI.has(t)||fI(e,0,t),n},ownKeys:function(e){return fI(e,0,zx(e)?"length":oI),Reflect.ownKeys(e)}},TI={get:EI,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},BI=function(e){return e},kI=function(e){return Reflect.getPrototypeOf(e)};function PI(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=rT(e=e.__v_raw),o=rT(t);t!==o&&!n&&fI(r,0,t),!n&&fI(r,0,o);var a=kI(r),s=a.has,l=i?BI:n?aT:oT;return s.call(r,t)?l(e.get(t)):s.call(r,o)?l(e.get(o)):void(e!==r&&e.get(t))}function RI(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.__v_raw,i=rT(n),r=rT(e);return e!==r&&!t&&fI(i,0,e),!t&&fI(i,0,r),e===r?n.has(e):n.has(e)||n.has(r)}function MI(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.__v_raw,!t&&fI(rT(e),0,oI),Reflect.get(e,"size",e)}function SI(e){e=rT(e);var t=rT(this);return kI(t).has.call(t,e)||(t.add(e),mI(t,"add",e,e)),this}function DI(e,t){t=rT(t);var n=rT(this),i=kI(n),r=i.has,o=i.get,a=r.call(n,e);a||(e=rT(e),a=r.call(n,e));var s=o.call(n,e);return n.set(e,t),a?Jx(t,s)&&mI(n,"set",e,t):mI(n,"add",e,t),this}function FI(e){var t=rT(this),n=kI(t),i=n.has,r=n.get,o=i.call(t,e);o||(e=rT(e),o=i.call(t,e)),r&&r.call(t,e);var a=t.delete(e);return o&&mI(t,"delete",e,void 0),a}function LI(){var e=rT(this),t=0!==e.size,n=e.clear();return t&&mI(e,"clear",void 0,void 0),n}function QI(e,t){return function(n,i){var r=this,o=r.__v_raw,a=rT(o),s=t?BI:e?aT:oT;return!e&&fI(a,0,oI),o.forEach((function(e,t){return n.call(i,s(e),s(t),r)}))}}function HI(e,t,n){return function(){var i=this.__v_raw,r=rT(i),o=Nx(r),a="entries"===e||e===Symbol.iterator&&o,s="keys"===e&&o,l=i[e].apply(i,arguments),c=n?BI:t?aT:oT;return!t&&fI(r,0,s?aI: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 OI(e){return function(){return"delete"!==e&&this}}function VI(){var e={get(e){return PI(this,e)},get size(){return MI(this)},has:RI,add:SI,set:DI,delete:FI,clear:LI,forEach:QI(!1,!1)},t={get(e){return PI(this,e,!1,!0)},get size(){return MI(this)},has:RI,add:SI,set:DI,delete:FI,clear:LI,forEach:QI(!1,!0)},n={get(e){return PI(this,e,!0)},get size(){return MI(this,!0)},has(e){return RI.call(this,e,!0)},add:OI("add"),set:OI("set"),delete:OI("delete"),clear:OI("clear"),forEach:QI(!0,!1)},i={get(e){return PI(this,e,!0,!0)},get size(){return MI(this,!0)},has(e){return RI.call(this,e,!0)},add:OI("add"),set:OI("set"),delete:OI("delete"),clear:OI("clear"),forEach:QI(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((function(r){e[r]=HI(r,!1,!1),n[r]=HI(r,!0,!1),t[r]=HI(r,!1,!0),i[r]=HI(r,!0,!0)})),[e,n,t,i]}var _I=ce(VI(),4),zI=_I[0],NI=_I[1],UI=_I[2],GI=_I[3];function jI(e,t){var n=t?e?GI:UI:e?NI:zI;return function(t,i,r){return"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(_x(n,i)&&i in t?n:t,i,r)}}var WI={get:jI(!1,!1)},qI={get:jI(!0,!1)},JI=new WeakMap,YI=new WeakMap,ZI=new WeakMap,XI=new WeakMap;function KI(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 Wx(e).slice(8,-1)}(e))}function $I(e){return nT(e)?e:tT(e,!1,II,WI,JI)}function eT(e){return tT(e,!0,TI,qI,ZI)}function tT(e,t,n,i,r){if(!Gx(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;var o=r.get(e);if(o)return o;var a=KI(e);if(0===a)return e;var s=new Proxy(e,2===a?i:n);return r.set(e,s),s}function nT(e){return!(!e||!e.__v_isReadonly)}function iT(e){return!(!e||!e.__v_isShallow)}function rT(e){var t=e&&e.__v_raw;return t?rT(t):e}var oT=function(e){return Gx(e)?$I(e):e},aT=function(e){return Gx(e)?eT(e):e};function sT(e){return!(!e||!0!==e.__v_isRef)}function lT(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 cT(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 cT(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function cT(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 uT=!1,hT=[],dT=Promise.resolve(),pT=function(e){return dT.then(e)},fT=function(e){hT.includes(e)||hT.push(e),uT||(uT=!0,pT(mT))},mT=function(){var e,t=lT(hT);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}hT.length=0,uT=!1};function vT(e){if(CT(e)){for(var t={},n=0;n<e.length;n++){var i=e[n],r=IT(i)?yT(i):vT(i);if(r)for(var o in r)t[o]=r[o]}return t}return IT(e)||TT(e)?e:void 0}var gT=/;(?![^(]*\))/g,AT=/:(.+)/;function yT(e){var t={};return e.split(gT).forEach((function(e){if(e){var n=e.split(AT);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function ET(e){var t="";if(IT(e))t=e;else if(CT(e))for(var n=0;n<e.length;n++){var i=ET(e[n]);i&&(t+=i+" ")}else if(TT(e))for(var r in e)e[r]&&(t+=r+" ");return t.trim()}function wT(e,t){if(e===t)return!0;var n=xT(e),i=xT(t);if(n||i)return!(!n||!i)&&e.getTime()===t.getTime();if(n=CT(e),i=CT(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=wT(e[i],t[i]);return n}(e,t);if(n=TT(e),i=TT(t),n||i){if(!n||!i)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e){var o=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(o&&!a||!o&&a||!wT(e[r],t[r]))return!1}}return String(e)===String(t)}function bT(e,t){return e.findIndex((function(e){return wT(e,t)}))}var CT=Array.isArray,xT=function(e){return e instanceof Date},IT=function(e){return"string"==typeof e},TT=function(e){return null!==e&&"object"==typeof e},BT=function(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}},kT=/-(\w)/g,PT=BT((function(e){return e.replace(kT,(function(e,t){return t?t.toUpperCase():""}))})),RT=/\B([A-Z])/g,MT=BT((function(e){return e.replace(RT,"-$1").toLowerCase()})),ST=function(e){var t=parseFloat(e);return isNaN(t)?e:t},DT=/^(spellcheck|draggable|form|list|type)$/,FT=function(e){var t,n=e.el,i=e.get,r=e.effect,o=e.arg,a=e.modifiers;"class"===o&&(n._class=n.className),r((function(){var e=i();if(o)(null==a?void 0:a.camel)&&(o=PT(o)),LT(n,o,e,t);else{for(var r in e)LT(n,r,e[r],t&&t[r]);for(var s in t)e&&s in e||LT(n,s,null)}t=e}))},LT=function(e,t,n,i){if("class"===t)e.setAttribute("class",ET(e._class?[e._class,n]:n)||"");else if("style"===t){n=vT(n);var r=e.style;if(n)if(IT(n))n!==i&&(r.cssText=n);else{for(var o in n)HT(r,o,n[o]);if(i&&!IT(i))for(var a in i)null==n[a]&&HT(r,a,"")}else e.removeAttribute("style")}else e instanceof SVGElement||!(t in e)||DT.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))},QT=/\s*!important$/,HT=function e(t,n,i){CT(i)?i.forEach((function(i){return e(t,n,i)})):n.startsWith("--")?t.setProperty(n,i):QT.test(i)?t.setProperty(MT(n),i.replace(QT,""),"important"):t[n]=i},OT=function(e,t){var n=e.getAttribute(t);return null!=n&&e.removeAttribute(t),n},VT=function(e,t,n,i){e.addEventListener(t,n,i)},_T=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,zT=["ctrl","shift","alt","meta"],NT={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 zT.some((function(n){return e["".concat(n,"Key")]&&!t[n]}))}},UT=function(e){var t=e.el,n=e.get,i=e.exp,r=e.arg,o=e.modifiers;if(r){var a=_T.test(i)?n("(e => ".concat(i,"(e))")):n("($event => { ".concat(i," })"));if("vue:mounted"!==r){if("vue:unmounted"===r)return function(){return a()};if(o){"click"===r&&(o.right&&(r="contextmenu"),o.middle&&(r="mouseup"));var s=a;a=function(e){if(!("key"in e)||MT(e.key)in o){for(var t in o){var n=NT[t];if(n&&n(e,o))return}return s(e)}}}VT(t,r,a,o)}else pT(a)}},GT=function(e){var t=e.el,n=e.get;(0,e.effect)((function(){t.textContent=jT(n())}))},jT=function(e){return null==e?"":TT(e)?JSON.stringify(e,null,2):String(e)},WT=function(e){return"_value"in e?e._value:e.value},qT=function(e,t){var n=t?"_trueValue":"_falseValue";return n in e?e[n]:t},JT=function(e){e.target.composing=!0},YT=function(e){var t=e.target;t.composing&&(t.composing=!1,ZT(t,"input"))},ZT=function(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)},XT=Object.create(null),KT=function(e,t,n){return $T(e,"return(".concat(t,")"),n)},$T=function(e,t,n){var i=XT[t]||(XT[t]=eB(t));try{return i(e,n)}catch(e){console.error(e)}},eB=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(){}}},tB={bind:FT,on:UT,show:function(e){var t=e.el,n=e.get,i=e.effect,r=t.style.display;i((function(){t.style.display=n()?r:"none"}))},text:GT,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,r=e.effect,o=e.modifiers,a=t.type,s=i("(val) => { ".concat(n," = val }")),l=o||{},c=l.trim,u=l.number,h=void 0===u?"number"===a:u;if("SELECT"===t.tagName){var d=t;VT(t,"change",(function(){var e=Array.prototype.filter.call(d.options,(function(e){return e.selected})).map((function(e){return h?ST(WT(e)):WT(e)}));s(d.multiple?e:e[0])})),r((function(){for(var e=i(),t=d.multiple,n=0,r=d.options.length;n<r;n++){var o=d.options[n],a=WT(o);if(t)CT(e)?o.selected=bT(e,a)>-1:o.selected=e.has(a);else if(wT(WT(o),e))return void(d.selectedIndex!==n&&(d.selectedIndex=n))}t||-1===d.selectedIndex||(d.selectedIndex=-1)}))}else if("checkbox"===a){var p;VT(t,"change",(function(){var e=i(),n=t.checked;if(CT(e)){var r=WT(t),o=bT(e,r),a=-1!==o;if(n&&!a)s(e.concat(r));else if(!n&&a){var l=Q(e);l.splice(o,1),s(l)}}else s(qT(t,n))})),r((function(){var e=i();CT(e)?t.checked=bT(e,WT(t))>-1:e!==p&&(t.checked=wT(e,qT(t,!0))),p=e}))}else if("radio"===a){VT(t,"change",(function(){s(WT(t))})),r((function(){var e=i();undefined!==e&&(t.checked=wT(e,WT(t)))}))}else{var f=function(e){return c?e.trim():h?ST(e):e};VT(t,"compositionstart",JT),VT(t,"compositionend",YT),VT(t,(null==o?void 0:o.lazy)?"change":"input",(function(){t.composing||s(f(t.value))})),c&&VT(t,"change",(function(){t.value=t.value.trim()})),r((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,r=e.effect;pT((function(){return r((function(){return $T(n.scope,i,t)}))}))}},nB=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,iB=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,rB=/^\(|\)$/g,oB=/^[{[]\s*((?:[\w_$]+\s*,?\s*)+)[\]}]$/,aB=function(e,t,n){var i=t.match(nB);if(i){var r=e.nextSibling,o=e.parentElement,a=new Text("");o.insertBefore(a,e),o.removeChild(e);var s,l,c,u,h=i[2].trim(),d=i[1].trim().replace(rB,"").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(iB))&&(d=d.replace(iB,"").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,r){var o={};s?s.forEach((function(e,n){return o[e]=t[p?n:e]})):o[d]=t,r?(l&&(o[l]=r),c&&(o[c]=i)):l&&(o[l]=i);var a=gB(n,o),u=m?KT(a.scope,m):i;return e.set(u,i),a.key=u,a},w=function(t,n){var i=new yB(e,t);return i.key=t.key,i.insert(o,n),i};return n.effect((function(){var e=KT(n.scope,h),t=A,i=ce(function(e){var t=new Map,n=[];if(CT(e))for(var i=0;i<e.length;i++)n.push(E(t,e[i],i));else if("number"==typeof e)for(var r=0;r<e;r++)n.push(E(t,r+1,r));else if(TT(e)){var o=0;for(var a in e)n.push(E(t,e[a],o++,a))}return[n,t]}(e),2);if(g=i[0],A=i[1],y){for(var r=0;r<v.length;r++)A.has(v[r].key)||v[r].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(o,s?s.el:a)))),c.unshift(s=f)}v=c}else v=g.map((function(e){return w(e,a)})),y=!0})),r}},sB=function(e){var t,n=e.el,i=e.ctx.scope.$refs,r=e.get;return(0,e.effect)((function(){var e=r();i[e]=n,t&&e!==t&&delete i[t],t=e})),function(){t&&delete i[t]}},lB=/^(?:v-|:|@)/,cB=/\.([\w-]+)/g,uB=!1,hB=function(e,t){var n=e.nodeType;if(1===n){var i,r=e;if(r.hasAttribute("v-pre"))return;if(OT(r,"v-cloak"),i=OT(r,"v-if"))return function(e,t,n){var i=e.parentElement,r=new Comment("v-if");i.insertBefore(r,e);for(var o,a,s=[{exp:t,el:e}];(o=e.nextElementSibling)&&(a=null,""===OT(o,"v-else")||(a=OT(o,"v-else-if")));)i.removeChild(o),s.push({exp:a,el:o});var l,c=e.nextSibling;i.removeChild(e);var u=-1,h=function(){l&&(i.insertBefore(r,l.el),l.remove(),l=void 0)};return n.effect((function(){for(var e=0;e<s.length;e++){var t=s[e],o=t.exp,a=t.el;if(!o||KT(n.scope,o))return void(e!==u&&(h(),(l=new yB(a,n)).insert(i,r),i.removeChild(r),u=e))}u=-1,h()})),c}(r,i,t);if(i=OT(r,"v-for"))return aB(r,i,t);if((i=OT(r,"v-scope"))||""===i){var o=i?KT(t.scope,i):{};t=gB(t,o),o.$template&&mB(r,o.$template)}var a=null!=OT(r,"v-once");a&&(uB=!0),(i=OT(r,"ref"))&&fB(r,sB,'"'.concat(i,'"'),t),dB(r,t);for(var s=[],l=0,c=Q(r.attributes);l<c.length;l++){var u=c[l],h=u.name,d=u.value;lB.test(h)&&"v-cloak"!==h&&("v-model"===h?s.unshift([h,d]):"@"===h[0]||/^v-on\b/.test(h)?s.push([h,d]):pB(r,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];pB(r,v,g,t)}a&&(uB=!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))),fB(e,GT,E.join("+"),t)}}else 11===n&&dB(e,t)},dB=function(e,t){for(var n=e.firstChild;n;)n=hB(n,t)||n.nextSibling},pB=function(e,t,n,i){var r,o,a;if(":"===(t=t.replace(cB,(function(e,t){return(a||(a={}))[t]=!0,""})))[0])r=FT,o=t.slice(1);else if("@"===t[0])r=UT,o=t.slice(1);else{var s=t.indexOf(":"),l=s>0?t.slice(2,s):t.slice(2);r=tB[l]||i.dirs[l],o=s>0?t.slice(s+1):void 0}r&&(r===FT&&"ref"===o&&(r=sB),fB(e,r,n,i,o,a),e.removeAttribute(t))},fB=function(e,t,n,i,r,o){var a=t({el:e,get:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n;return KT(i.scope,t,e)},effect:i.effect,ctx:i,exp:n,arg:r,modifiers:o});a&&i.cleanups.push(a)},mB=function(e,t){if("#"!==t[0])e.innerHTML=t;else{var n=document.querySelector(t);e.appendChild(n.content.cloneNode(!0))}},vB=function(e){var t=Object.assign(Object.assign({delimiters:["{{","}}"],delimitersRE:/\{\{([^]+?)\}\}/g},e),{scope:e?e.scope:$I({}),dirs:e?e.dirs:{},effects:[],blocks:[],cleanups:[],effect:function(e){if(uB)return fT(e),e;var n=function(e,t){e.effect&&(e=e.effect.fn);var n=new sI(e);t&&(Ox(n,t),t.scope&&Xx(n,t.scope)),t&&t.lazy||n.run();var i=n.run.bind(n);return i.effect=n,i}(e,{scheduler:function(){return fT(n)}});return t.effects.push(n),n}});return t},gB=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 r=$I(new Proxy(i,{set:(e,t,i,o)=>o!==r||e.hasOwnProperty(t)?Reflect.set(e,t,i,o):Reflect.set(n,t,i)}));return AB(r),Object.assign(Object.assign({},e),{scope:r})},AB=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))}},yB=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=vB(n)),hB(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(cI),this.ctx.cleanups.forEach((function(e){return e()}))}}]),e}(),EB=function(e){return e.replace(/[-.*+?^${}()|[\]\/\\]/g,"\\$&")},wB=function(e){var t,n=vB();if(e&&(n.scope=$I(e),AB(n.scope),e.$delimiters)){var i=ce(n.delimiters=e.$delimiters,2),r=i[0],o=i[1];n.delimitersRE=new RegExp(EB(r)+"([^]+?)"+EB(o),"g")}return n.scope.$s=jT,n.scope.$nextTick=pT,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]:Q(e.querySelectorAll("[v-scope]")).filter((function(e){return!e.matches("[v-scope] [v-scope]")}))).length||(i=[e]),t=i.map((function(e){return new yB(e,n,!0)})),this},unmount(){t.forEach((function(e){return e.teardown()}))}}},bB=document.currentScript;bB&&bB.hasAttribute("init")&&wB().mount();var CB=Object.freeze({__proto__:null,createApp:wB,nextTick:pT,reactive:$I}),xB=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),r=i.length,o=new Uint8Array(r);r--;)o[r]=i.charCodeAt(r);return new Blob([o],{type:n})};function IB(e,t){return new File([e],t,{type:e.type})}function TB(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 BB=Object.freeze({__proto__:null,base64ToBlob:xB,convertBlob2File:IB,download:TB,downloadFromURL:function(e,t){return new Promise(function(){var n=k(S.mark((function n(i,r){var o,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",r("url or name is null"));case 2:if(!(e instanceof Blob)){n.next=7;break}TB(e,t),i(!0),n.next=19;break;case 7:if(0!==e.indexOf("data:")){n.next=12;break}TB(xB(e),t),i(!0),n.next=19;break;case 12:return n.next=14,fetch(e);case 14:return o=n.sent,n.next=17,o.blob();case 17:(a=n.sent)?(TB(a,t),i(!0)):r(!1);case 19:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}())}});function kB(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var PB,RB=new THREE.Vector3,MB=new THREE.Vector3,SB=new THREE.Vector3,DB=new THREE.Quaternion,FB=new THREE.Quaternion,LB=new THREE.Color(1,1,1),QB=new THREE.Color(2,2,2),HB=function(e){f(n,THREE.PerspectiveCamera);var t=kB(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(RB.set(0,0,-1),THREE.MathUtils.degToRad(e))}},{key:"yaw",get:function(){var e=RB.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion).setY(0),t=MB.set(0,0,1),n=SB.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=RB.set(0,1,0),i=MB.set(1,0,0),r=DB.setFromAxisAngle(n,THREE.MathUtils.degToRad(e)),o=FB.setFromAxisAngle(i,THREE.MathUtils.degToRad(t));this.quaternion.multiplyQuaternions(r,o),this.updateTarget()}},{key:"pitch",get:function(){var e=RB.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion),t=MB.copy(e).projectOnPlane(SB.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=RB.set(0,1,0),i=MB.set(1,0,0),r=DB.setFromAxisAngle(n,THREE.MathUtils.degToRad(t)),o=FB.setFromAxisAngle(i,THREE.MathUtils.degToRad(e));this.quaternion.multiplyQuaternions(r,o),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 r=[],o=[];r.push(-t,e,-this.cylinderNear),r.push(t,e,-this.cylinderNear),r.push(t,-e,-this.cylinderNear),r.push(-t,-e,-this.cylinderNear),o.push(-i,n,-this.cylinderFar),o.push(i,n,-this.cylinderFar),o.push(i,-n,-this.cylinderFar),o.push(-i,-n,-this.cylinderFar),r=r.concat(o);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(r),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),PB)this.tag=PB.clone(),this.obj3d.add(this.tag);else{var e=this;Ka($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),PB=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=Ue):(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 r=this.player.cameraControls.activeControl;pe.start(It.property(n.camera,"fov",this.fov,(function(e){n.camera.staticFov=e})),1e3),pe.start(It.vector(r.target,this.target),1e3,null,0,de[Je.flydown.rotationEasing],null,Je.freeze.LookRotationForPlay),pe.start(It.vector(r.camera.position,e||this.position),1e3,(function(){t.player.mode==ht.DOLLHOUSE&&(t.showVideo(!0),t.tag.material.color.copy(QB),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(QB),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(LB);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?QB:LB),100,null,null,null,null,"cameraHighlight"+this.sid))}}]),n}(),OB=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,r=arguments.length>3?arguments[3]:void 0;this.cameras.forEach((function(o){null!=e&&t.player.model.panos.get(o.panoId).floorIndex!==e||Ae.updateVisible(o,n,!1,i,r)}))}},{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,r=arguments.length>3?arguments[3]:void 0;this.isFloorplan||this.cameras.forEach((function(o){null!=e&&t.player.model.panos.get(o.panoId).floorIndex!==e||Ae.updateVisible(o,n,!0,i,r)}))}},{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,Q(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(Uo,(function(){e.isEdit||e.stopWatch()})),this.player.on(No,(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&&!0===this.hoverCamera.visible&&(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 VB(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var _B=function(e){f(n,THREE.Group);var t=VB(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=Qe,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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var NB=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 OB(e);var t=!r.app.config.view&&!r.app.config.mobile,n=Ce.detectAndroidMobile();r.videoPlayer=n?new UB(e):new GB(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 _B(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}(),UB=function(e){f(n,e);var t=zB(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(ss),GB=function(e){f(n,e);var t=zB(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(hs);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var WB=function(e){f(n,e);var t=jB(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,r=(i.state.options.padding.left||0)+(i.state.options.padding.right||0),o=t+n,a=window.innerWidth-r,s=window.innerHeight-o;if(a/s<i.state.scale){var l=a/i.state.scale;e.style.height="".concat(l,"px"),e.style.top=(s-l)/2+o+"px"}else e.style.top="".concat(o,"px"),e.style.height="calc(100% - ".concat(o,"px)")},i.__on_update=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hasChanged,n=void 0!==t&&t,r=arguments.length>1?arguments[1]:void 0;if(i.__is_enter&&(i.player.lastFrameChanged||r)){var o=i.player.cameraControls.activeControl;if("dollhouse"==i.player.mode){var a=o.camera.position.distanceTo(o.target),s=he.linearClamp(a,o.minDistance,Math.max(o.maxDistance/2,o.minDistance+3),i.state.range.max,i.state.range.min);i.emit("zoom",s)}else if("floorplan"==i.player.mode&&n.cameraProjectionChanged){var l=o.getDefaultAbsoluteScale(i.player.model.size),c=Math.max(Je.zoomNearLimit,.5*l),u=Math.min(Je.zoomFarLimit,2.5*l),h=he.linearClamp(o.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,Je.zoom.max=this.state.defaults.zoomMax=Je.zoom.max,Je.zoom.min=this.state.defaults.zoomMin=Je.zoom.min,Je.zoom.enabled=this.state.defaults.zoomEnabled=Je.zoom.enabled,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 r=t.getDefaultAbsoluteScale(this.player.model.size),o=Math.max(Je.zoomNearLimit,.5*r),a=Math.min(Je.zoomFarLimit,2.5*r);t.absoluteScale=he.linearClamp(n,this.state.range.min,this.state.range.max,a,o)}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(),r=new THREE.Vector3(0,0,-1).applyQuaternion(e.player.quaternion),o=e.player.cameraControls.activeControl.camera,a=o.fov,s=na.getHFOVForCamera(o,o.aspect,1);e.player.currentPano.loadTiledPano(i,r,{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,r,o,a;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=t.getViewSize(),r=i.width,o=i.height,n.next=3,t.app.Camera.screenshot([{width:r,height:o,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}(mr);function qB(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var JB=function(e){f(n,e);var t=qB(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(Uo,(function(e){i.emit(Uo,e)})),e.on(Wo,(function(e){i.emit(Wo,e)})),e.on(qo,(function(e){i.emit(qo,e)})),e.on(Ho,(function(e){i.emit(Ho,e)})),e.on(Vo,(function(e){i.emit(Vo,e)})),e.on(Oo,(function(e){i.emit(Oo,e)})),e.on(_o,(function(e){i.emit(_o,e)})),e.on(No,(function(e,t){return i.emit(No,{fromMode:e,toMode:t})}));var t=i.app.core.get("Player").model;t.on("floor.changed",(function(e,n,r){i.emit("floor.changed",{toMode:n,floorIndex:e.floorIndex,allVisible:t.allFloorsVisible})}))})),i.monitor=new NB(e),i.extract=new WB(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 r=t.cameraControls.controls[e.mode],o=r.camera;e.target&&r.target.copy(e.target),e.position&&o.position.copy(e.position),r.offset.copy(o.position).sub(r.target),"floorplan"==e.mode&&(e.zoom&&(e.currentScale=$e.convertWorkshopOrthoZoom(e.zoom)),e.currentScale&&(r.currentScale=r.absoluteScale=e.currentScale,r.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(r){var o=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:xB(e),name:t,type:"blob"}):a.push({data:e,name:t,type:"base64"}),a.length==o&&(a.name=t,a.o=i,r(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 su.isSupportXR()}}]),n}(mr);function YB(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}JB.MODE=ht;var ZB=function(e){f(n,e);var t=YB(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 gl(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}(mr);function XB(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var KB,$B,ek,tk,nk,ik,rk,ok=new THREE.Box3,ak=new THREE.Raycaster,sk=new THREE.Plane,lk=0,ck=[],uk={cabinet:{widthNormal:{min:.55,max:.65},height:{min:.3,max:2.5,standard:2},closeRatio:.7},fire:{widthNormal:{min:.12,max:.16},height:{min:.4,max:.58},widthSame:!0,closeRatio:4,tinyXZ:!0},air:{widthNormal:{min:.35,max:.7},width:{min:.48,max:.75},thick:{min:.33,max:.5},height:{min:1.2,max:2.2,standard:1.8},atWall:.8,closeRatio:1.1},airSmart:{widthNormal:{min:.35,max:.7},width:{min:.48,max:.75},thick:{min:.33,max:.5},height:{min:1.2,max:2.2,standard:1.8},atWall:.8,closeRatio:1.1},"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,closeRatio:1.5},battery:{widthNormal:{min:.45,max:1.35},width:{min:.7,max:1.4},thick:{min:.35,max:.5},height:{min:.3,max:2.5},atWall:.9,closeRatio:.9},groundBar:{widthNormal:{min:.06,max:.4},width:{min:.3,max:.5},thick:{min:.05,max:.08},height:{min:.1,max:.2},bottom:{min:1.2,max:3},atWall:1,closeRatio:2},hlkcWindow:{widthNormal:{min:.08,max:.5},width:{min:.35,max:.5},thick:{min:.03,max:.06},height:{min:.35,max:.5},bottom:{min:1.2,max:3},atWall:1,closeRatio:2},electric:{widthNormal:{min:.2,max:.7},width:{min:.5,max:.65},thick:{min:.2,max:.3},height:{min:.5,max:1},bottom:{min:.8,max:1.8},atWall:1,closeRatio:2},monitor:{widthNormal:{min:.08,max:.11},height:{min:.1,max:.2,standard:.15},bottom:{min:1.2,max:3},atWall:1,closeRatio:4,tiny:!0},rowBigBox:{widthNormal:{min:.55,max:1/0},height:{min:.7,max:2.4,standard:2}}},hk={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"},dk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.bgcolor,r=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 o=Math.round(6*Math.random())+1,a=[];o-- >0;)a.push("|");t=[].concat(Q(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:r||0},textBorderColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:r||.9},textBorderThick:2,margin:{x:0,y:0},borderRadius:0,player:KB,sizeInfo:{minSize:90,maxSize:300,nearBound:1,farBound:7}});return s.position.copy(e),ek.add(s),s.sprite.position.y+=.4*s.sprite.scale.y,s},pk=function(e){var t=Tk(e);return uk[e.boxType].bottom?t:t.clone().setY(tk+e.size.y/2)},fk=[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)],mk=function e(t,n){n(t),t.list&&t.list.forEach((function(t){return e(t,n)})),t.mixedFrom&&t.mixedFrom.forEach((function(t){return e(t,n)}))},vk=function(){function e(t){o(this,e),this.setFromInfo(t),this.name=this.boxType+"-"+this.name,ik&&this.draw(),ck.push(this)}return u(e,[{key:"setFromInfo",value:function(e){for(var t in e)this[t]=e[t];this.position=pk(this);var n=(new THREE.Box3).setFromCenterAndSize(this.position,this.size);this.bound=n}},{key:"draw",value:function(){lk+=.23;var e=(new THREE.Color).setHSL(lk,.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=dk(this.position,this.score?[this.name,this.score.toFixed(1)]:this.name,{bgcolor:e}),ek.add(this.boxHelper)}},{key:"dispose",value:function(){var e=ck.indexOf(this);e>-1&&(ck.splice(e,1),ik&&(this.label.sprite.material.opacity=.3,this.boxHelper.material.opacity=.2))}},{key:"traversePair",value:function(e){mk(this,e)}},{key:"getDirection",value:function(){var e,t=this.xProp;if("cabinet"==this.boxType&&this.name.includes("row"))if(this.infos.box.length>1){t=this.infos.reduce((function(e,t){return e+t.k}),0)>1?"width":"thick"}else{var n=ck.filter((function(e){return"cabinet"==e.boxType&&e.name.includes("row")&&e.dirQua}));n.sort((function(e,t){return t.infos.box.length-e.infos.box.length}));var i=n[0];if(i)return this.dirQua=i.dirQua}if(!t){var r=Rk(this,!0);r.xWidthPossible,r.yWidthPossible,t=this.xProp}return t&&(this.panosDir||Pk(this),e="width"==t?Math.abs(this.panosDir["z+"])<Math.abs(this.panosDir["z-"])?new THREE.Vector3(0,1,0):new THREE.Vector3(0,-1,0):Math.abs(this.panosDir["x+"])<Math.abs(this.panosDir["x-"])?new THREE.Vector3(-1,0,0):new THREE.Vector3(1,0,0)),this.dirQua=tt.getQuaByAim(e,new THREE.Vector3,new THREE.Vector3(0,1,0)),this.dirQua}},{key:"toJson",value:function(){var e=this,t=hk[this.boxType];if(t instanceof Array){var n=new Map;(t=t.slice(0)).forEach((function(e){return n.set(e,0)}));var i=function(e){if(e){var t=n.get(e.category)+e.score;n.set(e.category,t)}};this.traversePair((function(e){i(e.box0),i(e.box1)})),t=(t=t.sort((function(e,t){return n.get(t)-n.get(e)})))[0]}return this.getDirection(),{points:fk.map((function(t){return he.invertVisionVector((new THREE.Vector3).addVectors(e.position,e.size.clone().multiply(t).multiplyScalar(.5))).toArray()})),category:t,type:this.boxType,sid:this.name,quaternion:this.dirQua.toArray()}}}]),e}(),gk=function(e,t){var n=-e.x*(2*Math.PI),i=Math.PI/2-e.y*Math.PI,r=new THREE.Vector3;return r.copy($i.RIGHT).applyAxisAngle($i.BACK,i).applyAxisAngle($i.UP,n).applyQuaternion(t.quaternion),r},Ak=function(e){if(!e.centerDir){var t=e.bbox2,n={x:bk(t[0],t[2]),y:(t[1]+t[3])/2};e.bbox2CenterX=n.x;var i=gk(n,e.pano);e.centerDir=i;var r={x:n.x,y:t[1]};e.centerTopDir=gk(r,e.pano);var o={x:n.x,y:t[3]};e.centerBtmDir=gk(o,e.pano);var a={x:t[0],y:t[3]};e.leftBtmDir=gk(a,e.pano);var s={x:t[2],y:t[3]};e.rightBtmDir=gk(s,e.pano)}},yk=function(e){e.bbox2||(e.bbox2=e.bbox.map((function(e,t){return t%2==0?e/4096:e/2048})))},Ek=function(e){kk(e),yk(e),Ak(e),function(e){if(e.boxType){var t=uk[e.boxType];if(ik){if(!e.posAtWall&&t.atWall>0){var n=t.thick?t.thick.min:t.widthNormal.min;ak.set(e.pano.position,e.centerDir);var i=ak.intersectObjects([$B]);i[0]&&(e.posAtWall=(new THREE.Vector3).addVectors(e.pano.position,e.centerDir.clone().multiplyScalar(i[0].distance-n)))}e.btmPos||xk(e),e.topPos||Ck(e)}else if(!t.bottom&&(ak.set(e.pano.position,e.centerBtmDir),e.btmPosPredict=ak.ray.intersectPlane(sk,new THREE.Vector3),e.btmPosPredict)){var r=new THREE.Vector2(e.centerBtmDir.x,e.centerBtmDir.z).normalize(),o=uk[e.boxType].widthNormal,a=o.min,s=o.max;a*=.4,s*=.4;var l=Math.min(Math.abs(r.x),Math.abs(r.y)),c=he.linearClamp(l,0,1,a,s);r=r.clone().multiplyScalar(c),e.btmPosPredict.x+=r.x,e.btmPosPredict.z+=r.y}}}(e)},wk=function(e,t){return Math.abs(e-t)<.5||(e>t?e-=1:t-=1),e-t},bk=function(e,t){return Math.abs(e-t)>.5?(e+t+1)/2:(e+t)/2},Ck=function(e){if(e.box1){var t=Ik(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=xk(e)),n.topPos=i.clone();var r,o=i.x-n.pano.position.x,a=i.z-n.pano.position.z;r=Math.abs(o)<Math.abs(a)?a*n.centerTopDir.y/n.centerTopDir.z:o*n.centerTopDir.y/n.centerTopDir.x,n.topPos.y=r+n.pano.position.y;var s=uk[kk(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},xk=function(e){if(e.box1){var t=Ik(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("pano0-7"==n.sid&&(console.log(3),function(e,t,n,i){var r=ui.createLine([e,e.clone().add(t.clone().multiplyScalar(n||1))],{color:i});ek.add(r)}(n.pano.position,n.centerBtmDir,20)),!ik)return n.btmPosPredict;ak.set(n.pano.position,n.centerBtmDir);var i,r=ak.intersectObjects([$B]);n.btmPosOri=r[0].point.clone(),kk(n);var o=new THREE.Vector2(n.centerBtmDir.x,n.centerBtmDir.z).normalize();if(uk[n.boxType].thick&&uk[n.boxType].atWall){var a=uk[n.boxType].widthNormal,s=a.min,l=a.max;s*=.3,l*=.5,n.xProp||Rk(n),i="width"==n.xProp?he.linearClamp(Math.abs(o.x),0,1,s,l):he.linearClamp(Math.abs(o.y),0,1,s,l)}else{var c=uk[n.boxType].thick||uk[n.boxType].widthNormal,u=(c.min+c.max)/2,h=.5*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(r[0].face.normal.y)<.9&&(uk[n.boxType].atWall||r[0].point.y-tk>.3)&&(i*=-1);var f=o.clone().multiplyScalar(i);n.btmPos=r[0].point.clone(),n.btmPos.x+=f.x,n.btmPos.z+=f.y}e.btmPos=n.btmPos}return e.btmPos},Ik=function(e,t,n,i){var r=(new THREE.Vector3).addVectors(e,t),o=(new THREE.Vector3).addVectors(n,i),a=he.getLineIntersect2({A:e.clone(),B:n.clone(),p1:r,p2:o,dir0:t,dir1:i});return a.pos3d||console.error("getIntersect2 no result? ?"),a},Tk=function(e){var t=kk(e);return e.preDealRes&&e.preDealRes.position||e.center||t&&(uk[t].atWall>.5&&uk[t].bottom?e.posAtWall:e.btmPos||e.btmPosPredict)||e.posAtWall},Bk=function(e,t){return hk[t]instanceof Array?hk[t].includes(e.category):hk[t]==e.category},kk=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),hk)if(hk[i]instanceof Array?hk[i].includes(t):hk[i]==t){n=i;break}e.boxType=n}return e.boxType},Pk=function(e,t){t=t||Tk(e);var n={"x+":0,"x-":0,"z+":0,"z-":0,got:!1};return!n.got&&t&&(KB.model.panos.list.forEach((function(e){var i=(new THREE.Vector3).subVectors(e.position,t);i.x>0?n["x+"]+=i.x:n["x-"]+=i.x,i.z>0?n["z+"]+=i.z:n["z-"]+=i.z})),n.got=!0),e.panosDir&&console.error("already has dir"),e.panosDir=n,n},Rk=function(e,t){var n,i;if("pano10-8&pano12-6"==e.name&&console.log(4),uk[e.boxType].atWall&&uk[e.boxType].thick||t){var r=Tk(e),o=nk,a=Math.min(r.x-o.min.x,o.max.x-r.x),s=Math.min(r.z-o.min.z,o.max.z-r.z),l=Pk(e,r),c=0==l["x+"]||0==l["x-"],u=0==l["z+"]||0==l["z-"];0==l["x+"]&&0!=l["x-"]?a=o.max.x-r.x:0==l["x-"]&&0!=l["x+"]&&(a=r.x-o.min.x),0==l["z+"]&&0!=l["z-"]?s=o.max.z-r.z:0==l["z-"]&&0!=l["z+"]&&(s=r.z-o.min.z);var h=u?1:0,d=c?1:0;return h+=a-s,!he.closeTo(h,d,.2)&&(a<.7||s<.7)&&(h<d?(n="thick",i="width"):(n="width",i="thick")),n||(t||(e.category?(e.pose||(e.pose=Sk(e,r)),h+=e.pose.xWidthPossible,d+=e.pose.yWidthPossible):mk(e,(function(e){e.boxposes&&e.boxposes.forEach((function(e){h+=e.xWidthPossible,d+=e.yWidthPossible}))}))),h>d?(n="width",i="thick"):(n="thick",i="width")),n&&(e.xProp=n,e.yProp=i),{xWidthPossible:h,yWidthPossible:d}}},Mk=function(e){if(!e.preDealRes&&e.center){e.preDealRes={},e.boxType||kk(e);var t,n=uk[e.boxType];n.widthNormal.min;var i=nk.distanceToPoint(e.center);if("pano2-5"==e.name&&console.log(4),i>.3&&!n.tiny&&!n.tinyXZ){var r=e.center.clone().clamp(nk.min,nk.max);e.preDealRes.position=r,kk(e),t=!0}var o=Tk(e);!t&&e.boxposes||(e.boxposes=[],[e.box0,e.box1].forEach((function(t){t&&e.boxposes.push(Sk(t,o))}))),Rk(e)}},Sk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=uk[e.boxType],r=wk(e.bbox2[2],e.bbox2[0])*Math.PI,o=(new THREE.Vector3).subVectors(e.pano.position,t).setY(0).length()+n,a=2*Math.tan(r)*o,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,d,p,f,m=i.widthNormal.max,v=i.widthNormal.min;if(uk[e.boxType].thick){var g=i.thick.min,A=i.width.min,y=i.thick.max,E=i.width.max,w=l.x*E+l.y*y,b=l.x*y+l.y*E,C=l.x*A+l.y*g,x=l.x*g+l.y*A;c=Math.min(C,x),u=Math.max(w,b),l.x,l.y,h=THREE.MathUtils.clamp((a-g*l.y)/l.x,g,E),d=THREE.MathUtils.clamp((a-g*l.x)/l.y,g,E),p=THREE.MathUtils.clamp((a-E*l.y)/l.x,g,E),f=THREE.MathUtils.clamp((a-E*l.x)/l.y,g,E)}else c=(l.x+l.y)*v,u=(l.x+l.y)*m,h=THREE.MathUtils.clamp((a-v*l.y)/l.x,v,m),d=THREE.MathUtils.clamp((a-v*l.x)/l.y,v,m),p=THREE.MathUtils.clamp((a-m*l.y)/l.x,v,m),f=THREE.MathUtils.clamp((a-m*l.x)/l.y,v,m);var I={box:e,projectWidth:a,camTangent:l,maxProjectWidth:u,minProjectWidth:c,dis:o,maxX:h,maxY:d,minX:p,minY:f};return i.atWall>0&&(I.xWidthPossible=-Math.abs(a-l.x*m-l.y*v),I.yWidthPossible=-Math.abs(a-l.x*v-l.y*m)),I},Dk=function(e,t){var n=0;if(e.forEach((function(i){i.lowR=i.dis<1.5?Math.pow(i.dis/1.5,1.4):1,i.projectWidth>i.maxProjectWidth?n+=500*Math.pow((i.projectWidth/i.maxProjectWidth-1)*i.lowR,2):i.projectWidth<i.minProjectWidth&&(n+=500*Math.pow((i.minProjectWidth/i.projectWidth-1)*i.lowR,2));var r=uk[t].widthNormal,o=r.min;if(r.max,1==uk[t].atWall&&o<.3||2==e.length&&"battery"==t){var a=uk[t].widthNormal,s=a.min,l=a.max-s,c=he.linearClamp(i.projectWidth,s,s+.5*l,600,0);n+=c}})),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)),r=new THREE.Vector2(Math.abs(e[1].camTangent.x),Math.abs(e[1].camTangent.y)),o=i.dot(r);if(o>.8){var a=Math.abs(e[0].projectWidth-e[1].projectWidth);e.score2=o*a*1300*e[0].lowR*e[1].lowR,n+=e.score2}e.camTangentCos=o}return-(n=Math.min(n,1200))},Fk=function(e){if("groundBar"==e.boxType&&console.log(1),!e.size){var t,n,i="",r="";"pano6-13&pano4-13"==e.name&&console.log(6);var o,a,s,l=Tk(e);if(e.predictSize)t=o=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=THREE.MathUtils.clamp(e.boxposes[0].projectWidth,e.boxposes[0].minProjectWidth,1.1*e.boxposes[0].maxProjectWidth),f=THREE.MathUtils.clamp(e.boxposes[1].projectWidth,e.boxposes[1].minProjectWidth,1.1*e.boxposes[1].maxProjectWidth);((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)&&(r=t<0?"x<0!":"y<0!"),o=t,a=n}else if(e.xProp){var m,v,g,A,y=uk[e.boxType].width,E=uk[e.boxType].thick;"width"==e.xProp?(m=THREE.MathUtils.clamp(e.boxposes[0].maxX,y.min,y.max),v=THREE.MathUtils.clamp(e.boxposes[0].maxY,E.min,E.max),g=THREE.MathUtils.clamp(e.boxposes[0].minX,y.min,y.max),A=THREE.MathUtils.clamp(e.boxposes[0].minY,E.min,E.max)):(m=THREE.MathUtils.clamp(e.boxposes[0].maxX,E.min,E.max),v=THREE.MathUtils.clamp(e.boxposes[0].maxY,y.min,y.max),g=THREE.MathUtils.clamp(e.boxposes[0].minX,E.min,E.max),A=THREE.MathUtils.clamp(e.boxposes[0].minY,y.min,y.max)),t=o=(m+g)/2,n=a=(v+A)/2}else{var w=uk[e.boxType].widthNormal;t=o=THREE.MathUtils.clamp(e.boxposes[0].maxX,w.min,w.max),n=a=THREE.MathUtils.clamp(e.boxposes[0].maxY,w.min,w.max)}if(uk[e.boxType].bottom)if(s=uk[e.boxType].height.standard,xk(e),s){var b=l.y-e.btmPos.y;l.y-=THREE.MathUtils.clamp((b-s/2)/2,-.1,.1)}else{var C=e.btmPos.y;s=2*(l.y-C)}else e.topPos||Ck(e),s=e.topPos.y-tk;var x=Lk(t,s,n,e);t=x.x,s=x.y,n=x.z,uk[e.boxType].widthSame&&(t=n=(t+n)/2),e.size=new THREE.Vector3(t,s,n),e.sizeAdjust=Math.pow(Math.abs(t-o),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=o,e.size.oriY=a,e.exStr=i,e.warnStr=r}},Lk=function(e,t,n,i){var r,o=i.xProp,a=i.yProp;if(null!=o){var s=uk[i.boxType][o],l=s.min,c=s.max;e=THREE.MathUtils.clamp(e,l,c);var u=uk[i.boxType][a];l=u.min,c=u.max;n=THREE.MathUtils.clamp(n,l,c),r=!0}if(!r){var h=uk[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=uk[i.boxType].height;l=d.min,c=d.max;return{x:e,y:t=THREE.MathUtils.clamp(t,l,c),z:n}},Qk=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},Hk=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 wk(e,t)})),n.sort((function(e,t){return wk(t,e)})),{leftX:t[0],rightX:n[0]}},Ok=function e(t,n,i,r,o){var a=[];if(r){var s=o.indexOf(r);o.splice(s,1)}for(var l=0;l<i.length;l++){a=[t,i[l]];var c=void 0;r?(c=r.slice(0)).push(a):c=[a],o.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,o)}},Vk=function(e){f(i,THREE.Group);var t,n=XB(i);function i(e,t,r){var a;return o(this,i),(a=n.call(this)).clear(),(KB=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(),(ek=new THREE.Object3D).name="testBox",a.add(ek),a.compute(r),a}return u(i,[{key:"compute",value:(t=k(S.mark((function e(t){var n,i,r,o,a=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=function(){return(o=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,Xn.post("/service/shapes/sceneMarkShape/getInfos",{num:KB.$app.config.num});case 2:if(t=e.sent,console.error(t),t.data&&t.success){e.next=6;break}return e.abrupt("return");case 6:t.data.forEach((function(e){var t=e.imagePath.split(".jpg")[0];n.datas[t]=e})),i();case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)},r=function(){return o.apply(this,arguments)},rk=Date.now(),this.datas={},this.datasMixed={},this.boxesSolid=ck,n=function(){var e=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.isSingle,o=i.center,s=i.onlyGet,l=i.dontCheckDis,c=e.sid+"&"+t.sid,u=t.sid+"&"+e.sid,h=kk(e),d=a.matchScoreMap[h][c],p=a.matchScoreMap[h][u],f=d||p;if(s)return f;if(f)return f;f={name:n=c,box0:e,box1:t,center:o},a.matchScoreMap[h][n]=f,"pano6-9&pano8-4"==n&&console.log(5),Ek(e),Ek(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=o?new THREE.Vector2(o.x-m.x,o.z-m.z).normalize():new THREE.Vector2(e.centerDir.x,e.centerDir.z).normalize(),E=o?new THREE.Vector2(o.x-v.x,o.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),r)){var I=2;C+=300*Math.sin(THREE.MathUtils.degToRad(f.dirAngleXZ)),C+=f.dirAngleXZ,C-=10*Math.abs(Tk(e).distanceToSquared(e.pano.position)-I),C-=10*Math.abs(Tk(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/uk[h].widthNormal.max,.6,2);if(!uk[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-=200*L*P,L=e.btmPosOri.distanceToSquared(t.btmPosOri),f.btmPosPreDis=L,C-=200*L*P*T}}if(!f.center){var Q=Ik(m,e.centerDir,v,t.centerDir);f.center=Q.pos3d.clone();var H,O=(new THREE.Vector3).subVectors(Q.pos3d,m).normalize(),V=(new THREE.Vector3).subVectors(Q.pos3d,v).normalize(),_=O.dot(e.centerDir)+V.dot(t.centerDir),z=_<1.95;if(C-=1e4*(2-_),z)return x.push("wrongDir"),Object.assign(f,{score:C-5e3,str:x});if(!l&&!uk[h].bottom&&e.btmPos&&t.btmPos){var N=new THREE.Vector2(e.btmPos.x,e.btmPos.z),U=new THREE.Vector2(t.btmPos.x,t.btmPos.z),G=new THREE.Vector2(f.center.x,f.center.z),j=N.distanceToSquared(G)+U.distanceToSquared(G),W=he.linearClamp(f.minAng,0,20,0,1);C-=1500*j*W,f.centerDrift=j}xk(f),H=1==uk[e.boxType].atWall?he.linearClamp(f.minAng,2,15,0,1):he.linearClamp(f.minAng,2,20,0,.4);var q=!uk[h].bottom&&e.btmPos||e.posAtWall||f.topPos,J=!uk[h].bottom&&t.btmPos||t.posAtWall||f.topPos,Y=.5,Z=(new THREE.Vector3).addVectors(f.center.clone().multiplyScalar(1-Y),f.btmPos.clone().multiplyScalar(Y)).setY(Q.pos3d.y);f.center=q&&J?(new THREE.Vector3).addVectors(Z.clone().multiplyScalar(H),q.clone().add(J).multiplyScalar(.5*(1-H))).setY(Q.pos3d.y):Z,f.cIntersect=Z}kk(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),!nk.containsPoint(f.center)){var ee=nk.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=Sk(e,f.center);X.push(t)}))};return te(),C+=Dk(X,h),Object.assign(f,{score:C,str:x,boxposes:X})};a.rows={};var t=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.reason,r=void 0===i?"row":i,o=e[0].pano,s=e[0].category,l=s+"|"+r;if(a.rows[l]||(a.rows[l]={}),a.rows[l][o.id])return a.rows[l][o.id];for(var c={sid:"pano"+o.id+("mix"==r?"-mix":"-row"),pano:o,category:"mix"==r?s:"rowBigBox",boxType:"mix"==r?e[0].boxType:"rowBigBox"},u=[],h=0;h<e.length;h++){var d=e[h];Ek(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(Ek(g),d.boxType==d.boxType){var A=[g.bbox2[0],g.bbox2[2]],y=A[0],E=A[1],w=wk(y,m),b=wk(y,f),C=wk(f,E);"pano2-4"==d.sid&&"pano2-5"==g.sid&&console.log(9);var x="mix"==r?.004:.003;if(w<=x&&b>=x||C<=x&&b<=x){var I=y<.002&&m>.998?[y,m]:f<.002&&E>.998?[f,E]:null;if("mix"==r&&!I)continue;var T=uk[d.boxType].widthNormal.max,B=T*T*("mix"==r?.7:1.8),k=1==uk[d.boxType].atWall?d.posAtWall:"mix"==r?d.btmPosOri||d.btmPosPredict:d.btmPos,P=1==uk[g.boxType].atWall?g.posAtWall:"mix"==r?g.btmPosOri||g.btmPosPredict:g.btmPos,R=k.distanceToSquared(P);if("mix"==r){var M=d.bbox2[3]-d.bbox2[1]+(g.bbox2[3]-g.bbox2[1]),S=Math.max(d.bbox2[3],g.bbox2[3])-Math.min(d.bbox2[1],g.bbox2[1]),D=M-S,F=4*(1-D/S+3*(S-D))*B;R+=F;var L=I?.002/(I[0]+(1-I[1])):0;R-=(L=Math.min(6,L))*B}R<B&&Ae.pushToGroupAuto([d,g],u)}}}}return u.forEach((function(e){e.sort((function(e,t){return wk(e.bbox2CenterX,t.bbox2CenterX)}))})),"row"==r&&(u.slice(0).forEach((function(e){if(e.length>=2){for(var t=[],n=new THREE.Box2,i=new THREE.Vector2,r=0,o=e.length;r<o;r++){var a=e[r],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[r],e[r-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 wk(e.bbox2CenterX,t.bbox2CenterX)}))}))),u.sort((function(e,t){return t.length-e.length})),t=u.map((function(e,t){var n=Hk(e),i=n.leftX,r=n.rightX,o=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,o,r,a],left:e.find((function(e){return e.bbox2[0]==i})),right:e.find((function(e){return e.bbox2[2]==r}))}),l=Tk(s.left),u=Tk(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"!=r&&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"==r&&(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)))})),a.rows[l][o.id]=t,t},n=function(n,i){a.matchScoreMap.rowBigBox={};var r=[],o=function(t,n,i){var o=t.sid+"&"+n.sid;if(o in r)return r[o];if("pano4-row-2,11,10,8,6&pano6-row-2,5,8,11"==o&&console.log(3),t.boxes.length==n.boxes.length||i){var a;if(t.boxes.length>1&&n.boxes.length>1){var s,l,c=[t.left,n.left],u=[t.right,n.right],h=function(e,t){var n,i,r=!1,o=[e.left,t.left],a=[e.right,t.right];o[0].btmPos.distanceToSquared(o[1].btmPos)+a[0].btmPos.distanceToSquared(a[1].btmPos)>o[0].btmPos.distanceToSquared(a[1].btmPos)+a[0].btmPos.distanceToSquared(o[1].btmPos)?(r=!0,n=(new THREE.Vector3).addVectors(o[0].btmPos,a[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,o[1].btmPos).multiplyScalar(.5)):(n=(new THREE.Vector3).addVectors(o[0].btmPos,o[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:r,k:Math.abs(s.x/s.y)}}(t,n),d=t.predictLen,p=n.predictLen,f=Math.abs(d-p);if(f>1)return S();h.reversed?(s=e(c[0],u[1],{isSingle:!0}),l=e(u[0],c[1],{isSingle:!0})):(s=e(c[0],c[1],{isSingle:!0}),l=e(u[0],u[1],{isSingle:!0}));var m=Tk(s),v=Tk(l);if(!m||!v||s.score<-4e3||l.score<-4e3)return S();Mk(s),Mk(l),m=Tk(s),v=Tk(l);var g=new THREE.Vector2(m.x-v.x,m.z-v.z),A=Math.abs(g.x/g.y);if(h.k>1&&A<1||h.k<1&&A>1)return console.error("请检查!info2.k > 1 && k < 1 || info2.k < 1 && k > 1",t.sid,"和",n.sid),S();var y=0;if((t.k>1&&n.k<1||t.k<1&&n.k>1)&&(y=t.k/n.k)<1&&(y=1/y),A<1&&m.z>v.z||A>1&&m.x>v.x){var E=v;v=m,m=E}var w=(new THREE.Vector3).addVectors(m,v).multiplyScalar(.5);w.add(t.btmPos).add(n.btmPos).multiplyScalar(1/3);var b=e(t,n,{isSingle:!0,center:w}),C=b.score-1e3*f-100*y+s.score+l.score;if(C<-4e3)return S();a={rowBigBox0:t,rowBigBox1:n,match:b,k:A,posLeft:m,posRight:v,score:C/3+500,reversed:h.reversed}}else if(1==t.boxes.length&&1==n.boxes.length)a=e(t.boxes[0],n.boxes[0]);else{var x=t.boxes.length>1?t:n,I=1==t.boxes.length?t:n;(a=e(t,n,{dontCheckDis:!0})).k=x.k,a.center&&a.center.add(Tk(x)).multiplyScalar(.5),"pano0-row-14&pano4-row-8,11"==a.name&&dk(a.center,"c"),a.predictSize=a.k>1?{x:x.predictLen,y:.6}:{y:x.predictLen,x:.6};var T=Tk(x.left).distanceToSquared(I.pano.position)<Tk(x.right).distanceToSquared(I.pano.position)?x.left:x.right,B=Tk(I),k=Tk(T).distanceToSquared(B);a.score-=1e3*k;var P=Tk(x),R=new THREE.Vector2(P.x-I.pano.position.x,P.z-I.pano.position.z).normalize(),M=new THREE.Vector2(I.centerDir.x,I.centerDir.z).normalize();a.score+=1e3*(R.dot(M)-1)}return S(a),a}function S(e){e&&r.push(e),r[o]=e}},s=[],l=1==n.filter((function(e){return e.length>1})).length,c=ik?-2e3:-800,u=function(e){"second"==e&&(l=!0);for(var i=0;i<n.length-1;i++){var a=t(n[i]);n[i][0].pano,"second"==e&&(a=a.filter((function(e){return!s.some((function(t){return t.includes(e)}))})));for(var u=function(i){var u=t(n[i]);"second"==e&&(u=u.filter((function(e){return!s.some((function(t){return t.includes(e)}))}))),n[i][0].pano;var h=[],d=void 0,p=void 0;for(a.length<u.length?(d=u.slice(),p=a.slice()):(d=a.slice(),p=u.slice());p.length<d.length;)p.push({sid:"void"});if(!d[0])return"continue";Ok(d[0],d,p,null,h),(h=h.map((function(e){var t=e.map((function(e){return e.some((function(e){return"void"==e.sid}))?null:o(e[0],e[1],l)})),n=t.reduce((function(e,t){return e+(t&&t.score>c?t.score:c/2)}),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})),h[0].pairs.forEach((function(e,t){var n=h[0].infos[t];if(n&&n.score>c){var i=e.filter((function(e){return"void"!=e.sid}));Ae.pushToGroupAuto(i,s,null,(function(e){if(!n.k)return!0;var t=e.relationships[0],i=t[0].sid+"&"+t[1].sid;return!r[i].k||r[i].k<1&&n.k<1||r[i].k>1&&n.k>1||void console.log("k不一致无法匹配",n,e)}))}}))},h=i+1;h<n.length;h++)u(h)}};u(),l||u("second"),console.log("matchGroups",s);var h=[],d=function e(t){var n=new THREE.Vector3,i=new THREE.Vector3,o=0,a=[],l={};if(t.relationships.forEach((function(e){var t=e[0].sid+"&"+e[1].sid,s=r[t];s.posLeft?(n.add(s.posLeft),i.add(s.posRight),o++):(a.push(s),Mk(s),Fk(s))})),o>0){n.multiplyScalar(1/o),i.multiplyScalar(1/o);var c=(new THREE.Vector3).addVectors(n,i).multiplyScalar(.5);l.left=n,l.right=i,l.center=c,l.pointsLen=o}if(a.length>0){var u=function(e){var t=new THREE.Vector3,r=new THREE.Vector3;if(e.forEach((function(e){var n=Tk(e);t.add(n),r.add(e.size)})),o>0){var a=new THREE.Vector3(Math.abs(n.x-i.x),r.y,Math.abs(n.z-i.z));r.add(a.multiplyScalar(o)).multiplyScalar(1/(o+e.length)),t.add(l.center.clone().multiplyScalar(o)).multiplyScalar(1/(o+e.length))}else r.multiplyScalar(1/e.length),t.multiplyScalar(1/e.length);return{center1:t,size:r}},d=function(e,t){a.forEach((function(e){e.sc=-e.center.distanceToSquared(f)-.5*t.distanceToSquared(e.size)}))},p=u(a),f=p.center1;d(0,p.size),a.sort((function(e,t){return t.sc-e.sc}));var m=a[Math.floor(a.length/2)];d(m.center,m.size);var v=a.filter((function(e){return e.sc<-8}));if(v.length){var g=Ae.disconnectGroup(v.map((function(e){return[e.box0,e.box1]})),s).newGroups;if(console.log("去除错误数据",v),g.length>1)return void g.forEach((function(t){e(t)}));a=a.filter((function(e){return e.sc>=-8}))}if(a.length){var A=u(a);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=a,l.group=t,h.push(l)};s.slice(0).forEach((function(e){d(e)}));var p=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},f=function(){for(var e=[],t=function(e,t){var n=[];e.forEach((function(e){n.push.apply(n,Q(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 r=uk.cabinet.widthNormal,o=r.min,a=r.max,s=(o+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<o)&&(c=THREE.MathUtils.clamp(c,o,a)),{aveW:c,count:u}},n=function(e,t,n,i){var r=new THREE.Box2;r.expandByPoint(new THREE.Vector2(e.x,e.z));var o=i>1?new THREE.Vector2(t/2,n/2):new THREE.Vector2(n/2,t/2);return r.expandByVector(o),r},i=function(i){for(var r=h[i],o=function(i){var o,a,s=h[i];if("pano4-row-4&pano6-row-5,1"==(null===(o=s.bigBoxes[0])||void 0===o?void 0:o.name)&&"pano4-row-2,5&pano6-row-3"==(null===(a=r.bigBoxes[0])||void 0===a?void 0:a.name)&&console.log(4),(r.k>1&&s.k<1||r.k<1&&s.k>1)&&p(r)>1.5&&p(s)>1.5)return"continue";var l=(r.k+s.k)/2>1?"z":"x";if(Math.abs(r.center[l]-s.center[l])>.6*1.5)return"continue";var c=t([r],p(r)),u=t([s],p(s)),d=r.predictLen=c.aveW*c.count,f=s.predictLen=u.aveW*u.count,m=r.area=d*c.aveW,v=s.area=f*u.aveW,g=function(e,t){var i=n(r.center,d+e,c.aveW+t,r.k),o=n(s.center,f+e,u.aveW+t,s.k),a=Qk(i,o).getSize(new THREE.Vector2);return{box0:i,box1:o,areaMix:Math.max(0,a.x)*Math.max(0,a.y)}}(.1,.3).areaMix;if(g/m<.65&&g/v<.65)return"continue";Ae.pushToGroupAuto([r,s],e)},a=i+1;a<h.length;a++)o(a)},r=0;r<h.length-1;r++)i(r);return h.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,r=e.reduce((function(e,t){return e+(t.pointsLen||t.bigBoxes.length)}),0),o={"<1":{count:0,sum:0},">1":{count:0,sum:0}};e.forEach((function(e){e.k<1?(o["<1"].count++,o["<1"].sum+=1/e.k):(o[">1"].count++,o[">1"].sum+=e.k)})),o["<1"].count&&(o["<1"].ave=o["<1"].sum/o["<1"].count),o[">1"].count&&(o[">1"].ave=o[">1"].sum/o[">1"].count),i=o["<1"].ave>o[">1"].ave?1/o["<1"].ave:o[">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/r),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,Q(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 Ck(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-tk}))}))).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 vk({name:"row"+n+"-"+w,center:b,size:I,boxType:"cabinet",infos:e});w++,e.box.push(T)}})),{v:e.length>0}}();if("object"==typeof f)return f.v},i=[],r=function(r){console.error("开始search",r);var o=a.matchScoreMap[r]={},s={},c=[];for(var u in a.datas)a.datas[u]&&(s[u]=a.datas[u].shapes.filter((function(e){return Bk(e,r)})),s[u].length&&c.push(u));var p=function(e){if(!a.datas[e])return"continue";(function(e){var t=e.length;if(!(t<2)){for(var n=0;n<t-1;n++){var i=e[n];Ek(i),i.contains=i.contains||[];for(var r=n+1;r<t;r++){var o=e[r];if("pano2-1"==i.sid&&"pano2-7"==o.sid&&console.log(6),Ek(o),o.contains=o.contains||[],!(Math.abs(o.bbox2CenterX-i.bbox2CenterX)>.4)){var a=wk(o.bbox2[0],i.bbox2[0]),s=wk(i.bbox2[2],o.bbox2[2]),l=wk(i.bbox2[2],i.bbox2[0]),c=wk(o.bbox2[2],o.bbox2[0]),u=Math.min(.005,.2*Math.min(l,c));s>=0&&Math.abs(a)<u||a>=0&&Math.abs(s)<u||s>=0&&a>=0?i.contains.push(o):(a<=0&&Math.abs(s)<u||s<=0&&Math.abs(a)<u||s<=0&&a<=0)&&o.contains.push(i)}}}var h=function(e,t){var n=Sk(e,Tk(e),.1),i=n.projectWidth,r=(n.maxProjectWidth+n.minProjectWidth)/2,o="out"==t?i-r:r-i;return 10*-Math.pow(o,2)},d="battery"==e[0].boxType?1:2;e.slice().forEach((function(t){if(t.contains.length>=d){var n=Hk(t.contains),i=n.leftX,r=n.rightX;if(t.contains.length>1&&(Math.abs(wk(t.bbox2[0],i))>.005||Math.abs(wk(t.bbox2[2],r))>.005))return;var o=!0;if(1==t.contains.length)o=!1;else{var a=h(t,"out"),s=t.contains.map((function(e){return h(e,"in")})),l=s.reduce((function(e,t){return e+t}),0)/s.length;l<-4&&(o=l>a)}o?(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(Q(t.contains)))}))}}))}})(s[e]),s[e].length&&t(s[e],{reason:"mix"}).forEach((function(t){if(t.boxes.length>1){t.boxes.forEach((function(n){n.state="被删除",n.mixTo=t;var i=s[e].indexOf(n);s[e].splice(i,1),i=a.datasMixed[e].shapes.findIndex((function(e){return e.sid==n.sid})),a.datasMixed[e].shapes.splice(i,1)})),s[e].push(t),a.datasMixed[e].shapes.push(t);var n=a.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 a.datas)p(f);if(0!=c.length){c.sort((function(e,t){return s[t].length-s[e].length}));var m=c.map((function(e){return s[e]}));console.log("按box个数排序:",m.slice());var v=m[0],g=v.length;if(1==m.length)return uk[r].tinyXZ&&a.expandModelBound(r),v.forEach((function(e){return d(e)})),h(r);var A=function(e){i.push({type:r,args:[e]}),uk[r].tinyXZ&&a.confirmGroundY(r),uk[r].tiny&&a.expandModelBound2(r)};if(1==g){c.forEach((function(e){return Ek(s[e][0])}));for(var y=0;y<c.length;y++)for(var E=s[c[y]][0],w=y+1;w<c.length;w++){var b=s[c[w]][0];e(E,b,{isSingle:!0})}var C=Object.keys(o);C.sort((function(e,t){return o[t].score-o[e].score}));var x=o[C[0]];if(Mk(x),x.score>-100&&(Fk(x),x.score>0&&x.sizeAdjust<.1))return new vk(o[C[0]]),void A(m);var I=[];C.forEach((function(e){var t=o[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 s[e]}));return l([x],T),void A(T)}var B={};m.forEach((function(e){e.forEach((function(e){return Ek(e)})),B[e.length]||(B[e.length]=[]),B[e.length].push(e)})),m=[],uk[r].atWall;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=Tk(t);return e+Math.abs(t.pano.position.distanceToSquared(n)-2)}),0)})),n.sort((function(e,t){return e.disSc-t.disSc}))),(t=m).push.apply(t,Q(n))})),console.log("按距离和个数排序:",m),g=(v=m[0]).length,"cabinet"==r&&n(m))i.push({type:r,args:[m,0]});else{for(var P=function(t,n,i){for(var r=i.fake,a=t.length,s=n.length,c=0;c<a;c++)for(var u=0;u<s;u++){var h=t[c],d=n[u];e(h,d)}for(var p=[],f=t.slice(0),v=n.slice(0);v.length<f.length;)v.push({sid:"void"});Ok(t[0],f,v,null,p),p=p.map((function(e){var t=e.map((function(e){return o[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按分数高低",p.sort((function(e,t){return t.score-e.score})));var g=ik?-2e3:-800,A=[],y=[];p[0]&&p[0].infos.forEach((function(e,t){if(e)if(e.score<g||uk[e.boxType].bottom&&e.minAng<5)y.push(e);else if(Mk(e),Fk(e),e.sizeAdjust&&uk[e.boxType].tiny||e.sizeAdjust>.2)y.push(e);else{if(e.box0.category==hk.battery&&e.size.x<1&&e.size.z<1){var n=(new THREE.Vector3).subVectors(e.box0.pano.position,Tk(e)),i=(new THREE.Vector3).subVectors(e.box1.pano.position,Tk(e));if(n.x*i.x>0&&n.z*i.z>0)return void y.push(e)}e.fake=r,new vk(e)}else A.push(p[0].pairs[t].find((function(e){return"void"!=e.sid})))})),A.length&&l(A.map((function(e){return{box0:e}})),m,{fake:r}),l(y,m,{fake:r})},R=0;R<m.length-1&&(P(m[R],m[R+1],{fake:R>0}),uk[r].tinyXZ&&!(m[R+1].length<2));R++);A(m)}}else uk[r].tinyXZ&&a.expandModelBound()};function o(e){var t=.1,n=.5,i=[],r=new Map;e.forEach((function(e){var t;(t=i).push.apply(t,Q(e))})),(i=i.filter((function(e){return!s(e)}))).forEach((function(e){Ek(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),o=-Math.abs(i-2);e.pose||(e.pose=Sk(e,Tk(e)));var a=Dk([e.pose],e.boxType)+7*THREE.MathUtils.clamp(e.pose.projectWidth,e.pose.minProjectWidth,e.pose.maxProjectWidth);r.set(e,{s1:o,s2:a,sum:o+a})})),(i=i.sort((function(e,t){return r.get(t).sum-r.get(e).sum}))).forEach((function(i){"pano0-4"==i.sid&&console.log(3),s(i)||function(e){if(!uk[e.boxType].bottom){e.blocked||(e.blocked={centerBtmDir:null,leftBtmDir:null,rightBtmDir:null});var t=function(t){if(!e.blocked[t]){var n=ck.find((function(n){if(ak.set(e.pano.position,e[t]),ak.ray.intersectsBox(n.bound))return!0}));if(!n)return e.blocked[t]=!1,{v:!1};e.blocked[t]=n}};for(var n in e.blocked){var i=t(n);if("object"==typeof i)return i.v}return!0}var r=ck.find((function(t){if(t.boxType==e.boxType)return ak.set(e.pano.position,e.centerDir),!!ak.ray.intersectsBox(t.bound)||void 0}));if(r)return e.blocked=r,!0}(i)||ck.find((function(e){if("air-pano16-7&pano14-13"==e.name&&console.log(3),e.boxType==i.boxType||"air-hanging"!=e.boxType&&"air-hanging"!=i.boxType){var r=Tk(e),o=Tk(i);new THREE.Vector2(r.x,r.z),new THREE.Vector2(o.x,o.z);var a=uk[i.boxType].widthNormal.max/2;a=THREE.MathUtils.clamp(a,t,n);var s=e.bound.distanceToPoint(o),l=uk[i.boxType].closeRatio,c=he.linearClamp(i.pano.position.distanceTo(o),3,8,1,2),u=a*((e.boxType==i.boxType?1:.5)*l*c)-1.3*s;return u>0&&console.log(1),u>0}}))||l([{box0:i,log:"findRest"}],e,{startIndex:0})}))}function s(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 ck.some((function(e){return t(e)}))}function l(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.startIndex,a=void 0===o?2:o,l=r.fake,h=[],p=ik?-2e3:-800,f=function(t,n){var i=function(t,n){if(t!=n)return t.pano==n.pano||e(t,n,{isSingle:!0,restMatch:!0}).score<p||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(Q(t))),t[0].box1&&t.sort((function(e,t){return e.score-t.score})),t.forEach((function(i){var r=i.box0,o=i.box1,m=[];o&&m.push(i);for(var v=function(t){var i=n[t],a=[],l=[];i.forEach((function(t){if(!s(t)){if(t.pano!=r.pano&&t!=o){var n=e(r,t,{isSingle:!0,restMatch:!0});n.score>1.5*p&&a.push(n)}if(o&&t.pano!=o.pano&&t!=r){var i=e(o,t,{isSingle:!0,restMatch:!0});i.score>1.5*p&&l.push(i)}}})),a.sort((function(e,t){return t.score-e.score})),l.sort((function(e,t){return t.score-e.score})),a[0]&&m.push(a[0]),l[0]&&m.push(l[0])},g=a;g<n.length;g++)v(g);m.sort((function(e,t){return t.score-e.score}));var A=m.slice(0,10).map((function(e){return Tk(e)?(Mk(e),Fk(e),e):e})).sort((function(e,t){return t.score-e.score})).slice(0,3);if(0==A.length)return l||d(r,.6);if(!(A[0].score>.65*p))return o?h.push(A[0]):void(("findRest"==i.log||Tk(r).distanceTo(r.pano.position)<2.5)&&(l||d(r)));if((A=A.filter((function(e){return e.score>.65*p}))).length){for(var y=[],E=[],w=function(e,t){var n=A[e];if(y.some((function(e){return e.includes(n)})))return"continue";for(var i=[n],r=e+1;r<t;r++){var o=A[r];f(n,o)&&i.push(o)}y.push(i)},b=0,C=A.length;b<C;b++)w(b,C);y.forEach((function(e){E.push(c(e,t[0].log,l))})),l||u(E)}})))}function c(e,t,n){var i=new THREE.Vector3,r=new THREE.Vector3,o=new THREE.Box3;e.forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(pk(e),e.size);o.union(t)})),o.getSize(r),e.forEach((function(e){return i.add(Tk(e))})),i.multiplyScalar(1/e.length);var a=e.find((function(e){return e.xProp}))||{},s=a.xProp,l=a.yProp;s&&e.find((function(e){return e.xProp&&e.xProp!=s}))&&(s=l=null);var c={name:("findRest"==t?"rest:":"low:")+e.map((function(e){return e.name})),boxType:e[0].boxType,center:i,size:r,list:e,xProp:s,yProp:l};s||Rk(c);var u=Lk(r.x,r.y,r.z,c);return r.x=u.x,r.y=u.y,r.z=u.z,c.fake=n,new vk(c)}function u(e,t){var n=[];if(e.length>1){var i=e[0].boxType,r=uk[i].widthNormal;r.min;for(var o=r.max,a=0,s=e.length;a<s-1;a++){var l=e[a];if(!l.fake)for(var c=a+1;c<s;c++){var u=e[c];if(!u.fake){var h=l.bound.clone().union(u.bound).getSize(new THREE.Vector3),d=l.bound.intersectsBox(u.bound);"electric"==l.boxType&&console.log(1);var p=o,f=o,m=uk[i].height.max;l.xProp&&u.xProp&&l.xProp==u.xProp&&(p=uk[i][l.xProp].max,f=uk[i][l.yProp].max,l.boxType!=u.boxType&&(p=Math.max(p,uk[u.boxType][u.xProp].max),f=Math.max(f,uk[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),m=Math.max(m,l.size.y,u.size.y);var v=d?1.5:1.3;"battery"==l.boxType&&(v*=1.3);var g=.4,A=.4,y=v,E=v;1==uk[l.boxType].atWall&&("width"==l.yProp?(g*=4,y*=4):"width"==l.xProp&&(A*=4,E*=4)),h.x-p<g&&h.x<p*y&&h.z<f*E&&h.z-f<A&&h.y<m*v&&h.y-m<.4&&Ae.pushToGroupAuto([l,u],n)}}}n.length&&n.forEach((function(e){var n=[],r=new THREE.Box3;e.forEach((function(e){if(r.union(e.bound),e.dispose(),t>1){var i=n.find((function(t){return t.boxType==e.boxType})),o=0,a=function(e){e&&(o+=e.score)};e.traversePair((function(e){a(e.box0),a(e.box1)})),i?i.score+=o:n.push({score:o,boxType:e.boxType})}})),t>1&&(n.sort((function(e,t){return t.score-e.score})),i=n[0].boxType);var o=r.getSize(new THREE.Vector3),a=r.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:o,xProp:l,yProp:c};l||Rk(u);var h=Lk(o.x,o.y,o.z,u);o.x=h.x,o.y=h.y,o.z=h.z;var d=new vk(u);console.error("混合",i,e,d)}))}}function h(e){e instanceof Array||(e=[e]),u(ck.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<.68)return console.error("取消createSinglePano: 线框识别分数低,可能错误",e);Ek(e);var n=Tk(e);if(nk.distanceToPoint(n)>.5)return console.log("取消createSinglePano:超出safebound",e);var i={name:e.sid,box0:e,center:n,topPos:e.topPos,btmPos:e.btmPos};Mk(i);var r=-500*t,o=Dk(i.boxposes,e.boxType);!uk[e.boxType].bottom&&e.btmPos&&(o-=3e3*(e.btmPos.y-tk));var a=o<r;console.log("createSinglePano",a?"失败":"成功","pose score:",o,e.sid,e),a||(i.score=o,Fk(i),new vk(i))};a.removedDatas={};for(var p=Object.keys(a.datas),f=p.length,m=0;m<f;m++)for(var v=KB.model.panos.index[p[m]],g=m+1;g<f;g++){var A=KB.model.panos.index[p[g]];if(v.position.distanceToSquared(A.position)<.01){var y=void 0;y=a.datas[p[m]].shapes.length>a.datas[p[g]].shapes.length?p[g]:p[m],console.log("删除pano".concat(y,"的data,因pano").concat(p[m],"和pano").concat(p[g],"很近")),a.removedDatas[y]=a.datas[y],delete a.datas[y]}}for(var E in a.datasMixed=Ae.CloneObject(a.datas,null,void 0,(function(e){return e.category})),hk)r(E);console.log("----FindRest----"),i.forEach((function(e){o.apply(void 0,Q(e.args)),"air"!=e.type&&"airSmart"!=e.type&&"cabinet"!=e.type&&h(e.type)})),h(["air","airSmart"]),console.log("cost:",Date.now()-rk,"ms, boxSolid:",a.boxesSolid)},i=function(){var e=function(e){if(!a.datas[e])return"continue";a.datas[e].shapes=a.datas[e].shapes.map((function(t,n){return Object.assign({sid:"pano"+e+"-"+n,category:t.category,pano:KB.model.panos.index[e],index:n},t)}))};for(var t in a.datas)e(t);a.panoBound=new THREE.Box3,KB.model.chunks.forEach((function(e){ok.union(e.geometry.boundingBox)}));var i=1/0,r=[];KB.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),a.panoBound.union(t),i=Math.min(e.floorPosition.y,i),r.push(e.floorPosition.y)})),tk=ok.min.y,r.sort((function(e,t){return e-t})),console.log(r);var o=r[Math.floor(r.length/2)];console.error("minY",i,"midFloorY",o,"原groundY",tk),a.minY=i,tk=ok.min.y=o,nk=a.safeBound=ok,sk.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,tk,0)),a.ifAnalyze&&n(),a.load(KB.currentPano.id)},t?(t.forEach((function(e){var t=e.imagePath.split(".jpg")[0];a.datas[t]=e})),i()):r.bind(this)();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]&&this.datas[n].shapes.forEach((function(e){if(Ek(e),"pano2-10"==e.sid&&console.log(4),e.btmPosPredict){if(e.pano.position.distanceToSquared(e.btmPosPredict)>20)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,r=0;r<i;r++){var o=t[r].box.btmPosPredict;if(t[r].dis>1){var a=o.clone().clamp(ok.min,ok.max),s=(new THREE.Vector3).subVectors(o,a).normalize().multiplyScalar(1);o=(new THREE.Vector3).addVectors(a,s)}var l=(new THREE.Box3).setFromCenterAndSize(o,new THREE.Vector3(.2,0,.2));e.union(l)}($B=new cr(e,new THREE.MeshBasicMaterial({side:THREE.DoubleSide,wireframe:!0,transparent:!0,opacity:.05}),0)).updateMatrixWorld(),ek.add($B),this.skyBoxTight=$B,this.safeBound=this.safeBoundFirstVer=nk=e,ik=!0,console.log("bound1:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"expandModelBound2",value:function(e){var t=this,n=$B.material;$B.geometry.dispose(),ck.forEach((function(n){n.boxType==e&&t.safeBound.union(n.bound)})),($B=new cr(this.safeBound,n,0)).updateMatrixWorld(),ek.add($B),this.skyBoxTight=$B,console.log("bound2:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"confirmGroundY",value:function(e){if(!ik){var t=[],n=[],i=0,r=function(e){e.btmPos&&e.box1&&n.push(e)};ck.forEach((function(t){t.boxType==e&&t.traversePair(r)}));var o=n;if(n.length>5){var a=new Map;n.forEach((function(e){a.set(e,Math.max(e.box0.pano.position.distanceTo(e.box0.btmPosPredict),e.box1.pano.position.distanceTo(e.box1.btmPosPredict)))})),n.sort((function(e,t){return a.get(e)-a.get(t)})),o=n.slice(0,5);for(var s=5;s<n.length;s++)a.get(n[s])<3&&o.push(n[s])}o.forEach((function(e){var n=e.btmPos.y,r=e.size.x/2,o=r/Math.tan(Math.acos(-e.box0.centerBtmDir.y)),a=r/Math.tan(Math.acos(-e.box1.centerBtmDir.y));n+=Math.min(o,a)*he.linearClamp(e.minAng,0,90,0,1),t.push(n),i+=n})),i/=t.length,t.length&&(console.error("confirmGroundY",i,t,o.map((function(e){return e.name})),n),tk=this.safeBound.min.y=this.panoBound.min.y=i,sk.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,tk,0)));var l=uk[e].height,c=l.min,u=l.max;ck.slice().forEach((function(t){if(t.boxType==e)if(t.fake)t.dispose();else{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-tk,c,u),t.setFromInfo(t),t.draw()}})),this.panoBound,this.expandModelBound()}}},{key:"bindEvents",value:function(){var e=this;KB.on(Wo,(function(t){e.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())})),e.wireframes.clear(),e.currentId=null})),KB.on(qo,(function(){KB.mode==ht.PANORAMA&&e.load(KB.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(KB.currentPano.id==e&&!KB.flying&&this.currentId!=e){this.currentId=e;var i=n.shapes,r=n.imageHeight,o=n.imageWidth,a=i.slice();i.forEach((function(e){e.boxes&&a.push.apply(a,Q(e.boxes))})),a.forEach((function(e){yk(e),Ak(e,KB.currentPano);var n=e.fill_color,i=e.color,a=[].concat(Q(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=Tk(e)?e.pano.position.distanceTo(Tk(e)):1,l=("fire"==e.boxType?0:-.2)/s;t.showSignalFrom2d(e.category+"-"+e.sid,e.bbox2,o,r,{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,r,o,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=gk(e,KB.currentPano);d.push(t)}));var p=(new THREE.BufferGeometry).setFromPoints(d),f=new THREE.LineBasicMaterial({color:r.line.color,opacity:r.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:r.fill.color,opacity:r.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*r.line.color.r,g:255*r.line.color.g,b:255*r.line.color.b,a:.5*r.line.opacity},textColor:{r:255,g:255,b:255,a:1.1*r.line.opacity},borderRadius:15,renderOrder:m.renderOrder+1,player:KB});y.position.copy(o),y.lookAt(0,0,0),y.scale.set(.12,.12,.12);var E=new THREE.Group;E.position.copy(KB.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"))}},{key:"clear",value:function(){$B=null,ek=null,ok=new THREE.Box3,tk=null,nk=null,ik=null,lk=0,ck=[]}}]),i}();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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var zk=function(e){f(n,e);var t=_k(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 ZB(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 Vk(i.app.core.get("Player")):"sds"==Ce.valueFromUrl("ai")&&new Vk(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:"whenReady",value:function(e){var t=this,n=function(t){t(),"function"==typeof e&&e()};return new Promise((function(e){t.ready?n(e):t.once("ready",(function(){return n(e)}))}))}},{key:"whenLoaded",value:function(e){var t=this,n=function(t){t(),"function"==typeof e&&e()};return new Promise((function(e){t.loaded?n(e):t.once("loaded",(function(){return n(e)}))}))}},{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}(mr),Nk=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}(),Uk=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 Gk(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var jk=K("render"),Wk=function(e){f(n,e);var t=Gk(n);function n(e){var i;return o(this,n),i=t.call(this),Object.defineProperty(h(i),jk,{value:qk}),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(Xo,Z(h(i),jk)[jk].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}(mr);function qk(){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 r=tt.getPos2d(t.position,e.player);r.trueSide?tt.ifShelter(t.position,e.player,{x:r.vector.x,y:r.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=r.pos.x,t.y=r.pos.y,t.visible=!0):t.visible=!1:t.visible=!1}})),this.emit("render",{marks:t,mode:n,floorId:i})}}U('@-webkit-keyframes ruler-point {\r\n 0% {\r\n height: 0\r\n }\r\n\r\n to {\r\n height: 11.375px\r\n }\r\n}\r\n\r\n@keyframes ruler-point {\r\n 0% {\r\n height: 0\r\n }\r\n\r\n to {\r\n height: 11.375px\r\n }\r\n}\r\n\r\n@-webkit-keyframes ruler-label {\r\n 0% {\r\n max-width: 0\r\n }\r\n\r\n to {\r\n max-width: 131.25px\r\n }\r\n}\r\n\r\n@keyframes ruler-label {\r\n 0% {\r\n max-width: 0\r\n }\r\n\r\n to {\r\n max-width: 131.25px\r\n }\r\n}\r\n\r\n@-webkit-keyframes door-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0\r\n }\r\n}\r\n\r\n@keyframes door-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0\r\n }\r\n}\r\n\r\n@-webkit-keyframes room-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0\r\n }\r\n}\r\n\r\n@keyframes room-label {\r\n 0% {\r\n opacity: 0;\r\n margin-top: 8.75px\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n margin-top: 0\r\n }\r\n}\r\n\r\n@-webkit-keyframes ruler-line {\r\n 0% {\r\n width: 0\r\n }\r\n\r\n to {\r\n width: 100%\r\n }\r\n}\r\n\r\n@keyframes ruler-line {\r\n 0% {\r\n width: 0\r\n }\r\n\r\n to {\r\n width: 100%\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n.widgets-design-option {\r\n width: 100%;\r\n height: 100%;\r\n z-index: 4;\r\n position: absolute;\r\n user-select: none;\r\n overflow: hidden;\r\n pointer-events: none;\r\n left: 0;\r\n top: 0;\r\n }\r\n .widgets-design-option i {\r\n margin: 0 5px;\r\n }\r\n .widgets-design-option i:before {\r\n font-family: "iconfont" !important;\r\n font-size: 32px;\r\n line-height: 36px;\r\n font-style: normal;\r\n }\r\n .widgets-design-option li {\r\n cursor: pointer;\r\n }\r\n .widgets-design-option > div {\r\n height: 36px;\r\n background: #262729;\r\n position: absolute;\r\n transform: translate(-100%, -50%) translateX(-15px);\r\n border-top-left-radius: 18px;\r\n border-bottom-left-radius: 18px;\r\n padding-left: 10px;\r\n pointer-events: auto;\r\n box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.4);\r\n }\r\n .widgets-design-option > div:after {\r\n position: absolute;\r\n right: -15px;\r\n top: 0;\r\n content: "";\r\n width: 0;\r\n height: 0;\r\n border-style: solid;\r\n border-width: 18px 0 18px 15px;\r\n border-color: transparent transparent transparent #262729;\r\n }\r\n .widgets-design-option.right > div {\r\n transform: translate(15px, -50%);\r\n border-top-left-radius: 0;\r\n border-bottom-left-radius: 0;\r\n border-top-right-radius: 18px;\r\n border-bottom-right-radius: 18px;\r\n padding: 0 10px 0 0;\r\n }\r\n .widgets-design-option.right > div:after {\r\n right: auto;\r\n left: -15px;\r\n border-width: 18px 15px 18px 0;\r\n border-color: transparent #262729 transparent transparent;\r\n }\r\n .widgets-design-option .delete-ruler li {\r\n line-height: 36px;\r\n padding: 0 10px;\r\n word-break: keep-all;\r\n list-style: none;\r\n }\r\n \r\n .widgets-rulers {\r\n position: absolute;\r\n pointer-events: none;\r\n top: 0;\r\n left: 0;\r\n bottom: 0;\r\n right: 0;\r\n}\r\n\r\n.widgets-rulers .ruler-line {\r\n position: absolute;\r\n -webkit-transform-origin: left 0.875px;\r\n transform-origin: left 0.875px;\r\n width: 0;\r\n height: 1.75px;\r\n}\r\n\r\n.widgets-rulers .ruler-line em {\r\n background: linear-gradient(90deg, hsla(0, 0%, 100%, 0.5), hsla(0, 0%, 100%, 0.3));\r\n display: block;\r\n height: 100%;\r\n -webkit-animation: ruler-line 0.5s ease 1s;\r\n animation: ruler-line 0.5s ease 1s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n -webkit-box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\r\n box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\r\n}\r\n\r\n.widgets-rulers .ruler-label {\r\n position: absolute;\r\n /* width: 0; */\r\n height: 0;\r\n top: 0.875px;\r\n left: 38%;\r\n color: #fff;\r\n}\r\n\r\n.widgets-rulers .ruler-label .ruler-label-point {\r\n position: absolute;\r\n width: 28px;\r\n height: 11.375px;\r\n right: 0;\r\n bottom: 0;\r\n background-position: bottom;\r\n background-repeat: no-repeat;\r\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjM0cHgiIGhlaWdodD0iMTVweCIgdmlld0JveD0iMCAwIDM0IDE1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNDguMiAoNDczMjcpIC0gaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoIC0tPg0KICAgIDx0aXRsZT5Hcm91cCA3PC90aXRsZT4NCiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4NCiAgICA8ZGVmcz4NCiAgICAgICAgPGNpcmNsZSBpZD0icGF0aC0xIiBjeD0iMS41IiBjeT0iMS41IiByPSIxLjUiPjwvY2lyY2xlPg0KICAgICAgICA8ZmlsdGVyIHg9Ii0xMDAuMCUiIHk9Ii0xMDAuMCUiIHdpZHRoPSIzMDAuMCUiIGhlaWdodD0iMzAwLjAlIiBmaWx0ZXJVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIGlkPSJmaWx0ZXItMiI+DQogICAgICAgICAgICA8ZmVPZmZzZXQgZHg9IjAiIGR5PSIwIiBpbj0iU291cmNlQWxwaGEiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIj48L2ZlT2Zmc2V0Pg0KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMSIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPg0KICAgICAgICAgICAgPGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMjk5MzY1OTQyIDAiIHR5cGU9Im1hdHJpeCIgaW49InNoYWRvd0JsdXJPdXRlcjEiPjwvZmVDb2xvck1hdHJpeD4NCiAgICAgICAgPC9maWx0ZXI+DQogICAgPC9kZWZzPg0KICAgIDxnIGlkPSLlm7rlrprnirbmgIEt5Yqg6L29IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNDI3LjAwMDAwMCwgLTI2Ny4wMDAwMDApIj4NCiAgICAgICAgPGcgaWQ9Ikdyb3VwLTciIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQyOS4wMDAwMDAsIDI2OS4wMDAwMDApIj4NCiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zMS41LDEyLjUgTDIxLjUsMS41IiBpZD0iTGluZS1Db3B5LTExIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMC41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4NCiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMS41LDEuNSBMMi41LDEuNSIgaWQ9IkxpbmUtQ29weS0xMiIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjAuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+DQogICAgICAgICAgICA8ZyBpZD0iT3ZhbC02LUNvcHktNiI+DQogICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4NCiAgICAgICAgICAgICAgICA8dXNlIGZpbGw9IiNGRkZGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgeGxpbms6aHJlZj0iI3BhdGgtMSI+PC91c2U+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4=");\r\n background-size: 28px 11.375px;\r\n -webkit-transform: translateZ(0);\r\n transform: translateZ(0);\r\n transform-origin: right center;\r\n -webkit-animation: ruler-point 0.3s ease 1.3s;\r\n animation: ruler-point 0.3s ease 1.3s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n}\r\n\r\n.widgets-rulers .ruler-label .ruler-label-name {\r\n position: absolute;\r\n height: 15.75px;\r\n font-size: 12px;\r\n line-height: 15.75px;\r\n right: 28px;\r\n bottom: 0.875px;\r\n white-space: nowrap;\r\n /* max-width: 0; */\r\n overflow: hidden;\r\n -webkit-animation: ruler-label 1s ease 1.6s;\r\n animation: ruler-label 1s ease 1.6s;\r\n -webkit-animation-fill-mode: both;\r\n animation-fill-mode: both;\r\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\r\n}\r\n\r\n.widgets-rulers .ruler-label.reverse .ruler-label-point {\r\n -webkit-transform: rotateY(180deg);\r\n transform: rotateY(180deg);\r\n}\r\n\r\n.widgets-rulers .ruler-label.reverse .ruler-label-name {\r\n /* -webkit-transform: rotateY(-180deg); */\r\n /* transform: rotateY(-180deg); */\r\n right: auto;\r\n left: 28px;\r\n}\r\n\r\n.widgets-rulers .measure .ruler-label .ruler-label-name {\r\n color: #f0ff00;\r\n}\r\n\r\n.widgets-rulers .ruler-intersection {\r\n position: absolute;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\n.widgets-rulers .ruler-intersection .ruler-intersection-point {\r\n position: absolute;\r\n left: 0;\r\n bottom: 0;\r\n width: 18.375px;\r\n height: 7px;\r\n background-repeat: no-repeat;\r\n background-size: 18.375px 7px;\r\n background-position: 50%;\r\n}\r\n\r\n.widgets-rulers .ruler-intersection .ruler-intersection-text {\r\n position: absolute;\r\n left: 18.375px;\r\n bottom: 0;\r\n font-size: 12px;\r\n line-height: 12px;\r\n white-space: nowrap;\r\n color: #12fffb;\r\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.3);\r\n -webkit-transform-origin: left center;\r\n transform-origin: left center;\r\n -webkit-transform: scale(0.85);\r\n transform: scale(0.85);\r\n}\r\n\r\n.measure .ruler-label .ruler-label-name {\r\n font-size: 14px;\r\n line-height: 14px;\r\n}\r\n\r\n.measure .ruler-label {\r\n position: absolute;\r\n}\r\n\r\n.measure .ruler-label .ruler-label-point {\r\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0i5Zu+5bGCXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzQgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM0IDE1OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojRjBGRjAwO3N0cm9rZS13aWR0aDowLjU7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qxe2ZpbHRlcjp1cmwoI2ZpbHRlci0yKTt9DQoJLnN0MntmaWxsOiNGMEZGMDA7fQ0KPC9zdHlsZT4NCjxmaWx0ZXIgIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaGVpZ2h0PSIzMDAuMCUiIGlkPSJmaWx0ZXItMiIgd2lkdGg9IjMwMC4wJSIgeD0iLTEwMC4wJSIgeT0iLTEwMC4wJSI+DQoJPGZlT2Zmc2V0ICBkeD0iMCIgZHk9IjAiIGluPSJTb3VyY2VBbHBoYSIgcmVzdWx0PSJzaGFkb3dPZmZzZXRPdXRlcjEiPjwvZmVPZmZzZXQ+DQoJPGZlR2F1c3NpYW5CbHVyICBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiIHN0ZERldmlhdGlvbj0iMSI+PC9mZUdhdXNzaWFuQmx1cj4NCgk8ZmVDb2xvck1hdHJpeCAgaW49InNoYWRvd0JsdXJPdXRlcjEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMjk5MzY1OTQyIDAiPg0KCQk8L2ZlQ29sb3JNYXRyaXg+DQo8L2ZpbHRlcj4NCjx0aXRsZT5Hcm91cCA3PC90aXRsZT4NCjxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPg0KPHBhdGggaWQ9IkxpbmUtQ29weS0xMSIgY2xhc3M9InN0MCIgZD0iTTMzLjUsMTQuNWwtMTAtMTEiLz4NCjxwYXRoIGlkPSJMaW5lLUNvcHktMTIiIGNsYXNzPSJzdDAiIGQ9Ik0yMy41LDMuNWgtMTkiLz4NCjxnIGlkPSJPdmFsLTYtQ29weS02Ij4NCgk8ZyBjbGFzcz0ic3QxIj4NCgkJPGNpcmNsZSBpZD0icGF0aC0xXzJfIiBjbGFzcz0ic3QyIiBjeD0iMy41IiBjeT0iMy41IiByPSIxLjUiLz4NCgk8L2c+DQoJPGc+DQoJCTxjaXJjbGUgaWQ9InBhdGgtMV8xXyIgY2xhc3M9InN0MiIgY3g9IjMuNSIgY3k9IjMuNSIgcj0iMS41Ii8+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=");\r\n animation-delay: 0.3s;\r\n}\r\n\r\n.measure .ruler-label .ruler-label-name {\r\n animation-delay: 0.6s;\r\n}\r\n',{});var Jk="#f0ff00",Yk=new THREE.Mesh(new THREE.SphereBufferGeometry(.01,10,10),new THREE.MeshBasicMaterial({color:Jk,depthTest:!1,transparent:!0})),Zk=ui.createFatLineMat({linewidth:3,color:Jk});function Xk(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,r=new THREE.Object3D;r.name="measure",this.balls=[Yk.clone(),Yk.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=ze,r.add(this.balls[0]),r.add(this.balls[1]),this.line=ui.createFatLine([this.points[0],this.points[1]],{material:Zk}),this.line.renderOrder=ze,r.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,r.add(this.boldLine),this.player.model.add(r),this.group=r,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)}Xk.prototype.setPoints=function(e){this.points=e},Xk.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),r=new THREE.Raycaster(n.clone(),i.clone().sub(n).normalize(),0,n.distanceTo(i)).intersectObjects(this.player.model.chunks),o=0;o<r.length;o++){var a=r[o].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}}},Xk.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)},Xk.prototype.updateBoldLine=function(){this.player.$app.config.vrFishTemp?ui.updateBoldLine(this.boldLine,this.fishPoints,"moveAndRotate"):ui.updateBoldLine(this.boldLine,this.points,"update")},Xk.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},Xk.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")}},Xk.prototype.getCrossPoint=function(e,t){var n,i,r,o=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>o||t.x<0?(r=t.x>o?o:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>o||n<0)&&(i=c(n=r)):i=c(n=r)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},Xk.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)},Xk.prototype.getPosAtSphere=function(e,t){this.fishPoints=[];var n=[];this.points.forEach(function(t,i){var r=tt.getPosAtSphere(t.clone(),e);this.fishPoints.push(r),n.push(r.x,r.y,r.z),this.balls[i].position.copy(r);var o=Constants.skyRadius/e.distanceTo(t);this.balls[i].scale.set(o,o,o)}.bind(this)),ui.moveFatLine(this.line,n)};function Kk(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}Xk.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),r=tt.getPos2d(i,this.player);if(r.trueSide){var o=e.pos2d.trueSide?e.pos2d:t.pos2d;return r.inSight&&(r.pos=this.getPosInCrossPoint(o.pos,r.pos),r.vector=null),{result:"p1p2",p1:o,p2:r}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:r},++n)}},Xk.prototype.updateVisible=function(e){this.visiblePanos.indexOf(e||this.player.currentPano)>-1?this.state="active":this.state="unable"},Xk.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),r=this.player.domElement.clientWidth,o=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>r||d.x<0||d.y>o||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<r/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 $k=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},eP=function(e){f(n,e);var t=Kk(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 r=i.app.core.get("Player"),o=new THREE.Vector3,a=i.tags.find((function(t){return t.sid==e.sid}))||e.tag,s=i.findBestPanoForWatching(a),l=function(){r.mode===ht.PANORAMA&&i.app.Camera.emit(Ho,{panoId:r.currentPano?r.currentPano.id:null,quaternion:r.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,o.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,o,i.app.dom),o.unproject(r.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==r.currentPano.id&&"panorama"==r.mode){c();var d=new THREE.Vector3(0,0,1).applyQuaternion(r.camera.quaternion).normalize(),p=r.camera.position.clone().sub(a.position).normalize();if(d.dot(p)<0){var f=r.camera.position.clone().sub(o).multiplyScalar(-1);o=r.camera.position.clone().sub(f)}var m=a.x;r.flyToPano({pano:s,lookAtPoint:o,checkAlone:!0,isTagFlying:!0},(function(){m>window.innerWidth/4&&m<window.innerWidth/4*3?l():(c(),r.flyToPano({pano:s,aimDuration:600,lookAtPoint:o},(function(){l()})))}))}else r.flyToPano({pano:s,lookAtPoint:a.position,duration:1e3,checkAlone:!0,isTagFlying:!0},(function(){return setTimeout((function(){c(),r.flyToPano({pano:s,aimDuration:600,lookAtPoint:o})}),10)}))}else r.flyToPano({pano:s,lookAtPoint:a.position,checkAlone:!0,isTagFlying:!0})},i.startMeasure=function(){var e=i.app.core.get("Player");"panorama"==e.mode?(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.app.Camera.panorama().then((function(){return i.startMeasure()}))},i.confirmMeasure=function(e){var t,n=i.app.core.get("Player");if(1==e){var r;i.isSingleView?(r=i.spot3d.position.clone(),i.updateTagPos=!0,i.spot3d.visible=!1):(r=i.editHandle.confirmPos().position,i.editHandle.enter(),n.locked=!1),i.lastPosition=r,i.measureStep=1;var o=r.clone().setY(n.model.currentFloor.boundingBox.min.y),a=Ae.sortByScore(n.model.panos.list,[or.filters.isPanoAligned()],[or.scoreFunctions.distanceSquared(i.currentPano,-.6)]);a[0]&&o.setY(a[0].item.floorPosition.y);var s=ui.createLine([r,o],{width:2,color:"#09e1c0"});n.model.add(s);var l=new THREE.Mesh(new THREE.CircleGeometry(.08,32),new THREE.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.6,depthTest:!1}));l.position.copy(o),l.position.y+=.002,l.lookAt(o.clone().add(new THREE.Vector3(0,1,0))),n.model.add(l),t=n.currentPano;var c=document.createElement("div");c.className="visible",c.id="measureTag",c.innerHTML='<span class="point zoom" style="background-image: url('.concat($n.getImageURL("images/tag_icon_default.svg"),');"></span>');var u=i.convertPositionTo2D(r).pos;c.style.left=u.x+"px",c.style.top=u.y+"px",c.style.setProperty("display","block","important"),document.querySelector("div[xui_tags]").appendChild(c),i.measurePointTemp={measureTag:c,stemLine:s,shadow:l}}else if(2==e){var h,d=(h=i.isSingleView?i.spot3d.position.clone():i.editHandle.confirmPos().position).distanceTo(i.lastPosition),p=Math.max(5,6*d),f=.3,m=i.getVisiblePano(i.lastPosition,p,f),v=i.getVisiblePano(h,p,f),g=Ae.getUnionSet(m,v);0==g.length&&(f=1,m=i.getVisiblePano(i.lastPosition,p,f),v=i.getVisiblePano(h,p,f),g=Ae.getUnionSet(m,v));var A=new Xk({points:[i.lastPosition,h],visiblePanos:g,state:"active"},n);n.chosenMeasureRuler=A,A.visiblePanos.includes(n.currentPano)||A.visiblePanos.push(n.currentPano),A.visiblePanos.includes(t)||A.visiblePanos.push(t),n.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine(),e.update()}))}},i.cancelMeasure=function(){var e=i.app.core.get("Player");if(i.measurePointTemp){var t=i.measurePointTemp,n=t.measureTag,r=t.stemLine,o=t.shadow;document.querySelector("div[xui_tags]").removeChild(n),r.geometry.dispose(),r.material.dispose(),e.model.remove(r),o.geometry.dispose(),o.material.dispose(),e.model.remove(o),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"),r=new THREE.Vector3(0,-1,0),o=new THREE.Raycaster(new THREE.Vector3(0,0,0),r,.001,9999);i.tags.forEach((function(e){if(null==e.floorIndex){o.set(e.position,r);var t=o.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 r=e.core.get("Player");r.locked=!0,r.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,r.camera,e,r.domElement),he.convertScreenPositionToNDC(e.x,e.y,n,r.domElement);var o=r.getMouseIntersect(n,r.OverlayManager.group.children.concat(r.model.colliders));o&&(i.spot3d.lookAt(o.normal.add(i.spot3d.position)),i.spot3d.topMesh.lookAt(r.camera.position))}),10)):(i.updateTagPos=!0,i.spot3d.position.set(0,1e3,0))}else e.core.get("Scene").getSplit("TAG").then((function(r){null==i.editHandle&&(i.editHandle=e.withNewComponent("TagEditManager",r,{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 r=document.querySelector(".widgets-design-option div");r&&r.addEventListener("pointerup",(function(e){e.stopPropagation(),t.chosenMeasureRuler.remove(),t.chosenMeasureRuler.showOptionLabel(!1)}));var o=i.app.store.getValue("metadata");o?i.isSingleView="laser"==o.sceneFrom:i.app.store.on("metadata",(function(e){return i.isSingleView="laser"==e.sceneFrom})),i.isSingleView&&(i.spot3d=new _B(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),r=i.measurePointTemp.measureTag;r.style.left=n.pos.x+"px",r.style.top=n.pos.y+"px",r.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 o=function(e,t){e.visible!=t&&(e.visible=t)};i.tags.forEach((function(n){if(n.isLose||!1===i.showTags)return o(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 o(n,!1)}else if(-1==a.indexOf(t.mode))return o(n,!1);if(Je.vrEnabled&&Je.vrSplitScreen)return o(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 o(n,!1)}if(t.linkEditor.setTagVisible&&n.floorIndex!=t.model.currentFloor.floorIndex&&t.linkEditor.tagVsetting!=n)return o(n,!1);var r=e.TagManager.convertPositionTo2D(n.position);if(!r.trueSide||!r.inSight)return o(n,!1);n.x=r.pos.x,n.y=r.pos.y,o(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 r=he.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(r,r,r)}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 r=he.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(r,r,r),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 r=t.tags.find((function(t){return t.sid==e}));if(!r)return i();if(t.emit("focus",e,t.focusId),e==t.focusId&&n.checkSameTag)return t.focusId="",i();t.focusId=e;var o=t.player||t.app.core.get("Player"),a=o.model.panos.closestPanoTowardPoint({point:r.position,getAll:!0}).map((function(e){return e.item})).filter((function(e){return r.visiblePanos.indexOf(e)>-1&&e.position.clone().setY(r.position.y).sub(r.position).length()>1.5})),s=a[0],l=a.filter((function(e){return e.floorIndex==o.model.currentFloor.floorIndex}));if(l.length>0&&(s=l[0]),s||(console.warn("该热点无可视点位"),s=o.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($k(u,"margin-left"))+parseInt($k(u,"margin-right")),height:(u.clientHeight||0)+parseInt($k(u,"margin-top"))+parseInt($k(u,"margin-bottom"))}}var h=new THREE.Vector3,d=function(){r.x=t.app.TagManager.convertPositionTo2D(r.position).pos.x,r.y=t.app.TagManager.convertPositionTo2D(r.position).pos.y,h.set(0,0,0);var e=r.x-("left"==n.direction?c.width/2:0),i=r.y-("top"==n.direction?c.height/2:0);t.app.TagManager.convertScreenPositionToNDC(e,i,h,t.app.dom),h.unproject(o.camera)};if(s.id==o.currentPano.id&&"panorama"==o.mode){d();var p=new THREE.Vector3(0,0,1).applyQuaternion(o.camera.quaternion).normalize(),f=o.camera.position.clone().sub(r.position).normalize();if(p.dot(f)<0){var m=o.camera.position.clone().sub(h).multiplyScalar(-1);h=o.camera.position.clone().sub(m)}r.x,o.flyToPano({pano:s,lookAtPoint:h,duration:1e3,isTagFlying:!0},(function(){setTimeout((function(){d(),o.flyToPano({pano:s,aimDuration:500,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else o.flyToPano({pano:s,lookAtPoint:r.position,duration:1e3,isTagFlying:!0},(function(){return setTimeout((function(){d(),o.flyToPano({pano:s,aimDuration:400,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else o.flyToPano({pano:s,lookAtPoint:r.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 r=n.filter((function(e){return e.floorIndex==t.model.currentFloor.floorIndex}));r.length>0&&(n=r);var o=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),r=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(r)<Math.PI/4}))),n.length>0&&(o=n[0]),o||(console.warn("该热点无可视点位"),o=t.currentPano),o}},{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}(mr),tP=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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var iP=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 gs(i),i.OverlayManager=new ms(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 r=n.getOverlayBySid(e);i.EditOverlay.DeleteOverlay(r,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 r=n.getOverlayBySid(e);t?r.show("forceHide"):r.hide("forceHide"),i.EditOverlay.editPlane&&i.EditOverlay.controlSelectOverlay(r.visible?r: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}(),rP=function(e){f(n,e);var t=nP(n);function n(e){var i;return o(this,n),(i=t.call(this)).BoxVideo=new iP(e),i}return n}(mr);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var aP=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.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).linkEditor=new Cs(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:ws.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}(mr);function sP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var lP=function(e){f(n,e);var t=sP(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}(mr);function cP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var uP,hP=window.navigator.userAgent,dP=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==hP.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}(),pP=function(e){f(i,e);var t,n=cP(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 dP(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(IB(xB(t.enter.cover),"tour-enter-".concat(t.sid,".jpg"))),t.exit&&t.exit.cover&&0===t.exit.cover.indexOf("data:image")&&e.push(IB(xB(t.enter.cover),"tour-exit-".concat(t.sid,".jpg")))}))})),{tours:t,files:e}}}]),i}(mr);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var mP=.7,vP=3,gP=1.78,AP=function(e){f(n,e);var t=fP(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,!(uP=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,r=arguments.length>1?arguments[1]:void 0;if(uP.lastFrameChanged||r){var o=uP.cameraControls.activeControl;if("dollhouse"==uP.mode){var a=o.camera.position.distanceTo(o.target),s=he.linearClamp(a,o.minDistance,Math.max(o.maxDistance/2,o.minDistance+3),vP,mP);e(s)}else if("floorplan"==uP.mode&&i.cameraProjectionChanged){var l=o.getDefaultAbsoluteScale(uP.model.size),c=Math.max(Je.zoomNearLimit,.5*l),u=Math.min(Je.zoomFarLimit,2.5*l),h=he.linearClamp(o.absoluteScale,c,u,vP,mP);e(h)}}}},uP.on("zoomTo",this.eventList.zoomTo),uP.on("setSize",this.eventList.setSize),uP.on("update",this.eventList.update),this.eventList.zoomTo(uP.zoomLevel),this.eventList.update(0,!0),Je.highestQualityTile=!0}}},{key:"leave",value:function(){this.editing=!1,console.log("退出,恢复"),uP&&(uP.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,uP.off("zoomTo",this.eventList.zoomTo),uP.off("setSize",this.eventList.setSize),uP.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<gP){var r=i/gP;uP.domElement.style.height="".concat(r,"px"),uP.domElement.style.top=(n-r)/2+t+"px"}else uP.domElement.style.top="".concat(t,"px"),uP.domElement.style.height="calc(100% - ".concat(t,"px)")}else uP.domElement.style.top=0,uP.domElement.style.height="100%"}},{key:"waitTexLoaded",value:function(e){var t=this;if("panorama"==uP.mode){if(!uP.currentPano||uP.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(uP.quaternion),r=uP.cameraControls.activeControl.camera,o=r.fov,a=na.getHFOVForCamera(r,r.aspect,1),s=uP.currentPano.loadTiledPano(n,i,{hFov:a,vFov:o},!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"!=uP.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=uP.cameraControls.activeControl.camera.fov/180*e,n=t*gP;return{width:Math.round(n),height:Math.round(t)}}},{key:"listenZoomLevel",value:function(e){}},{key:"onResetCamera",value:function(){"panorama"==uP.mode&&(uP.cameraControls.activeControl.lat=0)}},{key:"onResumeSize",value:function(){var e=this;if(uP){var t=uP.cameraControls.activeControl;if("transitioning"==uP.mode)return uP.once("mode.changed",(function(t,n){e.editing&&e.onResumeSize()}));"panorama"==uP.mode?uP.zoomTo(1):"dollhouse"==uP.mode?(t.target.copy(uP.model.center),this.onRangeChange({value:100})):"floorplan"==uP.mode&&(t.target.setX(uP.model.center.x),t.target.setZ(uP.model.center.z),t.camera.position.setX(uP.model.center.x),t.camera.position.setZ(uP.model.center.z),t.rotateToView(uP.model.size,uP.getDirection()),t.zoomToContain(uP.model.size))}}},{key:"onRangeChange",value:function(e){var t=this;this.temp.onRangeChange=e;var n=uP.cameraControls.activeControl,i=Math.round(e.value)/100;if(i<mP?(i=mP,this.eventList.zoomTo(i)):i>vP&&(i=vP,this.eventList.zoomTo(i)),"transitioning"==uP.mode)return uP.once("mode.changed",(function(e,n){t.editing&&t.onRangeChange(t.temp.onRangeChange)}));if("panorama"==uP.mode)Je.zoom.enabled=!0,uP.zoomTo(i);else if("dollhouse"==uP.mode){var r=he.linearClamp(i,mP,vP,Math.max(n.maxDistance/2,n.minDistance+3),n.minDistance);n.camera.position.copy(n.target).add(uP.getDirection().multiplyScalar(-r))}else if("floorplan"==uP.mode){var o=n.getDefaultAbsoluteScale(uP.model.size),a=Math.max(Je.zoomNearLimit,.5*o),s=Math.min(Je.zoomFarLimit,2.5*o);n.absoluteScale=he.linearClamp(i,mP,vP,s,a)}}},{key:"imgAddLabel",value:function(e,t,n){var i=new Image,r=new Image;i.setAttribute("crossOrigin","Anonymous"),r.setAttribute("crossOrigin","Anonymous"),i.src=e,r.src=t;var o=0,a=vt();return i.onload=r.onload=function(){2==++o&&(n.opacity/=100,a.resolve(Ae.imgAddLabel(i,r,n)))},a.promise()}}]),n}(mr),yP=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,r,o=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[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 IB(e.data,"thumb-".concat(e.name,".jpg"))}))},r=null,e.prev=6,e.next=9,this.app.remote_editor.upload_files(i);case 9:r=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(r.success){e.next=17;break}return e.abrupt("return",Promise.reject(r));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 r=e.sent,e.abrupt("return",r);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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var wP=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.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,r=e.ele;this.player=this.app.core.get("Player"),this.$paint=this.elem(r),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),r=t-this._lastTimestamp,o=this.calcLineWidth(r,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:o,x:n.x,y:n.y,t:5}),this.context.strokeStyle=this.colors[this.role]||"#00c8af",this.context.lineWidth=o,this.context.lineCap="round",this.context.linJoin="round",this.context.stroke(),this._lastPosition=n,this._lastTimestamp=t,this._lastLineWidth=o}},{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())},r=0;r<e.length-1;r++)i(r)}},{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}(mr);function bP(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 CP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var xP="rotate",IP="zoom",TP="endRotation",BP="moveModel",kP="flying.started",PP="flying.ended",RP=function(e){f(n,e);var t=CP(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,t=this,n=this.app.core.get("Player");"leader"==this.role?(this.app.Camera.on(kP,(function(e){return t.emitData(e)})),this.app.Camera.on(IP,(function(e){return t.emitData(e)})),this.app.Camera.on(BP,(function(e){return t.emitData(e)})),n.viewLinkManager.addEventListener("loaded",(function(){t.started&&n.viewLinkManager.hideAllViews()})),this.app.Camera.on(xP,(function(n){t.emitData(n),clearTimeout(e),e=null})),this.app.Camera.on(TP,(function(i){t.emitData(i);var r=0,o=20;e=function(){t.emitData({type:"syncRotContinue",quaternion:n.quaternion}),r++<10&&e&&"panorama"==n.mode&&setTimeout(e,o+=20)},setTimeout(e,o)}))):this.app.Camera.on(PP,this.requestSync.bind(this))}},{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"),t=e.modeTran.split("-")[1];if(t===ht.PANORAMA){var n=null;e.mode==ht.PANORAMA&&null!=e.nextPano?n=e.nextPano.id:e.currentPano&&(n=e.currentPano.id),this.emitData({panoId:n,quaternion:e.quaternion,mode:t,type:"flyToPano"})}else{var i={quaternion:e.quaternion,position:e.position,currentScale:e.cameraControls.controls.floorplan.currentScale,mode:t,type:"flyToNewMode"};e.cameraControls.activeControl&&(i.target={x:e.cameraControls.activeControl.target.x,y:e.cameraControls.activeControl.target.y,z:e.cameraControls.activeControl.target.z}),this.emitData(i)}}},{key:"requestSync",value:function(e){var t=this;setTimeout((function(){t.emitData({type:"requestSync"})}),1)}},{key:"emitData",value:function(e){var t=this.app.core.get("Player");if("receive"!=t.syncType){if(this.started){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?bP(Object(n),!0).forEach((function(t){nh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bP(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}(mr);function MP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var SP=function(e){f(n,e);var t=MP(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.lockedForce=!0;var n=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w),i=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(i)},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)],r={};r.pano=i,e.quaternion&&(r.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(r);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.lockedForce=!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}(RP);function DP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var FP,LP,QP=function(e){f(n,e);var t=DP(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)],r=t.locked;return t.locked=!1,t.flyToPano({pano:i},n),t.locked=r,!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){this.stopLerpQua(t),this.pauseSyncRot=!1;var n=t.cameraControls.activeControl.camera.quaternion.clone(),i=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);this.endQuaternion=i;var r=Date.now();r-this.lastUpdateTime>100?this.lerpRatio=.1:(this.lerpRatio+=.15,this.lerpRatio=Math.min(1,this.lerpRatio)),It.quaternion(n,i)(this.lerpRatio);var o=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(o),t.cameraControls.activeControl.locked=!1,t.cameraControls.activeControl.update(0),t.cameraControls.activeControl.lockedForce=!0,this.lastUpdateTime=r},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.lastUpdateTime=0,i.lerpRatio=1,i}return u(n,[{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.role=t.follow?"follow":"leader",At(w(n.prototype),"start",this).call(this),t.follow){var i=this.app.core.get("Player");i.locked=!0,this.inited||(i.on(Ho,(function(t){e.pauseSyncRot=!0,e.stopLerpQua(i)})),this.inited=!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,n=this.app.core.get("Player"),i=!0;if(this.transform(e),"leader"==this.role)switch(e.type){case"requestSync":this.sync()}else switch(e.type){case"flyToPano":if(n.panosTaskList.length>0)return setTimeout((function(){t.requestSync()}),500);var r=n.model.panos.index[parseInt(e.panoId)];n.locked=!1;var o={pano:r};e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),"panorama"==n.mode&&n.currentPano.id==e.panoId&&(o.aimDuration=0),n.flyToPano(o,(function(){n.locked=!0}));break;case"flyToNewMode":if(console.log("flyToNewMode",e.mode),e.mode==n.mode)return e.type="moveModel",e.info={scale:e.currentScale,target:e.target,position:e.position,quaternion:e.quaternion},this.receive(e);e.panoId&&(e.pano=n.model.panos.index[parseInt(e.panoId)]),n.locked=!1,e.callback=function(){n.locked=!0},n.flyToNewMode(e);break;case"rotate":n.model.mode==ht.PANORAMA&&(i=this.toSame(e,n,function(){this.syncRotate(e,n)}.bind(this)))&&this.syncRotate(e,n);break;case"endRotation":n.cameraControls&&n.cameraControls.activeControl&&(n.cameraControls.activeControl.lockedForce=!1);break;case"syncRotContinue":n.cameraControls&&n.cameraControls.activeControl&&this.syncRotate2(e,n);break;case"zoom":null==(i=this.toSame(e,n,function(){n.handleControlScroll(e.zoom)}.bind(this)))||i&&n.handleControlScroll(e.zoom);break;case"moveModel":null==(i=this.toSame(e,n,function(){this.copyCameraProp(n,e.info)}.bind(this)))||i&&(n.cameraControls.activeControl.lockedForce=!0,n.locked=!0,this.copyCameraProp(n,e.info),n.cameraControls.activeControl.locked=!1,n.mode==ht.PANORAMA&&(n.locked=!1))}}},{key:"syncRotate2",value:function(e,t){var n=this;if(!this.pauseSyncRot&&"panorama"==t.mode){var i=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w),r=Date.now();this.lerpQuaFun&&this.stopLerpQua(t),this.lerpQuaFun=function(){if(!t.cameraControls.activeControl)return n.stopLerpQua(t);var e=t.quaternion.clone();It.quaternion(e,i)(.1);var o=new THREE.Vector3(0,0,-1).applyQuaternion(e).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(o),Date.now()-r>500&&n.stopLerpQua(t)},t.on("update",this.lerpQuaFun)}}},{key:"stopLerpQua",value:function(e){e.off("update",this.lerpQuaFun),this.lerpQuaFun=null}}]),n}(RP),HP=function e(t){o(this,e),this.sync=new SP(t),this.follow=new QP(t),this.paint=new wP(t)};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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var VP,_P={},zP=function(e){f(n,THREE.EventDispatcher);var t=OP(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.app.Scene.on("loaded",(function(){FP=i.app.core.get("Player"),LP=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;VP=Math.max(2*Math.sqrt(FP.model.size.x*FP.model.size.x+FP.model.size.y*FP.model.size.y),30),FP.model.floors.list.forEach((function(e){var t=0;e.panos.forEach((function(e){t+=e.position.y})),t/=e.panos.length,_P[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(FP.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})}),FP.model.add(this.linkLine),this.linkLine2=ui.createFatLine(t,{material:ui.createFatLineMat({lineWidth:3,opacity:.2,color:"#30FFDF"})}),FP.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&&(FP.viewLinkManager.hoverBalloon&&e.markView.balloon==FP.viewLinkManager.hoverBalloon&&e.dragBalloonStart(),FP.viewLinkManager.hoverExit?e.dragExitStart():FP.viewLinkManager.hoverCircle&&e.dragViewStart(FP.viewLinkManager.hoverCircle.mesh))},dragEnd:function(t){e.handelDragEnd(t)},lookAim:function(){FP.on("ifFocusPoint",(function(t){if(e.editing&&e.markView){t.importance<3&&(t.importance=3,t.aim=e.markView.circle.mesh.position.clone())}}))}},FP.viewLinkManager.dispatchEvent({type:"getViewLinkEdit",v:this}),FP.viewLinkManager.addEventListener("changeIntersect",(function(t){e.dispatchEvent({type:"changeIntersect",hovered:t.hovered})})),this.inited=!0}},{key:"enter",value:function(){this.editing=!0,LP&&(FP.model.on("floor.changed",this.events.changeFloor),FP.on("pointerStart",this.events.dragStart),FP.on("pointerMove",this.events.movePos),FP.on("pointerUp",this.events.dragEnd),FP.on("ifFocusPoint",this.events.lookAim))}},{key:"leave",value:function(){this.editing=!1,LP&&(LP.removeComponent(this),FP.model.off("floor.changed",this.events.changeFloor),FP.off("pointerStart",this.events.dragStart),FP.off("pointerUp",this.events.dragEnd),FP.off("pointerMove",this.events.movePos),FP.off("ifFocusPoint",this.events.lookAim))}},{key:"setSize",value:function(e,t){this.inited}},{key:"checkCanAddView",value:function(){return this.inited&&!FP.flying&&FP.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=FP.cameraControls.controls.dollhouse;t.target.set(0,0,0),t.camera.position.setY(50),t.resetRanges()}if(this.checkCanAddView()){FP.mode===ht.FLOORPLAN&&FP.model.floorplanCadImg.hideCadPlane(),this.markView=new al({sid:"view360_"+Ae.getRandomSid()},this.app),FP.viewLinkManager.addView(this.markView);var n=function(){e.markView.balloon.showOrHide(!0,0),FP.updateFromControls(),e.beginSetPos(),e.setEditState(!0),os.add("viewChoosePos")};FP.isOutsideMode()?n():FP.flyToMode("floorplan",n)}else var i=setInterval((function(){e.checkCanAddView()&&(e.addView(),clearInterval(i))}),50)}},{key:"reEditView",value:function(e){this.markView=FP.viewLinkManager.views[e],this.oldData=this.getData(),this.reEdit=!0,this.setEditState(!0),this.markView.circle.mesh.visible=!0,FP.viewLinkManager.focusOn(this.markView),"dollhouse"!=FP.mode&&"floorplan"!=FP.mode||this.markView.balloon.showOrHide(!0,0),FP.mode===ht.FLOORPLAN&&FP.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),FP.emit("editViewStateChange",e)}},{key:"exit",value:function(){this.markView&&(this.stopSetPos(),this.cancelSetExit(),this.cancelSetEntry(),this.markView.circle.setSelect(!1),"panorama"!=FP.modeTran.split("-")[1]&&(this.markView.circle.mesh.visible=!1),this.markView.balloon.showOrHide(null,50,"auto"),this.setEditState(!1),FP.mode===ht.FLOORPLAN&&FP.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()):(FP.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){FP.model.panos.forEach((function(t){if(t.isAligned()){var n=e&&(FP.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(FP.camera,!0),this.markView.circle.mesh.visible=!1,this.placeGround(),"reset"!=e&&this.movePos("init"),FP.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),FP.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:Math.round(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),FP.viewLinkManager.focusOn(this.markView)}},{key:"focusView",value:function(e){var t=FP.viewLinkManager.views[e];FP.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=FP.model.center.clone();if(!(d=FP.getMouseIntersect(null,[this.ground])))return void console.error("no intersect");if(FP.model.allFloorsVisible)"init"!=e&&t.setY(this.markView.balloon.mesh.position.y);else{if(0==FP.model.currentFloor.panos.length)return console.warn("该层无漫游点!"),void this.stopSetPos();t.setY(_P[FP.model.currentFloor.floorIndex])}var n=tt.getPosAtPlane(d.point,FP,{y:t.y});n||((n=tt.getPosAtPlane(d.point,FP,{y:100})).y=t.y),n&&n.distanceTo(t)>VP&&(n=t.clone().add(n.clone().sub(t).normalize().multiplyScalar(VP)));var i=this.markView.circle.mesh.quaternion.clone(),r=Ae.sortByScore(FP.model.panos.list,[or.filters.isPanoAligned(),function(e){return FP.model.allFloorsVisible||e.floor==FP.model.currentFloor}],[function(e){return-n.distanceTo(e.position)}])[0].item,o=r.position.clone();if(this.markView.nearestPano=r,n.setY(o.y),this.markView.balloon.mesh.position.copy(n),this.markView.balloon.update(),d=tt.ifIntersectChunks(o,n,FP.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(r.position).setY(0).normalize().multiplyScalar(Je.boundExpandLength);p=o.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),o.distanceTo(p)<o.distanceTo(u))h=[o,p];else h=[o,u];ui.moveFatLine(this.linkLine2,h),this.linkLine.visible=!0,this.linkLine2.visible=!0}else if(this.draggingExit){var d=FP.getMouseIntersect(null,[FP.model.skybox]);this.markView.exitDoor.mesh.position.copy(d.point.clone().normalize().multiplyScalar(Je.view360.circleDisToCenter))}else if(this.draggingCircleAtView)if(this.settingVisibles){d=FP.getMouseIntersect(null,[FP.model.skybox]);this.draggingMesh.position.copy(d.point.clone().normalize().multiplyScalar(Je.view360.circleDisToCenter)),this.saveVisibleViews()}else{var p;o=FP.position.clone();if((d=tt.getMouseIntersect(FP.camera,FP.model.colliders.concat(FP.model.skybox),FP.mouse)).object==FP.model.skybox){s=d.point.clone().sub(o).normalize().multiplyScalar(Je.boundExpandLength);p=o.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);FP.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=FP.currentPano}}},{key:"placeGround",value:function(){this.ground.position.copy(this.markView.balloon.mesh.position),this.ground.lookAt(this.ground.position.clone().add(FP.getDirection(null,FP.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}}),FP.viewLinkManager.views[e].circle.setMapOut(t)}},{key:"setExitMap",value:function(e,t){console.log("setExitMap",e,t),"object"==typeof t&&(t={style:{exit:t}}),FP.viewLinkManager.views[e].exitDoor.setMapOut(t)}},{key:"deleteView",value:function(e){try{FP.viewLinkManager.views[e].dispose(),FP.viewLinkManager.removeView(FP.viewLinkManager.views[e])}catch(e){console.log(e)}}},{key:"enterView",value:function(e){var t=this,n=function(){e&&e()};FP.flying?FP.once("flying.ended",(function(){t.enterView(e)})):FP.currentPano==this.markView.pano&&"panorama"==FP.mode?n():this.markView.enter360Pano(n)}},{key:"exitView",value:function(){return new Promise((function(e,t){FP.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(),FP.flyToPano({pano:FP.currentPano,quaternion:e.markView.enterQuaternion,rotSpeed:2})})),t.promise()}},{key:"confirmEntry",value:function(){FP.currentPano==this.markView.pano&&(this.markView.pano.quaternion.copy(FP.quaternion),this.markView.enterQuaternion.copy(FP.quaternion),this.markView.mapChangeRot(),this.dispatchEvent({type:"confirmEntry",sid:this.markView.sid,enterQuaternion:FP.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(),FP.flyToPano({pano:FP.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=FP.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=FP.viewLinkManager.views[e];n.circle.mesh.visible=!0,FP.handleInputStart(t.offsetX,t.offsetY,!0,!0);var i=FP.getMouseIntersect(null,[FP.model.skybox]);n.circle.updatePos("at360View",{viewDir:i.point.clone()}),n.circle.update(FP.camera),this.saveVisibleViews()}},{key:"delVisibleView",value:function(e){delete this.markView.visibleViews[e],FP.viewLinkManager.views[e].circle.mesh.visible=!1,this.saveVisibleViews()}},{key:"saveVisibleViews",value:function(){var e={};for(var t in FP.viewLinkManager.views)FP.viewLinkManager.views[t].circle.mesh.visible&&(e[t]=FP.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,FP.cameraControls.activeControl.enabled=!1)}},{key:"dragExitStart",value:function(){this.settingExit&&(this.draggingExit=!0,FP.cameraControls.activeControl.enabled=!1)}},{key:"dragViewStart",value:function(e){(this.settingVisibles||this.markView&&e==this.markView.circle.mesh)&&(this.draggingCircleAtView=!0,this.draggingMesh=e,FP.cameraControls.activeControl.enabled=!1)}},{key:"handelDragEnd",value:function(e){FP.flying||(this.draggingBall||this.draggingExit||this.draggingCircleAtView)&&(this.draggingBall?(this.draggingBall=!1,this.settingPos&&this.confirmPos(),e.consume()):this.draggingExit?(this.draggingExit=!1,FP.cameraControls.activeControl.pointerDragOn=!1,e.consume()):this.draggingCircleAtView&&(this.draggingCircleAtView=!1,FP.cameraControls.activeControl.pointerDragOn=!1,this.confirmPos(),e.consume()),this.draggingMesh=null,FP.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?FP.viewLinkManager.showAllViews():setTimeout((function(){e.showAll()}),200)}},{key:"hideAll",value:function(){var e=this;this.inited?FP.viewLinkManager.hideAllViews():setTimeout((function(){e.hideAll()}),200)}},{key:"highlight",value:function(e){var t=FP.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 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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var UP=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.filterTemp={},i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).on(Uo,(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(r){r.uniforms.filterBase0.value.set(n.brightness,n.contrast,n.saturation),r.uniforms.filterTemperature0.value=n.temperature,r.uniforms.filterBase1.value.set(i.brightness,i.contrast,i.saturation),r.uniforms.filterTemperature1.value=i.temperature,e.hasFilter||t.hasFilter?r.defines.hasFilter=!0:delete r.defines.hasFilter,r.needsUpdate=!0}))}},{key:"getPanoMaterials",value:function(){var e=this.app.core.get("Player"),t=[this.app.core.get("QuickstartManager").skybox.material].concat(Q(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,Q(e.model.highMapCube.tiles.map((function(e){return e.material})))),t}}]),n}(mr);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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var jP,WP,qP=function(e){f(n,e);var t=GP(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),r=i.map((function(t){return e.player1.model.panos.index[t].position})),o=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(r[(s+1)%a]),u=(new THREE.Vector3).copy(o[s]),h=(new THREE.Vector3).copy(o[(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 r=t.cameraControls.activeControl,o=n.cameraControls.activeControl;if(t.quaternion.copy(n.quaternion).premultiply(i),"panorama"==t.mode){var a=(new THREE.Vector3).subVectors(o.target,n.position);a.applyQuaternion(i);var s=(new THREE.Vector3).addVectors(t.position,a);r.lookAt(s),r.target.copy(s)}else if(o){var l=(new THREE.Vector3).subVectors(o.target,n.model.panos.list[0].position);l.applyQuaternion(i),r.target.addVectors(t.model.panos.list[0].position,l),t.target.copy(r.target);var c=(new THREE.Vector3).subVectors(o.camera.position,o.target);c.applyQuaternion(i),t.position=(new THREE.Vector3).addVectors(r.target,c),r.camera.position.copy(t.position)}r.camera.quaternion.copy(t.quaternion)}}}]),n}(mr);function JP(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var YP=function(e){f(n,EventEmitter);var t=JP(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=WP;else{if(!i.dragging)return;if(!(t=jP.getMouseIntersect(null,jP.getColliders())))return}var n=i.getPoseByIntersect(t),r=n.position,o=n.quaternion,a=n.faceAngle2;i.editPlane.position.copy(r),i.editPlane.quaternion.copy(o),i.editPlane.faceAngle2=a,i.editPlane.getIsLieDown()&&i.editPlane.updateLabelPose(),i.editPlane.homePanoId=jP.currentPano.id,i.emit("dragPos",{panoId:jP.currentPano.id})},confirmPos:function(e){e.consume(),i.confirmPos()},dragStart:function(e){i.editPlane&&jP.OverlayManager.hoveringPlane==i.editPlane&&(jP.cameraControls.activeControl.enabled=!1,jP.cameraControls.activeControl.pointerDragOn=!1,i.dragging=!0,e.consume())},dragEnd:function(e){i.dragging&&(i.dragging=!1,e.consume(),jP.cameraControls.activeControl.enabled=!0)}},i}return u(n,[{key:"waitReady",value:function(e){jP?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&&(jP.on("pointerStart",t.events.dragStart),jP.on("pointerMove",t.events.movePos),jP.on("pointerUp",t.events.dragEnd))})))}},{key:"leave",value:function(){this.endAddPlane(),this.undoEdit(),this.editPlane&&(this.editPlane.isEditing=!1,jP.OverlayManager.highlight(null)),this.editPlane=null,this.entered=!1,jP.off("pointerStart",this.events.dragStart),jP.off("pointerUp",this.events.dragEnd),jP.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),jP.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);jP.OverlayManager.highlight(t)}},{key:"beginToAddPlane",value:function(){var e=this;this.enter((function(){jP.viewLinkManager.exitView(),jP.reticule.visible=!1,e.isAdding=!0,os.add("addOverlay")}))}},{key:"endAddPlane",value:function(){this.isAdding=!1,os.remove("addOverlay"),jP.reticule.visible=!0}},{key:"updateEditPlane",value:function(e){this.editPlane=e,e.isEditing=!0,jP.OverlayManager.highlight(e)}},{key:"getPoseByIntersect",value:function(e){var t=e.face.normal.clone();jP.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)),r=e.point.clone().add(t.multiplyScalar(.01));if(eR(i)){var o=e.face.normal.clone().setY(0),a=(new THREE.Vector3).subVectors(r,jP.position).setY(0).normalize();0==o.x&&0==o.z&&(o.z=1),n=he.getAngle(o,a,"y")-Math.PI/2;var s=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1),n);i.multiply(s)}return{position:r,quaternion:i,faceAngle2:n}}},{key:"startInsertion",value:function(e){var t=this,n=e.intersect,i=this.getPoseByIntersect(n),r=i.position,o=i.quaternion,a=i.faceAngle2,s=new XP(jP,{sid:Ae.getRandomSid(),pos:r,qua:o,modified:"new"});s.faceAngle=0,s.faceAngle2=a,s.updateMatrixWorld(),this.emit("createBill",{sid:s.sid,panoId:jP.currentPano.id}),jP.OverlayManager.clickOverlay(s,{dontEmit:!0,forceFlyToPlane:!0,afterFly:function(e){setTimeout((function(){t.events.movePos({reCompute:!0})}),1)}}),WP=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;jP.OverlayManager.clickOverlay(t,{dontEmit:!0,forceFlyToPlane:!0})}}]),n}(),ZP=["style-1","style-2","style-3"],XP=function(e){f(n,e);var t=JP(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=jP.getDirection().negate(),n=Math.atan2(t.x,t.z),i=new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion),r=this.getFaceAngle2(i);e-=n-=Math.atan2(i.x,i.z)+r;var o=(this.height*Math.abs(Math.cos(e))+this.width*Math.abs(Math.sin(e)))/2+.1,a=-o*Math.sin(-n),s=-o*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||ZP[0];return ZP.includes(t)?jP.$app.resource.getAppURL("images/billboard/".concat(t,".png")):(1==t.split(".").length&&(t+=".png"),jP.$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=eR(this.quaternion),this.lieDown!=e&&this.dispatchEvent({type:"lieDownChanged"}),this.lieDown}}]),n}(rs),KP=K("list"),$P=function(){function e(t){var n=this;o(this,e),Object.defineProperty(this,KP,{writable:!0,value:[]}),this.app=t,this.app.store.on("billboards",(function(e){(e.tags||e).forEach((function(e){e.panoId in jP.model.panos.index&&(e=Ae.CloneJson(e),n.manager.add(new XP(jP,e)))}))})),this.manager=new YP(this),this.app.Scene.on("loaded",(function(){(jP=n.app.core.get("Player")).billboardManager=n.manager,n.manager.emit("ready"),n.app.store.getValue("metadata").controls.showBillboardTitle&&n.manager.changeTitlesShow(!0),jP.on("view.changed",(function(e){"panorama"!=jP.mode&&"floorplan"!=jP.mode||!e.cameraWorldMatrixChanged||n.list.forEach((function(e){e.lieDown&&e.updateLabelPose()}))}))}))}return u(e,[{key:"list",get:function(){return Z(this,KP)[KP]}},{key:"get",value:function(e){return Z(this,KP)[KP].find((function(t){return t.sid==e}))}}]),e}();function eR(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);return Math.abs(t.y)>.9}function tR(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var nR=function(e){f(n,THREE.Mesh);var t=tR(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 iR(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var rR=function(e){f(n,e);var t=iR(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 r=e.cutModelList.clipMatrixs,o=0;o<r.length;o++){var a=new nR(i.clipBoxType[o],i.boxSize),s=new THREE.Matrix4;s.fromArray(r[o]),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 nR(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}(mr),oR=function(e){return Xn.get("/service/scene/getInfo",e)},aR=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:oR}),sR=function(e){return Xn.post("/service/scene/edit/base/save",e)},lR=function(e){return Xn.post("/service/scene/edit/cad/rename",e)},cR=function(e){return Xn.post("/service/scene/edit/publicScene",e)},uR=function(e){return Xn.get("/service/scene/edit/getInfo",e)},hR=function(e){return Xn.post("/service/scene/edit/cad/save",e)},dR=function(e){return Xn.postFile("/service/scene/edit/cad/reset",e)},pR=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:sR,cad_rename:lR,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:cR,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:uR,saveRoam:function(e){return Xn.post("/service/scene/edit/saveRoam",e)},saveTagsVisible:function(e){return Xn.post("/service/scene/edit/saveTagsVisible",e)},cad_save:hR,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:dR,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 fR(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 mR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fR(Object(n),!0).forEach((function(t){nh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fR(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var vR=function(e){return{info:function(){return oR(e)}}},gR=function(e){return{info:function(){return uR(e)},publish:function(){return cR(e)},save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return sR(mR(mR({},e),t))},cad_save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return hR(mR(mR({},e),t))},cad_reset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return dR(mR(mR({},e),t))},cad_rename:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return lR(mR(mR({},e),t))}}};function AR(e){e.APIs=function(e){var t={num:e.config.num,get rnd(){return Date.now()}};return{viewer:vR(t),editor:gR(t)}}(e),e.Scene=new zk(e),e.Camera=new JB(e),e.MinMap=new Nk(e),e.DataSYNC=new Uk(e),e.MarkManager=new Wk(e),e.TagManager=new eP(e),e.CadManager=new tP(e),e.VideoManager=new rP(e),e.WalkManager=new aP(e),e.RepairManager=new lP(e),e.ClipBoxManager=new rR(e),e.TourManager=new pP(e),e.Editor=new yP(e),e.Connect=new HP(e),e.Billboard=new $P(e),e.Screenshot=new AP(e),e.ViewLinkEdit=new zP(e),e.FilterManager=new UP(e),e.ConvertViews=new qP}var yR={pointFrom2DTo3D(e,t,n,i){var r=e.x,o=e.y;n||(n=t.camera),i||(i=t.domElement);var a=new THREE.Vector3(0,0,0);return he.convertScreenPositionToNDC(r,o,a,i),a.unproject(n),a.y=0,a},pointFrom3DTo2D(e,t,n,i){var r=e;return n||(n=t.camera),i||(i=t.domElement),e instanceof THREE.Vector3==!1&&(r=new THREE.Vector3(r.x||0,r.y||0,r.z||0)),tt.getPos2d(r,t,n,i).pos}};function ER(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 wR(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 wR(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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 o,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,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function wR(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 bR(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 r=w(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return y(this,n)}}var CR=function(e){f(n,e);var t=bR(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=pR,i.remote_viewer=aR,AR(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=ER(e.material);try{for(i.s();!(n=i.n()).done;){var r=n.value;t(r)}}catch(e){i.e(e)}finally{i.f()}}}))}}]),n}(Ke);return CR.MITT={Emiter:mr},CR.Utils={file:BB,math:he,convert:yR,MathLight:$e},CR.Animate={transitions:pe,easing:de,lerp:It},CR.Viewmode=ht,CR.THREE=THREE,CR.Deferred=vt,window.PetiteVue=CB,CR}));
|