kankan-sdk.js 862 KB

1234
  1. !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 k(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function S(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){k(r,i,o,a,s,"next",e)}function s(e){k(r,i,o,a,s,"throw",e)}a(void 0)}))}}var C=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof v?t:v,r=Object.create(o.prototype),a=new S(i||[]);return r._invoke=function(e,t,n){var i=h;return function(o,r){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===o)throw r;return C()}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var s=k(a,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=u(e,t,n);if("normal"===l.type){if(i=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=f,n.method="throw",n.arg=l.arg)}}}(e,n,a),r}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function v(){}function g(){}function y(){}var w={};l(w,r,(function(){return this}));var b=Object.getPrototypeOf,E=b&&b(b(I([])));E&&E!==n&&i.call(E,r)&&(w=E);var x=y.prototype=v.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(o,r,a,s){var l=u(e[o],e,r);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;this._invoke=function(e,i){function r(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(r,r):r()}}function k(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,k(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var r=o.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function R(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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function I(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){for(;++o<e.length;)if(i.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:C}}function C(){return{value:t,done:!0}}return g.prototype=y,l(x,"constructor",y),l(y,"constructor",g),g.displayName=l(y,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,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},T(P.prototype),l(P.prototype,a,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,i,o,r){void 0===r&&(r=Promise);var a=new P(c(t,n,i,o),r);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(x),l(x,s,"Generator"),l(x,r,(function(){return this})),l(x,"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=I,S.prototype={constructor:S,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(M),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(i,o){return s.type="throw",s.arg=e,n.next=i,o&&(n.method="next",n.arg=t),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:I(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){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)||function(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}}(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 V(){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 H(e,t,n){return(H=V()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&p(o,n.prototype),o}).apply(null,arguments)}var z=[],U=[];function _(e,t){if(e&&"undefined"!=typeof document){var n,i=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,r="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=z.indexOf(r);-1===a&&(a=z.push(r)-1,U[a]={}),n=U[a]&&U[a][i]?U[a][i]:U[a][i]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var a="prepend"===i?"afterbegin":"beforeend";return r.insertAdjacentElement(a,e),e}}_(":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}\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.3.0-alpha.8",lang:"zh",langs:{},view:!0,mobile:!1,deploy:"",region:"",server:"https://www.4dkankan.com/",resource:"https://4dkk.4dage.com/",showSDKInfo:!0,useShortcutKeys:!1,useAuth:!1,antialias:!0,scene:{markerURL:null,markerOpacity:null,pathEndColor: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 Z(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var q=0;function Y(e){return"__private_"+q+++"_"+e}var X=Y("plugins"),J=function(){function e(t){o(this,e),Object.defineProperty(this,X,{writable:!0,value:{}}),this.app=t}var t;return u(e,[{key:"add",value:(t=S(C.mark((function e(t,n){var i,o=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t(this.app,n),e.abrupt("return",new Promise((function(e,t){i.then&&i.then((function(n){return n.$name?o[n.$name]?e(o[n.$name]):(n.$html&&(n.$scope?n.$scope.insertAdjacentHTML("beforeend",n.$html):o.app.$plugins.insertAdjacentHTML("beforeend",n.$html),delete n.$html),o[n.$name]=n,n.$load&&(n.$load(),delete n.$load),void e(n)):t("require a plugin name")}))})));case 2:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"get",value:function(e){return Z(this,X)[X][e]}}]),e}(),K=Y("components"),ee=function(){function e(t){o(this,e),Object.defineProperty(this,K,{writable:!0,value:void 0}),this.app=t,Z(this,K)[K]={}}return u(e,[{key:"add",value:function(e,t){-1==["store","resource"].indexOf(e)?Z(this,K)[K][e]=t:this.app[e]=t}},{key:"get",value:function(e){return Z(this,K)[K][e]}}]),e}(),te=location.origin,ne=(document.currentScript||{}).src,ie=function(){if(!ne){try{({}).b()}catch(n){var e=n.stack||n.sourceURL||n.stacktrace,t=/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e);t&&(ne=t[0])}}var n=ne.split("/");return n.pop(),ne=n.join("/")+"/",function(){return ne}}();function oe(e,t,n){return new Promise((function(i,o){var r=function(e){var t=document.createElement("script");return t.async=!0,e.indexOf(te+"/")&&(t.crossOrigin="anonymous"),t.src=e,t}(e+(n?"?v=".concat(n):""));r.addEventListener("error",(function(){console.error("load:"+e+" error"),o()})),r.addEventListener("load",(function(){document.head.removeChild(r),i(t)})),document.head.appendChild(r)}))}window.addEventListener("error",(function(e){}));var re,ae=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}(),se=0,le={delayOneFrame(e){window.setTimeout(e,1)},normalizeUrl:e=>e.replace("https://","http://"),domainFromUrl(e){var t=/^([^:]*:\/\/)?(www\.)?([^\/]+)/.exec(e);return t?t[3]:e},average(e,t){if(0===e.length)return null;for(var n=0,i=0,o=0;o<e.length;o++){n+=t?e[o][t]:e[o],i++}return n/i},countUnique(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1+(t[e[n]]||0);return Object.keys(t).length},averageVectors(e,t){var n=new THREE.Vector3;if(0===e.length)return n;for(var i=0,o=0;o<e.length;o++){var r=t?e[o][t]:e[o];n.add(r),i++}return n.divideScalar(i)},equalLists(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},lowerMedian:(e,t)=>0===e.length?null:(t=t||2,e.sort((function(e,t){return e-t})),e[Math.floor(e.length/t)]),stableSort:(e,t)=>e.map((function(e,t){return{value:e,index:t}})).sort((function(e,n){var i=t(e.value,n.value);return 0!==i?i:e.index-n.index})).map((function(e){return e.value})),filterAll:(e,t)=>e.filter((function(e){return t.every((function(t){return t(e)}))})),formatDate:e=>[e.getFullYear(),e.getMonth()+1,e.getDate()].join("-"),formatDatetime:e=>[e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes()].join("-"),randomString(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t},uint8ToBase64(e,t){t&&"number"==typeof t||(t=8192);for(var n=[],i=0;i<e.length;i+=t)n.push(String.fromCharCode.apply(null,e.subarray(i,i+t)));return btoa(n.join(""))},uuid4:function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},nth:e=>1===(e%=10)?e+"st":2===e?e+"nd":3===e?e+"rd":e+"th",extendObject:(e,t)=>(Object.keys(t).forEach((function(n){e[n]=t[n]})),e),deepExtend:function e(t){t=t||{};for(var n=1;n<arguments.length;n++){var i=arguments[n];if(i)for(var o in i)i.hasOwnProperty(o)&&("object"==typeof i[o]?t[o]=e(t[o],i[o]):t[o]=i[o])}return t},inherit(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},extend(e,t){for(var n in t.prototype)e.prototype[n]=t.prototype[n]},extendObject(e,t){if(t instanceof Object)return Object.keys(t).forEach((function(n){e[n]=t[n]})),e},_textureCache:{},loadTextureFromCache(e){return this._textureCache[e]||(this._textureCache[e]=ce(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-se>=t){for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];e.apply(n,r),se=i}}:function(){for(var i=arguments.length,o=new Array(i),r=0;r<i;r++)o[r]=arguments[r];n&&clearTimeout(n);var a=this;n=setTimeout((function(){e.apply(a,o)}),t)}},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}}},ce=((re=new THREE.TextureLoader).setCrossOrigin("Anonymous"),re.crossOrigin=!0,function(e,t,n,i){return re.load(e,t,n,i)});le.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})},le.dataURLtoFile=function(e,t){for(var n=e.split(","),i=n[0].match(/:(.*?);/)[1],o=atob(n[1]),r=o.length,a=new Uint8Array(r);r--;)a[r]=o.charCodeAt(r);return new File([a],t,{type:i})},le.saveFile=function(e,t,n){var i=document.createElementNS("http://www.w3.org/1999/xhtml","a");i.href=e,i.download=t;var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(o),n&&n()},le.PrefixPng="data:image/png;base64,",le.getBlobSrc=function(e,t){var n=le.dataURLtoBlob((t?le.PrefixPng:"")+e);return window.URL.createObjectURL(n)},le.replaceAll=function(e,t,n){var i=new RegExp(t,"g");return e.replace(i,n)},le.randomWord=function(e,t,n){var i="",o=t,r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];e&&(o=Math.round(Math.random()*(n-t))+t);for(var a=0;a<o;a++){i+=r[Math.round(Math.random()*(r.length-1))]}return i},le.getRandomSid=function(){var e=le.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))},le.getTime=function(e){var t="",n=parseInt(e/60);return n<10&&(t+="0"),t+=n,1==(e=parseInt(e%60)+"").length&&(e="0"+e),t=t+":"+e},le.CloneJson=function(e){var t=JSON.stringify(e);return JSON.parse(t)},le.CloneObject=function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(o.push(THREE.Object3D),!e||"number"==typeof e||"string"==typeof e||e instanceof Function||o.some((function(t){return e instanceof t})))return e;if(t=t||{},e instanceof Array)return e.map((function(e){return i.CloneObject(e)}));if(e.clone instanceof Function)return e.clone();for(var r in e)e[r]instanceof Object&&!n?t[r]=this.CloneObject(e[r]):t[r]=e[r];return t},le.CloneClassObject=function(e){var t=new e.constructor;return this.CopyClassObject(t,e),t},le.CopyClassObject=function(e,t){for(var n in t){if(n in t.__proto__)break;e[n]=this.CloneObject(t[n],null)}},le.ifSame=function(e,t){if(e==t)return!0;if(!e||!t)return!1;if(e.constructor!=t.constructor)return!1;if(e instanceof Array){if(e.length!=t.length)return!1;for(var n=t.slice(0),i=function(t){if(null==(r=n.find((function(n){return ifSame(e[t],n)})))&&!n.includes(r)&&!e.includes(r))return{v:!1};var i=n.indexOf(r);n.splice(i,1)},o=0;o<e.length;o++){var r,a=i(o);if("object"==typeof a)return a.v}return!0}if(e.equals instanceof Function)return e.equals(t);if("number"==typeof e||"string"==typeof e)return!(!isNaN(e)||!isNaN(t))||e==t;if("object"==typeof e){var s=Object.keys(e),l=Object.keys(t);if(!ifSame(s,l))return!1;for(var c in e){if(!ifSame(e[c],t[c]))return!1}return!0}console.log("isSame出现例外")},le.canvasToImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/jpeg",o=e.toDataURL(i,t);if(n){o=o.replace(_fixType(i),"image/octet-stream");var r="4dage_"+(new Date).getTime()+("png"==i?".png":".jpg");le.saveFile(o,r)}return o},le.imgAddLabel=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement("canvas"),o=i.getContext("2d");o.canvas.width=e.width,o.canvas.height=e.height,o.drawImage(e,0,0,e.width,e.height);var r=e.width*n.widthRatioToImg,a=r*t.height/t.width;!n.leftRatioToImg&&n.rightRatioToImg&&(n.leftRatioToImg=1-n.rightRatioToImg-n.widthRatioToImg),!n.topRatioToImg&&n.bottomRatioToImg&&(n.topRatioToImg=1-n.bottomRatioToImg-a/e.height);var s=e.width*n.leftRatioToImg,l=e.height*n.topRatioToImg;return o.globalAlpha=null!=n.opacity?n.opacity:1,o.drawImage(t,s,l,r,a),le.canvasToImg(i)};var ue=function(e){le.extend(e,EventEmitter)},he={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",he.requestPointerLock)},requestPointerLock(){var e;if(document.fullscreenElement)e=document.fullscreenElement();else if(document.mozFullscreenElement)e=document.mozFullscreenElement();else if(document.mozFullScreenElement)e=document.mozFullScreenElement();else{if(!document.webkitFullscreenElement)return;e=document.webkitFullscreenElement()}e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock(),$(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",this)},exitPointerLock(){document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()},exitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},details(){var e=navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");return e?{name:e[1],version:parseInt(e[2]),platform:navigator.platform}:{}},is(e){return this.details()&&this.details().name===e},inIframe:()=>window.parent!==window,aspectRatio(){var e=window.innerWidth/window.innerHeight;return isFinite(e)?e:0},userAgent:()=>window.navigator.userAgent,isMobile(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isLandscape(){return this.isMobile&&this.aspectRatio()>1},isSmallScreen:()=>screen.width/window.devicePixelRatio<240,detectWeixin:function(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},detectWeixinMiniProgram:function(){return window.navigator.userAgent.match("miniProgram")},detectIE:()=>-1!==window.navigator.userAgent.indexOf("MSIE ")||!!navigator.userAgent.match(/Trident.*rv\:11\./),detectSafari(){return-1!==window.navigator.userAgent.indexOf("Safari")&&!this.detectChrome()},detectFirefox:()=>-1!==window.navigator.userAgent.indexOf("Firefox"),detectChrome(){return-1!==window.navigator.userAgent.indexOf("Chrome")&&!this.detectOpera()},detectOpera:()=>-1!==window.navigator.userAgent.indexOf("OPR"),detectIOS(){return this.detectIPhone()||this.detectIPad()||this.detectIPod()},detectIPad(){var e=window.navigator.userAgent;return/iPad/.test(e)},detectIPod(){var e=window.navigator.userAgent;return/iPod/.test(e)},detectIPhone(){var e=window.navigator.userAgent;return/iPhone/.test(e)},detectAndroid:()=>-1!==window.navigator.userAgent.indexOf("Android"),detectAndroidMobile(){var e=window.navigator.userAgent;return this.detectAndroid()&&-1!==e.indexOf("Mobile")},detectSamsungNative(){var e=window.navigator.userAgent;return-1!==e.indexOf("SM-G900H")||-1!==e.indexOf("GT-I9500")||-1!==e.indexOf("SM-N900")},detectSamsungS6:()=>-1!==window.navigator.userAgent.indexOf("SM-G92"),detectHUAWEI5X:()=>-1!==window.navigator.userAgent.indexOf("KIW-TL00H"),detectWebVR:()=>!(!window.navigator.getVRDisplays||!window.VRDisplay),getVRDisplay(){var e=this;return new Promise((function(t,n){e.detectWebVR()?navigator.getVRDisplays().then((function(e){e.length>=1?t(e[0]):n(null)})).catch((function(){return n(null)})):n(null)}))},iosVersion(){if(!this.detectIOS())throw new DeviceMismatchException("Did not detect an iDevice");return this.mobileVersion(/((?:\d+\_?){1,3}) like Mac OS/,"_")},androidVersion(){if(!this.detectAndroid())throw new DeviceMismatchException("Did not detect an Android based device");return this.mobileVersion(/Android ((?:\d+\.?){1,3})/,".")},valueFromCookie(e,t){var n=new RegExp(e+"=([0-9a-f]+)(; ?|$)").exec(document.cookie);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):i},valueFromHash(e,t){var n=new RegExp("[#&?]"+e+"=([^#&?]*)").exec(window.location.href);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):window.decodeURIComponent(i)},valueFromUrl(e){return this.urlHasValue(e,!0)},urlHasValue:function(e,t){var n=window.location.search.substr(1).split("&");if(t){for(var i=0;i<n.length;i++){var o=n[i].split("=");if(2===o.length&&o[0]===e)return o[1]}return""}for(var r=0;r<n.length;r++){if(n[r].split("=")[0]==e)return!0}return!1}},de={getEaseOut:function(e){var t;return(e=Math.round(e))<2?(e=Math.PI/2,t=de.easeOutSine):t=function(t,n,i,o){return e>2&&console.log(e),-i/Math.pow(-o,e)*Math.pow(t-o,e)+i},{k:e,easeFun:t}},linearTween:function(e,t,n,i){return n*e/i+t},easeInQuad:function(e,t,n,i){return n*(e/=i)*e+t},easeOutQuad:function(e,t,n,i){return-n*(e/=i)*(e-2)+t},easeInOutQuad:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,i){return n*(e/=i)*e*e+t},easeOutCubic:function(e,t,n,i){return e/=i,n*(--e*e*e+1)+t},easeInOutCubic:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,n,i){return n*(e/=i)*e*e*e+t},easeOutQuart:function(e,t,n,i){return e/=i,-n*(--e*e*e*e-1)+t},easeInOutQuart:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,n,i){return n*(e/=i)*e*e*e*e+t},easeOutQuint:function(e,t,n,i){return e/=i,n*(--e*e*e*e*e+1)+t},easeInOutQuint:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,n,i){return-n*Math.cos(e/i*(Math.PI/2))+n+t},easeOutSine:function(e,t,n,i){return console.log("easeOutSine"),n*Math.sin(e/i*(Math.PI/2))+t},easeInOutSine:function(e,t,n,i){return-n/2*(Math.cos(Math.PI*e/i)-1)+t},easeInExpo:function(e,t,n,i){return n*Math.pow(2,10*(e/i-1))+t},easeOutExpo:function(e,t,n,i){return n*(1-Math.pow(2,-10*e/i))+t},easeInOutExpo:function(e,t,n,i){return(e/=i/2)<1?n/2*Math.pow(2,10*(e-1))+t:(e--,n/2*(2-Math.pow(2,-10*e))+t)},easeInCirc:function(e,t,n,i){return e/=i,-n*(Math.sqrt(1-e*e)-1)+t},easeOutCirc:function(e,t,n,i){return e/=i,e--,n*Math.sqrt(1-e*e)+t},easeInOutCirc:function(e,t,n,i){return(e/=i/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:(e-=2,n/2*(Math.sqrt(1-e*e)+1)+t)},easeInElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)+t)},easeOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*i-o)*(2*Math.PI)/r)+n+t)},easeInOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:2==(e/=i/2)?t+n:(r||(r=i*(.3*1.5)),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*.5+n+t)},easeInBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*(e/=i)*e*((o+1)*e-o)+t},easeOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*((e=e/i-1)*e*((o+1)*e+o)+1)+t},easeInOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),(e/=i/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},easeOutBounce:function(e,t,n,i){return(e/=i)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInBounce:function(e,t,n,i){return n-de.easeOutBounce(i-e,0,n,i)+t},easeInOutBounce:function(e,t,n,i){return e<i/2?.5*de.easeInBounce(2*e,0,n,i)+t:.5*de.easeOutBounce(x,2*e-i,0,n,i)+.5*n+t}},pe={globalDone:null,funcs:[],counter:0,uniqueID:0,start(e,t,n,i,o,r,a){return i=i||0,this.funcs.push({func:e,current:-i*Math.abs(t),duration:(1-Math.max(i,0))*Math.abs(t),done:n,easing:o||de.linearTween,cycling:t<0,running:!0,debug:i<0,name:r||"T"+this.counter,id:void 0===a?this.counter:a,paused:!1}),e(0,16),this.counter+=1,e},trigger(e){var t=void 0===e.delayRatio?0:e.delayRatio,n=e.func||function(){},i=void 0===e.duration?0:e.duration;void 0!==e.cycling&&e.cycling&&(i=-Math.abs(i));var o=e.done||null,r=e.easing||de.linearTween,a=e.name||"R"+this.counter,s=void 0===e.id?this.counter:e.id;return this.start(n,i,o,t,r,a,s)},setTimeout(e,t,n){var i=void 0===n?this.counter:n;return this.trigger({done:e,duration:void 0===t?0:t,name:"O"+this.counter,id:i})},pause(){this.paused=!0},resume(){this.paused=!1},update(e){this.funcs.forEach((function(t){if(!(t.paused||(t.current+=1e3*e,t.current<0)))if(t.current>=t.duration&&!t.cycling){var n=t.easing(1,0,1,1);t.func(n,1e3*e),t.done&&t.done(),t.running=!1}else{var i=t.easing(t.current%t.duration/t.duration,0,1,1);(t.func(i,1e3*e)||!1)&&(t.done&&t.done(),t.running=!1)}}));var t=this.funcs.length;this.funcs=this.funcs.filter((function(e){return e.running}));var n=this.funcs.length;if(t>0&&0===n&&this.globalDone){var i=this.globalDone;this.globalDone=null,i()}},adjustSpeed(e,t){for(var n=this.getById(e),i=0;i<n.length;i++){var o=n[i];o.duration/=t,o.current/=t}},getById(e){return this.funcs.filter((function(t){return e===t.id}))},get(e){for(var t=0;t<this.funcs.length;t+=1)if(this.funcs[t].func===e)return this.funcs[t];return null},isRunning(e){var t=this.get(e);return null!==t&&t.running},countActive(){for(var e=0,t=0;t<this.funcs.length;t+=1)e+=this.funcs[t].running;return e},listActive(){for(var e=[],t=0;t<this.funcs.length;t+=1)this.funcs[t].running&&e.push(this.funcs[t].name);return e},done(e){this.globalDone=e},cancelById(e){var t=void 0===e?0:e;this.funcs=this.funcs.filter((function(e){return e.id!==t}))},cancel(e){this.funcs=this.funcs.filter((function(t){return t.func!==e}))},getUniqueId(){return this.uniqueID-=1,this.uniqueID}},fe={green:new THREE.Color("#00c8ae"),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))}},me="black",ve="std",ge="walk";Math.sign=function(e){return e<0?-1:1};var ye={signedUrlDefaultExpireTime:24e4,signedUrlCheckInterval:1e4,signedUrlRefreshBuffer:15e3,dollhouseFOV:70,dollhouseNear:1,dollhouseFar:5e3,insideFOV:70,insideFOVMax:120,insideNear:.1,insideFar:5e3,insideLookSpeed:.12,insideLookLimitUp:25,insideLookLimitDown:-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},we={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:he.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,modelOpaWhenFloorPlaneShow:.3,reticuleOpacityTransitionTime:250,reticuleColor:fe.newBlue,markerOpacityTransitionTime:500,guiAnimationSpeed:250,highlightAnimationDuration:500,modelComponentLoadSpinnerDelay:150,captureErrors:!1,maxMobileTextures:6,minimalMemoryMode:he.valueFromHash("m3",he.isMobile()),startupFlyinDelay:3e3,vrEnabled:!1,overlay:{width:1,height:.5,depth:.02},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:750,flytimeMaxDistanceThreshold:7,flytimeDistanceMultiplier:150,aimTime:1500,aimSlowFactor:1.5,blur:.8,movementEasing:"easeInOutQuad",blendEasing:"easeInOutQuad",fastForwardFactor:he.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:he.isSmallScreen()?.45:.6,desktop:2},zoomTruncateThreshhold:{mobile:he.isSmallScreen()?.35:.45,desktop:.85},minLengthForTruncate:16,truncateLength:12,truncateSuffix:"..."},tags:{enabled:he.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:fe.newBlue,colorUp:fe._desat(fe.newBlue,.5),colorDown:fe._darken(fe.newBlue,.35),opacity:.5,style:"ribbon",height:.025,ribbonWidth:.24,outsideHeight:.5,waypointRadius:.5,waypointIndoorRadius:.24,waypointPulse:1e3,typ:me,meshFree:he.valueFromHash("mf",1),mapGuides:he.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:he.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:he.valueFromHash("st",0),walkDelay:0,walkMaxDist:50,walkMinDist:.8,walkSlideShowThreshhold:3e3,walkExtraPanosDistance:.4,timePerMeter:800,motionLeadTime:500,movementEasing:"easeInOutQuad",blendEasing:"easeInOutQuad",showBunny:!1,loop:he.valueFromHash("lp",!1),auto:he.valueFromHash("ts",-1),eOrder:"YXZ",stepFactor:.25,brakeStrength:2,minBrakeAngle:.1,maxBrakeAngle:1.8,climbEffort:4},rotationFriction:.05,rotationAccelerationInside:4.5,rotationAccelerationOutside:.15,rotationAfterMoveMultiplier: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:he.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:he.valueFromHash("tileprerender",0),tilingFlagNames:["usetiles","tiles"],maxNavPanoQuality:he.valueFromHash("maxtileq",null),maxZoomPanoQuality:he.valueFromHash("maxztileq",null),overlayStyle:he.valueFromHash("tileoverlay",0),uploadIntervalDelay:he.valueFromHash("tileupdelay",10),initialIntervalDelay:he.valueFromHash("itiledelay",0),maxNonBaseUploadsPerFrame:he.valueFromHash("maxnbtpf",2),maxBaseUploadsPerFrame:he.valueFromHash("maxbtpf",6),customCompression:he.valueFromHash("tilecustcomp",0),mobileHighQualityOverride:!1,allowUltraHighResolution:!0},zoom:{enabled:!0,forceOff:he.valueFromHash("nozoom",0),overridemax:he.valueFromHash("maxzoom",null),overridemin:he.valueFromHash("minzoom",null),max:ye.highQualityMaxZoom,min:1,transitionStyle:he.valueFromHash("zoomtrans",1),activationThreshold:1.1,restoreTime:500,zoomToDefaultWhenToPano:!0},profiling:{enabled:he.valueFromHash("mem",!1)}};(we=le.deepExtend(we,ye,{insideFOV:he.valueFromHash("fov",ye.insideFOV),insideFOVMax:he.valueFromHash("fovmax",ye.insideFOVMax),panorama:{transitionTime:1e3,modelAlpha:0,modelAlphaDelay:we.flydown.modelTextureDelay,modelAlphaLength:1,skyboxOpacity:1,skyboxOpacityDelay:we.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-we.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-we.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.8,cameraMatrixDelay:.3,cameraMatrixEase:de.easeInOutQuad,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0},floorplan:{transitionTime:1e3,modelAlpha:1,modelAlphaDelay:0,modelAlphaLength:1-we.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-we.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.5,cameraMatrixDelay:0,cameraMatrixEase:de.easeOutCubic,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0,cameraHeight:50},transitioning:{reticuleOpacity:0,markerOpacity:.3,markerOpacityOnHover:1},"floorplan-dollhouse":{rotationDelay:0,rotationDuration:1},"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},"panorama-floorplan":{transitionTime:1500,rotationDelay:0,rotationDuration:.5}})).path.meshFree&&(we.path.typ=ge),we.zoom.max=we.zoom.overridemax||we.zoom.max,we.zoom.min=we.zoom.overridemin||we.zoom.min,we.HorizontalBlurShader=new THREE.ShaderPass(THREE.HorizontalBlurShader),we.VerticalBlurShader=new THREE.ShaderPass(THREE.VerticalBlurShader),we.VerticalBlurShader.renderToScreen,we.aspect=window.innerWidth/window.innerHeight,isNaN(ye.aspect)&&(ye.aspect=1),we.sphereBufferGeometry=new THREE.SphereBufferGeometry(.1),we.planeBufferGeometry=new THREE.PlaneBufferGeometry(.4,.4,1,1),we.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 be,Ee,xe,Te=we,Pe=ie(),ke={};function Re(e,t){if(void 0!==ke[e]&&console.warn("Identifier component.".concat(e," has already been declared")),"function"!=typeof t)throw TypeError("argument component not a function");ke[e]=t}var Me,Se=ue((xe=Ee=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 ee(this),this.config=e.config(t,{}),this.Plugins=new J(this),this.gui=new ae(this),null!=this.config.scene.markerOpacity&&(Te.panorama.markerOpacity=this.config.scene.markerOpacity),null!=this.config.scene.pathEndColor&&(Te.path.color=this.config.scene.pathEndColor)}return u(e,[{key:"withDom",value:function(){var e="string"==typeof this.config.dom?document.querySelector(this.config.dom):this.config.dom;if(!e)throw new Error("options.dom must be require");var t=document.createElement("div");t.className="kankan-app";var n=document.createElement("div");n.id="kankan-plugins__".concat(this.uid),n.className="kankan-plugins",n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",n.style.zIndex=10;var i=document.createElement("div");i.className="player",i.setAttribute("name","main");var o=document.createElement("div");o.className="player",o.setAttribute("name","copy");var r=document.createElement("div");r.className="player-mark",r.style.backgroundImage="url(".concat(this.resource.base("images/tag_pointer.png"),")"),i.appendChild(r),o.appendChild(r.cloneNode()),t.appendChild(n),t.appendChild(i),t.appendChild(o),e.appendChild(t),this.dom=t,this.$plugins=n}},{key:"withComponent",value:function(e){var t=ke[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];this.core.add(e,H(n,o))}else console.warn("component[".concat(e,"] not a function"))}},{key:"withNewComponent",value:function(e){var t=ke[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];return H(n,o)}console.warn("component[".concat(e,"] not a function"))}}],[{key:"root",value:function(e){return Pe+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}(),Ee.uid=1,Ee.env=W.env,Ee.version=W.version,Ee.Config=W,be=xe))||be,Ie={convertVisionVector:function(e){return new THREE.Vector3(e.x,e.z,-e.y)},invertVisionVector:function(e){return new THREE.Vector3(e.x,-e.z,e.y)},convertVisionQuaternion:function(e){return new THREE.Quaternion(e.x,e.z,-e.y,e.w).multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)))},invertVisionQuaternion:function(e){var t=e.clone().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(-90)));return new THREE.Quaternion(t.x,-t.z,t.y,t.w)},convertWorkshopVector:function(e){return new THREE.Vector3(-e.x,e.y,e.z)},convertWorkshopQuaternion:function(e){return new THREE.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new THREE.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},convertWorkshopPanoramaQuaternion:function(e){return new THREE.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(270)))},convertWorkshopOrthoZoom:function(e,t){return-1===e?-1:e*(t.clientHeight/t.clientHeight)},getVec2Angle:function(e,t){return Math.acos(THREE.MathUtils.clamp(this.getVec2Cos(e,t),-1,1))},getVec2Cos:function(e,t){return e.dot(t)/e.length()/t.length()},closeTo:function(e,t,n){return null!=n?Math.abs(e-t)<n:Math.abs(e-t)<1e-6},toPrecision:function(e,t){var n=function(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n};if(e instanceof Array){for(var i=0;i<e.length;i++)e[i]=n(e[i],t);return e}if(e instanceof Object){for(var i in e)e[i]=n(e[i],t);return e}return n(e,t)},isEmptyQuaternion:function(e){return 0===Math.abs(e.x)&&0===Math.abs(e.y)&&0===Math.abs(e.z)&&0===Math.abs(e.w)},projectPositionToCanvas:function(e,t,n,i){(n=n||new THREE.Vector3).copy(e);var o=.5*i.clientWidth,r=.5*i.clientHeight;return n.project(t),n.x=n.x*o+o,n.y=-n.y*r+r,n},convertScreenPositionToNDC:function(e,t,i,o){return(i=i||new n.Vector2).x=e/o.clientWidth*2-1,i.y=-t/o.clientHeight*2+1,i},handelPadding:(Me=new Map,function(e,t,n){var i,o=Me.get(n);return o&&n.clientWidth==o.width&&n.clientHeight==o.height&&(i=o.pad),i||(i={x:this.getOffset("left",n),y:this.getOffset("top",n)},Me.set(n,{width:n.clientWidth,height:n.clientHeight,pad:i})),{x:e-i.x,y:t-i.y}}),getOffset:function(e,t,n){var i="left"==e?t.offsetLeft:t.offsetTop;for(n||(n=document.body);(t=t.offsetParent)&&t!=n;)i+="left"==e?t.offsetLeft:t.offsetTop;return i},constrainedTurn:function(e){var t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<-Math.PI?t+=2*Math.PI:t},getFOVDotThreshold:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))},transform2DForwardVectorByCubeFace:function(e,t,n,i){switch(e){case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:n.set(1,t.y,t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:n.set(-1,t.y,-t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:n.set(-t.x,1,-t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:n.set(-t.x,-1,t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:n.set(-t.x,t.y,1);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:n.set(t.x,t.y,-1)}i&&n.normalize()},getFootPoint:function(e,t,n,i){var o=e.clone().sub(t),r=t.clone().sub(n),a=r.length(),s=o.dot(r)/a,l=t.clone().add(r.multiplyScalar(s/a));return i&&l.clone().sub(t).dot(l.clone().sub(n))>0&&(l=l.distanceTo(t)<l.distanceTo(n)?t.clone():n.clone()),l},getCenterOfGravityPoint:function(e){for(var t=0,n=0,i=0,o=1;o<=e.length;o++){var r=e[o%e.length].x,a=e[o%e.length].y,s=e[o-1].x,l=e[o-1].y,c=(r*l-a*s)/2;t+=c,n+=c*(r+s)/3,i+=c*(a+l)/3}return{x:n/=t,y:i/=t}},getBound:function(e){for(var t=new THREE.Box2,n=0,i=e.length;n<i;n++)t.expandByPoint(e[n]);return t},isPointInArea:function(e,t,n){var i=this.getBound(e);if(t.x<i.min.x||t.x>i.max.x||t.y<i.min.y||t.y>i.max.y)return!1;for(var o=!1,r=t.x,a=t.y,s=0,l=e.length-1;s<e.length;l=s++){var c=e[s].x,u=e[s].y,h=e[l].x,d=e[l].y;if((c-r)*(d-a)==(c-r)*(u-a)&&r>=Math.min(c,h)&&r<=Math.max(c,h)&&a>=Math.min(u,d)&&a<=Math.max(u,d))return!!n;u>a!=d>a&&r<(h-c)*(a-u)/(d-u)+c&&(o=!o)}return o},getArea:function(e){for(var t=e.length,n=0,i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return-.5*n},isInBetween:function(e,t,n,i){return e<=t&&t<=n||n<=t&&t<=e||this.closeTo(e,t,i)||this.closeTo(t,n,i)},ifPointAtLineBound:function(e,t,n){return Ie.isInBetween(t[0].x,e.x,t[1].x,n)&&Ie.isInBetween(t[0].y,e.y,t[1].y,n)},isLineIntersect:function(e,t,n){var i=e[1].y-e[0].y,o=e[0].x-e[1].x,r=i*e[0].x+o*e[0].y,a=t[1].y-t[0].y,s=t[0].x-t[1].x,l=a*t[0].x+s*t[0].y,c=i*s-a*o;if(0==c)return!1;var u=(s*r-o*l)/c,h=(i*l-a*r)/c;return n||Ie.ifPointAtLineBound({x:u,y:h},e)&&Ie.ifPointAtLineBound({x:u,y:h},t)?{x:u,y:h}:void 0},getNormal:function(e){var t,n,i=e.points[1].x-e.points[0].x,o=e.points[1].y-e.points[0].y;if(0!=o)n=-i*(t=1)/o;else{if(0==i)return console.log("两个点一样"),null;t=-o*(n=1)/i}var r=new THREE.Vector3(t,0,n),a=new THREE.Vector3(i,0,o);return r.cross(a).y>0&&(t*=-1,n*=-1),new THREE.Vector2(t,n).normalize()},getQuaBetween2Vector:function(e,t,n){var i=e.angleTo(t),o=e.clone().cross(t).normalize();return 0==o.length()?(new THREE.Quaternion).setFromAxisAngle(n,i):(new THREE.Quaternion).setFromAxisAngle(o,i)},getScaleForConstantSize:function(){var e,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Vector3;return function(){var a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s.width2d?e=s.width2d:(a="OrthographicCamera"==s.camera.type?(s.camera.right-s.camera.left)/s.camera.zoom/3:s.position.distanceTo(s.camera.position),e=s.maxSize-(s.maxSize-s.minSize)*THREE.MathUtils.smoothstep(a,s.nearBound,s.farBound));t.copy(s.position).project(s.camera),n.set(s.dom.clientWidth/2,s.dom.clientHeight/2,1).multiply(t),i.set(e/2,0,0).add(n),o.set(2/s.dom.clientWidth,2/s.dom.clientHeight,1).multiply(i),r.copy(o).unproject(s.camera);var l=r.distanceTo(s.position);return l}}(),getCrossPointAtRect:function(e,t,n,i,o,r){var a,s,l=(t.x-e.x)/(t.y-e.y);return((s=function(t){return 1/l*(t-e.x)+e.y}(a=t.x>=e.x?n+o:o))<r||s>r+i)&&(a=function(t){return l*(t-e.y)+e.x}(s=s<r?r:r+i)),new THREE.Vector2(a,s)},getDirFromUV:function(e){var t,n=Math.cos(e.y*Math.PI),i=2*Math.PI*e.x-Math.PI;t=-Math.PI/2<=i&&i<Math.PI/2?1:-1;var o=Math.tan(i),r=Math.sqrt((1-n*n)/(1+o*o)),a=o*r;return r*t<0&&(r*=-1,a*=-1),a*=-1,new THREE.Vector3(a,n,r)},getUVfromDir:function(e){return(e=e.clone()).x*=-1,{x:Math.atan2(e.x,e.z)/(2*Math.PI)+.5,y:Math.acos(e.y)/Math.PI}},crossRight:function(e,t){var n=t.elements,i=new THREE.Vector3;return i.x=n[0]*e.x+n[1]*e.y+n[2]*e.z+n[3],i.y=n[4]*e.x+n[5]*e.y+n[6]*e.z+n[7],i.z=n[8]*e.x+n[9]*e.y+n[10]*e.z+n[11],i},getNormalDir:function(e,t,n){var i=e.clone().sub(n.position);if(t)var o=n.rot90Matrix.clone();else o=n.skyboxMesh.matrixWorld.clone();return(i=this.crossRight(i,o)).normalize(),i},getDirByLonLat:function(e,t){var n=new THREE.Vector3,i=THREE.MathUtils.degToRad(90-t),o=THREE.MathUtils.degToRad(e);return n.x=Math.sin(i)*Math.cos(o),n.y=Math.cos(i),n.z=Math.sin(i)*Math.sin(o),n},getLineIntersect(e){if(null!=(e=e||{}).A)var t=e.A,n=e.B,i=e.p1,o=e.p2;if(t.equals(n))return i.clone();var r=i.clone().sub(t).normalize(),a=o.clone().sub(n).normalize();r.angleTo(a);return function(){var e,r=i.x-t.x,a=i.y-t.y,s=i.z-t.z,l=o.x-n.x,c=o.y-n.y,u=o.z-n.z,h=t.x-n.x,d=t.y-n.y,p=t.z-n.z,f=r*r+a*a+s*s,m=r*l+a*c+s*u,v=l*l+c*c+u*u,g=r*h+a*d+s*p,y=l*h+c*d+u*p,w=f*v-m*m,b=w,E=w,x=0,T=0,P=function(t){e=(1==t?i:o).clone(),console.log(e+" 在后方交点,使用点"+t)}.bind(this);if(Ie.closeTo(w,0))x=0,b=1,T=y,E=v;else if(T=f*y-m*g,(x=m*y-v*g)<0)return P(1),e;if(T<0)return P(2),e;var k=0,R=0;k=Ie.closeTo(x,0)?0:x/b,R=Ie.closeTo(T,0)?0:T/E;var M=new THREE.Vector3(t.x+k*r,t.y+k*a,t.z+k*s),S=new THREE.Vector3(n.x+R*l,n.y+R*c,n.z+R*u);return M.clone().add(S).multiplyScalar(.5)}()},getShapeGeo:function(e,t){var n=new THREE.Shape;n.moveTo(e[0].x,e[0].y);for(var i=1,o=e.length;i<o;i++)n.lineTo(e[i].x,e[i].y);return t&&t.forEach((function(e){var t=new THREE.Path;t.moveTo(e[0].x,e[0].y);for(var i=1,o=e.length;i<o;i++)t.lineTo(e[i].x,e[i].y);n.holes.push(t)})),new THREE.ShapeBufferGeometry(n)},getUnPosPlaneGeo:function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([0,0,1,0,1,1,0,1]),n=new THREE.BufferGeometry;return n.setIndex(new THREE.BufferAttribute(e,1)),n.setAttribute("uv",new THREE.BufferAttribute(t,2)),function(){return n}}(),getPlaneGeo:function(e,t,n,i){var o=this.getUnPosPlaneGeo().clone(),r=new Float32Array([e.x,e.y,e.z,t.x,t.y,t.z,n.x,n.y,n.z,i.x,i.y,i.z]);return o.setAttribute("position",new THREE.BufferAttribute(r,3)),o.computeVertexNormals(),o.computeBoundingSphere(),o},drawPlane:function(e,t,n,i,o){return new THREE.Mesh(this.getPlaneGeo(e,t,n,i),o)},movePlane:function(e,t,n,i,o){var r=new Float32Array([t.x,t.y,t.z,n.x,n.y,n.z,i.x,i.y,i.z,o.x,o.y,o.z]);e.geometry.setAttribute("position",new THREE.BufferAttribute(r,3)),e.geometry.computeBoundingSphere()}},Ce={};Ce.RADIANS_PER_DEGREE=Math.PI/180,Ce.DEGREES_PER_RADIAN=180/Math.PI,Ce.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},Ce.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.")},Ce.Matrix4.prototype={identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},applyToVector3:function(e){var t=e.x,n=e.y,i=e.z,o=this.elements;return e.x=o[0]*t+o[4]*n+o[8]*i+o[12],e.y=o[1]*t+o[5]*n+o[9]*i+o[13],e.z=o[2]*t+o[6]*n+o[10]*i+o[14],this},getInverse:function(e,t){var n=this.elements,i=e.elements,o=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],w=i[15],b=p*y*h-g*f*h+g*u*m-c*y*m-p*u*w+c*f*w,E=v*f*h-d*y*h-v*u*m+l*y*m+d*u*w-l*f*w,x=d*g*h-v*p*h+v*c*m-l*g*m-d*c*w+l*p*w,T=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,P=o*b+r*E+a*x+s*T;if(0===P){var k="MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(k);return console.warn(k),this.identity()}var R=1/P;return n[0]=b*R,n[1]=(g*f*s-p*y*s-g*a*m+r*y*m+p*a*w-r*f*w)*R,n[2]=(c*y*s-g*u*s+g*a*h-r*y*h-c*a*w+r*u*w)*R,n[3]=(p*u*s-c*f*s-p*a*h+r*f*h+c*a*m-r*u*m)*R,n[4]=E*R,n[5]=(d*y*s-v*f*s+v*a*m-o*y*m-d*a*w+o*f*w)*R,n[6]=(v*u*s-l*y*s-v*a*h+o*y*h+l*a*w-o*u*w)*R,n[7]=(l*f*s-d*u*s+d*a*h-o*f*h-l*a*m+o*u*m)*R,n[8]=x*R,n[9]=(v*p*s-d*g*s-v*r*m+o*g*m+d*r*w-o*p*w)*R,n[10]=(l*g*s-v*c*s+v*r*h-o*g*h-l*r*w+o*c*w)*R,n[11]=(d*c*s-l*p*s-d*r*h+o*p*h+l*r*m-o*c*m)*R,n[12]=T*R,n[13]=(d*g*a-v*p*a+v*r*f-o*g*f-d*r*y+o*p*y)*R,n[14]=(v*c*a-l*g*a-v*r*u+o*g*u+l*r*y-o*c*y)*R,n[15]=(l*p*a-d*c*a+d*r*u-o*p*u-l*r*f+o*c*f)*R,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,o=e.z,r=e.w,a=n+n,s=i+i,l=o+o,c=n*a,u=n*s,h=n*l,d=i*s,p=i*l,f=o*l,m=r*a,v=r*s,g=r*l;return t[0]=1-(d+f),t[4]=u-g,t[8]=h+v,t[1]=u+g,t[5]=1-(c+f),t[9]=p-m,t[2]=h-v,t[6]=p+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},Ce.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},Ce.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 Ce.Vector3),(t=Ce.dot(n,i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?Ce.setVector(e,-n.y,n.x,0):Ce.setVector(e,0,-n.z,n.y)):Ce.cross(n,i,e),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),multiply:function(e){return this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,o=e._z,r=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+r*a+i*l-o*s,this._y=i*c+r*s+o*a-n*l,this._z=o*c+r*l+n*s-i*a,this._w=r*c-n*a-i*s-o*l,this}},Ce.convertWorkshopVector=function(e){return new Ce.Vector3(-e.x,e.y,e.z)},Ce.convertWorkshopQuaternion=function(e){return new Ce.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new Ce.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},Ce.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e/16*(window.innerWidth/window.innerHeight)/ye.workshopApsect},Ce.convertWorkshopPanoramaQuaternion=function(e){return new Ce.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new Ce.Quaternion).setFromAxisAngle(new Ce.Vector3(0,1,0),270*Ce.RADIANS_PER_DEGREE))},Ce.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},Ce.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Ce.cross=function(e,t,n){var i=e.x,o=e.y,r=e.z;n.x=o*t.z-r*t.y,n.y=r*t.x-i*t.z,n.z=i*t.y-o*t.x},Ce.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},Ce.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},Ce.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},Ce.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},Ce.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,o=t.z,r=e.x,a=e.y,s=e.z,l=e.w,c=l*n+a*o-s*i,u=l*i+s*n-r*o,h=l*o+r*i-a*n,d=-r*n-a*i-s*o;t.x=c*l+d*-r+u*-s-h*-a,t.y=u*l+d*-a+h*-r-c*-s,t.z=h*l+d*-s+c*-a-u*-r},Ce.angleBetweenVectors=function(e,t){return Math.acos(Ce.dot(e,t))},Ce.closeTo=function(e,t,n){var i=Math.pow(10,-(n||4)),o=Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i&&Math.abs(e.z-t.z)<i;return e.w?o&&Math.abs(e.w-t.w)<i:o};var Ae=new THREE.Raycaster,De={getPos2d:function(e,t,n,i){n=n||t.camera,i=i||t.domElement;var o,r,a=e.clone().project(n);o=(a.x+1)/2*i.clientWidth,r=(1-(a.y+1)/2)*i.clientHeight;var s=o<=i.clientWidth&&o>=0&&r<=i.clientHeight&&r>=0;return{pos:new THREE.Vector2(o,r),vector:a,trueSide:a.z<1,inSight:s}},ifShelter:function(e,t,n,i,o){n||(n=this.getPos2d(e,t)),i=i||t.camera;var r=new THREE.Vector3(n.x,n.y,-1).unproject(i),a=e.clone().sub(r).normalize();Ae.set(r,a);var s=null==o?t.model.colliders:t.model.floors.index[o].collider.children,l=Ae.intersectObjects(s),c=e.distanceTo(r);if(l&&l.length)for(var u=0;u<l.length;u++)if(l[u].distance<c)return!0},getPosAtPlane:function(e,t,n){var i=e,o=t.mouse,r=new THREE.Vector3(o.x,o.y,-1).unproject(t.camera);if(null!=n.y){var a=n.y;if("floorplan"==t.mode)var s=e.x,l=e.z;else{if(a<t.camera.position.y&&r.y<=i.y)return null;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");s=((p=(r.y-a)/(i.y-a))*i.x-r.x)/(p-1),l=(p*i.z-r.z)/(p-1)}}else{var c=n.normalVec,u=n.pullPos;if(0!=c.y)return void console.log("N.y != 0");if(r.z==i.z)return void console.log("O.z==A.z?");if(0!=c.z&&0!=c.x){var h=c.x*(i.x-r.x)+c.y*(i.y-r.y)+c.z*(i.z-r.z);if(0==h)return void console.log("分母为0?? return;");var d=-(c.x*r.x+c.y*r.y+c.z*r.z-(u.x*c.x+u.y*c.y+u.z*c.z))/h;s=d*(i.x-r.x)+r.x,a=d*(i.y-r.y)+r.y,l=d*(i.z-r.z)+r.z}else if(0==c.x){l=u.z;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.z==l)return void console.log("一样3??");s=((p=(r.z-l)/(i.z-l))*i.x-r.x)/(p-1),a=(p*i.y-r.y)/(p-1)}else if(0==c.z){s=u.x;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.x==s)return void console.log("一样3??");var p;a=((p=(r.x-s)/(i.x-s))*i.y-r.y)/(p-1),l=(p*i.z-r.z)/(p-1)}}return new THREE.Vector3(s,a,l)},getMouseIntersect:function(e,t,n){var i=new THREE.Raycaster;e.updateMatrixWorld();var o=new THREE.Vector3(n.x,n.y,-1).unproject(e),r=new THREE.Vector3(n.x,n.y,1).unproject(e).sub(o).normalize();i.set(o,r);var a=i.intersectObjects(t);return 0===a.length?null:a[0]},ifIntersectChunks:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.clone().sub(e).normalize(),r=i.InfinityLen?1/0:e.distanceTo(t)+(i.extLen||0);if(0!=r){var a=new THREE.Raycaster(e.clone(),o,0,r),s=i.meshes||[];0==s.length&&(s=n.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),s));var l=a.intersectObjects(s);if(l&&l.length)return l;if(i.throughWidth){var c=Ie.getNormal({points:[{x:e.x,y:e.z},{x:t.x,y:t.z}]});c.multiplyScalar(i.throughWidth);var u=new THREE.Vector3(c.x,0,c.y),h=e.clone().add(u);a.set(h,o);var d=a.intersectObjects(i.meshes||n.colliders);if(a.set(e.clone().add(u.negate()),o),d&&d.length)return d;var p=a.intersectObjects(i.meshes||n.colliders);if(p&&p.length)return p}return null}},getVisiblePano:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],o=e.clone(),r=n.panos||t.panos.list;return r.forEach((function(e){if(e.isAligned()){var r=e.position.clone(),a=new THREE.Raycaster(r.clone(),o.clone().sub(r).normalize(),0,r.distanceTo(o)-(n.tolerance||0)).intersectObjects(n.model||t.colliders,!0);a&&a.length||i.push(e)}})),i},raycastToFindFloor:function(){var e=[new THREE.Vector3(0,-1,0),new THREE.Vector3(1,-1,0),new THREE.Vector3(0,-1,1),new THREE.Vector3(-1,-1,0),new THREE.Vector3(0,-1,-1),new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,-1)];return function(t,n){var i=[],o=[],r=[];for(var a in t.model.floors.list){var s=t.model.floors.list[a];n.y>=s.boundingBox.min.y&&n.y<=s.boundingBox.max.y&&(i.push(s),o.push.apply(o,L(s.collider.children)))}if(1==i.length)return i[0];if(i.length>1){for(var l=0;l<e.length;l++){var c=new THREE.Raycaster(n.clone(),e[l].clone()).intersectObjects(o);c.length&&function(){var e=c[0].object.parent.parent,t=r.find((function(t){return t.floor==e}));t?t.len++:r.push({floor:e,len:1})}()}return r.sort((function(e,t){t.len,e.len})),r[0]||(r=[],i.forEach((function(e){var t=e.boundingBox,i=[new THREE.Vector3(t.min.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.max.z),new THREE.Vector3(t.min.x,t.min.y,t.max.z),new THREE.Vector3(t.min.x,t.max.y,t.min.z),new THREE.Vector3(t.max.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.min.z),new THREE.Vector3(t.min.x,t.max.y,t.max.z),new THREE.Vector3(t.max.x,t.min.y,t.max.z)],o=0;i.forEach((function(e){return o+=e.distanceTo(n)})),r.push({floor:e,dis:o})})),r.sort((function(e,t){e.dis,t.dis}))),r[0].floor}return n.y<t.model.floors.list[0].center.y?(i=t.model.floors.list.sort((function(e,t){return e.boundingBox.min.y-t.boundingBox.min.y})))[0]:(i=t.model.floors.list.sort((function(e,t){return t.boundingBox.max.y-e.boundingBox.max.y})))[0]}}(),getQuaByAim:function(e,t){return(new THREE.Quaternion).setFromUnitVectors(new THREE.Vector3(0,0,-1),e.clone().sub(t).normalize())},getAimByQua:function(e,t){return new THREE.Vector3(0,0,-1).applyQuaternion(e).add(t)}},Le={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)}},Ve=0,He=1,ze=2,Oe=3,Fe=4,Ne=function(){this.actionSequence=[],this.actionSequenceInProgress=!1};Ne.prototype.reset=function(e){this.actionSequenceInProgress=!1,this.actionSequence.length=0},Ne.prototype.addZoomAction=function(){var e=null,t=null,n=!1,i=function(){e=null,this.actionSequence.length>0&&(this.actionSequence[0].start,this.actionSequence[this.actionSequence.length-1].end),this.reset()};return function(o,r,a){if(o!==r){n||(i=i.bind(this),n=!0),e&&(window.clearTimeout(e),e=null),a===t&&this.actionSequenceInProgress||(this.reset(),t=a),this.actionSequenceInProgress=!0;var s={start:o,end:r};this.actionSequence.push(s),e=window.setTimeout(i,150)}}}();var Be=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 r.opposite(e)===t.direction?(this.pop(),t.pano):null}}]),e}(),Ue={PANORAMA:"panorama",DOLLHOUSE:"dollhouse",FLOORPLAN:"floorplan",TRANSITIONING:"transitioning",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)},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)}},_e={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)};function je(e){return"[object Array]"===Object.prototype.toString.call(e)}function We(e,t){if(je(e))for(var n=0;n<e.length;n++)t(e[n]);else t(e)}function Qe(e){var t="pending",n=[],i=[],o=[],r=null,a={done:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(je(arguments[e]))for(var i=arguments[e],o=0;o<i.length;o++)"resolved"===t&&i[o].apply(this,r),n.push(i[o]);else"resolved"===t&&arguments[e].apply(this,r),n.push(arguments[e]);return this},fail:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(je(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},always:function(){return this.done.apply(this,arguments).fail.apply(this,arguments)},progress:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(je(arguments[e]))for(var n=arguments[e],i=0;i<n.length;i++)"pending"===t&&o.push(n[i]);else"pending"===t&&o.push(arguments[e]);return this},then:function(e,t,n){return Qe((function(n){We(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)})),We(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(je(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},promise:function(e){if(null==e)return a;for(var t in a)e[t]=a[t];return e},state:function(){return t},debug:function(){console.log("[debug]",n,i,t)},isRejected:function(){return"rejected"===t},isResolved:function(){return"resolved"===t},pipe:function(e,t,n){return Qe((function(n){We(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)})),We(t,(function(e){"function"==typeof e?s.fail((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.reject(t)})):s.fail(n.reject)}))})).promise()}},s={resolveWith:function(e){if("pending"===t){t="resolved";for(var i=r=arguments.length>1?arguments[1]:[],o=0;o<n.length;o++)n[o].apply(e,i)}return this},rejectWith:function(e){if("pending"===t){t="rejected";for(var n=r=arguments.length>1?arguments[1]:[],o=0;o<i.length;o++)i[o].apply(e,n)}return this},notifyWith:function(e){if("pending"===t)for(var n=r=arguments.length>1?arguments[1]:[],i=0;i<o.length;i++)o[i].apply(e,n);return this},resolve:function(){return this.resolveWith(this,arguments)},reject:function(){return this.rejectWith(this,arguments)},notify:function(){return this.notifyWith(this,arguments)}},l=a.promise(s);return e&&e.apply(l,[l]),l}Qe.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():Qe().resolve(e).promise()}return function(e){for(var t=Qe(),n=e.length,i=0,o=new Array(n),r=0;r<e.length;r++)!function(r){var a=null;e[r].done?e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})):(a=e[r],e[r]=new Deferred,e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})).resolve(a))}(r);return t.promise()}(arguments)};var Ze=Qe;function Ge(){return new Qe}var qe=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,Ge.when()}},{key:"get",value:function(e){return this.app.resource.getViewImagesURL(e)}}]),e}();function Ye(e,t,n){return(Ye="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=w(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}var $e=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}(),Xe=function(){function e(t){o(this,e),this.chunksize=t||10,this.chunks={},this.boundingBoxes={},this.children=[],this.offset=new THREE.Vector3(0,.5,0),this.material=new THREE.MeshBasicMaterial({color:16777215*Math.random(),side:THREE.DoubleSide})}return u(e,[{key:"add",value:function(e){var t,n,i,o,r,a,s,l,c,u,h=e.attributes;h?(t=h.position.array,n=void 0!==e.index?e.index.array:void 0):t=e.vertices;var d=new THREE.Vector3;if(n)for(i=0,o=n.length;i<o;i+=3){var p=3*n[i],f=3*n[i+1],m=3*n[i+2];r=(t[p]+t[f]+t[m])/3,a=(t[p+1]+t[f+1]+t[m+1])/3,s=(t[p+2]+t[f+2]+t[m+2])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[p],t[p+1],t[p+2],t[f],t[f+1],t[f+2],t[m],t[m+1],t[m+2]),c.expandByPoint(d.set(t[p],t[p+1],t[p+2])),c.expandByPoint(d.set(t[f],t[f+1],t[f+2])),c.expandByPoint(d.set(t[m],t[m+1],t[m+2]))}else for(i=0,o=t.length;i<o;i+=9)r=(t[i]+t[i+3]+t[i+6])/3,a=(t[i+1]+t[i+4]+t[i+7])/3,s=(t[i+2]+t[i+5]+t[i+8])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[i],t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6],t[i+7],t[i+8]),c.expandByPoint(d.set(t[i],t[i+1],t[i+2])),c.expandByPoint(d.set(t[i+3],t[i+4],t[i+5])),c.expandByPoint(d.set(t[i+6],t[i+7],t[i+8]))}},{key:"build",value:function(){var e=new THREE.Object3D;for(var t in e.material=this.material,this.chunks){var n=this.chunks[t],i=new THREE.BufferGeometry;i.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),i.boundingBox=this.boundingBoxes[t];var o=new THREE.Mesh(i,this.material);o.material.visible=!1,e.add(o),this.chunks[t]=[]}return e}}]),e}(),Je=1,Ke=3,et=1,tt=4,nt=5,it=6,ot=8,rt=100;function at(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var st=function(e){f(n,THREE.Object3D);var t=at(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.chunks=[],a.colliderBuilder=new Xe(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:"enter",value:function(e){this.model.setFloor(this,e)}},{key:"show",value:function(){var e=this;this.hidden=!1,this.chunks.forEach((function(e){e.material.uniforms.opacity.value=1,e.material.transparent=!1}));var t=this.model.$app.core.get("Player");setTimeout((function(){"floorplan"==t.mode&&e.model.floorplanCadImg.showCad(),t.labelManager&&t.labelManager.show(e.floorIndex),t.OverlayManager&&t.OverlayManager.show(e.floorIndex,!0)}),1)}},{key:"hide",value:function(){var e=this;this.hidden=!0,this.chunks.forEach((function(e){e.material.uniforms.opacity.value=.2,e.material.transparent=!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)}),1)}},{key:"toggle",value:function(e){void 0===e&&(e=this.hidden),e?this.show():this.hide()}},{key:"addChunk",value:function(e){e.renderOrder=Ke,this.add(e),this.chunks.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)}},{key:"addPano",value:function(e){this.panos.push(e),this.add(e.skyboxMesh),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.add(this.collider);var e=new THREE.Vector3;this.boundingBox.getCenter(e),this.center=e,this.conservativeBoundingBox.copy(this.boundingBox),this.conservativeBoundingBox.min.y=le.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.min.y})),5),this.conservativeBoundingBox.max.y=le.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.max.y})),5),this.colliderBuilder=null}},{key:"toShortString",value:function(){return le.nth(this.floorIndex+1)}},{key:"toString",value:function(){return this.name}}]),n}();function lt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ct=function(e){f(n,e);var t=lt(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){Ye(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 st(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()}))}}]),n}($e),ut={vector:function(e,t,n){var i=e.clone();return t=t.clone(),function(o){e.set(i.x*(1-o)+t.x*o,i.y*(1-o)+t.y*o,i.z*(1-o)+t.z*o),n&&n(e,o)}},quaternion:function(e,t,n){var i=e.clone();return function(o){e.copy(i).slerp(t,o),n&&n(e,o)}},property(e,t,n,i){var o=e[t];return function(r){e[t]=o*(1-r)+n*r,i&&i(e[t])}},uniform(e,t,n){var i=e.material.uniforms[t].value;return function(o){e.material.uniforms[t]&&(e.material.uniforms[t].value=i*(1-o)+n*o)}},matrix4(e,t){var n=e.clone();return function(i){for(var o=e.elements,r=n.elements,a=t.elements,s=0;s<16;s++)o[s]=r[s]*(1-i)+a[s]*i}},allUniforms(e,t,n){var i=e.map(function(e){return this.uniform(e,t,n)}.bind(this));return function(e){i.forEach((function(t){t(e)}))}}},ht={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"},dt=0,pt=1,ft=2,mt=3,vt=4,gt={LoadComplete:"panorama.load.complete",LoadFailed:"panorama.load.failed",TileLoaded:"panorama.tile.loaded"},yt=1,wt=2,bt=3,Et=4,xt={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"},Tt={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"},Pt={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:Te.modelAlpha},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},brushMap:{type:"t",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\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 \n uniform sampler2D paint1Map;\n uniform sampler2D paint0Map;\n uniform sampler2D brushMap;\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 \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 // 滤镜\n\n vec4 colorBrightness(vec4 color, float brightness) {\n brightness = clamp(brightness, -1., 1.);\n return color * (brightness + 1.);\n }\n\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 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 vec4 colorTemperature(vec4 color, float temperature) {\n temperature = clamp(temperature, -1., 1.);\n const float LuminancePreservationFactor = 1.0;\n float temperatureFactor = temperature < 0. ? 4000.0 : 9000.0;\n float temperatureStrength = mix(0., 1.5, abs(temperature));\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 ////////////////////////////////////////////////////////////////\n \n vec4 paint(vec4 colorFromPano, sampler2D paintMap, vec3 vWorldPosition) {\n vec2 sphereUv = getSamplerCoord(vWorldPosition.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 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\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\n\n \n \n void main()\n {\n #if (defined(Not_Cube_0) || defined(HasVideo)) \n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz); \n #endif \n \n #if defined(Not_Cube_0)\n vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0); \n #else\n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz); \n #ifdef HasVideo\n samplerCoord0.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n #endif\n #endif\n\n\n #if (defined(Not_Cube_1) || defined(HasVideo)) \n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n #endif \n \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\n\n // 涂抹图层\n colorFromPano0 = paint(colorFromPano0, paint0Map, vWorldPosition0);\n colorFromPano1 = paint(colorFromPano1, paint1Map, vWorldPosition1);\n\n // 滤镜\n colorFromPano0 = filter(colorFromPano0, filterBase0, filterTemperature0);\n colorFromPano1 = filter(colorFromPano1, filterBase1, filterTemperature1);\n\n\n vec4 color; \n\n\n if(blackout==0)\n {\n color=mix(colorFromPano0,colorFromPano1,progress);\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 vec4 colorFromTexture = texture2D(map,uv);\n color = mix(color, colorFromTexture, modelAlpha); \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 color = mix(color, 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 color = mix(color, 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 color = mix( color, 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 color = mix(color, 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 color = mix(color, 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 color = mix(color, 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 color = mix( color, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0) );\n\n #endif\n\n #endif\n\n #endif\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 vec2 sphereUv = getSamplerCoord(vWorldPosition1.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 0.25;\n if(sphereUv.x < 0.) sphereUv.x += 1.;\n vec4 brushBuffer = texture2D(brushMap, sphereUv);\n if(brushBuffer.a > 0.) {\n color = vec4(brushBuffer.rgb * brushBuffer.a + color.rgb * (1. - brushBuffer.a), 1.);\n } \n\n gl_FragColor = vec4(color.rgb,opa);\n }\n ",fragmentBufferShader:"\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 uniform int iIsBrush;\n varying vec2 vUv;\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视角变换矩阵\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., 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 // 抗锯齿 (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 void main()\n {\n vec2 uv = vUv;\n vec2 mouse = (-iResolution.xy + 2.0*iMouse.xy)/iResolution.y;\n\n float hAngle = (uv.x * 2.0 + 0.5) * -PI;\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;\n\n vec3 point = calcPoint(mouse, iAngle, iPitch);\n\n float brushSize = iBrushSize / 100.; // 笔刷大小\n if(iIsBrush == 0) brushSize += 0.005; // 补偿黑边\n if( length( point - wPos ) < brushSize && (iMouse.z > 0.0 || iIsBrush == 1)) \n {\n vec4 col;\n if(iBrushType == 1) {\n // 马赛克\n float mosaicAccuracy = 5. * 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 == 2) {\n // 高斯模糊\n const float Directions = 16.0;\n const float Quality = 3.0;\n float Size = 8.0;\n\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 col += texture2D(iChannel1, uv + vec2(cos(d), sin(d)) * Radius * i);\t\t\n }\n }\n \n col /= (Quality * Directions - 15.0);\n } \n else {\n // 橡皮\n col = vec4(texture2D(iChannel0, uv).rgb, 0.);\n }\n\n if(iIsBrush == 0) {\n // 边缘渐变\n if(iBrushType != 0) {\n // 橡皮以外\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) newAlpha = 0.01; // 0.005去黑边\n col.a = newAlpha > texture2D(iChannel0, uv).a ? newAlpha : texture2D(iChannel0, uv).a;\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;\n }\n }\n else {\n // 笔刷边缘\n if(length(point-wPos)/brushSize > 0.9) col = vec4(.9, .9, .9, 1.);\n float m;\n m = smootherstep(brushSize-0.002,brushSize+0.002,length(point - wPos ));\n col = mix(col, vec4(0.), m);\n if(length(point - wPos) <= brushSize*0.9+0.002) {\n m = smootherstep(brushSize*0.9-0.002,brushSize*0.9+0.002,length(point - wPos));\n col = mix(col, vec4(.9, .9, .9, 1.), m);\n }\n }\n\n gl_FragColor = col;\n\n } else {\n // bufferTexture\n gl_FragColor = texture2D(iChannel0, uv);\n }\n }\n "},kt={uniforms:{map:{type:"t",value:null},modelAlpha:{type:"f",value:Te.modelAlpha},depthmapRatio:{type:"f",value:0},opacity:{type:"f",value:1},progress:{type:"f",value:0},considerOcclusion:{type:"i",value:Te.fancierTransition},highlightPanoSelection:{type:"i",value:0},useThirdPano:{type:"i",value:Te.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:Te.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:Te.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:Te.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"},Rt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\n\nvoid main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"\n uniform sampler2D map; uniform float opacity; varying vec2 vUv;\n \n vec4 grey = vec4(0.23, 0.23, 0.23, 1.0); //cadImg greyArea to cover model, base color\n \n void main() {\n vec2 uv = vUv; \n vec4 colorFromTexture = texture2D( map, uv );\n float whiteness = 1.0 - smoothstep(0.1, 1.0, opacity); \n colorFromTexture = mix(colorFromTexture, grey, whiteness ); \n gl_FragColor = vec4(colorFromTexture.rgb, opacity); \n }\n "},Mt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},color:{type:"c",value:new THREE.Color(Te.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"},St={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"},It={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"},Ct={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 "},At={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 "},Dt={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 \n \n void main() \n {\n vUv = uv;\n\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 }\n\n "},Lt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},pulse:{type:"f",value:1},nearFade:{type:"v2",value:new THREE.Vector2(2*Te.insideNear,2*Te.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"},Vt={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);}"},Ht={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 "},zt={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 "},Ot={uniforms:{progress:{type:"f",value:0},map0:{type:"t",value:null},map1:{type:"t",value:null},map2:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:"\n uniform float progress;\n varying vec2 vUv0; varying vec2 vUv1; varying vec2 vUv2;\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 float baseScale = 0.78;\n float s1 = 1.0; float s2 = 1.28;\n float scale1 = progress * (s2 - s1) + s1;\n vUv1 = Scale(uv, scale1 * baseScale);\n float scale2;\n if(progress < 0.5){\n float s1 = 1.0; float s2 = 1.16; \n scale2 = 2.0 * progress * (s2 - s1) + s1;\n }else{\n float s1 = 1.16; float s2 = 1.27;\n scale2 = 2.0 *(progress - 0.5) * (s2 - s1) + s1;\n }\n \n vUv2 = Scale(uv, scale2 * baseScale);\n vUv0 = Scale(uv, baseScale);\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\n\n }\n\n ",fragmentShader:"\n uniform sampler2D map0;uniform sampler2D map1; uniform sampler2D map2;\n uniform float opacity;\n uniform float progress;\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 varying vec2 vUv0; varying vec2 vUv1; varying vec2 vUv2; \n void main(){\n float op1, op2;\n if(progress<0.5){\n op1 = 0.49; \n op2 = 2.0 * progress * (0.48 - 1.0) + 1.0;\n }else{\n op1 = 2.0 * (progress - 0.5) * (0.0 - 0.49) + 0.49;\n op2 = 2.0 * (progress - 0.5) * (0.0 - 0.48) + 0.48;\n }\n\n vec4 color0 = noRepeat(map0, vUv0);\n vec4 color1 = noRepeat(map1, vUv1);\n vec4 color2 = noRepeat(map2, vUv2);\n color1.a *= op1;\n color2.a *= op2;\n \n \n #if defined(useColor2) \n gl_FragColor = mixColor(mixColor(color0 , color1), color2); //为什么苹果渲染的发黑//这样稍微柔和一些\n #else\t\n gl_FragColor = mixColor(mixColor(color2 , color0), color1 ); //这个叠放顺序也是试出来比较好的一种。color0基底由于外框部分都是0,0,0,0作为下层会被取一部分黑色,所以只能放上层,而内层的color1也要放上层,所以color2就是最下层。\n #endif \n gl_FragColor.a *= opacity;\n }\n\n "},Ft={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);//平滑内边缘 \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 color = mix(white, color0, mapColor2.r);//平滑内边缘 \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 if(mapColor.a>0.0 && mapColor.a<1.0) color = green; \n else 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; //2中包含1-2的过渡,待平滑\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 "},Nt={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 "},Bt={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 Ut(e){return"precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"+e}function _t(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=Ut(e.fragmentShader),e==Pt&&(e.fragmentBufferShader=Ut(e.fragmentBufferShader)))}_t(xt),_t(Tt),_t(Pt),_t(kt),_t(Rt),_t(Mt),_t(St),_t(It),_t(Ct),_t(At),_t(Dt),_t(Lt),_t(Vt),_t(Ht),_t(zt),_t(Ot),_t(Ft),_t(Nt),_t(Bt);var jt={cube:xt,customDepth:Tt,model:Pt,modelDebug:kt,modelOutside:Rt,ribbon:Mt,skysphere:St,tagDisc:It,tagDiscDefault:Ct,tagDiscCustom:At,tagVideoMarker:Dt,waypoint:Lt,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:Vt,videoLoading:Ht,videoMakerWidget:zt,videoPanoMarker:Ot,linkSpot:Ft,linkSpotInside:Nt,sphereRenderToCube:Bt},Wt=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)}},Qt=Object.prototype.toString;function Zt(e){return"[object Array]"===Qt.call(e)}function Gt(e){return void 0===e}function qt(e){return null!==e&&"object"==typeof e}function Yt(e){if("[object Object]"!==Qt.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function $t(e){return"[object Function]"===Qt.call(e)}function Xt(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Zt(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Jt={isArray:Zt,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Qt.call(e)},isBuffer:function(e){return null!==e&&!Gt(e)&&null!==e.constructor&&!Gt(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:qt,isPlainObject:Yt,isUndefined:Gt,isDate:function(e){return"[object Date]"===Qt.call(e)},isFile:function(e){return"[object File]"===Qt.call(e)},isBlob:function(e){return"[object Blob]"===Qt.call(e)},isFunction:$t,isStream:function(e){return qt(e)&&$t(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:Xt,merge:function e(){var t={};function n(n,i){Yt(t[i])&&Yt(n)?t[i]=e(t[i],n):Yt(n)?t[i]=e({},n):Zt(n)?t[i]=n.slice():t[i]=n}for(var i=0,o=arguments.length;i<o;i++)Xt(arguments[i],n);return t},extend:function(e,t,n){return Xt(t,(function(t,i){e[i]=n&&"function"==typeof t?Wt(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 Kt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var en=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(Jt.isURLSearchParams(t))i=t.toString();else{var o=[];Jt.forEach(t,(function(e,t){null!=e&&(Jt.isArray(e)?t+="[]":e=[e],Jt.forEach(e,(function(e){Jt.isDate(e)?e=e.toISOString():Jt.isObject(e)&&(e=JSON.stringify(e)),o.push(Kt(t)+"="+Kt(e))})))})),i=o.join("&")}if(i){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e};function tn(){this.handlers=[]}tn.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},tn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},tn.prototype.forEach=function(e){Jt.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var nn=tn,on=function(e,t,n){return Jt.forEach(n,(function(n){e=n(e,t)})),e},rn=function(e){return!(!e||!e.__CANCEL__)},an=function(e,t){Jt.forEach(e,(function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])}))},sn=function(e,t,n,i,o){return function(e,t,n,i,o){return e.config=t,n&&(e.code=n),e.request=i,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,i,o)},ln=Jt.isStandardBrowserEnv()?{write:function(e,t,n,i,o,r){var a=[];a.push(e+"="+encodeURIComponent(t)),Jt.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),Jt.isString(i)&&a.push("path="+i),Jt.isString(o)&&a.push("domain="+o),!0===r&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},cn=["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"],un=Jt.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=Jt.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},hn=function(e){return new Promise((function(t,n){var i=e.data,o=e.headers;Jt.isFormData(i)&&delete o["Content-Type"];var r=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l=function(e,t){return e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}(e.baseURL,e.url);if(r.open(e.method.toUpperCase(),en(l,e.params,e.paramsSerializer),!0),r.timeout=e.timeout,r.onreadystatechange=function(){if(r&&4===r.readyState&&(0!==r.status||r.responseURL&&0===r.responseURL.indexOf("file:"))){var i,o,a,s,l,c="getAllResponseHeaders"in r?(i=r.getAllResponseHeaders(),l={},i?(Jt.forEach(i.split("\n"),(function(e){if(s=e.indexOf(":"),o=Jt.trim(e.substr(0,s)).toLowerCase(),a=Jt.trim(e.substr(s+1)),o){if(l[o]&&cn.indexOf(o)>=0)return;l[o]="set-cookie"===o?(l[o]?l[o]:[]).concat([a]):l[o]?l[o]+", "+a:a}})),l):l):null,u={data:e.responseType&&"text"!==e.responseType?r.response:r.responseText,status:r.status,statusText:r.statusText,headers:c,config:e,request:r};!function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(sn("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,u),r=null}},r.onabort=function(){r&&(n(sn("Request aborted",e,"ECONNABORTED",r)),r=null)},r.onerror=function(){n(sn("Network Error",e,null,r)),r=null},r.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(sn(t,e,"ECONNABORTED",r)),r=null},Jt.isStandardBrowserEnv()){var c=(e.withCredentials||un(l))&&e.xsrfCookieName?ln.read(e.xsrfCookieName):void 0;c&&(o[e.xsrfHeaderName]=c)}if("setRequestHeader"in r&&Jt.forEach(o,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete o[t]:r.setRequestHeader(t,e)})),Jt.isUndefined(e.withCredentials)||(r.withCredentials=!!e.withCredentials),e.responseType)try{r.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&r.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&r.upload&&r.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){r&&(r.abort(),n(e),r=null)})),i||(i=null),r.send(i)}))},dn={"Content-Type":"application/x-www-form-urlencoded"};function pn(e,t){!Jt.isUndefined(e)&&Jt.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var fn,mn={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(fn=hn),fn),transformRequest:[function(e,t){return an(t,"Accept"),an(t,"Content-Type"),Jt.isFormData(e)||Jt.isArrayBuffer(e)||Jt.isBuffer(e)||Jt.isStream(e)||Jt.isFile(e)||Jt.isBlob(e)?e:Jt.isArrayBufferView(e)?e.buffer:Jt.isURLSearchParams(e)?(pn(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Jt.isObject(e)?(pn(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}};mn.headers={common:{Accept:"application/json, text/plain, */*"}},Jt.forEach(["delete","get","head"],(function(e){mn.headers[e]={}})),Jt.forEach(["post","put","patch"],(function(e){mn.headers[e]=Jt.merge(dn)}));var vn=mn;function gn(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var yn=function(e){return gn(e),e.headers=e.headers||{},e.data=on(e.data,e.headers,e.transformRequest),e.headers=Jt.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Jt.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||vn.adapter)(e).then((function(t){return gn(e),t.data=on(t.data,t.headers,e.transformResponse),t}),(function(t){return rn(t)||(gn(e),t&&t.response&&(t.response.data=on(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},wn=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],r=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return Jt.isPlainObject(e)&&Jt.isPlainObject(t)?Jt.merge(e,t):Jt.isPlainObject(t)?Jt.merge({},t):Jt.isArray(t)?t.slice():t}function l(i){Jt.isUndefined(t[i])?Jt.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(e[i],t[i])}Jt.forEach(i,(function(e){Jt.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),Jt.forEach(o,l),Jt.forEach(r,(function(i){Jt.isUndefined(t[i])?Jt.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(void 0,t[i])})),Jt.forEach(a,(function(i){i in t?n[i]=s(e[i],t[i]):i in e&&(n[i]=s(void 0,e[i]))}));var c=i.concat(o).concat(r).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return Jt.forEach(u,l),n};function bn(e){this.defaults=e,this.interceptors={request:new nn,response:new nn}}bn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=wn(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[yn,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},bn.prototype.getUri=function(e){return e=wn(this.defaults,e),en(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Jt.forEach(["delete","get","head","options"],(function(e){bn.prototype[e]=function(t,n){return this.request(wn(n||{},{method:e,url:t,data:(n||{}).data}))}})),Jt.forEach(["post","put","patch"],(function(e){bn.prototype[e]=function(t,n,i){return this.request(wn(i||{},{method:e,url:t,data:n}))}}));var En=bn;function xn(e){this.message=e}xn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},xn.prototype.__CANCEL__=!0;var Tn=xn;function Pn(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 Tn(e),t(n.reason))}))}Pn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Pn.source=function(){var e;return{token:new Pn((function(t){e=t})),cancel:e}};var kn=Pn;function Rn(e){var t=new En(e),n=Wt(En.prototype.request,t);return Jt.extend(n,En.prototype,t),Jt.extend(n,t),n}var Mn=Rn(vn);Mn.Axios=En,Mn.create=function(e){return Rn(wn(Mn.defaults,e))},Mn.Cancel=Tn,Mn.CancelToken=kn,Mn.isCancel=rn,Mn.all=function(e){return Promise.all(e)},Mn.spread=function(e){return function(t){return e.apply(null,t)}},Mn.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Sn=Mn,In=Mn;Sn.default=In;var Cn=Sn,An=null,Dn=null,Ln=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 Vn={retry(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return new Promise((function(i,o){e().then(i).catch((function(r){t<=1?o(r):setTimeout((function(){Vn.retry(e,t-1,n).then(i).catch(o)}),n)}))}))},get:e=>An.get(e),getImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if("aws"==Dn.region&&-1!=e.indexOf("x-oss-process=image")){var n=e.split("?");e=n[0]+encodeURIComponent("?"+n[1].replace(/\//g,"@"))}return Vn.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=>An.get(e,{responseType:"text"}),getBueffer:e=>An.get(e,{responseType:"arraybuffer"}),getBlob:e=>An.get(e,{responseType:"blob"}),post:(e,t)=>An.post(e,t),postFile(e,t){var n=new FormData,i=null;for(var o in t.onUploadProgress&&(i=t.onUploadProgress,delete t.onUploadProgress),t)if("files"===o&&t[o].length>0)for(var r=0;r<t[o].length;r++){var a=t[o][r];a instanceof File?n.append(o,a):a.file?a.filename?n.append(o,a.file,a.filename):n.append(o,a.file):console.warn("file is wong !",t)}else"file"==o||"filename"===o?"file"==o&&(t.filename?n.append("file",t[o],t.filename):n.append("file",t[o])):n.append(o,t[o]);return An.post(e,n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:i})}};var Hn=ie(),zn={data:{}};function On(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}zn.load=function(e,t,n){var i=zn.data[e];return i?(t&&setTimeout((function(){t(i)}),1),i):(i=new THREE.Texture,Te.minimalMemoryMode&&(i.minFilter=THREE.LinearFilter,i.magFilter=THREE.LinearFilter,i.generateMipmaps=!1),i.sourceFile=e,zn.data[e]=i,Vn.getImage(e).then((function(e){i.image=e,i.needsUpdate=!0,t&&t(i)})).catch(n),i)},zn.loadWithoutUpdate=function(){var e=S(C.mark((function e(t,n,i){var o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=zn.data[t.split("?")[0]])){e.next=6;break}return n&&n(o),e.abrupt("return",o);case 6:return o=new THREE.Texture,Te.minimalMemoryMode&&(o.minFilter=THREE.LinearFilter,o.magFilter=THREE.LinearFilter,o.generateMipmaps=!1),o.sourceFile=t,zn.data[t.split("?")[0]]=o,e.next=12,Vn.getImage(t).then((function(e){o.image=e,o.needsUpdate=!0,n&&n(o)})).catch(i);case 12:return e.abrupt("return",o);case 13:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),zn.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),Te.minimalMemoryMode&&(n.minFilter=THREE.LinearFilter,n.magFilter=THREE.LinearFilter,n.generateMipmaps=!1),n.needsUpdate=!0,n},zn.isLoaded=function(e){return!!zn.data[e]},zn.getImageURL=function(e){return e&&0===e.indexOf("http")?e:Hn+e};var Fn={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"}},Nn={uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,Fn]),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}"},Bn=[],Un=function(e){f(n,THREE.ShaderMaterial);var t=On(n);function n(e){var i;return o(this,n),i=t.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(Nn.uniforms),vertexShader:Nn.vertexShader,fragmentShader:Nn.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),Bn.push(h(i)),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){Bn.forEach((function(n){n.resolution=new THREE.Vector2(e,t)}))}}]),n}(),_n=function(e){f(n,THREE.InstancedBufferGeometry);var t=On(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}(),jn=function(e){f(n,e);var t=On(n);function n(){var e;return o(this,n),(e=t.call(this)).type="LineGeometry",e.isLineGeometry=!0,e}return u(n,[{key:"setPositions",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return Ye(w(n.prototype),"setPositions",this).call(this,i),this}},{key:"setColors",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return Ye(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}(_n),Wn=function(e){f(n,e);var t=On(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 jn,r.material=void 0!==i?i:new Un({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}(function(e){f(n,THREE.Mesh);var t=On(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 _n,r.material=void 0!==i?i:new Un({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}()),Qn=fe.lightGreen,Zn=null,Gn={createLine:function(e,t){var n;if(t.mat)n=t.mat;else{var i={lineWidth:t.lineWidth||1,color:t.color||Qn,transparent:!t.dontAlwaysSeen,depthTest:!!t.dontAlwaysSeen};t.deshed&&(i.dashSize=t.dashSize||.1,i.gapSize=t.gapSize||.1),n=new THREE[t.deshed?"LineDashedMaterial":"LineBasicMaterial"](i)}var o=new THREE.LineSegments(new THREE.BufferGeometry,n);return o.renderOrder=t.renderOrder||4,this.moveLine(o,e),o},moveLine:function(e,t){if(0==t.length)return console.log(1);var n=[];t.forEach((function(e){return n.push(e.x,e.y,e.z)})),e.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),e.geometry.attributes.position.needsUpdate=!0,e.geometry.computeBoundingSphere(),e.material instanceof THREE.LineDashedMaterial&&e.computeLineDistances()},createFatLineMat:function(e){var t=Object.assign({},{lineWidth:5,color:16777215,transparent:!0,depthWrite:!1,depthTest:!1,dashSize:.1,gapSize:.1},e,{});return new Un(t)},createFatLine:function(e,t){var n=new jn;n.setColors(t.color||[1,1,1]);var i=t.material||this.createFatLineMat(t),o=new Wn(n,i);return o.scale.set(1,1,1),o.renderOrder=2,this.moveFatLine(o,e),o},moveFatLine:function(e,t){var n=e.geometry,i=[];t.forEach((function(e){return i.push(e.x,e.y,e.z)})),i.length>0?(n||(n=e.geometry=new jn),n.attributes.instanceEnd&&n.attributes.instanceEnd.data.array.length!=i.length&&(n.dispose(),n=new jn,e.geometry=n),n.setPositions(i),e.material.dashed&&e.computeLineDistances()):(n.dispose(),e.geometry=new jn)},createBoldLine:function(e,t,n){Zn=n;var i=(t=t||{})&&t.cylinder,o=e[1].clone().sub(e[0]),r=function(){i.lastVector=o;var e=new THREE.Vector3(0,-1,0),t=e.clone().cross(o).normalize(),n=e.angleTo(o);i.quaternion.setFromAxisAngle(t,n)};if(t&&"init"==t.type){if((i=new THREE.Mesh).material=t.mat,0==o.length())return i;r()}if(0==o.length())return i;if("update"!=t.type){var a=e[0].clone().add(e[1]).multiplyScalar(.5);i.position.copy(a),i.lastVector&&"moveAndRotate"!=t.type?i.lastVector&&o.angleTo(i.lastVector)>0&&r():r()}var s=e[0].distanceTo(e[1]),l=t&&t.standPos||Zn.position,c=W.isMobile?20:40,u=e[0].distanceTo(l),h=e[1].distanceTo(l),d=Ie.getFootPoint(l,e[0],e[1]);if(t.constantBold||"panorama"!=Zn.mode)var p=[new THREE.Vector2(.1,s/2),new THREE.Vector2(.1,-s/2)];else if(d.clone().sub(e[0]).dot(d.clone().sub(e[1]))>0)p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(h/c,-s/2)];else{var f=d.distanceTo(l),m=d.distanceTo(e[0]);p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(f/c,s/2-m),new THREE.Vector2(h/c,-s/2)]}return i.geometry&&i.geometry.dispose(),i.geometry=new THREE.LatheBufferGeometry(p,4),i.renderOrder=2,i},updateBoldLine:function(e,t,n,i,o){this.createBoldLine(t,{type:n,cylinder:e,standPos:i,constantBold:o},Zn)}};function qn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Yn,$n,Xn,Jn=new THREE.PlaneBufferGeometry(.4,.4,1,1),Kn=null,ei=[],ti=function(e){f(n,THREE.Mesh);var t=qn(n);function n(e){var i;o(this,n),(i=t.call(this)).pano=e,i.config=e.$app.config,i.geometry=Jn,i.widget=null,i.flagSpotTex=zn.load(zn.getImageURL("images/play-64.png")),Yn=zn.load(zn.getImageURL("images/256-1.png")),$n=zn.load(zn.getImageURL("images/256-3.png")),Xn=zn.load(zn.getImageURL("images/256-2.png"));var r=le.loadTextureFromCache(zn.getImageURL(i.config.scene.markerURL||"images/marker.png"));return r.anisotropy=4,i.material=new THREE.MeshBasicMaterial({map:r,side:THREE.DoubleSide,opacity:0,transparent:!0,depthWrite:!1,depthTest:!1}),i.renderOrder=tt,i.name="marker",i.layers.set(pt),i.updateMatrixWorld(),Te.colorMarkerOnLoad&&i.on("load",(function(){this.marker.material.color.set(65280)})),i}return u(n,[{key:"updateStyle",value:function(e,t,n){"normal"==e?this.material==Kn&&(this.material=this.normalMaterial,t.flagSpot=null):this.material!=Kn&&(Kn||(Kn=new ri,oi()),this.normalMaterial=this.material,this.material=Kn,this.setWidget(e,t))}},{key:"setWidget",value:function(e,t){var n=new ai(e,"flagSpot___"+t.id,{position:t.position.clone(),state:"videoPanoFlag",sid:"flagSpot___"+t.id,style:"videoMarker",pano:t});n.style="videoMarker",n.disc.material.uniforms.map.value=this.flagSpotTex;n.createMarkLine({type:"flagSpot",stemLineLen:.5,markerPos:this.position}).marker=this,n.rePos(n.markLine.groundPoint.clone().add(new THREE.Vector3(0,.5,0))),ei.push(n),t.flagSpot=n,this.material.depthTest=!1;var i=t.marker.visible;Object.defineProperty(t.marker,"visible",{get:function(){return i},set:function(e){t.flagSpot&&(e?t.flagSpot.show():t.flagSpot.hide()),i=e}})}}]),n}(),ni=[],ii=0;function oi(){for(var e=0;e<ni.length;e++)ni[e].uniforms.progress.value=ii;ei.forEach((function(e){return e.update()})),ii>1&&(ii=0),ii+=.01,window.requestAnimationFrame(oi)}var ri=function(e){f(n,THREE.RawShaderMaterial);var t=qn(n);function n(){var e;o(this,n),e=t.call(this);var i=THREE.UniformsUtils.clone(jt.videoPanoMarker.uniforms);return i.map0.value=Yn,i.map1.value=$n,i.map2.value=Xn,i.opacity.value=1,e.vertexShader=jt.videoPanoMarker.vertexShader,e.fragmentShader=jt.videoPanoMarker.fragmentShader,e.uniforms=i,e.transparent=!0,he.detectIOS()&&(e.defines.useColor2=""),ni.push(h(e)),e}return n}(),ai=function(e){f(n,EventEmitter);var t=qn(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=fe._darken(a.content.color,.2),a.animTime=0,a.animated=!1,a.openning=0,a.openTransition=null,a.mode=Ue.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||fe.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 si({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=new THREE.Object3D;e.position.copy(this.position);var t=this.model.$app.config;"shop"==t.name||"grave"==t.name?(this.defaultStyleMaterial=new THREE.RawShaderMaterial({transparent:!0,vertexShader:jt.tagDiscDefault2.vertexShader,fragmentShader:jt.tagDiscDefault2.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.tagDiscDefault2.uniforms),depthTest:!1}),this.customStyleMaterial=new THREE.RawShaderMaterial({transparent:!0,vertexShader:jt.tagDiscCustom.vertexShader,fragmentShader:jt.tagDiscCustom.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.tagDiscCustom.uniforms),depthTest:!1})):(this.defaultStyleMaterial=new THREE.RawShaderMaterial({transparent:!0,vertexShader:jt.tagDiscDefault.vertexShader,fragmentShader:jt.tagDiscDefault.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.tagDiscDefault.uniforms),depthTest:!1}),this.defaultStyleMaterial.uniforms.uColor.value.copy(this.color),this.customStyleMaterial=new THREE.RawShaderMaterial({transparent:!0,vertexShader:jt.tagDiscCustom.vertexShader,fragmentShader:jt.tagDiscCustom.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.tagDiscCustom.uniforms),depthTest:!1})),this.animated=!0;var n=t.isMobile?new THREE.PlaneBufferGeometry(1.4,1.4):new THREE.PlaneBufferGeometry(1,1);return this.customStyleMaterial.uniforms.map.value=null,this.disc=new THREE.Mesh(n,new THREE.RawShaderMaterial({transparent:!0,vertexShader:jt.tagVideoMarker.vertexShader,fragmentShader:jt.tagVideoMarker.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.tagDiscCustom.uniforms),depthTest:!1})),this.disc.layers.set(pt),this.disc.renderOrder=ot,this.disc.tag=this,this.disc.pano=this.videoPano,this.disc.name="disc",e.add(this.disc),e.name="tagGroup",e}},{key:"hide",value:function(e,t){if(!this.hidden){this.hidden=!0;var n=KanKan.Deferred();if(0===this.disc.material.uniforms.opacity.value&&!pe.isRunning(this.visibleTransition))return n.resolve().promise();e=e||0,t=t||0,pe.cancel(this.visibleTransition),this.markLine&&this.markLine.hide();var i=this.disc.material.uniforms.opacity.value/1,o=t+e,r=t/o;return this.visibleTransition=pe.start(function(e){var t=ut.property(e.disc.material.uniforms.opacity,"value",0);return function(e){t(e)}}(this),o*i,(function(){n.resolve()}),r,de[Te.warp.blendEasing]),n.promise()}}},{key:"show",value:function(e,t){if(this.hidden){this.hidden=!1;var n=KanKan.Deferred();if(1===this.disc.material.uniforms.opacity.value&&!pe.isRunning(this.visibleTransition))return n.resolve().promise();e=e||0,t=t||0,pe.cancel(this.visibleTransition),this.markLine&&this.markLine.show();var i=(1-this.disc.material.uniforms.opacity.value)/1,o=t+e,r=t/o;return this.visibleTransition=pe.start(function(e){var t=ut.property(e.disc.material.uniforms.opacity,"value",1);return function(e){t(e)}}(this),o*i,(function(){n.resolve()}),r,de[Te.warp.blendEasing]),n.promise()}}},{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=this.model.player.camera,i=Te.tags.visibility,o=Te.tags.disc.scale,r=e===Ue.DOLLHOUSE||e===Ue.FLOORPLAN?Te.tags.visibility.visibleDistance:t.position.distanceTo(this.discWorldPosition);if(this.obj3d.visible=0!==this.disc.material.opacity&&(i.anyDistance||r<=i.visibleDistance||e===Ue.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.disc.quaternion.copy(t.quaternion);var a=Ie.getScaleForConstantSize({maxSize:o.maxSize,minSize:"videoPanoFlag"==this.state&&e!=Ue.PANORAMA?30:o.minSize,nearBound:o.nearBound,farBound:o.farBound,camera:t,position:this.discWorldPosition,dom:this.model.$app.dom}),s=1+Te.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.editing&&(this.discScale*=2.5)}catch(e){}this.disc.scale.set(this.discScale,this.discScale,this.discScale),this.animated&&(this.animTime+=.016,this.disc.material.uniforms.uTime.value=this.animTime)}}},{key:"tagVisibleOnCurrentFloor",value:function(e){return!(e===Ue.DOLLHOUSE||e===Ue.FLOORPLAN)||this.model.allFloorsVisible||!!this.floors.find((function(e){return!e.hidden}))}},{key:"updateVideoFlagVisible",value:function(){this.obj3d.visible&&"dollhouse"==this.model.player.mode&&(this.model.allFloorsVisible&&De.ifShelter(this.position,null,this.model.currentFloor.floorIndex)?this.videoPano.marker.visible=!1:this.videoPano.marker.visible=!!this.videoPano.marker.visibleOri)}}],[{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)/Te.tags.disc.scale.baseViewportSize)),n.currentViewportScale}}]),n}(),si=function(){function e(t){o(this,e),this.tag=t.tag,this.groundPoint=t.groundPoint||t.markerPos,this.stemLine=Gn.createLine([t.stemLineLen?this.groundPoint.clone().add(new THREE.Vector3(0,t.stemLineLen,0)):t.tag.position,this.groundPoint],{width:2,color:t.stemLineColor||"#eee"}),this.stemLine.name="markGroup-stemLine",this.stemLine.layers.set(pt),this.stemLine2&&this.stemLine2.layers.set(pt),this.tag.obj3d.parent.add(this.stemLine),this.stemLine2&&this.tag.obj3d.parent.add(this.stemLine2)}return u(e,[{key:"hide",value:function(){this.stemLine.visible=!1}},{key:"show",value:function(){this.stemLine.visible=!0}}]),e}(),li=0,ci=1,ui=2,hi=3,di=4,pi=5,fi={};function mi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}fi.TILE_SIZE=512,fi.FACES_PER_PANO=6,fi.LocationOnTile={Center:0,UpperLeft:1,UpperRight:2,LowerRight:3,LowerLeft:4},fi.getTileVector=function(e,t,n,i,o,r,a,s){var l=e/t,c=t/e*2,u=c/2,h=i/l*2-1+u,d=(o=l-1-o)/l*2-1+u;switch(r=r||fi.LocationOnTile.Center){case fi.LocationOnTile.UpperLeft:h-=u,d+=u,h+=a*c;break;case fi.LocationOnTile.UpperRight:h+=u,d+=u,d-=a*c;break;case fi.LocationOnTile.LowerRight:h+=u,d-=u,h-=a*c;break;case fi.LocationOnTile.LowerLeft:h-=u,d-=u,d+=a*c;break;case fi.LocationOnTile.Center:}switch(n){case li:Ce.setVector(s,-1,d,-h);break;case ci:Ce.setVector(s,1,d,h);break;case ui:Ce.setVector(s,-h,1,-d);break;case hi:Ce.setVector(s,-h,-1,d);break;case di:Ce.setVector(s,-h,d,1);break;case pi:Ce.setVector(s,h,d,-1)}Ce.normalize(s)},fi.getFaceForTile=function(e,t){var n=fi.TILE_SIZE;e<fi.TILE_SIZE&&(n=e);var i=Math.floor(e/n),o=i*i;return Math.floor(t/o)},fi.getTileLocation=function(e,t,n){var i=fi.TILE_SIZE;e<fi.TILE_SIZE&&(i=e);var o=fi.getFaceForTile(e,t),r=Math.floor(e/i),a=t-o*(r*r);return n.tileX=a%r,n.tileY=Math.floor(a/r),n.face=o,n.faceTileIndex=a,n},fi.getTileCountForSize=function(e){if(e<=fi.TILE_SIZE)return fi.FACES_PER_PANO;var t=Math.floor(e/fi.TILE_SIZE);return t*t*fi.FACES_PER_PANO},fi.getRelativeDirection=function(){var e=new Ce.Matrix4,t=new Ce.Quaternion;return function(n,i){t.copy(n),t.inverse(),e.makeRotationFromQuaternion(t),e.applyToVector3(i),Ce.normalize(i)}}(),fi.matchingTilesInDirection=function(){var e=new Ce.Vector3,t=new Ce.Vector3(0,0,-1),n=new Ce.Quaternion,i=function(e,t){e.push({face:t.face,faceTileIndex:t.faceTileIndex,tileX:t.tileX,tileY:t.tileY})},o=function(){var e={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(t,n,o){for(var r=fi.getTileCountForSize(t),a=0,s=0;s<r;s++)fi.getTileLocation(t,s,e),n&&!n(e)||(a++,o&&i(o,e));return a}}();return function(i,r,a,s,l,c){var u=r<fi.TILE_SIZE?r:fi.TILE_SIZE;if(!s&&!l)return o(r,null,c);var h=!!l;if(l=l||s,l=Math.max(0,Math.min(l,360)),s=Math.max(0,Math.min(s,360)),Ce.copyVector(a,e),fi.getRelativeDirection(i.quaternion,e),h){n.setFromUnitVectors(e,t);return o(r,(function(e){return fi.isTileWithinFrustum(r,u,e.face,e.tileX,e.tileY,n,s,l)}),c)}return o(r,(function(t){return fi.isTileWithinFOV(r,u,t.face,t.tileX,t.tileY,e,s)}),c)}}(),fi.isTileWithinFrustum=function(){var e=new Ce.Vector3;return function(t,n,i,o,r,a,s,l){for(var c=Math.tan(.5*l*Ce.RADIANS_PER_DEGREE),u=-c,h=Math.tan(.5*s*Ce.RADIANS_PER_DEGREE),d=-h,p=fi.mapFaceToCubemapFace(i),f=0,m=0,v=0,g=0,y=0,w=fi.LocationOnTile.Center;w<=fi.LocationOnTile.LowerLeft;w++)if(fi.getTileVector(t,n,p,o,r,w,0,e),Ce.applyQuaternionToVector(a,e),e.z>=-1e-5);else{var b=-1/e.z,E=e.x*b,x=e.y*b;x>c?f++:x<u&&m++,E>h?v++:E<d&&g++,y++}return m!==y&&f!==y&&v!==y&&g!==y}}(),fi.isTileWithinFOV=function(){var e=new Ce.Vector3,t=new Ce.Vector3(0,1,0),n=new Ce.Vector3(1,0,0);return function(i,o,r,a,s,l,c){var u=fi.mapFaceToCubemapFace(r);if(Ce.cross(l,t,n),fi.getTileVector(i,o,u,a,s,fi.LocationOnTile.Center,0,e),fi.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=fi.LocationOnTile.UpperLeft;m<=fi.LocationOnTile.LowerLeft;m++)if(fi.getTileVector(i,o,u,a,s,m,p,e),fi.isWithinFOV(e,l,c,null))return!0;p+=h}return!1}}(),fi.isWithinFOV=function(){var e=new Ce.Vector3,t=new Ce.Vector3;return function(n,i,o,r){if(Ce.copyVector(n,t),r){Ce.copyVector(r,e),Ce.normalize(e);var a=Ce.dot(e,n);e.x*=a,e.y*=a,e.z*=a,Ce.subVector(t,e)}var s=o/2*Ce.RADIANS_PER_DEGREE,l=Math.cos(s);return Ce.dot(t,i)>=l}}(),fi.mapFaceToCubemapFace=function(){var e={0:ui,1:di,2:li,3:pi,4:ci,5:hi};return function(t){return e[t]}}();var vi=function(e){f(n,THREE.Object3D);var t=mi(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 r.minFilter=THREE.LinearFilter,r.magFilter=THREE.LinearFilter,e.sprite=new THREE.Sprite(new THREE.SpriteMaterial({map:r,color:16777215,transparent:!0,depthTest:!1,depthWrite:!1})),e.add(e.sprite),e.sprite.renderOrder=null!=i.renderOrder?i.renderOrder:2,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=i.borderRadius||6,null!=i.text&&e.setText(i.text),e.name=i.name,e.addEventListener("dispose",e.dispose.bind(h(e))),e}return u(n,[{key:"setText",value:function(e){this.text!==e&&(this.text=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="Bold "+this.fontsize+"px "+this.fontface,t["font-weight"]=100;var n=t.measureText(this.text).width,i=new THREE.Vector2(this.fontsize,.4*this.fontsize),o=2*i.x+n+2*this.rectBorderThick,r=2*i.y+this.fontsize+2*this.rectBorderThick;t.canvas.width=o,t.canvas.height=r,t.font="Bold "+this.fontsize+"px "+this.fontface;t.textBaseline="middle",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,o-this.rectBorderThick,r-this.rectBorderThick,this.borderRadius),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,this.rectBorderThick+i.x,r/2+2)),t.fillStyle="rgba("+this.textColor.r+","+this.textColor.g+","+this.textColor.b+","+this.textColor.a+")",t.fillText(this.text,this.rectBorderThick+i.x,r/2+2);var a=new THREE.Texture(e);a.minFilter=THREE.LinearFilter,a.magFilter=THREE.LinearFilter,a.needsUpdate=!0,this.sprite.material.map&&this.sprite.material.map.dispose(),this.sprite.material.map=a,this.sprite.scale.set(.01*o,.01*r,1)}},{key:"roundRect",value:function(e,t,n,i,o,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+i-r,n),e.arcTo(t+i,n,t+i,n+r,r),e.lineTo(t+i,n+o-r),e.arcTo(t+i,n+o,t+i-r,n+o,r),e.lineTo(t+r,n+o),e.arcTo(t,n+o,t,n+o-r,r),e.lineTo(t,n+r),e.arcTo(t,n,t+r,n,r),e.closePath(),e.fill(),e.stroke()}},{key:"dispose",value:function(){this.sprite.material.uniforms.map.value.dispose(),this.parent&&this.parent.remove(this),this.sprite.dispatchEvent({type:"dispose"}),this.removeAllListeners()}}]),n}();function gi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var yi=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),-Math.PI/2),wi={sizeInfo:{minSize:200,maxSize:250,nearBound:.8,farBound:10},backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:nt},bi=function(e){f(n,EventEmitter);var t=gi(n);function n(e,i,r,a,s){var l,c,u,d,p;if(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.parent}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>Te.panoramaNeighbourMaxDistance)return this.model.panos.setNeighbour(this,e,!1),void n.raycastsSkipped++;var i=e.position.clone().sub(this.position).normalize(),o=new THREE.Raycaster(this.position,i.clone(),0,t).intersectObjects(this.model.colliders);n.raycastsDone++,this.model.panos.setNeighbour(this,e,0===o.length),Te.showNeighbourRaycasts&&(o.length?this.floor.model.add(new THREE.ArrowHelper(i,this.position,o[0].distance,16711680)):this.floor.model.add(new THREE.ArrowHelper(i,this.position,t,16777215,0,0)))}}.bind(this)),this.model.panos.neighbourMap[this.id]},l.enter=(c=null,function(){this.setZoomed(!1),this.emit(gt.Enter,c,this),c=this,this.model.setHighMap(this)}),l.loadTiledPano=(u={},d={},p={},function(e,t,n,i,o,r){null!=i||(i=!0),null!=o||(o=!0);var a=this.getWaitDeferred(e),s=a.deferred,l=null,c=null;if(n&&("number"==typeof n?l=n:(l=n.hFov,c=n.vFov)),this.isLoaded(e))s.resolve(e);else{if(!a.active){a.active=!0;var h=this.id+":"+e;if(u[h]=u[h]||[],p[h]=null,n){var f=[],m=fi.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),Le.info("Loading partial pano: "+this.id+" with "+m+" tiles")}d[this.id]||(d[this.id]=!0,this.on(gt.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(gt.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(gt.TileLoaded,function(e,t,n){var i=this.id+":"+e;u[i]=u[i]||[];var o=fi.getTileLocation(e,t,{}),r=o.faceTileIndex,a=o.face;u[i].push({faceTileIndex:r,face:a});var s=this.getWaitDeferred(e).deferred;if(s&&"pending"===s.state()&&(s.notify(e,t,n),p[i])){var l=p[i].find((function(e){return e.faceTileIndex==r&&e.face==a}));l&&(l.loaded=!0),p[i].some((function(e){return!e.loaded}))||(this.onPanoRendered(this.id,e,n,!0),s.resolve(e,n),this.resetWaitDeferred(e),p[i]=null)}}.bind(this)))}this.tileDownloader.clearForceQueue(),this.tileDownloader.forceQueueTilesForPano(this,e,t,l,c,r),this.tiledPanoRenderTarget=this.panoRenderer.activateTiledPano(this,this.qualityManager.getMaxNavPanoSize(),i),this.panoRenderer.renderPanoTiles(this.id,t,o)}return s.promise()}),l.$app=e,l.model=l.$app.core.get("Player").model,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.skyboxMesh=new THREE.Mesh(Te.sphereBufferGeometry),l.skyboxMesh.position.copy(l.position),l.skyboxMesh.name="skybox",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.noBlocks=[],l.blocks=[],l.seeMarkers=r.seeMarkers,l.tiled=null!=r.tiled?r.tiled:l.model.supportsTiles,l.isAligned()&&(l.marker=new ti(h(l))),l.tiled){l.solidSkybox=null;var f=(new THREE.Quaternion).multiplyQuaternions(l.quaternion,yi);l.skyboxMesh.quaternion.copy(f),l.skyboxMesh.updateMatrix(),l.skyboxMesh.updateMatrixWorld(),l.rot90Matrix=l.skyboxMesh.matrixWorld.clone()}else{l.solidSkybox=new THREE.Texture([null,null,null,null,null,null]),l.solidSkybox.flipY=!1,Te.minimalMemoryMode&&(l.solidSkybox.minFilter=THREE.LinearFilter,l.solidSkybox.magFilter=THREE.LinearFilter,l.solidSkybox.generateMipmaps=!1);f=r.quaternion.clone();l.quaternion=(new THREE.Quaternion).multiplyQuaternions(f,yi)}return l.skyboxMesh.material.color=new THREE.Color(1,1,1),l.skyboxMesh.quaternion.copy(l.quaternion),l.skyboxMesh.name="skybox",l.skyboxMesh.visible=!1,l.skyboxMesh.updateMatrix(),l.skyboxMesh.updateMatrixWorld(),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}return u(n,[{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){this.hasVideo&&this.panoVideoRenderer.ifEnable()||this.marker&&pe.start(ut.property(this.marker.material,"opacity",Te[e].markerOpacityOnHover),250)}},{key:"hoverOff",value:function(e){this.hasVideo&&this.panoVideoRenderer.ifEnable()||this.marker&&pe.start(ut.property(this.marker.material,"opacity",Te[e].markerOpacity),250)}},{key:"build1",value:function(){this.floor=this.floor||this.model.floors.get(this.floorIndex)||this.raycastToFindFloor()||this.model.getFloorAtPoint(this.position),this.floor.addPano(this),this.floorPosition=this.floorPosition||this.raycastFloorPosition(),this.neighbourPanos=this.neighbourPanos||this.findNeighourPanos(),Te.colorMarkerByFloor&&this.marker&&this.marker.material.color.set(this.floor.debugColor)}},{key:"build2",value:function(){this.floorPosition=this.floorPosition||this.interpolateFloorPosition(),this.height=this.position.distanceTo(this.floorPosition),this.placeMarker()}},{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(ht.TileRenderSuccess,this.onTileRendered.bind(this)),this.panoRenderer.on(ht.PanoRenderComplete,this.onPanoRendered.bind(this)),this.panoRenderer.on(ht.TileRenderFailure,this.onTileRenderFail.bind(this)),this.panoRenderer.on(ht.UploadAttemptedForAllTiles,this.onUploadAttemptedForAllTiles.bind(this))}},{key:"updateMakerStyle",value:function(){this.marker&&(this.hasVideo&&this.panoVideoRenderer.ifEnable()||this.panoVideo?this.marker.updateStyle(this.model,this):this.marker.updateStyle("normal",this))}},{key:"updateMarkerVisible",value:function(e,t){this.flagSpot&&(e&&(t.linkEditor&&t.linkEditor.setPanoVisible||t.linkEditor.checkHasNeighbor(this)&&(t.currentPano!=Ue.PANORAMA||this.neighbourPanos[t.currentPano.id]))?this.marker.visible=!0:this.marker.visible=!1)}},{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=tt,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:"attachToPanoVideoRenderer",value:function(e){this.hasVideo&&(this.panoVideoRenderer=e,this.on(gt.Enter,e.onVideoPanoramasEnter.bind(e)),this.on(gt.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:Ge(),active:!1},t[e]=n),n}},{key:"resetWaitDeferred",value:function(e){var t=this.getWaitDeferred(e);t.active=!1,t.deferred=Ge()}},{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=Ge()}}},{key:"onUploadAttemptedForAllTiles",value:function(e,t,n){e===this.id&&(t===this.qualityManager.getPanoSize(yt)&&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(gt.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(gt.LoadComplete,t,n))}},{key:"setZoomed",value:function(e){this.zoomed=e,this.updateSkyboxForZoomLevel(),e?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(gt.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 Le.info("Skipping load of pano, already loaded"),Ze.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 Vn.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),this.solidSkybox.needsUpdate=!0,this.emit("load",e),this.model.emit("load",this),this}.bind(this),function(){Le.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=Ge(),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:"addLabel",value:function(){this.removeLabel(),this.label=new vi(Object.assign({},wi,{text:this.id})),this.label.position.copy(this.floorPosition),this.floor.add(this.label)}},{key:"removeLabel",value:function(){this.label&&(this.floor.remove(this.label),this.label.material.dispose(),this.label=null)}}]),n}();function Ei(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}bi.raycastsSkipped=0,bi.raycastsDone=0,bi.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}},inPanoDirection:function(e,t,n){return n=Te.navigation.panoScores?Te.navigation.filterStrictness:n,function(i){var o=i.floorPosition.clone().sub(e).normalize(),r=i.position.clone().sub(e).normalize();return o.dot(t)>n||r.dot(t)>n}},atFloor:function(e){return function(t){return!e||t.floor===e}},not:function(e){return function(t){return t!==e}},notIn:function(e){return function(t){return-1===e.indexOf(t)}},isLoaded:function(){return function(e){return e.isLoaded()}},isNotLoaded:function(){return function(e){return!e.isLoaded()}},isCloseEnoughTo:function(e,t){return function(n){return e.distanceTo(n.floorPosition)<t}},hasMinimumHeightDifferenceTo:function(e,t){return function(n){return Math.abs(n.position.y-e.y)>t}},isNotBehindNormal:function(e,t){var n=new THREE.Vector3;return t=t.clone(),function(i){return n.copy(i.position).sub(e).normalize().dot(t)>0}},isNeighbourPanoTo:function(e){return function(t){return!e||!e.neighbourPanos||!!e.neighbourPanos[t.id]}},isNeighbourOfNeighbourTo:function(e){return function(t){return!!e.neighbourPanos[t.id]||e.neighbourUUIDs.some((function(n){var i=e.model.panos.get(n);return!!i&&i.neighbourPanos[t.id]}))}},isNotRecentlyFailed:function(e){return function(t){return Date.now()-t.failedLoadingAt>e}},isOnVisibleFloor:function(){return function(e){return!e.floor.hidden}},isPanoAligned:function(){return function(e){return e.isAligned()}},isInFanAngle:function(e,t,n){return function(i){var o=t.setY(0),r=i.position.clone().sub(e).setY(0);return o.angleTo(r)<=n}}},bi.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}}},bi.scoreFunctions={distance:function(e,t){return t=t||Te.navigation.distanceFactor,function(n){return e?e.position.distanceTo(n.position)*t:0}},distanceSquared:function(e,t){return t=t||Te.navigation.distanceFactor,function(n){return e?e.position.distanceToSquared(n.position)*t:0}},direction:function(e,t){return function(n){return n.position.clone().sub(e).normalize().dot(t)*Te.navigation.directionFactor}},angle:function(e,t){return function(n){return n.position.clone().sub(e).normalize().angleTo(t)*Te.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*Te.navigation.optionalityFactor}},penalizeHeightDifferenceUnder:function(e,t){return function(n){return e.y-n.position.y<t?-20:0}}};var xi=function(e){f(n,e);var t=Ei(n);function n(){var e;return o(this,n),(e=t.call(this)).neighbourMap={},e.map=null,e}return u(n,[{key:"getIndex",value:function(e){return e.id}},{key:"find",value:function(e,t){var n=le.filterAll(this.list,e);return 0===n.length?null:(t&&t.forEach((function(e){n=le.stableSort(n,e)})),n[0])}},{key:"sortByScore",value:function(e,t){var n=le.filterAll(this.list,e);return 0===n.length?null:n=n.map((function(e){return{pano:e,score:t.reduce((function(t,n){return t+n(e)}),0)}})).sort((function(e,t){return t.score-e.score}))}},{key:"lowestByScore",value:function(e,t,n){return this.findRankedByScore(0,e,t,n)}},{key:"findRankedByScore",value:function(e,t,n,i){i&&(i.candidates=null,i.pano=null),e||(e=0);var o=this.sortByScore(t,n);return!o||0===o.length||e>=o.length?null:(i&&(i.candidates=o,i.pano=o[e].pano),o[e].pano)}},{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=[bi.filters.isPanoAligned()];return t&&n.push(bi.filters.inDirection(e,t,.75)),this.find(n,[bi.sortFunctions.distanceToPoint(e)])}},{key:"fadeMarkerOpacity",value:function(e,t,n){if(pe.cancelById("fadeMarkerOpacity"),this.list.findIndex((function(e){return e.marker}))<0)logger.info("marker findIndex<0");else{var i,o=function(e,n){e.member=e.member.filter((function(t){return t.marker&&t.marker.material.opacity!=e.toOp})),pe.trigger({func:function(t,n){e.member.forEach((function(n){var i=n.marker.oldOpacity,o=i+t*(e.toOp-i);n.marker&&(n.marker.material.opacity=o)}))}.bind(this),duration:null==t?Te.markerOpacityTransitionTime:t,name:"_fpm_"+n,id:"fadeMarkerOpacity"})};this.forEach((function(e){e.marker&&(e.marker.oldOpacity=e.marker.material.opacity)})),i=(e=null==e?Te.panorama.markerOpacity:e)>0&&n?n:[{member:this.list,toOp:e}];for(var r=0;r<i.length;r++)o(i[r],r)}}},{key:"closestPanoTowardPoint",value:function(e){var t=e.point,n=e.require||[],i=e.rank||[];e.force;var o=e.getAll;n.push(bi.filters.isPanoAligned()),e.floor&&n.push(bi.filters.atFloor(e.floor));var r={position:t};i.push(bi.scoreFunctions.distanceSquared(r,-2));var a=this.sortByScore(n,i);return o?a:a&&a.length>0&&a[0].pano}}]),n}($e);function Ti(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Pi=function(e){f(n,THREE.Mesh);var t=Ti(n);function n(e,i,r){var a;o(this,n),e=e.clone().expandByScalar(.01);var s=new THREE.Vector3;e.getSize(s);var l=new THREE.BoxGeometry(s.x,s.y,s.z);l.computeBoundingBox(),a=t.call(this,l,i);var c=new THREE.Vector3;return e.getCenter(c),a.position.copy(c),a.frustumCulled=!1,r&&a.add(new THREE.WireframeHelper(h(a))),a}return n}();function ki(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ri=function(e){f(n,THREE.RawShaderMaterial);var t=ki(n);function n(e,i){if(o(this,n),(e=e||{}).not_Cube){var r=e.defines||{};r.Not_Cube="",e.defines=r}i=i||"model";return t.call(this,le.extendObject({fragmentShader:jt[i].fragmentShader,vertexShader:jt[i].vertexShader,uniforms:THREE.UniformsUtils.clone(jt[i].uniforms),name:"ModelTextureMaterial"},e))}return u(n,[{key:"setProjectedPanos",value:function(e,t,n){var i=this;if(n&&(this.uniforms.progress.value=0),e.ensureSkyboxReadyForRender(),this.uniforms.pano0Map.value=e.getSkyboxTexture(),this.uniforms.pano0Position.value.copy(e.position),this.uniforms.pano0Matrix.value.copy(e.skyboxMesh.matrixWorld),t.ensureSkyboxReadyForRender(),delete this.defines.HasVideo,this.updateTexDefines(e,t),t.hasVideo){this.uniforms.exposure.value=t.videoInfo.exposure||1,this.uniforms.blendFov.value=t.videoInfo.blendFov||5,t.videoInfo.clipRect&&this.uniforms.clipRect.value.set(t.videoInfo.clipRect.leftBottom.x,t.videoInfo.clipRect.leftBottom.y,t.videoInfo.clipRect.rightTop.x,t.videoInfo.clipRect.rightTop.y),this.defines.VideoMapping=t.videoInfo.mapping||0,this.defines.HasVideo=t.videoInfo.cameraType||8;var o=t.panoVideoRenderer.videoPlayer,r=o._resource?o._resource.get(t.id).video:o.instances.get(t.id).videoElement;0==r.readyState?r.addEventListener("resize",(function(e){i.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}),!1):this.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}this.needsUpdate=!0,this.uniforms.pano1Map.value=t.getSkyboxTexture(),this.uniforms.pano1Position.value.copy(t.position),this.uniforms.pano1Matrix.value.copy(t.skyboxMesh.matrixWorld)}},{key:"updateTexDefines",value:function(e,t){var n=this,i=!1,o=function(e,t){e.tiled?null!=n.defines["Not_Cube_"+t]&&(delete n.defines["Not_Cube_"+t],i=!0):null==n.defines["Not_Cube_"+t]&&(n.defines["Not_Cube_"+t]="",i=!0)};o(e,0),o(t,1),i&&(this.needsUpdate=!0)}}]),n}();function Mi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Si=function(e){f(n,e);var t=Mi(n);function n(e){var i;o(this,n),Le.time("Computing a nice bounding cubemap");var r=new Ri({side:THREE.BackSide,transparent:!0});return r.uniforms.modelAlpha.value=0,r.uniforms.opacity.value=1-Te.modelAlpha,(i=t.call(this,e,r)).renderOrder=et,Le.timeEnd("Computing a nice bounding cubemap"),i}return n}(Pi);function Ii(){}Ii.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t)for(var r=0,a=i.length;r<a;r++)i[r].fn!==t&&i[r].fn._!==t&&o.push(i[r]);return o.length?n[e]=o:delete n[e],this}};var Ci=Ii,Ai=Ii;Ci.TinyEmitter=Ai;var Di={map:{type:"t",value:null},opacity:{type:"f",value:0},opaRadius:{type:"f",value:.2}},Li="varying vec2 vUv;void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}",Vi="uniform sampler2D map; uniform float opacity;uniform float opaRadius;varying vec2 vUv; void main() { vec2 vUv2 = vec2(vUv.x*2.0 - 1.0, vUv.y*2.0 - 1.0); vec4 colorFromTexture = texture2D( map, vUv ); float opa = 1.0; float r = vUv2.x*vUv2.x + vUv2.y*vUv2.y; if(r > 1.0) opa = 0.0; else if(r < opaRadius)opa = 1.0; else{\tfloat a = -1.0 / ((opaRadius - 1.0)*(opaRadius - 1.0));\tfloat b = -2.0 * a * opaRadius;\tfloat c = 1.0 + a * opaRadius * opaRadius; opa = a * r*r + b * r + c; } gl_FragColor = vec4(colorFromTexture.rgb, opacity * min(colorFromTexture.a, opa) );}";function Hi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var zi={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}},Oi=function(e){f(n,e);var t=Hi(n);function n(e){var i,r,a;return o(this,n),(i=t.call(this)).changefloorLogoOpa=function(e){if(this.firstLogo){var t=0==e.index?this.firstLogo:this.secondLogo;pe.cancelById("flOpa_"+e.index),null!=e.from&&(t.material.uniforms.opacity.value=e.from),e.dur?pe.start(ut.uniform(t,"opacity",e.opa),e.dur||0,null,e.delay||0,de.easeInQuad,"changefloorLogoOpa","flOpa_"+e.index):t.material.uniforms.opacity.value=e.opa}},i.updateFloorlogo=(r=new THREE.Quaternion,a=function(e,t,n){return Math.abs(e-t)<n},function(e){var t,n;if(!this.fixDirection&&e&&this.firstLogo&&this.secondLogo&&((this.firstLogo.visible||0!=this.firstLogo.material.uniforms.opacity.value||this.secondLogo.visible||0!=this.secondLogo.material.uniforms.opacity.value)&&(n=!0),n)){var i,o=this.app.core.get("Player").camera.quaternion;if((i=a(o.x,r.x,.005)&&a(o.y,r.y,.005)&&a(o.z,r.z,.005)&&a(o.w,r.w,.005))||(r=o.clone()),!i){if(!t){var s=new THREE.Vector3(0,0,-1);s.applyQuaternion(e),s.setY(0);var l=(new THREE.Matrix4).lookAt(s,new THREE.Vector3,new THREE.Vector3(0,1,0));t=(new THREE.Quaternion).setFromRotationMatrix(l);var c=new THREE.Quaternion(0,.7071067811865476,.7071067811865476,0);t.multiply(c)}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.firstLogo={visible:!0},i.secondLogo={visible:!0},i.fixDirection=!1,i}return u(n,[{key:"bindEvents",value:function(){}},{key:"createFloorLogo",value:function(){var e=this.getLogo(),t=e.url,n=e.size/100,i=zn.load(t);this.firstLogo=this.getLogoMesh(i),this.secondLogo=this.getLogoMesh(i),this.secondLogo.visible=!1,this.firstLogo.scale.set(n,n,n),this.secondLogo.scale.set(n,n,n),this.emit("ready"),this.ready=!0}},{key:"changeFloorLogo",value:function(e){if(this.ready){if(this.firstLogo.material.uniforms.map.value&&this.firstLogo.material.uniforms.map.value.dispose(),this.secondLogo.material.uniforms.map.value&&this.secondLogo.material.uniforms.map.value.dispose(),e.url){var t=zn.load(e.url);this.firstLogo.material.uniforms.map.value=t,this.secondLogo.material.uniforms.map.value=t}else if(e.id){var n=zn.load(this.app.resource.getAppURL("images/floorlogos/".concat(e.id,".png")));this.firstLogo.material.uniforms.map.value=n,this.secondLogo.material.uniforms.map.value=n}else if(e.image){var i=new THREE.Texture(e.image);i.needsUpdate=!0,this.firstLogo.material.uniforms.map.value=i,this.secondLogo.material.uniforms.map.value=i,this.firstLogo.material.needsUpdate=!0,this.secondLogo.material.needsUpdate=!0}if(e.size){var o=e.size/100;this.firstLogo.scale.set(o,o,o),this.secondLogo.scale.set(o,o,o)}}}},{key:"getLogo",value:function(){var e=this.app.store.getValue("metadata"),t=e.floorLogo||"0";"zh"!=this.app.config.lang&&(t="en/"+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:"getLogoMesh",value:function(e){var t=THREE.UniformsUtils.clone(Di);t.map.value=e;var n=new THREE.ShaderMaterial({fragmentShader:Vi,vertexShader:Li,uniforms:t,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,depthTest:!1}),i=new THREE.Mesh(new THREE.PlaneGeometry(2.5,2.5,1,1),n);i.name="floorlogo";var o=zi.floorLogo.size/100;return i.scale.set(o,o,o),i.position.set(zi.floorLogo.position.x,zi.floorLogo.position.y,zi.floorLogo.position.z),i.lookAt(i.position.clone().add(new THREE.Vector3(0,1,0))),i.renderOrder=zi.floorLogo.renderOrder,i}}]),n}(Ci);function Fi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ni=THREE.BoxBufferGeometry,Bi=THREE.BufferGeometry,Ui=THREE.Color,_i=THREE.CylinderBufferGeometry,ji=THREE.DoubleSide,Wi=THREE.Euler,Qi=THREE.Float32BufferAttribute,Zi=THREE.Line;THREE.LineBasicMaterial;var Gi=THREE.Matrix4,qi=THREE.Mesh,Yi=THREE.MeshBasicMaterial,$i=THREE.Object3D,Xi=THREE.OctahedronBufferGeometry,Ji=THREE.PlaneBufferGeometry,Ki=THREE.Quaternion;THREE.Raycaster;var eo,to,no,io,oo,ro,ao=THREE.TorusBufferGeometry,so=new THREE.Raycaster,lo=new THREE.Vector3,co=new THREE.Vector3,uo=new THREE.Quaternion,ho={X:new THREE.Vector3(1,0,0),Y:new THREE.Vector3(0,1,0),Z:new THREE.Vector3(0,0,1)},po=new THREE.Vector3,fo=new THREE.Vector3,mo=new THREE.Vector3,vo=new THREE.Vector3,go=new THREE.Vector3,yo=new THREE.Vector3,wo=0,bo=new THREE.Vector3,Eo=new THREE.Quaternion,xo=new THREE.Vector3,To=new THREE.Vector3,Po=new THREE.Quaternion,ko=new THREE.Quaternion,Ro=new THREE.Vector3,Mo=new THREE.Vector3,So=new THREE.Quaternion,Io=new THREE.Vector3,Co=new THREE.Vector3,Ao=new THREE.Quaternion,Do=new THREE.Quaternion,Lo=new THREE.Vector3,Vo=new THREE.Vector3,Ho=new THREE.Vector3,zo=new THREE.Quaternion,Oo=new THREE.Vector3,Fo=function(e){f(n,THREE.Object3D);var t=Fi(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,oo=new No(r),a.add(oo),ro=new qo(r),a.add(ro),a.player=r.player,a.options=r,eo={type:"change"},to={type:"mouseDown"},no={type:"mouseUp",mode:a.mode},io={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("size",1),a.defineProperty("dragging",!1),a.defineProperty("showX",!0),a.defineProperty("showY",!0),a.defineProperty("showZ",!0),a.defineProperty("worldPosition",Co),a.defineProperty("worldPositionStart",Mo),a.defineProperty("worldQuaternion",Ao),a.defineProperty("worldQuaternionStart",So),a.defineProperty("cameraPosition",bo),a.defineProperty("cameraQuaternion",Eo),a.defineProperty("pointStart",po),a.defineProperty("pointEnd",fo),a.defineProperty("rotationAxis",vo),a.defineProperty("rotationAngle",wo),a.defineProperty("eye",Vo),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),document.addEventListener("mouseup",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)),document.removeEventListener("mouseup",this.onPointerUp.bind(this)),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){this.fatLineMats.forEach((function(e){}))}},{key:"switchEditState",value:function(e){"overlay"==e||"panovideo"==e&&(this.mode="scale"),this.editState=e}},{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,ro[e]=t,oo[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(eo))}}),this[e]=t,ro[e]=t,oo[e]=t}},{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),this.object.parent.matrixWorld.decompose(To,Po,Ro),this.object.matrixWorld.decompose(Co,Ao,Lo),ko.copy(Po).invert(),Do.copy(Ao).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(bo,Eo,xo),Vo.copy(bo).sub(Co).normalize(),$i.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);so.set(t,this.player.getMouseDirection(e));var n=so.intersectObjects(oo.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);so.set(t,this.player.getMouseDirection(e));var n=so.intersectObjects([ro],!0)[0]||!1;if(n){var i=this.space;if("scale"===this.mode?i="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(i="world"),"local"===i&&"rotate"===this.mode){var o=this.rotationSnap;"X"===this.axis&&o&&(this.object.rotation.x=Math.round(this.object.rotation.x/o)*o),"Y"===this.axis&&o&&(this.object.rotation.y=Math.round(this.object.rotation.y/o)*o),"Z"===this.axis&&o&&(this.object.rotation.z=Math.round(this.object.rotation.z/o)*o)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),Ho.copy(this.object.position),zo.copy(this.object.quaternion),Oo.copy(this.object.scale),this.object.matrixWorld.decompose(Mo,So,Io),po.copy(n.point).sub(Mo),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!1)}this.dragging=!0,to.mode=this.mode,this.dispatchEvent(to)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,i=this.object,o=this.space;if("scale"===n?o="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(o="world"),console.log(t),void 0!==i&&null!==t&&!1!==this.dragging&&(void 0===e.button||0===e.button)){var r=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);so.set(r,this.player.getMouseDirection(e));var a=so.intersectObjects([ro],!0)[0]||!1;if(!1!==a){if(fo.copy(a.point).sub(Mo),"translate"===n){if(mo.copy(fo).sub(po),"local"===o&&"XYZ"!==t&&mo.applyQuaternion(Do),-1===t.indexOf("X")&&(mo.x=0),-1===t.indexOf("Y")&&(mo.y=0),-1===t.indexOf("Z")&&(mo.z=0),"local"===o&&"XYZ"!==t?mo.applyQuaternion(zo).divide(Ro):mo.applyQuaternion(ko).divide(Ro),i.overlayType){var s=i.floor.boundingBox.min.y-mo.y-Ho.y;s>0&&s<.024&&(mo.y=i.floor.boundingBox.min.y-Ho.y)}i.position.copy(mo).add(Ho),this.translationSnap&&("local"===o&&(i.position.applyQuaternion(uo.copy(zo).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(zo)),"world"===o&&(i.parent&&i.position.add(lo.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(lo.setFromMatrixPosition(i.parent.matrixWorld))))}else if("scale"===n){if(-1!==t.search("XYZ")){var l=fo.length()/po.length();fo.dot(po)<0&&(l*=-1),this.options.NoScaleZ?co.set(l,l,1):co.set(l,l,l)}else lo.copy(po),co.copy(fo),lo.applyQuaternion(Do),co.applyQuaternion(Do),co.divide(lo),-1===t.search("X")&&(co.x=1),-1===t.search("Y")&&(co.y=1),-1===t.search("Z")&&(co.z=1);if("overlay"==this.editState){if(Oo.x*co.x*Te.overlay.width<.1)return;if(Oo.x*co.x*Te.overlay.width>10)return;if(Oo.y*co.y*Te.overlay.height<.1)return;if(Oo.y*co.y*Te.overlay.height>10)return}i.scale.copy(Oo).multiply(co),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=Te.overlay.width*i.scale.x,i.height=Te.overlay.height*i.scale.y,this.player.EditOverlay.updateOverlayScaleDisplay())}else if("rotate"===n){if(mo.copy(fo).sub(po),"floorplan"==this.player.mode)var c=this.player.cameraControls.cameras.floorplan,u=5/((c.right-c.left)/c.aspect);else u=5/Co.distanceTo(lo.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(vo.copy(Vo),wo=fo.angleTo(po),go.copy(po).normalize(),yo.copy(fo).normalize(),wo*=yo.cross(go).dot(Vo)<0?1:-1):"XYZE"===t?(vo.copy(mo).cross(Vo).normalize(),wo=mo.dot(lo.copy(vo).cross(this.eye))*u):"X"!==t&&"Y"!==t&&"Z"!==t||(vo.copy(ho[t]),lo.copy(ho[t]),"local"===o&&lo.applyQuaternion(Ao),wo=mo.dot(lo.cross(Vo).normalize())*u),this.rotationSnap&&(wo=Math.round(wo/this.rotationSnap)*this.rotationSnap),this.rotationAngle=wo,"local"===o&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(zo),i.quaternion.multiply(uo.setFromAxisAngle(vo,wo)).normalize()):(vo.applyQuaternion(ko),i.quaternion.copy(uo.setFromAxisAngle(vo,wo)),i.quaternion.multiply(zo).normalize())}this.dispatchEvent(eo),this.dispatchEvent(io)}}}},{key:"pointerUp",value:function(e){this.dragging&&null!==this.axis&&(no.mode=this.mode,this.dispatchEvent(no)),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)}},{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}(),No=function(e){f(n,THREE.Object3D);var t=Fi(n);function n(e){var i;o(this,n),(i=t.call(this)).type="TransformControlsGizmo",i.player=e.player;var r=new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:ji,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(53501),d.clone().color.set(16776960),d.clone().color.set(65535),d.clone().color.set(16711935),r.clone().color.set(16776960);var p=a.clone();p.color.set(16711680);var f=Gn.createFatLineMat({lineWidth:3,color:16711680,depthTest:!1,opacity:.9});e.fatLineMats.push(f);var m=a.clone();m.color.set(65280);var v=Gn.createFatLineMat({lineWidth:3,color:65280,depthTest:!1,opacity:.9});e.fatLineMats.push(v);var g=a.clone();g.color.set(255);var y=Gn.createFatLineMat({lineWidth:3,color:255,depthTest:!1,opacity:.9});e.fatLineMats.push(y),a.clone().color.set(65535),a.clone().color.set(16711935);var w=a.clone();w.color.set(16776960);var b=a.clone();b.color.set(7895160),w.clone().opacity=.25;var E=new _i(0,.07,.2,12,1,!1),x=new Ni(.125,.125,.125),T=new Bi;T.setAttribute("position",new Qi([0,0,0,1,0,0],3));var P={},k=Gn.createFatLine([{x:0,y:0,z:0},{x:.5,y:0,z:0}],{});P["x+"]=k.geometry,k=Gn.createFatLine([{x:0,y:0,z:0},{x:-.5,y:0,z:0}],{}),P["x-"]=k.geometry,k=Gn.createFatLine([{x:0,y:0,z:0},{x:0,y:.5,z:0}],{}),P["y+"]=k.geometry,k=Gn.createFatLine([{x:0,y:0,z:0},{x:0,y:-.5,z:0}],{}),P["y-"]=k.geometry,k=Gn.createFatLine([{x:0,y:0,z:0},{x:0,y:0,z:.5}],{}),P["z+"]=k.geometry,k=Gn.createFatLine([{x:0,y:0,z:0},{x:0,y:0,z:-.5}],{}),P["z-"]=k.geometry;var R,M=function(e,t){var n=new THREE.Line(e,t);return n.computeLineDistances(),n.scale.set(1,1,1),n.renderOrder=4,n},S=function(e,t){for(var n=new Bi,i=[],o=0;o<=64*t;++o)i.push(0,Math.cos(o/32*Math.PI)*e,Math.sin(o/32*Math.PI)*e);return n.setAttribute("position",new Qi(i,3)),n},I={X:[[new qi(E,c),[.5,0,0],[0,0,-Math.PI/2],null,"fwd"],[M(P["x+"],f)]],Y:[[new qi(E,u),[0,.5,0],null,null,"fwd"],[M(P["y+"],v)]],Z:[[new qi(E,h),[0,0,.5],[Math.PI/2,0,0],null,"fwd"],[M(P["z+"],y)]]},C={X:[[new qi(new _i(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new qi(new _i(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new qi(new _i(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]]},A={START:[[new qi(new Xi(.01,2),l),null,null,null,"helper"]],END:[[new qi(new Xi(.01,2),l),null,null,null,"helper"]],DELTA:[[new Zi((R=new Bi,R.setAttribute("position",new Qi([0,0,0,1,1,1],3)),R),l),null,null,null,"helper"]],X:[[new Zi(T,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Zi(T,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Zi(T,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},D={X:[[new Zi(S(1,.5),p)],[new qi(new Xi(.04,0),c),[0,0,.99],null,[1,3,1]]],Y:[[new Zi(S(1,.5),m),null,[0,0,-Math.PI/2]],[new qi(new Xi(.04,0),u),[0,0,.99],null,[3,1,1]]],Z:[[new Zi(S(1,.5),g),null,[0,Math.PI/2,0]],[new qi(new Xi(.04,0),h),[.99,0,0],null,[1,3,1]]],XYZE:[[new Zi(S(1,1),b),null,[0,Math.PI/2,0]]]},L={AXIS:[[new Zi(T,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},V={X:[[new qi(new ao(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new qi(new ao(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new qi(new ao(1,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]]},H={X:[[new qi(x,c),[.5,0,0],[0,0,-Math.PI/2]],[M(P["x+"],f),null,null]],Y:[[new qi(x,u),[0,.5,0]],[M(P["y+"],v)]],XYZX:[[new qi(new Ni(.125,.125,.125),d.clone()),[.5,.5,0]]]},z={X:[[new qi(new _i(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new qi(new _i(.2,0,.5,4,1,!1),s),[0,.3,0]]],XYZX:[[new qi(new Ni(.2,.2,.2),s),[.5,.5,0]]]},O={X:[[new Zi(T,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Zi(T,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Zi(T,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},F=function(e){var t=new $i;for(var n in e)for(var i=e[n].length;i--;){var o=e[n][i][0].clone(),r=e[n][i][1],a=e[n][i][2],s=e[n][i][3],l=e[n][i][4];if(o.name=n,o.tag=l,r&&o.position.set(r[0],r[1],r[2]),a&&o.rotation.set(a[0],a[1],a[2]),s&&o.scale.set(s[0],s[1],s[2]),o.updateMatrix(),o.geometry.clone()){var c=o.geometry.clone();c.applyMatrix4(o.matrix),o.geometry=c}else o.geometry.applyMatrix4(o.matrix);o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),t.add(o)}return t},N=new THREE.Vector3(0,0,0),B=new Wi,U=new THREE.Vector3(0,1,0),_=new THREE.Vector3(0,0,0),j=new Gi,W=new Ki,Q=new Ki,Z=new Ki,G=new THREE.Vector3(1,0,0),q=new THREE.Vector3(0,1,0),Y=new THREE.Vector3(0,0,1);return i.gizmo={},i.picker={},i.helper={},i.add(i.gizmo.translate=F(I)),i.add(i.gizmo.rotate=F(D)),i.add(i.gizmo.scale=F(H)),i.add(i.picker.translate=F(C)),i.add(i.picker.rotate=F(V)),i.add(i.picker.scale=F(z)),i.add(i.helper.translate=F(A)),i.add(i.helper.rotate=F(L)),i.add(i.helper.scale=F(O)),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:Z;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var i=[];i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);var o=this.worldPosition.distanceTo(this.cameraPosition);if("transitioning"!=this.player.mode||"floorplan"!=this.player.modeTran.split("-")[0]&&"floorplan"!=this.player.modeTran.split("-")[1]){if("floorplan"==this.player.mode){o=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect}}else{var r,a=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect;o=Math.min(o,a)}for(var s=o*this.size/7,l=0;l<i.length;l++){var c=i[l];if(c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition),c.scale.set(1,1,1).multiplyScalar(s),"helper"!==c.tag){if(c.quaternion.copy(n),"translate"===this.mode||"scale"===this.mode){var u=.99;e.dontHideWhenFaceCamera||("X"!==c.name&&"XYZX"!==c.name||Math.abs(U.copy(G).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(U.copy(q).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(U.copy(Y).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XY"===c.name&&Math.abs(U.copy(Y).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"YZ"===c.name&&Math.abs(U.copy(G).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XZ"===c.name&&Math.abs(U.copy(q).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1));var h=!1;U.copy(Y).applyQuaternion(n).dot(this.eye)<0&&(h=!0),-1!==c.name.search("X")&&(U.copy(G).applyQuaternion(n).dot(this.eye)<0?(c instanceof THREE.Line?c.geometry=P["x-"]:c.scale.x*=-1,this.parent.object&&c.position.add(new THREE.Vector3(-this.parent.object.width/2,0,h||"XYZX"==c.name?0:this.parent.object.depth).applyQuaternion(c.quaternion))):(c instanceof THREE.Line&&(c.geometry=P["x+"]),this.parent.object&&c.position.add(new THREE.Vector3(this.parent.object.width/2,0,h||"XYZX"==c.name?0:this.parent.object.depth).applyQuaternion(c.quaternion)))),-1!==c.name.search("Y")&&(U.copy(q).applyQuaternion(n).dot(this.eye)<0?(c instanceof THREE.Line?c.geometry=P["y-"]:c.scale.y*=-1,this.parent.object&&c.position.add(new THREE.Vector3(0,-this.parent.object.height/2,h||"XYZX"==c.name?0:this.parent.object.depth).applyQuaternion(c.quaternion))):(c instanceof THREE.Line&&(c.geometry=P["y+"]),this.parent.object&&c.position.add(new THREE.Vector3(0,this.parent.object.height/2,h||"XYZX"==c.name?0:this.parent.object.depth).applyQuaternion(c.quaternion)))),-1!==c.name.search("Z")&&(h?c instanceof THREE.Line?c.geometry=P["z-"]:c.scale.z*=-1:(c instanceof THREE.Line&&(c.geometry=P["z+"]),this.parent.object&&c.position.add(new THREE.Vector3(0,0,this.parent.object.depth).applyQuaternion(c.quaternion))))}else"rotate"===this.mode&&(Q.copy(n),U.copy(this.eye).applyQuaternion(W.copy(n).invert()),-1!==c.name.search("E")&&c.quaternion.setFromRotationMatrix(j.lookAt(this.eye,_,q)),"X"===c.name&&(W.setFromAxisAngle(G,Math.atan2(-U.y,U.z)),W.multiplyQuaternions(Q,W),c.quaternion.copy(W)),"Y"===c.name&&(W.setFromAxisAngle(q,Math.atan2(U.x,U.z)),W.multiplyQuaternions(Q,W),c.quaternion.copy(W)),"Z"===c.name&&(W.setFromAxisAngle(Y,Math.atan2(U.y,U.x)),W.multiplyQuaternions(Q,W),c.quaternion.copy(W)));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 Ui(1,1,1),.5)):(c.material.opacity*=.25,c.material.color.lerp(new Ui(1,1,1),.5))):(c.material.opacity*=.5,c.material.color.lerp(new Ui(1,1,1),.5))}else c.visible=!1,"AXIS"===c.name?(c.position.copy(this.worldPositionStart),c.visible=!!this.axis,"X"===this.axis&&(W.setFromEuler(B.set(0,0,0)),c.quaternion.copy(n).multiply(W),Math.abs(U.copy(G).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Y"===this.axis&&(W.setFromEuler(B.set(0,0,Math.PI/2)),c.quaternion.copy(n).multiply(W),Math.abs(U.copy(q).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Z"===this.axis&&(W.setFromEuler(B.set(0,Math.PI/2,0)),c.quaternion.copy(n).multiply(W),Math.abs(U.copy(Y).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"XYZE"===this.axis&&(W.setFromEuler(B.set(0,Math.PI/2,0)),U.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(j.lookAt(_,U,q)),c.quaternion.multiply(W),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),N.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),N.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(N),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)))}$i.prototype.updateMatrixWorld.call(this)},i}return n}(),Bo=new THREE.Vector3(1,0,0),Uo=new THREE.Vector3(0,1,0),_o=new THREE.Vector3(0,0,1),jo=new THREE.Vector3,Wo=new THREE.Vector3,Qo=new THREE.Vector3,Zo=new THREE.Matrix4,Go=new THREE.Quaternion,qo=(Bo=new THREE.Vector3(1,0,0),Uo=new THREE.Vector3(0,1,0),_o=new THREE.Vector3(0,0,1),jo=new THREE.Vector3,Wo=new THREE.Vector3,Qo=new THREE.Vector3,Zo=new THREE.Matrix4,Go=new THREE.Quaternion,function(e){f(n,THREE.Mesh);var t=Fi(n);function n(e){var i;return o(this,n),(i=t.call(this,new Ji(1e4,1e4,2,2),new Yi({color:"#ff0000",visible:!1,wireframe:!0,side:ji,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:Go),Uo.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:Go),_o.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:Go),Qo.copy(Uo),this.mode){case"translate":case"scale":switch(this.axis){case"X":Qo.copy(this.eye).cross(Bo),Wo.copy(Bo).cross(Qo);break;case"Y":Qo.copy(this.eye).cross(Uo),Wo.copy(Uo).cross(Qo);break;case"Z":Qo.copy(this.eye).cross(_o),Wo.copy(_o).cross(Qo);break;case"XY":Wo.copy(_o);break;case"YZ":Wo.copy(Bo);break;case"XZ":Qo.copy(_o),Wo.copy(Uo);break;case"XYZ":case"E":default:Wo.set(0,0,0)}break;case"rotate":default:Wo.set(0,0,0)}0===Wo.length()?this.quaternion.copy(this.cameraQuaternion):(Zo.lookAt(jo.set(0,0,0),Wo,Qo),this.quaternion.setFromRotationMatrix(Zo)),$i.prototype.updateMatrixWorld.call(this)}}]),n}()),Yo="move",$o="rotate",Xo="zoom",Jo="endRotation",Ko="moveModel",er="mode.changed",tr="mode.changing",nr="pano.chosen",ir="closest.pano.changing",or="flyin.finished",rr="flying.started",ar="flying.ended",sr="ready",lr="start.inside",cr="start.outside",ur="view.changed",hr="warp.interrupted.flyto",dr="input.start",pr=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=Ge()}return u(e,[{key:"init",value:function(e){var t=this;this.player=this.app.core.get("Player"),this.model=e,this.app.store.getValue("flooruser")?this.createCad():this.app.store.on("flooruser",(function(){return t.createCad()})),this.player.on(tr,(function(e,n,i,o){if(n==Ue.FLOORPLAN){setTimeout(t.showCad.bind(t),Math.min(1e3,o))}else t.hideCad()}))}},{key:"showCad",value:function(){var e=this;if(this.show){if(!this.ready)return this.deferred.then((function(){return e.showCad()}));this.hideCad();var t=this.model.floors.index[this.model.currentFloor.floorIndex].plane;t&&(t.material.opacity=1,t.visible=!0)}}},{key:"hideCad",value:function(){var e=this;if(!this.ready)return this.deferred.then((function(){return e.hideCad()}));this.model.floors.forEach((function(e){e.plane?(e.plane.visible=!1,e.plane.material.opacity=0):console.warn("还没有创建plane")}))}},{key:"displayCad",value:function(e){this.show=e,this.show?this.showCad():this.hideCad()}},{key:"createCad",value:function(){var e=this,t=new THREE.TextureLoader;this.model.floors.forEach((function(n){n.floorTexture&&(n.floorTexture.dispose(),n.floorTexture=null),t.load(e.app.resource.getUserResourceURL("floor-cad-".concat(n.floorIndex,".png")),(function(t){t.needsUpdate=!0,n.floorTexture=t,e.createPlane(n.floorIndex)}),(function(t){++e.done==e.model.floors.length&&(e.ready=!0,e.deferred.resolve()),console.warn("没有floorplan_".concat(n.floorIndex,".png"))}))}))}},{key:"createPlane",value:function(e){var t=this.model.floors.index[e],n=t.boundingBox,i=n.getCenter(this.center),o=n.getSize(new THREE.Vector3),r=new THREE.PlaneBufferGeometry(1,1),a=null,s=this.getCadInfo(e);if(!s||this.app.store.getValue("flooruser").vesion)a=new THREE.Mesh(r,new THREE.MeshBasicMaterial({map:null,opacity:0,transparent:!0,side:THREE.DoubleSide,depthTest:!1,visible:!1}));else{var l=new THREE.MeshBasicMaterial({map:t.floorTexture,opacity:this.player.modeTran&&"floorplan"==this.player.modeTran.split("-")[1]?1:0,transparent:!0,side:THREE.DoubleSide,depthTest:!1});l.needsUpdate=!0,a=new THREE.Mesh(r,l),s.bound&&(o.x=s.bound.right-s.bound.left,o.z=s.bound.bottom-s.bound.top,i.x=(s.bound.right+s.bound.left)/2,i.z=(s.bound.bottom+s.bound.top)/2)}this.model.add(a),t.plane=a,a.rotateX(-Math.PI/2);var c=this.app.store.getValue("metadata"),u=parseFloat(c.floorPlanAngle||0);a.rotateZ(u),a.renderOrder=10,a.name="floorplanImg",s&&this.adjustPlane(n,e,o,i,!1,s),this.changeCadVisible(null,{autoJudge:!0}),++this.done==this.model.floors.length&&(this.ready=!0,this.deferred.resolve(),this.player.mode==Ue.FLOORPLAN&&this.showCad())}},{key:"updatePlanes",value:function(){var e=this,t=new THREE.TextureLoader;this.model.floors.forEach(function(){var n=S(C.mark((function n(i){return C.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:i.floorTexture&&(i.floorTexture.dispose(),i.floorTexture=null),t.load(e.app.resource.getUserResourceURL("floor-cad-".concat(i.floorIndex,".png"),!0),(function(t){t.needsUpdate=!0,i.floorTexture=t,e.updatePlane(i.floorIndex,t)}),(function(t){++e.done==e.model.floors.length&&(e.ready=!0,e.deferred.resolve()),console.warn("没有 floorplan_".concat(i.floorIndex,".png"))}));case 2:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}())}},{key:"updatePlane",value:function(e,t){var n=this.model.floors.index[e],i=n.boundingBox,o=i.getCenter(this.center),r=i.getSize(new THREE.Vector3);if(n.plane){n.plane.renderOrder=10,n.plane.name="floorplanImg";var a=this.app.store.getValue("metadata"),s=parseFloat(a.floorPlanAngle||0);n.plane.rotation.z=0,n.plane.rotateZ(s)}var l=this.getCadInfo(e);console.log(l,"----after"),!l||this.app.store.getValue("flooruser").vesion?n.plane&&(n.plane.material.opacity=0,n.plane.material.map=null,n.plane.material.needsUpdate=!0,n.plane.material.visible=!1):l.bound&&(r.x=l.bound.right-l.bound.left,r.z=l.bound.bottom-l.bound.top,o.x=(l.bound.right+l.bound.left)/2,o.z=(l.bound.bottom+l.bound.top)/2,n.plane&&(n.plane.material.map=t,n.plane.material.needsUpdate=!0,n.plane.material.visible=!0),this.adjustPlane(i,e,r,o,!1,l)),this.changeCadVisible(null,{autoJudge:!0}),++this.done==this.model.floors.length&&(this.ready=!0,this.deferred.resolve())}},{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:"getCurrentScale",value:function(e){e=e.clone().applyEuler(new THREE.Euler(0,0,0));return Math.max(Math.abs(e.x),Math.abs(e.z)*(1920/937))/2/10*Math.max(1.62,1.2)}},{key:"getScreenXY",value:function(e,t){var n=e.x,i=e.y,o=960+(n-this.model.center.x)*t.res,r=468.5-(i+this.model.center.z)*t.res;return o=.5+o<<0,r=.5+r<<0,{x:1*Math.floor(o),y:1*Math.floor(r)}}},{key:"adjustPlane",value:function(e,t,n,i,o,r){var a=this.model.floors.index[t];if(o)a.plane.position.y=e.max.y+.1;else{n=n||e.getSize(new THREE.Vector3),i=i||e.getCenter(new THREE.Vector3);var s=a.floorTexture.image.width,l=a.floorTexture.image.height,c=a.cadImgRatio=n.x/(s-r.left-r.right),u=c*s,h=c*l;this.width=u,this.height=h;var d=(r.left-r.right)/2*c,p=(r.top-r.bottom)/2*c;a.plane.position.set(i.x-d,e.max.y+.1,i.z-p),a.plane.scale.set(u,h,1),this.player.planLabels.forEach((function(e){return e.update()}))}}},{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:"remove",value:function(){this.model.floors.forEach((function(e){null!=e.plane&&(e.plane.parent.remove(e.plane),e.plane.geometry.dispose(),e.plane.material.dispose(),e.plane=null),e.cadImgRatio=null})),this.removeEntryArrow(),this.removeRoomLabels(),this.show=null,this.initedCad=!1}}]),e}();function fr(e,t){var n=this;this.player=t,this.sid=e.sid,this.setPoints(e.points),this.state=e.state||"active",this.elem=document.createElement("div"),this.elem.className="ruler",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="约"+this.length+"米",window.ifTest&&e.color&&setTimeout((function(){n.elem.querySelector("em").background=e.color}),1e3),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.player.cornerRulers.push(this)}fr.prototype.setPoints=function(e){this.points=e},fr.prototype.remove=function(){this.elem.remove()},fr.prototype.getCrossPoint=function(e,t){var n,i,o,r=objects.player.domElement.clientWidth,a=objects.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},fr.prototype.getPosInCrossPoint=function(e,t){var n=objects.player.domElement.clientWidth,i=objects.player.domElement.clientHeight;return Ie.getCrossPointAtRect(e,t,n,i,0,0)},fr.prototype.getPosAtSphere=function(e){this.fishPoints=[],this.points.forEach(function(t){var n=De.getPosAtSphere(t.clone(),e);this.fishPoints.push(n)}.bind(this))};fr.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=De.getPos2d(i);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},fr.prototype.update=function(){if("panorama"==objects.player.mode&&"active"==this.state){var e=De.getPos2d(this.points[0]),t=De.getPos2d(this.points[1]);if(!e.trueSide||!t.trueSide){if(!e.trueSide&&!t.trueSide)return void this.elem.css("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.css("display","none");e=n.p1,t=n.p2}var i=e.pos,o=t.pos,r=i.distanceTo(o);if(0!=r){var a=Math.acos((i.x-o.x)/r);a%=360,a*=180/Math.PI;var s=i.clone().sub(o),l=new THREE.Vector3(s.x,s.y,0),c=new THREE.Vector3(1,0,0);a*=l.cross(c).z>0?1:-1,this.elem.find(".ruler-line").css({width:r+"px",left:t.pos.x+"px",top:t.pos.y+"px",transform:"rotate("+-a+"deg)"});var u,h,d=.5,p=objects.player.domElement.clientWidth,f=objects.player.domElement.clientHeight;if(e.inSight&&t.inSight)u=(i.x+o.x)/2;else{var m,v;m=e.inSight?i.clone():this.getCrossPoint(o,i),v=t.inSight?o.clone():this.getCrossPoint(i,o);var g=m.clone().add(v).multiplyScalar(.5);if(u=g.x,h=g.y,g.x>p||g.x<0||g.y>f||g.y<0)return void this.elem.css("display","none");if(o.x==i.x){if(o.y==i.y)return void console.warn("pos1和2一样???");d=o.y<i.y?(h-o.y)/(i.y-o.y):(o.y-h)/(o.y-i.y)}else d=o.x<i.x?(u-o.x)/(i.x-o.x):(o.x-u)/(o.x-i.x);if(d<0||d>1)return void this.elem.css("display","none")}this.elem.css("display",""),"left"!=this.dir&&u<p/2||"right"==this.dir?this.elem.find(".ruler-label").addClass("reverse"):this.elem.find(".ruler-label").removeClass("reverse"),this.elem.find(".ruler-label").css({transform:"rotate("+a+"deg)",left:100*d+"%"})}else console.warn("ruler间距为0!")}else this.elem.css("display","none")};var mr,vr=function(){function e(t){o(this,e),this.updateRulersVisi=function(e){var t,n=objects.player;if(this.roomInfo)if(window.showAllRulerForTest)n.cornerRulers.forEach((function(e){e.state="active",e.update()}));else{if(!1===e||!this.rulerVisi||config.isEdit&&(objects.mainDesign&&objects.mainDesign.editing||"screen"==store.getters.page)||"panorama"!=n.mode||settings.vrEnabled||!n.currentPano||1==this.version&&null==n.currentPano.belongToRoom||objects.tagManager.editSpot.setSpotPos||!n.currentPano.isAligned()||n.enteringView||n.EditOverlay&&n.EditOverlay.editing||n.EditPanoVideo&&n.EditPanoVideo.editing)return t&&[t.horizon,t.verti&&t.verti,t.last&&t.last.horizon].forEach((function(e){e&&(e.state="unable",e.update())})),void(t=null);var i=n.currentPano.visibleRulerInfos;if(i){var o=[],r=n.getDirection().setY(0).normalize(),a=[function(e){return-e.pointBtm.distanceTo(n.position)/3},function(e){var t=e.pointBtm.clone().sub(n.position).setY(0).normalize(),i=r.dot(t);return 10*Math.pow(i,3)},function(e){var t=2;return e.horizon.length<.4&&(!e.last||e.last.horizon.length<.4)&&(t-=1),t}],s=common.sortByScore(i,[],a);if(s&&s[0]&&s[0].item!=t||(!s||!s[0])&&t){if(t&&(t.horizon.state="unable",o.push(t.horizon),t.verti&&(t.verti.state="unable",o.push(t.verti)),t.last&&(t.last.horizon.state="unable",o.push(t.last.horizon))),s&&s[0]){(t=s[0].item).horizon.state="active",t.verti&&(t.verti.state="active"),t.last&&(t.last.horizon.state="active");var l=t.pointBtm.distanceTo(n.currentPano.origin);l>2*t.horizon.length?t.horizon.dir=this.isClockWise?"left":"right":t.horizon.dir="",t.last&&(l>2*t.last.horizon.length?t.last.horizon.dir=this.isClockWise?"right":"left":t.last.horizon.dir="")}else t=null;n.rulerGroupShowing=t}t&&(o.push(t.horizon),t.last&&o.push(t.last.horizon),t.verti&&o.push(t.verti)),o.forEach((function(e){e.update()}))}}},this.app=t,this.roomInfo={},this.rulerVisi=!1,this.version=2,this.cad=null,this.planeNeedAdjust=[],this.appType=null}return u(e,[{key:"showRule",value:function(e,t){var n=this;this.rulerVisi=e,config.isEdit?e?objects.player.mode&&objects.player.currentPano&&objects.player.FlyToMode("panorama",(function(){n.shineRulers(!0)})):this.shineRulers(!1):("vrhouse"==config.name?"vrhouse"==t||this.cad&&this.initRoomInfo(this.cad):e?this.cad&&this.initRoomInfo(this.cad):(this.initType="noRuler",this.cad&&this.initRoomInfo(this.cad,"noRuler")),this.updateRulersVisi())}},{key:"init",value:function(e){this.model=e}},{key:"beforeInit",value:function(e){return!!e&&((!Object.keys(this.roomInfo).length||!this.roomInfo[Object.keys(this.roomInfo)[0]].rooms.length)&&!!this.app.store.getValue("metadata"))}},{key:"initRoomInfo",value:function(e){var t=this;if(console.log(e),this.beforeInit(e)){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.reSetSkyBox(),"noRuler"!=this.initType&&this.model.panos.list.forEach((function(e){t.ifPanoSeePoints(e,t.roomInfo)})),this.rulerVisi&&this.updateRulersVisi(),this.planeNeedAdjust.length&&(this.planeNeedAdjust.forEach((function(e){var n=t.roomInfo[e.index].boundingBox;n.max.y!=-1/0&&t.model.floorplanCadImg.adjustPlane(n,e.index,null,null,e.onlyHeight)})),this.planeNeedAdjust=[])}}},{key:"initFloorPlan",value:function(e){var t=this;e.floors.forEach((function(e,n){var i=[],o=[],r=new THREE.Box3;e.block&&e.block.forEach((function(n,a){var s,l=[],c=n.ground,u=n.wall,h=t.searchItemById(n.top,e["vertex-z"]).z,d=t.searchItemById(n.bottom,e["vertex-z"]).z,p=[];if(c.length>0)c.forEach((function(i,o){var a=t.searchItemById(i,e["vertex-xy"]),s=t.searchItemById(c[(o+1)%c.length],e["vertex-xy"]),f=searchWallByPoint(e,i,c[(o+1)%c.length]),m=u.includes(f);t.dealPointInfo({point1:a,point2:s,points:p,type:"block",top:h,bottom:d,pointInfos:l,parentIndex:n.id,index:o,isOutSide:!m,boundingBox:r}),t.addWall({point1:a,point2:s,top:h,bottom:d,type:"wall",index:n.id+"_"+o})})),s=p.length>2;else if(u.length){var f,m=[];if(u.length>1){var v=t.searchItemById(u[0],e.segment),g=t.searchItemById(u[1],e.segment);if(g.a==v.a||g.b==v.a)f=!0;else{if(g.a!=v.b&&g.b!=v.b)return void console.error("wall不连续??? block: ".concat(n.id));f=!1}}u.forEach((function(i,o){var a=t.searchItemById(i,e.segment);if(0==m.length&&!f||m[m.length-1]==a.a){m.push(a.a,a.b);var c=t.searchItemById(a.a,e["vertex-xy"]),u=t.searchItemById(a.b,e["vertex-xy"])}else{if(!(0==m.length&&f||m[m.length-1]==a.b))return void console.error("wall不连续??wallId:".concat(i," block: ").concat(n.id));c=t.searchItemById(a.b,e["vertex-xy"]),u=t.searchItemById(a.a,e["vertex-xy"]);m.push(a.b,a.a)}t.dealPointInfo({point1:c,point2:u,points:p,type:"block",top:h,bottom:d,pointInfos:l,parentIndex:n.id,index:o,boundingBox:r}),t.addWall({point1:c,point2:u,top:h,bottom:d,type:"wall",index:n.id+"_"+o}),s=m[0]==m[m.length-1]}))}t.dealRoom({points:p,pointInfos:l,isClosedRing:s,type:"block",index:a,allPointsInfos:i,rooms:o}),t.addWall({points:p,bottom:d,top:h,type:"floor",index:a})})),e.hole.forEach((function(n,a){if(!n.plane||0!=n.plane.z){var s=[];if(!(n.point.length<2)){var l=t.searchItemById(n.inside,e.block),c=t.searchItemById(l.top,e["vertex-z"]).z,u=t.searchItemById(l.bottom,e["vertex-z"]).z,h=[];n.point.forEach((function(e,i){var o=n.point[(i+1)%n.point.length];t.dealPointInfo({point1:e,point2:o,points:h,type:"hole",top:c,bottom:u,pointInfos:s,parentIndex:a,index:i,boundingBox:r}),t.addWall({point1:e,point2:o,top:c,bottom:u,type:"wall",index:a+"_"+i})})),t.dealRoom({points:h,pointInfos:s,isClosedRing:n.point.length>2,type:"hole",index:n.inside,rooms:o,allPointsInfos:i})}}})),e.furnColumn.concat(e.furnFlue).forEach((function(e,n){for(var a=[],s=e.top,l=e.bottom,c=[],u=0,h=e.pos.length;u<h;u+=2){var d={x:e.pos[u],y:e.pos[u+1]},p={x:e.pos[(u+2)%e.pos.length],y:e.pos[(u+3)%e.pos.length]};t.dealPointInfo({point1:d,point2:p,points:c,type:"freeColumn",top:s,bottom:l,pointInfos:a,parentIndex:n,index:u/2,boundingBox:r})}t.dealRoom({points:c,pointInfos:a,isClosedRing:!0,type:"column",index:n,allPointsInfos:i,rooms:o})})),function(){var t=this,n=[1,3,2,0];e.column.forEach((function(a,s){var l=[],c=t.searchRoomByLine(e,a.line);if(c){for(var u=t.searchItemById(c.top,e["vertex-z"]).z,h=t.searchItemById(c.bottom,e["vertex-z"]).z,d=[],p=0;p<3;p++){var f={x:a.pos[2*n[p]],y:a.pos[2*n[p]+1]},m={x:a.pos[2*n[p+1]],y:a.pos[2*n[p+1]+1]};t.dealPointInfo({point1:f,point2:m,points:d,type:"column",top:u,bottom:h,pointInfos:l,parentIndex:s,index:p/2,boundingBox:r,rooms:o,allPointsInfos:i})}t.dealRoom({points:d,pointInfos:l,isClosedRing:!1,type:"column",index:s,allPointsInfos:i,rooms:o})}else console.log("有柱子找不到房间 ",s)}))}();n=app.model.floors.list.length>1?null!=e.subgroup?e.subgroup:e.id:app.model.floors.list[0].floorIndex;t.roomInfo[n]={pointInfos:i,boundingBox:r,center:r.getCenter(new THREE.Vector3),rooms:o,oriRoomGroup:oriRoomGroup},null!=e.name&&(objects.model.floors.index[n].name=e.name)}))}},{key:"addWall",value:function(e){if(config.isEdit){var t;if("wall"==e.type){var n=new THREE.Vector3(e.point1.x,e.top,-e.point1.y),i=new THREE.Vector3(e.point2.x,e.top,-e.point2.y),o=new THREE.Vector3(e.point1.x,e.bottom,-e.point1.y),r=new THREE.Vector3(e.point2.x,e.bottom,-e.point2.y);t=Ie.getPlaneGeo(n,i,r,o)}else if("floor"==e.type){if(e.points.length<3)return;t=Ie.getShapeGeo(e.points);var a=new THREE.Matrix4;a.set(1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1),t.applyMatrix4(a),t.computeVertexNormals()}var s=new THREE.Mesh(t,_material);s.name="tagBound_"+e.type+"_"+e.index,"floor"==e.type&&s.position.setY(e.bottom),oriRoomGroup.add(s)}}},{key:"searchItemById",value:function(e,t){return t.filter((function(t){return t.id==e}))}},{key:"dealPointInfo",value:function(e){console.error(e);try{var t=new THREE.Vector3(e.point1.x,e.bottom,-e.point1.y)}catch(e){console.log(1)}var n=new THREE.Vector3(e.point2.x,e.bottom,-e.point2.y),i=new THREE.Vector3(e.point1.x,e.top,-e.point1.y);if("noRuler"!=this.initType){e.points.push({x:t.x,y:t.z});var o={pointBtm:t,pointTop:i};o.horizon=new fr({sid:"r_horiz_"+e.type+e.parentIndex+"_"+e.index,points:[t,n],state:"unable"}),e.isOutSide||(o.verti=new fr({sid:"r_verti_"+e.type+e.parentIndex+"_"+e.index,points:[t,i],state:"unable"})),o.visiblePanos=[],e.pointInfos.push(o)}e.boundingBox.expandByPoint(t),e.boundingBox.expandByPoint(n),e.boundingBox.expandByPoint(i)}},{key:"dealRoom",value:function(e){var t;if(!("noRuler"==this.initType||e.points.length<2)){var n=Ie.getArea(e.points)>0,i={type:e.type,pointInfos:e.pointInfos,isClockWise:n,point2ds:e.points,panos:[]};e.rooms.push(i),e.isClosedRing?e.pointInfos.forEach((function(t,n){t.last=e.pointInfos[(n+e.pointInfos.length-1)%e.pointInfos.length],t.next=e.pointInfos[(n+1)%e.pointInfos.length],t.room=i})):e.pointInfos.forEach((function(t,n){0!=n&&(t.last=e.pointInfos[n-1]),n!=e.pointInfos.length&&(t.next=e.pointInfos[n+1]),t.room=i})),(t=e.allPointsInfos).push.apply(t,L(e.pointInfos)),console.log(e.type+e.index+" isClockWise "+n)}}},{key:"getColor",value:function(e,t,n){var i=(e+1)*parseInt(256/t);return i=i.toString(16),"block"==n?"#"+i+i+i:"#0000"+i}},{key:"searchRoomByLine",value:function(e,t){for(var n=0;n<e.block.length;n++)if(e.block[n].ground.includes(t)||e.block[n].wall.includes(t))return e.block[n]}},{key:"searchWallByPoint",value:function(e,t,n){for(var i=0,o=e.segment.length;i<o;i++){var r=e.segment[i];if(r.a==t&&r.b==n||r.a==n&&r.b==t)return r.id}}},{key:"ifPanoSeePoints",value:function(e,t){e.visibleRulerInfos=[];var n=t[e.floorIndex];if(n){for(var i=0;i<n.rooms.length;i++){var o,r=n.rooms[i];o=Ie.isPointInArea(r.point2ds,{x:e.position.x,y:e.position.z}),r.pointInfos.forEach((function(t){if((n=t.pointBtm.distanceTo(e.position))<Math.max(t.last?1.5*t.last.horizon.length:0,t.horizon?1.5*t.horizon.length:0,4)){if(t.last&&t.next){var n=t.pointBtm.clone().sub(e.position).setY(0),i=t.next.pointBtm.clone().sub(t.pointBtm).setY(0),a=t.last.pointBtm.clone().sub(t.pointBtm).setY(0);if(o==r.isClockWise?i.clone().cross(n).y>0&&t.horizon.length>.2||a.clone().cross(n).y<0&&t.last.horizon.length>.2:i.clone().cross(n).y<0&&t.horizon.length>.2||a.clone().cross(n).y>0&&t.last.horizon.length>.2)return}t.visiblePanos.push(e),e.visibleRulerInfos.push(t)}}))}e.belongToRoom=null}else console.error("ifPanoSeePoints 没找到楼层")}}]),e}();function gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var yr=ue(mr=function(e){f(n,THREE.Object3D);var t=gr(n);function n(e){var i;o(this,n),(i=t.call(this)).setupCustomProperties=function(){var e=Te.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)}))}})},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){t=t||this.mode,this.emit("floor.changed",e,t,this.currentFloor),this.currentFloor=e;var n=this.$app.core.get("Player").mode;t===Ue.PANORAMA?this.show():(t===Ue.FLOORPLAN||t===Ue.DOLLHOUSE&&n==t)&&this.floors.list.forEach(function(e,t){var n=e===this.currentFloor||this.allFloorsVisible;e.toggle(n)}.bind(this));var i=this,o=e;pe.start((function(){}),Te.showFloorDelay,function(){i.floors.forEach((function(e){e.chunks.forEach((function(t){t.renderOrder=e===o?Je:Ke}))}))}.bind(this))},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.addChunk=function(e,t){this.floors.getOrMakeFloor(e).addChunk(t),this.chunks.push(t)},i.setMode=function(e){if(!this.supportedModes[e])throw new BasicException("Mode not supported for this model: "+e);this.mode=e,this.chunks.forEach((function(t){t.setMode(e)}))},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){Le.info("Floor "+e+": "+e.children.length+" chunks, "+e.panos.length+" panos.")}.bind(this)),this.skybox=new Si(this.boundingBox),this.skybox.matrixWorldNeedsUpdate=!0,this.add(this.skybox);var i=this.$app.core.get("PanoVideoRenderer").videosInfo;if(i){var o=i.parameters;this.updateVideoRenderParameters(o)}return Le.debug("Done building model"),bi.raycastsDone>0&&(Le.warn("raycasts: "+bi.raycastsDone),Le.warn("raycasts skipped: "+bi.raycastsSkipped)),this.floorLogos.createFloorLogo(),this.add(this.floorLogos.firstLogo),this.add(this.floorLogos.secondLogo),setTimeout((function(){e.floorplanCadImg.init(e),e.wallManager.init(e)}),100),this.addHighMapCube(),this.builded=!0,this.dispatchEvent({type:"builded"}),Promise.resolve(this)},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)}))},i.setSide=function(e){this.floors.forEach((function(t){t.collider.material.side=e}))},i.fadePanoMarkers=function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=this.player.currentPano;if(Te.vrEnabled&&"portrait"!=window.VRScreenType)this.updateVrMarker();else{var r=location.search.match(new RegExp("[\\?,&]role=(.*?)[&,$]"));if(r&&"customer"==r[1])return null!=i.vrCustomer&&(this.markerUnable=!!i.vrCustomer),void(this.markerUnable&&i.vrCustomer);var a=function(){var e=[];n.player.model.panos.forEach((function(t){t.hasVideo||t.panoVideo?i.hideVideoFlag||t.floor.hidden?t.updateMarkerVisible(!1,n.player):t.updateMarkerVisible(!0,n.player):e.push(t)})),n.panos.fadeMarkerOpacity(1,t,[{toOp:0,member:e}])};if(0==e)a();else if(this.player.mode==Ue.PANORAMA&&o){var s,l=[],c=[];if(o.hasVideo&&this.$app.core.get("PanoVideoRenderer").ifEnable()){if(o.videoInfo.dir)var u=o.videoInfo.dir.clone(),h=THREE.MathUtils.degToRad(o.videoInfo.hfov/2);else{var d=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.supportsTiles?90:180)),p=_e.FORWARD.clone().applyQuaternion(d.multiply(o.quaternion)).add(o.position);u=p.clone().sub(o.position),h=THREE.MathUtils.degToRad(32.5)}s=bi.filters.isInFanAngle(o.position,u,h)}else if(o.panoVideo){u=o.panoVideo.dir.clone(),h=THREE.MathUtils.degToRad(o.panoVideo.hfov/2);s=bi.filters.isInFanAngle(o.position,u,h)}this.player.model.panos.forEach((function(e){s&&s(e)||!(o.seeMarkers.indexOf(e.id)>-1)?e.hasVideo||e.panoVideo?e.marker.visible=!1:c.push(e):e.hasVideo||e.panoVideo?n.$app.core.get("PanoVideoRenderer").ifEnable()&&(e.marker.visible=!0):l.push(e)})),this.panos.fadeMarkerOpacity(e,t,[{toOp:Te.panorama.markerOpacity,member:l},{toOp:0,member:c}])}else"panorama"!=this.player.modeTran.split("-")[1]&&a()}},i.outsideAllowed=function(){return this.supportedModes[Ue.DOLLHOUSE]&&this.supportedModes[Ue.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 qe(i.sid,e),i.outdoorPanoLocations=[],i.floors=new ct(h(i)),i.floorsEnabled=void 0===r.floors||r.floors,i.changingFloor=!1,i.chunks=[],i.panos=new xi,i.colliders=[],i.loadPanosPromise=null,i.loadMeshTexturesPromise=null,i.auxDataPromise=null,i.meshTexturesLoaded=!1,i.meshTextures=[],i.mattertags={},i.tagsShown=!1,i.shouldShowMattertags=!1,i.has360Views=!1,i.showingLabels=Te.labels.enabled&&a.player_options.labels,i.supportedModes={},i.supportedModes[Ue.PANORAMA]=!0,i.supportedModes[Ue.DOLLHOUSE]=!a.player_options||a.player_options.dollhouse&&browser.valueFromHash("dh",1),i.supportedModes[Ue.FLOORPLAN]=!a.player_options||a.player_options.floor_plan&&browser.valueFromHash("dh",1),i.supportedModes[Ue.TRANSITIONING]=!0,i.supportsTiles=!0,i.supportsVR=a.is_vr,i.mode=Ue.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 Oi(i.$app),i.floorplanCadImg=new pr(i.$app),i.wallManager=new vr(i.$app),i}return u(n,[{key:"createTranControl",value:function(e){var t={player:e,fatLineMats:[],dontHideWhenFaceCamera:!0,scaleAxis:["x","y"],NoScaleZ:!0};this.transformControls=new Fo(e.camera,e.domElement,t),this.transformControls.fatLineMats=t.fatLineMats,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}))}},{key:"suspendVideoRender",value:function(){this.skybox&&(this.skybox.material.uniforms.videoReady.value=0),this.chunks.forEach((function(e){e.materialInside.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}))}},{key:"updateVideoRenderParameters",value:function(e){var t=this;this.skybox.material.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?this.skybox.material.defines.HasVideo=8:2==e.cameraType?this.skybox.material.defines.HasVideo=2:3==e.cameraType&&(this.skybox.material.defines.HasVideo=3),this.skybox.material.defines.VideoMapping=e.mapping,this.skybox.material.needsUpdate=!0,this.chunks.forEach((function(n){n.materialInside.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?n.materialInside.defines.HasVideo=8:2==e.cameraType?n.materialInside.defines.HasVideo=2:3==e.cameraType&&(t.skybox.material.defines.HasVideo=3),n.materialInside.defines.VideoMapping=e.mapping,n.materialInside.needsUpdate=!0}))}},{key:"updateVrMarker",value:function(e){var t=this;if(this.player.currentPano.isAligned()){if(e=null==e?Te.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
  2. }))}}},{key:"addHighMapCube",value:function(){if("4k"==this.$app.core.get("QualityManager").tileClass&&2048==this.$app.core.get("QualityManager").maxRenderTargetSize){for(var e=new THREE.PlaneGeometry(1,1,1,1),t=new THREE.Object3D,n=0;n<6;n++){for(var i=new THREE.Object3D,o=0;o<8;o++)for(var r=0;r<8;r++){var a=new THREE.Mesh(e,new THREE.MeshBasicMaterial({side:2}));a.position.set(o-3.5,r-3.5,-4),a.visible=!1,i.add(a)}switch(n){case li:i.rotation.set(0,Math.PI/2,0);break;case ci:i.rotation.set(0,-Math.PI/2,0);break;case ui:var s=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),l=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),Math.PI/2);i.quaternion.copy(s).multiply(l);break;case hi:s=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),l=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/2);i.quaternion.copy(s).multiply(l);break;case di:i.rotation.set(0,Math.PI,0);break;case pi:i.rotation.set(0,0,0)}i.scale.set(1,-1,1),t.add(i)}t.name="highMapCube",this.highMapCube=t,this.add(t),t.scale.set(.21,.21,.21),this.highMapCube.visible=!1}}},{key:"isHighMapLoaded",value:function(e,t,n){return!!this.highMapCube.children[e].children[8*t+n].material.map}},{key:"updateHighMap",value:function(e,t,n,i){var o=this.highMapCube.children[t].children[8*n+i];o.material.map=e,o.visible=!0,o.material.needsUpdate=!0}},{key:"resetHighMap",value:function(){var e=this;this.highMapCube&&(this.highMapCube.children.forEach((function(t){return t.children.forEach((function(t){if(t.material.map){t.material.map.dispose(),t.material.map.loaded=!1,t.material.map.version=0;var n=e.$app.core.get("SceneRenderer").renderer.properties.get(t.material.map);e.$app.core.get("SceneRenderer").renderer.getContext().deleteTexture(n.__webglTexture),t.material.map=null,t.material.needsUpdate=!0,t.visible=!1}}))})),this.highMapCube.visible=!1)}},{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)}}]),n}())||mr;function wr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var br=function(e){f(n,EventEmitter);var t=wr(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 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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var xr=function(e){f(n,THREE.Mesh);var t=Er(n);function n(e){var i;o(this,n),i=t.call(this);var r=THREE.UniformsUtils.clone(jt.waypoint.uniforms);return r.map.value=le.loadTextureFromCache(zn.getImageURL("images/blueReticle.png")),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:jt.waypoint.vertexShader,fragmentShader:jt.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0}))).layers.set(ft),i.renderOrder=it,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(ut.property(this.material.uniforms.opacity,"value",0),Te.reticuleOpacityTransitionTime))}},{key:"show",value:function(){this.hidden=!1,this.material.opacity<=0&&pe.start(ut.property(this.material.uniforms.opacity,"value",Te[this.player.mode].reticuleOpacity),Te.reticuleOpacityTransitionTime)}},{key:"update",value:function(){Date.now()-this.mouseLastMoveTime>Te.hideReticuleTimeout&&!this.hidden&&this.hide()}},{key:"updatePosition",value:function(e,t){if(!this.hidden){if(!t)return this.hide();var n=t.point,i=e.distanceTo(n),o=1+.01*i;i<1&&(o-=1-i),this.show(),this.scale.set(o,o,o),this.direction=this.direction.multiplyScalar(.8),this.direction.add(t.face.normal.clone().multiplyScalar(.2)),this.position.copy(n).add(t.face.normal.clone().multiplyScalar(.01)),this.lookAt(this.position.clone().add(this.direction))}}}]),n}(),Tr="move",Pr="interaction.direct",kr="interaction.key",Rr="input.start",Mr="input.pinch",Sr="input.scroll",Ir="autopan.interrupt",Cr="autopan.complete",Ar="autopan.clamped",Dr="longtap",Lr=Object.freeze({None:0,Queued:1,ForceQueued:2,Downloading:3,Downloaded:4,DownloadFailed:5}),Vr=Object.freeze({None:0,DirectionalFOV:1}),Hr=function(){var e=function e(t,n){var i=e._panoSpaceDir,o=e._fovThreshold,r=e._fovThresholdNarrow,a=Math.max(Math.min(i.dot(t.direction),1),-1),s=Math.max(Math.min(i.dot(n.direction),1),-1);return t._dot=a,n._dot=s,a>=o&&s<o?-1:a<o&&s>=o?1:a>=r&&s<r?-1:a<r&&s>=r||t.panoSize>n.panoSize?1:n.panoSize>t.panoSize?-1:-(a-s)};return e._panoSpaceDir=new THREE.Vector3,e._fovThreshold=-1,e._fovThresholdNarrow=-1,e}(),zr=function(){function e(t,n,i,r,a){o(this,e),this.filterAndPrioritize=function(){var t=[],n=[],i=[];return function(o,r,a){"360view"!=this.priorityCriteria.pano.panoType&&(this.populateNeighborPanos(this.priorityCriteria.pano,r,t),this.populateScoredPanos(this.priorityCriteria.pano,r,n,this.priorityCriteria.cameraDir,e.MAX_SCORED_PANOS_TOCONSIDER));var s=this.baseSize,l=this.standardSize,c=this.highSize,u=this.ultraHighSize;this.queueTilesForPano(o,a,this.priorityCriteria.pano,s),this.priorityCriteria.upcomingPanos&&this.queueTilesForPanos(o,this.priorityCriteria.upcomingPanos,a,s,e.MAX_UPCOMING_PANOS_TOADD),i.length=0,this.canDownloadSize(l)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,l,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),this.queueTilesForPanos(o,n,a,s,e.MAX_SCORED_PANOS_TOADD),i.length=0,this.canDownloadSize(c)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),this.canDownloadSize(u)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),i.length=0,this.canDownloadSize(l)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,l,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(c)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(u)&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),this.queueTilesForPanos(o,t,a,s)}}(),this.queueTilesForPano=function(){var e={filter:Vr.None};return function(t,n,i,o){if(i.tiled)return this.filterAndQueueTileDownloadDescriptors(t,n,i,o,e)}}(),this.queueTilesForPanosInDirection=function(){var e=new THREE.Vector3;return function(t,n,i,o,r,a,s,l){for(var u=0,h=0;h<i.length;h++){var d=i[h];if(e.copy(d.position),e.sub(r),e.normalize(),Math.max(Math.min(a.dot(e),1),-1)>=c.getFOVDotThreshold(s))if(u+=this.queueTilesInDirectionForPano(t,n,d,o,r,a,s)>0?1:0,l&&u>=l)break}return u}}(),this.queueTilesInDirectionForPano=function(){var e={filter:Vr.DirectionalFOV,direction:new THREE.Vector3,fov:60},t=new THREE.Vector3;return function(n,i,o,r,a,s,l){if(o.tiled)return t.copy(s),fi.getRelativeDirection(o.quaternion,t),e.direction.copy(t),e.fov=l,this.filterAndQueueTileDownloadDescriptors(n,i,o,r,e)}}(),this.filterAndQueueTileDownloadDescriptors=function(){var e=[];return function(t,n,i,o,r){var a=n.getTileDownloadDescriptors(i,o);e.length=0,this.filterTileDownloadDescriptors(i,a,e,r);for(var s=0,l=0;l<e.length;l++){var c=e[l];c&&(t.push(c),s++)}return s}}(),this.filterTileDownloadDescriptors=(new THREE.Vector3,function(e,t,n,i){var o,r;switch(i.filter){case Vr.DirectionalFOV:for(o=0;o<t.length;o++)r=t[o],fi.isTileWithinFOV(r.panoSize,r.tileSize,r.face,r.tileX,r.tileY,i.direction,i.fov)&&n.push(r);break;default:for(o=0;o<t.length;o++)r=t[o],n.push(r)}for(o=0;o<n.length;o++)r=n[o],this.canIncludeDescriptor(r)||(n[o]=null)}),this.qualityManager=t,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize(),this.baseSize=n,this.standardSize=i,this.highSize=r,this.ultraHighSize=a,this.priorityCriteria=new e.PriorityCriteria(null,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,0,-1))}return u(e,[{key:"updateCriteria",value:function(e,t,n,i){this.priorityCriteria.pano=e,this.priorityCriteria.cameraPosition.copy(t),this.priorityCriteria.cameraDir.copy(n),this.priorityCriteria.upcomingPanos=i,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize()}},{key:"canDownloadSize",value:function(e){return this.maxNavQuality>=e||this.maxZoomQuality>=e&&this.zoomingActive}},{key:"populateNeighborPanos",value:function(e,t,n){(n=n||[]).length=0;var i=t.getNeighbours(e);for(var o in i)if(i.hasOwnProperty(o)){var r=t.get(o);n.push(r)}return n}},{key:"populateScoredPanos",value:function(t,n,i,o,r){(i=i||[]).length=0;var a=[bi.filters.inPanoDirection(t.position,o,e.DIRECTION_SCORE_STRICTNESS),bi.filters.not(t)],s=[bi.scoreFunctions.distanceSquared(t),bi.scoreFunctions.direction(t.position,o)],l=n.sortByScore(a,s);if(l)for(var c=0;c<l.length&&c<r;c++){var u=l[c].pano;i.push(u)}return i}},{key:"queueTilesForPanos",value:function(e,t,n,i,o){for(var r=0,a=0;a<t.length;a++){var s=t[a];if(r+=this.queueTilesForPano(e,n,s,i)>0?1:0,o&&r>=o)break}return r}},{key:"queueTilesInDirectionForPanos",value:function(e,t,n,i,o,r,a,s){for(var l=0,c=0;c<n.length;c++){var u=n[c];if(l+=this.queueTilesInDirectionForPano(e,t,u,i,r,a)>0?1:0,s&&l>=s)break}return l}},{key:"canIncludeDescriptor",value:function(e){return e.status!==Lr.Downloading&&e.status!==Lr.Downloaded}},{key:"canIncludePano",value:function(e,t){return!e.isLoaded(t)}},{key:"setZoomingActive",value:function(e){e!==this.zoomingActive&&(this.zoomingActive=e)}}],[{key:"PriorityCriteria",value:function(e,t,n,i,o){this.pano=e,this.cameraPosition=(new THREE.Vector3).copy(t),this.cameraDir=(new THREE.Vector3).copy(n),this.panoSpaceDir=(new THREE.Vector3).copy(i),this.upcomingPanos=o,this.copy=function(e){this.pano=e.pano,this.cameraPosition.copy(e.cameraPosition),this.cameraDir.copy(e.cameraDir),this.panoSpaceDir.copy(e.panoSpaceDir),this.upcomingPanos=o},this.zoomingActive=!1}},{key:"appendQueue",value:function(e,t){if(e&&t)for(var n=0;n<t.length;n++)e.push(t[n])}},{key:"getFOVDotThreshold",value:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))}},{key:"sortPanoTiles",value:function(t,n,i){Hr._panoSpaceDir.copy(i),fi.getRelativeDirection(n.quaternion,Hr._panoSpaceDir),Hr._fovThresholdNarrow=Ie.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Hr._fovThreshold=Ie.getFOVDotThreshold(e.DIRECTIONAL_FOV),t.sort(Hr)}},{key:"insertSortedPanoTile",value:function(t,n,i,o){Hr._panoSpaceDir.copy(o),fi.getRelativeDirection(i.quaternion,Hr._panoSpaceDir),Hr._fovThresholdNarrow=Ie.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Hr._fovThreshold=Ie.getFOVDotThreshold(e.DIRECTIONAL_FOV);for(var r=-1,a=0;a<t.length;a++){if(Hr(n,t[a])<=0){r=a;break}}if(-1===r)t[t.length]=n;else{for(var s=t.length;s>r;s--)t[s]=t[s-1];t[r]=n}}}]),e}();zr.DIRECTIONAL_FOV=180,zr.DIRECTIONAL_FOV_NARROW=120,zr.MAX_SCORED_PANOS_TOCONSIDER=6,zr.MAX_SCORED_PANOS_TOADD=2,zr.MAX_UPCOMING_PANOS_TOADD=3,zr.DIRECTION_SCORE_STRICTNESS=.75;var Or={clampVFOV:function(e,t,n,i){return Or.getHFOVFromVFOV(e,n,i)>t?Or.getVFOVFromHFOV(t,n,i):e},getHFOVForCamera:function(e,t,n){return Or.getHFOVFromVFOV(e.fov,t,n)},getHFOVFromVFOV:function(e,t,n){return 2*Math.atan(Math.tan(e*Ce.RADIANS_PER_DEGREE/2)*(t/n))*Ce.DEGREES_PER_RADIAN},getVFOVFromHFOV:function(e,t,n){return 2*Math.atan(Math.tan(e*Ce.RADIANS_PER_DEGREE/2)*(n/t))*Ce.DEGREES_PER_RADIAN}},Fr={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};he.detectFirefox()&&(Fr.SEMICOLON=59,Fr.PLUSEQUALS=61,Fr.DASHUNDERSCORE=173);var Nr="model-added",Br="active-model-changed";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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var _r=function(e){f(n,e);var t=Ur(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}(br),jr=function(){function e(t,n,i){o(this,e),this.flightStepWalk=function(e,t,n){var i=new THREE.Vector3,o=new THREE.Vector3,r=function(e,t){var n=Math.min(this.player.position.distanceTo(e.position),Te.transition.flytimeMaxDistanceThreshold)*Te.transition.flytimeDistanceMultiplier+Te.transition.flyTime;o.copy(_e.FORWARD),this.player.getDirection(o),i.copy(t).sub(e.position).normalize();var r=i.dot(o),a=Math.acos(r),s=a/n;return s>.001&&(n*=s/.001,a<1&&(n*=1.2)),n};return function(e,t,n){if(this.warpInterrupted)n&&n();else if(this.activeTransType!==l.WALK)this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),n&&n();else if(this.player.currentPano!==e){var i={pano:e,lookAtPoint:t,duration:null,maxDistanceOverride:Te.warp.walkMaxDist,skipWarpingCheck:!1,constantMoveSpeed:!0};i.duration=r.call(this,e,t),this.player.nonInterruptingFlyToPano(i,n)}else n&&n()}}(),this.warpTravel_WALK=function(){var e=[];return function(t){var n=this.player.model.panos;e.length=0;for(var i=null,o=!1,r=0;r<this.nodes.length;r++){var a=this.nodes[r],s=n.get(a);this.nodes.length,o=i&&s.position.distanceTo(i.position)<Te.warp.walkMinDist,i&&o||(e.push(a),i=s)}o&&this.nodes.length>1&&(e[e.length-1]=this.nodes[this.nodes.length-1]);var l=e.length,c=n.get(e[l-1]),u=new Array(l+1);u[u.length-1]=function(){t&&t()}.bind(this);for(var h=l-1,d=u.length-1;d>0;d-=1){var p=e[h];c=n.get(p);var f=new THREE.Vector3;this.getLookAtForWalkingTourNode(e,h,f),u[d-1]=this.makeWalkFlightFunc(c,f,u[d]),h--}u[0]()}}(),this.getLookAtForWalkingTourNode=function(){var e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3;return function(r,a,s){var l=r.length;if(a>=l)return!1;var c=1,u=1;t.set(0,0,0),o.set(0,0,0);for(var h=null,d=a;d<a+3&&!(d>=l);d++){if(h=this.player.model.panos.get(r[d]),this.getOrientationForWalkingTourNode(r,d,n),d===a&&e.copy(n),i.copy(n),d>a){var p=i.dot(e)<.65;c*=p?.2:.75,u*=p?.2:.4}n.multiplyScalar(c),t.add(n),o.lerp(h.position,u)}return t.normalize(),s.copy(o),s.add(t),!0}}(),this.obj3d=null,this.nodes=[],this.colorHull=[],this.shortPaths={},this.floorHull=null,this.cameraHull=null,this.floorPathDistance=0,this.floorCurvePoints=null,this.floorCurveColors=null,this.camCurvePoints=null,this.warpDestHeroLoc=null,this.warpDestPano=null,this.warpPathPoints=null,this.warpPathLengths=[0],this.warpLength=0,this.closeWarpDistance=4,this.UP=_e.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=le.loadTextureFromCache(zn.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(Br,this.updateModel.bind(this))}},{key:"pointPathDistance",value:function(e){for(var t=0,n=1;n<e.length;n+=1)t+=e[n-1].distanceTo(e[n]);return t}},{key:"pointPathLengths",value:function(e){for(var t=[0],n=1;n<e.length;n+=1)t.push(t[n-1]+e[n-1].distanceTo(e[n]));return t}},{key:"interpAlongPath",value:function(e,t,n){var i,o=new THREE.Vector3,r=t[t.length-1];if(n<1){i=n*r;for(var a=1;a<t.length;a+=1)if(t[a]>i){var s=(i-t[a-1])/(t[a]-t[a-1]);return o.copy(e[a]),o.sub(e[a-1]),o.multiplyScalar(s),o.add(e[a-1]),o}}else o.copy(e[e.length-1]);return o}},{key:"pathHeight",value:function(){return Te.path.height}},{key:"createBunnyObj",value:function(e){this.bunnyObj||(this.bunnyObj=new THREE.AxesHelper(.1),this.bunnyObj.visible=Te.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(Te.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===Ue.PANORAMA&&this.player.currentPano&&!this.player.currentPano.isAligned()||Te.path.mapGuides&&this.currentPanoMarker.placed&&pe.start(ut.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",1),e)}},{key:"fadeOutCpm",value:function(e){pe.start(ut.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",0),e)}},{key:"popInCpm",value:function(){Te.path.mapGuides&&this.currentPanoMarker.placed&&this.fadeInCpm(2)}},{key:"popOutCpm",value:function(){this.fadeOutCpm(2)}},{key:"buildWarpDestinationDescriptor",value:function(e,t,n,i,o,r){return new _r({cameraMode:i,position:e,quaternion:t,panoId:n,orthoZoom:r,floorVisibility:o,thumbUrl:null,name:null})}},{key:"buildWarpDestinationDescriptorFromHero",value:function(e){return this.buildWarpDestinationDescriptor(e.position,e.quaternion,this.getHeroId(e),e.cameraMode,e.floorVisibility,e.orthoZoom)}},{key:"setWarpDestination",value:function(e){this.warpDestHeroLoc=e}},{key:"setWarpDestinationByHeroIndex",value:function(e){var t=this.getHeroDescriptorByHeroIndex(e);return null!==t&&(this.setWarpDestination(t),!0)}},{key:"setWarpDestinationByPano",value:function(e,t){return!!this.model.panos.get(e.id)&&this.setWarpDestinationByPanoId(e.id,t)}},{key:"setWarpDestinationByPanoId",value:function(e,t){var n=this.model.panos.get(e);if(n){t=t||new THREE.Quaternion;var i=this.buildWarpDestinationDescriptor(n.position,t,n.id,"panorama",[],-1);return this.setWarpDestination(i),!0}return!1}},{key:"getHeroDescriptorByHeroIndex",value:function(e){var t=objects.play.heroCount();if(null!==this.warpDestHeroLoc&&t<2)return Le.info("ShowPath.getHeroDescriptorByHeroIndex() -> Only one hero location is available."),this.model.getHeroDescriptorByIndex(0);var n=this.model.getHeroDescriptorByIndex(e);n=util.getPlayDataItem(e),1==objects.store.getters["guide/plays"][e].type&&(n=util.getPlayDataItem(e,0));var i=util.convertHighlight(n),o=new _r(i);if(o){var r=o.isPano()?o.panoId:o.cameraMode;Le.debug('ShowPath.getHeroDescriptorByHeroIndex() -> New brush/warp destination: "'+r+'" out of '+t+" choices.")}return o}},{key:"getHeroDescriptorByPano",value:function(e){return this.model.panos.get(e.id)?this.getHeroDescriptorByPanoId(e.id):null}},{key:"getHeroDescriptorByPanoId",value:function(e){var t=this.getHeroIndexFromPanoId(e);return this.getHeroDescriptorByHeroIndex(t)}},{key:"getHeroIndexFromPanoId",value:function(e){for(var t=0;t<this.model.heroLocations.length;t++){var n=this.model.heroLocations[t],i=this.getHeroId(n);if(i&&i===e)return t}return-1}},{key:"getHeroPano",value:function(e){if(null===e)return Le.warn("getHeroPano(): no destination"),null;var t=this.getHeroId(e),n=this.model.panos.get(t);return void 0===n&&(n=null,""!==t&&Le.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=Te.warp.walkExtraPanosDistance,i=e.id+":"+t.id+":"+n;if(this.shortPaths.hasOwnProperty(i))return this.shortPaths[i]?this.shortPaths[i].slice():null;var o=t.id+":"+e.id+":"+n;if(this.shortPaths.hasOwnProperty(o))return this.shortPaths[o]?this.shortPaths[o].slice().reverse():null;var r=this.model.panos.aStarSearch(e,t);return this.model.panos.includeNodesNearPath(r,n),this.shortPaths[i]=r?r.slice():null,r}},{key:"makePathHulls",value:function(e){var t,n,i,o,r,a=0,s=[],l=[],c=[],u=this.model.panos;o=(t=u.get(e[0])).floor.floorIndex;for(var h=0;h<e.length;h+=1)(n=(t=u.get(e[h])).floorPosition.clone().sub(this.model.position)).y+=this.pathHeight(),s.push(n),l.push(t.position.clone()),i=t.floor.floorIndex,c.push(i>o?Te.path.colorUp:i<o?Te.path.colorDown:Te.path.color),h>0&&((r=l[h].distanceTo(l[h-1]))>a&&(a=r));return a>this.longestStep&&(this.longestStep=a,Le.debug("path contains "+a+" meter segment")),{floor:s,camera:l,color:c}}},{key:"makeFloorCurves",value:function(e,t,n){var i=this.player.mode===Ue.PANORAMA?Te.path.waypointIndoorRadius:Te.path.waypointRadius,o=this.pointPathDistance(e)-2*i,r=e.slice(0),a=r[1].clone().sub(r[0]);a.y=0,a.normalize().multiplyScalar(i),r[0]=(new THREE.Vector3).copy(r[0]).add(a),(a=r[r.length-2].clone().sub(r[r.length-1])).y=0,a.normalize().multiplyScalar(i),r[r.length-1]=(new THREE.Vector3).copy(r[r.length-1]).add(a);var s=new THREE.CatmullRomCurve3(r),l=Math.floor(o/n);l=4*Math.floor(l/4),l=Math.max(4,l);for(var c,u,h=s.getSpacedPoints(l),d=[],p=new THREE.Vector3,f=0;f<h.length;f+=1){u=0,c=h[f].distanceTo(e[0]);for(var m=1;m<e.length;m+=1)p.copy(h[f]).sub(e[m]),p.y*=4,p.length()<c&&(u=m);d.push(t[u])}return{distance:o,points:h,colors:d}}},{key:"makeCameraCurvePoints",value:function(e,t){var n=this.pointPathDistance(e);return new THREE.CatmullRomCurve3(e).getSpacedPoints(Math.max(2,Math.floor(n/t)))}},{key:"setPathHulls",value:function(e){var t=this.makePathHulls(e);this.floorHull=t.floor,this.cameraHull=t.camera,this.colorHull=t.color}},{key:"setFloorCurves",value:function(){var e=this.makeFloorCurves(this.floorHull,this.colorHull,this.brushPrefs.paveStep);this.floorPathDistance=e.distance,this.floorCurvePoints=e.points,this.floorCurveColors=e.colors}},{key:"setCameraCurvePoints",value:function(){this.camCurvePoints=this.makeCameraCurvePoints(this.cameraHull,Te.warp.stepFactor*this.brushPrefs.paveStep)}},{key:"chooseWarpPath",value:function(e){var t,n,i,o=this.playerControls.cameras[Ue.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?(Le.debug("warp path to unreachable node"),n=(t=this.warpDestPano.position.clone().sub(o.position)).clone().negate(),t.multiplyScalar(.15).add(o.position),n.multiplyScalar(.15).add(this.warpDestPano.position),t.y=o.position.y,n.y=this.warpDestPano.position.y,i=new THREE.CubicBezierCurve3(o.position.clone(),t,n,this.warpDestPano.position.clone()),this.warpPathPoints=i.getSpacedPoints(this.brushPrefs.cvSegments)):(Le.debug("follow warp path (path distance was "+this.nodes.length+" nodes, "+this.floorPathDistance+")"),this.setCameraCurvePoints(),this.warpPathPoints=this.camCurvePoints.slice(0)),this.warpLength=0,this.warpPathLengths=[0];for(var r=new THREE.Vector3,a=new THREE.Vector3,s=Math.cos(THREE.MathUtils.degToRad(Te.warp.minBrakeAngle)),l=Math.cos(THREE.MathUtils.degToRad(Te.warp.maxBrakeAngle)),c=1;c<this.warpPathPoints.length;c+=1){r.copy(this.warpPathPoints[c-1]).sub(this.warpPathPoints[c]);var u=r.length();r.y*=Te.warp.climbEffort;var h=r.length()/u;if(c>1){r.setY(0).normalize(),a.copy(this.warpPathPoints[c-2]).sub(this.warpPathPoints[c-1]).setY(0).normalize();var d=Math.min(1,r.dot(a)),p=1+(Te.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=Te.warp.showBunny;for(var n=.6*Te.path.ribbonWidth*.5,i=new THREE.Vector3,o=new THREE.Vector3(0,this.pathHeight(),0),r=new THREE.BufferGeometry,a=new THREE.Vector3,s=0;s<e.length;s+=1){a.copy(e[s]),0===s?a.sub(e[s+1]):a.sub(e[s-1]).negate(),a.normalize(),i.crossVectors(a,_e.UP),i.multiplyScalar(n);var l=(new THREE.Vector3).copy(e[s]).add(o);l.sub(i),r.vertices.push(l),(l=(new THREE.Vector3).copy(e[s]).add(o)).add(i),r.vertices.push(l)}var c,u,h,d=0;for(s=0;s<e.length-1;s+=1){var p=2*s,f=d,m=d+=e[s+1].distanceTo(e[s]),v=t[s],g=t[s+1];(c=new THREE.Face3(p,p+1,p+2)).vertexColors=[new THREE.Color(v),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,f),new THREE.Vector2(1,f),new THREE.Vector2(0,m)]),(c=new THREE.Face3(p+2,p+1,p+3)).vertexColors=[new THREE.Color(g),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,m),new THREE.Vector2(1,f),new THREE.Vector2(1,m)])}r.computeFaceNormals(),r.computeVertexNormals(),this.player.mode===Ue.PANORAMA?((h=THREE.UniformsUtils.clone(jt.ribbon.uniforms)).map.value=this.pathImg.path,h.opacity.value=0,h.color.value.set(Te.path.color),u=new THREE.RawShaderMaterial({side:THREE.DoubleSide,depthWrite:!1,transparent:!0,vertexShader:jt.ribbon.vertexShader,fragmentShader:jt.ribbon.fragmentShader,uniforms:h,name:"ribbonT",opacity:0})):u=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,name:"ribbonOut",vertexColors:THREE.VertexColors});var y=new THREE.Mesh(r,u);return y.name="ribbon",this.player.mode===Ue.PANORAMA&&(y.renderOrder=rt),y}},{key:"drawPathPavement",value:function(e){for(var t,n=new THREE.Vector3,i=new THREE.BufferGeometry,o=new THREE.Vector3,r=0;r<e.length;r+=1)o.copy(e[r]),0===r?o.sub(e[r+1]).negate():o.sub(e[r-1]),o.normalize(),n.crossVectors(o,_e.UP),n.multiplyScalar(this.brushPrefs.paveWidth),(t=(new THREE.Vector3).copy(e[r])).sub(n),i.vertices.push(t),i.vertices.push((new THREE.Vector3).copy(e[r])),(t=(new THREE.Vector3).copy(e[r])).add(n),i.vertices.push(t);var a,s,l;for(r=0;r<e.length-1;r+=1)a=3*r+1,l=(s=.25*r)+.25,i.faces.push(new THREE.Face3(a-1,a,a+3)),i.faceVertexUvs[0].push([new THREE.Vector2(0,s),new THREE.Vector2(.5,s),new THREE.Vector2(.5,l)]),i.faces.push(new THREE.Face3(a+3,a+2,a-1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(0,l),new THREE.Vector2(0,s)]),i.faces.push(new THREE.Face3(a+3,a,a+1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(.5,s),new THREE.Vector2(1,s)]),i.faces.push(new THREE.Face3(a+3,a+1,a+4)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(1,s),new THREE.Vector2(1,l)]);var c=this.player.mode===Ue.PANORAMA?new THREE.MeshBasicMaterial({color:Te.path.color,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,opacity:0,name:"paveT",map:this.pathImg.path}):new THREE.MeshBasicMaterial({color:Te.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===Ue.PANORAMA?Te.path.waypointIndoorRadius:Te.path.waypointRadius,i=this.pathHeight(),o=new THREE.CylinderGeometry(n,n,i,32),r=THREE.UniformsUtils.clone(jt.waypoint.uniforms);r.map.value=e,r.opacity.value=0,r.color.value.set(Te.path.color);var a={side:THREE.DoubleSide,depthWrite:!1,depthTest:!1,transparent:!0,vertexShader:jt.waypoint.vertexShader,fragmentShader:jt.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0};this.player.mode!==Ue.PANORAMA&&(a.depthTest=!1,a.name="wayPtOut");var s=new THREE.RawShaderMaterial(a),l=new THREE.Mesh(o,s);return l.renderOrder=tt,l.name=t,l}},{key:"makeStartMarker",value:function(e,t){var n=(new THREE.Vector3).copy(t[1]).sub(t[0]);n.y=0,n.normalize();var i=Math.acos(n.x),o=this.makeWaypointObj(this.pathImg.pathStart,"Start");return o.rotateOnAxis(new THREE.Vector3(0,1,0),i),o.position.copy(e),o}},{key:"makeEndMarker",value:function(e){var t=this.makeWaypointObj(this.pathImg.pathEnd,"End"),n=this.model.panos.get(this.nodes[0]).floor.floorIndex,i=this.model.panos.get(this.nodes[this.nodes.length-1]).floor.floorIndex;return n<i?t.material.uniforms.color.value.set(Te.path.colorUp):n>i&&t.material.uniforms.color.value.set(Te.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!==Ue.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(ut.property(e.material.uniforms.opacity,"value",0),Te.path.fadeOutTime,n,0,de[Te.warp.blendEasing]):pe.start(ut.property(e.material,"opacity",0),Te.path.fadeOutTime,n,0,de[Te.warp.blendEasing]),t+=1,n=null);0===t&&this.discardPathObject(),this.player.mode!==Ue.PANORAMA&&this.fadeInCpm(Te.path.fadeInTime-3)}}},{key:"appearSlow",value:function(){var e;this.fadeOutCpm(Te.path.fadeInTime);for(var t=this.player.mode===Ue.PANORAMA?Te.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(ut.property(e.material.uniforms.opacity,"value",t),Te.path.fadeInTime,null,0,de[Te.warp.blendEasing]):pe.start(ut.property(e.material,"opacity",t),Te.path.fadeInTime,null,0,de[Te.warp.blendEasing]))}},{key:"update",value:function(){this.obj3d&&this.obj3d.updateMatrixWorld()}},{key:"calcBurnsAmount",value:function(e){var t=THREE.MathUtils.degToRad(Te.warp.burnsAngle);if(this.player.mode===Ue.PANORAMA){var n=this.burnsDir*t;if(this.upcomingTransType===me)return n;var i=e;if(null===i)return Le.warn("Transition request for non-highlight"),n;var o=this.getHeroDescriptorByHeroIndex(i);if(null===o)return n;if(!o.isPano())return n;var r=this.getHeroPano(o),a=this.playerControls.cameras[Ue.PANORAMA],s=_e.FORWARD.clone().applyQuaternion(a.quaternion).setY(0).normalize(),l=Math.min(THREE.MathUtils.degToRad(Te.warp.minBurnsAngle),t),c=function(e){var n=Math.acos(Math.min(1,e.dot(s))),i=(new THREE.Vector3).crossVectors(s,e);return Math.max(l,Math.min(Math.abs(n),t))*Math.sign(i.y)};if(r===this.player.currentPano)return c(_e.FORWARD.clone().applyQuaternion(o.quaternion).setY(0).normalize());var u=this.findShortestPath(this.player.currentPano,r);if(null==u||u.length<1)return Le.debug("Empty path ahead..."),n;var h=this.makePathHulls(u),d=new THREE.CatmullRomCurve3(h.camera),p=Math.min(.1,Te.warp.lookAheadDist/d.getLength());return c(d.getPointAt(p).clone().sub(a.position).setY(0).normalize())}return this.player.mode===Ue.DOLLHOUSE?.02*this.burnsDir:this.burnsDir}},{key:"waitNextStep",value:function(e,t){var n=Te.warp.tourStepDelay;n||(n=this.lastTransType===me?constants.tourStepDelaySlideShow:constants.tourStepDelayDefault);var i=new THREE.Euler,o=new THREE.Vector3;Le.debug("Starting wait: "+(void 0!==t));var r=this.calcBurnsAmount(e),a=function(){this.endWarpState(),this.player.mode===Ue.DOLLHOUSE&&(this.playerControls.cameras[Ue.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(Te.warp.doBurns)if(this.player.mode===Ue.PANORAMA){var l=this.playerControls.cameras[Ue.PANORAMA];i.setFromQuaternion(WarpcameraStyle.quaternion,Te.warp.eOrder);var c=s*r/n;i.y+=c,o.set(0,0,-1),o.applyEuler(i),o.add(l.position),l.controls.lookAt(o),l.controls.lookVector.copy(o),l.lookAt(o)}else this.player.mode===Ue.DOLLHOUSE?this.playerControls.controls[Ue.DOLLHOUSE].rotationAcceleration.x=r:this.playerControls.controls[Ue.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===Ue.DOLLHOUSE||this.warpDestHeroLoc.cameraMode===Ue.FLOORPLAN){var t=function(){e&&e()}.bind(this);this.player.flyToNewMode({mode:this.warpDestHeroLoc.cameraMode,duration:Te.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:t,force:!0})}else Le.warn("no warp destination!!!"),e&&e()}},{key:"_resetWarpShaderParams",value:function(e){this.player.mode===Ue.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!==ze&&this._clearWarpShading(),this._wrapupTravelOnlyBits(),this.upcomingTransType=null,e&&e()}},{key:"_warpCameraAim",value:function(e,t){var n=this.warpDestHeroLoc.quaternion,i=this.playerControls.cameras[Ue.PANORAMA],o=new THREE.Vector3(0,0,1).applyQuaternion(n).normalize(),r=new THREE.Vector3(0,0,1).applyQuaternion(i.quaternion).normalize().dot(o),a=THREE.MathUtils.radToDeg(Math.acos(r)),s=new THREE.Euler(0,0,0,Te.warp.eOrder).setFromQuaternion(n,Te.warp.eOrder),l=(new THREE.Euler).setFromQuaternion(i.quaternion,Te.warp.eOrder),c=new THREE.Euler(s.x-l.x,s.y-l.y,s.z-l.z,Te.warp.eOrder);c.y=Ie.constrainedTurn(c.y),this.burnsDir=Math.sign(c.y);var u=new THREE.Euler(0,0,0,Te.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>Te.warp.minRotation?pe.start(d,e,t,0,de[Te.warp.movementEasing]):(Le.debug("Aim angle only is "+a.toPrecision(3)+" degrees, skipping explicit re-aim"),void(t&&t()))}},{key:"_warpBendAim",value:function(e,t,n,i){var o=i||0,r=this.playerControls.cameras[Ue.PANORAMA],a=new THREE.Euler(0,0,0,Te.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Te.warp.eOrder),s=(new THREE.Euler).setFromQuaternion(r.quaternion,Te.warp.eOrder),l=new THREE.Euler(a.x-s.x,a.y-s.y,a.z-s.z,Te.warp.eOrder);l.y=Ie.constrainedTurn(l.y);var c=Math.min(THREE.MathUtils.degToRad(Te.warp.softBendTilt),Math.abs(l.x));l.x=c*Math.sign(l.x),c=Math.min(THREE.MathUtils.degToRad(Math.max(0,Te.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,Te.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)*Te.warp.softBendEnd;u.x=a.x-n*l.x,u.y=a.y-n*l.y,u.z=a.z-n*l.z}h.set(0,0,-1),h.applyEuler(u),h.add(r.position),r.controls.lookAt(h),r.controls.lookVector.copy(h),r.lookAt(h)}.bind(this);return pe.start(d,t,n,o,de[Te.warp.movementEasing])}},{key:"_warpStepCameraAim",value:function(e,t,n){var i=this.playerControls.cameras[Ue.PANORAMA],o=new THREE.Euler(0,0,0,Te.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Te.warp.eOrder),r=(new THREE.Euler).setFromQuaternion(i.quaternion,Te.warp.eOrder),a=new THREE.Euler(o.x-r.x,o.y-r.y,o.z-r.z,Te.warp.eOrder);a.y=Ie.constrainedTurn(a.y),this.burnsDir=Math.sign(a.y);var s=new THREE.Euler(0,0,0,Te.warp.eOrder),l=new THREE.Vector3,c=function(e,t){e<.5?s.copy(r):s.copy(o),l.set(0,0,-1),l.applyEuler(s),l.add(i.position),i.controls.lookAt(l),i.controls.lookVector.copy(l),i.lookAt(l)}.bind(this);return pe.start(c,t,n,0,de[Te.warp.movementEasing])}},{key:"setBurnsDir",value:function(){var e=this.playerControls.cameras[Ue.PANORAMA],t=new THREE.Euler(0,0,0,Te.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Te.warp.eOrder),n=(new THREE.Euler).setFromQuaternion(e.quaternion,Te.warp.eOrder),i=new THREE.Euler(t.x-n.x,t.y-n.y,t.z-n.z,Te.warp.eOrder);i.y=Ie.constrainedTurn(i.y),this.burnsDir=Math.sign(i.y)}},{key:"stepWarpPath",value:function(e,t){var n=this.playerControls.cameras[Ue.PANORAMA],i=this.warpPathPoints?this.warpPathPoints[0]:e;if(!i)return n.position.copy(this.warpDestPano.position),!0;var o=this.warpDestPano.position;if(null!==this.nodes&&this.cameraHull&&this.cameraHull.length>1){var r=new THREE.Vector3;t<.5?r.copy(this.cameraHull[1]).sub(i).normalize().multiplyScalar(Te.warp.softPushDist*t).add(i):r.copy(this.cameraHull[this.cameraHull.length-2]).sub(o).normalize().multiplyScalar(Te.warp.softPushDist*Te.warp.softPushEnd*(1-t)).add(o),n.position.copy(r)}else t<.5?n.position.copy(i):n.position.copy(o)}},{key:"interruptAndFastForward",value:function(e,t){this.warping&&(this.warpInterrupted=!0,this.warpInterruptionBlackoutStyle=e,this.warpInterruptionTravelTime=t,null!==this.warpInterruptionBlackoutStyle&&void 0!==this.warpInterruptionBlackoutStyle||(this.warpInterruptionBlackoutStyle=He),null!==this.warpInterruptionTravelTime&&void 0!==this.warpInterruptionTravelTime||(this.warpInterruptionTravelTime=Te.minWarpTime))}},{key:"warpCameraAim",value:function(e){var t=Te.warp.minWarpTime;if(this.upcomingTransType===me)t=Te.warp.teleportTime;else{var n=this.playerControls.cameras[Ue.PANORAMA],i=new THREE.Euler(0,0,0,Te.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,Te.warp.eOrder),o=(new THREE.Euler).setFromQuaternion(n.quaternion,Te.warp.eOrder),r=new THREE.Euler(i.x-o.x,i.y-o.y,i.z-o.z,Te.warp.eOrder);r.y=Ie.constrainedTurn(r.y);var a=1e3*Math.abs(r.y)/THREE.MathUtils.degToRad(Te.warp.maxAimPerSec);t=Math.max(t,a)}var s=function(){this._warpStopFlying(),this.discardSlow(),e&&e()}.bind(this);this._warpCameraAim(t,s)}},{key:"warpCommonParameters",value:function(e,t,n,i){this.model.skybox.material.uniforms.blackout.value=i;var o=ut.uniform(this.model.skybox,"progress",1),r=ut.allUniforms(this.model.chunks,"progress",1),a=!1,s=function(){if(this.warpInterrupted)return a=!0,!0}.bind(this),l=function(e,t){return n&&a?(this.model.skybox.material.uniforms.progress.value=0,!0):void o(e,t)}.bind(this),c=function(e,t){return n&&a?(r(0),!0):void r(e,t)}.bind(this);pe.start(s,e,null,t,null,"safeHaltWatch"),pe.start(l,e,null,t,de[Te.warp.blendEasing],"skyboxProgress"),pe.start(c,e,null,t,de[Te.warp.blendEasing],"chunkProgress")}},{key:"warpTravel_STD",value:function(e){var t,n=Math.min(Te.warp.lookAheadMax,Te.warp.lookAheadDist/this.warpLength),i=this.playerControls.cameras[a.PANORAMA],o=(Math.min(.25,3/this.warpLength),Math.min(.35,7/this.warpLength)),r=new THREE.Euler(0,0,0,Te.warp.eOrder),s=new THREE.Vector3,c=(new THREE.Euler).setFromQuaternion(i.quaternion,Te.warp.eOrder),u=(new THREE.Euler).copy(c),h=i.position.clone(),p=new THREE.Matrix4,f=new THREE.Euler,m=Te.warp.minWarpTime;m+=this.warpLength*Te.warp.timePerMeter,Te.warp.flySpeed>.01&&(m=1e3*this.warpLength/Te.warp.flySpeed);var v=!1,y=this.warpDestHeroLoc.quaternion,w=new THREE.Vector3(0,0,-1).applyQuaternion(y).normalize(),b=this.warpPathPoints[this.warpPathPoints.length-1].clone().sub(this.warpPathPoints[this.warpPathPoints.length-2]).normalize(),E=b.dot(w),x=THREE.MathUtils.radToDeg(Math.acos(E)),T=function(e){var t=o;return THREE.MathUtils.smoothstep(e,0,t)*(1-THREE.MathUtils.smoothstep(e,1-t,1))},P=function(){return p.lookAt(h,t,_e.UP),r.setFromRotationMatrix(p,Te.warp.eOrder),c.setFromQuaternion(i.quaternion,Te.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,Te.warp.eOrder),Ie.constrainedTurn(f.y)}.bind(this),k=function(e,t){if(this.warpInterrupted)return v=!0,!0}.bind(this),R=function(e,t){return v||!this.warpPathPoints?(effects.blur(0),!0):void effects.blur(e)}.bind(this),M=ut.allUniforms(this.model.chunks,"modelAlpha",1),S=function(e,t){return v||!this.warpPathPoints?(M(0),!0):void M(e,t)}.bind(this),I=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),C=function(e,i){return this.warpPathPoints?!!v||void(t=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,Math.min(e+n,1))):(Le.debug("Lost bunny."),!0)}.bind(this),A=function(e,o){if(v)return Le.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);Te.warp.matchCam&&(l*=1-d),p.lookAt(h,t,_e.UP),r.setFromRotationMatrix(p,Te.warp.eOrder),c.setFromQuaternion(i.quaternion,Te.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,Te.warp.eOrder),f.y=Ie.constrainedTurn(f.y),r.x=c.x+l*f.x,r.y=c.y+l*f.y,r.z=c.z+l*f.z,f.set(r.x-u.x,r.y-u.y,r.z-u.z,Te.warp.eOrder),f.y=Ie.constrainedTurn(f.y);var m=THREE.MathUtils.degToRad(Te.warp.maxTurnPerSec)*o/1e3;f.y=Math.sign(f.y)*Math.min(m,Math.abs(f.y)),u.x=u.x+f.x*Te.warp.turnFriction,u.y=u.y+f.y*Te.warp.turnFriction,u.z=u.z+f.z*Te.warp.turnFriction,u.x=Math.max(THREE.MathUtils.degToRad(Te.warp.minDownAngle),u.x);var g=t.clone().sub(h).normalize();if(x<Te.warp.maxAimRotation&&d>0){var y=1-d;g.x=g.x*y+d*b.x,g.y=g.y*y+d*b.y,g.z=g.z*y+d*b.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&&Te.warp.matchCam||(i.controls.lookAt(s),i.controls.lookVector.copy(s),i.lookAt(s))}.bind(this),D=function(){v?(this.discardSlow(),this.upcomingTransType=l.BLACK,this.warpTravel_BLACK(-.5,this.warpInterruptionTravelTime,Oe,e)):this._wrapupWarpShading(e)}.bind(this);C(0);var L=Te.warp.motionLeadTime+1e3*Math.abs(P())/THREE.MathUtils.degToRad(Te.warp.maxTurnPerSec),V=L/(m+=L);this.warpCommonParameters(m,V,!0,Ve),pe.start(k,m,null,0,null,"_haltWatcher"),Te.warp.blur>0&&(g.blurStrength=Te.warp.blur,pe.start(R,m,null,V,T,"blurring")),pe.start(S,m,null,V,T,"modelAlpha"),pe.start(I,m,null,V,d[Te.warp.blendEasing],"followPath"),pe.start(C,m,null,V,d[Te.warp.blendEasing],"goBunny"),pe.start(A,m,D,0,d[Te.warp.blendEasing],"lookAtBunny")}},{key:"warpTravel_BLACK",value:function(e,t,n,i){this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1;var o=e||0;null!=t||(t=Te.warp.teleportTime),this.warpCommonParameters(t,o,!1,n),this.model.chunks.forEach((function(e){e.material.uniforms.blackout.value=n})),this._warpBendAim(null,t,null,o);var r=function(){this.wrapupWarpShadingOnly(i,n)}.bind(this),a=this.player.position.clone();pe.start(this.stepWarpPath.bind(this,a),t,r,o,de[Te.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(_e.FORWARD).applyQuaternion(this.warpDestHeroLoc.quaternion);else{var o=this.player.model.panos.get(e[t]),r=this.player.model.panos.get(e[t+1]);n.copy(r.position).sub(o.position)}return n.normalize(),!0}},{key:"warpCameraTravel",value:function(e,t,n,i){if(this.activeTransType=this.upcomingTransType,this.lastTransType=this.activeTransType,this.upcomingTransType=null,e)this.activeTransType===me?this.warpTravel_BLACK(null,n,t,i):this.activeTransType===ge?this.warpTravel_WALK(function(){this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),i&&i()}.bind(this)):this.warpTravel_STD(i);else{var o=function(){this._wrapupTravel(i)}.bind(this),r={pano:this.warpDestPano,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(r,o)}}},{key:"startWarpState",value:function(){this.warping=!0,this.warpInterrupted=!1,this.warpInterruptionBlackoutStyle=null,this.warpInterruptionTravelTime=null}},{key:"endWarpState",value:function(){this.warping=!1}},{key:"warpToPano",value:function(e,t,n,i){if(this.warping)Le.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!==Ue.PANORAMA)return this.upcomingTransType=null,this.discardSlow(),void this.player.flyToNewMode({mode:Ue.PANORAMA,pano:this.warpDestPano,duration:Te.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:i,force:!0});if(!this.warpDestPano)return Le.warn("no warp destination, callback dropped"),void(this.upcomingTransType=null);var o=!(this.model.panos.isNeighbour(this.player.currentPano,this.warpDestPano)&&this.warpDestPano!==this.player.currentPano&&this.warpDestPano.position.distanceTo(this.player.currentPano.position)<Te.warp.nearPanoDist),r=this.chooseWarpPath(o);if(r&&this.upcomingTransType!==ge){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||(Le.warn("Arrived at a very strange spot!"),this.player.currentPano=this.warpDestPano,this.placeCpm(),this.fadeOutCpm(Te.path.fadeOutTime),this.player.spider.draw()),Le.debug("Warping to pano ",this.warpDestPano.position),this.upcomingTransType!==ge&&this.player.emit(nr,this.player.currentPano,this.warpDestPano),this.startWarpState();var s=function(){this.endWarpState(),i&&i()}.bind(this);r?this.warpCameraTravel(o,t,n,s):this.warpCameraAim(s),this.player.smoothZoomToDefault(Te.zoom.restoreTime)}}}]),e}(),Wr="zoom.in",Qr="zoom.out",Zr="zoom.max",Gr="zoom.min";function qr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Yr=function(e){f(n,EventEmitter);var t=qr(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}},{key:"getVideo",value:function(e){var t=this.instances.get(e);return t||(t=this.addVideo(e)),t.videoElement}},{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".flv")}},{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 $r(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Xr=function(e){f(n,EventEmitter);var t=$r(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}},{key:"getVideo",value:function(e){var t=this.videos.get(e);return t||(t=this.addVideo(e)),t}},{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.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.style.display=he.urlHasValue("debug")?"block":"none",t}}]),n}();function Jr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Kr=function(e){f(n,THREE.Object3D);var t=Jr(n);function n(e,i){var r;o(this,n),(r=t.call(this)).player=e,r._planeGeometry=new THREE.PlaneGeometry(Te.overlay.width,Te.overlay.height,1,1),r._boxGeometry=new THREE.BoxBufferGeometry(Te.overlay.width,Te.overlay.height,Te.overlay.depth);var a=L(r._boxGeometry.index.array);a.splice(24,6),r._boxGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array(a),1)),r._boxMat=new THREE.MeshBasicMaterial({color:"#eeeeee",transparent:!0,opacity:.8});var s=he.detectAndroidMobile()&&he.detectWeixin()&&!he.detectWeixinMiniProgram();return r.overlayVideoPlayer=s?new Yr(r.player):new Xr(r.player),console.log("nonsupportH5Video? "+s),r.info=i,r.sid=i.sid,r.build(i),r.name="overlay_"+r.sid,r.floor=r.player.model.floors.get(i.floorIndex)||r.raycastToFindFloor(),r.updateVisibleOnFloor(),r}return u(n,[{key:"raycastToFindFloor",value:function(){return this.floor=De.raycastToFindFloor(this.player,this.plane.getWorldPosition(new THREE.Vector3)),this.floor||(console.error("Overlay raycastToFindFloor cannot find floor?"),this.floor=this.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.player.EditOverlay&&this.player.EditOverlay.editPlane==this)&&!this.info.hide?this.visible=!0:this.visible=!1}},{key:"build",value:function(e){var t=new THREE.Mesh(this._planeGeometry,new THREE.MeshBasicMaterial({color:"#00c8af",opacity:.4,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-.9,polygonOffsetUnits:-4}));if(t.renderOrder=3,this.add(t),this.plane=t,this.player.OverlayManager.add(this),e.media){if(e.media.includes("video"))e.media=this.overlayVideoPlayer.getVideo(e.sid),e.type="video",e.media.addEventListener("ended",(function(){e.media.play(),e.media.paused?console.log("overlay没重复播放成功 需要点击"):console.log("重播放成功")}));else if(e.media.includes("photo")){var n=new Image;n.crossOrigin="anonymous",n.src=this.player.$app.resource.getUserResourceURL(e.poster),e.media=n,e.type="photo"}t.material.opacity=1,t.material.color=new THREE.Color(1,1,1)}null==e.width&&(e.width=Te.overlay.width),null==e.height&&(e.height=Te.overlay.height),this.setFromInfo(e),e.hasBox&&this.addBox(!0)}},{key:"setFromInfo",value:function(e){var t=this.plane;e.width&&(this.scale.setX(e.width/Te.overlay.width),this.width=e.width),e.height&&(this.scale.setY(e.height/Te.overlay.height),this.height=e.height),e.depth&&this.scale.setZ(e.depth/Te.overlay.depth,this.depth=e.depth),e.pos&&this.position.copy(e.pos),e.qua&&this.quaternion.copy(e.qua),e.hide&&(this.visible=!e.hide),e.type&&(t.material.map?(t.material.map.image=e.media,t.material.map.needsUpdate=!0):("video"==e.type?t.material.map=new THREE.VideoTexture(e.media):(t.material.map=new THREE.Texture(e.media),t.material.map.needsUpdate=!0),t.material.map.wrapS=t.material.map.wrapT=THREE.ClampToEdgeWrapping,t.material.map.minFilter=THREE.LinearFilter,t.material.map.magFilter=THREE.LinearFilter,t.material.map.generateMipmaps=!0),this.file=e.file),this.overlayType=e.type,!!this.hasBox!=!!e.hasBox&&this.addBox(!this.hasBox)}},{key:"addBox",value:function(e){if(e!=!!this.hasBox){if(e){var t=new THREE.Mesh(this._boxGeometry,this._boxMat);t.position.set(0,0,Te.overlay.depth/2),t.renderOrder=3,this.plane.position.set(0,0,Te.overlay.depth),this.add(t),this.box=t}else this.plane.position.set(0,0,0),this.remove(this.box),this.box=null;this.hasBox=e,this.updateMatrixWorld()}}},{key:"dispose",value:function(){this.plane.material.dispose(),this.plane.material.map=null,this.parent.remove(this)}}]),n}(),ea={priorityEvent:[{hoverOverlay:"pointer"},{addOverlay:"url(https://4dkk.4dage.com/v3-test/img/box_video.png),auto"},{hoverFootMarker:"pointer"},{hoverView:"pointer"},{dragView:"move"},{viewChoosePos:"pointer"}],list:[],currentCursorIndex:null,init:function(e){this.domElements=[e.domElement]},add:function(e){var t=this.priorityEvent.find((function(t){return t[e]}));t?this.list.includes(e)||(this.judge({addItem:t,name:e}),this.list.push(e)):console.error("CursorDeal 未定义优先级 name:"+e)},remove:function(e){var t=this.list.indexOf(e);t>-1&&(this.list.splice(t,1),this.judge())},judge:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.addItem){var n=this.priorityEvent.indexOf(t.addItem);(n<this.currentCursorIndex||null==this.currentCursorIndex)&&(this.domElements.forEach((function(e){return e.style.cursor=t.addItem[t.name]})),this.currentCursorIndex=n)}else{var i={index:1/0,cursor:null};this.list.forEach((function(t){var n=e.priorityEvent.find((function(e){return e[t]})),o=e.priorityEvent.indexOf(n);o<i.index&&(i.index=o,i.cursor=n[t])})),this.currentCursorIndex=i.index,this.domElements.forEach((function(e){return e.style.cursor=i.cursor||""}))}}};function ta(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var na=function(e){f(n,EventEmitter);var t=ta(n);function n(e){var i;o(this,n),(i=t.call(this)).player=e,i.group=new THREE.Object3D,i.group.name="OverlayGroup",e.OverlayManager=h(i),i.withBox=!0,i.lineMat=Gn.createFatLineMat({depthTest:!1,lineWidth:2,color:"#4fffff",opacity:.3}),i.model=i.player.model,i.model.add(i.group),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];a.pos=(new THREE.Vector3).fromArray(a.pos),a.qua=(new THREE.Quaternion).fromArray(a.qua),i.add(new Kr(i.player,a))}return r.boxPhotos&&r.boxPhotos.length&&r.boxPhotos.forEach((function(e){e.pos=(new THREE.Vector3).fromArray(e.pos),e.qua=(new THREE.Quaternion).fromArray(e.qua),i.add(new Kr(i.player,e))})),e.on("collectIntersectMesh",(function(e){e.push.apply(e,L(i.group.children.filter((function(e){return e.visible})).map((function(e){return e.plane}))))})),e.on("judgeIntersect",(function(e,t){t.getConsumed()||e&&(e.object.overlayType||e.object.parent.overlayType)?(i.hoverOverlay(e.object),t.consume()):i.hoverOverlay(null)})),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.visible=!0)}))}},{key:"hide",value:function(e){this.group.children.forEach((function(t){"all"!=e&&t.floor.floorIndex!=e||(t.visible=!1)}))}},{key:"setSize",value:function(e,t){this.openOverlay&&this.resizeOverlay()}},{key:"hoverOverlay",value:function(e,t){var n=this;if(this.group.visible){var i;if(this.withBox&&e?e=(i=e.parent).plane:i=e,e){if(ea.add("hoverOverlay"),i.visible&&i!=this.hoveringPlane){this.hoveringPlane&&this.hoverOverlay(null);for(var o=e.geometry.getAttribute("position").array,r=new THREE.Object3D,a=[0,1,3,2],s=0;s<4;s++){var l=[{x:o[3*a[s]],y:o[3*a[s]+1],z:o[3*a[s]+2]},{x:o[3*a[(s+1)%4]],y:o[3*a[(s+1)%4]+1],z:o[3*a[(s+1)%4]+2]}];r.add(Gn.createFatLine(l,{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))})),e.border=r,e.add(r),this.hoveringPlane=i,this.lineMat.opacity=0,pe.cancelById(Te.freeze.wallLineShine,!0),pe.start(function(e){this.lineMat.opacity=e}.bind(this),200,null,0,de[Te.transition.blendEasing],"wallLineShine",Te.freeze.wallLineShine)}}else{if(this.hoveringPlane){var c=function(){u.border.children.forEach((function(e){e.geometry.dispose()})),u.remove(u.border)},u=this.withBox?this.hoveringPlane.plane:this.hoveringPlane;pe.cancelById(Te.freeze.wallLineShine),"soon"==t?(this.lineMat.opacity=0,c()):pe.start(function(e){this.lineMat.opacity=1-e}.bind(this),200,c,0,de[Te.transition.blendEasing],"wallLineShine",Te.freeze.wallLineShine,c),this.hoveringPlane=null}ea.remove("hoverOverlay")}}}},{key:"getMatFromCss",value:function(e){if(e.includes("matrix3d"))var t=e.slice(9,-1).split(",");else t=e.slice(7,-1).split(",");if(t.forEach((function(e,n){t[n]=parseFloat(e)})),16==t.length)var n=(new THREE.Matrix4).fromArray(t);else if(6==t.length)n=(new THREE.Matrix4).fromArray([t[0],t[1],0,0,t[2],t[3],0,0,0,0,1,0,t[4],t[5],0,1]);return n}},{key:"getCssFromMatrix",value:function(e){return"matrix3d("+e.elements+")"}},{key:"getOverlayOpenPos",value:function(e){var t=e.width/(.9*$("#player").width()),n=e.height/(.9*$("#player").height()),i=1/Math.max(t,n),o=-e.width*i/$("#player").width(),r=player.cameraControls.activeControl?player.cameraControls.activeControl.camera:player.camera,a=new THREE.Vector3(o,0,-1).unproject(r).clone().sub(player.camera.position),s=player.getDirection(),l=s.angleTo(a),c=e.width/2/Math.tan(l);this.withBox&&(c+=e.plane.position.length());var u=player.camera.position.clone().add(s.clone().multiplyScalar(c));return this.useCssRender||this.updatePlaneElemStyle(i),u}},{key:"updatePlaneElemStyle",value:function(e){this.openOverlay.elem.css({width:this.openOverlay.width*e+"px",height:this.openOverlay.height*e+"px"})}},{key:"getPlanePos",value:function(e){return this.withBox?(new THREE.Vector3).setFromMatrixPosition(e.plane.matrixWorld):e.position.clone()}},{key:"clickOverlay",value:function(e,t){var n=this;if(!this.openOverlay||e){var i=this.withBox&&e?e.plane:e;"video"==e.overlayType&&i.material.map.image.play();var o=this.model.player.domElement.clientWidth/this.model.player.domElement.clientHeight*Math.tan(THREE.MathUtils.degToRad(this.model.player.zoomFov/2)),r=e.width/2/o;console.log("goodDistance "+r),r*=r,0==De.getVisiblePano(e.plane.getWorldPosition(new THREE.Vector3),this.model).length&&console.warn("clickOverlay 找不到visiblePanos");var a={};if(this.player.$app.Camera.flyToPoint(e.position.clone(),{rank:[function(t){var n=new THREE.Vector3(0,0,1).applyQuaternion(e.quaternion),i=t.position.clone().sub(e.position),o=n.angleTo(i);return a[t.id]=o,o=100*-o}],require:[function(t){return t.floorIndex==e.floor.floorIndex}]}),!t){var s=this.player.EditOverlay&&this.player.EditOverlay.editing;if(s&&!(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))return s?(console.log("videos/panel/display面板出现"),void setTimeout((function(){var t=JSON.parse(JSON.stringify(e.info));t.sid=e.sid,t.type=e.overlayType,n.VideoManager.emit("videos/panel/display",t),n.player.EditOverlay.updateOverlayPanel(e),e.updateVisibleOnFloor(),n.player.EditOverlay.controlSelectOverlay(e.visible?e:null)}),10)):void ea.remove("hoverOverlay")}}}}]),n}();function ia(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var oa=function(e){f(n,EventEmitter);var t=ia(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.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.transformControls.switchEditState("overlay"),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,ea.add("addOverlay")}},{key:"endAddPlane",value:function(){this.isAdding=!1,ea.remove("addOverlay"),this.player.reticule.visible=!0}},{key:"addOverlay",value:function(e){var t=e.intersect.point,n=new Kr(this.player,{sid:le.getRandomSid(),floorIndex:this.player.model.currentFloor.floorIndex});n.position.copy(t),this.player.getMouseDirection().angleTo(e.intersect.face.normal)<Math.PI/2?(n.lookAt(e.intersect.face.normal.clone().negate().add(t)),n.position.add(e.intersect.face.normal.clone().negate().multiplyScalar(.01))):(n.lookAt(e.intersect.face.normal.clone().add(t)),n.position.add(e.intersect.face.normal.clone().multiplyScalar(.01))),n.modified="new",n.updateMatrixWorld(),this.player.OverlayManager.clickOverlay(n),this.VideoManager.emit("videos/panel/switchTclMode","translate"),this.endAddPlane()}},{key:"updateOverlayInfo",value:function(e){e.info={width:e.width,height:e.height,depth:Te.overlay.depth*e.scale.z,pos:e.position.clone(),qua:e.quaternion.clone(),media:e.plane.material.map.image,file:e.file,type:e.overlayType,hasBox:e.hasBox,hide:!e.visible}}},{key:"undoEdit",value:function(){if(this.editPlane){var e=this.editPlane;"new"==e.modified?this.disposeOverlay(e):(e.setFromInfo(e.info),"delete"==e.modified&&this.player.OverlayManager.add(e))}}},{key:"updateOverlayScaleDisplay",value:function(){var e=this.editPlane,t=Math.abs(e.width)/190,n=Math.abs(e.height)/190,i=1/Math.max(t,n),o=Math.round(Math.abs(e.width)*i),r=Math.round(Math.abs(e.height)*i);console.log(e.width,e.height,e.depth),this.VideoManager.emit("videos/panel/changeSize",{wText:e.width.toFixed(2),hText:e.height.toFixed(2),width:o,height:r,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(),e.hasBox?this.VideoManager.emit("videos/panel/changeDepth",e.scale.z*Te.overlay.depth*100):this.VideoManager.emit("videos/panel/changeDepth",0)}},{key:"controlSelectOverlay",value:function(e){e?this.transformControls.attach(e):this.transformControls.detach()}},{key:"useImgRatio",value:function(e){var t=this.editPlane.plane;if(t.material.map){var n=t.material.map.image,i="video"==this.editPlane.overlayType?n.videoWidth:n.width,o="video"==this.editPlane.overlayType?n.videoHeight:n.height;if("suitSize"==e){var r=Math.min(Math.max(i,o)/200,1);if(i>o)var a=r,s=r*o/i;else s=r,a=r*i/o}else{var l=Math.sqrt(Math.abs(this.editPlane.width*this.editPlane.height)/(i*o));a=l*i*(this.editPlane.width<0?-1:1),s=l*o*(this.editPlane.height<0?-1:1)}this.editPlane.scale.setX(a/Te.overlay.width),this.editPlane.scale.setY(s/Te.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,null==this.editPlane.depth&&(this.editPlane.addBox(!0),this.editPlane.depth=.01,this.editPlane.scale.z=.01/Te.overlay.depth),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)}},{key:"getOverlaySavingInfo",value:function(){var e=this.editPlane;if(e.file||e.plane.material.map&&e.plane.material.map.image){var t={width:Ie.toPrecision(e.width,4),height:Ie.toPrecision(e.height,4),depth:Ie.toPrecision(Te.overlay.depth*e.scale.z,4),pos:Ie.toPrecision(e.position.toArray(),4),qua:Ie.toPrecision(e.quaternion.toArray(),4),sid:e.sid,hasBox:e.hasBox?1:0,media:[e.overlayType],hide:!e.visible,floorIndex:e.floor.floorIndex},n=this;return{data:t,type:"new"==e.modified?1:0,needSaveMedia:!e.info||e.file!=e.info.file,done:function(){e.modified=!1,n.updateOverlayInfo(e)}}}}},{key:"disposeOverlay",value:function(e){e==this.player.OverlayManager.hoveringPlane&&this.player.OverlayManager.hoverOverlay(null,"soon"),e.dispose(),e.modified="delete"}},{key:"DeleteOverlay",value:function(e,t){var n=this;t(e.sid,(function(){n.disposeOverlay(e),n.controlSelectOverlay(null)}))}}]),n}();function ra(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("store",(function(){return function(e){f(r,e);var t,n,i=ra(r);function r(){var e;return o(this,r),(e=i.call(this)).__store={},e}return u(r,[{key:"get",value:function(){var e=S(C.mark((function e(t,n){var i;return C.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=S(C.mark((function e(t){return C.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=S(C.mark((function e(t){return C.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.getUserImage(t);case 4:return e.abrupt("return",this.__store[t]);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getValue",value:function(e){return this.__store[e]}},{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}(Ci)}));var aa,sa={WalkManger:{enter:'单击<img src="'.concat(zn.getImageURL("images/roam/roam_checked.png"),'" crossorigin="anonymous">设置选中点位漫游可行。'),firstPointLimit:"初始点位无法隐藏。",link:"漫游到选中点位时,操作点位可以行走。",unLink:"漫游到选中点位时,操作点位不可行走。",show:"该点位已显示",hide:"已隐藏该点位,漫游时将不再显示",deactive:'单击<img src="'.concat(zn.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">设置点位漫游可行。'),activeHidePoint:'该点位已隐藏,点击<img src="'.concat(zn.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">可显示。')},TagManger:{unLink:"在该点位漫游时不再显示选中热点。"}};function la(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ca=function(){function e(t){var n=this;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.footTex1=zn.load(zn.getImageURL("images/End_256.png")),this.footTex2=zn.load(zn.getImageURL("images/End_unable_256.png")),this.footTex5=zn.load(zn.getImageURL("images/mutil_connect_upper.png")),this.footTex6=zn.load(zn.getImageURL("images/mutil_connect_lower.png")),this.actionVisiTex0=zn.load(zn.getImageURL("images/roam/roam_invisible.png")),this.actionVisiTex1=zn.load(zn.getImageURL("images/roam/roam_visible.png")),this.actionLinkTex0=zn.load(zn.getImageURL("images/roam/roam_uncheck.png")),this.actionLinkTex1=zn.load(zn.getImageURL("images/roam/roam_checked.png")),aa=t.model.panos,this.ifAllPanoNoNeighbor(),this.meshGroup=new THREE.Object3D,this.meshGroup.name="setVisible-group",t.model.add(this.meshGroup),this.player.model.on("floor.changed",(function(e,t){(n.setTagVisible||n.setPanoVisible)&&n.gotoFloor(e.floorIndex)})),t.on("collectIntersectMesh",(function(e){(n.setPanoVisible||n.setTagVisible)&&e.push.apply(e,L(n.footIcons))})),t.on("judgeIntersect",(function(e,t){(t.getConsumed()||n.setPanoVisible||n.setTagVisible)&&(e&&"FootIcon"==e.object.type?ea.add("hoverFootMarker"):ea.remove("hoverFootMarker"),t.consume())}))}return u(e,[{key:"enterSet",value:function(e){var t=this;if(this.player.$app.gui.toast({event:"DialogList3D.WalkManger.enter",content:sa.WalkManger.enter,showClose:!0}),"panoVisible"==e){if(!this.player.modeTran)return void(this.player.afterCModeFuc=function(){t.enterSet(e)});this.player.flyoutType="beginSetPanoVisible",this.beginSetPanoVisible(),this.setPanoVisible=!0,setTimeout((function(){t.player.flyToMode("floorplan",t.updateFootIconSize.bind(t))}),10)}else this.player.flyToMode("floorplan",this.beginSetTagVisible.bind(this))}},{key:"toggle",value:function(e){var t=this;console.log("walk/Set "+e);var n=this.activePano;if(e){var i=aa.sortByScore([function(e){return e.isAligned()}],[function(e){return-e.position.distanceTo(n.position)}]);if(1==i.length)return void console.log("仅有一个漫游点");var o=[],r=Math.max(2*-i[1].score,4);if("all"==e)(o=i.filter((function(e){return 0!=e.score&&e.pano.footIcon.visible}))).forEach((function(e){return t.panoVLines[e.pano.id]&&t.panoVLines[e.pano.id].visible||t.dealPanoVisible(e.pano.id)}));else{for(var a=function(e,t){var n=e.position.clone(),i=t.position.clone();return De.ifIntersectChunks(n,i,{})},s=1;s<i.length;s++)if(-i[s].score<r)a(n,i[s].pano)&&(i[s].block=!0),i[s].good=!0;else{if(o||(o=i.filter((function(e){return e.good&&!e.block}))),!(o.length<2))break;if(!a(n,i[s].pano))if(0==o.length)o.push(i[s]);else{var l=o[0].pano.position.clone().sub(n.position).setY(0),c=i[s].pano.position.clone().sub(n.position).setY(0);if(l.angleTo(c)>Math.PI/2){console.log("再加一个 角度"+THREE.MathUtils.radToDeg(l.angleTo(c)));break}}}0==o.length&&o.push(i[0]),o.forEach((function(e){return t.dealPanoVisible(e.pano.id)}))}console.log(o)}else{var u=this.player.$app.core.get("Scene").firstView;if(u.pano.footIcon==this.activePano.footIcon&&this.checkHasNeighbor(u.pano,"beforeCreateLine"))return this.player.$app.WalkManager.emit(this.checkLinkStatus()),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:sa.WalkManger.firstPointLimit,showClose:!0}),!1;for(var h in this.panoVLines)this.panoVLines[h].visible&&this.dealPanoVisible(h)}return!0}},{key:"setDisplay",value:function(e){var t=this;aa.forEach((function(e){return e.updateMarkerVisible(!0,t.player)})),this.player.path.currentPanoMarker.mesh.visible=!e,this.player.OverlayManager&&(this.player.OverlayManager.group.visible=!e),this.player.reticule.visible=!e}},{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){var t=[];for(var n in this.panoVLines){var i=this.panoVLines[n];i.name.indexOf("new")>-1&&i.visible?t.push({type:"add",id:n}):-1!=i.name.indexOf("new")||i.visible||t.push({type:"sub",id:n})}if(t.length){var o=e&&e.id||this.activePano.id;this.savePanoVisiChange(o,t)}}},{key:"savePanoVisiChange",value:function(e,t){for(var n=this.searchNeib(e),i=n.seeMarkers,o=n.neighbourUUIDs,r=n.neighbourPanos,a=0;a<t.length;a++){var s,l=this.searchNeib(t[a].id),c=l.seeMarkers,u=l.neighbourUUIDs,h=l.neighbourPanos;if("add"==t[a].type)c.push(e),u.push(e),h[e]=!0,i.push(t[a].id),o.push(t[a].id),r[t[a].id]=!0;else(s=c.indexOf(e))>-1&&c.splice(s,1),(s=u.indexOf(e))>-1&&u.splice(s,1),h[e]=!1,(s=i.indexOf(t[a].id))>-1&&i.splice(s,1),(s=o.indexOf(t[a].id))>-1&&o.splice(s,1),r[t[a].id]=!1;this.panoVTemp[t[a].id]={neighbourPanos:h,seeMarkers:c,neighbourUUIDs:u}}this.panoVTemp[e]={neighbourPanos:r,seeMarkers:i,neighbourUUIDs:o}}},{key:"pauseSetPanoVisible",value:function(e,t){var n=this;this.setPanoVisible&&("unsaved"==e?this.saveLastPanoVi():(this.panoVTemp={},this.startEditPano=null),this.delVisibleLines(),this.activePano=null,this.showFootIcons(null,!0,t),aa.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),ea.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=aa.index[t];n.seeMarkers=this.panoVTemp[t].seeMarkers,n.neighbourUUIDs=this.panoVTemp[t].neighbourUUIDs,n.neighbourPanos=this.panoVTemp[t].neighbourPanos}var i=this;if(this.checkHasNeighbor(this.player.currentPano))this.noPanoHasNeighbor=!1;else{var o=aa.sortByScore([function(t){return e.checkHasNeighbor(t)}],[function(e){return-e.position.distanceTo(i.player.currentPano.position)}]);o&&o.length?(this.player.currentPano=o[0].pano,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=aa.index[e].seeMarkers.slice(0),t.neighbourUUIDs=aa.index[e].neighbourUUIDs.slice(0),t.neighbourPanos=le.CloneObject(aa.index[e].neighbourPanos)),t}},{key:"turnToPanoIndex",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=aa.index[e[n]],o=aa.list.indexOf(i);t.push(o)}return t}},{key:"beginSetTagVisible",value:function(){this.setTagVisible||(this.setTagVisible=!0,this.tagVTemp={},this.setDisplay(!0))}},{key:"SetOneTagVisible",value:function(e){this.tagVsetting!=e&&(this.tagVsetting&&this.saveLastTagVi(this.tagVsetting),this.tagVsetting=e,this.delVisibleLines(),this.showFootIcons(this.player.currentPano),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(this.player.model.panos.index[n]),e=!0;else if(-1==i.name.indexOf("new")&&!i.visible){var o=t.map((function(e){return e.id})).indexOf(n);if(-1==o){console.log("visiblePanos删除error");continue}t.splice(o,1),e=!0}}e&&(this.tagVTemp[this.tagVsetting.sid]=t)}},{key:"pauseSetTagVisible",value:function(e){this.setTagVisible&&this.tagVsetting&&("unsaved"==e?this.saveLastTagVi(this.tagVsetting):this.tagVTemp={},this.delVisibleLines(),this.hideFootIcons(),this.tagVsetting=null)}},{key:"finishSetTagVisible",value:function(){this.setTagVisible&&(this.pauseSetTagVisible(),this.setTagVisible=!1,this.setDisplay(!1))}},{key:"saveTagVisibles",value:function(){this.tagVsetting&&this.saveLastTagVi(this.tagVsetting);var e=[];for(var t in this.tagVTemp)e.push({sid:t,value:this.tagVTemp[t].filter((function(e){return!!e})).map((function(e){return e.id}))});return e}},{key:"afterSaveTagVisibles",value:function(){this.finishSetTagVisible()}},{key:"createTagVisiLines",value:function(e){var t=this;(this.tagVTemp[e.sid]||e.visiblePanos).forEach((function(n){n&&n.floor.floorIndex==t.player.model.currentFloor.floorIndex&&t.createTagSingleLine(n,"old",e)}))}},{key:"createTagSingleLine",value:function(e,t,n){var i=Gn.createLine([e.floorPosition.clone(),n.position.clone()],{color:fe.green});this.meshGroup.add(i),i.name="tagVL-"+t+"-"+e.id,this.tagsVLines[e.id]=i,this.changeIconLinkState(aa.index[e.id].footIcon,"linked")}},{key:"dealTagVisible",value:function(e,t){this.tagsVLines[t]?(this.tagsVLines[t].visible=!this.tagsVLines[t].visible,this.changeIconLinkState(aa.index[t].footIcon,!!this.tagsVLines[t].visible&&"linked"),this.tagsVLines[t].visible||this.player.$app.gui.toast({event:"DialogList3D.TagManger.unLink",content:sa.TagManger.unLink,showClose:!0})):this.createTagSingleLine(aa.index[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(aa.index[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(aa.index[i].footIcon,"linked")):t.createTagSingleLine(aa.index[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&&this.createPanoSingleLine(e,"old",i)}},{key:"createPanoSingleLine",value:function(e,t,n){var i=aa.index[n];if(!i.panoType){var o=i.floorPosition.clone(),r=Gn.createLine([e.floorPosition.clone(),o],{color:fe.green,deshed:i.floorIndex!=e.floorIndex});this.meshGroup.add(r),r.name="PanoVL-"+t+"-"+n,i.floorIndex!=e.floorIndex&&(r.material.opacity=.5),this.panoVLines[n]=r,this.activePano&&(i.floorIndex!=e.floorIndex?this.changeIconLinkState(aa.index[n].footIcon,"floorLinked"):this.changeIconLinkState(aa.index[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.footTex1)}else this.player.$app.WalkManager.emit("walkManager.multiFloorLinking");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:sa.WalkManger.deactive})):(this.lastFloorActivePano=null,this.pauseSetPanoVisible("unsaved"),this.SetOnePanoVisible(aa.index[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus())):(this.lastFloorActivePano=null,this.SetOnePanoVisible(aa.index[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus()));else if(!t||"ActionIcon"==t.type)if(this.activePano){var o;if(this.panoVLines[e]?(this.panoVLines[e].visible=!this.panoVLines[e].visible,o=this.panoVLines[e].visible,this.changeIconLinkState(aa.index[e].footIcon,!!this.panoVLines[e].visible&&"linked")):(this.createPanoSingleLine(this.activePano,"new",e),o=!0),this.startEditPano||(this.startEditPano=this.activePano),o)this.changeIconVisiState(aa.index[e].footIcon,!0),this.changeIconVisiState(aa.index[this.activePano.id].footIcon,!0),t&&"ActionIcon"==t.type&&this.player.$app.WalkManager.emit(this.checkLinkStatus());else{var r=this.checkHasNeighbor(aa.index[e]),a=this.checkHasNeighbor(this.activePano);this.changeIconVisiState(aa.index[e].footIcon,r),this.changeIconVisiState(aa.index[this.activePano.id].footIcon,a),t&&"ActionIcon"==t.type&&(this.player.$app.WalkManager.emit(this.checkLinkStatus()),a||(this.activePano==this.player.$app.core.get("Scene").firstView.pano?this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:sa.WalkManger.firstPointLimit}):this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:sa.WalkManger.hide})))}}else{if("invisible"==t.footIcon.status){if(this.panoVTemp[e]){var s=Object.keys(this.panoVTemp[e].neighbourPanos),l=[];s.forEach((function(e){return l.push({type:"add",id:e})})),this.savePanoVisiChange(e,l)}else{var c=De.getVisiblePano(aa.index[e].position,this.player.model).map((function(e){return e.id})),u=[];c.forEach((function(e){return u.push({type:"add",id:e})})),this.savePanoVisiChange(e,u)}this.player.$app.gui.toast({event:"DialogList3D.WalkManger.show",content:sa.WalkManger.show})}else{this.createPanoVisiLines(aa.index[e],!0),Object.values(this.panoVLines).forEach((function(e){return e.visible=!1}));var h=this.player.$app.core.get("Scene").firstView;if(h.pano.footIcon==t.footIcon)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:sa.WalkManger.firstPointLimit}),!1;var d=this.panoVTemp[h.pano.id]&&this.panoVTemp[h.pano.id].neighbourUUIDs||h.pano.neighbourUUIDs;1==d.length&&d[0]==e&&this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:sa.WalkManger.firstPointLimit}),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:sa.WalkManger.hide}),this.saveLastPanoVi(aa.index[e])}aa.forEach((function(e){return n.changeIconVisiState(e.footIcon,n.checkHasNeighbor(e))}))}this.updateFootIconSize()}},{key:"showFootIcons",value:function(e,t,n){var i=this;if(!this.footIcons){this.footIcons=[],this.actionIcons=[];var o=.4;o*=40/Math.sqrt(Math.min(this.player.domElement.clientWidth,this.player.domElement.clientHeight)),o=THREE.MathUtils.clamp(o,.3,.7);var r=new THREE.PlaneGeometry(o,o,1,1),a=r.clone();for(var s in a.scale(.5,.5,.5),aa.index)if(aa.index[s].isAligned()){var l=new ua(r,aa.index[s]);l.material.uniforms.map.value=this.footTex1,l.visible=!1,aa.index[s].footIcon=l;var c=new ha(l,a,aa.index[s]);c.material.map=this.actionLinkTex0,l.actionIcon=c,this.meshGroup.add(l),l.add(c),this.footIcons.push(l),this.actionIcons.push(c)}}n=n||this.player.model.currentFloor,aa.list.forEach((function(o){if(o.isAligned())if(o.floor==n)o.footIcon.visible=!0,i.changeIconLinkState(o.footIcon,!1),t&&i.changeIconVisiState(o.footIcon,i.checkHasNeighbor(aa.index[o.id],"beforeCreateLine")),e&&o==e?(o.footIcon.oriScale=new THREE.Vector3(1.5,1.5,1.5),t&&i.changeIconLinkState(o.footIcon,"center")):(o.footIcon.oriScale=new THREE.Vector3(1,1,1),o.footIcon.actionIcon.visible=!0);else{var r=(i.panoVTemp&&i.panoVTemp[o.id]?i.panoVTemp[o.id].neighbourUUIDs:o.neighbourUUIDs).filter((function(t){return e&&t==e.id}));o.footIcon.oriScale=new THREE.Vector3(1,1,1),r.length>0?(t&&i.changeFloorIconState(o.footIcon),o.footIcon.visible=!0,i.changeIconLinkState(o.footIcon,"floorLinked")):o.footIcon.visible=!1}}))}},{key:"checkHasNeighbor",value:function(e,t){var n=this.panoVTemp&&this.panoVTemp[e.id]?this.panoVTemp[e.id].neighbourPanos:e.neighbourPanos;if("beforeCreateLine"==t||e!=this.activePano){for(var i in n)if(i!=e.id&&n[i]){if(this.activePano&&this.activePano.id==i&&this.panoVLines[e.id]&&!this.panoVLines[e.id].visible)continue;return!0}return!1}for(var i in this.panoVLines)if(this.panoVLines[i].visible)return!0}},{key:"ifAllPanoNoNeighbor",value:function(){for(var e in aa.index)if(aa.index[e].isAligned()&&this.checkHasNeighbor(aa.index[e]))return!1;return this.noPanoHasNeighbor=!0,!0}},{key:"changeIconLinkState",value:function(e,t){if(e){var n;"linked"==t&&(n=fe.green,e.actionIcon.material.map=this.actionLinkTex1),"floorLinked"==t&&(n="#d5f12e",e.actionIcon.visible=!1,e.material.uniforms.opacity.value=.5),"center"==t&&(n="#d5f12e",e.actionIcon.visible=!1),0==t&&(n="#fff",e.actionIcon.material.map=this.actionLinkTex0);try{e.material.uniforms.color.value.set(n)}catch(e){console.log(e)}}}},{key:"checkFloorLinkStatus",value:function(){var e=this,t="walkManager.unlinkFloor",n=(this.panoVTemp[this.activePano.id]&&this.panoVTemp[this.activePano.id].neighbourUUIDs||aa.index[this.activePano.id].neighbourUUIDs).map((function(e){return aa.index[e]})).filter((function(t){return t.floorIndex!=e.activePano.floorIndex}))[0];n&&n.floor.center.y>this.activePano.floor.center.y&&(t="walkManager.linkUpperFloor"),n&&n.floor.center.y<this.activePano.floor.center.y&&(t="walkManager.linkLowerFloor"),this.player.$app.WalkManager.emit(t)}},{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=this.footTex1,this.activePano||(e.actionIcon.material.map=this.actionVisiTex1),e.material.uniforms.opacity.value=1,this.changeFloorIconState(e)):(e.status="invisible",e.material.uniforms.map.value=this.footTex2,this.activePano||(e.actionIcon.material.map=this.actionVisiTex0),this.activePano&&this.activePano.id==e.name?(e.material.uniforms.opacity.value=1,this.player.$app.gui.toast({event:"DialogList3D.WalkManger.activeHidePoint",content:sa.WalkManger.activeHidePoint})):e.material.uniforms.opacity.value=.5))}},{key:"changeFloorIconState",value:function(e){if(e){var t=aa.index[e.name],n=(this.panoVTemp&&this.panoVTemp[t.id]?this.panoVTemp[t.id].neighbourUUIDs:t.neighbourUUIDs).filter((function(e){return aa.index[e].floorIndex!=t.floorIndex})).map((function(e){return aa.index[e].floor}));return!!n.length&&(n[0].center.y>t.floor.center.y&&(e.status="floor",e.material.uniforms.map.value=this.footTex5),n[0].center.y<t.floor.center.y&&(e.status="floor",e.material.uniforms.map.value=this.footTex6),!0)}}},{key:"getClosestOtherFloorPano",value:function(e,t){return aa.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:"getUpperFloor",value:function(e){var t=this.player.model.floors,n=t.index[e],i={index:e,height:9999};return t.list.forEach((function(e){e.center.y>n.center.y&&Math.abs(e.center.y-n.center.y)<Math.abs(i.height-n.center.y)&&(i.index=e.floorIndex,i.height=e.center.y)})),i.index}},{key:"getLowerFloor",value:function(e){var t=this.player.model.floors,n=t.index[e],i={index:e,height:9999};return t.list.forEach((function(e){e.center.y<n.center.y&&Math.abs(e.center.y-n.center.y)<Math.abs(i.height-n.center.y)&&(i.index=e.floorIndex,i.height=e.center.y)})),i.index}},{key:"recoverAllState2",value:function(){for(var e=0;e<this.footIcons.length;e++)this.footIcons[e].material.uniforms.opacity.value=1,this.footIcons[e].material.uniforms.map.value=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=Ie.getScaleForConstantSize({width2d:150,position:new THREE.Vector3,camera:this.player.camera,dom:this.player.$app.dom}),t=this.player;e=THREE.MathUtils.clamp(e,.45,3.2),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];this.activePano&&(this.lastFloorActivePano=this.activePano),this.setTagVisible?this.pauseSetTagVisible("unsaved",n):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));var i=this.getFitBoundSize(n),o=n.boundingBox.getCenter(new THREE.Vector3);this.player.focusPoint({modelSize:i,aim:o})}}},{key:"getFitBoundSize",value:function(e,t){t||(t=e.size);var n=(this.player.domElement.clientWidth+this.player.domElement.clientHeight)/160,i=t.x,o=t.y;return new THREE.Vector3(i<n?(n+e.size.x)/2:Math.min(i+.3*e.size.x,e.size.x),1,o<n?(n+e.size.z)/2:Math.min(o+.3*e.size.z,e.size.z))}}]),e}(),ua=function(e){f(n,THREE.Mesh);var t=la(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).geometry=e,r.material=new THREE.RawShaderMaterial({vertexShader:jt.waypoint.vertexShader,fragmentShader:jt.waypoint.fragmentShader,uniforms:THREE.UniformsUtils.clone(jt.waypoint.uniforms),transparent:!0,depthWrite:!1,depthTest:!1,name:"footIcon"}),r.material.uniforms.color.value.set("#ffffff"),r.renderOrder=tt,r.type="FootIcon",r.name=i.id,r.pano=i,r.status="",r.position.copy(i.floorPosition.clone()),r.lookAt(r.position.clone().add(new THREE.Vector3(0,1,0))),r}return n}(),ha=function(e){f(n,THREE.Mesh);var t=la(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=tt+1,a.type="ActionIcon",a.name=r.id,a.pano=r,a.position.set(.2,.2,0),a}return n}(),da=function(){function e(t,n){o(this,e),this.player=t,this.position=n.pos,this.sid=n.sid,this.text=n.text||"",this.toPano=n.toPano,this.clickFun=n.clickFun,this.noLine=n.noLine,this.driftDir=n.driftDir,this.floorIndex=n.floorIndex,this.elem=document.createElement("div"),this.elem.className="room-label",this.elem.style.display="none",this.elem.innerHTML="<a><p><span>".concat(this.text,"</span></p></a>"),n.container?n.container.append(this.elem):document.querySelector(".widgets-doll-labels").append(this.elem),this.player.dollLabels.push(this),this.elem.addEventListener("click",this.clickFuc.bind(this)),this.enable=!0,this.type="doll",this.pos2d=new THREE.Vector3,this.noLine&&(this.elem.className+=" noLine")}return u(e,[{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.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=De.getPos2d(this.position,this.player);if(e.trueSide)if(De.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=De.getPos2d(this.position.clone().add(this.driftDir),this.player),n=this.elem.children[0].getBoundingClientRect(),i=Ie.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.position.distanceTo(this.player.camera.position),r=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()));this.elem.style.left=r.x+"px",this.elem.style.top=r.y+"px"}else this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px";this.pos2d=e.vector}else this.elem.style.display="none"}}},{key:"clickFuc",value:function(){this.toPano?this.player.flyToPano({pano:this.toPano}):this.clickFun&&this.clickFun()}},{key:"remove",value:function(){var e=this.elem.parentElement;e&&e.removeChild(this.elem);var t=this.player.dollLabels.indexOf(this);t>-1&&this.player.dollLabels.splice(t,1)}}]),e}();function pa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var fa=1.6,ma=.2,va=new THREE.Vector3(0,0,-1),ga=new THREE.MeshStandardMaterial({transparent:!0,color:new THREE.Color(1,1,1),opacity:.45,metalness:1,emissive:new THREE.Color(.85,.85,.85)}),ya=ga.clone();ya.opacity=.9;var wa=function(e){f(n,THREE.Object3D);var t=pa(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(ma,ma,ma),r.setPosition(i),r.currentHighLight=0,console.log("create entryArrow"),r}return u(n,[{key:"createArrow",value:function(){var e=[{x:0,y:0},{x:1,y:.8},{x:1,y:fa},{x:0,y:.8},{x:-1,y:fa},{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);var o=new THREE.ExtrudeBufferGeometry(t,{depth:.4,bevelEnabled:!1}),r=new THREE.Mesh(o,ga);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*ma,-e.points2d[0].y),n=new THREE.Vector3(e.points2d[1].x,e.bottom+.4*ma,-e.points2d[1].y),i=t.clone().add(n).multiplyScalar(.5),o=t.clone().sub(n).normalize(),r=new THREE.Matrix4;r.set(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1),o.applyMatrix4(r);var a="LEFT"==e.openSide?o.multiplyScalar(-1):o;"reverse"==e.enter&&(i.add(a.clone().multiplyScalar(t.distanceTo(n))),a.multiplyScalar(-1)),this.enterDir=a,this.position.copy(i);var s=Ie.getQuaBetween2Vector(va,a,new THREE.Vector3(0,1,0));this.quaternion.copy(s),this.addLabel(i,a,e.floorIndex),this.entryPos=i}},{key:"addLabel",value:function(e,t,n){var i=this.player.model.panos.closestPanoTowardPoint({point:e});i||console.error("what!!! no closetPano");this.dollLabelOriPos=e.clone().sub(t.clone().multiplyScalar(1.4000000000000001));var o=new da(this.player,{sid:"entry",pos:this.dollLabelOriPos,driftDir:t,noLine:!0,text:W.i18n("model.enter"),toPano:i,floorIndex:n});this.player.defaultRoomLabels.push(o),this.dollLabel=o}},{key:"moveCloseToWall",value:function(e){this.children.forEach((function(t){t.position.z=t.oriPosition.z+e})),this.dollLabel.position=this.dollLabelOriPos.clone().sub(this.enterDir.clone().multiplyScalar(e*ma))}},{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=ya:t.material=ga})),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){ga.depthTest=e,ya.depthTest=e}}]),n}(),ba={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)},Ea=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||Te.vrEnabled&&Te.vrSplitScreen||this.player.linkEditor&&(this.player.linkEditor.setPanoVisible||this.player.linkEditor.setTagVisible))this.elem.style.display="none";else{var e=De.getPos2d(this.position,this.player);e.trueSide?(this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px",Te.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 ba){var n=ba[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}();_('#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 .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 xa=function(){function e(t){o(this,e),this.sortByScore=function(e,t,n){var i=le.filterAll(e,t);return 0===i.length?null:i=i.map((function(e){return{item:e,score:n.reduce((function(t,n){return t+n(e)}),0)}})).sort((function(e,t){return t.score-e.score}))},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(){for(var e=this,t=this.player.$app.store.getValue("flooruser"),n=!0,i=0;i<t.floors.length;i++)for(var o in t.floors[i])if(t.floors[i][o]instanceof Array&&t.floors[i][o].length>0){n=!1;break}n||(this.player.defaultRoomLabels.forEach((function(e){return e.remove()})),this.player.defaultRoomLabels=[],t.floors.forEach((function(n,i){var o=e.player.model.floors.index[i];if(o){o.entryArrow=[];var r=o.boundingBox.min.y,a=JSON.parse(JSON.stringify(n)),s=JSON.parse(JSON.stringify(e.player.model.center));if(s.z=-1*s.z,a.symbols&&Object.keys(a.symbols).forEach((function(e){var n=a.symbols[e];n.endPoint=Ta(n.endPoint,t.angle,s),n.startPoint=Ta(n.startPoint,t.angle,s),n.points2d=n.points2d.map((function(e){return Ta(e,t.angle,s)}))})),a.tags&&Object.keys(a.tags).forEach((function(e){var n=a.tags[e];n.center=Ta(n.center,t.angle,s),n.points2d=n.points2d.map((function(e){return Ta(e,t.angle,s)}))})),a.rooms&&Object.keys(a.rooms).forEach((function(e){var n=a.rooms[e];n.center=Ta(n.center,t.angle,s)})),a.points&&Object.keys(a.points).forEach((function(e){var n=a.points[e],i=Ta({x:n.x,y:n.y},t.angle,s);n.x=i.x,n.y=i.y})),a.symbols){for(var l,c=Object.keys(a.symbols),u=0;u<c.length;u++)a.symbols[c[u]].enter&&((l=JSON.parse(JSON.stringify(a.symbols[c[u]]))).bottom=r+.1,l.floorIndex=i,o.entryArrow.push(new wa(e.player,l)),e.player.model.currentFloor.floorIndex==i?e.updateEntryVisi(!0,i):e.updateEntryVisi(!1,i));e.moveEntryArrow(i)}a.tags=a.tags||{},e.hasPlaneLabels=a.tags.length>0;var h=o.center.y;Object.keys(a.tags).forEach((function(t){var n=a.tags[t],r=n.des&&parseFloat(n.des).toFixed(2),s=n.title,l=r+n.unit+"<sup>2</sup>",c=n.des?"约"+l:"";if(s||c){var u=s&&c?s+"<br>"+l:s||c,d="floorplan"==e.player.modeTran.split("-")[1]?new THREE.Vector3(0,-1,0):new THREE.Vector3(0,1,0),p=n.center,f=new THREE.Vector3(p.x,-999*d.y,-p.y),m=new THREE.Raycaster(f,d,.001,9999).intersectObject(o.children[0]);m[0]?(f=m[0].point).y+=.5:f.y=h;var v=e.player.model.panos.closestPanoTowardPoint({point:f,floor:o});v||console.error("what!!! no closetPano");var g=new da(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 Le.warn("floor[".concat(i,"] is empty"))})),this.initedLabel=!0,this.setPlanLabelVisi())}},{key:"initDoorLabels",value:function(e,t){var n=this,i=[];if(t.rooms&&t.rooms[0]&&t.rooms[0].wallPointIDs){var o=this.player.model.floors.index[e],r=o.boundingBox.min.y;console.log("floorJson",t),Object.keys(t.tags).forEach((function(e){var n=t.tags[e];n.__panos=[],n.title||delete t.tags[e]})),console.log(t.rooms);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){var t=e.doors.find((function(e){return e.vectorId==n.vectorId}));t&&(n.linePoints=t.linePoints,e.doors.push(n),n.atRooms.push(e))}))})),t.rooms.forEach((function(e){e.doors=e.doors.filter((function(e){return e.atRooms}))})),o.panos.forEach((function(e){e._atRoom=null})),t.rooms.forEach((function(e){e.points=e.wallPointIDs.map((function(e){return t.points[e]})),null==e.closetParent&&(o.panos.forEach((function(i){!i._atRoom&&i.isAligned()&&n.searchAtRoom(t,e,i,{x:i.position.x,y:-i.position.z},(function(e){i._atRoom=e,e.panos.push(i)}))})),Object.keys(t.tags).forEach((function(i){var o=t.tags[i];o._atRoom||n.searchAtRoom(t,e,o,{x:o.center.x,y:o.center.y},(function(e){o._atRoom=e,e.taggings.push(o),e.name+=o.title+" "}))}))),e.taggings.length&&e.panos.forEach((function(i){var o=n.sortByScore(e.taggings,[function(e){var o=new THREE.Vector2(i.position.x,i.position.z),r=new THREE.Vector2(e.center.x,-e.center.y);return!n.isShelter(t,r,o)}],[function(e){var t=new THREE.Vector2(i.position.x,i.position.z),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}]);o&&o[0]&&o[0].item.__panos.push(i)}))})),Object.keys(t.tags).forEach((function(e){var i=t.tags[e],o=i.__panos.filter((function(e){return e.neighbourUUIDs.length>0}));o.length&&(i.clickToPano=n.sortByScore(o,[],[function(e){var t=new THREE.Vector2(e.position.x,e.position.z),n=new THREE.Vector2(i.center.x,-i.center.y);return-t.distanceTo(n)}])[0].item)})),o.taggingTables=Object.values(t.tags).filter((function(e){return e.clickToPano}));var s="floor".concat(e,"(").concat(t.name||"no name",") 共有").concat(t.rooms.length,"个房间,分别是 ");t.rooms.forEach((function(e){s+="\n房间".concat(e.roomId," : ").concat(e.name," ")})),t.rooms.forEach((function(i){0!=i.taggings.length&&(Ie.getArea(i.points),i.doors.forEach((function(a){if(!(a.atRooms.length<2)){if(i.closetChilds){var s=a.atRooms.find((function(e){return a.startPoint&&a.endPoint}));Ie.getArea(s.points)}var l=Ie.getNormal({points:[a.startPoint,a.endPoint]}),c=new THREE.Vector3(l.x,0,-l.y),u=!1,h=i.panos.filter((function(e){return e.neighbourUUIDs.length>0}));0==h.length&&(u=!0,h=o.panos.filter((function(e){if(0!=e.neighbourUUIDs.length){var t=new THREE.Vector2(a.center.x,-a.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(a.center.x,0,-a.center.y));return c.angleTo(i)<Math.PI/2||void 0}}})));var d=n.sortByScore(h,[],[function(e){var t=0;if(u){var n=e.position.clone().sub(new THREE.Vector3(a.center.x,0,-a.center.y));t=2*-c.angleTo(n)}var i=new THREE.Vector2(a.center.x,-a.center.y),o=new THREE.Vector2(e.position.x,e.position.z);return-i.distanceTo(o)+t}]);d&&(d=d[0].item);var p=n.sortByScore(i.taggings,[],[function(e){var t=d?new THREE.Vector2(d.position.x,d.position.z):new THREE.Vector2(a.center.x,a.center.y),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}])[0].item,f=new THREE.Vector3(a.center.x,r+.3,-a.center.y),m=a.atRooms.find((function(e){return e!=i&&e.name}));m||(m=a.atRooms.find((function(e){return e!=i})));var v=Math.PI/6,g=m.panos,y=g.filter((function(e){var i=e.position.clone().setY(0).distanceTo(f.clone().setY(0));if(!(i<1.5||i>15))return i>4||g.find((function(t){return bi.filters.isInFanAngle(f,e.position.clone().sub(f).setY(0),v)(t)}))?!n.isShelter(t,f,e.position,a.line):void 0})),w=new Ea(n.player,{doorDir:c,text:p.title,pos:f,visiblePanos:y,sameRoomPanos:g,toPano:d,aim:new THREE.Vector3(p.center.x,0,-p.center.y),floorIndex:e});w.door=a,w.forRoom=i,w.forTag=p,a.doorLabels.push(w),n.player.defaultRoomLabels.push(w)}})))})),i=i.filter((function(e){return e.atRooms.length>1})),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"]),Ea.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.show);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.show||this.player.linkEditor&&this.player.linkEditor.setPanoVisible),o=this.player.model.floors;null!=t&&(o=o.filter((function(e){return e.floorIndex==t}))),o.forEach((function(t){if(t.entryArrow.length){if(i)if(0==e)i=!1;else{var o=n.player.modeTran.split("-")[1];i="floorplan"==o||"panorama"!=o&&"dollhouse"==o}t.entryArrow.forEach((function(e){return i?e.show():e.hide()}))}}))}},{key:"moveEntryArrow",value:function(e){var t=this.player.model.floors.index[e];if(t.entryArrow.length&&t.cadImgRatio){var n=24*this.player.model.floors.index[e].cadImgRatio;t.entryArrow.forEach((function(e){return e.moveCloseToWall(n)}))}}},{key:"searchAtRoom",value:function(e,t,n,i,o){var r=this;if(Ie.isPointInArea(t.points,i)){if(t.closetChilds)t.closetChilds.find((function(t){return r.searchAtRoom(e,e.rooms.find((function(e){return e.roomId==t})),n,i,o)}))||o(t);else o(t);return!0}}},{key:"order",value:function(e,t,n){var i=n.find((function(t){return t.id==e})),o=n.find((function(e){return e.id==t})),r=n.indexOf(i);return(n.indexOf(o)-r+n.length)%n.length==1}},{key:"isShelter",value:function(e,t,n,i){var o=this,r=[new THREE.Vector2(t.x,-t.z),new THREE.Vector2(n.x,-n.z)];return Object.values(e.walls).find((function(t){if(t.id!=i){var n=[o.searchItemById(t.start,Object.values(e.points)),o.searchItemById(t.end,Object.values(e.points))];return Ie.isLineIntersect(r,n)}}))}},{key:"searchItemById",value:function(e,t){for(var n=0,i=t.length;n<i;n++)if(t[n].vectorId==e)return t[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 Ta(e,t,n){var i=new THREE.Vector2(e.x,e.y);if(Math.abs(t)<.01||Math.abs(t-2*Math.PI)<.01)return i;var o=(i.x-n.x)*Math.cos(t)-(i.y-n.z)*Math.sin(t)+n.x,r=(i.y-n.z)*Math.cos(t)+(i.x-n.x)*Math.sin(t)+n.z;return i.x=o,i.y=r,i}var Pa,ka,Ra,Ma,Sa,Ia,Ca,Aa,Da,La,Va,Ha,za,Oa=new THREE.Vector3(0,0,-1),Fa=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}return u(e,[{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">\n <span>N</span>\n </div>\n <div class="center"></div>\n ',this.player.domElement.append(this.dom),this.dirTextDiv=this.dom.querySelector(".dirText"),this.centerDiv=this.dom.querySelector(".center"),this.span=this.dirTextDiv.querySelector("span"),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%":"260px",this.dom.style.top=this.config.mobile?"10%":"60px"),this.centerDiv.style.width="50px",this.centerDiv.style.height="50px",this.config.mobile){var t=this.player.getSize(),n=t.clientWidth,i=t.clientHeight,o=Math.min(n,i);if(o<450){var r=Math.round(o/450*1e3)/1e3;this.dom.transform=" scale(".concat(r,")")}}try{this.renderer=new THREE.WebGLRenderer({antialias:this.config.antialias,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.domElement.setAttribute("name","compass"),this.renderer.setClearAlpha(0),this.renderer.setSize(50,50,!1,window.devicePixelRatio?window.devicePixelRatio:1)}catch(e){throw new RendererCreationException("Unable to create a WebGL rendering context")}this.centerDiv.appendChild(this.renderer.domElement),this.camera=new THREE.PerspectiveCamera,this.camera.fov=70,this.scene=new THREE.Scene,this.scene.add(this.camera),this.createCompass(),this.player.on("scene/LoadHouseFloor",(function(){e.setNorth()})),this.player.on("changeDir",(function(){e.setNorth()}));var a=this.player.$app.store.getValue("flooruser");this.angle=(a.compass-THREE.MathUtils.radToDeg(a.angle)+360)%360||0,this.player.$app.store.on("flooruser",(function(t){e.angle=(t.compass-THREE.MathUtils.radToDeg(t.angle)+360)%360||0}))}},{key:"createCompass",value:function(){var e=new THREE.ConeBufferGeometry(.7,2,4,!0),t=new THREE.ConeBufferGeometry(.7,2,4,!0),n=new THREE.MeshBasicMaterial({vertexColors:!0}),i=function(e,t,n){for(var i=[],o=0,r=e.attributes.position.count;o<r;++o)i.push(1,1,1);var a=function(e,t){i[3*e+0]=t[0],i[3*e+1]=t[1],i[3*e+2]=t[2]},s=[(t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2];a(1,t),a(5,t),a(6,t),a(2,s),a(3,s),a(7,s),a(4,n),a(8,n),a(9,n),e.setAttribute("color",new THREE.BufferAttribute(new Float32Array(i),3))},o=[20/255,146/255,170/255];i(e,[1/255,238/255,245/255],o),i(t,o,[40/255,60/255,103/255]);var r=new THREE.Mesh(e,n);r.position.setY(1),e.computeVertexNormals(),t.computeVertexNormals();var a=new THREE.Object3D;a.add(r);var s=new THREE.Mesh(t,n);s.rotation.x=Math.PI,s.position.setY(-1),a.add(s),a.rotation.z=Math.PI/2,a.rotation.y=Math.PI/2,a.scale.set(.7,.7,.7),this.scene.add(a),this.cones=a}},{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=Oa.clone();if("transitioning"==this.player.mode){var o=new THREE.Camera;o.position.copy(this.camera.position),o.lookAt(o.position.clone().add(n)),t=o.quaternion.invert().premultiply(e)}var r=new THREE.Vector3(0,1,0);t&&r.applyQuaternion(t),n.projectOnPlane(r),i.projectOnPlane(r);var a=n.angleTo(i);n.cross(i).y>0&&(a=-a);var s=this.angle-90+THREE.MathUtils.radToDeg(a);this.dirTextDiv.style.transform="rotate("+s+"deg)",this.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){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]?this.setDisplay(!0):this.setDisplay(!1)}},{key:"setDomLeft",value:function(){this.dom.css({right:"none",left:this.config.mobile?"1%":"2%"})}}]),e}();function Na(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ba={},Ua=function(e,t,n){Ha.material.uniforms.tDiffuse.value=t;var i=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI/2);La.quaternion.copy((new THREE.Quaternion).multiplyQuaternions(i,n));var o=new THREE.Vector3(0,0,-8).applyQuaternion(La.quaternion);La.position.copy(o.clone().negate());var r=ka.renderer.autoClear;ka.renderer.autoClear=!1,ka.renderer.setRenderTarget(e),ka.renderer.render(Va,La),ka.renderer.setRenderTarget(null),ka.renderer.autoClear=r},_a=function(e){return console.log(e),e&&!e.includes("/")?Ra.resource.getUserResourceURL(e):e},ja=function(e){f(n,THREE.EventDispatcher);var t=Na(n);function n(e,i){var r;return o(this,n),r=t.call(this),za=!(Ra=e).config.view,Pa=i,ka=Ra.core.get("SceneRenderer"),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.addEventListener("getViewLinkEdit",(function(e){console.log("getViewLinkEdit"),Ba=e.v})),Ra.Scene.on("loadeddata",(function(){var e=Ra.store.getValue("links");if(e)return Pa.model.builded?void r.init(e):Pa.model.addEventListener("builded",r.init.bind(h(r),e));r.init()})),r}return u(n,[{key:"init",value:function(e){var t=this;Wa.init(),this.createViews(e),Pa.model.add(this.ViewLinkCircles),Pa.model.add(this.ViewLinkBalloons),Pa.model.add(this.ViewLinkExits),this.inited=!0,Pa.currentPano&&Pa.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=[];Pa.on("collectIntersectMesh",(function(e,o){if(t.inited&&t.enabled){var r=!0;if(Pa.isOutsideMode()?i=Ba.markView?[Ba.markView.balloon.mesh]:t.ViewLinkBalloons.children:Pa.is360View(Pa.mode,Pa.currentPano)?(i=Ba.settingEntry?[]:Ba.settingVisibles?t.ViewLinkCircles.children:t.ViewLinkExits.children.concat(t.ViewLinkCircles.children),r=!1):Ba.markView?(i=[Ba.markView.circle.mesh],r=!1):i=t.ViewLinkCircles.children,r)e.push.apply(e,L(i));else{var a=De.getMouseIntersect(Pa.camera,i,Pa.mouse);a&&i.includes(a.object)&&(n=a,t.dealwithIntersect(a),o.consume())}}})),Pa.on("judgeIntersect",(function(e,o){o.getConsumed()||(e&&i.includes(e.object)?(n=e,o.consume()):n=null,t.dealwithIntersect(n))})),Pa.on("click",(function(e){e.getConsumed()||t.dealWithClick()&&e.consume()})),Pa.on("update",(function(e){e.hasChanged.cameraChanged&&t.update()})),Pa.on("mode.changing",(function(e,n,i,o){if("panorama"==e)setTimeout((function(){for(var e in t.views)t.views[e].balloon.showOrHide(!0,o/2,"auto"),t.views[e].circle.mesh.visible=!1;Ba.markView&&(Ba.markView.circle.mesh.visible=!0)}),o||500);else if("floorplan"==e)for(var r in t.views)t.views[r].balloon.mesh.material.depthTest=!0;if("floorplan"==n&&setTimeout((function(){for(var e in t.views)t.views[e].balloon.mesh.material.depthTest=!1}),o),"panorama"==n){for(var a in t.views)t.views[a].balloon.showOrHide(!1),t.views[a].circle.mesh.visible=!0;Ba.cancelPos&&Ba.cancelPos()}})),Pa.model.on("floor.changed",(function(e,t,n){if("panorama"!=Pa.mode||"panorama"==t){var i=Pa.model.allFloorsVisible;Pa.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){Ba.markView!=e&&e.balloon.showOrHide(!1,500)}))}))}}))}},{key:"createViews",value:function(e){if(e&&(le.CloneJson(e.tags||e).forEach(function(e){if(this.views[e.sid])console.log("有重复的view sid"+e.sid);else{var t=new Wa(e);this.addView(t)}}.bind(this)),"panorama"!=Pa.getToMode()))for(var t in this.views)this.views[t].balloon.showOrHide(!0,0)}},{key:"dealwithIntersect",value:function(e){if(this.enabled){var t,n=e&&e.object;if(!this.hoverCircle||this.hoverCircle.mesh==n||Ba.markView&&Ba.markView.circle==this.hoverCircle||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverCircle.setSelect(!1)),!this.hoverBalloon||this.hoverBalloon.mesh==n||Ba.markView&&Ba.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 ea.remove("hoverView"),ea.remove("dragView"),!0;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})):n.name.includes("exit")?((t=this.views[n.name.split("circle_exitDoor")[1]]).exitDoor.setSelect(!0),this.hoverExit=t.exitDoor):(t=this.views[n.name.split("circle_")[1]],this.hoverCircle=t.circle,t.circle.setSelect(!0),this.dispatchEvent({type:"changeIntersect",hovered:t.sid})),Ba.markView==t&&(Pa.currentPano!=t.pano||Ba.settingExit||Ba.settingVisibles)?ea.add("dragView"):(ea.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];return e==this.hoverExit?(t.backToPanorama(),!0):("url"==t.linkType?t.url&&(window.location.href=t.url):"pano"==t.linkType&&t.pano&&t.enter360Pano(),!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)}},{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.enabled=!0)}},{key:"hideAllViews",value:function(){this.enabled&&(Pa.is360View(Pa.mode,Pa.currentPano)?Pa.currentPano.view.backToPanorama():Pa.enteringView&&Pa.once("flying.ended",(function(){Pa.currentPano.view.backToPanorama()})),this.ViewLinkCircles.visible=!1,this.ViewLinkBalloons.visible=!1,this.ViewLinkExits.visible=!1,this.dealwithIntersect(null),this.enabled=!1)}},{key:"focusOn",value:function(e){var t=this;if(Pa.flying)return Pa.once("flying.ended",(function(){t.focusOn(e)}));"panorama"==Pa.mode?Pa.flyToPano({pano:e.nearestPano,lookAtPoint:e.circle.mesh.position}):Pa.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.mesh.visible=!0}else this.views[n].circle.mesh.visible=!1;else{for(var o in this.views)this.views[o].circle.at360View&&this.views[o].circle.updatePos("normal"),t.flyOut||(this.views[o].circle.mesh.visible=!0);t.flyOut&&Ba.markView&&(Ba.markView.circle.mesh.visible=!0)}}},{key:"exitView",value:function(){var e=new Ge;return Pa.is360View(Pa.mode,Pa.currentPano)?(Pa.currentPano.view.backToPanorama(),Pa.once(ar,(function(){e.resolve()}))):e.resolve(),e.promise()}}]),n}(),Wa=function(e){f(n,THREE.EventDispatcher);var t=Na(n);function n(e){var i;return o(this,n),(i=t.call(this)).sid=e.sid,i.pano=null,i.balloon=new Ga(e,h(i)),i.circle=new Za(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,Te.view360.circleDisToCenter),i.url=e.url,(za||"pano"==i.linkType)&&(i.exitDoor=new Za(Object.assign({},e,{circleType:"exitDoor",exitDirection:i.exitDirection}))),e.thumb&&(i.imgSid=e.thumb.split(".jpg")[0],e.thumb=Ra.resource.getUserImagesURL("panorama/".concat(i.imgSid,"/low/").concat(e.thumb)),i.resolution=e.resolution),i.nearestPano=e.nearestPano&&Pa.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(),Pa.currentPano==this.pano?this.backToPanorama():this.entering&&Pa.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=Pa.model.panos.list.indexOf(this.pano);Pa.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 bi(Pa.$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(Pa.$app.core.get("PanoRenderer")),n.qualityManager=Pa.$app.core.get("QualityManager"),n.tiled&&(n.tileDownloader=Pa.$app.core.get("TileDownloader")),n.build1(),n.view=this,Pa.model.panos.add(n),this.panoImgVersion=e.version,t&&Pa.currentPano==this.pano){var i=function e(){Pa.checkAndWaitForPanoLoad(n,"high","low",Pa.basePanoSize,e)||(Pa.model.setProjectedPanos(n,n),n.enter())};Pa.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=zn.load(e,(function(){za&&(t.unDealTex=i),Ua(n,i,t.enterQuaternion)}));return i.flipY=!1,i.minFilter=THREE.LinearFilter,this.renderTarget=n,n.texture}},{key:"mapChangeRot",value:function(){Ua(this.renderTarget,this.unDealTex,this.enterQuaternion)}},{key:"enter360Pano",value:function(e){Pa.isOutsideMode()?Pa.flyToNewMode({mode:"panorama",pano:this.pano,callback:e}):Pa.flyToPano({pano:this.pano},e)}},{key:"backToPanorama",value:function(){Pa.flyToPano({pano:Pa.lastPano||this.nearestPano,lookAtPoint:this.circle.mesh.position})}}]),n}();Wa.init=function(){Wa.inited||(Ma=new THREE.PlaneBufferGeometry(.4,.4),Sa=new THREE.PlaneBufferGeometry(1.5,1.5),Ia=zn.load(zn.getImageURL("images/img_pamove.png")),Ca=zn.load(zn.getImageURL("images/img_pamove_normal.png")),Aa=zn.load(zn.getImageURL("images/img_panorama_dot.png")),Da=zn.load(zn.getImageURL("images/img_exit_dot.png")),(La=new THREE.PerspectiveCamera).fov=80,La.aspect=1,La.updateProjectionMatrix(),(Va=new THREE.Scene).add(La),Ha=new THREE.Mesh(new THREE.SphereBufferGeometry(10,25,25),new THREE.RawShaderMaterial({uniforms:THREE.UniformsUtils.clone(Bt.uniforms),vertexShader:Bt.vertexShader,fragmentShader:Bt.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide})),Va.add(Ha),Wa.inited=!0)};var Qa=function(e){f(n,THREE.EventDispatcher);var t=Na(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){if("sprite"==this.state&&this.mesh.visible&&(e||!this.mesh.material.uniforms.opacity||this.mesh.material.uniforms.opacity.value>0)&&this.mesh.quaternion.copy(Pa.camera.quaternion),this.strictScale){var t="floorplan"==Pa.mode?Pa.cameraControls.activeControl.camera:Pa.camera,n=Ie.getScaleForConstantSize({dom:Pa.$app.dom,maxSize:100,minSize:40,nearBound:2,farBound:80,camera:t,position:this.mesh.position});this.mesh.scale.set(n,n,n)}}},{key:"setStrictScale",value:function(e){this.strictScale=e,e?this.update():this.mesh.scale.set(1,1,1)}},{key:"setMapIn",value:function(e){this.mesh.material.uniforms.mapIn.value=e}},{key:"dispose",value:function(){}}]),n}(),Za=function(e){f(n,e);var t=Na(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(Nt.uniforms),n=new THREE.Mesh(Ma,new THREE.RawShaderMaterial({uniforms:t,vertexShader:Nt.vertexShader,fragmentShader:Nt.fragmentShader,transparent:!0,side:THREE.DoubleSide}));if(n.renderOrder=it,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()}Pa.isOutsideMode()&&(this.mesh.visible=!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(Te.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()}},{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(){Ye(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(ut.uniform(this.mesh,"progress",e?1:0),500,(function(){}),0,de[Te.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=zn.load(e);else{var n;if(e.style)e.style.exit.name&&"custom"!=e.style.exit.name?n=Ra.resource.getAppURL("images/link/exit-style-".concat(e.style.exit.name,".png")):e.style.exit.url&&(n=_a(e.style.exit.url)),t=zn.load(n);else t=Da}else t=Da;else if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=zn.load(_a(e));else{var i;if(e.style)e.style.enter.name&&"custom"!=e.style.enter.name?i=Ra.resource.getAppURL("images/link/enter-style-".concat(e.style.enter.name,".png")):e.style.enter.url&&(i=_a(e.style.enter.url)),t=zn.load(i);else t=Aa}else t=Aa;this.mesh.material.uniforms.mapOut.value=t}}]),n}(Qa),Ga=function(e){f(n,e);var t=Na(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(Ft.uniforms);t.mapOut.value=Ia,t.mapOut2.value=Ca,t.opacity.value=0;var n=new THREE.Mesh(Sa,new THREE.RawShaderMaterial({uniforms:t,vertexShader:Ft.vertexShader,fragmentShader:Ft.fragmentShader,transparent:!0,side:THREE.DoubleSide}));n.renderOrder=it,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;"auto"==n&&(e="panorama"!=Pa.getToMode()&&(Pa.model.allFloorsVisible||!this.view.floor||this.view.floor==Pa.model.currentFloor));t=null!=t?t:500;var o=e?1:0;this.mesh.material.uniforms.opacity.value!=o&&(e&&(this.mesh.visible=!0),this.update(!0),pe.start(ut.uniform(this.mesh,"opacity",o),t,(function(t){i.mesh.visible=!!e}),0,de[Te.transition.blendEasing],"balloonOpa"))}},{key:"setSelect",value:function(e){if(e!=this.selected){this.selected=e;pe.cancelById("balloonPro"),pe.start(ut.uniform(this.mesh,"activeProgress",e?1:0),300,(function(){}),0,de[Te.transition.blendEasing],"balloonPro")}}}]),n}(Qa),qa=function(){function e(t,n){var i=this;o(this,e),this.app=t,this.player=n,this.sceneRenderer=t.core.get("SceneRenderer"),this.sceneNum=t.config.num,this.painting=!1,this.pause=!1,this.mousePosition=new THREE.Vector4,this.currentPaintUrl=null;var r=t.store.getValue("metadata");r?(this.paintData=r.mosaicList,this.width=1024*("pro"==r.sceneFrom?2:4),this.height=1024*("pro"==r.sceneFrom?1:2)):t.store.on("metadata",(function(e){i.paintData=e.mosaicList,i.width=1024*("pro"==e.sceneFrom?2:4),i.height=1024*("pro"==e.sceneFrom?1:2)}))}return u(e,[{key:"init",value:function(){var e=new THREE.Vector3(this.width,this.height,window.devicePixelRatio);this.bufferRenderer=new $a(this.sceneRenderer.renderer,{width:this.width,height:this.height}),this.brushBufferRenderer=new $a(this.sceneRenderer.renderer,{width:4096,height:2048}),this.bufferShader=new Ya({iResolution:{value:e},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}})}},{key:"start",value:function(e){var t=this;this.player.reticule.visible=!1,this.player.cameraControls.activeControl.enabled=!1,this.mousePosition.setZ(0);var n=this.player.camera.getWorldDirection(new THREE.Vector3),i=n.clone().projectOnPlane(new THREE.Vector3(0,1,0)),o=n.angleTo(i)*Math.sign(-n.y),r=n.clone().setY(0),a=this.player.currentPano.skyboxMesh.rotation,s=new THREE.Vector3(1,0,0).applyEuler(a).setY(0),l=new THREE.Vector3(0,0,1).applyEuler(a).setY(0),c=r.angleTo(s)*Math.sign(r.dot(l));if(this.bufferShader.uniforms.iAngle.value=c,this.bufferShader.uniforms.iPitch.value=o,e)this.pause=!1,this.sceneRenderer.renderer.domElement.style.cursor="none";else{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,t.bufferRenderer.readBuffer.dispose(),t.bufferRenderer.readBuffer=new THREE.WebGLRenderTarget(t.width,t.height,t.bufferRenderer.bufferOptions),t.bufferRenderer.readBuffer.texture=e,t.painting=!0,t.sceneRenderer.renderer.domElement.style.cursor="none",t.pause&&t.cancel(!0)})):(this.bufferRenderer.readBuffer.dispose(),this.bufferRenderer.readBuffer=new THREE.WebGLRenderTarget(this.width,this.height,this.bufferRenderer.bufferOptions),this.painting=!0,this.sceneRenderer.renderer.domElement.style.cursor="none",this.pause&&this.cancel(!0)),this.hasEdit=!1,this.player.locked=!0;var u=zn.load(this.app.resource.getViewImagesURL("pan/low/".concat(this.player.currentPano.id,".jpg")));this.bufferShader.uniforms.iChannel1.value=u}}},{key:"cancel",value:function(e){this.player.reticule.visible=!0,this.player.cameraControls.activeControl.enabled=!0,this.sceneRenderer.renderer.domElement.style.cursor="default",this.setPaintTexture("brushMap",null),e?this.pause=!0:(this.painting=!1,this.hasEdit=!1,this.player.locked=!1,this.setPaintImage(this.currentPaintUrl,this.currentPaintUrl))}},{key:"update",value:function(){this.painting&&!this.pause&&(this.bufferShader.uniforms.iIsBrush.value=1,this.bufferShader.uniforms.iChannel0.value=null,this.brushBufferRenderer.render(this.bufferShader.scene,this.bufferShader.camera),this.bufferShader.uniforms.iIsBrush.value=0,this.bufferShader.uniforms.iChannel0.value=this.bufferRenderer.readBuffer.texture,this.bufferRenderer.render(this.bufferShader.scene,this.bufferShader.camera),this.setPaintTexture("paint0Map",this.bufferRenderer.readBuffer.texture),this.setPaintTexture("paint1Map",this.bufferRenderer.readBuffer.texture),this.setPaintTexture("brushMap",this.brushBufferRenderer.readBuffer.texture))}},{key:"changeBrush",value:function(e){-1==parseInt(e)?this.cancel(!0):(this.start(!0),this.bufferShader.uniforms.iBrushType.value=parseInt(e))}},{key:"setBrushSize",value:function(e){this.bufferShader.uniforms.iBrushSize.value=parseFloat(e)}},{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:"updatePanoPaint",value:function(e,t){if(this.paintData){var n=this.paintData.find((function(t){return t.panoId==e})),i=n&&(n.data||this.app.resource.getUserResourceURL(n.fileName)),o=this.paintData.find((function(e){return e.panoId==t})),r=o&&(o.data||this.app.resource.getUserResourceURL(o.fileName));this.currentPaintUrl=null!=t?r:i,this.setPaintImage(i,r)}}},{key:"setPaintImage",value:function(e,t){var n=this;e?zn.loadWithoutUpdate(e,(function(e){return n.setPaintTexture("paint0Map",e)})):this.setPaintTexture("paint0Map",null),t?zn.loadWithoutUpdate(t,(function(e){return n.setPaintTexture("paint1Map",e)})):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}))}},{key:"dealPointerDown",value:function(){this.hasEdit=!0,this.player.cameraControls.activeControl.enabled=!!this.pause,this.mousePosition.setZ(1)}},{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)}}]),e}(),Ya=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:jt.model.fragmentBufferShader,vertexShader:jt.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)},$a=function(){function e(t,n){o(this,e),this.renderer=t,this.width=n.width,this.height=n.height,this.bufferArray=new Float32Array(this.width*this.height*4),this.bufferOptions={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat,type:THREE.FloatType,stencilBuffer:!1},this.readBuffer=new THREE.WebGLRenderTarget(n.width,n.height,this.bufferOptions),this.writeBuffer=this.readBuffer.clone()}return u(e,[{key:"render",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n)this.renderer.render(e,t);else{var i=this.renderer.autoClear;this.renderer.autoClear=!1,this.renderer.setRenderTarget(this.writeBuffer),this.renderer.render(e,t),this.renderer.setRenderTarget(null),this.renderer.autoClear=i}var o=[this.writeBuffer,this.readBuffer];this.readBuffer=o[0],this.writeBuffer=o[1]}},{key:"save",value:function(){this.renderer.readRenderTargetPixels(this.readBuffer,0,0,this.width,this.height,this.bufferArray),this.outputCanvas=document.createElement("canvas"),this.outputCanvas.width=this.width,this.outputCanvas.height=this.height;for(var e=this.outputCanvas.getContext("2d"),t=4*this.width,n=0;n<this.height;n++){for(var i=this.height-1-n,o=e.createImageData(this.width,1),r=i*this.width*4,a=0;a<t;a++)o.data[a]=255*this.bufferArray[r+a];e.putImageData(o,0,n)}return this.base64=this.outputCanvas.toDataURL("image/png"),this.base64}}]),e}();function Xa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("Player",(function(){return function(e){f(n,EventEmitter);var t=Xa(n);function n(){var e,i,r,a,s,l;return o(this,n),(e=t.call(this)).setupCustomProperties=function(e){var t=e||Ue.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)===Ue.DOLLHOUSE||e===Ue.FLOORPLAN},e.is360View=function(e,t){return e===Ue.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(nr,(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(rr,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(Yo,e),this.mode===Ue.PANORAMA&&this.emit($o,{quaternion:this.cameraControls.activeControl.camera.quaternion,mode:Ue.PANORAMA,currentPanoId:this.currentPano?this.currentPano.id:null,type:"rotate"})},e.handleControlInputStart=function(e){this.emit(dr,e)},e.onModeUpdated=function(e,t){this.cameraControls.activateControls(t),this.emit(er,e,t),"transitioning"==t?(e=this.modeTran.split("-")[0])==Ue.PANORAMA&&(this.flyingToTag=this.flyRotate=this.flyingWithRot=!1,this.model.chunks.forEach((function(e){e.visible=!0}))):(t=this.modeTran.split("-")[1],this.isOutsideMode(e)&&this.isOutsideMode(t)||this.model.fadePanoMarkers(),Ue.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(Tr,this.handleControlMove.bind(this)),this.cameraControls.on(Rr,this.handleControlInputStart.bind(this)),this.cameraControls.on(Mr,this.handleControlPinch.bind(this)),this.cameraControls.on(Sr,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.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(Jo,{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=le.average(e.changedTouches,"clientX"),n=le.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),Te.input.longTapThreshold)}},e.onTouchMove=function(e){var t=le.average(e.changedTouches,"clientX"),n=le.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=le.average(e.changedTouches,"clientX"),n=le.average(e.changedTouches,"clientY");this.handleInputEnd.call(this,t,n,!0),this.emit(Jo,{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),Te.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){if(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(Jo,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})):this.onMouseUp(e),this.$app.TagManager.spot3d&&this.$app.TagManager.spot3d.visible){this.cameraControls.activeControl.enabled=!0,this.cameraControls.activeControl.pointerDragOn=!1;var t=this.$app.TagManager;t.updateTagPos=!1,t.editTag?t.editTag.position=t.spot3d.position:t.editTag={position:t.spot3d.position,visiblePanos:t.getVisiblePano(t.spot3d.position),sid:le.getRandomSid(),icon:this.$app.resource.base("images/tag_icon_default.svg")}}},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(Tr,"key")}.bind(this),n=e.which;switch(n){case Fr.F:t(),this.changeFloor(-1);break;case Fr.R:t(),this.changeFloor(1)}if(this.mode===Ue.PANORAMA)switch(n){case Fr.UPARROW:case Fr.W:this.flyLocalDirection(_e.FORWARD.clone());break;case Fr.DOWNARROW:case Fr.S:this.flyLocalDirection(_e.BACK.clone());break;case Fr.A:this.flyLocalDirection(_e.LEFT.clone());break;case Fr.D:this.flyLocalDirection(_e.RIGHT.clone())}if(this.started)switch(n){case Fr.ONE:this.insideMode();break;case Fr.TWO:this.flyToNewMode({mode:Ue.DOLLHOUSE});break;case Fr.THREE:this.flyToNewMode({mode:Ue.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){Te.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(Xo,{zoom:e,type:"zoom"}),Te.zoom.enabled?(e>0?e=1+this.scrollZoomSpeed:e<0&&(e=1-this.scrollZoomSpeed),0!==e&&this.handleScrollPinchZoom(e)):this.$app.config.useShortcutKeys&&this.flyLocalDirection(new THREE.Vector3(0,0,-e).normalize())},e.handleInputStart=function(e,t,n,i){var o,r={x:e,y:t};i||(r=Ie.handelPadding(e,t,this.domElement)),Ie.convertScreenPositionToNDC(r.x,r.y,this.mouse,this.domElement),Ie.convertScreenPositionToNDC(r.x,r.y,this.mouseAtMouseDown,this.domElement),this.mouseCouldBeClickToMove=!0,this.mouseDown=!0;if(this.emit("pointerStart",{consume:function(){o=!0},getConsumed:function(){return o}}),!o){if(this.OverlayManager&&(this.intersect=this.getMouseIntersect(null,this.OverlayManager.group.children.concat(this.model.colliders)),this.intersect&&(this.intersect.object.overlayType||this.intersect.object.parent.overlayType)?this.OverlayManager.hoverOverlay(this.intersect.object):this.OverlayManager.hoverOverlay(null),this.OverlayManager.group.children.forEach((function(e){"video"==e.overlayType&&e.plane.material.map.image.play()}))),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.$app.TagManager.editTag){var a=this.$app.TagManager.spot3d;this.getMouseIntersect(null,[a.topMesh,a.bottomMesh])&&(this.$app.TagManager.updateTagPos=!0,this.cameraControls.activeControl.enabled=!1)}this.aimQuaternion=null}},e.handleInputMove=function(e,t,n){this.isTouchEvent=n;var i,o=Ie.handelPadding(e,t,this.domElement);Ie.convertScreenPositionToNDC(o.x,o.y,this.mouse,this.domElement),this.mouseAtMouseDown.distanceTo(this.mouse)>.01&&(this.mouseCouldBeClickToMove=!1,this.couldBeLongTap=!1,clearTimeout(this.mouseDownTimer),this.model.transformControls&&this.model.transformControls.handleDragging()),this.EditPanoMosaic&&this.EditPanoMosaic.editing&&this.EditPanoMosaic.dealPointerMove(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerMove(o);if(this.emit("pointerMove",{consume:function(){i=!0},getConsumed:function(){return i}}),!i&&(this.mouseLastMoveTime=Date.now(),this.reticule.move(e,t,n),this.$app.TagManager.updateTagPos)){var r=this.getMouseIntersect(null,this.OverlayManager.group.children.concat(this.model.colliders)),a=this.$app.TagManager.spot3d;r?(a.visible=!0,a.lookAt(r.normal.add(r.point)),a.topMesh.lookAt(this.camera.position),a.topMesh.scale.copy(new THREE.Vector3(1,1,1).multiplyScalar(this.camera.position.distanceTo(a.position)/3)),a.position.copy(r.point)):a.visible=!1}},e.handleInputEnd=function(e,t,n){var i,o=this;if(this.isTouchEvent=n,this.mouseDown=!1,this.cameraControls.controls[Ue.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
  3. if(this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),this.linkEditor&&this.linkEditor.setPanoVisible){var r=[].concat(L(this.linkEditor.actionIcons),L(this.linkEditor.footIcons)).filter((function(e){return e.pano.floorIndex==o.model.currentFloor.floorIndex}));if(this.intersect=this.getMouseIntersect(null,r.concat(this.measureRulers.map((function(e){return e.boldLine})))),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.map((function(e){return e.boldLine})));if(c&&c.object.parentRuler)return void c.object.parentRuler.showOptionLabel(!0,c.point);if(this.OverlayManager.hoveringPlane)return void this.OverlayManager.clickOverlay(this.OverlayManager.hoveringPlane);if(this.intersect&&this.EditOverlay&&this.EditOverlay.isAdding)return this.EditOverlay.addOverlay({intersect:this.intersect});if(this.emit("click",{intersect:this.intersect,consume:function(){l=!0},getConsumed:function(){return l}}),l)return;if(this.currentPano&&this.is360View(this.mode,this.currentPano))return;if(this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Tr,this.isTouchEvent?"touch":"mouse"),this.history.invalidate(),this.intersect)return this.flyToPanoClosestToMouse();if(this.mode===Ue.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!==Ue.PANORAMA))return this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Dr,"touch"),!0},e.start=function(e){var t=this,n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.tag,s=e.quickstart,l=Ge();this.updateModelDependentData(),this.updateFromControls();var c=this.is360View(n,i);return!this.model.outsideAllowed()||c||s?this.startInside(i,o,r,a,l):(this.startOutside(e,l),this.once(ar,(function(e){t.emit(sr,c,e,a),t.started=!0}))),this.compass=new Fa(this),this.linkEditor=new ca(this),this.labelManager=new xa(this),l},e.startOutside=function(e,t){var n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.zoom,s=e.floorVisibility,l=e.tag;this.emit(cr,Te[n].transitionTime),this.isOutsideMode(n)?(this.model.warpDestFloors(s,!0),pe.cancelById(Te.freeze.FlyToViewFloor),n===Ue.FLOORPLAN?this.floorplanMode(o,r,a):this.dollhouseMode(o,r),t.resolve(!1)):this.startInsideWithFlyin(i,o,r,l,t),this.beforeChangeMode(null,n)},e.startInside=function(e,t,n,i,o){o=o||Ge(),this.currentPano=e;var r=e&&!e.isAligned();if(t=r?e.position:t||e.position,n=n||e.quaternion,e){var a=this.startInside.bind(this,e,t,n,i,o);if(this.checkAndWaitForPanoLoad(e,"high","low",this.basePanoSize,a))return}this.modeTran="panorama-panorama",this.beforeChangeMode(null,Ue.PANORAMA,this.currentPano,0),this.afterChangeMode(null,Ue.PANORAMA),e.enter(),this.mode=Ue.PANORAMA,e.floor.enter(this.mode),this.emit(nr,this.currentPano,this.currentPano),this.switchCameraMode(this.mode,n),this.emit(lr,r);var s=this.$app.core.get("PanoVideoRenderer");return s.setMuted(!0),s.activatePanorama(this.currentPano),o.resolve(!0),o},e.startInsideWithFlyin=function(e,t,n,i,o){if(o=o||Ge(),this.dollhouseMode(),!e)return Le.warn("Player.startInsideWithFlyin() -> targetPano is invalid."),o.resolve(!1),o;t=t||e.position;var r=n||this.cameraControls.activeControl.camera.quaternion,a=e.position;return this.fitDollhouse(a,t,r),setTimeout(function(t){this.cameraControls.activeControl&&(this.cameraControls.activeControl.maxDistance=t);var i={mode:Ue.PANORAMA,pano:e,quaternion:n,callback:function(){this.emit(or),o.resolve(!0)}.bind(this)};this.flyToNewMode(i)}.bind(this,this.cameraControls.activeControl.maxDistance),Te.startupFlyinDelay),o},e.checkAndWaitForPanoLoad=(i={},r={},a={},function(e,t,n,o,s,l,c,u,h,d){if(function(e){if(i.hasOwnProperty(e.id)&&i[e.id]&&performance.now()-r[e.id]<5e3)return!0}(e))return e.id,a[e.id]=s,!0;var p=function(t,n,o){le.delayOneFrame(function(){i[t]=!1,e.id,a[e.id]&&a[e.id](n,o),a[e.id]=null}.bind(this))}.bind(this,e.id),f=function(e,t){le.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(),e.id,a[e.id]=s),i[e.id]}catch(t){throw i[e.id]=!1,r[e.id]=performance.now()-5e3,t}}),e.checkAndWaitForWholePanoLoad=function(e,t,n,i,o){if(!e)throw new BasicException("Player.checkAndWaitForWholePanoLoad() -> Cannot load texture for null pano.");return o&&this.model.waitForLoad(e,(function(){return e.isLoaded(n)})),!e.isLoaded(t)&&(e.loadCube(t).done(i),!0)},e.checkAndWaitForTiledPanoLoad=(s=new THREE.Vector3,function(e,t,n,i,o,r,a,l){if(!e)throw new BasicException("Player.checkAndWaitForTiledPanoLoad() -> Cannot load texture for null pano.");if(s.copy(_e.FORWARD),this.getDirection(s),!e.isLoaded(t))return r&&this.model.waitForLoad(e,(function(){return e.isLoaded(t)})),e.loadTiledPano(t,s,null,a,l).done(function(e,t){n&&n(e,t)}.bind(this)).fail(function(e){i&&i(e)}.bind(this)).progress(function(e,t,n){o&&o(e,t,n)}.bind(this)),!0}),e.switchCameraMode=function(e,t,n,i,o){var r,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=this.cameraControls.controls[e],l=s.camera;if(e==Ue.PANORAMA)l.position.copy(this.currentPano.position),r=t?_e.FORWARD.clone().applyQuaternion(t):this.getDirection().setY(0).normalize(),s.lookAt(r.add(l.position));else if(n&&s.target.copy(n),i&&l.position.copy(i),e==Ue.DOLLHOUSE){if(!i&&!n){if(a.dontFitScreen&&this.mode===Ue.PANORAMA)i=this.position.clone(),this.mode===Ue.PANORAMA?i.add(new THREE.Vector3(0,6,0)).add(this.getDirection().multiplyScalar(-10)):i.add(_e.DOWN.clone().applyQuaternion(this.quaternion).multiplyScalar(6)).setY(6);else{var c;this.mode===Ue.PANORAMA?(s.target.copy(this.model.center),c=this.getDirection().negate().setY(1).normalize()):(s.target.copy(this.target.clone().setY(this.model.center.y)),c=_e.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 e==Ue.FLOORPLAN&&(n||s.target.copy(this.model.center).setY(0),i||(l.position.copy(this.model.center).setY(Te.floorplan.cameraHeight),s.rotateToView(this.model.size,this.getDirection())),o?s.currentScale=s.absoluteScale=o:s.zoomToContain(this.model.size));s.update(0)},e.update=function(){var e={};return function(t){var n=this;if(this.updatePersistentZooming(t),this.updateFromControls(t),this.hasChanged(e)&&(this.lastChangeTime=Date.now(),!this.mouseDown&&this.containsMouse&&this.updateIntersect(),this.emit(ur)),this.OverlayManager&&this.OverlayManager.group.children.forEach((function(e){if(e.box){var t=new THREE.Vector3(0,0,1).applyQuaternion(e.quaternion),i=t.clone().multiplyScalar(e.depth).add(e.position);e.box.visible=t.dot(i.sub(n.camera.position))<0}})),this.linkEditor&&(this.linkEditor.setTagVisible||this.linkEditor.setPanoVisible)&&this.linkEditor.updateFootIconSize(),this.compass&&this.compass.update(this.quaternion),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.update(),this.dollLabels.concat(this.planLabels).concat(this.doorLabels).forEach((function(e){e.update()})),this.updateLabelZIndex(["dollLabels","doorLabels"]),Ea.updateCameraDir(this),"panorama"==this.mode&&this.measureRulers.forEach((function(e){e.update()})),this.chosenMeasureRuler&&this.chosenMeasureRuler.updateOptionPos(),e.cameraChanged2&&this.model.floorLogos.updateFloorlogo(this.camera&&this.camera.quaternion,this),this.model.supportsTiles){var i=this.panosTaskList.length>1?this.panosTaskList.map((function(e){return e.pano})):[];this.updateTileDownloader(i),this.updatePanoRenderer()}this.reticule.update(),this.cachedPanoCandidates&&Te.navigation.panoScores&&this.model.panos.showPanoScores(this.cachedPanoCandidates),this.updateControlLocks(),this.model.supportsTiles&&this.updateZoomPano(),this.emit("update",{x:this.position.x,y:this.position.z,lon:this.cameraControls.controls.panorama.lon,hasChanged:e,mode:this.mode})}}(),e.updateLabelZIndex=function(e){var t=this;e.forEach((function(e){"dollLabels"==e&&"dollhouse"!=t.mode||"doorLabels"==e&&"panorama"!=t.mode||t[e].sort((function(e,t){return t.pos2d.z-e.pos2d.z})).forEach((function(e,t){e.elem.style.zIndex=t}))}))},e.updatePersistentZooming=function(e){1===this.zooming?this.zoomBy(1+this.zoomSpeed*e):-1===this.zooming&&this.zoomBy(1-this.zoomSpeed*e)},e.updateControlLocks=function(){this.currentPano&&this.model.supportsTiles&&(this.cameraControls.controls[Ue.PANORAMA].locked=Te.vrEnabled||!this.currentPano.highestFullTileRenderOpCompleted&&this.currentPano.lockUntilRenderingComplete)},e.updatePanoRenderer=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;this.$app.core.get("PanoRenderer").hasQueuedTiles()&&n&&(e.copy(_e.FORWARD),this.getDirection(e),this.$app.core.get("PanoRenderer").updateDirection(e))}}(),e.updatePreRendering=function(){var e={};return function(t){if(1===Te.tiling.preRenderTourPanos&&this.preRenderingEnabled){var n=this.nextPano||this.currentPano;if(n&&t&&t.length>1){var i=t.findIndex((function(e){if(e.id===n.id)return!0}));if(i>=0&&i+1<t.length){var o=t[i+1];o.isLoaded(this.basePanoSize)||e[o.id]||(window.setTimeout(function(t){this.checkAndWaitForPanoLoad(t,"high","low",this.basePanoSize,null,null,null,!1,!1,!1),window.setTimeout(function(t){e[t.id]=!1}.bind(this,t),Te.tiling.panoPreRenderRepeatDelay)}.bind(this,o),Te.tiling.panoPreRenderDelay),e[o.id]=!0)}}}}}(),e.enablePreRendering=function(){this.preRenderingEnabled=!0},e.updateTileDownloader=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;n&&(e.copy(_e.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.flying,t=this.isOutsideMode()&&this.cameraControls.controls[this.mode].isEngaged(),n=pe.getById(Te.freeze.LookTransition);if(e||t||this.isTouchEvent||n.length&&n[0].running,this.linkEditor&&(this.linkEditor.setPanoVisible||this.linkEditor.setTagVisible))return this.intersect=this.getMouseIntersect(null,this.linkEditor.footIcons),void(this.intersect&&this.intersect.object.visible?ea.add("hoverFootMarker"):ea.remove("hoverFootMarker"));var i,o=function(){i=!0},r=function(){return i},a=[];if(this.emit("collectIntersectMesh",a,{consume:o,getConsumed:r}),!i){var s=this.panoMarkers.filter((function(e){return e.visible&&e.material.opacity>0})),l=this.model.panos.list.filter((function(e){return e.flagSpot})).map((function(e){return e.flagSpot.disc}));this.intersect=this.getMouseIntersect(null,s.concat(l)),(this.intersect||(a.push.apply(a,L(this.getColliders())),this.intersect=this.getMouseIntersect(null,a),this.emit("judgeIntersect",this.intersect,{consume:o,getConsumed:r}),!i))&&(this.intersect&&this.updateClosestPano(this.intersect),this.closestPano||this.closestPanoInDirection(this.getMouseDirection())?(this.reticule.updatePosition(this.position,this.intersect),Te.navigation.panoScores&&!Te.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)||(e=this.model.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),[]),this.mode===Ue.PANORAMA&&e.push(this.model.skybox)),e},e.getMouseIntersect=function(e,t,n){e=e||this.mouse.clone(),t||(t=this.getColliders());var i=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);this.raycaster.set(i,this.getMouseDirection(e));var o=this.raycaster.intersectObjects(t);if(0===o.length)return null;if("getAll"==n)return o;var r=o[0];r.face&&(r.normal=r.face.normal.applyQuaternion(r.object.quaternion),this.position.clone().sub(r.point).dot(r.normal)<0&&r.normal.negate(),this.currentPano?r.onFloor=r.point.y<this.position.y-.5*this.currentPano.height:r.onFloor=r.point.y<this.position.y-.5,r.horizontal=r.normal.y>.8);return r},e.updateClosestPano=function(e){var t=this;if(this.mode!==Ue.TRANSITIONING){var n,i=[];if(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===Ue.PANORAMA){if(!this.currentPano)return;i.push(bi.filters.not(this.currentPano)),i.push(bi.filters.inFloorDirection(this.currentPano.floorPosition,this.getDirection(),.25)),i.push(bi.filters.isNeighbourPanoTo(this.currentPano)),i.push(bi.filters.isCloseEnoughTo(e.point,Te.panoFloorClickRadius)),i.push(bi.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(bi.filters.isOnVisibleFloor()),this.mode!==Ue.FLOORPLAN&&i.push(bi.filters.inDirection(this.position,this.getDirection(),.25));n=this.model.panos.find(i,[bi.sortFunctions.floorDistanceToPoint(e.point)])}n!==this.closestPano?(n&&(this.isPanoHover=!0),this.emit(ir,this.closestPano,n,this.mode),this.closestPano=n):this.isPanoHover=!1}},e.dollhouseMode=function(e,t){this.modeTran="dollhouse-panorama",this.emit(tr,this.mode,Ue.DOLLHOUSE),this.mode=Ue.DOLLHOUSE,this.cameraControls.controls[Ue.DOLLHOUSE].reset();var n=new THREE.Vector3(this.model.center.x,0,this.model.center.z),i=new THREE.Vector3(15,10,15);if(e&&t){var o=_e.FORWARD.clone().applyQuaternion(t),r=(e=this.model.center.clone().sub(e)).dot(o);r>0?n=o.clone().multiplyScalar(r).add(e):Le.warn("Tried to initiate dollhouse mode that wasn'quaternion looking at the model",e,t)}this.cameraControls.controls[Ue.DOLLHOUSE].resetRanges(0,!0),this.cameraControls.controls[Ue.DOLLHOUSE].target.copy(n),this.cameraControls.cameras[Ue.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=Ge(),i=t||null;if(this.mode!==Ue.PANORAMA&&this.mode!==Ue.TRANSITIONING){var o=[];this.model.currentFloor&&o.push(bi.filters.atFloor(this.model.currentFloor)),e=e||this.currentPano||this.model.panos.find(o,[bi.sortFunctions.distanceToPoint(this.cameraControls.activeControl.target)]),this.flyToNewMode({mode:Ue.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===Ue.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,o=_e.FORWARD.clone().applyQuaternion(n);n=o.clone().add(e),this.cameraControls.activeControl.target.copy(n),this.cameraControls.activeControl.camera.position.set(0,2.4*i,0).add(e).add(o.multiplyScalar(-10))},e.floorplanMode=function(e,t,n){this.mode=Ue.FLOORPLAN;var i=this.cameraControls.controls[Ue.FLOORPLAN];i.reset();var o=e||this.model.center;if(i.target.copy(o).setY(0),i.camera.position.copy(o).setY(Te.floorplan.cameraHeight),n?(i.currentScale=n/(window.innerWidth/window.innerHeight),i.absoluteScale=i.currentScale):i.zoomToContain(this.model.size),t){var r=_e.LEFT.clone().applyQuaternion(t);i.rotateLeft(-Math.atan2(r.x,r.z))}else i.rotateToView(this.model.size,this.getDirection());i.update(0)},e.getAimToNextPano=function(e,t,n){var i;if(!t&&!n){var o={importance:0,aim:null};this.emit("ifFocusPoint",o),o.aim&&o.importance>=3&&(t=o.aim)}if(!t)if(e.panoVideo)i=!0,t=e.position.clone().add(e.panoVideo.dir);else if(i=!t&&e.hasVideo&&this.$app.core.get("PanoVideoRenderer")&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(e.videoInfo.dir)t=e.position.clone().add(e.videoInfo.dir);else{var r=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180));t=_e.FORWARD.clone().applyQuaternion(r.multiply(e.quaternion)).add(e.position)}return{aimQua:n=t?De.getQuaByAim(t,e.position):n,hasVideo:i}},e.flyToPano=function(e,t){var n=this;if(!this.locked){var i=e.pano,o=e.lookAtPoint,r=e.quaternion,a=e.duration,s=e.aimDuration,l=e.rotSpeed,c=e.maxDistanceOverride;e.skipWarpingCheck;var u=e.easeType,h=null,d=null,p=e.zoomLevel||(Te.zoom.zoomToDefaultWhenToPano?1:this.zoomLevel),f=e.cancelLookFun;if(!this.EditPanoMosaic||!this.EditPanoMosaic.editVideo||this.EditPanoMosaic.editVideo.pano==i){var m=this.getAimToNextPano(i,o,r);r=m.aimQua;if(m.hasVideo,e.quaternion=r,this.mode===Ue.PANORAMA){var v=this.is360View(this.mode,i)||this.is360View(this.mode,this.currentPano);if(this.judgePanoTask(e,v)&&(i&&(h=le.deepExtend(e),d=function(){le.delayOneFrame(function(){this.panosTaskList[0]==h&&(h.retry=!0,this.flyToPano(h,t))}.bind(this))}.bind(this)),!i||!this.checkAndWaitForPanoLoad(i,"high","low",this.basePanoSize,d))){var g=e.finalCallback=function(n){this.nextPanoTask(e,n),t&&t()}.bind(this);this.currentPano||(this.currentPano=i);var y=a;if("number"!=typeof a){var w=c||Te.transition.flytimeMaxDistanceThreshold,b=Math.min(this.currentPano.position.distanceTo(i.position),w);y=e.flySpeed&&"constant"==u?b/e.flySpeed:b*Te.transition.flytimeDistanceMultiplier+Te.transition.flyTime}if(e.duration=y,e.pano.id,this.panosTaskList.map((function(e){return e.pano.id})),this.zoomLevel!==p)switch(Te.zoom.transitionStyle){case 1:this.smoothZoomLevelTo(p,y/2);break;case 2:return h=le.deepExtend(e),d=this.flyToPano.bind(this,h,t),void this.smoothZoomLevelTo(p,Te.zoom.restoreTime*(this.zoomLevel-p),d)}if(r){var E=this.cameraControls.activeControl.camera.quaternion.clone(),x=E.clone(),T=new THREE.Vector3;if(pe.cancelById(Te.freeze.LookTransition),i===this.currentPano){var P=_e.FORWARD.clone().applyQuaternion(E),k=_e.FORWARD.clone().applyQuaternion(r),R=P.angleTo(k);return this.flyRotate=!0,null!=s||(s=1*Math.sqrt(R)/(l||Te.tags.navigate.rotateSpeedFactor)*1e3),void pe.start(function(e){if(this.mode!=Ue.PANORAMA)return pe.cancelById(Te.freeze.LookTransition),void g(!0);x.copy(E),ut.quaternion(x,r)(e),T.copy(De.getAimByQua(x,this.cameraControls.activeControl.camera.position)),this.cameraControls.activeControl.lookAt(T)}.bind(this),s,g.bind(this,!0),0,de[Te.transition.movementEasing],null,Te.freeze.LookTransition,f)}}if(i===this.currentPano||this.flying)return this.currentPano,this.flying,void g();this.flying=!0,this.position.clone();var M=this.currentPano;if(this.nextPano=i,Le.debug("Flying to pano ",i.position),this.emit(nr,this.currentPano,i),this.emit(rr,{panoId:i.id,quaternion:r,lastPanoId:M.id,type:"flyToPano"}),this.model.currentFloor=i.floor,this.doorLabels.forEach((function(e){return e.updateVisible(i)})),v)return void this.fade360View(this.cameraControls.activeControl.camera,{pano:i,aim:o,aimQua:r},(function(){n.afterFlyToPano(e)}));this.model.floorLogos.changefloorLogoOpa({index:0,opa:0,dur:y,delay:.7}),this.model.floorLogos.secondLogo.position.copy(i.floorPosition.clone().sub(this.model.position)),this.model.floorLogos.secondLogo.visible=!0,this.model.floorLogos.changefloorLogoOpa({index:1,opa:1,dur:250}),r&&!v&&(this.flyingWithRot=!0,pe.start((function(e){if(n.mode!=Ue.PANORAMA)return pe.cancelById(Te.freeze.LookTransition),void g();x.copy(E),ut.quaternion(x,r)(e),T.copy(De.getAimByQua(x,n.cameraControls.activeControl.camera.position)),n.cameraControls.activeControl.lookAt(T)}),y,null,0,de[Te.transition.movementEasing],null,Te.freeze.LookTransition,f)),e.chunkProgress=this.judgeHideWall(i),this.startTransition(e)}}else this.flyToNewMode({mode:Ue.PANORAMA,pano:i,duration:a,quaternion:r,callback:t})}}},e.startTransition=function(e){var t=this;this.model.fadePanoMarkers(0,0,{hideVideoFlag:!0});var n="constant"==e.easeType?null:"easeOut"==e.easeType?de.easeOutQuad:de[Te.transition.movementEasing],i=e.progress||0,o=this.$app.resource.num+Te.freeze.FlyToPano;pe.cancelById(o,!0),e.pano.id,"constant"==e.easeType||e.easeType,e.duration,e.progress;var r=this.currentPano.position.distanceTo(e.pano.position);pe.start((function(n,a){var s=pe.getById(o)[0],l=i+n*(1-i),c=e.currentSpeed=(l-e.progress)*r/a;if(n>0&&n<1&&a){var u=function(e,t){var n=.06;Math.abs(e-1)>n&&(e=e>1?1.06:.94),pe.adjustSpeed(o,e)};if("constant"==e.easeType)c>0&&!Ie.closeTo(c,e.flySpeed)&&e.flySpeed&&(e.flySpeed,u(e.flySpeed/c));else if("easeOut"==e.easeType){l>.05&&l<.8&&s.duration>1500&&u(1+.05*l)}}t.model.skybox.material.uniforms.progress.value=l;var h=t.currentPano.position.clone(),d=e.pano.position.clone();if(ut.vector(h,d)(l),t.cameraControls.cameras[Ue.PANORAMA].position.copy(h),e.progress=l,e.chunkProgress&&t.model.chunks.forEach((function(e){return e.material.uniforms.progress.value=l})),l>.5&&t.panosTaskList.length>1&&t.checkAndWaitForPanoLoad(t.panosTaskList[1].pano,"high","low",t.basePanoSize,(function(){})),l>.5&&e.byKey&&1==e.flyCount&&"constant"==e.easeType&&1==t.panosTaskList.length){e.easeType="easeOut";var p=(1-l)*r;e.duration=2*p/Te.transition.flySpeed,t.startTransition(e)}}),e.duration,this.afterFlyToPano.bind(this,e),0,n,"chunkFly",o),e.flyCount++},e.nextPanoTask=function(e,t){e==this.panosTaskList[0]&&this.panosTaskList.splice(0,1),t&&this.panosTaskList.length&&(this.panosTaskList[0].dealingTask=!0,this.panosTaskList[0].pano.id,this.flyToPano(this.panosTaskList[0]))},e.judgePanoTask=function(e,t){e.progress=e.progress||0,e.flyCount=0;var n=this.panosTaskList.length,i=this.panosTaskList[n-1];if(!e.retry&&!e.dealingTask){var o=this.panosTaskList[0];if((e.quaternion||t)&&(e.canConstantlyWalk=!1),i&&i.pano.tileError&&(this.panosTaskList=[],n=0,i=void 0),0!=n&&!i.canConstantlyWalk&&e.pano!=this.currentPano)return;if(n>0){if(this.panosTaskList.some((function(t){return t.pano==e.pano&&(!t.lookAtPoint&&!e.lookAtPoint||t.lookAtPoint.equals(e.lookAtPoint))})))return;if(n>2)return;if("constant"!=o.easeType&&0==o.flyCount)return}if(this.panosTaskList.push(e),n++,e.pano.id,n>1){if(e.byKey)e.easeType="constant",e.flySpeed=Te.transition.flySpeed;else{var r=e.pano.position.distanceTo(i.pano.position);e.easeType="easeOut",e.duration=2*r/Te.transition.flySpeed}if("constant"!=o.easeType){var a=this.currentPano.position.distanceTo(o.pano.position),s=(1-o.progress)*a/(o.currentSpeed||Te.transition.flySpeed);o.easeType="constant",o.flySpeed=Te.transition.flySpeed,o.duration=s,this.startTransition(o)}return void("constant"!=i.easeType&&(i.easeType="constant",i.flySpeed=Te.transition.flySpeed,i.duration=null))}}return!0},e.judgeHideWall=function(e){if(this.currentPano.noBlocks.includes(e.id));else if(this.currentPano.blocks[e.id])this.hideWalls=this.currentPano.blocks[e.id],this.hideWalls.forEach((function(e){e.visible=!1}));else{var t=this.currentPano.origin.clone(),n=e.origin.clone(),i=n.clone().sub(t).normalize().multiplyScalar(.1),o=t.clone().sub(i),r=n.clone().add(i),a=De.ifIntersectChunks(o,r,this.model,{throughWidth:.08,meshes:this.model.chunks});a?(this.hideWalls=a.map((function(e){return e.object.visible=!1,e.object})),this.currentPano.blocks[e.id]=this.hideWalls.slice(0)):this.currentPano.noBlocks.push(e.id)}return!0},e.afterFlyToPano=function(e){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==Ue.PANORAMA&&(this.path.fadeOutCpm(Te.path.fadeOutTime),this.paintEditor&&this.paintEditor.updatePanoPaint(this.currentPano.id,this.currentPano.id))),this.mode==Ue.PANORAMA&&(this.flying=!1,this.emit(ar,{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.material.uniforms.progress&&(e.material.uniforms.progress.value=1),e.visible=!0})),this.model.fadePanoMarkers(),this.doorLabels.forEach((function(e){return e.updateVisible()})),e.finalCallback&&e.finalCallback(!0)},e.fastToPano=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.flying&&!this.isWarping()){var n=t.pano||this.model.panos.index[t.panoId];if(!n)return console.error("fastToPano pano 无");this.position.clone();var i=this.currentPano,o=t.duration||1500;this.path.warpDestPano=n;var r=function(){e.waitingToWarp=!1,e.fastToPano(t)};this.checkAndWaitForPanoLoad(n,"high","low",this.basePanoSize,r)?this.waitingToWarp=!0:(this.emit("pano.chosen",i,n),this.emit(rr,{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()},this.path.warpTravel_BLACK(null,o,1,(function(){t.finalCallback=t.callback,e.afterFlyToPano(t)})))}},e.fade360View=function(e,t,n){var i=this,o=t.transitionTime||600;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(ut.property(this.domElement.style,"opacity",0),o,(function(){i.model.skybox.material.uniforms.opacity.value=null!=t.skyboxOpacity?t.skyboxOpacity:1,i.model.alpha=null!=t.modelAlpha?t.modelAlpha:0,t.pano&&(e.position.copy(t.pano.position),e.quaternion.copy(t.pano.quaternion));var r=!(!t.pano||!t.pano.view),a=!!(i.is360View(i.mode,i.currentPano)&&!t.flyIn||t.flyOut);if(r){t.pano.view.exitDoor.mesh.visible=!0,i.viewLinkManager.updateCirclesWhenFade("enter",t),t.pano.view.balloon.showOrHide(!1),t.pano.view.entering=!1;var s=t.aim||new THREE.Vector3(0,0,-1).applyQuaternion(t.pano.view.enterQuaternion||t.pano.quaternion).add(e.position);i.cameraControls.controls.panorama.lookAt(s),i.cameraControls.controls.panorama.update(0),i.OverlayManager.group.visible=!1}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)}i.currentPano.view.balloon.visible=!1,setTimeout((function(){i.currentPano.view.balloon.visible=!0}),500)}r||i.viewLinkManager.updateCirclesWhenFade("leave",t),!t.aim||t.flyIn||t.flyOut||(i.cameraControls.controls.panorama.lookAt(t.aim),i.cameraControls.controls.panorama.update(0)),i.OverlayManager.group.visible=!0}t.pano&&(i.emit(nr,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(ut.property(i.domElement.style,"opacity",1),o,(function(){i.enteringView=null,n&&n(),i.reticule.hide()}),0,null,null,"fade360")}),0,null,null,"fade360")},e.flyToPanoClosestToMouse=function(){if(Date.now()-this.mouseLastMoveTime>50&&this.updateIntersect(),this.closestPano)return this.flyToPano({pano:this.closestPano});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<.45)){var t=this.getDirection(e),n=1===e.z?.4:.75,i=1===Math.abs(e.x);return this.flyDirection(t,n,i,!0)}},e.flyDirection=function(e,t,n,i){if(!this.locked){var o=Ge();this.history.invalidate();var r=this.closestPanoInDirection(e,t,n);return r?this.flyToPano({pano:r,canConstantlyWalk:this.canConstantlyWalk,byKey:i},o.resolve.bind(o,!0)):0==this.panosTaskList.length&&(this.bump(e),o.resolve(!1)),o.promise()}},e.closestPanoInDirection=function(e,t,n){return this.rankedPanoInDirection(0,e,t,n)},e.rankedPanoInDirection=(l={pano:null,candidates:[]},function(e,t,n,i){e||(e=0),n=void 0!==n?n:.75;var o=i?"angle":"direction",r=this.panosTaskList.length?this.panosTaskList[this.panosTaskList.length-1].pano:this.currentPano,a=[bi.filters.isPanoAligned(),bi.filters.inPanoDirection(r.position,t,n),bi.filters.isNeighbourPanoTo(r),bi.filters.not(r)],s=[bi.scoreFunctions.distanceSquared(r),bi.scoreFunctions[o](r.position,t)];return this.model.panos.findRankedByScore(e,a,s,l),this.cachedPanoCandidates=l.candidates,l.pano}),e.bump=function(e){var t=this;if(this.mode===Ue.PANORAMA&&!this.flying&&!this.isWarping()){var n,i,o,r=Te.transition,a=(r.flytimeMaxDistanceThreshold*r.flytimeDistanceMultiplier+r.flyTime)/10,s=this.camera.getWorldDirection(new THREE.Vector3).dot(e);if(Math.abs(s)>.5)n=function(){pe.start(ut.property(this.cameraControls.cameras[Ue.PANORAMA],"zoom",s>0?1.04:.96),a,i,0,de.easeInOutSine,"bumpZStart")}.bind(this),i=function(){pe.start(ut.property(this.cameraControls.cameras[Ue.PANORAMA],"zoom",1),3*a,o,0,de.easeInOutSine,"bumpZRelax")}.bind(this);else{var l=this.camera.position.clone(),c=e.clone();this.raycaster.set(l,c);var u=this.model.floors.reduce((function(e,t){return e.concat(t.collider.children)}),[]),h=this.raycaster.intersectObjects(u),d=h.length>0?h[0].distance/25:.04,p=l.clone().add(c.multiplyScalar(d));n=function(){pe.start(ut.vector(this.cameraControls.cameras[Ue.PANORAMA].position,p),a,i,0,de.easeInOutSine,"bumpTStart")}.bind(this),i=function(){pe.start(ut.vector(this.cameraControls.cameras[Ue.PANORAMA].position,l),5*a,o,0,de.easeInOutSine,"bumpTRelax")}.bind(this)}o=function(){"panorama"==t.mode&&(t.flying=!1,t.emit(ar,{targetPano:t.currentPano,currentPano:t.currentPano}))},this.flying=!0,n()}},e.changeFloor=function(e){if(!this.is360View(this.mode,this.currentPano))if(this.mode===Ue.PANORAMA){var t=this.history.reversePano(e);t?this.flyToPano({pano:t}):this.changeFloorByScore(e)}else this.model.setFloor(this.model.nextFloor(e)||this.model.currentFloor)},e.changeFloorByScore=function(){var e={pano:null,candidates:[]};return function(t){var n=this.model.nextFloor(t);return n?(this.model.panos.lowestByScore([bi.filters.atFloor(n),bi.filters.isPanoAligned()],[bi.scoreFunctions.distance(this.currentPano),bi.scoreFunctions.direction(this.position,new THREE.Vector3(0,t,0)),bi.scoreFunctions.penalizeHeightDifferenceUnder(this.position,.5)],e),void(e.pano?(this.cachedPanoCandidates=e.candidates,this.history.push(t,this.currentPano),this.flyToPano({pano:e.pano})):Le.warn("No pano found on selected floor, not moving there."))):void Le.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(_e.FORWARD)).applyQuaternion(this.camera.quaternion)},e.flyToNewMode=function(e,t){var n=this,i=(e=e||{}).mode,o=e.pano,r=e.duration;e.warpDest;var a=e.callback;e.force;var s=e.quaternion,l=e.target,c=e.position,u=e.currentScale;if(t=t||Ge(),this.isWarping())return Le.warn("Player.flyToNewMode() -> Cannot fly when warping"),a&&a(!1),t.reject("Cannot change mode during tour transition");if(this.mode===Ue.TRANSITIONING)return a&&a(!1),t.reject("Cannot change mode during mode transition");if(i===this.mode)return a&&a(!1),t.resolve(),t;Le.debug("Switching mode to "+i);var h=function(){le.delayOneFrame(function(){this.flyToNewMode(e,t)}.bind(this))}.bind(this);if(o&&this.checkAndWaitForPanoLoad(o,"low","low",this.basePanoSize,h))return t.promise();if(!this.model.meshTexturesLoaded&&this.isOutsideMode(i))return Le.info("Waiting for model textures to be loaded before going out to dollhouse"),this.model.waitForLoad(this.model,function(){return this.model.meshTexturesLoaded}.bind(this)),this.model.loadMeshTextures().done(h),h(),t.promise();this.history.invalidate();var d=this.mode,p=this.cameraControls.cameras[i],f=le.deepExtend({},Te[i],Te[d+"-"+i]);this.modeTran=this.mode+"-"+i;var m=f.transitionTime;void 0!==r&&(m=r),this.emit(tr,d,i,o,m),o&&(this.currentPano=o),this.switchCameraMode(i,s,l,c,u),pe.cancelById(Te.freeze.LookTransition);var v=(new THREE.Vector3).copy(this.position);i===Ue.PANORAMA?(this.emit(nr,o,o),setTimeout(function(){o.floor.enter(i)}.bind(this),m/2),this.path.fadeOutCpm(Te.path.fadeOutTime)):(this.path.placeCpm(),this.path.fadeInCpm(Te.path.fadeInTime),i===Ue.FLOORPLAN&&this.model.currentFloor.enter(i));var g=this.currentPano,y=this.position.clone();return this.emit(rr,{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:g&&g.id,type:"flyToNewMode"}),this.flying=!0,this.isOutsideMode(i)&&this.is360View(d,g)?(f.blackoutStyle=Fe,m=Te.show360Views.transitionTime,f.transitionTime=m,f.skyboxOpacity=0,f.modelAlpha=1,f.flyOut=!0,f.toMode=i,this.fade360View(p,f)):this.isOutsideMode(d)&&this.is360View(i,o)?(this.mode=i,f.pano=o,f.blackoutStyle=ze,m=Te.show360Views.transitionTime,f.transitionTime=m,f.flyIn=!0,this.fade360View(p,f,this.afterchangeMode)):(pe.start(ut.property(this.model,"alpha",f.modelAlpha,null),m*f.modelAlphaLength,null,f.modelAlphaDelay,null,Te.freeze.FlyToNewMode),pe.start(ut.vector(this.position,p.position),m,null,Te.flydown.movementDelay,de[Te.flydown.movementEasing],null,Te.freeze.FlyToNewMode),pe.start(ut.quaternion(this.quaternion,p.quaternion),m*f.rotationDuration,null,f.rotationDelay,de[Te.flydown.rotationEasing],null,Te.freeze.FlyToNewMode),pe.start(ut.matrix4(this.camera.projectionMatrix,p.projectionMatrix),m*f.cameraMatrixDuration,null,f.cameraMatrixDelay,f.cameraMatrixEase,null,Te.freeze.FlyToNewMode),pe.start((function(){n.camera.projectionMatrixInverse.copy(n.camera.projectionMatrix).invert()}),m*f.cameraMatrixDuration,null,f.cameraMatrixDelay,f.cameraMatrixEase,null,Te.freeze.FlyToNewMode),pe.start(ut.uniform(this.model.skybox,"opacity",f.skyboxOpacity),m*f.skyboxOpacityLength,null,f.skyboxOpacityDelay,null,Te.freeze.FlyToNewMode),pe.start(ut.property(this.reticule.material.uniforms.opacity,"value",0),m,null,Te.freeze.FlyToNewMode)),pe.setTimeout(function(){this.flying=!1,d===Ue.PANORAMA&&i!==Ue.PANORAMA?this.currentPano.exit():d!==Ue.PANORAMA&&i===Ue.PANORAMA&&(this.currentPano!==g&&g.exit(),this.currentPano.enter()),d===Ue.DOLLHOUSE&&this.cameraControls.controls[Ue.DOLLHOUSE].resetRanges(),this.mode=i,this.afterChangeMode(d,i),this.emit(ar,{targetPosition:v,currentPosition:y,targetPano:this.currentPano,currentPano:g}),a&&a(),t.resolve()}.bind(this),m,Te.freeze.FlyToNewMode),this.mode=Ue.TRANSITIONING,this.beforeChangeMode(d,i,o,m),t.promise()},e.setSize=function(e,t){var n=e/t;this.baseFov=Or.clampVFOV(Te.insideFOV,Te.insideFOVMax,e,t);var i=Or.getHFOVFromVFOV(Te.insideFOV,e,t);for(var o in i>Te.insideFOVMax?this.baseFov=Or.getVFOVFromHFOV(Te.insideFOVMax,e,t):this.baseFov=Te.insideFOV,this.cameraControls.cameras){var r=this.cameraControls.cameras[o];r.fov=r.staticFov?r.staticFov:this.baseFov*(1/this.zoomLevel),r.updateAspect(n)}this.emit("setSize",e,t)},e.toJSON=function(){var e={};return this.cameraControls.activeControl?((e=this.cameraControls.activeControl.toJSON()).camera_mode=Ue.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})):Ue.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||Te.zoom.enabled&&this.mode===Ue.PANORAMA&&this.zoomEnabled)&&(e<Te.zoom.min&&(e=Te.zoom.min),e>Te.zoom.max&&(e=Te.zoom.max),e>this.zoomLevel?(this.emit(Wr),e===Te.zoom.max&&this.emit(Zr)):e<this.zoomLevel&&(this.emit(Qr),e===Te.zoom.min&&this.emit(Gr)),this.cameraControls.activeControl)){var n=this.cameraControls.activeControl.camera;this.zoomLevel=e,n.fov=this.baseFov*(1/this.zoomLevel),n.updateProjectionMatrix(),this.zoomFov=n.fov,this.emit("zoomTo",e)}},e.zoomDefault=function(){this.zoomTo(1,!0)},e.smoothZoomToDefault=function(e,t){var n,i=this.zoomLevel,o=function(e){e>1&&(e=1),n=i*(1-e)+e,this.zoomTo(n,!0)}.bind(this),r=function(){this.zoomDefault(),t&&window.setTimeout(t,50)}.bind(this);pe.start(o,e,r,null,0,de[Te.transition.blendEasing])},e.smoothZoomFovTo=function(e,t,n){var i=this.baseFov/e;this.smoothZoomLevelTo(i,t,n)},e.smoothZoomLevelTo=function(e,t,n){if(this.zoomLevel!=e){var i,o=this.zoomLevel,r=function(t){t>1&&(t=1),i=o*(1-t)+t*e,this.zoomTo(i,!0)}.bind(this);pe.start(r,t,n,null,0,de[Te.transition.blendEasing])}},e.updateZoomPano=function(){var e=this.$app.core.get("QualityManager"),t=this.$app.core.get("PanoRenderer"),n=this.currentPano;if(!t.zoomPanoRenderingDisabled&&this.mode===Ue.PANORAMA&&n.tiled&&n){var i="2k"==e.navTileClass&&"4k"==e.tileClass?1.7:Te.zoom.activationThreshold,o=Te.highestQualityTile||this.zoomLevel>i,r=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano)&&!this.isWarping(),a=o&&r;this.$app.core.get("TileDownloader").tilePrioritizer.setZoomingActive(a),t.setZoomingActive(a,n,!0);var s=function(n,i){t.resetRenderStatus(n.id,!1,!0,e.getMaxNavPanoSize()),t.clearAllQueuedUploadsForPano(n.id),t.renderPanoTiles(n.id,null,!1,!1),n.setZoomed(i)}.bind(this);if(a&&(!n.zoomed||e.zoomLevelResolution&&"4k"!=e.zoomLevelResolution)?(n.zoomed||s(n,!0),"1k"==e.navTileClass&&"1k"!=e.tileClass&&this.zoomLevel<2?t.enableHighQuality(function(){"4k"!=e.tileClass&&s(n,!0)}.bind(this)):t.enableUltraHighQualityMode(function(){e.useUltraHighResolutionPanos&&!Te.zoom.overridemax&&(Te.zoom.max=Te.ultraHighQualityMaxZoom),s(n,!0)}.bind(this))):!o&&n.zoomed&&s(n,!1),a&&"1k"==e.navTileClass&&"4k"==e.tileClass){var l=function(n){e.updateMaximums(),t.setupZoomRenderTarget()};e.zoomLevelResolution=this.zoomLevel>=2?"4k":this.zoomLevel>1.1?"2k":"1k",this.oldZoomLevel<2&&this.zoomLevel>=2?(l(),s(n,o)):this.oldZoomLevel<=Te.zoom.activationThreshold&&this.zoomLevel>Te.zoom.activationThreshold?l():this.oldZoomLevel>2&&this.zoomLevel<=2?(l(),s(n,o)):this.oldZoomLevel>Te.zoom.activationThreshold&&this.zoomLevel<=Te.zoom.activationThreshold&&l(),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,n?(e.cameraChanged2=!1,e.cameraChanged3=!1):(e.cameraChanged2=!Ce.closeTo(this.quaternion,this.previousState.quaternion,5)||!Ce.closeTo(this.position,this.previousState.position,4),e.cameraChanged3=!Ce.closeTo(this.quaternion,this.previousState.quaternion,3)||!Ce.closeTo(this.position,this.previousState.position,3)),e.allFloorsVisible=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,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(ar,(function(){i.flyToMode(e,t,n)}));else{this.once(ar,(function(){t()}));try{this.flyToNewMode({mode:e,pano:"panorama"==e&&this.currentPano,duration:n})}catch(e){console.log("flyToMode遇到问题?")}}},e.vrModeChange=function(){Te.vrEnabled?(Te.vrEnabled=!1,window.VRScreenNotFull||he.exitFullscreen()):(Te.vrEnabled=!0,window.VRScreenNotFull||he.requestFullscreen(document.body))},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=(r=this.cameraControls.controls.floorplan).getDefaultAbsoluteScale(t),i=r.absoluteScale,o=r.target.clone();pe.cancelById(Te.freeze.outsideFocus,!0),pe.start(function(t){r.absoluteScale=n*t+i*(1-t),r.target=e.aim.clone().multiplyScalar(t).add(o.clone().multiplyScalar(1-t)),r.camera.position.copy(r.target.clone().add(r.offset))}.bind(this),e.dur||600,null,0,de[Te.transition.blendEasing],"outsideFocus",Te.freeze.outsideFocus,null)}else if("dollhouse"==this.mode){var r=this.cameraControls.controls.dollhouse,a=e.radius||10,s=(o=r.target.clone(),r.offset.clone().normalize()),l=r.offset.length();pe.cancelById(Te.freeze.outsideFocus,!0),pe.start(function(t){r.target=e.aim.clone().multiplyScalar(t).add(o.clone().multiplyScalar(1-t));var n=a*t+l*(1-t);r.camera.position.copy(r.target.clone().add(s.clone().multiplyScalar(n)))}.bind(this),e.dur||600,null,0,de[Te.transition.blendEasing],"outsideFocus",Te.freeze.outsideFocus,null)}},e.getSnapAngleInfo=function(){var e={metadata:{}},t=this.camera.quaternion.clone();switch(this.mode){case"panorama":e.metadata.scan_id=this.currentPano.id;break;case"floorplan":var n=this.getSize(),i=n.clientWidth,o=n.clientHeight;(t=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90))).multiply(this.camera.quaternion),e.metadata.camera_mode=1,e.metadata.ortho_zoom=Ie.toPrecision(this.cameraControls.activeControl.currentScale/(i/o),4);break;case"dollhouse":e.metadata.camera_mode=2}return e.metadata.camera_position=this.camera.position.clone(),e.metadata.camera_quaternion=t,e.metadata.lon=this.cameraControls.activeControl.lon,e.metadata.lat=this.cameraControls.activeControl.lat,e.sid="4dkk"+(new Date).getTime(),e.name="",e.mode=this.mode,e},e.model=new yr(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=!0,e.isTouchEvent=!1,e.isPanoHover=!1,e.reticule=new xr(h(e)),e.panoMarkers=[],e.quaternion=new THREE.Quaternion,e.position=new THREE.Vector3(15,10,15),e.previousState=null,e.lastInsideView=new br,e.last360View=new br,e.raycaster=new THREE.Raycaster,e.raycaster.layers.enable(pt),e.intersect=null,e.lastChangeTime=Date.now(),e.history=new Be,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=Te.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(Ue.PANORAMA),e.zoomStats=new Ne,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 ja(e.$app,h(e)),e.paintEditor=new qa(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 jr(this.director,this,this.cameraControls),this.basePanoSize=this.$app.core.get("QualityManager").getPanoSize(yt),this.standardPanoSize=this.$app.core.get("QualityManager").getPanoSize(wt),this.highPanoSize=this.$app.core.get("QualityManager").getPanoSize(bt),this.ultraHighPanoSize=this.$app.core.get("QualityManager").getPanoSize(Et),this.$app.core.get("TileDownloader").processPriorityQueue=!1,this.$app.core.get("TileDownloader").tilePrioritizer=new zr(this.$app.core.get("QualityManager"),this.basePanoSize,this.standardPanoSize,this.highPanoSize,this.ultraHighPanoSize),this.bindEvents(this.domElement),this.updateModel(),ea.init(this),Un.init(this.$app)}},{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.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:"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){e==Ue.PANORAMA?(this.labelManager&&this.labelManager.updateEntryVisi(!0,this.model.currentFloor.floorIndex),this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),this.model.floorLogos.firstLogo.visible=!1,this.model.floorLogos.secondLogo.visible=!1,this.model.skybox.material.depthTest=!1,this.model.skybox.material.transparent=!0):e==Ue.FLOORPLAN?wa.switchDepthTest(!0):Ue.DOLLHOUSE,t==Ue.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.setDisplay(!1),this.labelManager&&this.labelManager.updateEntryVisi(!1,this.model.currentFloor.floorIndex)):t==Ue.FLOORPLAN?(setTimeout(wa.switchDepthTest.bind(this,!1),.5*i),this.labelManager&&this.labelManager.setPlanLabelVisi(!0,this.model.currentFloor.floorIndex)):Ue.DOLLHOUSE,this.$app.Camera.emit("mode.beforeChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex})}},{key:"afterChangeMode",value:function(e,t,n,i){e==Ue.PANORAMA?this.compass&&this.compass.autoJudgeDisplay():e==Ue.FLOORPLAN?this.labelManager&&this.labelManager.setPlanLabelVisi(!1,this.model.currentFloor.floorIndex):Ue.DOLLHOUSE,t==Ue.PANORAMA?(this.model.floorLogos.firstLogo.visible=!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):t==Ue.FLOORPLAN||t==Ue.DOLLHOUSE&&this.model.floors.forEach((function(e){e.entryArrow.forEach((function(e){return e.dollLabel.update()}))})),this.$app.Camera.emit("mode.afterChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex}),this.panosTaskList=[]}}]),n}()})),Re("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(Et),this.highSize=this.getPanoSize(bt),this.standardSize=this.getPanoSize(wt),this.baseSize=this.getPanoSize(yt),Te.tiling.maxZoomPanoQuality&&this.ultraHighSize<=Te.tiling.maxZoomPanoQuality&&(Te.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=he.valueFromHash("threshold2k",ye.windowHeightHighQualityThreshold),this.updateMaximums(),this.$app.core.get("ModelManager").on(Br,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)}},{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){Te.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=Te.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=Te.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSize<this.maxNavPanoSize&&(this.maxNavPanoSize=this.maxZoomPanoSize)}},{key:"buildPanoSizeClassMap",value:function(){this.panoSizeClassMap[yt]=512,this.panoSizeClassMap[wt]=1024,this.panoSizeClassMap[bt]=2048,this.panoSizeClassMap[Et]=4096}},{key:"getPanoSize",value:function(e){return this.panoSizeClassMap[e]}},{key:"getMaxPossiblePanoSize",value:function(){return this.getPanoSize(Et)}},{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 wt;case"2k":default:return bt}}},{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(Et):"1k"!=this.zoomLevelResolution&&this.useHighResolutionPanos?this.getPanoSize(bt):this.getPanoSize(wt):this.useHighResolutionPanos?this.useUltraHighResolutionPanos?this.getPanoSize(Et):this.getPanoSize(bt):this.getPanoSize(wt)}}]),e}()}));var Ja={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:di,2:li,3:pi,4:ci,5:hi}[e]}},Ka="tiledownloader.download.success",es="tiledownloader.download.failure",ts="tiledownloader.pano.download.complete";function ns(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("TileDownloader",(function(){var e,t;return t=e=function(e){f(n,EventEmitter);var t=ns(n);function n(e){var i;return o(this,n),(i=t.call(this)).forceQueueTilesForPano=function(){var e=[],t=[];return function(n,i,o,r,a,s){e.length=0;for(var l=this.getTileDownloadDescriptors(n,i),c=0;c<l.length;c++){var u=l[c];u.status!==Lr.None&&u.status!==Lr.Queued||e.push(u)}if(o&&e.length>0){zr.sortPanoTiles(e,n,o),t.length=0,fi.matchingTilesInDirection(n,i,o,r,a,t);for(var h=0,d=function(e){return e.face===p.face&&e.faceTileIndex===p.faceTileIndex};h<e.length;){var p=e[h];t.findIndex(d)<0?e.splice(h,1):h++}}for(var f=0;f<e.length;f++)this.forceQueue.push(e[f]);this.setStatusForAllDescriptors(this.forceQueue,Lr.ForceQueued),this.clearFromQueue(this.priorityQueue,Lr.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!==Lr.Downloaded&&n.status!==Lr.Failed&&e.push(n)}this.activeDownloads.length=0,this.activeDownloads.push.apply(this.activeDownloads,e)}}(),i.getTileUrl=function(){var e={256:"256",512:"512",1024:"1k",2048:"2k",4096:"4k"},t={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(n,i,o,r,a){fi.getTileLocation(i,r,t);var s=Math.floor(i/o),l=s*s,c=Math.floor(r/l),u="";1===Te.tiling.customCompression&&Te.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-1)+",",u+=0==t.tileY?"y_0":"y_"+(512*t.tileY-1))),"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:"start",value:function(){this.refreshUpdateInterval(0)}},{key:"stop",value:function(){window.cancel(this.refreshInterval)}},{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:"update",value:function(){var e=this.forceQueue.length>0;return this.processQueueForDownloading(this.forceQueue),this.processPriorityQueue&&(this.queuePrioritizedTilesForPanos(this.panos),this.priorityQueue.length>0&&(e=!0),this.processQueueForDownloading(this.priorityQueue)),e}},{key:"clearForceQueue",value:function(){this.clearQueue(this.forceQueue)}},{key:"queuePrioritizedTilesForPanos",value:function(e){this.tilePrioritizer&&(this.clearQueue(this.priorityQueue),this.tilePrioritizer.filterAndPrioritize(this.priorityQueue,e,this),this.clearFromQueue(this.priorityQueue,Lr.None,!0),this.setStatusOrRemoveForAllDescriptors(this.priorityQueue,Lr.Queued))}},{key:"clearQueue",value:function(e){this.setStatusForAllDescriptors(e,Lr.None),e.length=0}},{key:"clearFromQueue",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];o&&(t===o.status&&!n||t!==o.status&&n)&&(e[i]=null)}}},{key:"setStatusForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status=t)}}},{key:"setStatusOrRemoveForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status!==t?i.status=t:e[n]=null)}}},{key:"getTileDownloadDescriptors",value:function(e,t){var n=this.getAllTileDownloadDescriptorsForPano(e),i=n[t];return i||(i=this.buildDownloadDescriptorArray(t),n[t]=i,this.initTileDownloadDescriptors(i,e,t)),i}},{key:"getAllTileDownloadDescriptorsForPano",value:function(e){var t=this.downloadDescriptors[e.id];return t||(t={},this.downloadDescriptors[e.id]=t),t}},{key:"processQueueForDownloading",value:function(e,t){if(this.cleanupActiveDownloads(),this.activeDownloads.length<this.concurrentDownloads||t)for(var n=t?e.length:this.concurrentDownloads-this.activeDownloads.length,i=0,o=0;i<n&&e.length>0;o++){var r=e.shift();r&&(this.startDownload(r),i++)}}},{key:"testDownload",value:function(e,t,n){var i=this.downloadTestResults[e];if(i)i===this.freeze.Success?n(!0):i===this.freeze.Fail&&n(!1);else{this.downloadTestResults[e]=this.freeze.Testing;var o=this.panos.list[0],r=this.getTileUrl(o,e,t,0),a=function(t){this.downloadTestResults[e]=this.freeze.Success,n(!0)}.bind(this),s=function(){this.downloadTestResults[e]=this.freeze.Fail,n(!1)}.bind(this);this.loadImage(r,0,a,s)}}},{key:"startDownload",value:function(e){e.status=Lr.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(es)}},{key:"downloadComplete",value:function(e,t){if(e.panoGroupId===this.panoGroupId){var n=this.getPanoLoadCallbacks(e.pano,e.panoSize);e.status=Lr.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(Ka,i),this.isPanoDownloaded(e.pano,e.panoSize)&&(i={panoId:e.pano.id,tileSize:e.tileSize,panoSize:e.panoSize},this.emit(ts,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!==Lr.Downloaded)return!1}return!0}},{key:"setPanoLoadCallbacks",value:function(e,t,n,i,o){var r=e.id+":"+this.$app.core.get("QualityManager").getPanoSize(t);this.panoLoadCallbacks[r]={onLoad:n,onFail:i,onProgress:o}}},{key:"getPanoLoadCallbacks",value:function(e,t){var n=e.id+":"+t;return this.panoLoadCallbacks[n]}},{key:"buildDownloadDescriptorArray",value:function(e){for(var t=fi.getTileCountForSize(e),n=[],i=0;i<t;i++){var o=this.buildDownloadDescriptor();n.push(o)}return n}},{key:"buildDownloadDescriptor",value:function(){return{panoGroupId:null,pano:null,panoSize:-1,tileSize:-1,tileIndex:-1,totalTiles:-1,faceTileIndex:-1,status:Lr.None,url:null,image:null,direction:new THREE.Vector3,face:-1,cubeFace:-1,tileX:-1,tileY:-1}}},{key:"initTileDownloadDescriptors",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];this.initTileDownloadDescriptor(o,t,n,i)}}},{key:"initTileDownloadDescriptor",value:function(e,t,n,i){var o=n>=fi.TILE_SIZE?fi.TILE_SIZE:n;e.face=fi.getFaceForTile(n,i),e.cubeFace=Ja.mapFaceToCubemapFace(e.face),e.panoGroupId=this.panoGroupId,e.pano=t,e.panoSize=n,e.tileSize=o,e.tileIndex=i,e.totalTiles=fi.getTileCountForSize(n),e.status=Lr.None,e.image=null,fi.getTileLocation(e.panoSize,e.tileIndex,e),fi.getTileVector(e.panoSize,e.tileSize,e.cubeFace,e.tileX,e.tileY,fi.LocationOnTile.Center,0,e.direction)}},{key:"loadImage",value:function(e,t,n,i){Vn.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}));var is="scene-renderer-context-created",os="after-render";function rs(e,t){this.tree=e,this.parent=t,this.children=[],this.id=++hs}function as(e,t,n,i,o,r,a,s){if(e){a=a||TileTree.TraversalType.PreOrder;var l=i*cs+n;if(a===TileTree.TraversalType.PreOrder&&(o&&o(e,t,l,n,i),r&&r.push(e)),e.children&&0!==e.children.length){for(var c=i*cs,u=n*cs,h=0;h<cs;h++)for(var d=0;d<cs;d++)as(e.children[d*cs+h],t+1,u+h,c+d,o,r,a);a===TileTree.TraversalType.PostOrder&&(o&&o(e,t,l,n,i),r&&r.push(e))}}}function ss(e,t,n){if(n>e.levels)return null;var i=new rs(e,t);e.allNodes.push(i);for(var o=0;o<us;o++)i.children[o]=ss(e,i,n+1);return i}function ls(e,t,n,i,o){if(!e)return null;if(0===n)return e;if(!e.children||0===e.children.length)return null;var r=Math.pow(cs,n)/cs,a=i%r,s=o%r,l=Math.floor(o/r),c=Math.floor(i/r),u=l*cs+c;return ls(e.children[u],t+1,n-1,a,s)}window.TileTree=function(e,t){this.levels=t,this.tileSize=e,this.root=null,this.allNodes=[],function(e){e.root=ss(e,null,0)}(this)};var cs=2,us=cs*cs;TileTree.TraversalType=Object.freeze({PreOrder:0,PostOrder:1});var hs=0;TileTree.getLevelCountForSize=function(e,t){var n=0;for(t<e&&(t=e);!((t/=cs)<e);)n++;return n},TileTree.getSizeForLevel=function(e,t){return Math.pow(cs,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 ls(this.root,0,i,t,n)},TileTree.prototype.breadthFirst=function(e){var t=!!(e=e||{}).nullLevelEnd,n=e.maxLevel,i=e.minLevel,o=e.callback,r=e.saveVisited,a=[],s={},l=0;for(a.push(this.root),a.push(s);a.length>0&&!(n&&l>n);){var c=a.shift();if(c===s)(!i||l>=i)&&(o&&t&&o(null),r&&t&&r.push(null)),a.length>0&&a.push(s),l++;else{if(c.children)for(var u=0;u<c.children.length;u++){c.children[u]&&a.push(c.children[u])}var h=this.getFaceIndexFromNode(c);(!i||l>=i)&&(o&&o(c,l,h),r&&r.push(c))}}},TileTree.prototype.getFaceIndexFromNode=function(e){if(!e)return-1;for(var t=1,n=e,i=0,o=0;;){var r=n.parent;if(!r)break;for(var a=-1,s=0;s<r.children.length;s++)r.children[s]===n&&(a=s);i=a%cs*t+i,o=Math.floor(a/cs)*t+o,t*=cs,n=r}return o*t+i},TileTree.prototype.depthFirst=function(e,t,n){as(this.root,0,0,0,e,t,n,this.tileSize)};var ds=TileTree;function ps(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function fs(){this.uploadIntervalCancelled||(this.overlayTilesLoaded||!this.usingTileOverlay?(ms=!0,this.updateUploadQueue(this.maxNonBaseUploadsPerFrame,this.maxBaseUploadsPerFrame),this.peekNextFromUploadQueue()?this.refreshUploadInterval(vs):this.uploadInterval=null):this.refreshUploadInterval(this.uploadIntervalDelay))}var ms=!1,vs=Te.tiling.uploadIntervalDelay,gs=Te.tiling.initialIntervalDelay,ys=Te.tiling.maxNonBaseUploadsPerFrame,ws=Te.tiling.maxBaseUploadsPerFrame,bs=0,Es=1;Re("PanoRenderer",(function(){return function(e){f(n,EventEmitter);var t=ps(n);function n(e){var i,r,a,s;return o(this,n),(i=t.call(this)).updateActivePanos=function(){var e=[];return function(t,n){e.length=0;for(var i=0;i<this.activePanos.length;i++){t&&e.length===n&&e.push(t);var o=this.activePanos[i],r=this.getActiveRenderTargetDescriptor(o.id);t&&o.id===t.id||!this.isRenderTargetDescriptorValid(r)||e.push(o)}t&&n>=e.length&&e.push(t),this.activePanos.length=0,this.activePanos.push.apply(this.activePanos,e)}}(),i.renderPanoTiles=function(){var e=[];return function(t,n,i,o){this.zoomRenderTarget&&this.zoomRenderTarget.width===this.$app.core.get("QualityManager").getMaxZoomPanoSize()||this.zoomPanoRenderingDisabled||this.setupZoomRenderTarget(),n=n||this.direction||Vectors.FORWARD;var r=this.getActiveRenderTargetDescriptor(t);if(!this.isRenderTargetDescriptorValid(r))throw new BasicException("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated.");for(var a=0;a<fi.FACES_PER_PANO;a++){var s=this.getTileTree(t,a);e.length=0,s.breadthFirst({saveVisited:e});for(var l=0;l<e.length;l++){var c=e[l];this.queueTileUpload(c.tile,!1,o||0===l&&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=fs.bind(this)),null!=t||(t=vs),ms||(t=gs),this.uploadInterval=window.setTimeout(e,t),this.uploadIntervalDelay=t)}}(),i.update=function(){var e=performance.now(),t=0;return function(){this.uploadIntervalCancelled=!0,window.clearTimeout(this.uploadInterval),this.uploadInterval=null,//!(i > w || 0 === t) || !this.overlayTilesLoaded && this.usingTileOverlay || (this.updateUploadQueue(this.maxNonBaseUploadsPerFrame, this.maxBaseUploadsPerFrame),
  4. !(performance.now()-e>vs||0===t)||!this.overlayTilesLoaded&&this.usingTileOverlay||(this.updateUploadQueue(this.maxNonBaseUploadsPerFrame,this.maxBaseUploadsPerFrame),e=performance.now()),t++}}(),i.uploadTile=(r={},a=Te.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,y=(this.getPanoDescriptor(o),this.getPanoLODDescriptor(o,u)),w=this.getActiveRenderTargetDescriptor(o),b=w.renderTarget,E=w.size;this.isPanoZoomed(o)&&this.zoomRenderTarget&&(b=this.zoomRenderTarget,E=this.zoomRenderTarget.width);var x=function(){y.uploaded.includes(h)||(y.uploaded.push(h),y.uploadCount++),n.emit(ht.TileRenderSuccess,o,u,h,d),y.uploadCount===d&&n.emit(ht.PanoRenderComplete,o,u,d),n.setUploaded(e,!0),n.addCoverageForNode(e.node)};if(this.isRenderTargetDescriptorValid(w)||(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 T=c/u*E,P=p*c/u*E,k=f*c/u*E;if(r[c]||(r[c]=i.initSizedTexture2D(c,THREE.ClampToEdgeWrapping)),u>this.$app.core.get("QualityManager").maxRenderTargetSize)var R=i.initSizedTexture2D(c,THREE.ClampToEdgeWrapping),M=this.$app.core.get("Player").model.isHighMapLoaded(e.cubeFace,p,f);else R=r[c];if(i.uploadTexture2D(l,R,0,0,c,c),u>this.$app.core.get("QualityManager").maxRenderTargetSize)M||this.$app.core.get("Player").model.updateHighMap(R,e.cubeFace,p,f);else if(1===a||2===a){var S=1===a?this.overlayTilesBasic:this.overlayTilesEnhanced;i.renderToCubeMap(R,b,c,c,0,0,c,c,P,k,T,T,e.cubeFace),i.renderToCubeMap(S[u],b,c,c,0,0,c,c,P,k,T,T,e.cubeFace,THREE.NormalBlending,!0,.5)}else i.renderToCubeMap(R,b,c,c,0,0,c,c,P,k,T,T,e.cubeFace);x()}else g?x():(s[o+":"+u+":"+h]=!0,this.setUploaded(e,!1));return e.uploadAttempted||(y.uploadAttempts++,this.emit(ht.TileUploadAttempted,o,u,h,d)),e.uploadAttempted=!0,y.uploadAttempts===d&&this.emit(ht.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=ws,i.maxNonBaseUploadsPerFrame=ys,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(Ka,this.onTileDownloaded.bind(this)):this.$app.core.get("TileDownloader").on(Ka,this.onTileDownloaded.bind(this))}},{key:"setupZoomRenderTarget",value:function(){var e=this.$app.core.get("QualityManager");if("2k"!=e.maxRenderTargetSize||"2k"!=e.getMaxNavPanoSize())if(e.getMaxZoomPanoSize()>=e.getMaxNavPanoSize()&&("2k"!=e.tileClass||"1k"!=e.tileClass)){var t=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer");if(this.zoomRenderTarget&&this.zoomRenderTarget.width===e.getMaxZoomPanoSize())return;var n=this.zoomRenderTarget;if(e.getMaxZoomPanoSize()>e.maxRenderTargetSize)return;if(this.zoomRenderTarget=this.initTiledPano(e.getMaxZoomPanoSize(),!1),n){var i=n.width,o=this.zoomRenderTarget.width;t.copyCubeMap(n.texture,this.zoomRenderTarget,i,i,o,o),n.texture.dispose(),n.texture.loaded=!1,n.texture.version=0,t.deallocateCubeTexture(n.texture),n.texture=null}this.zoomPanoRenderingDisabled=!1}else this.zoomPanoRenderingDisabled=!0}},{key:"enableHighQuality",value:function(e){this.$app.core.get("QualityManager").highQualityModeStarted||(this.setupZoomRenderTarget(),e(),this.$app.core.get("QualityManager").highQualityModeStarted=!0)}},{key:"enableUltraHighQualityMode",value:function(e){var t=this.$app.core.get("QualityManager");if("2k"==t.tileClass||"1k"==t.tileClass)return this.enableHighQuality(e);if(!t.ultraHighQualityModeEnabled()){var n=t.getPanoSize(Et);this.$app.core.get("TileDownloader").testDownload(n,fi.TILE_SIZE,function(t){t&&(this.$app.core.get("QualityManager").enableUltraHighQualityMode(),this.setupZoomRenderTarget(),e())}.bind(this))}}},{key:"activateTiledPano",value:function(e,t,n){n&&this.clearAllQueuedUploads();for(var i=0;i<fi.FACES_PER_PANO;i++)this.initTileTree(e.id,i,this.$app.core.get("QualityManager").getMaxPossiblePanoSize());this.linkAllTilesAndNodes(e);var o=this.getActiveRenderTargetDescriptor(e.id),r=t;if(r>this.$app.core.get("QualityManager").getMaxNavPanoSize()&&(r=this.$app.core.get("QualityManager").getMaxNavPanoSize()),!o||r!==o.size){if(o&&this.deactiveDescripor(o.renderTarget),!(o=this.activeDescripor(r))){var a=this.initTiledPano(r,!1);(o=this.initDescriptor(a.width)).renderTarget=a}o.pano=e,this.resetPanoDescriptor(e.id),this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0)}this.setActiveRenderTargetDescriptor(e.id,o);var s=n?0:1;return this.updateActivePanos(e,s),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 o=null;i&&(o=ds.getLevelCountForSize(fi.TILE_SIZE,i)+1);for(var r=function(e,i,o,r){n&&(i.tile.zoomUploaded=!1),t&&(i.tile.uploaded=!1)},a=0;a<fi.FACES_PER_PANO;a++){this.getTileTree(e,a).breadthFirst({callback:r.bind(this,a),minLevel:o})}}},{key:"copyBaseRenderStatusToZoomed",value:function(e){for(var t=ds.getLevelCountForSize(fi.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<fi.FACES_PER_PANO;i++){this.getTileTree(e,i).breadthFirst({callback:n.bind(this,i),maxLevel:t})}}},{key:"isRenderTargetDescriptorValid",value:function(e){return e&&e.renderTarget}},{key:"isPanoActive",value:function(e){var t=this.getActiveRenderTargetDescriptor(e);return this.isRenderTargetDescriptorValid(t)}},{key:"isPanoZoomed",value:function(e){return this.zoomingActive&&this.zoomPanoId===e}},{key:"initTileTree",value:function(e,t,n){var i=this.tileTrees[e];i||(i=[],this.tileTrees[e]=i);var o=i[t];if(!o){var r=ds.getLevelCountForSize(fi.TILE_SIZE,n);o=new ds(fi.TILE_SIZE,r),i[t]=o}}},{key:"getTileTree",value:function(e,t){var n=this.tileTrees[e];if(!n)throw new BasicException("PanoRenderer.getTileTree() -> Tree array not yet initialized!");var i=n[t];if(!i)throw new BasicException("PanoRenderer.getTileTree() -> Tree not yet initialized!");return i}},{key:"initTiledPano",value:function(e,t){return new THREE.WebGLCubeRenderTarget(e,{stencilBuffer:!1})}},{key:"getUploadQueueForPano",value:function(e){var t=this.uploadQueues[e];return t||(t=[],this.uploadQueues[e]=t),t}},{key:"isTileUploaded",value:function(e){return this.isPanoZoomed(e.panoId)?e.zoomUploaded:e.uploaded}},{key:"setUploaded",value:function(e,t){this.isPanoZoomed(e.panoId)?e.zoomUploaded=t:e.uploaded=t}},{key:"queueTileUpload",value:function(e,t,n){var i=this.getActiveRenderTargetDescriptor(e.panoId);if(this.isRenderTargetDescriptorValid(i)&&e.downloaded&&!this.isTileUploaded(e)&&(!e.uploadQueued||n)&&(!(e.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive)){var o=this.getUploadQueueForPano(e.panoId);n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?zr.insertSortedPanoTile(o,e,i.pano,this.direction):o.push(e),e.uploadQueued=!0,this.uploadInterval||this.uploadIntervalCancelled||this.refreshUploadInterval(0))}}},{key:"shoulPushToFrontOfQueue",value:function(e){return 0===ds.getLevelCountForSize(fi.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e=null,t=null,n=bs;n<=Es;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 bs:if(0===t[0].level)return t;break;case Es:return t}return null}},{key:"peekNextFromUploadQueue",value:function(){if(this.forceQueue.length>0)return this.forceQueue[0];var e=this.getTopUploadQueue();return e&&e.length>0?e[0]:null}},{key:"clearAllQueuedUploads",value:function(){this.clearAllUploadQueues(null,0)}},{key:"clearAllQueuedUploadsForPano",value:function(e){this.clearAllUploadQueues(e,0)}},{key:"clearAllUploadQueues",value:function(e,t){if(e)this.clearUploadQueue(this.getUploadQueueForPano(e),t),this.clearUploadQueue(this.forceQueue,t,e);else{for(var n=0;n<this.activePanos.length;n++){var i=this.activePanos[n];this.clearUploadQueue(this.getUploadQueueForPano(i.id),t)}this.clearUploadQueue(this.forceQueue,t)}}},{key:"clearUploadQueue",value:function(e,t,n){null!=t||(t=0);for(var i=0;i<e.length;){var o=e[i];(!n||n&&n===o.panoId)&&o.level>=t?(o.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t){e||(e=1);for(var n=0,i=0;!(i>=t||n>=e);){var o=this.getNextFromUploadQueue();if(!o)break;if(0!==o.level?n++:i++,!(o.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive){var r=this.getActiveRenderTargetDescriptor(o.panoId);this.isRenderTargetDescriptorValid(r)&&this.uploadTile(o,o.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);zr.sortPanoTiles(i,n,this.direction)}}}},{key:"linkTileAndNode",value:function(e,t){t.tile=e,e.node=t}},{key:"linkAllTilesAndNodes",value:function(e){for(var t=function(t,n,i,o,r){var a=this.getTileDirectoryEntry(e.id,n,o,r);this.linkTileAndNode(a,i)},n=0;n<fi.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=ds.getLevelCountForSize(fi.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=Ja.mapFaceToCubemapFace(e.face),n.panoId=e.panoId,n.tileSize=e.tileSize,n.direction=(new THREE.Vector3).copy(e.direction),n.node=null,n.level=ds.getLevelCountForSize(fi.TILE_SIZE,n.panoSize),this.isPanoActive(n.panoId)){var i=this.getTileTree(n.panoId,n.face).getSubNode(n.panoSize,n.tileX,n.tileY);this.linkTileAndNode(n,i),this.queueTileUpload(n,!0)}}},{key:"getTileDirectoryEntry",value:function(e,t,n,i){var o=this.tileDirectory[e];o||(o={},this.tileDirectory[e]=o);var r=16384*t+1024*n+i,a=o[r];return a||(a={downloaded:!1,uploaded:!1,zoomUploaded:!1},o[r]=a),a._key=e+":"+t+":"+n+":"+i,a._tileKey=r,a}},{key:"setZoomingActive",value:function(e,t,n){this.zoomPanoRenderingDisabled||e===this.zoomingActive&&this.zoomPanoId===t.id||(this.zoomingActive=e,this.zoomPanoId=t.id,this.zoomingActive&&(this.zoomPanoId!==t.id||n)&&this.updateZoomedPanoFromBase(t))}},{key:"updateZoomedPanoFromBase",value:function(e){if(!this.zoomPanoRenderingDisabled&&this.zoomRenderTarget){var t=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer"),n=this.getActiveRenderTargetDescriptor(e.id);if(n&&n.renderTarget){var i=Math.min(this.$app.core.get("QualityManager").maxRenderTargetSize,this.$app.core.get("QualityManager").getMaxZoomPanoSize()),o=n.renderTarget,r=n.size;t.copyCubeMap(o.texture,this.zoomRenderTarget,r,r,i,i),this.copyBaseRenderStatusToZoomed(e.id)}}}},{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){for(var t=0;t<this.M.length;t++){var n=this.M[t];if(!n.inUse&&n.size===e)return n.inUse=!0,n}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}}]),n}()}));var xs="panorama.videorenderer.suspendrender",Ts="panorama.videorenderer.resumerender",Ps="panorama.videorenderer.textured",ks="panorama.videorenderer.canplayvideo",Rs="panorama.videorenderer.startvideo";function Ms(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Ss(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("ModelManager",(function(){return function(e){f(n,EventEmitter);var t=Ms(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(ht.TileRenderSuccess,this.onTileRendered.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ps,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(xs,this.onSuspendVideoRender.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ts,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(Nr)}},{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(Br,{oldModel:n,model:t})}},{key:"getActiveModel",value:function(){return this.activeModel}}]),n}()}));var Is=function(e){f(n,THREE.PerspectiveCamera);var t=Ss(n);function n(e){var i;return o(this,n),(i=t.call(this,Or.clampVFOV(Te.insideFOV),window.innerWidth/window.innerHeight,Te.insideNear,Te.insideFar)).controls=null,i}return u(n,[{key:"updateAspect",value:function(e){this.aspect=e,this.updateProjectionMatrix()}}]),n}();function Cs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var As=function(e){f(n,THREE.PerspectiveCamera);var t=Cs(n);function n(e){var i;return o(this,n),(i=t.call(this,Or.clampVFOV(ye.dollhouseFOV),window.innerWidth/window.innerHeight,ye.dollhouseNear,ye.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 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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ls=function(e){f(n,THREE.OrthographicCamera);var t=Ds(n);function n(e){var i;o(this,n),i=t.call(this);var r=window.innerWidth/window.innerHeight;return(i=t.call(this,-ye.orthoBase,ye.orthoBase,ye.orthoBase/r,-ye.orthoBase/r,ye.orthoNear,ye.orthoFar)).controls=null,i.updateAspect(r),i}return u(n,[{key:"updateAspect",value:function(e){isNaN(e)&&(e=1),this.aspect=e}}]),n}(),Vs=0,Hs=1,zs=2;function Os(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Fs=function(e){f(n,EventEmitter);var t=Os(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.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}return u(n,[{key:"usable",value:function(){return this.enabled&&!this.locked}},{key:"lookAt",value:function(e){var t=this.camera.position.clone().sub(e),n=Math.atan(t.z/t.x);n+=t.x<0?Math.PI:0,n+=t.x>0&&t.z<0?2*Math.PI:0,this.lon=THREE.MathUtils.radToDeg(n)+180;var i=Math.sqrt(t.x*t.x+t.z*t.z),o=Math.atan(t.y/i);this.lat=-THREE.MathUtils.radToDeg(o)}},{key:"startRotationFrom",value:function(e,t){var n=Ie.handelPadding(e,t,this.dom);Ie.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(Rr,"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(Rr,"pointer"))}},{key:"onMouseDown",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.button){case Vs:this.startRotationFrom(e.clientX,e.clientY)}this.emit(Rr,"mouse")}}},{key:"updateRotation",value:function(){if(this.usable()&&this.pointerDragOn){this.camera.matrixWorld=new THREE.Matrix4;var e=new THREE.Vector3(this.pointerDragStart.x,this.pointerDragStart.y,-1).unproject(this.camera),t=new THREE.Vector3(this.pointer.x,this.pointer.y,-1).unproject(this.camera),n=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.sqrt(t.x*t.x+t.z*t.z),o=Math.atan2(e.y,n),r=Math.atan2(t.y,i);this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.rotationDifference.y=THREE.MathUtils.radToDeg(o-r),e.y=0,t.y=0;var a=Math.acos(e.dot(t)/e.length()/t.length());isNaN(a)||(this.rotationDifference.x=THREE.MathUtils.radToDeg(a),this.pointerDragStart.x<this.pointer.x&&(this.rotationDifference.x*=-1)),this.rotationDifference.multiplyScalar(this.speed),this.pointerDragStart.copy(this.pointer)}}},{key:"onMouseMove",value:function(e){if(this.usable()){var t=Ie.handelPadding(e.clientX,e.clientY,this.dom);Ie.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(Tr,"mouse")}}},{key:"onTouchMove",value:function(e){if(this.usable())switch(this.emit(Tr,"touch"),e.touches.length){case 1:var t=Ie.handelPadding(e.touches[0].clientX,e.touches[0].clientY,this.dom);Ie.convertScreenPositionToNDC(t.x,t.y,this.pointer,this.dom);break;case 2:var n=(e.touches[0].clientX-e.touches[1].clientX)/window.innerWidth,i=(e.touches[0].clientY-e.touches[1].clientY)/window.innerHeight,o=this.pinchDistance-Math.sqrt(n*n+i*i);Math.abs(o)>.01&&(this.emit(Pr),this.emit(Mr,o),this.pinchDistance-=o)}}},{key:"onPointerMove",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.forEach((function(t){e.pointerId===t.id&&(t.clientX=e.clientX,t.clientY=e.clientY)})),e.touches=this.pointers,this.onTouchMove(e))}},{key:"endRotation",value:function(){this.pointerDragOn=!1;var e=le.averageVectors(this.rotationHistory);this.player.$app.VRScreenSYNC?this.rotationSpeed.set(0,0):this.rotationSpeed.set(e.x*Te.rotationAfterMoveMultiplier,e.y*Te.rotationAfterMoveMultiplier)}},{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>Te.rotationAfterMoveHistoryCount;)this.rotationHistory.shift();this.lon+=this.rotationDifference.x,this.lat+=this.rotationDifference.y,this.rotationDifference.set(0,0),this.rotationSpeed.x=this.rotationSpeed.x*(1-Te.rotationFriction)+this.rotationAcc.x*Te.rotationAccelerationInside,this.rotationSpeed.y=this.rotationSpeed.y*(1-Te.rotationFriction)+this.rotationAcc.y*Te.rotationAccelerationInside,this.lon+=this.rotationSpeed.x*e,this.lat+=this.rotationSpeed.y*e,this.lat=Math.max(ye.insideLookLimitDown,Math.min(Te.insideLookLimitUp,this.lat)),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(Pr),this.emit(Sr,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(kr);var n=!0;switch(e){case Fr.LEFTARROW:case Fr.J:t("x",-1);break;case Fr.RIGHTARROW:case Fr.L:t("x",1);break;case Fr.I:t("y",1);break;case Fr.K:t("y",-1);break;default:n=!1}n&&this.emit(Tr,"key")}},{key:"onKeyUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case Fr.LEFTARROW:case Fr.J:case Fr.RIGHTARROW:case Fr.L:this.rotationAcc.x=0;break;case Fr.I:case Fr.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:Ie.toPrecision(this.camera.position.x,4),y:Ie.toPrecision(this.camera.position.y,4),z:Ie.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:Ie.toPrecision(this.camera.quaternion.x,4),y:Ie.toPrecision(this.camera.quaternion.y,4),z:Ie.toPrecision(this.camera.quaternion.z,4),w:Ie.toPrecision(this.camera.quaternion.w,4)}}}},{key:"setStateFromJSON",value:function(e){this.camera.position.copy(e.camera_position),this.camera.quaternion.copy(e.camera_quaternion)}}]),n}(),Ns=-1,Bs=0,Us=1,_s=2,js=3,Ws=4;function Qs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zs=function(e){f(n,EventEmitter);var t=Qs(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).setAutoPanPosition=function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){n.copy(this.camera.position),void 0===e&&null===e||n.setX(e),void 0===t&&null===t||n.setZ(t);var o=this.camera.position.distanceTo(this.target),r=Vector3.FORWARD.clone().applyQuaternion(this.camera.quaternion);this.targetClamped=!1,i.copy(n).addScaledVector(r,o),this.targetBounds.containsPoint(i)||(this.targetBounds.clampPoint(i,i),n.copy(i).addScaledVector(r,-o),this.targetClamped=!0),this.autoPanPosition.x=n.x,this.autoPanPosition.z=n.z,this.autoPan&&this.stopAutoPanning()}}(),a.camera=e,a.camera.controls=h(a),a.player=r,a.enabled=!1,a.target=new THREE.Vector3,a.targetBounds=new THREE.Box3,a.zoomSpeed=1,a.minDistance=0,a.maxDistance=1/0,a.scale=1,a.dollyStart=new THREE.Vector2,a.dollyEnd=new THREE.Vector2,a.dollyDelta=new THREE.Vector2,a.noRotateUpDown=!1,a.rotateSpeed=1,a.keyboardZoomSpeed=0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.minPolarAngle=THREE.MathUtils.degToRad(25),a.maxPolarAngle=THREE.MathUtils.degToRad(65),a.rotationAcceleration=new THREE.Vector2,a.rotationSpeed=new THREE.Vector2,a.rotateStart=new THREE.Vector2,a.rotateEnd=new THREE.Vector2,a.rotateDelta=new THREE.Vector2,a.phiDelta=0,a.thetaDelta=0,a.rotateCenter=new THREE.Vector2,a.rotateStartVec=new THREE.Vector2,a.rotateEndVec=new THREE.Vector2,a.autoPan=!1,a.autoPanPosition=new THREE.Vector3,a.panAcceleration=new THREE.Vector2,a.panSpeed=new THREE.Vector2,a.panStart=new THREE.Vector2,a.panEnd=new THREE.Vector2,a.panDelta=new THREE.Vector2,a.panOffset=new THREE.Vector3,a.panVector=new THREE.Vector3,a.offset=new THREE.Vector3,a.lastPosition=new THREE.Vector3,a.state=Ns,a.mouseActions={},a.mouseActions[Vs]=Bs,a.mouseActions[Hs]=Us,a.mouseActions[zs]=_s,a.touchActions={},a.touchActions[1]=Bs,a.touchActions[2]=Ws,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!==Ns}},{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?Ar:e?Ir:Cr)}},{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-Te.panFriction).addScaledVector(this.panAcceleration,Te.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){e||(e=1/60);var n=Math.min(1,Te.rotationFriction*e*60);this.rotationSpeed.multiplyScalar(1-n).addScaledVector(this.rotationAcceleration,Te.rotationAccelerationOutside*e),this.rotateLeft(-this.rotationSpeed.x),this.noRotateUpDown||this.rotateUp(this.rotationSpeed.y),this.updatePan(e);var i=this.camera.position;this.offset.copy(i).sub(this.target);var o=Math.atan2(this.offset.x,this.offset.z),r=Math.atan2(Math.sqrt(this.offset.x*this.offset.x+this.offset.z*this.offset.z),this.offset.y);this.autoRotate&&this.rotateLeft(this.getAutoRotationAngle()),o+=this.thetaDelta,r+=this.phiDelta,r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(this.angle,Math.min(Math.PI-this.angle,r)),this.lon=o,this.lat=r;var a=this.updateZoom();a=Math.max(this.minDistance,Math.min(this.maxDistance,a)),this.target.add(this.panVector),this.targetBounds.clampPoint(this.target,this.target),this.offset.x=a*Math.sin(r)*Math.sin(o),this.offset.y=a*Math.cos(r),this.offset.z=a*Math.sin(r)*Math.cos(o),i.copy(this.target).add(this.offset),this.camera.lookAt(this.target),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.panVector.set(0,0,0),this.lastPosition.distanceTo(this.camera.position)>0&&this.lastPosition.copy(this.camera.position)}}},{key:"getAutoRotationAngle",value:function(){return 2*Math.PI/60/60*this.autoRotateSpeed}},{key:"getZoomScale",value:function(){return Math.pow(.95,this.zoomSpeed)}},{key:"onMouseDown",value:function(e){if(this.enabled){switch(e.preventDefault(),this.stopAutoPanning(),this.mouseDown=!0,this.state=this.mouseActions[e.button],this.state){case Bs:this.rotateStart.set(e.clientX,e.clientY),this.rotationSpeed.set(0,0),this.noRotateUpDown&&(this.rotateCenter=De.getPos2d(this.target,this.player).pos,this.rotateStartVec.subVectors(this.rotateStart,this.rotateCenter));break;case Us:this.dollyStart.set(e.clientX,e.clientY);break;case _s:this.panStart.set(e.clientX,e.clientY)}this.emit(Rr,"mouse")}}},{key:"onMouseMove",value:function(e){if(this.enabled&&this.mouseDown&&0!==e.buttons){switch(e.preventDefault(),this.state){case Bs:if(this.rotateEnd.set(e.clientX,e.clientY),this.noRotateUpDown){this.rotateEndVec.subVectors(this.rotateEnd,this.rotateCenter);var t=Ie.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 Us: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 _s: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(Tr,"mouse"),this.lastMoveTime=e.timeStamp,this.update();var o={};o.quaternion={_w:this.camera.quaternion._w,_x:this.camera.quaternion._x,_y:this.camera.quaternion._y,_z:this.camera.quaternion._z},o.position={x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},o.target={x:this.target.x,y:this.target.y,z:this.target.z},this.player.emit(Ko,{info:o,mode:this.player.mode,type:"moveModel"})}}},{key:"onMouseUp",value:function(e){this.enabled&&(this.mouseDown=!1,this.state=Ns,"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&&Te.useWheel){this.emit(Tr,"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===Ue.FLOORPLAN?(i.scale=this.absoluteScale,this.player.emit(Ko,{info:i,mode:Ue.FLOORPLAN,type:"moveModel"})):this.player.mode===Ue.DOLLHOUSE&&(i.quaternion=this.camera.quaternion,i.position=this.camera.position,i.target=this.target,this.player.emit(Ko,{info:i,mode:Ue.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 Fr.UPARROW:case Fr.I:this.navRotationAcc("y",1);break;case Fr.DOWNARROW:case Fr.K:this.navRotationAcc("y",-1);break;case Fr.LEFTARROW:case Fr.J:this.navRotationAcc("x",-1);break;case Fr.RIGHTARROW:case Fr.L:this.navRotationAcc("x",1);break;case Fr.W:this.navPanAcc("y",1);break;case Fr.S:this.navPanAcc("y",-1);break;case Fr.A:this.navPanAcc("x",-1);break;case Fr.D:this.navPanAcc("x",1);break;default:t=!1}t&&this.emit(Tr,"key")}},{key:"onKeyUp",value:function(e){this.enabled&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case Fr.I:case Fr.K:case Fr.UPARROW:case Fr.DOWNARROW:this.keyboardZoomSpeed=0,this.rotationAcceleration.y=0;break;case Fr.J:case Fr.L:case Fr.LEFTARROW:case Fr.RIGHTARROW:this.rotationAcceleration.x=0;break;case Fr.S:case Fr.W:this.panAcceleration.y=0;break;case Fr.A:case Fr.D:this.panAcceleration.x=0}}},{key:"onTouchStart",value:function(e){if(this.enabled||this.state===Ns){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(le.average(e.touches,"pageX"),le.average(e.touches,"pageY"))}.bind(this),i=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.rotateStartVec.subVectors(t,n),this.rotateStart=t,this.rotateCenter=De.getPos2d(this.target,this.player).pos}else this.rotateStart.set(le.average(e.touches,"pageX"),le.average(e.touches,"pageY"))}.bind(this);switch(this.state=this.touchActions[e.touches.length],this.state){case Ws:t();case _s:n();break;case js:t();case Bs:i()}this.rotationSpeed.set(0,0),this.emit(Rr,"touch")}}},{key:"onTouchMove",value:function(e){if(this.enabled&&this.state!==Ns){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(){this.panEnd.set(le.average(e.touches,"pageX"),le.average(e.touches,"pageY")),this.panDelta.subVectors(this.panEnd,this.panStart),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.rotateDelta.set(0,0)}.bind(this),i=function(t,n){var i=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),o=i.clone().rotateAround(this.rotateCenter,n).clone().sub(this.rotateCenter).multiplyScalar(1/t),r=this.rotateCenter.clone().sub(this.rotateStart);this.panDelta.addVectors(o,r),this.pan(this.panDelta.x,this.panDelta.y),this.rotateStart=i}.bind(this),o=function(){if(this.noRotateUpDown){var t=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),n=new THREE.Vector2(e.touches[1].pageX,e.touches[1].pageY);this.rotateEndVec.subVectors(t,n);var i=Ie.getVec2Angle(this.rotateStartVec,this.rotateEndVec),o=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),r=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);return o.clone().cross(r).z<0&&(i*=-1),this.rotateLeft(i),this.rotateStartVec.copy(this.rotateEndVec),i}this.rotateEnd.set(le.average(e.touches,"pageX"),le.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 Ws:t();case _s:n();break;case js:i(t(),o());break;case Us:t();break;case Bs:o();break;default:this.state=Ns}this.lastMoveTime=e.timeStamp,this.emit(Tr,"touch");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(Ko,{info:r,mode:this.player.mode,type:"moveModel"})}}},{key:"onTouchEnd",value:function(e){this.enabled&&(this.state===Bs&&(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=Ns,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(Rr,"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=Ns,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:Ie.toPrecision(this.camera.position.x,4),y:Ie.toPrecision(this.camera.position.y,4),z:Ie.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:Ie.toPrecision(this.camera.quaternion.x,4),y:Ie.toPrecision(this.camera.quaternion.y,4),z:Ie.toPrecision(this.camera.quaternion.z,4),w:Ie.toPrecision(this.camera.quaternion.w,4)}}}}]),n}();function Gs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var qs=function(e){f(n,e);var t=Gs(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this,e,i,r)).minPolarAngle=Te.dollhouseDefault.minPolarAngle,a.maxPolarAngle=Te.dollhouseDefault.maxPolarAngle,a.minDistance=Te.dollhouseDefault.minDistance,a.maxDistance=Te.dollhouseDefault.maxDistance,a.adjustedMinDistance=a.minDistance,a.adjustedMaxDistance=a.maxDistance,a.dom=i,a}return u(n,[{key:"pan",value:function(e,t){this.camera.updateMatrix();var n=this.camera.position.clone().sub(this.target).length();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)){var n=this.player.model.boundingBox;if(e<=this.camera.suitModelAspect){var i=Or.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=1.2*this.suitableDistance,this.adjustedMinDistance=.5*this.suitableDistance,this.resetRanges(),this.enabled&&(this.scale=this.suitableDistance/t)}}},{key:"resetRanges",value:function(e,t){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=Te.dollhouseDefault.minPolarAngle,this.maxPolarAngle=Te.dollhouseDefault.maxPolarAngle)}},{key:"toJSON",value:function(){return Zs.prototype.toJSON.call(this)}}]),n}(Zs);function Ys(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var $s=function(e){f(n,e);var t=Ys(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this,e,i,r)).minDistance=15,a.maxDistance=100,a.noRotateUpDown=!0,a.minPolarAngle=0,a.maxPolarAngle=0,a.mouseActions[Vs]=_s,a.mouseActions[Hs]=Us,a.mouseActions[zs]=Bs,a.touchActions[1]=_s,a.touchActions[2]=js,a.absoluteScale=1,a.currentScale=1,a.dom=i,a.$app=r.$app,a.plane=null,a.cadSize=null,a.floorTexture=null,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||(n=this.$app.store.getValue("metadata").floorPlanAngle,n=parseFloat(n)),e=e.clone().applyEuler(new THREE.Euler(0,n,0));var i=Math.max(Math.abs(e.x),Math.abs(e.z)*this.camera.aspect),o=Math.min(window.innerWidth-400,window.innerHeight-200);return t=null!=t&&null!=t?t:Math.max(2*o/800,2),i/2/Te.orthoBase*t}},{key:"rotateToView",value:function(e,t){var n=0,i=he.aspectRatio()<1,o=e.x<e.z,r=this.$app.store.getValue("metadata");n=void 0!==r.floorPlanAngle?2*Math.PI-1*parseFloat(r.floorPlanAngle):i===o?0:Math.PI/2,this.rotateLeft(n),this.update(0)}},{key:"pan",value:function(e,t){this.camera.updateMatrix(),this.panLeft(e*(this.camera.right-this.camera.left)/this.player.domElement.clientWidth),this.panUp(-t*(this.camera.top-this.camera.bottom)/this.player.domElement.clientHeight)}},{key:"updateZoom",value:function(){this.absoluteScale*=this.scale-.03*this.keyboardZoomSpeed,this.absoluteScale=Math.max(Te.zoomNearLimit,Math.min(this.absoluteScale,Te.zoomFarLimit)),this.currentScale=.8*this.currentScale+.2*this.absoluteScale;var e=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;return this.camera.left=-Te.orthoBase*this.currentScale*e,this.camera.right=Te.orthoBase*this.currentScale*e,this.camera.top=Te.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.bottom=-Te.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.updateProjectionMatrix(),this.offset.length()}},{key:"updateDirect",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.left=-e.width/2,this.camera.right=e.width/2,this.camera.top=e.height/2,this.camera.bottom=-e.height/2,this.camera.updateProjectionMatrix(),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y),this.updateForCad=!0}},{key:"updateForRotateCad",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y);var i=this.$app.core.get("Player").model;this.absoluteScale=this.getDefaultAbsoluteScale(i.size,null,e.floorPlanAngle),this.currentScale=this.absoluteScale;var o=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;this.camera.left=-Te.orthoBase*this.currentScale*o,this.camera.right=Te.orthoBase*this.currentScale*o,this.camera.top=Te.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.bottom=-Te.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.updateProjectionMatrix(),this.updateForCad=!0}},{key:"recoverToUpdate",value:function(){this.updateForCad=!1,this.target.copy(this.camera.position),this.target.setY(this.camera.position.y-1);var e=this.$app.store.getValue("metadata"),t=parseFloat(e.floorPlanAngle||0);this.thetaDelta=t,this.absoluteScale=this.currentScale=this.camera.right/Te.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=Zs.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){Te.zoomNearLimit,Math.min(this.absoluteScale,Te.zoomFarLimit);var t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z)/2/Te.orthoBase;n=Math.max(.1,n),Te.zoomFarLimit=parseInt(10*n),Te.zoomNearLimit=Te.zoomFarLimit/100,console.log("setZoomBounds",Te.zoomNearLimit,Te.zoomFarLimit)}}]),n}(Zs);function Xs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("CameraControls",(function(){return function(e){f(n,EventEmitter);var t=Xs(n);function n(){var e;return o(this,n),(e=t.call(this)).activeControl=null,e.controls={},e.cameras={},e}return u(n,[{key:"init",value:function(e,t){this.setUpControls(e,t),this.bindEvents(e)}},{key:"activateControls",value:function(e){this.activeControl&&(this.activeControl.reset(),this.activeControl.enabled=!1),this.controls[e]&&(this.controls[e].enabled=!0),this.activeControl=this.controls[e]}},{key:"setUpControls",value:function(e,t){var n={},i={},o=(t=t||[Ue.PANORAMA,Ue.DOLLHOUSE,Ue.FLOORPLAN],[Is,As,Ls]),r=[Fs,qs,$s];t.forEach(function(t,a){n[t]=new o[a](e),i[t]=new r[a](n[t],e,this.$app.core.get("Player")),i[t].on(Tr,this.emit.bind(this,Tr)),i[t].on(Rr,this.emit.bind(this,Rr)),i[t].on(Pr,this.emit.bind(this,Pr)),i[t].on(kr,this.emit.bind(this,kr)),i[t].on(Mr,this.emit.bind(this,Mr)),i[t].on(Sr,this.emit.bind(this,Sr))}.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)),Te.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(Br,function(e){this.setModelForControls(e.model)}.bind(this)),this.on("syncCadAnd3D",(function(e){t.controls[Ue.FLOORPLAN].updateDirect(e)})),this.on("syncCadAnd3DForRotate",(function(e){t.controls[Ue.FLOORPLAN].updateForRotateCad(e)}))}},{key:"setModelForControls",value:function(e){var t=e.boundingBox.clone().expandByScalar(Te.modelBoundsPadding);[Ue.DOLLHOUSE,Ue.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?le.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?le.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 Js="panovideo.canplay",Ks="panovideo.start",el="panovideo.resume",tl="panovideo.pause",nl="panovideo.stop",il="panovideo.switch";function ol(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 rl(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 rl(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function rl(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 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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var sl=function(e){f(n,EventEmitter);var t=al(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}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;if((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.zIndex="1000",t.style.width="300px",t.style.height="300px",t.style.display=he.urlHasValue("debug")?"block":"none",this.domElement.appendChild(t),!n.videoReady){n.videoReady=!0,window.listener=window.document.body,window.listener.addEventListener("touchstart",(function e(){t.play(),t.pause(),window.listener.removeEventListener("touchstart",e,!1)}),!1)}return t}},{key:"_onCanPlay",value:function(){this.emit(Js)}},{key:"_onPlaying",value:function(){var e=this;this.emit(il,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.5&&(e.emit(el),e.video.ontimeupdate=null,e.isFirstPlay=!1)},this.isFirstPlay&&this.emit(Ks)}},{key:"_onPause",value:function(e){this.video&&(this.video._isPaused=!0),this.emit(tl)}},{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=ol(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){var t=this._resource.get(e);t&&(t.video.autoplay=!0,t.video.onplaying=this._onPlaying.bind(this),t.video.onpause=this._onPause.bind(this),t.video.oncanplay=this._onCanPlay.bind(this),this.video=t.video,this.texture=t.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.isFirstPlay||!e._isCanplay)if(he.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,he.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.onDomElementTouchEnd.bind(this)):he.detectIOS()?this.domElement.addEventListener("touchstart",this.onDomElementTouchStart.bind(this)):this.domElement.addEventListener("mousedown",this.onDomElementMouseDown.bind(this));else e.play()}},{key:"pause",value:function(){this.video&&(this.video._isPaused=!0,this.video.pause())}},{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=ol(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}},{key:"onDomElementTouchStart",value:function(){this.isMuted||(this.video.muted=!1,this.domElement.removeEventListener("touchstart",this.onDomElementTouchStart))}},{key:"onDomElementTouchEnd",value:function(){this.isMuted||(this.video.muted=!1,this.domElement.removeEventListener("touchend",this.onDomElementTouchEnd))}},{key:"onDomElementMouseDown",value:function(){this.isMuted||(this.video.muted=!1,this.domElement.removeEventListener("mousedown",this.onDomElementMouseDown))}}]),n}();function ll(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 cl(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 cl(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function cl(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 ul(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}sl.videoReady=!1;var hl,dl,pl=function(e){f(n,EventEmitter);var t=ul(n);function n(e,r){var a;return o(this,n),(a=t.call(this)).domElement=e,a.instances=new Map,r.forEach((function(e,t){a.instances.set(t,a._createVideo(e.flv.url))})),a.video=null,a.texture=new i.VideoTexture(document.createElement("video")),a.texture.minFilter=i.LinearFilter,a.isFirstPlay=!0,a.isMuted=!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.zIndex="1000",t.style.width="200px",t.style.display=he.urlHasValue("debug")?"block":"none",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(il,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.2&&(e.emit(el),e.isFirstPlay&&e.emit(Ks),e.isFirstPlay=!1,e.video.ontimeupdate=null)}}},{key:"_onPause",value:function(){this.emit(tl),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=new i.VideoTexture(this.video),this.texture.minFilter=i.LinearFilter,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(),he.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.onDomElementTouchEnd.bind(this)):he.detectIOS()?this.domElement.addEventListener("touchstart",this.onDomElementTouchStart.bind(this)):this.domElement.addEventListener("mousedown",this.onDomElementMouseDown.bind(this))):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=ll(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}},{key:"onDomElementTouchStart",value:function(){this.setMuted(!1),this.domElement.removeEventListener("touchstart",this.onDomElementTouchStart)}},{key:"onDomElementTouchEnd",value:function(){this.setMuted(!1),this.domElement.removeEventListener("touchstart",this.onDomElementTouchEnd)}},{key:"onDomElementMouseDown",value:function(){this.setMuted(!1),this.domElement.removeEventListener("mousedown",this.onDomElementMouseDown)}}]),n}();function fl(){dl={version:1,upPath:"",videoPath:hl.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 ml=null;function vl(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 gl={handle:function(e,t){hl=t,dl||fl();var n="";if(void 0!==e.version&&(n="?imagesVersion="+e.version),!e.videos)return e.videos={version:dl.version,videos:dl.videoInfos,parameters:dl.parameters},void vl(dl,e.videosUser,n);try{var i=e.videos;if(!i.data||!i.data.length)return e.videos={version:dl.version,videos:dl.videoInfos,parameters:dl.parameters},void vl(dl,e.videosUser,n)}catch(e){console.error(e)}var o,r=e.sceneFrom||"pro";if("pro"==r){var a=e.videos,s=a.version||0;return dl.version=s,dl.parameters.cameraType=8,1==s?a.data.forEach((function(e){dl.videoInfos.set(e.id,{mp4:{url:dl.videoPath+e.id+".mp4"+n},mpeg:{url:dl.videoPath+e.id+".ts",size:e.tsSize+n},flv:{url:dl.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){dl.videoInfos.set(e.id,{mp4:{url:dl.videoPath+e.id+".mp4"+n},mpeg:{url:dl.videoPath+e.id+".ts"+n,size:e.tsSize},flv:{url:dl.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:1,cameraType:8,blend_fov:e.blend_fov||5})})),(o=a.upPath,ml||(ml=new Promise((function(e,t){o||t("找不到参数请求地址"),Vn.getText(o).then((function(t){return e(t)})).catch((function(e){return t(e)}))})).then((function(e){var t=e.split(/\n/).filter((function(e){return""!=e.trim()})).map((function(e){return e.split(":")})),n=Number(t[0][1]),i=Number(t[1][1]),o=t[2][1].trim().split(/\s+/).map((function(e){return Number(e)})),r=t[7][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],a=t[8][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],s=t[9][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3];return dl.parameters.focal=n,dl.parameters.pixel=i,dl.parameters.centerX=o[0],dl.parameters.centerY=o[1],dl.parameters.translateX=r,dl.parameters.translateY=a,dl.parameters.translateZ=s,dl})).catch((function(e){return console.warn("球幕视频【八目】:参数文件加载失败",e),dl})).finally((function(){return dl})))).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},vl(t,e.videosUser,n),t})).catch((function(e){throw e}))}if("lite"==r){var l=e.videos,c=l.version||0;dl.version=c,dl.parameters.cameraType=2;var u="";return void 0!==e.version&&(u="?imagesVersion="+e.version),1==c&&l.data.forEach((function(e){dl.videoInfos.set(e.id,{mp4:{url:dl.videoPath+e.id+".mp4"+u},mpeg:{url:dl.videoPath+e.id+".ts",size:e.tsSize+u},flv:{url:dl.videoPath+e.id+".flv"+u},exposure:Number(e.value)||1,mapping:1,cameraType:2,blend_fov:e.blend_fov||5})})),function(e){return ml||(ml=new Promise((function(t,n){e||n("找不到参数请求地址"),Vn.getText(e,null,(function(e){t(e)}),(function(e){n(e)}))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),dl.parameters.focal=t.focal,dl.parameters.centerX=t.cx,dl.parameters.centerY=t.cy,dl.parameters.translateX=t.tx,dl.parameters.translateY=t.ty,dl.parameters.translateZ=t.tz,dl})).catch((function(e){return console.warn("球幕视频【双目】:参数文件加载失败"),dl})).finally((function(){return dl})))}(l.upPath).then((function(t){return 1==c&&(t.parameters.inputWidth=3e3,t.parameters.inputHeight=3e3,t.parameters.outputWidth=4096,t.parameters.outputHeight=2048,t.parameters.pixel=1.12),e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},t})).catch((function(e){throw e}))}if("minion"==r){var h=e.videos,d=h.version||0;dl.version=d,dl.parameters.cameraType=3;var p="";return void 0!==e.version&&(p="?imagesVersion="+e.version),h.data.forEach((function(e){dl.videoInfos.set(e.id,{mp4:{url:dl.videoPath+e.id+".mp4"+p},mpeg:{url:dl.videoPath+e.id+".ts",size:e.tsSize+p},flv:{url:dl.videoPath+e.id+".flv"+p},exposure:Number(e.value)||1,mapping:1,cameraType:3,blend_fov:e.blend_fov||5})})),function(e){return ml||(ml=new Promise((function(t,n){e||n("找不到参数请求地址"),t(Vn.getText(e))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),dl.parameters.focal=t.focal,dl.parameters.centerX=t.cx,dl.parameters.centerY=t.cy,dl.parameters.translateX=t.rx,dl.parameters.translateY=t.ry,dl.parameters.translateZ=t.rz,dl})).catch((function(e){return console.warn("球幕视频【转台】:参数文件加载失败",e),dl})).finally((function(){return dl})))}(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},vl(t,e.videosUser,p),t})).catch((function(e){throw e}))}console.warn("有尚不支持的相机来源:",r)},getEnvironment:function(){dl||fl();var e="PC",t="H5";return he.detectAndroidMobile()?e="Android":he.detectIOS()&&(e="Ios"),he.detectWeixin()&&(t="WeChat",navigator.userAgent.match("miniProgram")&&(t="WeChatMiniprogram")),{os:e,environment:t}}},yl=0,wl=1;function bl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function El(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("PanoVideoRenderer",(function(){return function(e){f(n,EventEmitter);var t=bl(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=yl,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(jt.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:jt.videoLoading.vertexShader,fragmentShader:jt.videoLoading.fragmentShader,transparent:!0})),e.loadingUI.visible=!1,e}return u(n,[{key:"init",value:function(e){var t=this;this.videosInfo=e,e?(this.version=e.version,this.$app.core.get("Player").on("guide/play/start",(function(e){t.isGuiding=!0,t.setMuted(!0)})),this.$app.core.get("Player").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,(he.detectIE()||navigator.userAgent.match("JSN-AL00"))&&(this.ready=!1,console.warn("浏览器不支持球幕视频")),this.$app.core.get("SceneRenderer").scene.add(this.loadingUI)):Le.warn("PanoVideoRenderer初始化失败,数据为空")}},{key:"initVideoPlayer",value:function(e,t){var n=gl.getEnvironment(),i=n.os,o=n.environment;this.videoPlayer="Android"==i&&"WeChat"==o?new pl(e,t):new sl(e,t),this.videoPlayer.on(Js,this.onVideoCanPlay.bind(this)),this.videoPlayer.on(Ks,this.onVideoStartPlay.bind(this)),this.videoPlayer.on(il,this.onVideoSwitch.bind(this)),this.videoPlayer.on(el,this.onVideoResume.bind(this)),this.videoPlayer.on(tl,this.onVideoPause.bind(this)),this.videoPlayer.on(nl,this.onVideoStop.bind(this))}},{key:"activatePanorama",value:function(e){var t=this;e.hasVideo&&this.ready&&(this.activePanorama=e,this.started=!0,this.videoPlayer.startVideo(e.id),this.loadingUITimer=setTimeout((function(){t.showLoading(e),window.clearTimeout(t.loadingUITimer)}),500))}},{key:"deactivePanorama",value:function(e){null!=e&&null!=e.id&&this.videoPlayer.pauseVideo(e.id),this.activePanorama=null}},{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(xs)}},{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(ks)}},{key:"onVideoStartPlay",value:function(){this.emit(Rs)}},{key:"onVideoSwitch",value:function(e){this.texture=e,this.emit(Ps,e)}},{key:"onVideoResume",value:function(){this._state=wl,this.emit(Ts),this.hideLoading()}},{key:"onVideoPause",value:function(){this._state=yl,this.emit(xs)}},{key:"onVideoStop",value:function(){this._state=yl,this.emit(xs)}},{key:"ifEnable",value:function(){return this.ready}}]),n}()})),Re("DisplayController",(function(){return function(e){f(n,EventEmitter);var t=El(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(rr,this.handlePlayerFlyingStarted.bind(this)),this.$app.core.get("Player").on(ar,this.handlePlayerFlyingEnded.bind(this)),this.$app.core.get("Player").on(tr,this.handlePlayerModeChanging.bind(this)),this.$app.core.get("Player").on(er,this.handlePlayerModeChanged.bind(this)),this.$app.core.get("Player").on(ir,this.handleClosestPanoChanging.bind(this)),this.$app.core.get("Player").on(lr,this.handleStartInside.bind(this)),this.$app.core.get("Player").on(cr,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;this.panoVideoRenderer.setMuted(!1),t&&this.model.mode==Ue.PANORAMA&&this.panoVideoRenderer.activatePanorama(t)}},{key:"handlePlayerModeChanging",value:function(e,t,n){var i,o=this.$app.core.get("ModelManager").getActiveModel();i=this.$app.core.get("Player").is360View(t,n)?0:Te[t].markerOpacity,o.fadePanoMarkers(i),o.setMode(t)}},{key:"handlePlayerModeChanged",value:function(e,t){var n=this.$app.core.get("ModelManager").getActiveModel(),i=t===Ue.PANORAMA?THREE.DoubleSide:THREE.FrontSide;n.setSide(i),n.setMode(t)}},{key:"handleClosestPanoChanging",value:function(e,t,n){n!==Ue.TRANSITIONING&&(e&&e.hoverOff(n),t&&t.hoverOn(n))}},{key:"handleStartInside",value:function(e){var t=Te[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(ut.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.chunks.forEach((function(e){return e.visible=!0})),this.model.panos.forEach((function(e){return e.updateMakerStyle()})))}}]),n}()})),Re("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:Te.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 Ri({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(Rs,this.onVideoStartPlay.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ps,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(Ts,this.onVideoRenderResume.bind(this)),this.$app.core.get("PanoVideoRenderer").on(xs,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.controls.locked=!0,this.controls.limitDownAngel=this.controls.lat,this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion)}},{key:"load",value:function(e){var t=this;if(this.loadPromise)return this.loadPromise;var n=this.$app.store.__store.metadata;if(this.view=e,this.view.pano.shouldRedrawOnBaseLoaded=!0,this.view.pano.tiled){this.init(e,n);var i=document.querySelector(".player[name=main]"),o=this.qualityManager.getPanoSize(yt),r=this.qualityManager.getPanoSize(wt),a=Or.getHFOVForCamera(this.quickStartcamera,i.clientWidth,i.clientHeight),s=this.quickStartcamera.fov,l=_e.FORWARD.clone().applyQuaternion(this.view.quaternion),c=this.view.pano.loadTiledPano(r,l,{hFov:a,vFov:s},!1,!1,!0),u=this.view.pano.loadTiledPano(o,l.clone().negate(),null,!1,!1,!0);this.loadPromise=new Promise((function(e){(t.view.pano.hasVideo?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)})),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&&he.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"==he.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(ut.property(this.quickStartcamera,"fov",70),3e3,(function(){t.unlockHanlde&&t.unlockHanlde(),t.locked=!1,t.enter=!0,t.controls.locked=!1,t.controls.rotationAcc.set(0,0),t.controls.limitDownAngel=null;try{parent.postMessage({num:config.projectNum,cmd:"unlocked",isParent:top==self},"*")}catch(e){console.error("跨域",e)}}),0,de.easeOutCubic)}}},{key:"exit",value:function(){this.enter=!1,this.pano.enter(),this.controls.rotationAcc.set(0,0),this.controls.limitDownAngel=null,this.animFov&&pe.cancel(this.animFov),this.app.player.model?this.app.player.flyToPano({pano:this.pano}):this.smoothLookAt(this.initTarget,1e3)}},{key:"smoothLookAt",value:function(e,t){var n=this;t=t||1e3;var i=e.clone().sub(this.controls.camera.position).normalize(),o=this.controls.lookVector.clone(),r=new THREE.Vector3;new THREE.Vector3;this.animFov=pe.start((function(e){r.lerpVectors(o,i,e),n.controls.lookAt(r.add(n.controls.camera.position))}),t)}},{key:"cancelRotate",value:function(){this.enter&&this.app.startOption.needUnlock&&this.controls.rotationAcc.set(0,0)}},{key:"update",value:function(e){this.locked,this.controls.update(e),this.camera.position.copy(this.quickStartcamera.position),this.camera.quaternion.copy(this.quickStartcamera.quaternion),this.camera.fov=this.quickStartcamera.fov,this.camera.updateProjectionMatrix(),this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion),this.view.fov=this.quickStartcamera.fov}},{key:"setSize",value:function(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}},{key:"destroy",value:function(){this.scene.remove(this.skybox),this.controls.rotationAcc.set(0,0)}},{key:"attachDom",value:function(e){e.addEventListener("touchstart",this.onTouchStart.bind(this)),e.addEventListener("touchmove",this.onTouchMove.bind(this)),e.addEventListener("touchend",this.onTouchEnd.bind(this))}},{key:"onTouchEvent",value:function(e,t){"touchstart"==t.type?this.onTouchStart(t):"touchmove"==t.type?this.onTouchMove(t):"touchend"==t.type&&this.onTouchEnd(t)}},{key:"onTouchStart",value:function(e){this.touchStartPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveDelta.set(0,0),this.touchMoveOffset.set(0,0),this.enter||0==this.app.needUnlock?(this.controls.rotationAcc.set(0,0),this.controls.onTouchStart(e)):this.canEnter=!1,this._start={x:e.touches[0].clientX,y:e.touches[0].clientY}}},{key:"onTouchMove",value:function(e){if(this._move={x:e.touches[0].clientX,y:e.touches[0].clientY},this.touchMoveDelta.set(e.touches[0].clientX-this.touchPrevPosition.x,e.touches[0].clientY-this.touchPrevPosition.y),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveOffset.set(e.touches[0].clientX-this.touchStartPosition.x,e.touches[0].clientY-this.touchStartPosition.y),this.enter||0==this.app.needUnlock)this.controls.onTouchMove(e);else{var t=-this.touchMoveDelta.x;Math.abs(this.getAngle(this._start,this._move))<15&&0==this.enter&&this.unlock(new THREE.Vector2(t,0))}}},{key:"onTouchEnd",value:function(e){(this.enter||0==this.app.needUnlock)&&this.controls.onTouchEnd(e)}},{key:"getAngle",value:function(e,t){var n=t.x-e.x,i=t.y-e.y;return 360*Math.atan(i/n)/(2*Math.PI)}}]),e}()}));var xl={currentBlur:0,aspect:Te.aspect,blurStrength:1,hblurPass:Te.HorizontalBlurShader,vblurPass:Te.VerticalBlurShader,bindEvents(e){e.on(er,(function(e,t){e===Ue.PANORAMA&&(pe.cancel(xl.blur),pe.cancel(xl.addBlur),pe.start(xl.removeBlur,500,null,0,null,"deblur"))}))},blur(e){xl.currentBlur=e;var t=e*xl.blurStrength;Te.VerticalBlurShader.uniforms.v.value=t/512*xl.aspect,Te.HorizontalBlurShader.uniforms.h.value=t/512},addBlur(e){e=Math.max(e,xl.currentBlur),xl.blur(e)},removeBlur(e){e=Math.min(1-e,xl.currentBlur),xl.blur(e)}};xl.blur(0);var Tl=function e(t){o(this,e),this.message=t};function Pl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var kl,Rl,Ml,Sl=function(e){f(n,e);var t=Pl(n);function n(e){return o(this,n),t.call(this,e)}return n}(Tl),Il={};Il.Init=function(e,t){if(Rl=t,(kl=e).renderer&&!kl.newRenderer&&!Ml){var n=le.loadTextureFromCache(zn.getImageURL("images/circleMarker.png"));Rl.model.panos.list.forEach((function(e){e.createVrMarker(n,Rl)})),kl.newRenderer=new Vl(kl.renderer,kl,kl.camera),kl.isHuawei5X=he.detectHUAWEI5X(),kl.oldRenderer=kl.renderer;var i=!1,o=!1;Object.defineProperty(Te,"vrEnabled",{get:function(){return i},set:function(e){if((e=!!e)&&Te.vrSplitScreen?(kl.renderer=kl.newRenderer,Rl.cameraControls.cameras.panorama.staticFov=70):(kl.renderer=kl.oldRenderer,Rl.cameraControls.cameras.panorama.staticFov=null),i=e,"portrait"!=window.VRScreenType&&(Il.cursor.visible=e,kl.setSize(window.innerWidth,window.innerHeight),Rl.model.updateVrMarker(e,Rl)),Rl.cameraControls.controls.panorama.locked=e,e)Rl.viewLinkManager.hideAllViews(),setTimeout((function(){if(console.log("orientEnable"+window.orientEnable),Te.vrEnabled&&!window.orientEnable&&he.detectIOS()){var e=he.iosVersion();if(12==e.major&&e.minor>=2)window.VRScreenNotFull||(he.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(){Te.vrEnabled&&!window.orientEnable&&(Al("reset"),window.DeviceMotionEvent&&window.DeviceMotionEvent.requestPermission&&"function"==typeof window.DeviceMotionEvent.requestPermission?(console.log("开始获取权限1"),window.DeviceMotionEvent.requestPermission().then((function(e){console.log("permissionState1: "+e),Al("deviceMotion",e)})).catch((function(e){Al("deviceMotion",!1),console.log(e)}))):(console.log("window.DeviceMotionEvent undefined"),Al("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),Al("deviceOrientation",e)})).catch((function(e){Al("deviceOrientation",!1),console.log(e)}))):(console.log("window.DeviceOrientationEvent undefined"),Al("deviceOrientation",!1)))}),t?0:150)}else console.log("陀螺仪未能启用 ios "+e.major+"."+e.minor)}}),200);else{var t=Rl.position,n=(new THREE.Quaternion).copy(Rl.camera.quaternion),o=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t);o.x==t.x&&o.z==t.z?console.log("看向正地面时无法lookAt,无法更新camera转向,直接退出vr"):Rl.cameraControls.activeControl.lookAt(o),Rl.viewLinkManager.showAllViews(),Il.shiftQuaternion=null}}}),Object.defineProperty(Te,"vrSplitScreen",{get:function(){return o},set:function(e){o!=(e=!!e)&&(o=e,Te.vrEnabled&&"portrait"!=window.VRScreenType&&(e?(kl.renderer=kl.newRenderer,Rl.cameraControls.cameras.panorama.staticFov=70):(kl.renderer=kl.oldRenderer,Rl.cameraControls.cameras.panorama.staticFov=null),console.log("vrSplitScreen"),kl.setSize(window.innerWidth,window.innerHeight)))}}),90!=window.orientation&&270!=window.orientation||(Te.vrSplitScreen=!0),Dl(.5,!0,1,16777215,0);var r={setSize:function(e,t){kl.camera.aspect=e/t}};kl.resizeListeners.push(r),Ml=!0}};var Cl={},Al=function(e,t){"reset"==e?Cl={}:(Cl[e]=t,2!=Object.keys(Cl).length||"granted"==Cl.deviceMotion&&"granted"==Cl.deviceOrientation||console.error("运动和方向访问失败"))},Dl=function(e,t,n,i,o){var r,a=new THREE.SpriteMaterial({opacity:n,color:i,transparent:t,map:zl(zn.getImageURL("images/vrCursor.png")),side:THREE.DoubleSide});a.map.offset=new THREE.Vector2(1/17*o,0),a.map.repeat=new THREE.Vector2(1/17,1),a.depthTest=!1,a.blending=THREE.AdditiveBlending,(r=new THREE.Sprite(a)).scale.set(e,e,e),r.position.z=-5,r.visible=!1,r.name="cursor",r.renderOrder=tt,kl.camera.add(r),kl.scene.add(kl.camera),Il.cursor=r;var s=new Ll(kl.scene,r,kl.camera);Il.cursor.triggerTargetEvent=s.triggerTargetEvent,kl.updateListeners=[s].concat(kl.updateListeners)};window.orientEnable=0;var Ll=function(e,t,n){this.cursor=t,this.raycaster=new THREE.Raycaster,this.targetEventObj={},this.type=1,this.canStartAnimation=!0;var i=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.orient=THREE.MathUtils.degToRad(window.orientation||0),window.addEventListener("orientationchange",(function(){i.orient=THREE.MathUtils.degToRad(window.orientation||0)})),window.addEventListener("deviceorientation",(function(e){if(Te.vrEnabled||!window.orientEnable){window.orientEnable||(window.orientEnable=1);var t=THREE.MathUtils.degToRad(e.alpha),n=THREE.MathUtils.degToRad(e.beta),o=THREE.MathUtils.degToRad(e.gamma);this.isHuawei5X?(-1e3===i.alpha&&(i.alpha=t),-1e3===i.beta&&(i.beta=n),-1e3===i.gamma&&(i.gamma=o),Math.abs(t-i.alpha)>.06&&(i.alpha=t),Math.abs(n-i.beta)>.006&&(i.beta=n),Math.abs(o-i.gamma)>.006&&(i.gamma=o)):(i.alpha=t,i.beta=n,i.gamma=o)}})),this.setObjectQuaternion=function(e,t,n,o,r){if(i.euler.set(n,t,-o,"YXZ"),e.setFromEuler(i.euler),e.multiply(i.q1),e.multiply(i.q0.setFromAxisAngle(i.zee,-r)),null==Il.shiftQuaternion){var a=new THREE.Vector3(0,0,-1).applyQuaternion(Rl.camera.quaternion);a.setY(0).normalize();var s=(new THREE.Matrix4).lookAt(new THREE.Vector3,a,new THREE.Vector3(0,1,0)),l=(new THREE.Quaternion).setFromRotationMatrix(s),c=new THREE.Vector3(0,0,-1).applyQuaternion(e);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).invert();Il.shiftQuaternion=l.clone().premultiply(h)}e.premultiply(Il.shiftQuaternion)},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),o=THREE.MathUtils.degToRad(t.beta),r=THREE.MathUtils.degToRad(t.gamma);e?(-1e3===i.alpha&&(i.alpha=n),-1e3===i.beta&&(i.beta=o),-1e3===i.gamma&&(i.gamma=r),Math.abs(n-i.alpha)>.06&&(i.alpha=n),Math.abs(o-i.beta)>.006&&(i.beta=o),Math.abs(r-i.gamma)>.006&&(i.gamma=r)):(i.alpha=n,i.beta=o,i.gamma=r)}(n)}})),this.update=function(e){TWEEN.update(),window.ifTest&&Te.vrEnabled?this.triggerTargetEvent():Te.vrEnabled&&(this.setObjectQuaternion(Rl.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(Rl.model.vrMarkers);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)}},Vl=function(e,t,n){var i=new Hl(n);window.VRCamera=i,i.bananaAspect=.8,this.width,this.height,this.name="vrRenderer";var o=this;this.setSize=function(t,n){e.setSize.call(this,t,n),o.width=t,o.height=n},this.render=function(t,n,o,r){var a,s;if(n.__RESS__SKIP__STEREO__){var l=e.autoClear;return e.autoClear=!1,e.setRenderTarget(o),r&&e.clear(),e.render(t,n),e.setRenderTarget(null),void(e.autoClear=l)}if("PerspectiveCamera"===n.type)a=i.cameraL,s=i.cameraR,t.updateMatrixWorld(),null===n.parent&&n.updateMatrixWorld(),i.vrCameraUpdate(n);else{if("OrthographicCamera"!==n.type)return DEBUG&&console.error("Unsupported renderer: ",n.type);a=s=n}e.setScissorTest(!0),e.setScissor(0,0,this.width/2,this.height),e.setViewport(0,0,this.width/2,this.height),e.render.call(this,t,a,o,r),e.setScissor(this.width/2,0,this.width/2,this.height),e.setViewport(this.width/2,0,this.width/2,this.height),e.render.call(this,t,s,o,r),e.setScissorTest(!1)},this.__proto__={__proto__:e}},Hl=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,console.debug("vrCameraUpdate"),this.bananaFocus=e.focus,this.bananaFov=50,this.bananaReal_aspect=e.aspect*this.bananaAspect,this.bananaNear=e.near,this.bananaFar=e.far,console.debug(e.aspect),this.bananaFocus=10;var t,n,i=e.projectionMatrix.clone(),o=this.overlap/2,r=o*this.bananaNear/this.bananaFocus,a=this.bananaNear*Math.tan(Math.PI/180*this.bananaFov*.5);this.eyeLeft.elements[12]=-o,this.eyeRight.elements[12]=o,t=-a*this.bananaReal_aspect+r,n=a*this.bananaReal_aspect+r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(i),t=-a*this.bananaReal_aspect-r,n=a*this.bananaReal_aspect-r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(this.eyeLeft),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(this.eyeRight)}},zl=function(e){var t=new THREE.TextureLoader;return t.crossOrigin="anonymous",t.load(e)};function Ol(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Fl(e){var t,n,i,o,r,a=Math.floor,s=new Array(64),l=new Array(64),c=new Array(64),u=new Array(64),h=new Array(65535),d=new Array(65535),p=new Array(64),f=new Array(64),m=[],v=0,g=7,y=new Array(64),w=new Array(64),b=new Array(64),E=new Array(256),x=new Array(2048),T=[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],P=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],k=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],M=[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],S=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],I=[0,1,2,3,4,5,6,7,8,9,10,11],C=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],A=[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 D(e,t){for(var n=0,i=0,o=new Array,r=1;r<=16;r++){for(var a=1;a<=e[r];a++)o[t[i]]=[],o[t[i]][0]=n,o[t[i]][1]=r,i++,n++;n*=2}return o}function L(e){for(var t=e[0],n=e[1]-1;n>=0;)t&1<<n&&(v|=1<<g),n--,--g<0&&(255==v?(V(255),V(0)):V(v),g=7,v=0)}function V(e){m.push(e),m.length}function H(e){V(e>>8&255),V(255&e)}function z(e,t,n,i,o){for(var r,a=o[0],s=o[240],l=function(e,t){var n,i,o,r,a,s,l,c,u,h,d=0;for(u=0;u<8;++u){n=e[d],i=e[d+1],o=e[d+2],r=e[d+3],a=e[d+4],s=e[d+5],l=e[d+6];var f=n+(c=e[d+7]),m=n-c,v=i+l,g=i-l,y=o+s,w=o-s,b=r+a,E=r-a,x=f+b,T=f-b,P=v+y,k=v-y;e[d]=x+P,e[d+4]=x-P;var R=.707106781*(k+T);e[d+2]=T+R,e[d+6]=T-R;var M=.382683433*((x=E+w)-(k=g+m)),S=.5411961*x+M,I=1.306562965*k+M,C=.707106781*(P=w+g),A=m+C,D=m-C;e[d+5]=D+S,e[d+3]=D-S,e[d+1]=A+I,e[d+7]=A-I,d+=8}for(d=0,u=0;u<8;++u){n=e[d],i=e[d+8],o=e[d+16],r=e[d+24],a=e[d+32],s=e[d+40],l=e[d+48];var L=n+(c=e[d+56]),V=n-c,H=i+l,z=i-l,O=o+s,F=o-s,N=r+a,B=r-a,U=L+N,_=L-N,j=H+O,W=H-O;e[d]=U+j,e[d+32]=U-j;var Q=.707106781*(W+_);e[d+16]=_+Q,e[d+48]=_-Q;var Z=.382683433*((U=B+F)-(W=z+V)),G=.5411961*U+Z,q=1.306562965*W+Z,Y=.707106781*(j=F+z),$=V+Y,X=V-Y;e[d+40]=X+G,e[d+24]=X-G,e[d+8]=$+q,e[d+56]=$-q,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[T[c]]=l[c];var u=f[0]-n;n=f[0],0==u?L(i[0]):(L(i[d[r=32767+u]]),L(h[r]));for(var m=63;m>0&&0==f[m];m--);if(0==m)return L(a),n;for(var v,g=1;g<=m;){for(var y=g;0==f[g]&&g<=m;++g);var w=g-y;if(w>=16){v=w>>4;for(var b=1;b<=v;++b)L(s);w&=15}r=32767+f[g],L(o[(w<<4)+d[r]]),L(h[r]),g++}return 63!=m&&L(a),n}function O(e){if(e<=0&&(e=1),e>100&&(e=100),r!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var i=a((t[n]*e+50)/100);i<1?i=1:i>255&&(i=255),s[T[n]]=i}for(var o=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],r=0;r<64;r++){var h=a((o[r]*e+50)/100);h<1?h=1:h>255&&(h=255),l[T[r]]=h}for(var d=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,f=0;f<8;f++)for(var m=0;m<8;m++)c[p]=1/(s[T[p]]*d[f]*d[m]*8),u[p]=1/(l[T[p]]*d[f]*d[m]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),r=e}}this.encode=function(e,r){(new Date).getTime(),r&&O(r),m=[],v=0,g=7,H(65496),H(65504),H(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),H(1),H(1),V(0),V(0),function(){H(65499),H(132),V(0);for(var e=0;e<64;e++)V(s[e]);V(1);for(var t=0;t<64;t++)V(l[t])}(),function(e,t){H(65472),H(17),V(8),H(t),H(e),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1)}(e.width,e.height),function(){H(65476),H(418),V(0);for(var e=0;e<16;e++)V(P[e+1]);for(var t=0;t<=11;t++)V(k[t]);V(16);for(var n=0;n<16;n++)V(R[n+1]);for(var i=0;i<=161;i++)V(M[i]);V(1);for(var o=0;o<16;o++)V(S[o+1]);for(var r=0;r<=11;r++)V(I[r]);V(17);for(var a=0;a<16;a++)V(C[a+1]);for(var s=0;s<=161;s++)V(A[s])}(),H(65498),H(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var a=0,h=0,d=0;v=0,g=7,this.encode.displayName="_encode_";for(var p,f,E,T,D,F,N,B,U,_=e.data,j=e.width,W=e.height,Q=4*j,Z=0;Z<W;){for(p=0;p<Q;){for(F=D=Q*Z+p,N=-1,B=0,U=0;U<64;U++)F=D+(B=U>>3)*Q+(N=4*(7&U)),Z+B>=W&&(F-=Q*(Z+1+B-W)),p+N>=Q&&(F-=p+N-Q+4),f=_[F++],E=_[F++],T=_[F++],y[U]=(x[f]+x[E+256>>0]+x[T+512>>0]>>16)-128,w[U]=(x[f+768>>0]+x[E+1024>>0]+x[T+1280>>0]>>16)-128,b[U]=(x[f+1280>>0]+x[E+1536>>0]+x[T+1792>>0]>>16)-128;a=z(y,c,a,t,i),h=z(w,u,h,n,o),d=z(b,u,d,n,o),p+=32}Z+=8}if(g>=0){var G=[];G[1]=g+1,G[0]=(1<<g+1)-1,L(G)}return H(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++)E[t]=e(t)}(),t=D(P,k),n=D(S,I),i=D(R,M),o=D(C,A),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var i=e;i<t;i++)d[32767+i]=n,h[32767+i]=[],h[32767+i][1]=n,h[32767+i][0]=i;for(var o=-(t-1);o<=-e;o++)d[32767+o]=n,h[32767+o]=[],h[32767+o][1]=n,h[32767+o][0]=t-1+o;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)x[e]=19595*e,x[e+256>>0]=38470*e,x[e+512>>0]=7471*e+32768,x[e+768>>0]=-11059*e,x[e+1024>>0]=-21709*e,x[e+1280>>0]=32768*e+8421375,x[e+1536>>0]=-27439*e,x[e+1792>>0]=-5329*e}(),O(e),(new Date).getTime()}window.addEventListener("orientationchange",(function(e){console.log("vr orientation ".concat(window.orientation)),0==window.orientation||180==window.orientation?Te.vrSplitScreen=!1:Te.vrSplitScreen=!0})),new THREE.RawShaderMaterial({fragmentShader:jt.skysphere.fragmentShader,vertexShader:jt.skysphere.vertexShader,uniforms:THREE.UniformsUtils.clone(jt.skysphere.uniforms),side:THREE.BackSide,name:"skysphereBG"}),window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame,Re("SceneRenderer",(function(){return function(e){f(n,EventEmitter);var t=Ol(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(pt),this.camera.layers.enable(ft),this.scene=new THREE.Scene,this.light=new THREE.AmbientLight(16777215),this.scene.add(this.light)},e.addComponent=function(e){this.components.push(e),e.update&&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 Tl("Can't start SceneRenderer, already started");this.createContext(e),this.initComposer(),this.started=!0;try{Il.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}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setClearColor("#292929",1),this.emit(is)}catch(e){throw new Sl("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.effects.currentBlur>0?this.composer.render():this.renderer.render(this.scene,this.camera)},e.updateScreenSize=function(e){var t,n,o,s=!1;e&&!e.resize&&null!=e.width&&null!=e.height?(n=e.width,o=e.height,s=!0,t=1):(n=this.renderer.domElement.parentElement.clientWidth,o=this.renderer.domElement.parentElement.clientHeight,e&&e.resize&&(i=this.renderWidth,r=this.renderHeight),(n!==i||o!==r||this.forceUpdateSize||a!=window.devicePixelRatio)&&(i=n,r=o,s=!0,a=window.devicePixelRatio,t=window.devicePixelRatio)),s&&(this.setSize(n,o,t),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.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&&(window.requestAnimationFrame(this.animate),this.updateScreenSize(),this.updateComponents(),this.render(),this.emit(os))},e.getImageData=function(){var e=document.createElement("canvas"),t=e.getContext("2d");return function(n,i,o){return e.width===i&&e.height===o||(e.width=i,e.height=o),t.drawImage(n,0,0,i,o),t.getImageData(0,0,i,o)}}(),e.initSizedTexture2D=function(e,t,n){var i=this.renderer,o=i.getContext(),r=i.state,a=new THREE.Texture;a.flipY=!1,a.wrapS=t,a.wrapT=t,!0!==n&&(n=!1),a.generateMipmaps=n;var s=i.paramThreeToGL(a.format),l=i.paramThreeToGL(a.type),c=i.properties.get(a),u=o.createTexture();r.bindTexture(o.TEXTURE_2D,u),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,a.flipY),o.texImage2D(o.TEXTURE_2D,0,s,e,e,0,s,l,null);var h=i.paramThreeToGL(t);return o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,h),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,h),n?(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearMipMapLinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_NEAREST),o.generateMipmap(o.TEXTURE_2D)):(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR)),r.bindTexture(o.TEXTURE_2D,null),c.__webglTexture=u,a},e.deallocateCubeTexture=function(e){var t=this.renderer,n=t.context,i=t.properties.get(e);n.deleteTexture(i.__image__webglTextureCube)},e.renderToCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null;return function(a,s,l,c,u,h,d,p,f,m,v,g,y,w,b,E){var x=this.oldRenderer||this.renderer;e||(t=new THREE.Scene,r=new THREE.CubeCamera(.1,1e3,s),t.add(r),n=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"scene",value:null},alpha:{type:"startYinTile",value:1}},vertexShader:jt.basicTextured.vertexShader,fragmentShader:jt.basicTextured.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),i=new THREE.PlaneGeometry(1,1),o=new THREE.Mesh(i,n),t.add(o),e=!0),r.renderTarget=s;var T=i.getAttribute("uv");T.setUsage(THREE.DynamicDrawUsage),T.needsUpdate=!0;var P=T.array,k=u/l,R=h/c,M=d/l,S=p/c;P[0]=k,P[1]=R+S,P[2]=k+M,P[3]=R+S,P[4]=k,P[5]=R,P[6]=k+M,P[7]=R;var I=i.getAttribute("position");I.setUsage(THREE.DynamicDrawUsage),I.needsUpdate=!0;var C=I.array,A=f/s.width-.5,D=m/s.height-.5,L=v/s.width,V=g/s.height;C[0]=A,C[1]=D+V,C[3]=A+L,C[4]=D+V,C[6]=A,C[7]=D,C[9]=A+L,C[10]=D,x.properties.get(t),n.uniforms.tDiffuse.value=a,n.blending=w||THREE.NoBlending,n.transparent=!!b,null!=E||(E=1),n.uniforms.alpha.value=E,n.needUpdate=!0,0==y&&(o.scale.set(-1,-1,1),o.position.set(.5,0,0)),1==y&&(o.scale.set(-1,-1,1),o.position.set(-.5,0,0)),2==y&&(o.scale.set(1,1,1),o.position.set(0,.5,0)),3==y&&(o.scale.set(1,1,1),o.position.set(0,-.5,0)),4==y&&(o.scale.set(-1,-1,1),o.position.set(0,0,.5)),5==y&&(o.scale.set(-1,-1,1),o.position.set(0,0,-.5)),o.lookAt(r.position),s.viewport.set(0,0,s.width,s.height);var H=x.autoClear;x.autoClear=!1,r.update(x,t),x.autoClear=H}}(),e.copyCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null,a=new THREE.Euler;return function(s,l,c,u,h,d,p,f,m){if(!e){t=new THREE.Scene,n=new THREE.CubeCamera(.1,1e3,l),t.add(n),i=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:jt.copyCubeMap.vertexShader,fragmentShader:jt.copyCubeMap.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),o=new THREE.BoxGeometry(2,2,2),(r=new THREE.Mesh(o,i)).scale.set(-1,-1,1),t.add(r),e=!0}n.renderTarget=l;for(var v=0;v<6;v++){this.getCubeOrientationForCubeFace(v,a),r.rotation.copy(a),r.matrixWorldNeedsUpdate=!0,r.updateMatrixWorld(),i.uniforms.tDiffuse.value=s,i.blending=p||THREE.NoBlending,i.transparent=!!f,null!=m||(m=1),i.uniforms.alpha.value=m,i.needUpdate=!0,l.viewport.set(0,0,h,d);var g=this.renderer.autoClear;this.renderer.autoClear=!1,n.update(this.renderer,t),this.renderer.autoClear=g}}}(),e.getCubeOrientationForCubeFace=function(e,t){switch(e){case li:t.set(0,-Math.PI/2,0);break;case ci:t.set(0,Math.PI/2,0);break;case ui:t.set(Math.PI/2,Math.PI,0);break;case hi:t.set(-Math.PI/2,Math.PI,0);break;case di:t.set(0,-Math.PI,0);break;case pi:t.set(0,0,0)}},e.scene=null,e.camera=null,e.light=null,e.renderer=null,e.effects=xl,e.animateCallback=null,e.composer=null,e.qualityManager=null,e.updateClock=new THREE.Clock,e.components=[],e.updateListeners=[],e.resizeListeners=[],e.forceUpdateSize=!1,e.started=!1,e.textures={},e.suspendedObjects=[],e.vrMode=!1,e}return u(n,[{key:"uploadTexture2D",value:function(e,t,n,i,o,r){var a=this.renderer,s=a.getContext(),l=a.state,c=a.properties.get(t);l.bindTexture(s.TEXTURE_2D,c.__webglTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,t.unpackAlignment),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,a.paramThreeToGL(t.wrapS)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,a.paramThreeToGL(t.wrapT)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,a.paramThreeToGL(t.magFilter)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,a.paramThreeToGL(t.minFilter)),s.texSubImage2D(s.TEXTURE_2D,0,n,i,s.RGBA,s.UNSIGNED_BYTE,e),t.generateMipmaps&&s.generateMipmap(s.TEXTURE_2D),l.bindTexture(s.TEXTURE_2D,null)}}]),n}()}));var Nl=function(){var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,n=799,i=3406,o=2276,r=1567,a=3784,s=5793,l=2896;function c(){}function u(e,t){for(var n,i,o=0,r=[],a=16;a>0&&!e[a-1];)a--;r.push({children:[],index:0});var s,l=r[0];for(n=0;n<a;n++){for(i=0;i<e[n];i++){for((l=r.pop()).children[l.index]=t[o];l.index>0;){if(0===r.length)throw new Error("Could not recreate Huffman Table");l=r.pop()}for(l.index++,r.push(l);r.length<=n;)r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;o++}n+1<a&&(r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s)}return r[0].children}function h(t,n,i,o,r,a,s,l,c){i.precision,i.samplesPerLine,i.scanLines;var u=i.mcusPerLine,h=i.progressive;i.maxH,i.maxV;var d=n,p=0,f=0;function m(){if(f>0)return f--,p>>f&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw new Error("unexpected marker: "+(p<<8|e).toString(16))}return f=7,p>>>7}function v(e){for(var t,n=e;null!==(t=m());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw new Error("invalid huffman sequence")}return null}function g(e){for(var t=0;e>0;){var n=m();if(null===n)return;t=t<<1|n,e--}return t}function y(e){var t=g(e);return t>=1<<e-1?t:t+(-1<<e)+1}var w=0;var b,E=0;function x(e,t,n,i,o){var r=n%u,a=(n/u|0)*e.v+i,s=r*e.h+o;t(e,e.blocks[a][s])}function T(e,t,n){var i=n/e.blocksPerLine|0,o=n%e.blocksPerLine;t(e,e.blocks[i][o])}var P,k,R,M,S,I,C=o.length;I=h?0===a?0===l?function(e,t){var n=v(e.huffmanTableDC),i=0===n?0:y(n)<<c;t[0]=e.pred+=i}:function(e,t){t[0]|=m()<<c}:0===l?function(t,n){if(w>0)w--;else for(var i=a,o=s;i<=o;){var r=v(t.huffmanTableAC),l=15&r,u=r>>4;if(0!==l)n[e[i+=u]]=y(l)*(1<<c),i++;else{if(u<15){w=g(u)+(1<<u)-1;break}i+=16}}}:function(t,n){for(var i=a,o=s,r=0;i<=o;){var l=e[i],u=n[l]<0?-1:1;switch(E){case 0:var h=v(t.huffmanTableAC),d=15&h;if(r=h>>4,0===d)r<15?(w=g(r)+(1<<r),E=4):(r=16,E=1);else{if(1!==d)throw new Error("invalid ACn encoding");b=y(d),E=r?2:3}continue;case 1:case 2:n[l]?n[l]+=(m()<<c)*u:0==--r&&(E=2==E?3:0);break;case 3:n[l]?n[l]+=(m()<<c)*u:(n[l]=b<<c,E=0);break;case 4:n[l]&&(n[l]+=(m()<<c)*u)}i++}4===E&&0==--w&&(E=0)}:function(t,n){var i=v(t.huffmanTableDC),o=0===i?0:y(i);n[0]=t.pred+=o;for(var r=1;r<64;){var a=v(t.huffmanTableAC),s=15&a,l=a>>4;if(0!==s)n[e[r+=l]]=y(s),r++;else{if(l<15)break;r+=16}}};var A,D,L,V,H=0;for(D=1==C?o[0].blocksPerLine*o[0].blocksPerColumn:u*i.mcusPerColumn,r||(r=D);H<D;){for(k=0;k<C;k++)o[k].pred=0;if(w=0,1==C)for(P=o[0],S=0;S<r;S++)T(P,I,H),H++;else for(S=0;S<r;S++){for(k=0;k<C;k++)for(L=(P=o[k]).h,V=P.v,R=0;R<V;R++)for(M=0;M<L;M++)x(P,I,H,R,M);if(++H===D)break}if(f=0,(A=t[n]<<8|t[n+1])<65280)throw new Error("marker was not found");if(!(A>=65488&&A<=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 y(e,u,h){var d,p,f,m,v,g,y,w,b,E,x=c.quantizationTable,T=h;for(E=0;E<64;E++)T[E]=e[E]*x[E];for(E=0;E<8;++E){var P=8*E;0!=T[1+P]||0!=T[2+P]||0!=T[3+P]||0!=T[4+P]||0!=T[5+P]||0!=T[6+P]||0!=T[7+P]?(d=s*T[0+P]+128>>8,p=s*T[4+P]+128>>8,f=T[2+P],m=T[6+P],v=l*(T[1+P]-T[7+P])+128>>8,w=l*(T[1+P]+T[7+P])+128>>8,g=T[3+P]<<4,y=T[5+P]<<4,b=d-p+1>>1,d=d+p+1>>1,p=b,b=f*a+m*r+128>>8,f=f*r-m*a+128>>8,m=b,b=v-y+1>>1,v=v+y+1>>1,y=b,b=w+g+1>>1,g=w-g+1>>1,w=b,b=d-m+1>>1,d=d+m+1>>1,m=b,b=p-f+1>>1,p=p+f+1>>1,f=b,b=v*o+w*i+2048>>12,v=v*i-w*o+2048>>12,w=b,b=g*n+y*t+2048>>12,g=g*t-y*n+2048>>12,y=b,T[0+P]=d+w,T[7+P]=d-w,T[1+P]=p+y,T[6+P]=p-y,T[2+P]=f+g,T[5+P]=f-g,T[3+P]=m+v,T[4+P]=m-v):(b=s*T[0+P]+512>>10,T[0+P]=b,T[1+P]=b,T[2+P]=b,T[3+P]=b,T[4+P]=b,T[5+P]=b,T[6+P]=b,T[7+P]=b)}for(E=0;E<8;++E){var k=E;0!=T[8+k]||0!=T[16+k]||0!=T[24+k]||0!=T[32+k]||0!=T[40+k]||0!=T[48+k]||0!=T[56+k]?(d=s*T[0+k]+2048>>12,p=s*T[32+k]+2048>>12,f=T[16+k],m=T[48+k],v=l*(T[8+k]-T[56+k])+2048>>12,w=l*(T[8+k]+T[56+k])+2048>>12,g=T[24+k],y=T[40+k],b=d-p+1>>1,d=d+p+1>>1,p=b,b=f*a+m*r+2048>>12,f=f*r-m*a+2048>>12,m=b,b=v-y+1>>1,v=v+y+1>>1,y=b,b=w+g+1>>1,g=w-g+1>>1,w=b,b=d-m+1>>1,d=d+m+1>>1,m=b,b=p-f+1>>1,p=p+f+1>>1,f=b,b=v*o+w*i+2048>>12,v=v*i-w*o+2048>>12,w=b,b=g*n+y*t+2048>>12,g=g*t-y*n+2048>>12,y=b,T[0+k]=d+w,T[56+k]=d-w,T[8+k]=p+y,T[48+k]=p-y,T[16+k]=f+g,T[40+k]=f-g,T[24+k]=m+v,T[32+k]=m-v):(b=s*h[E+0]+8192>>14,T[0+k]=b,T[8+k]=b,T[16+k]=b,T[24+k]=b,T[32+k]=b,T[40+k]=b,T[48+k]=b,T[56+k]=b)}for(E=0;E<64;++E){var R=128+(T[E]+8>>4);u[E]=R<0?0:R>255?255:R}}for(var w=0;w<f;w++){var b=w<<3;for(u=0;u<8;u++)d.push(new Uint8Array(m));for(var E=0;E<p;E++){y(c.blocks[w][E],g,v);var x=0,T=E<<3;for(h=0;h<8;h++){var P=d[b+h];for(u=0;u<8;u++)P[T+u]=g[x++]}}}return d}function p(e){return e<0?0:e>255?255:e}return c.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;function i(){var e=t[n]<<8|t[n+1];return n+=2,e}function o(e){var t,n,i=0,o=0;for(n in e.components)e.components.hasOwnProperty(n)&&(i<(t=e.components[n]).h&&(i=t.h),o<t.v&&(o=t.v));var r=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/o);for(n in e.components)if(e.components.hasOwnProperty(n)){t=e.components[n];for(var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),l=Math.ceil(Math.ceil(e.scanLines/8)*t.v/o),c=r*t.h,u=a*t.v,h=[],d=0;d<u;d++){for(var p=[],f=0;f<c;f++)p.push(new Int32Array(64));h.push(p)}t.blocksPerLine=s,t.blocksPerColumn=l,t.blocks=h}e.maxH=i,e.maxV=o,e.mcusPerLine=r,e.mcusPerColumn=a}t.length;var r,a,s,l,c=null,p=null,f=[],m=[],v=[],g=[],y=i();if(65496!=y)throw new Error("SOI not found");for(y=i();65497!=y;){switch(y){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 w=(s=void 0,l=void 0,s=i(),l=t.subarray(n,n+s-2),n+=l.length,l);65504===y&&74===w[0]&&70===w[1]&&73===w[2]&&70===w[3]&&0===w[4]&&(c={version:{major:w[5],minor:w[6]},densityUnits:w[7],xDensity:w[8]<<8|w[9],yDensity:w[10]<<8|w[11],thumbWidth:w[12],thumbHeight:w[13],thumbData:w.subarray(14,14+3*w[12]*w[13])}),65518===y&&65===w[0]&&100===w[1]&&111===w[2]&&98===w[3]&&101===w[4]&&0===w[5]&&(p={version:w[6],flags0:w[7]<<8|w[8],flags1:w[9]<<8|w[10],transformCode:w[11]});break;case 65499:for(var b=i()+n-2;n<b;){var E=t[n++],x=new Int32Array(64);if(E>>4==0)for(_=0;_<64;_++){x[e[_]]=t[n++]}else{if(E>>4!=1)throw new Error("DQT: invalid table spec");for(_=0;_<64;_++){x[e[_]]=i()}}f[15&E]=x}break;case 65472:case 65473:case 65474:i(),(r={}).extended=65473===y,r.progressive=65474===y,r.precision=t[n++],r.scanLines=i(),r.samplesPerLine=i(),r.components={},r.componentsOrder=[];var T,P=t[n++];for(B=0;B<P;B++){T=t[n];var k=t[n+1]>>4,R=15&t[n+1],M=t[n+2];r.componentsOrder.push(T),r.components[T]={h:k,v:R,quantizationIdx:M},n+=3}o(r),m.push(r);break;case 65476:var S=i();for(B=2;B<S;){var I=t[n++],C=new Uint8Array(16),A=0;for(_=0;_<16;_++,n++)A+=C[_]=t[n];var D=new Uint8Array(A);for(_=0;_<A;_++,n++)D[_]=t[n];B+=17+A,(I>>4==0?g:v)[15&I]=u(C,D)}break;case 65501:i(),a=i();break;case 65498:i();var L=t[n++],V=[];for(B=0;B<L;B++){j=r.components[t[n++]];var H=t[n++];j.huffmanTableDC=g[H>>4],j.huffmanTableAC=v[15&H],V.push(j)}var z=t[n++],O=t[n++],F=t[n++],N=h(t,n,r,V,a,z,O,F>>4,15&F);n+=N;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 "+y.toString(16))}y=i()}if(1!=m.length)throw new Error("only single frame JPEGs supported");for(var B=0;B<m.length;B++){var U=m[B].components;for(var _ in U)U[_].quantizationTable=f[U[_].quantizationIdx],delete U[_].quantizationIdx}this.width=r.samplesPerLine,this.height=r.scanLines,this.jfif=c,this.adobe=p,this.components=[];for(B=0;B<r.componentsOrder.length;B++){var j=r.components[r.componentsOrder[B]];this.components.push({lines:d(0,j),scaleX:j.h/r.maxH,scaleY:j.v/r.maxV})}},getData:function(e,t){var n,i,o,r,a,s,l,c,u,h,d,f,m,v,g,y,w,b,E,x,T,P=this.width/e,k=this.height/t,R=0,M=e*t*this.components.length,S=new Uint8Array(M);switch(this.components.length){case 1:for(n=this.components[0],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*k],u=0;u<e;u++)d=a[0|u*n.scaleX*P],S[R++]=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*k],s=i.lines[0|h*i.scaleY*k],u=0;u<e;u++)d=a[0|u*n.scaleX*P],S[R++]=d,d=s[0|u*i.scaleX*P],S[R++]=d;break;case 3:for(T=!0,this.adobe&&this.adobe.transformCode?T=!0:void 0!==this.colorTransform&&(T=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*k],s=i.lines[0|h*i.scaleY*k],l=o.lines[0|h*o.scaleY*k],u=0;u<e;u++)T?(d=a[0|u*n.scaleX*P],f=s[0|u*i.scaleX*P],b=p(d+1.402*((m=l[0|u*o.scaleX*P])-128)),E=p(d-.3441363*(f-128)-.71413636*(m-128)),x=p(d+1.772*(f-128))):(b=a[0|u*n.scaleX*P],E=s[0|u*i.scaleX*P],x=l[0|u*o.scaleX*P]),S[R++]=b,S[R++]=E,S[R++]=x;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(T=!1,this.adobe&&this.adobe.transformCode?T=!0:void 0!==this.colorTransform&&(T=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],r=this.components[3],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*k],s=i.lines[0|h*i.scaleY*k],l=o.lines[0|h*o.scaleY*k],c=r.lines[0|h*r.scaleY*k],u=0;u<e;u++)T?(d=a[0|u*n.scaleX*P],f=s[0|u*i.scaleX*P],m=l[0|u*o.scaleX*P],v=c[0|u*r.scaleX*P],g=255-p(d+1.402*(m-128)),y=255-p(d-.3441363*(f-128)-.71413636*(m-128)),w=255-p(d+1.772*(f-128))):(g=a[0|u*n.scaleX*P],y=s[0|u*i.scaleX*P],w=l[0|u*o.scaleX*P],v=c[0|u*r.scaleX*P]),S[R++]=255-g,S[R++]=255-y,S[R++]=255-w,S[R++]=255-v;break;default:throw new Error("Unsupported color mode")}return S},copyToImageData:function(e,t){var n,i,o,r,a,s,l,c,u,h=e.width,d=e.height,f=e.data,m=this.getData(h,d),v=0,g=0;switch(this.components.length){case 1:for(i=0;i<d;i++)for(n=0;n<h;n++)o=m[v++],f[g++]=o,f[g++]=o,f[g++]=o,t&&(f[g++]=255);break;case 3:for(i=0;i<d;i++)for(n=0;n<h;n++)l=m[v++],c=m[v++],u=m[v++],f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;case 4:for(i=0;i<d;i++)for(n=0;n<h;n++)a=m[v++],s=m[v++],o=m[v++],l=255-p(a*(1-(r=m[v++])/255)+r),c=255-p(s*(1-r/255)+r),u=255-p(o*(1-r/255)+r),f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;default:throw new Error("Unsupported color mode")}}},c}();var Bl={encode:function(e,t){return void 0===t&&(t=50),{data:new Fl(t).encode(e,t),width:e.width,height:e.height}},decode:function(e,t){var n={useTArray:!1,colorTransform:void 0,formatAsRGBA:!0};t?"object"==typeof t?t={useTArray:void 0===t.useTArray?n.useTArray:t.useTArray,colorTransform:void 0===t.colorTransform?n.colorTransform:t.colorTransform,formatAsRGBA:void 0===t.formatAsRGBA?n.formatAsRGBA:t.formatAsRGBA}:(t=n).useTArray=!0:t=n;var i=new Uint8Array(e),o=new Nl;o.parse(i),o.colorTransform=t.colorTransform;var r=t.formatAsRGBA?4:3,a=o.width*o.height*r;try{var s={width:o.width,height:o.height,data:t.useTArray?new Uint8Array(a):new Buffer(a)}}catch(e){throw e instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+a):e}return o.copyToImageData(s,t.formatAsRGBA),s}};function Ul(e,t,n){e&&(e=e.toLowerCase().trim());var i=new I.UP.clone,o=Math.PI/3,r=Math.PI/2;switch(e){case"left":n.copy(t),n.applyAxisAngle(i,r);break;case"right":n.copy(t),n.applyAxisAngle(i,-r);break;case"forwardleft":n.copy(t),n.applyAxisAngle(i,o);break;case"forwardright":n.copy(t),n.applyAxisAngle(i,-o);break;case"forward":default:n.copy(t)}return n}function _l(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 jl(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 Wl(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 Ql(e,t){t.copy(I.FORWARD),e.getDirection(t)}var Zl={director:null,player:null,controls:null,sceneRenderer:null,model:null,init:function(e,t,n,i){this.director=e,this.player=n,this.controls=t,this.sceneRenderer=i},handleToObject:{},objectToHandle:{},handleCount:0,onMessageReceive:function(e){if(e){var t=e.targetFunction,n=e.params,i=e.onDone;t&&this[t]&&this[t](n,i)}},waitForInit:function(e,t){F.then(t.bind({success:!0,message:"Init complete."}))},moveToPano:function(e,t){var n=new THREE.Euler(0,0,0,"YXZ"),i=new THREE.Quaternion;return function(e,t){var o=e.pano,r=e.rotation,a=e.transition;if(!this.model)return t({success:!1,error:"The model has not been loaded yet"});var s=this.model.panos.get(o);if(!s)return t({success:!1,error:o+" does not exist in this model"});if(!r)return t({sucess:!1,erorr:r+" is not a valid rotation"});n.set(c.Math.degToRad(r.x||0),c.Math.degToRad(r.y||0),c.Math.degToRad(r.z||0),"YXZ"),Le.info(r.z);var l={success:!0,message:o};if(a===A.FADEOUT)i.setFromEuler(n),this.player.warpToPano(s,i,null,null,b.BLACK,null,null,t.bind(this,l));else{var u,h;a===A.INSTANT&&(u=0,h=0);var d=I.FORWARD.clone().applyEuler(n).add(s.position);this.player.flyToPano({pano:s,lookAtPoint:d,duration:u,aimDuration:h},t.bind(this,l))}}}(),moveInDirection:function(e,t){var n=e.direction;return void 0===v[n]?(R.warn("Showcase -> moveInDirection: Cannot move in invalid direction."),void(t&&t({success:!1,error:"Invalid direction."}))):void this.player.flyLocalDirection(I[n].clone()).then((function(e){t(e?{success:!0,message:"moved "+n}:{success:!1,error:"Cannot move in direction: "+n})}))},getPose:function(e,t){return this.player.camera.position,(new THREE.Euler).setFromQuaternion(this.player.camera.quaternion,"YXZ"),t({success:!0,message:B(this.player)})},takeScreenShot:function(){var e=new THREE.PerspectiveCamera,t=new THREE.WebGLRenderTarget;return function(n,i){if(!n.resolution)return i({success:!1,error:"An invalid resolution was specified"});if(-1===n.resolution.width||-1===n.resolution.height){var o=this.sceneRenderer.renderer.getSize();n.resolution.width=o.width,n.resolution.height=o.height}e.layers.set(dt),n.visibleObjects&&(n.visibleObjects.showPucks&&e.layers.enable(pt),n.visibleObjects.showReticule&&e.layers.enable(ft));var r=n.resolution.width,a=n.resolution.height,s=r/a;e.position.copy(this.sceneRenderer.camera.position),e.quaternion.copy(this.sceneRenderer.camera.quaternion),e.projectionMatrix.copy(this.player.camera.projectionMatrix),e.projectionMatrix.elements[0]=this.player.camera.projectionMatrix.elements[5]/s,e.projectionMatrix.elements[5]=-e.projectionMatrix.elements[5],t.setSize(r,a),this.sceneRenderer.renderer.setRenderTarget(t),this.sceneRenderer.renderer.render(this.sceneRenderer.scene,e),this.sceneRenderer.renderer.setRenderTarget(null);var l=new Uint8Array(r*a*4);this.sceneRenderer.renderer.readRenderTargetPixels(t,0,0,r,a,l);var c=Bl.encode({data:l,width:r,height:a,heading:180,pitch:0},n.quality);i({success:!0,message:"data:image/jpg;base64,"+le.uint8ToBase64(c.data),camera:e})}}(),findRankedPano:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){Ql(this.player,i),Ul(t,i,n);var o=this.player.rankedPanoInDirection(e,n);if(o){var r=this.objectToHandle[o.id];return r||(this.objectToHandle[o.id]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedPano: Unable to find nearby pano."),-1}}(),findRankedtag:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){Ql(this.player,i),Ul(t,i,n);var o=this.player.rankedtagInDirection(e,n);if(o){var r=this.objectToHandle[o.sid];return r||(this.objectToHandle[o.sid]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedtag: Unable to find nearby tag."),-1}}(),clickNearesttag:function(e){this.clickRankedtag(0,e)},clickRankedtag:function(e,t){var n=Wl.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=jl.call(this,e,t);i?_l.call(this,i,n):n(null)},clickPano:function(e,t){var n=this.handleTable[e];n?_l.call(this,n,t):t(null)},rotateDirection:function(e,t){var n=e.direction,i=e.angle;if(!P.active){var o=0,r=0,a=0,s=0;if(!i||isNaN(i))return R.warn("Showcase -> rotateDirection: Invalid rotation angle."),void(t&&t({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotateDirection: Cannot rotate while transitioning"),void(t&&t({success:!1,error:"Cannot rotate while transitioning"}));if(n===v.RIGHT||n===v.LEFT)n===v.RIGHT&&(i=-i),o=i>0?-1:1,a=i;else{if(n!==v.UP&&n!==v.DOWN)return R.warn("Showcase -> rotateDirection: Invalid direction for rotation: "+n),void(t&&t({success:!1,error:"Invalid direction for rotation."}));if(this.player.mode===E.FLOORPLAN)return R.warn("Showcase -> rotateDirection: Cannot rotate "+n+" in floorplan mode"),void(t&&t({success:!1,error:"Cannot rotate "+n+" in floorplan mode"}));if(n===v.DOWN&&(i=-i),0===(i=N.call(this,i)))return R.warn("Showcase -> rotateDirection: Already at maximum rotation in direction: "+n),void(t&&t({success:!1,error:"Already at maximum rotation in direction: "+n}));r=i>0?1:-1,s=i}var l=i;i=c.Math.degToRad(i),a=c.Math.degToRad(a),s=c.Math.degToRad(s);var u=this.controls.activeControl;u.startRotating(o,r),P.start(a,s,this.player,(function(){u.stopRotating(!0),t&&t({success:!0,message:"Rotated "+l.toFixed(2)+"° in direction: "+e.direction})}))}},rotate:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(n,i){var o=n.xAngle,r=n.yAngle;if(!P.active){if(o=o||0,r=r||0,isNaN(o)||isNaN(r))return R.warn("Showcase -> rotate: Invalid rotation angle."),void(i&&i({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotate: Cannot rotate while transitioning"),void(i&&i({success:!1,error:"Cannot rotate while transitioning"}));Math.abs(o)<.01&&(o=0),Math.abs(r)<.01&&(r=0);var a=r;r=N.call(this,r);var s=a>0?"UP":"DOWN";if(!(o=-o)&&a&&!r)return R.warn("Showcase -> rotate: Already at maximum rotation in direction: "+s),void(i&&i({success:!1,error:"Already at maximum rotation in direction: "+s}));a>r&&R.warn("Showcase -> rotate: Reached maximum rotation in direction: "+s);var l=r;r=c.Math.degToRad(r),o=c.Math.degToRad(o),e.copy(this.player.mode===E.FLOORPLAN?I.UP:I.FORWARD),this.player.getDirection(e),t.copy(e).applyAxisAngle(I.UP,o),t.applyAxisAngle(I.RIGHT,r);var u=(e.angleTo(t),o>0?-1:o<0?1:0),h=r>0?1:r<0?-1:0;Math.abs(o)>Math.abs(r)?h*=Math.abs(r/o):Math.abs(r)>Math.abs(o)&&(u*=Math.abs(o/r));var d=this.controls.activeControl;d.startRotating(u,h),P.start(o,r,this.player,(function(){d.stopRotating(!0),i&&i({success:!0,message:"Rotated "+n.xAngle.toFixed(2)+"° horizontally, "+l.toFixed(2)+"° vertically"})}))}}}(),panCamera:function(e,t){function n(e){switch(o.removeAllListeners(T.AutoPanComplete),o.removeAllListeners(T.AutoPanInterrupt),o.removeAllListeners(T.AutoPanClamped),e){case T.AutoPanInterrupt:t({success:!0,message:"Camera panning interrupted."});break;case T.AutoPanClamped:if(o.autoPanPosition.x!==i.x||o.autoPanPosition.z!==i.z){if(Math.abs(this.player.position.x-o.autoPanPosition.x)<.01&&Math.abs(this.player.position.z-o.autoPanPosition.z)<.01)return void t({success:!1,error:"Already at edge of current model bounds."});var n="The view point is outside the bounds for the current model. ";n+="The view point was clamped to "+r(o.target.x,o.target.z),console.warn(n)}case T.AutoPanComplete:t({success:!0,message:"Panned camera to position "+r(o.autoPanPosition.x,o.autoPanPosition.z)})}}if(this.player.mode!==E.DOLLHOUSE&&this.player.mode!==E.FLOORPLAN)return t({success:!1,error:"Camera panning is not available in the current mode: "+this.player.mode});var i=e.position,o=this.player.control;o.setAutoPanPosition(i.x,i.z),o.autoPan=!0;var r=function(e,t){return"("+e.toFixed(2)+", "+t.toFixed(2)+")"};o.on(T.AutoPanComplete,n.bind(this,T.AutoPanComplete)),o.on(T.AutoPanInterrupt,n.bind(this,T.AutoPanInterrupt)),o.on(T.AutoPanClamped,n.bind(this,T.AutoPanClamped))},click:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputStart(n,i),this.player.updateIntersect(),this.player.handleInputEnd(n,i)},mouseOver:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputMove(n,i),this.player.updateIntersect()},moveToMode:function(e,t){function n(e){t(e?{success:!1,error:"Failed to load new mode: "+e}:{success:!0,message:"Moved to new mode: "+i})}var i=e.mode;i===E.PANORAMA||i===E.DOLLHOUSE||i===E.FLOORPLAN?this.director.changeMode(i).then((function(){n()}),(function(e){n(e)})):t({success:!1,error:"Invalid mode selection"})}},Gl=function(e,t,n,i,o){Zl.init(e,t,n,o)},ql=function(e,t){Zl.takeScreenShot(e,t)};Re("Screenshot",(function(){var e,t,n,i;return e=Y("execute"),t=Y("recover"),n=Y("toFish"),i=Y("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!=Ue.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)}}),Object.defineProperty(this,n,{writable:!0,value:function(e){this.player.model.fishSkybox||(this.player.model.fishSkybox=new THREE.Mesh(new THREE.SphereGeometry(ye.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=Te.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==Ue.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=Te.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==Ue.TRANSITIONING)&&Le.warn("you take a screenshot on flying or transitioning mode!!");var n=this.player.getSize(),i=n.clientWidth,o=n.clientHeight,r=this.player.model.floorLogos.firstLogo.visible,a=this.player.model.floorLogos.secondLogo.visible;this.player.model.panos.list.forEach((function(e){e.isAligned()&&(e.marker.forceHide=e.marker.visible,e.marker.visible=!1)})),this.player.reticule.visible=!1,this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1,this.player.path.currentPanoMarker.mesh.visible=!1,this.player.mode!=Ue.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"),t.snapshotTopview&&this.player.mode==Ue.FLOORPLAN&&(this.$app.core.get("CameraControls").controls.floorplan.snapshotTopAspect=i/o),t.changeBefore={fL0:r,fL1:a,notHideTags:t.notHideTags},Z(this,e)[e](t)}}]),a}();function r(o,r){var a,s,l=this;o.tasks.unFish&&o.tasks.unFish.length?(a=o.tasks.unFish.splice(0,1)[0],s="unFish"):o.tasks.fish&&o.tasks.fish.length?(a=o.tasks.fish.splice(0,1)[0],s="fish"):s="finish","unFish"==r&&"fish"==s?Z(this,n)[n](o.changeBefore):"fish"==r&&"finish"==s?(Z(this,i)[i](o.changeBefore),Z(this,t)[t](o.changeBefore)):"finish"==s?Z(this,t)[t](o.changeBefore):Le.info("other state:"+r+"|"+s),"finish"!=s&&ql({resolution:{width:a.width,height:a.height},quality:Te.isSafari?45:60},(function(t){o.done&&o.done(t.message,a.name,t),Z(l,e)[e](o,s)}))}}));var Yl=Object.freeze({Show:0,Hide:1,Retain:2}),$l=Object.freeze({Standard:0,Slow:1,Retain:2});function Xl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Re("Director",(function(){return function(e){f(n,EventEmitter);var t=Xl(n);function n(){var e;return o(this,n),(e=t.call(this)).endlessLoop=Te.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=me;break;case 2:this.defaultWarpStyle=ge;break;case 3:this.defaultWarpStyle=ve;break;default:this.defaultWarpStyle=me}else this.defaultWarpStyle=me,Le.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(Br,this.updateModel.bind(this)),this.player.on(hr,this.handleFlyToWarpInterruption.bind(this)),this.player.on(Yo,this.handlePlayerMove.bind(this)),this.player.on(nr,this.handlePlayerPanoChosen.bind(this)),this.player.on(er,this.handlePlayerModeChanged.bind(this)),this.player.on(dr,this.handlePlayerInputStart.bind(this)),this.player.on(rr,this.handlePlayerFlyingStarted.bind(this))}},{key:"handleFlyToWarpInterruption",value:function(e,t){e===ge?(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===Ue.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(){Te.nestscenes&&Te.nestscenes.scenes&&Te.nestscenes.scenes.length&&!Te.nestscenes.scenes[0].script&&(Te.basic.menu.scene_autoplay&&(Te.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()),Te.warp.auto>=0&&transitions.trigger({duration:1e3*Math.min(300,Te.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!==Ue.TRANSITIONING){Le.debug("Director.redirectToItem() -> Redirecting to "+e+" via "+t);var n=function(){transitions.setTimeout(function(){this.setDestinationItem(e),Le.info("from redirectToItem"),this.goToDestination(!0,BlackoutStyle.BEGINNING,Te.warp.warpInterruptionRedirectTime,!1)}.bind(this),0)}.bind(this);this.interrupt(BlackoutStyle.END,0),this.updateSuccessFunction(n)}else Le.debug("Director.redirectToItem() -> Cannot redirect while transitioning.");else Le.warn("Director.redirectToItem() -> Director cannot redirect if there is nothing to interrupt.");else Le.warn("Director.redirectToItem() -> Redirecting to null item.")}},{key:"useSpecialTransition",value:function(e){void 0!==e&&this.defaultWarpStyle!==me&&Le.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())Le.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,Yl.Retain,Yl.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())Le.warn("Cannot go to new destination while player is flying or warping.");else{var o=this.player.model.getHeroDescriptorByIndex(this.destinationItem),r=null,a=null;if(null!=o.pano&&void 0!==o.pano){var s=0===this.destinationItem||e?me:this.nextWarpStyle;a=this.player.warpToPanoByHeroIndex.bind(this.player,this.destinationItem,Yl.Show,$l.Slow,s,t,n,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!0)}else a=this.player.warpToNonPanoByHeroIndex.bind(this.player,this.destinationItem,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!1);this.transitionStage=this.C.Moving,this.player.model.fadePanoMarkers(0,null,{hideVideoFlag:!0}),this.awaitCompletion(function(){a()}.bind(this),r),this.emit("update.controls")}else this.arrivedAtDestination(!0)}},{key:"tourInterlude",value:function(){if(this.player.model.fadePanoMarkers(0),this.emit("update.controls"),this.tourIsPlaying)return this.atEndOfTour()&&!this.endlessLoop?(this.tourInProgress=!1,this.stopTour(),this.emit(DirectorEvents.TourEnd),void(this.player.mode===Viewmode.PANORAMA&&this.player.model.fadePanoMarkers(Te.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 Le.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(Le.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 Ue.PANORAMA:this.player.insideMode();break;case Ue.DOLLHOUSE:case Ue.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){Le.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 Jl=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 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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Jl.prototype.beginMove=function(e){if(e.preventDefault(),e.stopPropagation(),this.hasBound&&this.getMoveBound(),!this.moving){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;if(this.moving=!0,this.useTransform){var n,i,o=this.elem.style.transform;if(o){var r=o.indexOf("("),a=o.indexOf(")");o=o.slice(r+1,a).split(","),n=parseFloat(o[0]),i=parseFloat(o[1])}else n=i=0;this.dragInfo={startElem:{x:n,y:i},endElem:{x:n,y:i}}}else this.dragInfo={startElem:{x:parseFloat(this.elem[0].style.left),y:parseFloat(this.elem[0].style.top)}};this.dragInfo.startMouse={x:t?e.changedTouches[0].clientX:e.clientX,y:t?e.changedTouches[0].clientY:e.clientY},this.beginMoveFuc&&this.beginMoveFuc()}},Jl.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")}},Jl.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})},Jl.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}},Jl.prototype.reportPos=function(){return{x:this.dragInfo.endElem.x+this.domParent.clientWidth/2,y:this.dragInfo.endElem.y+this.domParent.clientHeight/2}},Jl.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 ec,tc,nc=function(e){f(n,EventEmitter);var t=Kl(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=De.getPos2d(this.pos3d,this.player,this.camera,this.domParent);if(e.trueSide)if(this.mayShelter&&De.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=De.getPos2d(this.pos3d.clone().add(this.driftDir)),n=this.elem[0].children[0].getBoundingClientRect(),i=Ie.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.pos3d.distanceTo(this.camera.position);this.pos2d=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()))}else this.pos2d=(new THREE.Vector2).copy(e.vector);this.setElemPos()}else this.elem.style.display="none"}}},{key:"setElemPos",value:function(){if(this.useTransform){var e=this.pos2d.x/2*this.domParent.clientWidth,t=-this.pos2d.y/2*this.domParent.clientHeight;this.elem.style.transform="translate("+parseInt(e)+"px,"+parseInt(t)+"px)"}else this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}}]),n}();function ic(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var oc,rc,ac=new THREE.Vector2,sc={},lc={};function cc(e){ac=uc(e)}function uc(e){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;return{x:t?e.changedTouches[0].clientX:e.offsetX,y:t?tc?e.changedTouches[0].clientY-ec.domElement.clientHeight:e.changedTouches[0].clientY:e.offsetY}}Re("TagEditManager",(function(){return function(e){f(n,e);var t=ic(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;if(!this.inited){oc=this.$app.dom.querySelector('.player[name="copy"]'),ec=this.$app.core.get("Player"),this.$app.core.get("TagManager"),tc=this.$app.config.mobile;var n=document.createElement("div");n.className="widgets-rulers",ec.domElement.append(n),this.markSpotA=new nc({name:"markSpotA",elem:e.spotA,domParent:ec.domElement,camera:ec.camera,useTransform:!0},ec),this.markSpotB=new nc({name:"markSpotB",elem:e.spotB,domParent:oc,camera:this.splitView.panoramaCam,useTransform:!0},ec),this.markSpotA.name="markSpotA",this.markSpotB.name="markSpotB",new Jl({elem:this.markSpotA.elem,domParent:ec.domElement,useTransform:!0,cameraControls:ec.cameraControls,beginMoveFuc:function(){t.editing&&(t.markSpotA.dragging=!0,ec.cameraControls.controls.panorama.locked=!0,t.splitView.panoramaCtl.locked=!0)},moveDoneFuc:function(e){t.editing&&(t.markSpotA.dragging=!1,ec.cameraControls.controls.panorama.locked=!1,t.splitView.panoramaCtl.locked=!1,e&&t.moveToReGetA(e),ec.mouseCouldBeClickToMove=!1)}}),rc=new Jl({elem:this.markSpotB.elem,domParent:oc,useTransform:!0,beginMoveFuc:function(){t.markSpotB.dragging=!0,t.splitView.panoramaCtl.locked=!0,ec.cameraControls.controls.panorama.locked=!0},moveDoneFuc:function(e){t.markSpotB.dragging=!1,t.splitView.panoramaCtl.locked=!1,ec.cameraControls.controls.panorama.locked=!1,e&&t.moveToReGetB(e)}}),oc.addEventListener("pointerdown",cc),oc.addEventListener("touchstart",cc),oc.addEventListener("pointerup",this.clickToReGetB.bind(this)),oc.addEventListener("touchend",this.clickToReGetB.bind(this)),ec.on("update",(function(e){t.editing&&(e.hasChanged.cameraChanged2&&t.markSpotA.update(),t.splitView.changed()&&t.markSpotB.update())})),ec.on("pano.chosen",(function(e,n){t.changePano(n)})),ec.on("click",(function(e){t.editing&&!t.clickA&&(e.intersect&&t.getA(e.intersect),e.consume())})),ec.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;ec.viewLinkManager.exitView().then((function(){if(ec.flying||ec.flyingToTag)return ec.flyingToTag,void ec.once(ar,(function(){e.enter()}));ec.flyToMode("panorama",(function(){!function t(){ec.currentPano?(e.editing=!0,e.setSpotPos||ec.flying||(e.splitView.enter(),e.panoB=e.splitView.panoB,e.markSpotA.elem.style.display="none",e.markSpotB.elem.style.display="none",e.markSpotA.pos3d=e.clickA=null,e.markSpotB.pos3d=e.clickB=null,ec.reticule.visible=!1,ec.locked=!0)):setTimeout(t,50)}()}))}))}},{key:"reSetPos",value:function(e){var t=this;this.markTagPos=(new THREE.Vector3).copy(e),ec.viewLinkManager.exitView().then((function(){return ec.flying||ec.flyingToTag?(ec.flyingToTag,void ec.once(ar,(function(){t.reSetPos(e)}))):(t.editing=!0,t.hotRePos=!0,t.markSpotA.pos3d=t.clickA=t.markTagPos.clone(),t.markSpotA.enable=!0,t.markSpotB.pos3d=t.clickB=t.markTagPos.clone(),t.markSpotA.elem.style.display="block",t.markSpotB.elem.style.display="block",t.markSpotB.enable=!0,setTimeout((function(){t.markSpotA.update(),t.markSpotB.update()}),300),t.splitView.enter(),t.panoA=t.splitView.panoA,t.panoB=t.splitView.panoB,ec.flyToPano({pano:ec.currentPano,aimDuration:500,lookAtPoint:t.markTagPos}),!0)}))}},{key:"confirmPos",value:function(e){if(this.editing){var t=le.getRandomSid(),n=this.computeHotPos();return e&&ec.model.add(new e(t,{position:n})),{sid:t,position:n}}}},{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(),ec.reticule.visible=!0,this.hideMarker&&(editSpot.hideMarker.visible=!0,editSpot.hideMarker=null),this.hotRePos=!1,this.editing=!1,ec.locked=!1}},{key:"changePano",value:function(e){this.editing&&this.markTagPos&&(this.splitView.changePano(e),e.assistPano==this.splitView.panoB?this.markSpotA.pos3d.copy(this.clickA):this.markSpotA.pos3d=this.markTagPos.clone(),this.splitView.pauseCameraBind=!0)}},{key:"getA",value:function(e){var t=this;if(!ec.flying&&this.editing){if(this.panoA=ec.currentPano,ec.locked=!1,2!=Te.visions&&this.panoA==this.panoB){var n=ec.model.matrixWorld.clone().invert(),i=e.point.clone().applyMatrix4(n);if(!this.clickA){this.clickA=this.clickB=i;var o=ec.model.panos.find([function(e){return ec.currentPano.neighbourPanos[e.id]&&ec.currentPano!=e}],[bi.sortFunctions.distanceToPoint(ec.currentPano.position)]);o?ec.flyToPano({pano:o,lookAtPoint:i.clone()}):console.log("当前场景只有一个pano,所以不走到下一个点")}this.clickA=this.clickB=i}else{if(ec.currentPano.assistPano!=this.splitView.panoB){if(this.clickA){this.panoA=ec.currentPano;n=ec.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.splitView.pauseCameraBind=!1}if(!this.getMatchData()){var r=this.panoA.id+"_"+this.panoB.id;if(sc[r]=(sc[r]||0)+1,!(sc[r]>5))return void setTimeout((function(){t.getA(e)}),200);console.error("获取不到matchdata 放弃使用: "+r)}n=ec.model.matrixWorld.clone().invert();if(this.clickA=e.point.clone().applyMatrix4(n),this.dirA=Ie.getNormalDir(this.clickA,ec.model.supportsTiles,ec.currentPano),this.UVa=Ie.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=Ie.getDirFromUV(this.UVb),this.clickB=function(e,t){e=e.clone();var n=t.skyboxMesh.matrixWorld.clone();return n.invert(),e=Ie.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!=Te.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=De.getMouseIntersect(this.splitView.panoramaCam,[this.splitView.cube],e),n=ec.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){ec.handleInputStart(e.x,e.y,!0,!0),ec.updateIntersect({}),ec.intersect?this.getA(ec.intersect):this.markSpotA.update(),ec.mouseDown=!1}},{key:"moveToReGetB",value:function(e){var t=new THREE.Vector2;Ie.convertScreenPositionToNDC(e.x,e.y,t,oc),this.getB(t)}},{key:"clickToReGetB",value:function(e){if(!rc.moving){var t=uc(e);if(!(Math.abs(ac.x-t.x)>3||Math.abs(ac.y-t.y)>3)){if(!this.clickA&&!this.hotRePos)return console.log("..?.."),void this.$app.TagManager.emit("tagManager.firstMarkTagPosB");var n=new THREE.Vector2;Ie.convertScreenPositionToNDC(t.x,t.y,n,oc),this.getB(n)}}}},{key:"restricPosAtRoom",value:function(e){var t=ec.currentPano.position,n=e,i=n.clone().sub(t).normalize(),o=new THREE.Raycaster(t,i,0,t.distanceTo(n)).intersectObjects(ec.model.colliders);return o&&o.length&&(console.log("热点飘出模型外,矫正:"+e.toArray()+" --\x3e "+o[0].point.toArray()),e.copy(o[0].point).sub(i.clone().multiplyScalar(.001))),e}},{key:"computeHotPos",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.panoA||!this.clickA)return null;var t=this.panoA.position.clone(),n=this.panoB.position.clone(),i=this.clickA,o=this.clickB,r=Ie.getLineIntersect({A:t,B:n,p1:i,p2:o});return e.dontRestric||this.restricPosAtRoom(r),this.markTagPos=r,console.log("markTagPos: ",r.toArray()),r}},{key:"getMatchData",value:function(){var e=this.panoA.id+"_"+this.panoB.id;if(lc[e])return lc[e];Vn.get(this.$app.resource.getEditDataURL("mapping/".concat(e,".json"))).then((function(t){lc[e]=t}))}},{key:"searchPointAtLeft",value:function(e){var t=this.getMatchData();if(e||console.log("!!!"),!t||!t["view pair"]||!t["view pair"].uv)return null;var n,i=e.x,o=e.y,r={},a={},s={},l={},c={leftTop:r,rightTop:a,leftBot:s,rightBot:l};function u(e,t){var n=t[0],r=t[1],a=(n-i)*(n-i)+(r-o)*(r-o);(null==e.dis||e.dis>a)&&(e.dis=a,e.pair=t)}t["view pair"].uv.forEach((function(e){e[0]<i&&e[1]<=o?u(r,e):e[0]>=i&&e[1]<=o?u(a,e):e[0]<i&&e[1]>=o?u(s,e):u(l,e)}));var h=0;for(var d in c)c[d].pair&&h++;var p={};function f(e,t){return e.pair?t.pair?e.dis<t.dis?e:t:e:t}function m(){var e=f(r,s),t=f(a,l),n=f(r,a),c=f(s,l);return p.x=(i-e.pair[0])/(t.pair[0]-e.pair[0]),p.y=(o-n.pair[1])/(c.pair[1]-n.pair[1]),{x:e.pair[2]+(t.pair[2]-e.pair[2])*p.x,y:n.pair[3]+(c.pair[3]-n.pair[3])*p.y}}return(h>=3||2==h&&(r.pair&&l.pair||s.pair&&a.pair))&&(n=m()),n}}]),n}(Ci)}));var hc,dc,pc,fc=function(){function e(t,n){o(this,e),this.quickstart=!0,this.mode=Ue.PANORAMA,this.zoom=-1,this.fov=he.urlHasValue("fov")?Number(he.urlQueryValue("fov")):Te.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=he.urlHasValue("pose",!0);if(n)try{n=le.replaceAll(n,"pano",'"pano"'),n="{"+(n=le.replaceAll(n,"qua:",'"qua":['))+"]}";var i=JSON.parse(n);this.pano=t.get(i.pano),this.pano?(this.quaternion=(new THREE.Quaternion).fromArray(i.qua),this.zoom=-1,this.setByUrl=!0):(n=!1,console.error("检测到firstView但是 找不到该pano"))}catch(e){n=!1,console.error("检测到firstView但是解析出错"+e)}else if(e&&e.entry){var o=e.entry;this.updateByEntry(o,t)}else this.pano=t.list[0],this.quaternion.copy(this.pano.quaternion);this.position.copy(this.pano.position),this.quaternion.equals(new THREE.Quaternion(-.5,.5,.5,.5))&&(this.quaternion.set(0,0,0,1),console.log("检测到初始画面quaternion为-0.5,0.5,0.5,0.5,强制更改为0,0,0,1"))}},{key:"updateByEntry",value:function(e,t){"string"==typeof e&&(e=JSON.parse(e)),e.pano&&(this.pano=t.get(e.pano)),null==this.pano&&(this.pano=t.list[0]),this.quaternion.copy(this.pano.quaternion),e.camera&&(this.quaternion=(new THREE.Quaternion).fromArray(e.camera.quaternion),this.zoom=e.camera.zoom)}},{key:"fromGuideView",value:function(e,t){this.mode=e.value.mode,this.zoom=e.value.zoom,this.position.copy(e.value.pos),this.quaternion.set(e.value.qua._x,e.value.qua._y,e.value.qua._z,e.value.qua._w),this.pano=t.get(e.value.pano)}}]),e}();function 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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var vc,gc={},yc=function(e){f(n,EventEmitter);var t=mc(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&&Ce.closeTo(a.position,t,5)&&Ce.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;pc=this.$app.core.get("Player"),dc=this.$app.dom.querySelector('.player[name="copy"]'),(hc=new THREE.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),hc.setSize(300,300,!1),dc.appendChild(hc.domElement);var t=this.$app.withNewComponent("CameraControls");if(t.init(dc,["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(dt),this.panoramaCam.layers.enable(pt),this.panoramaCam.layers.enable(mt),this.panoramaCam.layers.enable(vt),2!=Te.visions||pc.model.panos.list[0].assistPano||(Te.visions=1,console.warn("自动更改 visions = 1")),2!=Te.visions&&pc.model.supportsTiles){var n=this.$app.withNewComponent("SceneRenderer",1),i=this.$app.withNewComponent("PanoRenderer",1),o=this.$app.withNewComponent("TileDownloader",1);o.index=1,n.renderer=hc,o.processPriorityQueue=!0,i.init(n,o),(vc=new xi).extend(pc.model.panos.list.map((function(t){var n=new bi(e.$app,t.id,t);return n.attachToPanoRenderer(i),n.tileDownloader=o,n.qualityManager=e.$app.core.get("QualityManager"),n}))),o.setPanoData(vc,[],this.$app.core.get("ModelManager").projectNum),o.setUrls(pc.model.urls),o.start()}this.cube=new THREE.Mesh(new THREE.BoxGeometry(10,10,10),new Ri({side:THREE.BackSide,transparent:!1,name:"splitViewCubeMat",not_Cube:2==Te.visions},"skybox")),this.cube.name="splitView-cube",this.cube.layers.set(vt),this.$app.core.get("SceneRenderer").scene.add(this.cube),pc.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=pc.cameraControls.cameras.panorama;e.fov=e.staticFov=60,this.zoomEnabled=Te.zoom.enabled,Te.zoom.enabled=!1,this.pauseCameraBind=!1,this.panoA=pc.currentPano,this.setSize(),this.setSceneB(),this.emit("enter"),pc.OverlayManager.hide("all")}}},{key:"leave",value:function(){this.editing&&(this.$app.core.get("SceneRenderer").removeComponent(this),this.emit("leave"),this.editing=!1,Te.zoom.enabled=this.zoomEnabled,pc.OverlayManager.show("all",!0))}},{key:"setSceneB",value:function(){var e=this.panoB;2!=Te.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!=Te.visions&&pc.model.supportsTiles&&(e=vc.index[e.id]);var n=function(){if(gc[t.panoB.id]&&(clearTimeout(gc[t.panoB.id]),delete gc[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.skyboxMesh.matrixWorld)}};if(e.tiled){var i=Or.getHFOVForCamera(pc.camera,pc.domElement.clientWidth/2,pc.domElement.clientHeight),o=pc.zoomFov,r=pc.getDirection();e.loadTiledPano(2048,r,{hFov:i,vFov:o},!1,!1,!0).then((function(){n()})),pc.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){}))}else pc.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){n()}))}},{key:"update",value:function(){this.editing&&hc.render(this.$app.core.get("SceneRenderer").scene,this.panoramaCam)}},{key:"setSize",value:function(){this.editing&&(hc.setSize(dc.clientWidth,dc.clientHeight,!0,Math.min(window.devicePixelRatio,2)),this.panoramaCam.updateAspect(dc.clientWidth/dc.clientHeight))}},{key:"changePano",value:function(e){this.panoA=e}}]),n}();function wc(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 bc(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 bc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function bc(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}Re("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=Ge(),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=S(C.mark((function e(){var t,n,i,o,r;return C.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,this.beforeLoad(),!this.$app.Scene.locked){e.next=21;break}return e.next=21,this.$app.Scene.locked;case 21:return this.$app.core.get("TileDownloader").start(),n=JSON.parse(JSON.stringify(t)),e.next=25,gl.handle(n,this.$app);case 25:if(this.$app.core.get("PanoVideoRenderer").init(n.videos),!t.mosaicList){e.next=46;break}i=wc(t.mosaicList),e.prev=28,i.s();case 30:if((o=i.n()).done){e.next=38;break}if(r=o.value,e.t1=r.fileName,!e.t1){e.next=36;break}return e.next=36,zn.loadWithoutUpdate(this.$app.resource.getUserResourceURL(r.fileName));case 36:e.next=30;break;case 38:e.next=43;break;case 40:e.prev=40,e.t2=e.catch(28),i.e(e.t2);case 43:return e.prev=43,i.f(),e.finish(43);case 46:return e.next=48,this.$app.resource.visions();case 48:return this.initPanos(t),e.next=51,this.isQuick(t);case 51:return this.$app.Scene.emit("ready"),this.ready=!0,e.next=55,this.$app.resource.modelmesh();case 55:return e.next=57,this.$app.resource.textures();case 57:return e.next=59,this.$app.resource.floorcad();case 59:return e.next=61,this.$app.resource.flooruser();case 61:return this.$app.core.get("SceneRenderer").addComponent(pe),this.$app.core.get("Player").model.build(),this.afterLoad(),e.next=66,this.loadPanos();case 66:case"end":return e.stop()}}),e,this,[[1,10],[28,40,43,46]])}))),function(){return a.apply(this,arguments)})},{key:"isQuick",value:(r=S(C.mark((function e(t){return C.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=S(C.mark((function e(){return C.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:return 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),e.next=7,this.$app.store.get("tags");case 7:return e.next=9,this.$app.store.get("tours");case 9:return e.next=11,this.$app.store.get("links");case 11:this.$app.Scene.emit("loadeddata");case 12: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 fc(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(),xl.bindEvents(this.$app.core.get("Player")),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("Player")),Gl(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){Le.error(e.message)}1==this.$app.uid&&Il.Init(this.$app.core.get("SceneRenderer"),this.$app.core.get("Player"))}}},{key:"quickEnter",value:(n=S(C.mark((function e(t,n){var i,o,r=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$app.core.get("CameraControls").activateControls(Ue.PANORAMA),i=this.$app.core.get("CameraControls").controls[Ue.PANORAMA],this.$app.withComponent("QuickstartManager",this.$app.core.get("QualityManager"),this.$app.core.get("SceneRenderer").scene,this.$app.core.get("SceneRenderer").camera,i),o=this.$app.core.get("QuickstartManager"),e.next=6,o.load(t);case 6:this.$app.core.get("SceneRenderer").addComponent(o),this.$app.core.get("SceneRenderer").once(os,(function(){Le.info("".concat(r.$app.config.num,"First render after quickstart load finished."))}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getSplit",value:(t=S(C.mark((function e(t,n){return C.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),Le.warn("".concat(this.$app.config.num,"[load visions2] fail"));case 9:return this.splitViews[t]||(this.splitViews[t]=new yc(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 Ec={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 Le.error("failed parsing proto for .dam"),null}return t},decompressModeldata(e){var t=null;try{t=this.decoderModeldata().decode(e)}catch(e){return Le.error("failed parsing proto for .modeldata"),null}return t}};function xc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Tc=function(e){f(n,THREE.Mesh);var t=xc(n);function n(e){var i;o(this,n);var r=new Ri({side:THREE.DoubleSide});(i=t.call(this,e.geometry,r)).materialInside=r;var a=THREE.UniformsUtils.clone(jt.modelOutside.uniforms);return i.materialOutside=new THREE.RawShaderMaterial({fragmentShader:jt.modelOutside.fragmentShader,vertexShader:jt.modelOutside.vertexShader,uniforms:a,side:THREE.FrontSide,name:"chunkOut"}),i.name=e.name||"",i.textureName=e.textureName,i.meshUrl=e.meshUrl,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=this.materialInside;e!==Ue.DOLLHOUSE&&e!==Ue.FLOORPLAN||(t=this.materialOutside),e===Ue.PANORAMA?t.side=THREE.BackSide:t.side=THREE.FrontSide,t.transparent=this.material.transparent,t.uniforms.opacity.value=this.material.uniforms.opacity.value,this.material=t}}]),n}(),Pc={convertProtobufToSceneObject:function(e,t,n){if(0==t.chunk.length)return Le.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;return 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(),new Tc({geometry:n,textureName:t.material_name,name:t.chunk_name,meshUrl:e.resource.getViewImagesURL(Te.job+Te.format)})}))},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})),Le.info("检测到疑似没有noblock数据,应该是手动上传,block置空"));var o=e.sweepLocations.map(function(e){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}}.bind(this)).map(function(e){return e.position=this.convertVisionVector(e.position),e.quaternion=this.convertVisionQuaternion(e.quaternion),e.puck=this.convertVisionVector(e.puck),e}.bind(this));return o.forEach((function(e){e.neighbours=e.neighbours.filter((function(e){return o[e]})).map((function(e){return o[e].uuid}))})),o.forEach((function(e){e.noBlocks&&(e.noBlocks=e.noBlocks.map((function(e){return o[e].uuid})))})),o.forEach((function(e){e.seeMarkers&&(e.seeMarkers=e.seeMarkers.filter((function(e){return o[e]})).map((function(e){return o[e].uuid})))})),o},panos:function(e,t,n){var i=e.core.get("Player").model.panos,o=e.core.get("PanoVideoRenderer"),r=o.videosInfo.videos;if(e.config.view){var a=new Map;i.extend(t.map(function(t){if(t.neighbours.length){var n=r.get(t.uuid);return n&&a.set(t.uuid,n),new bi(e,t.uuid,t,n)}return new bi(e,t.uuid,t,null)}.bind(this)),"id"),o.initVideoPlayer(e.dom,a)}else i.extend(t.map(function(t){return new bi(e,t.uuid,t,r.get(t.uuid))}.bind(this)),"id"),o.initVideoPlayer(e.dom,r);return i.forEach((function(e){e.neighbourUUIDs&&(e.neighbourUUIDs.forEach((function(t){var n=i.get(t);n&&i.setNeighbour(e,n,!0)})),e.neighbourPanos=i.getNeighbours(e)||[]),n.filterList&&n.filterList[e.id]&&(e.filterEffect=n.filterList[e.id])})),0===i.length&&Le.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 bi(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))}},kc={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}}},Rc={load:(e,t,n)=>new Promise((function(n){function i(e,i){e||(t.push(i),++a===o&&n())}if(!e.chunks[0]||!e.chunks[0].meshUrl)return n();var o=le.countUnique(e.chunks.map((function(e){return e.textureName})));e.chunks[0].meshUrl.indexOf("_50k");var r="low";Te.minimalMemoryMode&&"high"===r&&(he.detectSamsungS6()?(Le.warn("Galaxy S6 cannot handle large textures, turning down quality."),r="low"):o>Te.maxMobileTextures&&(Le.warn("Model probably too large for mobile, turning down quality."),r="low"));var a=0,s=e.data.job.uuid+"_50k_texture_jpg_high1/";e.chunks.forEach((function(t){if(!t.material.map&&t.textureName){var n=e.urls.get(s+t.textureName);t.setTextureMap(zn.load(n,i.bind(this,zn.isLoaded(n))))}}))}))},Mc=ie(),Sc=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};Re("resource",(function(){return function(){function e(){o(this,e),this.reload=!1,this.version=Date.now(),this.imageVersion=0,this.linkVersion=0}var t,n,i,r,a,s,l,c,h,d,p,f,m,v,g,y,w;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 Mc+e}},{key:"auth",value:(w=S(C.mark((function e(){var t;return C.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 w.apply(this,arguments)})},{key:"metadata",value:(y=S(C.mark((function e(){var t,n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Le.time("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),t=window.__KANKAN_DATA,n=null,null!=t){e.next=34;break}if(!this.$app.config.view){e.next=16;break}if("local"!=this.$app.config.deploy||this.$app.config.server){e.next=11;break}return e.next=8,Vn.get("scene_view_data/".concat(this.$app.config.num,"/data/scene.json?_=").concat(this.time));case 8:n=e.sent,e.next=14;break;case 11:return e.next=13,Vn.get("/service/scene/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 13:n=e.sent;case 14:e.next=19;break;case 16:return e.next=18,Vn.get("/service/scene/edit/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 18:n=e.sent;case 19:if(null==n.success){e.next=28;break}if(!n.success){e.next=24;break}t=n.data,e.next=26;break;case 24:return this.$app.Scene.emit("error",{type:"network",code:n.code,message:n.message}),e.abrupt("return");case 26:e.next=29;break;case 28:t=n;case 29: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.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);case 34:return Le.timeEnd("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),this.$app.store.set("metadata",t),e.abrupt("return",t);case 37:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"modeldata",value:(g=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.visions();case 2:return e.next=4,this.modelmesh();case 4:return e.next=6,this.textures();case 6:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"visions",value:(v=S(C.mark((function e(){var t,n,i=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Le.time("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),e.next=3,Vn.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,Le.timeEnd("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),function(e){Le.time("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid));var t=Ec.decompressModeldata(e);"ajk"==n.dataSync&&i.$app.DataSYNC.use("DataAJK",{sweepLocations:t});var o=Pc.visionModeldata(t);Le.timeEnd("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid)),i.$app.core.get("Player").model.panos=Pc.panos(i.$app,o,n)}(t);case 10:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"visions2",value:(m=S(C.mark((function e(){var t,n,i=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.$app.core.get("Player").model,Le.time("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),e.next=4,Vn.getBueffer(this.getResourceURL("scene_view_data/{num}/images/vision2.modeldata?_=".concat(this.version)));case 4:n=e.sent,Le.timeEnd("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),function(e){Le.time("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid));var n=Ec.decompressModeldata(e),o=Pc.visionModeldata(n);Le.timeEnd("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid)),Pc.panosAssist(o,i.$app).forEach((function(e){t.panos.index[e.id-1].assistPano=e}))}(n);case 8:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"modelmesh",value:(f=S(C.mark((function e(){var t,n,i=this;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(e,t){if(0===e.length){Le.warn("No geometry found for model, loading faux geometry, disabling outside mode"),t.model.supportedModes[Ue.DOLLHOUSE]=!1,t.model.supportedModes[Ue.FLOORPLAN]=!1;var n=new Tc({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=kc.parseFloor(e.name)),t.model.addChunk(n,e)})),t.model.floors.sort()},Le.time("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),e.next=4,Vn.getBueffer(this.getResourceURL("scene_view_data/{num}/images/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam?_=".concat(this.imageVersion)));case 4:t=e.sent,Le.timeEnd("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),function(e){Le.time("".concat(i.$app.config.num,"[parse dam]").concat(i.$app.uid));var t=Ec.decompressMesh(e),o=Pc.convertProtobufToSceneObject(i.$app,t);Le.timeEnd("".concat(i.$app.config.num,"[parse dam]").concat(i.$app.uid)),n(o,i.$app.core.get("Player"))}(t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"textures",value:(p=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Le.time("".concat(this.$app.config.num,"[load textures]").concat(this.$app.uid)),e.next=3,Rc.load(this.$app.core.get("Player").model,this.$app.core.get("Player").model.meshTextures,this);case 3:Le.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 p.apply(this,arguments)})},{key:"floor",value:(d=S(C.mark((function e(){var t;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,Le.time("".concat(this.$app.config.num,"[load floor]").concat(this.$app.uid)),e.next=5,Vn.get(this.getResourceURL("scene_view_data/{num}/data/floor.json?_=".concat(this.time)));case 5:t=e.sent,Le.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),Le.warn("loaded [floor] error");case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(){return d.apply(this,arguments)})},{key:"floorcad",value:(h=S(C.mark((function e(){var t;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,Le.time("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=5,Vn.get(this.getResourceURL("scene_view_data/{num}/data/floorplan_cad.json?_=".concat(this.time)));case 5:(t=e.sent).floors||(t=Sc(t)),t&&t.floors&&(t.floors=t.floors.filter((function(e){return e.segment&&e.segment.length>0}))),Le.timeEnd("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),Le.warn("loaded [floorcad] error"),t={floors:[{id:0,subgroup:0,name:"1楼","vertex-xy":[{id:0,x:5.531,y:-6.046},{id:1,x:5.531,y:5.777},{id:2,x:-2.663,y:5.777},{id:3,x:-2.663,y:-6.046}],segment:[{id:0,a:0,b:1,border:!0,exterior:!1},{id:1,a:1,b:2,border:!0,exterior:!1},{id:2,a:2,b:3,border:!0,exterior:!1},{id:3,a:3,b:0,border:!0,exterior:!1}],tagging:[{pos:[.0647071629502,.4580562219187],title:"",content:"",showTitle:!0,showContent:!0}],cadInfo:{cadBoundingBox:{x_min:-2.663,x_max:5.531,y_min:-6.046,y_max:5.777,z_min:0,z_max:0},res:56.38726775494,currentScale:1.702512}}]};case 15:return this.$app.store.set("floorcad",t),e.abrupt("return",t);case 17:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return h.apply(this,arguments)})},{key:"flooruser",value:(c=S(C.mark((function e(){var t,n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=null,n=this.$app.store.getValue("metadata"),e.prev=2,Le.time("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),!n.floorPlanUser){e.next=10;break}return e.next=7,Vn.get(this.getUserResourceURL("floorplan_user.json",this.reload));case 7:t=e.sent,e.next=11;break;case 10:t=JSON.parse(JSON.stringify(this.$app.store.getValue("floorcad")));case 11:Le.timeEnd("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),Le.warn("loaded [flooruser] error");case 17:return this.$app.store.set("flooruser",t),e.abrupt("return",t);case 19:case"end":return e.stop()}}),e,this,[[2,14]])}))),function(){return c.apply(this,arguments)})},{key:"tags",value:(l=S(C.mark((function e(t){var n,i,o,r=this;return C.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 e.prev=2,e.next=5,this.$app.store.get("metadata");case 5:if(e.sent.tags){e.next=8;break}return e.abrupt("return",[]);case 8:if(Le.time("".concat(this.num,"[load tags]").concat(this.$app.uid)),n={},"view"!=this.mode){e.next=26;break}if(n.success=!0,e.t0=[],!t){e.next=19;break}return e.next=16,Vn.get(t);case 16:e.t1=e.sent,e.next=22;break;case 19:return e.next=21,Vn.get(this.getUserResourceURL("hot.json"));case 21:e.t1=e.sent;case 22:e.t2=e.t1,n.data={icons:e.t0,tags:e.t2},e.next=29;break;case 26:return e.next=28,this.$app.remote_editor.tag_list({num:this.num});case 28:n=e.sent;case 29:return i=[],n.success&&n.data&&n.data.tags&&n.data.tags&&(o=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=e.visiblePanos.map((function(e){return r.$app.core.get("Player").model.panos.index[e]})):e.visiblePanos=r.$app.TagManager.getVisiblePano(e.position)),e.icon&&-1==i.indexOf(e.icon)&&i.push(e.icon),e}))),this.$app.store.set("tags",n.data),Le.timeEnd("".concat(this.num,"[load tags]").concat(this.$app.uid)),e.abrupt("return",o||[]);case 36:e.prev=36,e.t3=e.catch(2),Le.error("loaded [tags] error",e.t3);case 39:case"end":return e.stop()}}),e,this,[[2,36]])}))),function(e){return l.apply(this,arguments)})},{key:"tours",value:(s=S(C.mark((function e(){var t;return C.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,Vn.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),Le.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 s.apply(this,arguments)})},{key:"links",value:(a=S(C.mark((function e(){var t;return C.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.links){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,Vn.get(this.getUserResourceURL("links.json"));case 10:t=e.sent,this.$app.store.set("links",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.linkPan_list({num:this.num});case 16:t=e.sent,this.$app.store.set("links",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),Le.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return a.apply(this,arguments)})},{key:"mosaics",value:(r=S(C.mark((function e(){var t;return C.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,Vn.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),Le.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=S(C.mark((function e(t){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vn.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=S(C.mark((function e(t){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Vn.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=S(C.mark((function e(t){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vn.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){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/").concat(e,"?_=").concat(this.time)):e}},{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 Ic=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})};function Cc(e,t){return new File([e],t,{type:e.type})}function Ac(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Dc=function(e){f(n,e);var t=Ac(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(){i.app.core.get("Player").on(nr,(function(e){i.emit(nr,e)})),i.app.core.get("Player").on(rr,(function(e){i.emit(rr,e)})),i.app.core.get("Player").on(ar,(function(e){i.emit(ar,e)})),i.app.core.get("Player").on($o,(function(e){i.emit($o,e)})),i.app.core.get("Player").on(Jo,(function(e){i.emit(Jo,e)})),i.app.core.get("Player").on(Xo,(function(e){i.emit(Xo,e)})),i.app.core.get("Player").on(Ko,(function(e){i.emit(Ko,e)})),i.app.core.get("Player").model.on("floor.changed",(function(e,t,n){i.emit("floor.changed",{toMode:t,floorIndex:e.floorIndex})}))})),i}return u(n,[{key:"mode",get:function(){return this.app.core.get("Player").mode}},{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=Ge();return this.app.core.get("Player").flyToNewMode({mode:Ue.FLOORPLAN},e),e}},{key:"dollhouse",value:function(){var e=Ge();return this.app.core.get("Player").flyToNewMode({mode:Ue.DOLLHOUSE},e)}},{key:"vr",value:function(){var e=this;return this.app.core.get("Player").flyToMode("panorama",(function(){return e.app.core.get("Player").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==Ue.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:e.nextPano}))}},{key:"getPoseUrlParams",value:function(){var e;return e=this.app.core.get("Player").getSnapAngleInfo(),"pose=pano:".concat(e.metadata.scan_id,",qua:").concat(Ie.toPrecision(e.metadata.camera_quaternion.toArray(),4))}},{key:"setPose",value:function(e){var t=this.app.core.get("Player");if(!t.flying&&!e.flying){e.position&&e.position instanceof THREE.Vector3==!1&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.quaternion&&e.quaternion instanceof THREE.Quaternion==!1&&(e.quaternion.hasOwnProperty("_x")?e.quaternion=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):e.quaternion=new THREE.Quaternion(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w));var n=t.model.panos.index[e.panoId],i={mode:e.mode,pano:n,quaternion:e.quaternion,zoomLevel:e.zoomLevel,position:e.position,currentScale:e.currentScale,duration:e.duration,aimDuration:e.duration};if(t.mode!=e.mode)t.flyToNewMode(i);else if("panorama"==e.mode)n&&t.flyToPano(i);else{var o=t.cameraControls.controls[e.mode],r=o.camera;e.target&&o.target.copy(e.target),e.position&&r.position.copy(e.position),o.offset.copy(r.position).sub(o.target),"floorplan"==e.mode&&(e.zoom&&(e.currentScale=Ce.convertWorkshopOrthoZoom(e.zoom)),e.currentScale&&(o.currentScale=o.absoluteScale=e.currentScale,o.updateZoom()))}}}},{key:"flyToMode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mode=t,this.mode==t?e&&e():("panorama"!=t||n.pano||(n.pano=this.currentPano),"transitioning"==this.mode&&this.modeTran.split("-")[1]!=t?this.afterCModeFuc.unique=function(){this.afterCModeFuc.unique=e,this.flyToNewMode(n)}.bind(this):(this.afterCModeFuc.unique=e,this.flyToNewMode(n)))}},{key:"flyToPano",value:function(e,t,n){var i=this.app.core.get("Player").model.panos.index[e];i&&this.app.core.get("Player").flyToPano({mode:"panorama",pano:i,lookAtPoint:t,duration:n,aimDuration:n})}},{key:"flyToTag",value:function(e,t){objects.tagManager.activeTag&&objects.tagManager.activeTag!=e&&this.tagManager.dismissActiveTag(),objects.tagManager.navigatingViaTag=!0,objects.tagManager.activateTag(e,"examine"),e.updateBoardOrient=!0,e.examine(this,t,function(){this.following&&(this.play.control.noFly=!0)}.bind(this))}},{key:"flyToPoint",value:function(e,t){var n=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){this.app.core.get("Player").compass.setDisplay(e)}},{key:"getScreenshotInfo",value:function(){var e;return e=this.app.core.get("Player").getSnapAngleInfo(),{camera:{quaternion:Ie.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}}},{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];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(i){var o=t.length,r=[],a=e.app.core.get("Player"),s=setInterval((function(){a.path&&a.path.currentPanoMarker&&(clearInterval(s),e.app.core.get("Screenshot").capture({tasks:{unFish:t},snapshotTopview:!0,notHideTags:!0,done:function(e,t){n?r.push({data:Ic(e),name:t,type:"blob"}):r.push({data:e,name:t,type:"base64"}),r.length==o&&i(r)}}))}),50)}))}},{key:"setFastTransition",value:function(e){this.app.core.get("Player").setPanoTaskEnable(e)}}]),n}(Ci);function Lc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Dc.MODE=Ue;var Vc=function(e){f(n,e);var t=Lc(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.on("ready",(function(){return i.ready=!0})),i.on("loaded",(function(){i.loaded=!0;var e=i.app.core.get("PanoVideoRenderer");e.on(ht.CanPlayVideo,(function(){return i.emit(ht.CanPlayVideo)})),e.on(ht.StartPlay,(function(){return i.emit(ht.StartPlay)})),e.on(ht.SuspendRender,(function(){return i.emit(ht.SuspendRender)})),e.on(ht.ResumeRender,(function(){return i.emit(ht.ResumeRender)}))})),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:"floorId",get:function(){return this.app.core.get("Player").currentPano.floorIndex}},{key:"panoCount",get:function(){return this.app.core.get("Player").model.panos.list.length}},{key:"videoCount",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.length:0}},{key:"videoList",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.map((function(e){return e.id})):[]}},{key:"isCurrentPanoHasVideo",get:function(){return this.app.core.get("Player").currentPano.hasVideo}},{key:"showFloorCadImage",value:function(){this.app.core.get("Player").model.floorplanCadImg.displayCad(!0)}},{key:"hideFloorCadImage",value:function(){var e=this;this.app.core.get("Player")?this.app.core.get("Player").model.floorplanCadImg.displayCad(!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();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=Ge()}},{key:"unlock",value:function(){this.locked&&(this.locked.resolve(),this.locked=null)}}]),n}(Ci),Hc=function(){function e(t){o(this,e),this.app=t,this.plugin=null,this.display=null,this.hidden=!1,this.deferred=Ge()}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}(),zc=function(){function e(t){o(this,e),this.app=t}var t;return u(e,[{key:"use",value:(t=S(C.mark((function e(t,n){return C.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}();_('.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}\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 Oc="#f0ff00",Fc=new THREE.Mesh(new THREE.SphereBufferGeometry(.01,10,10),new THREE.MeshBasicMaterial({color:Oc,depthTest:!1,transparent:!0})),Nc=Gn.createFatLineMat({width:3,color:Oc,alwaysShow:!0});function Bc(e,t){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 n=new THREE.Object3D;n.name="measure",this.balls=[Fc.clone(),Fc.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=2,n.add(this.balls[0]),n.add(this.balls[1]),this.line=Gn.createFatLine([this.points[0],this.points[1]],{material:Nc}),n.add(this.line),this.boldLine=Gn.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,n.add(this.boldLine),this.player.model.add(n),this.group=n,this.player.$app.config.vrFishTemp&&(this.getPosAtSphere(this.player.currentPano.position),this.updateBoldLine())}Bc.prototype.setPoints=function(e){this.points=e},Bc.prototype.initVisiblePanos=function(){var e=this,t=this.player.model.wallManager.roomInfo;if(t)if(this.player.model.wallManager.version=2)for(var n=this.points[0].clone().setY(0),i=this.points[1].clone().setY(0),o=new THREE.Raycaster(n.clone(),i.clone().sub(n).normalize(),0,n.distanceTo(i)).intersectObjects(this.player.model.chunks),r=0;r<o.length;r++){var a=o[r].point.clone(),s=De.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(Ie.isLineIntersect(l,d)){t[c].panos.forEach((function(t){-1==e.visiblePanos.indexOf(t.id)&&e.visiblePanos.push(t.id)})),console.log("加入房间 "+c);break}}},Bc.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()},Bc.prototype.updateBoldLine=function(){this.player.$app.config.vrFishTemp?Gn.updateBoldLine(this.boldLine,this.fishPoints,"moveAndRotate"):Gn.updateBoldLine(this.boldLine,this.points,"update")},Bc.prototype.showOptionLabel=function(e,t){if(e){this.player.chosenMeasureRuler=this;t=Ie.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},Bc.prototype.updateOptionPos=function(){if(this.optionLabelPos){var e=De.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")}},Bc.prototype.getCrossPoint=function(e,t){var n,i,o,r=this.player.domElement.clientWidth,a=this.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},Bc.prototype.getPosInCrossPoint=function(e,t){var n=this.player.domElement.clientWidth,i=this.player.domElement.clientHeight;return Ie.getCrossPointAtRect(e,t,n,i,0,0)},Bc.prototype.getPosAtSphere=function(e,t){this.fishPoints=[];var n=[];this.points.forEach(function(t,i){var o=De.getPosAtSphere(t.clone(),e);this.fishPoints.push(o),n.push(o.x,o.y,o.z),this.balls[i].position.copy(o);var r=Constants.skyRadius/e.distanceTo(t);this.balls[i].scale.set(r,r,r)}.bind(this)),Gn.moveFatLine(this.line,n)};function Uc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Bc.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=De.getPos2d(i,this.player);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},Bc.prototype.updateVisible=function(){this.visiblePanos.indexOf(this.player.currentPano.id)>-1?this.state="active":this.state="unable"},Bc.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=De.getPos2d(this.points[0],this.player),i=De.getPos2d(this.points[1],this.player),o=this.player.domElement.clientWidth,r=this.player.domElement.clientHeight;if(!n.trueSide||!i.trueSide){if(!n.trueSide&&!i.trueSide)return void(this.elem.style.display="none");var a=this.getPosInScreen({point:this.points[0],pos2d:n},{point:this.points[1],pos2d:i},0);if(!a)return void(this.elem.style.display="none");n=a.p1,i=a.p2}var s=n.pos,l=i.pos;if(0!=s.distanceTo(l)){if(n.inSight&&i.inSight)e=(s.x+l.x)/2,t=(s.y+l.y)/2;else{var c,u;c=n.inSight?s.clone():this.getCrossPoint(l,s),u=i.inSight?l.clone():this.getCrossPoint(s,l);var h,d=c.clone().add(u).multiplyScalar(.5);if(e=d.x,t=d.y,d.x>o||d.x<0||d.y>r||d.y<0)return this.elem.style.display="none",void(this.group.visible=!1);if(l.x==s.x){if(l.y==s.y)return void console.warn("pos1和2一样???");h=l.y<s.y?(t-l.y)/(s.y-l.y):(l.y-t)/(l.y-s.y)}else h=l.x<s.x?(e-l.x)/(s.x-l.x):(l.x-e)/(l.x-s.x);if(h<0||h>1)return void(this.elem.style.display="none")}this.elem.style.display="",this.group.visible=!0;var p=this.elem.querySelector(".ruler-label");"left"!=this.dir&&e<o/2||"right"==this.dir?p.className.indexOf("reverse")<0&&(p.className+=" reverse"):p.className.replaceAll("reverse",""),p.style.left=e+"px",p.style.top=t+"px"}else console.warn("ruler间距为0!")};var _c=function(e){f(n,e);var t=Uc(n);function n(e){var i;return 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=t.model.panos.closestPanoTowardPoint({point:i.editTag.position,getAll:!0}).map((function(e){return e.pano})).filter((function(e){return i.editTag.visiblePanos.indexOf(e)>-1&&e.position.clone().setY(i.editTag.position.y).sub(i.editTag.position).length()>1.5})),o=n[0],r=n.filter((function(e){return e.floorIndex==t.model.currentFloor.floorIndex}));r.length>0&&(o=r[0]),o||(o=t.currentPano),t.flyToPano({pano:o,lookAtPoint:i.editTag.position,aimDuration:0,duration:1},(function(){i.edit.enter(i.editTag,(function(){i.editHandle.markTagPos=i.editTag.position,i.editHandle.markSpotA.elem.style.display="block",i.editHandle.markSpotB.elem.style.display="block"}))}))},i.focus=function(e,t,n){var o=i.app.core.get("Player"),r=new THREE.Vector3,a=i.tags.find((function(t){return t.sid==e.sid}))||e.tag,s=o.model.panos.closestPanoTowardPoint({point:a.position,getAll:!0}).map((function(e){return e.pano})).filter((function(e){return a.visiblePanos.indexOf(e)>-1&&e.position.clone().setY(a.position.y).sub(a.position).length()>1.5})),l=s[0],c=s.filter((function(e){return e.floorIndex==o.model.currentFloor.floorIndex}));c.length>0&&(l=c[0]),l||(console.warn("该热点无可视点位"),l=o.currentPano);var u=function(){a.x=i.convertPositionTo2D(a.position).pos.x,a.y=i.convertPositionTo2D(a.position).pos.y,r.set(0,0,0);var t=a.x-("left"==n?e.arrowBox.width+e.tagBox.width/2:0),s=a.y-("top"==n?e.arrowBox.height+e.tagBox.height/2:0);Ie.convertScreenPositionToNDC(t,s,r,i.app.dom),r.unproject(o.camera)};if("board"==t)if(l.id==o.currentPano.id&&"panorama"==o.mode){u();var h=new THREE.Vector3(0,0,1).applyQuaternion(o.camera.quaternion).normalize(),d=o.camera.position.clone().sub(a.position).normalize();if(h.dot(d)<0){var p=o.camera.position.clone().sub(r).multiplyScalar(-1);r=o.camera.position.clone().sub(p)}var f=a.x;o.flyToPano({pano:l,lookAtPoint:r},(function(){f>window.innerWidth/4&&f<window.innerWidth/4*3||(u(),i.app.Camera.flyToPoint(r,{aimDur:400}))}))}else o.flyToPano({pano:l,lookAtPoint:a.position,duration:1e3},(function(){return setTimeout((function(){u(),i.app.Camera.flyToPoint(r,{aimDur:500})}),10)}));else o.flyToPano({pano:l,lookAtPoint:a.position})},i.startMeasure=function(){var e=i.app.core.get("Player");document.querySelector(".widgets-design-option").style.display="none",i.edit.enter(),e.measureRulers.forEach((function(e){e.state="unable"})),e.chosenMeasureRuler&&e.chosenMeasureRuler.showOptionLabel(!1)},i.confirmMeasure=function(e){var t=i.app.core.get("Player");if(1==e){var n=i.editHandle.confirmPos().position;i.lastPosition=n,i.editHandle.enter(),i.measureStep=1;var o=n.clone().setY(t.model.currentFloor.boundingBox.min.y),r=Gn.createLine([n,o],{width:2,color:"#09e1c0"});t.model.add(r);var a=new THREE.Mesh(new THREE.CircleGeometry(.08,32),new THREE.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.6}));a.position.copy(o),a.lookAt(o.clone().add(new THREE.Vector3(0,1,0))),t.model.add(a);var s=document.createElement("div");s.className="visible",s.id="measureTag",s.innerHTML='<span class="point zoom" style="background-image: url('.concat(zn.getImageURL("images/tag_icon_default.svg"),');"></span>');var l=i.convertPositionTo2D(n).pos;s.style.left=l.x+"px",s.style.top=l.y+"px",s.style.setProperty("display","block","important"),document.querySelector("div[xui_tags]").appendChild(s),i.measurePointTemp={measureTag:s,stemLine:r,shadow:a}}else if(2==e){var c=i.editHandle.confirmPos().position,u=i.getVisiblePano(i.lastPosition).concat(i.getVisiblePano(c).filter((function(e){return-1==i.getVisiblePano(i.lastPosition).indexOf(e)}))),h=new Bc({points:[i.lastPosition,c],visiblePanos:u,state:"active"},t);t.chosenMeasureRuler=h,-1==h.visiblePanos.indexOf(t.currentPano.id)&&h.visiblePanos.push(t.currentPano.id),t.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine()}))}},i.cancelMeasure=function(){var e=i.app.core.get("Player");if(i.measurePointTemp){var t=i.measurePointTemp,n=t.measureTag,o=t.stemLine,r=t.shadow;document.querySelector("div[xui_tags]").removeChild(n),o.geometry.dispose(),o.material.dispose(),e.model.remove(o),r.geometry.dispose(),r.material.dispose(),e.model.remove(r),i.measurePointTemp=null}i.edit.exit()},i.app=e,i.view=Ge(),i.editor=Ge(),i.plugin=Ge(),i.loaded=!1,i.editTag=null,i.tags=[],i.showTags=!0,i.showTagsVisible=!1,i.app.store.on("tags",(function(e){i.tags=e.tags||[],i.view.then((function(e){return e.render()})),i.loaded=!0})),i.edit={},i.edit.enter=function(t,n){if(i.isSingleView){i.hideAll();var o=e.core.get("Player");o.locked=!0,o.reticule.visible=!1,i.spot3d.visible=!0,t?(i.updateTagPos=!1,i.spot3d.position.set(t.position.x,t.position.y,t.position.z),setTimeout((function(){var e=new THREE.Vector3(0,0,0),n=new THREE.Vector3(0,0,.5);Ie.projectPositionToCanvas(t.position,o.camera,e,o.domElement),Ie.convertScreenPositionToNDC(e.x,e.y,n,o.domElement);var r=o.getMouseIntersect(n,o.OverlayManager.group.children.concat(o.model.colliders));r&&(i.spot3d.lookAt(r.normal.add(i.spot3d.position)),i.spot3d.topMesh.lookAt(o.camera.position))}),10)):(i.updateTagPos=!0,i.spot3d.position.set(0,1e3,0))}else e.core.get("Scene").getSplit("TAG").then((function(o){null==i.editHandle&&(i.editHandle=e.withNewComponent("TagEditManager",o,{spotA:e.dom.querySelector('.player[name="main"] .player-mark'),spotB:e.dom.querySelector('.player[name="copy"] .player-mark')})),t?i.editHandle.reSetPos(t.position):i.editHandle.enter(),n&&n()}))},i.edit.exit=function(){var t=i.app.core.get("Player");if(i.isSingleView)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,setTimeout((function(){t.cameraControls.activeControl.camera.fov=70,t.camera.fov=t.baseFov*(1/t.zoomLevel)}),50)},i.edit.confirm=function(){var t=i.editTag;if(i.isSingleView){if(i.showAll(),!i.spot3d.visible)return i.edit.exit(),null;t.position=i.spot3d.position.clone(),t.visiblePanos=i.getVisiblePano(i.spot3d.topMesh.getWorldPosition(new THREE.Vector3))}else{if(!i.editHandle)return;var n=i.editHandle.confirmPos(),o=n.position,r=n.sid;if(!o)return i.edit.exit(),null;var a=i.getVisiblePano(o);null==t?t={position:o,visiblePanos:a,sid:r,icon:e.resource.base("images/tag_icon_default.svg")}:t.position=o}return i.edit.exit(),t},i.edit.beginTagVisiSetting=function(){i.showTagsVisible=!0;var e=i.app.core.get("Player");e&&e.linkEditor&&(e.linkEditor.enterSet("tagVisible"),e.linkEditor.beginSetTagVisible())},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(){i.showTagsVisible=!1,i.app.core.get("Player").linkEditor.finishSetTagVisible()},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.querySelector(".widgets-design-option div");n&&n.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.spot3d=new THREE.Group,i.spot3d.renderOrder=it,i.spot3d.name="TagSpot3d",i.spot3d.visible=!1,t.model.add(i.spot3d);var r=new THREE.Mesh(new THREE.PlaneBufferGeometry(.4,.4,1,1),new THREE.MeshLambertMaterial({transparent:!0,map:le.loadTextureFromCache(zn.getImageURL("images/tag_pointer.png"))}));i.spot3d.bottomMesh=r,i.spot3d.add(r);var a=new THREE.Mesh(new THREE.PlaneBufferGeometry(.2,.2,1,1),new THREE.MeshLambertMaterial({transparent:!0,map:le.loadTextureFromCache(zn.getImageURL("images/tag_icon_default.svg"))}));a.renderOrder=ot,a.position.set(0,0,.3),i.spot3d.topMesh=a,i.spot3d.add(a);var s=Gn.createLine([new THREE.Vector3(0,0,.3),new THREE.Vector3(0,0,0)],{width:2,color:"#eee"});i.spot3d.line=s,i.spot3d.add(s);var l=[];t.model.floors.list.map((function(e){return l.push.apply(l,L(e.children))}));var c=new THREE.Vector3(0,-1,0),u=new THREE.Raycaster(new THREE.Vector3(0,0,0),c,.001,9999);t.on("update",(function(n){if(i.measurePointTemp){var o=i.convertPositionTo2D(i.lastPosition),r=i.measurePointTemp.measureTag;r.style.left=o.pos.x+"px",r.style.top=o.pos.y+"px",r.className=o.trueSide&&o.inSight?"visible":""}i.tags&&i.tags.length&&(i.tags.forEach((function(n){if(n.isLose||!1===i.showTags)return n.visible=!1;if(0==i.showTagsVisible&&(i.editTag||t.mode!=Ue.PANORAMA||!n.visiblePanos.includes(t.currentPano)||t.paintEditor&&t.paintEditor.painting))return n.visible=!1;var o=e.TagManager.convertPositionTo2D(n.position);if(n.x=o.pos.x,n.y=o.pos.y,!o.trueSide||!o.inSight)return n.visible=!1;if(t.linkEditor.setTagVisible){u.set(n.position,c);var r=u.intersectObjects(l);if(r.length&&r[0].object.parent.floorIndex!=t.model.currentFloor.floorIndex)return n.visible=!1}n.visible=!0})),i.emit("update",n))}))})),i}return u(n,[{key:"tag",value:function(){return this.ready?Promise.resolve(this):this.plugin.promise()}},{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 De.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 De.ifShelter(e,n,t,null,i)}},{key:"getVisiblePano",value:function(e){return De.getVisiblePano(e,this.app.core.get("Player").model)}},{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=e.visiblePanos.map((function(e){return t.app.core.get("Player").model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position))})),this.tags=[].concat(this.tags,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:"showAll",value:function(){this.showTags=!0}},{key:"hideAll",value:function(){this.showTags=!1}},{key:"convertScreenPositionToNDC",value:function(e,t,n){return Ie.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}(Ci),jc=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=Ge();var i=Ge(),r=null;this.app.Scene.on("BoxVideo.loaded",(function(){r=n.app.core.get("Player"),i.resolve()})),this.edit.enter=function(){r&&r.OverlayManager?n.app.VideoManager.BoxVideo.hideAll():i.then((function(){return n.edit.enter()}))},this.edit.exit=function(){r&&n.app.VideoManager.BoxVideo.showAll()}}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}}]),e}();function Wc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Qc=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={};var i=Ge(),r=null;this.app.Scene.on("loaded",(function(){(r=n.app.core.get("Player")).EditOverlay=new oa(r),r.OverlayManager=new na(r),r.model.createTranControl(r),i.resolve(),n.app.Scene.emit("BoxVideo.loaded")})),this.edit.enter=function(){if(r&&r.EditOverlay){r.EditOverlay.transformControls?r.EditOverlay.enter():r.EditOverlay.init();var e="panorama"!=r.model.mode?1100:0;setTimeout((function(){var e=r.OverlayManager.group.children.filter((function(e){return"video"==e.overlayType}))[0];e&&r.OverlayManager.clickOverlay(e,!0)}),e)}else i.then((function(){return n.edit.enter()}))},this.edit.exit=function(){r&&r.EditOverlay.leave()},this.edit.save=function(){return r.EditOverlay.getOverlaySavingInfo()},this.edit.undoEdit=function(){r.EditOverlay.undoEdit()},this.edit.add=function(){r.EditOverlay.beginToAddPlane()},this.edit.upload=function(e,t){t.videoWidth||t.width?r.EditOverlay.overlayUploaded(e,t):t.oncanplay=function(){r.EditOverlay.overlayUploaded(e,t)}},this.edit.delete=function(e,t){var i=n.getOverlayBySid(e);r.EditOverlay.DeleteOverlay(i,t)},this.edit.lookAt=function(e){var t=n.getOverlayBySid(e);r.OverlayManager.clickOverlay(t,!0)},this.edit.select=function(e){var t=n.getOverlayBySid(e);r.OverlayManager.clickOverlay(t)},this.edit.unselect=function(){var e=r.EditOverlay.editPlane;e&&(e.raycastToFindFloor(),e.updateVisibleOnFloor(),r.EditOverlay.controlSelectOverlay(null),r.EditOverlay.editPlane=null)},this.edit.setVisible=function(e,t){var i=n.getOverlayBySid(e);i.visible=!!t,r.EditOverlay.editPlane&&r.EditOverlay.controlSelectOverlay(i.visible?i:null)},this.edit.transfrom=function(e){r.EditOverlay.editing&&(r.EditOverlay.transformControls.mode=0==e?"translate":1==e?"scale":"rotate")},this.edit.setPlaneWH=function(e,t){return t.value=THREE.MathUtils.clamp(t.value,t.min,t.max),"W"==e&&(r.EditOverlay.editPlane.scale.x*=t.value/r.EditOverlay.editPlane.width,r.EditOverlay.editPlane.width=t.value),"H"==e&&(r.EditOverlay.editPlane.scale.y*=t.value/r.EditOverlay.editPlane.height,r.EditOverlay.editPlane.height=t.value),t.value},this.edit.setThinkness=function(e){var t=r.EditOverlay;return e.value=THREE.MathUtils.clamp(e.value,e.min,e.max),0==e.value?(t.editPlane.addBox(!1),t.editPlane.depth=.001,t.editPlane.scale.z=.001):(t.editPlane.addBox(!0),t.editPlane.depth=e.value/100,t.editPlane.scale.z=e.value/100/Te.overlay.depth),e.value},this.edit.resetRatio=function(){r.EditOverlay.editPlane.overlayType&&(r.EditOverlay.editPlane.width/=r.EditOverlay.editPlane.scale.x,r.EditOverlay.editPlane.height/=r.EditOverlay.editPlane.scale.y,r.EditOverlay.editPlane.scale.setX(1),r.EditOverlay.editPlane.scale.setY(1),r.EditOverlay.updateOverlayScaleDisplay(),r.EditOverlay.useImgRatio())}}return u(e,[{key:"showAll",value:function(){var e=this.app.core.get("Player");e&&(e.OverlayManager.group.visible=!0)}},{key:"hideAll",value:function(){var e=this.app.core.get("Player");e&&(e.OverlayManager.group.visible=!1)}}]),e}(),Zc=function(e){f(n,e);var t=Wc(n);function n(e){var i;return o(this,n),(i=t.call(this)).BoxVideo=new Qc(e),i}return n}(Ci);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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var qc=function(e){f(n,e);var t=Gc(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=Ge();return i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).linkEditor=new ca(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.getUpperFloor(e.activePano.floorIndex);i.edit.unlinkToOtherFloor(),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="upper",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.linkToLowerFloor=function(){var e=r.linkEditor;e.startEditPano||(e.startEditPano=e.activePano);var t=e.getLowerFloor(e.activePano.floorIndex);i.edit.unlinkToOtherFloor(),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="lower",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.floorLinkConfirm=function(){var e=r.linkEditor,t=e.lastFloorActivePano,n=e.linkToFloorPano;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=r.linkEditor;t.startEditPano||(t.startEditPano=t.activePano);var n=e||t.activePano,i=t.panoVTemp[n.id]&&t.panoVTemp[n.id].neighbourPanos||r.model.panos.index[n.id].neighbourPanos,o=Object.keys(i).map((function(e){return r.model.panos.index[e]})),a=[];o.forEach((function(e){e.floorIndex!=n.floorIndex&&a.push({type:"sub",id:e.id})})),a.length&&(t.savePanoVisiChange(n.id,a),t.changeIconVisiState(n.footIcon,t.checkHasNeighbor(n)),t.delVisibleLines(),t.showFootIcons(n,!0),t.createPanoVisiLines(n))},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},i}return n}(Ci),Yc=function(){function e(t,n){o(this,e),this.PanoMosaicManager=n,this.setFromInfo(t),this.getInfo()}return u(e,[{key:"setFromInfo",value:function(e){e.pano?this.pano=e.pano:this.pano=this.PanoMosaicManager.player.model.panos.index[e.panoId],this.dir=e.dir.normalize(),this.rect0=e.rect,this.hfov=parseFloat(e.hfov),this.vfov=parseFloat(e.vfov),this.computeParam(),e.needUpdate&&this.show()}},{key:"getClipRect",value:function(){var e=this.PanoMosaicManager.player.model.matrixWorld.clone().invert(),t=this.pano.position.clone().add(this.dir);t.applyMatrix4(e);var n=Ie.getNormalDir(t,!0,this.pano),i=Ie.getUVfromDir(n),o=this.hfov/360,r=this.vfov/180,a=function(e){return e-Math.floor(e)},s=this.PanoMosaicManager.player.$app.store.getValue("metadata"),l=8;3!=s.sceneSource&&4!=s.sceneSource||(l=16);var c={x:Math.floor(a(i.x-o/2)*l*1024),y:Math.floor(a(i.y-r/2)*l/2*1024),width:Math.floor(o*l*1024),height:Math.floor(r*l/2*1024)};if(c.x+c.width>=1024*l){var u=1024*l-1-c.x;return[{x:c.x,y:c.y,width:u,height:c.height},{x:0,y:c.y,width:c.width-u,height:c.height}]}return[c]}},{key:"computeParam",value:function(){var e=this.hfov/360,t=this.vfov/180,n=this.getAbsoluteAngleByDir(this.dir),i=Ie.getUVfromDir(n.dir2),o=function(e){return e-Math.floor(e)};this.rect={leftBottom:new THREE.Vector2(o(i.x-e/2),o(i.y-t/2)),rightTop:new THREE.Vector2(o(i.x+e/2),o(i.y+t/2))},this.lon=n.lon,this.lat=n.lat}},{key:"getAbsoluteAngleByDir",value:function(e){var t=this.PanoMosaicManager.player.model.matrixWorld.clone().invert(),n=this.pano.position.clone().add(e);n.applyMatrix4(t);var i=Ie.getNormalDir(n,!1,this.pano),o={dir2:i},r=i.clone().negate(),a=Math.atan(r.z/r.x);a+=r.x<0?Math.PI:0,a+=r.x>0&&r.z<0?2*Math.PI:0,o.lon=THREE.MathUtils.radToDeg(a)+180;var s=Math.sqrt(r.x*r.x+r.z*r.z),l=Math.atan(r.y/s);return o.lat=-THREE.MathUtils.radToDeg(l),o.lon%=360,o}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.PanoMosaicManager.showMosaic(this,e)}},{key:"getDirAtAbsoluteAngle",value:function(e,t){var n=Ie.getDirByLonLat(e,t),i=this.pano.skyboxMesh.matrixWorld.clone().invert();return Ie.crossRight(n,i)}},{key:"getDirAtAngle",value:function(e,t){return this.getDirAtAbsoluteAngle(this.lon+e,this.lat+t)}},{key:"getAngleByDir",value:function(e){var t=this.getAbsoluteAngleByDir(e),n=(t.lon-this.lon)%360;return Math.abs(n)>180&&(n+=n>0?-360:360),{lon:n,lat:t.lat-this.lat}}},{key:"checkIfHover",value:function(){if(!this.PanoMosaicManager.player.flying){var e=De.getMouseIntersect(this.PanoMosaicManager.player.camera,[this.PanoMosaicManager.player.model.skybox],this.PanoMosaicManager.player.mouse);if(e){var t=e.point.clone().sub(this.pano.position.clone()),n=this.getAngleByDir(t.clone()),i=n.lon,o=n.lat,r=Math.abs(i);if(r<=this.hfov/2||r>=360-this.hfov/2)if(Math.abs(o)<=this.vfov/2)return e}}}},{key:"getInfo",value:function(){this.info={dir:this.dir,hfov:this.hfov,vfov:this.vfov,pano:this.pano,video:this.video,needUpdate:!0}}}]),e}(),$c=function(){function e(t){o(this,e),this.editing=!1,this.editVideo=null,this.meshGroup=new THREE.Object3D,this.scaleBtn=null,this.hoveredVideo=!1,this.player=t,this.PanoMosaicManager,this.init()}return u(e,[{key:"checkIfCanInit",value:function(){return this.player.model&&this.player.PanoMosaicManager&&this.player.currentPano&&this.player.model.transformControls}},{key:"waitToInit",value:function(e){var t=this;console.log("waitToInit");var n=setInterval((function(){t.checkIfCanInit()&&(e&&e(),clearInterval(n))}),50)}},{key:"init",value:function(){var e=this;this.checkIfCanInit()?(this.PanoMosaicManager=this.player.PanoMosaicManager,this.meshGroup.name="panoMosaic-group",this.player.model.add(this.meshGroup),this.meshGroup.visible=!1,this.scaleBtn=new THREE.Mesh(new THREE.PlaneBufferGeometry(.05,.05),new THREE.MeshBasicMaterial({map:zn.load(zn.getImageURL("images/zoom.png")),transparent:!0,opacity:.75,depthTest:!1,depthWrite:!1})),this.scaleBtn.renderOrder=100,this.meshGroup.add(this.scaleBtn),this.scaleBtn.visible=!1,this.player.on(tr,(function(t,n,i){"panorama"==t&&e.editing&&(e.meshGroup.visible=!1)})),this.player.on("ModeChanged",(function(t,n,i){"panorama"==n&&e.editing&&(e.meshGroup.visible=!0)}))):this.waitToInit((function(){e.init()}))}},{key:"moveScaleBtn",value:function(){var e=1,t=1,n=this.editVideo.getDirAtAngle(this.editVideo.hfov/2+e,this.editVideo.vfov/2+t).normalize();this.scaleBtn.position.copy(this.player.position.clone().add(n)),this.scaleBtn.lookAt(this.player.position)}},{key:"addMosaic",value:function(){if(this.player.flying)this.player.waitFlytoItemFuc=this.addMosaic.bind(this);else{var e=this.player.currentPano,t=this.player.getDirection();this.editVideo=new Yc({pano:e,dir:t,hfov:30,vfov:40,isNew:!0},this.PanoMosaicManager),this.editVideo.isNew=!0,this.beginEditVideo()}}},{key:"lookAtMosaic",value:function(e){var t=this.player.model.panos.index[e.panoId];this.player.flying?this.player.waitFlytoItemFuc=function(){}:this.player.currentPano.id==e.panoId&&"panorama"==this.player.mode?this.player.flyToPano({pano:t,lookAtPoint:t.position.clone().add(e.dir)}):this.player.flyToPano({pano:t,lookAtPoint:t.position.clone().add(e.dir)},(function(){}))}},{key:"beginEditVideo",value:function(){this.player.reticule.visible=!1,this.editVideo.show({isEdit:!0}),this.scaleBtn.visible=!0,this.moveScaleBtn()}},{key:"endEditVideo",value:function(e){delete this.PanoMosaicManager.material.defines.isEdit,this.player.PanoMosaicManager.material.needsUpdate=!0,!e&&this.editVideo&&this.editVideo.setFromInfo(this.editVideo.info),this.PanoMosaicManager.hide(),this.dealPointerUp(),this.editVideo=null,this.hoveredVideo=null,this.hoveredScale=!1,document.querySelector(".player").style.cursor="",this.scaleBtn.visible=!1,this.player.reticule.visible=!0,console.log("endEditVideo")}},{key:"confirmVideo",value:function(e){var t=this.editVideo;t.isNew&&this.PanoMosaicManager.addMosaic(this.editVideo),t.isNew=!1,t.getInfo(),this.endEditVideo(!0)}},{key:"deleteVideo",value:function(e){}},{key:"enter",value:function(){this.editing||(this.editing=!0,this.meshGroup.visible="panorama"==this.player.mode)}},{key:"leave",value:function(){this.editing&&(this.editing=!1,this.endEditVideo(),this.meshGroup.visible=!1,this.player.cameraControls.controls.panorama.insideLookLimitDown=null)}},{key:"scaleVideo",value:function(){if(this.scaling){var e=De.getMouseIntersect(this.player.camera,[this.player.model.skybox],this.player.mouse).point.clone().sub(this.player.position),t=this.editVideo.getAngleByDir(e);if(this.scaleOffset){var n=t.lon<0?this.editVideo.hfov>90?179:1:t.lon;if(this.editVideo.hfov=THREE.MathUtils.clamp(2*n-this.scaleOffset.lon,1,359),this.editVideo.vfov=Math.min(Math.abs((2*t.lat-this.scaleOffset.lat)%360),179,2*(89+this.editVideo.lat),2*(89-this.editVideo.lat)),this.editVideo.video){var i=this.editVideo.video.videoWidth/this.editVideo.video.videoHeight;this.editVideo.hfov/this.editVideo.vfov>i?this.editVideo.hfov=this.editVideo.vfov*i:this.editVideo.vfov=this.editVideo.hfov/i}this.editVideo.computeParam();var o=this.editVideo.rect;this.PanoMosaicManager.material.uniforms.clipRect.value.set(o.leftBottom.x,o.leftBottom.y,o.rightTop.x,o.rightTop.y),this.moveScaleBtn(),console.log("scaling")}else this.scaleOffset={lon:t.lon-this.editVideo.hfov/2,lat:t.lat-this.editVideo.vfov/2}}}},{key:"dragVideo",value:function(){if(this.reposing){var e=De.getMouseIntersect(this.player.camera,[this.player.model.skybox],this.player.mouse).point.clone().sub(this.player.position),t=(new THREE.Matrix4).lookAt(new THREE.Vector3,e,this.player.camera.up);if(this.dragLastDirMat){var n=this.dragLastDirMat.clone().invert(),i=t.clone().multiply(n),o=this.editVideo.dir.clone().applyMatrix4(i),r=this.editVideo.getAbsoluteAngleByDir(o);r.lat-this.editVideo.vfov/2<-89?o=this.editVideo.getDirAtAbsoluteAngle(r.lon,this.editVideo.vfov/2-89):r.lat+this.editVideo.vfov/2>89&&(o=this.editVideo.getDirAtAbsoluteAngle(r.lon,89-this.editVideo.vfov/2)),this.editVideo.dir=o,this.editVideo.computeParam();var a=this.editVideo.rect;this.PanoMosaicManager.material.uniforms.clipRect.value.set(a.leftBottom.x,a.leftBottom.y,a.rightTop.x,a.rightTop.y),this.moveScaleBtn()}this.dragLastDirMat=t}}},{key:"dealPointerDown",value:function(){this.hoveredVideo?(this.reposing=!0,this.player.cameraControls.activeControl.enabled=!1,this.dragVideo()):this.hoveredScale&&(this.scaling=!0,this.player.cameraControls.activeControl.enabled=!1,this.scaleVideo())}},{key:"dealPointerMove",value:function(){this.editVideo&&(this.dragVideo(),this.scaleVideo())}},{key:"dealPointerUp",value:function(){this.editVideo&&(this.reposing=this.scaling=!1,this.player.cameraControls.activeControl.enabled=!0,this.player.cameraControls.activeControl.pointerDragOn=!1,this.dragLastDirMat=null,this.scaleOffset=null)}},{key:"getSavingInfo",value:function(){var e=this.editVideo;return{data:{dir:e.dir,hfov:e.hfov,vfov:e.vfov,pano:e.pano.id,rect:e.getClipRect()},type:this.editVideo.isNew?1:0,needSaveMedia:!e.info||e.file!=e.info.file,done:function(){e.isNew=!1,e.getInfo()}}}},{key:"setSize",value:function(e,t){}},{key:"checkIfHover",value:function(){if("panorama"==this.player.mode){var e=this.editVideo||this.player.currentPano.panoVideo;if(e){this.hoveredVideo=null;var t=De.getMouseIntersect(this.player.camera,[this.scaleBtn],this.player.mouse);return t?(this.hoveredScale=!0,console.log("hover scale"),document.querySelector(".player").style.cursor="move"):(this.hoveredScale=!1,(t=e.checkIfHover())&&this.editVideo&&(this.hoveredVideo=this.editVideo)),this.intersect=t,document.querySelector(".player").style.cursor=t?"move":"",t}}}}]),e}();function Xc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Jc=new THREE.SphereBufferGeometry(10,30,30),Kc=function(e){f(n,THREE.Mesh);var t=Xc(n);function n(e){var i;o(this,n);var r=new THREE.ShaderMaterial({side:THREE.DoubleSide,depthTest:!1,transparent:!0,defines:{NoVideo:"",PrepareVideo:""},uniforms:{map:{value:null},clipRect:{value:new THREE.Vector4(.1,.4,.2,.7)},panoPosition:{value:new THREE.Vector3(0,0,0)},panoMatrix:{value:new THREE.Matrix4}},vertexShader:"\n uniform mat4 panoMatrix;\n //uniform mat4 videoDirMatrix;\n uniform vec3 panoPosition; \n varying vec3 vSamplerDirection;\n\n void main()\n {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); \n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n vec3 positionLocalToPanoCenter = worldPosition.xyz - panoPosition;\n \n vSamplerDirection = (vec4(positionLocalToPanoCenter, 1.0) * panoMatrix).xyz;\n //vSamplerDirection = (vec4(positionLocalToPanoCenter, 1.0) * videoDirMatrix).xyz;\n \n //vSamplerDirection = positionLocalToPanoCenter;\n \n\n vSamplerDirection.x *= -1.0;\n\n }\n\n ",fragmentShader:"\n\n #define PI 3.141592653\n\n uniform vec4 clipRect; \n \n uniform vec3 panoPosition; \n uniform sampler2D map;\n\n varying vec3 vSamplerDirection;\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 float linearStep( float start, float end, float value ) {\n if(start<=end){\n return clamp( (value - start) / (end - start), 0.0, 1.0 );\n }else{\n float width = 1.0 - (start - end) ;\n if(value >= start ){\n return clamp( (value - start) / width, 0.0, 1.0 );\n }else{\n return clamp( (value + 1.0 - start ) / width, 0.0, 1.0 );\n }\n }\n }\n\n void main() \n {\n\n vec2 uv = getSamplerCoord( vSamplerDirection );\n\n \n vec4 videoColor = vec4(0, 1.0,0.8,0.3);;\n #ifdef NoVideo \n videoColor = vec4(0, 1.0,0.8,0.3); //(0, 0.78125,0.68359375,0.4); //greenblue \n #elif defined(PrepareVideo) \n videoColor = vec4(1.0, 1.0, 1.0, 0.05); \n \n #else \n vec2 videoUV = vec2( 0.0, 0.0 ); \n videoUV.x = linearStep( clipRect.x, clipRect.z, uv.x );\n videoUV.y = linearStep( clipRect.y, clipRect.w, uv.y ); \n vec4 mapColor = texture2D( map, videoUV );\n #ifdef isEdit \n videoColor = mix(videoColor, mapColor, mapColor.a );\n #else \n videoColor = mapColor;\n #endif \n #endif\n \n /* float rect = (step( clipRect.x, uv.x ) - step( clipRect.z, uv.x )) //x\n *(step( clipRect.y, uv.y ) - step( clipRect.w, uv.y )); //y \n */ \n float rect;\n if(clipRect.x <= clipRect.z){//识别是否在区域内\n rect = uv.x >= clipRect.x && uv.x <= clipRect.z ? 1.0 : 0.0;\n }else{\n rect = (uv.x >= clipRect.x || uv.x <= clipRect.z) ? 1.0 : 0.0;\n }\n if(rect>0.0){\n if(clipRect.y <= clipRect.w){\n rect = uv.y >= clipRect.y && uv.y <= clipRect.w ? 1.0 : 0.0;\n }else{\n rect = (uv.y >= clipRect.y || uv.y <= clipRect.w) ? 1.0 : 0.0;\n }\n } \n\n rect *= videoColor.a;\n \n vec3 color = videoColor.rgb * rect;\n \n gl_FragColor = vec4( color, rect ); \n } \n "});(i=t.call(this,Jc,r)).player=e,i.list=[],i.visible=!1;var a=e.$app.store.getValue("metadata");a.mosaics&&JSON.parse(a.mosaics).forEach((function(e){e.dir&&(e.dir=(new THREE.Vector3).copy(e.dir),i.addMosaic(new Yc(e,h(i))))})),e.model.add(h(i)),e.on(rr,(function(){i.hide()}));var s=function(){e.currentPano.panoMosaics&&e.currentPano.panoMosaics.length?i.showMosaic(e.currentPano.panoMosaics[0]):e.EditPanoMosaic&&e.EditPanoMosaic.editVideo&&i.showMosaic(e.EditPanoMosaic.editVideo)};return e.on(ar,s),e.on(lr,s),i}return u(n,[{key:"showMosaic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("panorama"==this.player.mode){this.currentpanoMosaic=e,t.isEdit&&(this.material.defines.isEdit="");var n=e.rect;this.material.uniforms.clipRect.value.set(n.leftBottom.x,n.leftBottom.y,n.rightTop.x,n.rightTop.y),this.material.uniforms.panoPosition.value.copy(e.pano.position),this.material.uniforms.panoMatrix.value.copy(e.pano.skyboxMesh.matrixWorld),this.position.copy(e.pano.position),this.visible=!0}}},{key:"hide",value:function(){this.currentPanoVideo&&(this.material.uniforms.map.value&&(this.material.uniforms.map.value.dispose(),this.material.uniforms.map.value=null),this.currentPanoVideo=null,this.material.defines.NoVideo="",this.material.needsUpdate=!0),this.visible=!1}},{key:"addMosaic",value:function(e){this.list.push(e),e.pano.panoMosaics||(e.pano.panoMosaics=[]),e.pano.panoMosaics.push(e),e.pano.updateMakerStyle()}}]),n}();function eu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var tu=function(e){f(n,e);var t=eu(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={},i.mosaic=Ge(),i.mosaics=[];var a=Ge();return i.app.Scene.on("loaded",(function(){i.mosaics=i.app.store.getValue("metadata").mosaicList||[],(r=i.app.core.get("Player")).PanoMosaicManager=new Kc(r),r.EditPanoMosaic=new $c(r),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.edit.mosicEnter=function(){r&&r.EditPanoMosaic?r.EditPanoMosaic.enter():a.then((function(){return r.EditPanoMosaic.enter()}))},i.edit.mosicLeave=function(){r.EditPanoMosaic.leave()},i.edit.addMosaic=function(){r.EditPanoMosaic.addMosaic()},i.edit.findMosic=function(e){r.EditPanoMosaic.lookAtMosaic(e)},i.edit.exitMosicEditing=function(){r.EditPanoMosaic.endEditVideo()},i.edit.getMosaicSavingInfo=function(){return r.EditPanoMosaic.getSavingInfo().data},i}return u(n,[{key:"install",value:function(e,t){this[e]&&this[e].resolve(t)}}]),n}(Ci);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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var iu,ou=function(){function e(t){o(this,e),this.app=t}return u(e,[{key:"add",value:function(e){e.audio&&this.remove(e),e.music&&(e.audio=new Howl({preload:!0,src:[this.app.resource.getUserResourceURL(e.music,!0)],loop:!1,html5:!0,onloaderror(e,t){console.log(e,t)},onplayerror:function(e){console.log(e)},onload(){}}))}},{key:"remove",value:function(e){e.audio&&(e.audio.unload(),e.audio=null,delete e.audio)}},{key:"play",value:function(){}}]),e}(),ru=function(e){f(i,e);var t,n=nu(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=Ge(),t.recorder=Ge(),t.audioPlayer=new ou(e),t.app.store.on("tours",(function(e){t.tours=e,t.load(),t.emit("loaded",t.tours)})),t}return u(i,[{key:"uuid",value:function(){return le.getRandomSid()}},{key:"load",value:function(e){var t=this,n=null;e&&(this.tours=e),this.tours.forEach((function(e){t.audioPlayer.add(e),e.list.forEach((function(e){delete e._trans,e.enter.cover&&-1!=e.enter.cover.indexOf(".jpg")&&(e.enter.cover=t.app.resource.getUserResourceURL(e.enter.cover)),null==n||"panorama"==n.enter.mode&&"panorama"==e.enter.mode&&n.enter.panoId!=e.enter.panoId||(n._notrans=!0),n=e}))}))}},{key:"reload",value:(t=S(C.mark((function e(){return C.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(Cc(Ic(t.enter.cover),"tour-enter-".concat(t.sid,".jpg"))),t.exit&&t.exit.cover&&0===t.exit.cover.indexOf("data:image")&&e.push(Cc(Ic(t.enter.cover),"tour-exit-".concat(t.sid,".jpg")))}))})),{tours:t,files:e}}}]),i}(Ci);function au(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var su=.7,lu=3,cu=1.78,uu=function(e){f(n,e);var t=au(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,!(iu=this.app.core.get("Player")))return this.app.Scene.on("loaded",(function(){t.editing&&t.enter(e)}));this.setPlayerSize(!0),this.oldStates={zoomMax:Te.zoom.max,zoomMin:Te.zoom.min,zoomEnabled:Te.zoom.enabled,zoomToDefaultWhenToPano:Te.zoom.zoomToDefaultWhenToPano},Te.zoom.max=3,Te.zoom.min=.7,Te.zoom.enabled=!0,Te.zoom.zoomToDefaultWhenToPano=!1,this.eventList={zoomTo:e.bind(this),setSize:this.setPlayerSize.bind(this)},iu.on("zoomTo",this.eventList.zoomTo),iu.on("setSize",this.eventList.setSize),this.eventList.zoomTo(iu.zoomLevel),Te.highestQualityTile=!0}}},{key:"leave",value:function(){this.editing=!1,console.log("退出,恢复"),iu&&(iu.zoomTo(1),Te.zoom.enabled=this.oldStates.zoomEnabled,Te.zoom.max=this.oldStates.zoomMax,Te.zoom.min=this.oldStates.zoomMin,Te.zoom.zoomToDefaultWhenToPano=this.oldStates.zoomToDefaultWhenToPano,iu.off("zoomTo",this.eventList.zoomTo),iu.off("setSize",this.eventList.setSize),Te.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<cu){var o=i/cu;iu.domElement.style.height="".concat(o,"px"),iu.domElement.style.top=(n-o)/2+t+"px"}else iu.domElement.style.top="".concat(t,"px"),iu.domElement.style.height="calc(100% - ".concat(t,"px)")}else iu.domElement.style.top=0,iu.domElement.style.height="100%"}},{key:"waitTexLoaded",value:function(e){var t=this;if("panorama"==iu.mode){if(!iu.currentPano||iu.flying)return console.log("延迟"),e||(e=Ge()),setTimeout((function(){t.waitTexLoaded(e)}),100),e.promise();var n=this.getTileSize(),i=new THREE.Vector3(0,0,-1).applyQuaternion(iu.quaternion),o=iu.cameraControls.activeControl.camera,r=o.fov,a=Or.getHFOVForCamera(o,o.aspect,1),s=iu.currentPano.loadTiledPano(n,i,{hFov:a,vFov:r},!1,!1,!0);return s.done((function(){console.log("加载完成"),e&&e.resolve()})),s}return Ge().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"!=iu.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=iu.cameraControls.activeControl.camera.fov/180*e,n=t*cu;return{width:Math.round(n),height:Math.round(t)}}},{key:"listenZoomLevel",value:function(e){}},{key:"onResetCamera",value:function(){"panorama"==iu.mode&&(iu.cameraControls.activeControl.lat=0)}},{key:"onResumeSize",value:function(){var e=this;if(iu){var t=iu.cameraControls.activeControl;if("transitioning"==iu.mode)return iu.once("mode.changed",(function(t,n){e.editing&&e.onResumeSize()}));"panorama"==iu.mode?iu.zoomTo(1):"dollhouse"==iu.mode?(t.target.copy(iu.model.center),this.onRangeChange({value:100})):"floorplan"==iu.mode&&(t.target.setX(iu.model.center.x),t.target.setZ(iu.model.center.z),t.camera.position.setX(iu.model.center.x),t.camera.position.setZ(iu.model.center.z),t.rotateToView(iu.model.size,iu.getDirection()),t.zoomToContain(iu.model.size))}}},{key:"onRangeChange",value:function(e){var t=this;this.temp.onRangeChange=e;var n=iu.cameraControls.activeControl,i=parseInt(e.value)/100;if("transitioning"==iu.mode)return iu.once("mode.changed",(function(e,n){t.editing&&t.onRangeChange(t.temp.onRangeChange)}));if("panorama"==iu.mode)Te.zoom.enabled=!0,iu.zoomTo(i);else if("dollhouse"==iu.mode){var o=(i-su)/(lu-su),r=n.minDistance+(n.maxDistance-n.minDistance)*o;n.camera.position.copy(n.target).add(iu.getDirection().multiplyScalar(-r))}else if("floorplan"==iu.mode){var a=n.getDefaultAbsoluteScale(iu.model.size);n.absoluteScale=a*i}}},{key:"imgAddLabel",value:function(e,t,n){var i=new Image,o=new Image;i.setAttribute("crossOrigin","Anonymous"),o.setAttribute("crossOrigin","Anonymous"),i.src=e,o.src=t;var r=0,a=Ge();return i.onload=o.onload=function(){2==++r&&(n.opacity/=100,a.resolve(le.imgAddLabel(i,o,n)))},a.promise()}}]),n}(Ci),hu=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=S(C.mark((function e(){var t;return C.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=S(C.mark((function e(){var t,n,i,o,r=arguments;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"thumb-1k.jpg",e.next=3,this.setEntry();case 3:return n=e.sent,i={num:this.num,bizType:"settings-thumb",files:n.thumbs.map((function(e){return Cc(e.data,"thumb-".concat(e.name,".jpg"))}))},o=null,e.prev=6,e.next=9,this.app.remote_editor.upload_files(i);case 9:o=e.sent,e.next=15;break;case 12:return e.prev=12,e.t0=e.catch(6),e.abrupt("return",Promise.reject(e.t0));case 15:if(o.success){e.next=17;break}return e.abrupt("return",Promise.reject(o));case 17:return e.prev=17,e.next=20,this.app.remote_editor.saveInitialPage({num:this.num,fileName:t,data:JSON.stringify(n.entry)});case 20:return o=e.sent,e.abrupt("return",o);case 24:return e.prev=24,e.t1=e.catch(17),e.abrupt("return",Promise.reject(e.t1));case 27:case"end":return e.stop()}}),e,this,[[6,12],[17,24]])}))),function(){return n.apply(this,arguments)})},{key:"publish",value:(t=S(C.mark((function e(){return C.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 du(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var pu=function(e){f(n,e);var t=du(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;this.player=this.app.core.get("Player"),this.$paint=this.elem(),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))}},{key:"elem",value:function(){var e=this.app.$plugins.querySelector("[xui_sync_paint]");if(null==e){this.app.$plugins.insertAdjacentHTML("beforeend",'<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=this.app.$plugins.querySelector("[xui_sync_paint]"),this.bind(e)}return e}},{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},Ie.convertScreenPositionToNDC(0,0,this.mouse,this.app.dom);var n=De.getMouseIntersect(this.player.camera,[this.player.model.skybox],this.mouse);this.placeIntersectPlane(n&&n.point)}},{key:"onRecord",value:function(e){this.transformTo3d(e),this.records.push(e),this.emit("data",{type:"paint",data:e})}},{key:"beginStroke",value:function(e){this._mouseDown=!0,this._lastTimestamp=Date.now(),this._lastPosition=this.windowToCanvas(e.x,e.y),this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:5})}},{key:"moveStroke",value:function(e){var t=Date.now(),n=this.windowToCanvas(e.x,e.y),i=this.calcDistance(n,this._lastPosition),o=t-this._lastTimestamp,r=this.calcLineWidth(o,i);this.context.beginPath(),this.context.moveTo(this._lastPosition.x,this._lastPosition.y),this.context.lineTo(n.x,n.y),this.paints.push({color:this.colors[this.role]||"#00c8af",width:r,x:n.x,y:n.y,t:5}),this.context.strokeStyle=this.colors[this.role]||"#00c8af",this.context.lineWidth=r,this.context.lineCap="round",this.context.linJoin="round",this.context.stroke(),this._lastPosition=n,this._lastTimestamp=t,this._lastLineWidth=r}},{key:"endStroke",value:function(){this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:0}),this.onRecord(this.paints),this.paints=[],this.isUndo=!0,this._mouseDown=!1,this._lastTimestamp=0,this._endTime=Date.now()}},{key:"calcDistance",value:function(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}},{key:"calcLineWidth",value:function(e,t){var n,i=t/e;return n=i<=.1?6:i>=3?2:6-(i-.1)/2.9*2,-1==this._lastLineWidth?n:2*this._lastLineWidth/3+1*n/3}},{key:"windowToCanvas",value:function(e,t){var n=this.canvas.getBoundingClientRect();return{x:Math.round(e-n.left),y:Math.round(t-n.top)}}},{key:"placeIntersectPlane",value:function(e){if(!this.intersectPlane){var t=new THREE.PlaneGeometry(8e3,8e4,1,1);this.intersectPlane=new THREE.Mesh(t,new THREE.MeshBasicMaterial({transparent:!0,wireframe:!1,opacity:0,side:THREE.DoubleSide,depthTest:!1})),this.intersectPlane.lookAt(new THREE.Vector3(0,1,0)),this.intersectPlane.name="intersectPlane",this.player.model.add(this.intersectPlane)}if(e){this.intersectPlane.position.copy(e);var n=this.player.getDirection(null,this.player.camera);this.intersectPlane.lookAt(e.clone().add(n))}}},{key:"transformTo3d",value:function(e){var t=this;0!=e.length&&e.forEach((function(e){Ie.convertScreenPositionToNDC(e.x,e.y,t.mouse,t.app.dom);var n=De.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=De.getPos2d(n,t.player,t.player.camera);e.x=i.pos.x,e.y=i.pos.y}))}},{key:"undo",value:function(){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var e=0;e<this.records.length;e++)this.paint(this.records[e],0);this.emit("data",{type:"undo"})}},{key:"paint",value:function(e){for(var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,i=function(i){n?e[i].t&&setTimeout((function(){t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke()}),n):e[i].t&&(t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke())},o=0;o<e.length-1;o++)i(o)}},{key:"receive",value:function(e){if("undo"==e.type){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var t=0;t<this.records.length;t++)this.paint(this.records[t],0)}else this.transformTo2d(e.data),this.paint(e.data),this.records.push(e.data)}}]),n}(Ci);function fu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mu(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 vu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var gu="rotate",yu="zoom",wu="endRotation",bu="moveModel",Eu="flying.started",xu=function(e){f(n,e);var t=vu(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.inited=!1,i.started=!1,i}return u(n,[{key:"init",value:function(){var e=this;this.app.Camera.on(Eu,(function(t){return e.emitData(t)})),this.app.Camera.on(gu,(function(t){return e.emitData(t)})),this.app.Camera.on(wu,(function(t){return e.emitData(t)})),this.app.Camera.on(yu,(function(t){return e.emitData(t)})),this.app.Camera.on(bu,(function(t){return e.emitData(t)}))}},{key:"start",value:function(){this.started=!0,this.inited||(this.init(),this.app.core.get("Player").setPanoTaskEnable(!1),this.app.VRScreenSYNC=!0,Te.zoom.enabled=!1)}},{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,Te.zoom.enabled=!0}},{key:"sync",value:function(){var e=this.app.core.get("Player");if(this.app.Camera.mode===Ue.PANORAMA){var t=null;e.currentPano&&(t=e.currentPano.id),this.emitData({panoId:t,quaternion:e.cameraControls.activeControl.camera.quaternion,mode:Ue.PANORAMA,type:"flyToPano"})}else this.emitData({quaternion:e.cameraControls.activeControl.camera.quaternion,target:{x:e.cameraControls.activeControl.target.x,y:e.cameraControls.activeControl.target.y,z:e.cameraControls.activeControl.target.z},position:e.position,currentScale:e.cameraControls.activeControl.currentScale,mode:this.app.Camera.mode,type:"flyToNewMode"})}},{key:"emitData",value:function(e){var t=this.app.core.get("Player");if("receive"!=t.syncType){if(this.started&&"follow"!=this.role){if(e)for(var n in e){var i=e[n];i instanceof THREE.Vector2?e[n]=new THREE.Vector2(i.x,i.y):i instanceof THREE.Vector3&&(e[n]=new THREE.Vector3(i.x,i.y,i.z))}this.emit("data",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mu(Object(n),!0).forEach((function(t){fu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(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}(Ci);function Tu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Pu=function(e){f(n,e);var t=Tu(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==Ue.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==Ue.TRANSITIONING?null:e.mode==Ue.FLOORPLAN?(t.flyToNewMode({mode:Ue.FLOORPLAN,callback:n}),!1):e.mode!=Ue.DOLLHOUSE||(t.flyToNewMode({mode:Ue.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){t.cameraControls.activeControl.locked=!0,t.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var n=new THREE.Vector3(0,0,-1).applyQuaternion(t.cameraControls.activeControl.camera.quaternion).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(n)},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i}return u(n,[{key:"receive",value:function(e){var t=this.app.core.get("Player"),n=!0;switch(this.transform(e),e.type){case"flyToPano":t.syncType="receive";var i=t.model.panos.index[parseInt(e.panoId)],o={};o.pano=i,e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(o);break;case"flyToNewMode":t.syncType="receive",e&&e.panoId&&(e.pano=t.model.panos.index[parseInt(e.panoId)]),"panorama"==t.model.mode&&(this.app.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==Ue.PANORAMA&&(n=this.toSame(e,t,function(){this.syncRotate(e,t)}.bind(this)))&&this.syncRotate(e,t);break;case"endRotation":t.cameraControls&&t.cameraControls.activeControl&&(t.cameraControls.activeControl.locked=!1,console.log("endRotation:"+JSON.stringify(e.rotationSpeed)),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}(xu);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 o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ru,Mu,Su=function(e){f(n,e);var t=ku(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==Ue.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 console.log("mode:"+t.mode),t.mode==Ue.TRANSITIONING?null:e.mode==Ue.FLOORPLAN?(t.flyToNewMode({mode:Ue.FLOORPLAN,callback:n}),!1):e.mode!=Ue.DOLLHOUSE||(t.flyToNewMode({mode:Ue.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){t.cameraControls.activeControl.locked=!0,t.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var n=new THREE.Vector3(0,0,-1).applyQuaternion(t.cameraControls.activeControl.camera.quaternion).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(n)},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i.role="leader",i}return u(n,[{key:"start",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Ye(w(n.prototype),"start",this).call(this),e.follow){this.role="follow";var t=this.app.core.get("Player");t.locked=!0}}},{key:"receive",value:function(e){var t=this.app.core.get("Player"),n=!0;switch(this.transform(e),e.type){case"flyToPano":console.log("漫游");var i=t.model.panos.index[parseInt(e.panoId)];t.locked=!1;var o={};o.pano=i,e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(o,(function(){t.locked=!0}));break;case"flyToNewMode":console.log("飞入飞出"),e.panoId&&(e.pano=t.model.panos.index[parseInt(e.panoId)]),t.locked=!1,e.callback=function(){t.locked=!0},t.flyToNewMode(e);break;case"rotate":console.log("旋转"),t.model.mode==Ue.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&&(console.log("停止旋转"),t.cameraControls.activeControl.locked=!1,console.log("endRotation:"+JSON.stringify(e.rotationSpeed)),t.cameraControls.activeControl.rotationSpeed=e.rotationSpeed||new THREE.Vector2);break;case"zoom":console.log("缩放"),null==(n=this.toSame(e,t,function(){t.handleControlScroll(e.zoom)}.bind(this)))||n&&t.handleControlScroll(e.zoom);break;case"moveModel":console.log("移动模型"),null==(n=this.toSame(e,t,function(){this.copyCameraProp(t,e.info)}.bind(this)))||n&&(t.cameraControls.activeControl.locked=!0,t.locked=!0,this.copyCameraProp(t,e.info),t.cameraControls.activeControl.locked=!1,t.locked=!1)}}}]),n}(xu),Iu=function e(t){o(this,e),this.sync=new Pu(t),this.follow=new Su(t),this.paint=new pu(t)};function Cu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Au,Du={},Lu=function(e){f(n,THREE.EventDispatcher);var t=Cu(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.app.Scene.on("loaded",(function(){Ru=i.app.core.get("Player"),Mu=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;Au=Math.max(2*Math.sqrt(Ru.model.size.x*Ru.model.size.x+Ru.model.size.y*Ru.model.size.y),30),Ru.model.floors.list.forEach((function(e){var t=0;e.panos.forEach((function(e){t+=e.position.y})),t/=e.panos.length,Du[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",Ru.model.add(this.ground),this.ground.position.setY(Ru.model.center.y);var t=[{x:0,y:0,z:0},{x:10,y:0,z:0}];this.linkLine=Gn.createFatLine(t,{material:Gn.createFatLineMat({lineWidth:3,color:"#00C8AF",dashed:!0,gapSize:.2,dashSize:.3})}),Ru.model.add(this.linkLine),this.linkLine2=Gn.createFatLine(t,{material:Gn.createFatLineMat({lineWidth:3,opacity:.2,color:"#30FFDF"})}),Ru.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&&(Ru.viewLinkManager.hoverBalloon&&e.markView.balloon==Ru.viewLinkManager.hoverBalloon&&e.dragBalloonStart(),Ru.viewLinkManager.hoverExit?e.dragExitStart():Ru.viewLinkManager.hoverCircle&&e.dragViewStart(Ru.viewLinkManager.hoverCircle.mesh))},dragEnd:function(t){e.handelDragEnd(t)},lookAim:function(){Ru.on("ifFocusPoint",(function(t){if(e.editing&&e.markView){t.importance<3&&(t.importance=3,t.aim=e.markView.circle.mesh.position.clone())}}))}},Ru.viewLinkManager.dispatchEvent({type:"getViewLinkEdit",v:this}),Ru.viewLinkManager.addEventListener("changeIntersect",(function(t){e.dispatchEvent({type:"changeIntersect",hovered:t.hovered})})),this.inited=!0}},{key:"enter",value:function(){this.editing=!0,Mu&&(Ru.model.on("floor.changed",this.events.changeFloor),Ru.on("pointerStart",this.events.dragStart),Ru.on("pointerMove",this.events.movePos),Ru.on("pointerUp",this.events.dragEnd),Ru.on("ifFocusPoint",this.events.lookAim))}},{key:"leave",value:function(){this.editing=!1,Mu&&(Mu.removeComponent(this),Ru.model.off("floor.changed",this.events.changeFloor),Ru.off("pointerStart",this.events.dragStart),Ru.off("pointerUp",this.events.dragEnd),Ru.off("pointerMove",this.events.movePos),Ru.off("ifFocusPoint",this.events.lookAim))}},{key:"setSize",value:function(e,t){this.inited}},{key:"checkCanAddView",value:function(){return this.inited&&!Ru.flying&&Ru.viewLinkManager.inited}},{key:"addView",value:function(){var e=this;if(this.checkCanAddView()){var t=function(){e.markView=new Wa({sid:"view360_"+le.getRandomSid()},e.app),e.markView.balloon.showOrHide(!0,0),Ru.updateFromControls(),Ru.viewLinkManager.addView(e.markView),e.beginSetPos(),e.setEditState(!0),ea.add("viewChoosePos")};Ru.isOutsideMode()?t():Ru.flyToMode("floorplan",t)}else var n=setInterval((function(){e.checkCanAddView()&&(e.addView(),clearInterval(n))}),50)}},{key:"reEditView",value:function(e){this.markView=Ru.viewLinkManager.views[e],this.oldData=this.getData(),this.reEdit=!0,this.setEditState(!0),this.markView.circle.mesh.visible=!0,Ru.viewLinkManager.focusOn(this.markView),"dollhouse"!=Ru.mode&&"floorplan"!=Ru.mode||this.markView.balloon.showOrHide(!0,0)}},{key:"setEditState",value:function(e){e=!!e,this.markView.balloon.setSelect(e),this.markView.circle.setSelect(e),this.markView.balloon.setStrictScale(e),e||(this.reEdit=!1)}},{key:"exit",value:function(){this.markView&&(this.stopSetPos(),this.cancelSetExit(),this.cancelSetEntry(),this.markView.circle.setSelect(!1),"panorama"!=Ru.modeTran.split("-")[1]&&(this.markView.circle.mesh.visible=!1),this.markView.balloon.showOrHide(null,50,"auto"),this.setEditState(!1),this.markView=null)}},{key:"cancelEdit",value:function(){this.markView&&(this.reEdit?(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.circle.mesh.scale.set(this.oldData.circle.scale,this.oldData.circle.scale,this.oldData.circle.scale),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()):(Ru.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){if(e){var t=Ru.model.allFloorsVisible?Ru.model.panos.list:Ru.model.currentFloor.panos;0==t.length&&(console.error("该楼层无漫游点,无法设置! 请联系客服"),console.warn("无漫游点!!"),this.stopSetPos()),Ru.model.panos.fadeMarkerOpacity(1,null,[{toOp:1,member:t}])}else Ru.model.panos.fadeMarkerOpacity(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(Ru.camera,!0),this.markView.circle.mesh.visible=!1,this.placeGround(),"reset"!=e&&this.movePos("init"),Ru.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),Ru.off("click",this.events.confirmPos),ea.remove("viewChoosePos"))}},{key:"confirmPos",value:function(){this.stopSetPos(),this.dispatchEvent({type:"confirm",info:{sid:this.markView.sid,balloon:{pos:this.markView.balloon.mesh.position.toArray()},circle:{pos:this.markView.circle.position.toArray(),qua:this.markView.circle.quaternion.toArray(),scale:parseInt(100*this.markView.circle.mesh.scale.x)},nearestPano:this.markView.nearestPano.id,enterQuaternion:this.markView.enterQuaternion.toArray(),exitDirection:this.markView.exitDirection.toArray()}})}},{key:"cancelPos",value:function(){this.dispatchEvent({type:"cancelPos"})}},{key:"reSetPos",value:function(){this.markView.balloon.setSelect(!0),Ru.viewLinkManager.focusOn(this.markView)}},{key:"focusView",value:function(e){var t=Ru.viewLinkManager.views[e];Ru.viewLinkManager.focusOn(t)}},{key:"changeScale",value:function(e){console.log("changeScale",e),this.markView.circle.mesh.scale.set(e,e,e)}},{key:"movePos",value:function(e){if(this.settingPos){var t=Ru.model.center.clone();if(!(d=Ru.getMouseIntersect(null,[this.ground])))return void console.error("no intersect");if(Ru.model.allFloorsVisible)"init"!=e&&t.setY(this.markView.balloon.mesh.position.y);else{if(0==Ru.model.currentFloor.panos.length)return console.warn("该层无漫游点!"),void this.stopSetPos();t.setY(Du[Ru.model.currentFloor.floorIndex])}var n=De.getPosAtPlane(d.point,Ru,{y:t.y});n||((n=De.getPosAtPlane(d.point,Ru,{y:100})).y=t.y),n&&n.distanceTo(t)>Au&&(n=t.clone().add(n.clone().sub(t).normalize().multiplyScalar(Au)));var i=this.markView.circle.mesh.quaternion.clone(),o=Ru.model.panos.sortByScore([bi.filters.isPanoAligned(),function(e){return Ru.model.allFloorsVisible||e.floor==Ru.model.currentFloor}],[function(e){return-n.distanceTo(e.position)}])[0].pano,r=o.position.clone();if(this.markView.nearestPano=o,n.setY(r.y),this.markView.balloon.mesh.position.copy(n),this.markView.balloon.update(),d=De.ifIntersectChunks(r,n,Ru.model,{InfinityLen:!0})){var a=d[0].face.normal.applyQuaternion(d[0].object.quaternion);p=d[0].point.add(a.multiplyScalar(.01*(1+Math.random()))),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().add(a))}else{var s=n.clone().sub(o.position).setY(0).normalize().multiplyScalar(Te.boundExpandLength);p=r.clone().add(s),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(s))}this.markView.circle.mesh.visible=!0,this.markView.circle.updatePos("normal",{position:p,quaternion:this.markView.circle.mesh.quaternion.clone()}),this.markView.circle.mesh.quaternion.copy(i);var l=n.clone().sub(p),c=l.length(),u=p.clone().add(l.multiplyScalar(Math.max(0,(c-.4)/c)));u.y-=.01;var h=[u,p];if(Gn.moveFatLine(this.linkLine,h),r.distanceTo(p)<r.distanceTo(u))h=[r,p];else h=[r,u];Gn.moveFatLine(this.linkLine2,h),this.linkLine.visible=!0,this.linkLine2.visible=!0}else if(this.draggingExit){var d=Ru.getMouseIntersect(null,[Ru.model.skybox]);this.markView.exitDoor.mesh.position.copy(d.point.clone().normalize().multiplyScalar(Te.view360.circleDisToCenter))}else if(this.draggingCircleAtView)if(this.settingVisibles){d=Ru.getMouseIntersect(null,[Ru.model.skybox]);this.draggingMesh.position.copy(d.point.clone().normalize().multiplyScalar(Te.view360.circleDisToCenter)),this.saveVisibleViews()}else{var p;r=Ru.position.clone();if((d=De.getMouseIntersect(Ru.camera,Ru.model.colliders.concat(Ru.model.skybox),Ru.mouse)).object==Ru.model.skybox){s=d.point.clone().sub(r).normalize().multiplyScalar(Te.boundExpandLength);p=r.clone().add(s),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(s))}else{a=d.face.normal.applyQuaternion(d.object.quaternion);Ru.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=Ru.currentPano}}},{key:"placeGround",value:function(){this.ground.position.copy(this.markView.balloon.mesh.position),this.ground.lookAt(this.ground.position.clone().add(Ru.getDirection(null,Ru.camera)))}},{key:"changeType",value:function(e){console.log("changeType",e),this.markView.linkType=e,this.markView.setPano()}},{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}}),Ru.viewLinkManager.views[e].circle.setMapOut(t)}},{key:"setExitMap",value:function(e,t){console.log("setExitMap",e,t),"object"==typeof t&&(t={style:{exit:t}}),Ru.viewLinkManager.views[e].exitDoor.setMapOut(t)}},{key:"deleteView",value:function(e){try{Ru.viewLinkManager.views[e].dispose(),Ru.viewLinkManager.removeView(Ru.viewLinkManager.views[e])}catch(e){console.log(e)}}},{key:"enterView",value:function(e){var t=this,n=function(){e&&e()};Ru.flying?Ru.once("flying.ended",(function(){t.enterView(e)})):Ru.currentPano==this.markView.pano&&"panorama"==Ru.mode?n():this.markView.enter360Pano(n)}},{key:"exitView",value:function(){return new Promise((function(e,t){Ru.viewLinkManager.exitView().then((function(){e("success")}))}))}},{key:"beginSetEntry",value:function(){var e=this,t=new Ge;return console.log("beginSetEntry"),this.settingEntry=!0,this.enterView((function(){t.resolve(),Ru.flyToPano({pano:Ru.currentPano,quaternion:e.markView.enterQuaternion,rotSpeed:2})})),t.promise()}},{key:"confirmEntry",value:function(){Ru.currentPano==this.markView.pano&&(this.markView.pano.quaternion.copy(Ru.quaternion),this.markView.enterQuaternion.copy(Ru.quaternion),this.markView.mapChangeRot(),this.dispatchEvent({type:"confirmEntry",sid:this.markView.sid,enterQuaternion:Ru.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 Ge;return this.settingExit=!0,this.enterView((function(){t.resolve(),Ru.flyToPano({pano:Ru.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=Ru.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=Ru.viewLinkManager.views[e];n.circle.mesh.visible=!0,Ru.handleInputStart(t.offsetX,t.offsetY,!0,!0);var i=Ru.getMouseIntersect(null,[Ru.model.skybox]);n.circle.updatePos("at360View",{viewDir:i.point.clone()}),n.circle.update(Ru.camera),this.saveVisibleViews()}},{key:"delVisibleView",value:function(e){delete this.markView.visibleViews[e],Ru.viewLinkManager.views[e].circle.mesh.visible=!1,this.saveVisibleViews()}},{key:"saveVisibleViews",value:function(){var e={};for(var t in Ru.viewLinkManager.views)Ru.viewLinkManager.views[t].circle.mesh.visible&&(e[t]=Ru.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,Ru.cameraControls.activeControl.enabled=!1)}},{key:"dragExitStart",value:function(){this.settingExit&&(this.draggingExit=!0,Ru.cameraControls.activeControl.enabled=!1)}},{key:"dragViewStart",value:function(e){(this.settingVisibles||this.markView&&e==this.markView.circle.mesh)&&(this.draggingCircleAtView=!0,this.draggingMesh=e,Ru.cameraControls.activeControl.enabled=!1)}},{key:"handelDragEnd",value:function(e){Ru.flying||(this.draggingBall?(this.draggingBall=!1,this.settingPos&&this.confirmPos(),e.consume()):this.draggingExit?(this.draggingExit=!1,Ru.cameraControls.activeControl.pointerDragOn=!1,e.consume()):this.draggingCircleAtView&&(this.draggingCircleAtView=!1,Ru.cameraControls.activeControl.pointerDragOn=!1,this.confirmPos(),e.consume()),this.draggingMesh=null,Ru.cameraControls.activeControl.enabled=!0)}},{key:"getData",value:function(e){return{sid:this.markView.sid,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?Ru.viewLinkManager.showAllViews():setTimeout((function(){e.showAll()}),200)}},{key:"hideAll",value:function(){var e=this;this.inited?Ru.viewLinkManager.hideAllViews():setTimeout((function(){e.hideAll()}),200)}}]),n}();function Vu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Hu=function(e){f(n,e);var t=Vu(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=Ge();return i.filterTemp={},i.app.Scene.on("loaded",(function(){r=i.app.core.get("Player"),a.resolve()})),i.edit.brightness=function(e){i.getPanoMeshes().forEach((function(t){t.material.uniforms.filterBase0.value.setX(e),t.material.uniforms.filterBase1.value.setX(e)})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=r.currentPano.filterEffect||{}),i.filterTemp[r.currentPano.id].brightness=e},i.edit.contrast=function(e){i.getPanoMeshes().forEach((function(t){t.material.uniforms.filterBase0.value.setY(e),t.material.uniforms.filterBase1.value.setY(e)})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=r.currentPano.filterEffect||{}),i.filterTemp[r.currentPano.id].contrast=e},i.edit.saturation=function(e){i.getPanoMeshes().forEach((function(t){t.material.uniforms.filterBase0.value.setZ(e),t.material.uniforms.filterBase1.value.setZ(e)})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=r.currentPano.filterEffect||{}),i.filterTemp[r.currentPano.id].saturation=e},i.edit.temperature=function(e){i.getPanoMeshes().forEach((function(t){t.material.uniforms.filterTemperature0.value=e,t.material.uniforms.filterTemperature1.value=e})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=r.currentPano.filterEffect||{}),i.filterTemp[r.currentPano.id].temperature=e},i.edit.applyCurrent2All=function(){var e=i.filterTemp[r.currentPano.id]||r.currentPano.filterEffect;e&&r.model.panos.list.forEach((function(t){t.panoType||(i.filterTemp[t.id]=e)}))},i.edit.save=function(){var e={};r.model.panos.list.forEach((function(t){t.filterEffect&&(e[t.id]=t.filterEffect)})),Object.assign(e,i.filterTemp);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]})),t.filterTemp={}}}},i.edit.undoEdit=function(){i.filterTemp={};var e=r.currentPano.filterEffect||{};i.getPanoMeshes().forEach((function(t){t.material.uniforms.filterBase0.value.set(e.brightness||0,e.contrast||0,e.saturation||0),t.material.uniforms.filterBase1.value.set(e.brightness||0,e.contrast||0,e.saturation||0),t.material.uniforms.filterTemperature0.value=e.temperature||0,t.material.uniforms.filterTemperature1.value=e.temperature||0}))},i}return u(n,[{key:"updatePanoFilters",value:function(e,t){var n=this.filterTemp[e.id]||e.filterEffect||{};this.getPanoMeshes().forEach((function(e){e.material.uniforms.filterBase0.value.set(n.brightness||0,n.contrast||0,n.saturation||0),e.material.uniforms.filterTemperature0.value=n.temperature||0}));var i=this.filterTemp[t.id]||t.filterEffect||{};this.getPanoMeshes().forEach((function(e){e.material.uniforms.filterBase1.value.set(i.brightness||0,i.contrast||0,i.saturation||0),e.material.uniforms.filterTemperature1.value=i.temperature||0}))}},{key:"getPanoMeshes",value:function(){var e=this.app.core.get("Player"),t=[this.app.core.get("QuickstartManager").skybox].concat(L(e.model.chunks));return e.model.skybox&&t.push(e.model.skybox),t}}]),n}(Ci);var zu=Object.freeze({__proto__:null,tour_save:function(e){return Vn.post("/service/scene/edit/tour/save",e)},tour_delete:function(e){return Vn.post("/service/scene/edit/tour/delete",e)},locales:function(e){return Vn.post("/service/scene/edit/locales",e)},upload_content:function(e){return Vn.post("/service/scene/edit/upload/content",e)},getAuth:function(e){return Vn.postFile("/service/scene/edit/getAuth",e)},saveInitialPage:function(e){return Vn.post("/service/scene/edit/saveInitialPage",e)},linkPan_upload:function(e){return Vn.postFile("/service/scene/edit/linkPan/upload",e)},linkPan_save:function(e){return Vn.post("/service/scene/edit/linkPan/save",e)},linkPan_delete:function(e){return Vn.post("/service/scene/edit/linkPan/delete",e)},styles_delete:function(e){return Vn.post("/service/scene/edit/styles/delete",e)},linkPan_list:function(e){return Vn.postFile("/service/scene/edit/linkPan/list",e)},base_save:function(e){return Vn.post("/service/scene/edit/base/save",e)},cad_rename:function(e){return Vn.post("/service/scene/edit/cad/rename",e)},icons_delete:function(e){return Vn.post("/service/scene/edit/icons/delete",e)},photo_box_save:function(e){return Vn.post("/service/scene/edit/photo/box/save",e)},photo_box_delete:function(e){return Vn.post("/service/scene/edit/photo/box/delete",e)},waterMark_add:function(e){return Vn.post("/service/scene/edit/waterMark/add",e)},waterMark_delete:function(e){return Vn.post("/service/scene/edit/waterMark/delete",e)},mosaics_delete:function(e){return Vn.post("/service/scene/edit/mosaics/delete",e)},mosaics_add:function(e){return Vn.post("/service/scene/edit/mosaics/add",e)},mosaics_list:function(e){return Vn.post("/service/scene/edit/mosaics/list",e)},publicScene:function(e){return Vn.post("/service/scene/edit/publicScene",e)},upload_files:function(e){return Vn.postFile("/service/scene/edit/upload/files",e)},delete_file:function(e){return Vn.post("/service/scene/edit/delete/file",e)},saveUpload:function(e){return Vn.post("/service/scene/edit/saveUpload",e)},getInfo:function(e){return Vn.get("/service/scene/edit/getInfo",e)},saveRoam:function(e){return Vn.post("/service/scene/edit/saveRoam",e)},saveTagsVisible:function(e){return Vn.post("/service/scene/edit/saveTagsVisible",e)},cad_save:function(e){return Vn.post("/service/scene/edit/cad/save",e)},tag_save:function(e){return Vn.post("/service/scene/edit/tag/save",e)},tag_delete:function(e){return Vn.post("/service/scene/edit/tag/delete",e)},uploadPanorama:function(e){return Vn.postFile("/service/scene/edit/uploadPanorama",e)},uploadModel:function(e){return Vn.postFile("/service/scene/edit/uploadModel",e)},downloadModel:function(e){return Vn.postFile("/service/scene/edit/downloadModel",e)},tag_list:function(e){return Vn.postFile("/service/scene/edit/tag/list",e)},cad_reset:function(e){return Vn.postFile("/service/scene/edit/cad/reset",e)},downloadPanorama:function(e){return Vn.post("/service/scene/edit/downloadPanorama",e)},video_box_save:function(e){return Vn.post("/service/scene/edit/video/box/save",e)},video_box_delete:function(e){return Vn.post("/service/scene/edit/video/box/delete",e)},uploadBallScreenVideo:function(e){return Vn.postFile("/service/scene/edit/uploadBallScreenVideo",e)},downloadBallScreenVideo:function(e){return Vn.post("/service/scene/edit/downloadBallScreenVideo",e)},sceneSync:function(e){return Vn.postFile("/service/scene/edit/sceneSync",e)}}),Ou=Object.freeze({__proto__:null,downLoadZSData:function(e){return Vn.postFile("/service/scene/downLoadZSData",e)},check_key:function(e){return Vn.post("/service/scene/check/key",e)},getInfo:function(e){return Vn.get("/service/scene/getInfo",e)}});function Fu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Nu=function(e){f(n,e);var t=Fu(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).withComponent("store"),i.withComponent("resource"),i.withComponent("Scene"),i.withDom(),i.remote_editor=zu,i.remote_viewer=Ou,function(e){e.Scene=new Vc(e),e.Camera=new Dc(e),e.MinMap=new Hc(e),e.DataSYNC=new zc(e),e.TagManager=new _c(e),e.CadManager=new jc(e),e.VideoManager=new Zc(e),e.WalkManager=new qc(e),e.RepairManager=new tu(e),e.TourManager=new ru(e),e.Editor=new hu(e),e.Connect=new Iu(e),e.Screenshot=new uu(e),e.ViewLinkEdit=new Lu(e),e.FilterManager=new Hu(e)}(h(i)),function(e){e&&!Ln&&(Dn=e.config,Ln=e,(An=Cn.create({baseURL:Dn.server||""})).interceptors.request.use((function(e){return-1!=e.url.indexOf("/service/")&&(e.headers.token=he.valueFromUrl("token")||localStorage.getItem("token")||""),e}),(function(e){return Promise.reject(e)})),An.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 Ln&&!1===e.data.success&&Ln.Scene.emit("error",{type:"network",code:e.data.code,message:e.data.message}),e.data}),(function(e){if(Ln){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("data/floorplan_cad")&&Ln.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)),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,i,o=this;if("string"==typeof e)return(n=e,i=this.config.version+"-"+Date.now(),oe(ie()+"plugins/"+n+".js",n,i)).then((function(e){return o.Plugins.add(window[e],t)}))}},{key:"render",value:function(){this.core.get("Scene").start()}},{key:"metadata",value:function(e){return void 0===e?(this.store.set("metadata"),this):this.store.get("metadata")}}]),n}(Se);return Nu.MITT={Emiter:Ci},Nu.Utils={MathLight:Ce},Nu.Animate={transitions:pe,easing:de,lerp:ut},Nu.Viewmode=Ue,Nu.Deferred=Ge,Nu}));