@realsee/dnalogel 3.47.0 → 3.47.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(ee,N){typeof exports=="object"&&typeof module!="undefined"?N(exports,require("three"),require("three/examples/jsm/renderers/CSS3DRenderer"),require("@realsee/five/line"),require("animejs"),require("@realsee/five"),require("hammerjs"),require("three/examples/jsm/loaders/FBXLoader"),require("earcut"),require("@realsee/five/gltf-loader")):typeof define=="function"&&define.amd?define(["exports","three","three/examples/jsm/renderers/CSS3DRenderer","@realsee/five/line","animejs","@realsee/five","hammerjs","three/examples/jsm/loaders/FBXLoader","earcut","@realsee/five/gltf-loader"],N):(ee=typeof globalThis!="undefined"?globalThis:ee||self,N(ee.dnalogel={},ee.THREE,ee.CSS3DRenderer,ee.Line,ee.anime,ee.FiveSDK,ee.Hammer,ee.FBXLoader,ee.earcut,ee.GLTFLoader))})(this,function(ee,N,He,wt,Wi,Xe,vn,An,ui,gs){"use strict";var Cx=Object.defineProperty,Px=Object.defineProperties;var Ix=Object.getOwnPropertyDescriptors;var jr=Object.getOwnPropertySymbols;var Gm=Object.prototype.hasOwnProperty,Qm=Object.prototype.propertyIsEnumerable;var yc=(ee,N,He)=>N in ee?Cx(ee,N,{enumerable:!0,configurable:!0,writable:!0,value:He}):ee[N]=He,x=(ee,N)=>{for(var He in N||(N={}))Gm.call(N,He)&&yc(ee,He,N[He]);if(jr)for(var He of jr(N))Qm.call(N,He)&&yc(ee,He,N[He]);return ee},ne=(ee,N)=>Px(ee,Ix(N));var fs=(ee,N)=>{var He={};for(var wt in ee)Gm.call(ee,wt)&&N.indexOf(wt)<0&&(He[wt]=ee[wt]);if(ee!=null&&jr)for(var wt of jr(ee))N.indexOf(wt)<0&&Qm.call(ee,wt)&&(He[wt]=ee[wt]);return He};var d=(ee,N,He)=>(yc(ee,typeof N!="symbol"?N+"":N,He),He);var H=(ee,N,He)=>new Promise((wt,Wi)=>{var Xe=ui=>{try{An(He.next(ui))}catch(gs){Wi(gs)}},vn=ui=>{try{An(He.throw(ui))}catch(gs){Wi(gs)}},An=ui=>ui.done?wt(ui.value):Promise.resolve(ui.value).then(Xe,vn);An((He=He.apply(ee,N)).next())});function Um(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const y=Um(N);function Ym(){console.debug("%c %c@realsee/dnalogel %cv3.47.0",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function Xm(){const n=typeof OffscreenCanvas!="undefined",t=n&&new OffscreenCanvas(1,1).getContext("webgl")!==null;n&&!t&&Object.assign(window,{OffscreenCanvas:function(e,i){const s=document.createElement("canvas");return s.width=e,s.height=i,s}})}function wc(){}const Cc=()=>Promise.resolve(),Pc={__queue:Promise.resolve()};function Zm(n=Cc){Pc.__queue=Pc.__queue.then(n).catch(Cc)}function lo(n,t,e){const i=n.x,s=n.y,o=Math.floor(i/t*1e4)/1e4,r=Math.floor(s/e*1e4)/1e4;return{x:o,y:r}}function zr(n,t,e){const{x:i,y:s}=n,o=i*t,r=s*e;return{x:o,y:r}}function co(n){if(n.length<2)return{};const t=n.slice(-2),e=t[0],i={x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};return{control:e,end:i}}function Jm(n,t,e=wc){new Promise(i=>{setTimeout(()=>{e(),i(!0)},t*n)})}const qm=window,Ic=window.requestAnimationFrame||qm.webkitRequestAnimationFrame||(n=>setTimeout(n,16));function ho(n,t=0){t<=0?Ic(n):Ic(()=>ho(n,t-1))}var Kt=Object.freeze({Linear:Object.freeze({None:function(n){return n},In:function(n){return this.None(n)},Out:function(n){return this.None(n)},InOut:function(n){return this.None(n)}}),Quadratic:Object.freeze({In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(n){var t=1.70158;return n===1?1:n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return n===0?0:--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}}),Bounce:Object.freeze({In:function(n){return 1-Kt.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Kt.Bounce.In(n*2)*.5:Kt.Bounce.Out(n*2-1)*.5+.5}}),generatePow:function(n){return n===void 0&&(n=4),n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return Math.pow(t,n)},Out:function(t){return 1-Math.pow(1-t,n)},InOut:function(t){return t<.5?Math.pow(t*2,n)/2:(1-Math.pow(2-t*2,n))/2+.5}}}}),bn=function(){return performance.now()},Mc=function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},n.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},n.prototype.update=function(t,e){t===void 0&&(t=bn()),e===void 0&&(e=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var o=this._tweens[i[s]],r=!e;o&&o.update(t,r)===!1&&!e&&delete this._tweens[i[s]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},n}(),Hi={Linear:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=Hi.Utils.Linear;return t<0?o(n[0],n[1],i):t>1?o(n[e],n[e-1],e-i):o(n[s],n[s+1>e?e:s+1],i-s)},Bezier:function(n,t){for(var e=0,i=n.length-1,s=Math.pow,o=Hi.Utils.Bernstein,r=0;r<=i;r++)e+=s(1-t,i-r)*s(t,r)*n[r]*o(i,r);return e},CatmullRom:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=Hi.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(s=Math.floor(i=e*(1+t))),o(n[(s-1+e)%e],n[s],n[(s+1)%e],n[(s+2)%e],i-s)):t<0?n[0]-(o(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[e]-(o(n[e],n[e],n[e-1],n[e-1],i-e)-n[e]):o(n[s?s-1:0],n[s],n[e<s+1?e:s+1],n[e<s+2?e:s+2],i-s)},Utils:{Linear:function(n,t,e){return(t-n)*e+n},Bernstein:function(n,t){var e=Hi.Utils.Factorial;return e(n)/e(t)/e(n-t)},Factorial:function(){var n=[1];return function(t){var e=1;if(n[t])return n[t];for(var i=t;i>1;i--)e*=i;return n[t]=e,e}}(),CatmullRom:function(n,t,e,i,s){var o=(e-n)*.5,r=(i-t)*.5,a=s*s,l=s*a;return(2*t-2*e+o+r)*l+(-3*t+3*e-2*o-r)*a+o*s+t}}},Or=function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n}(),Vr=new Mc,uo=function(){function n(t,e){e===void 0&&(e=Vr),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Kt.Linear.None,this._interpolationFunction=Hi.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Or.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.getDuration=function(){return this._duration},n.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},n.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},n.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},n.prototype.start=function(t,e){if(t===void 0&&(t=bn()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var o in this._valuesEnd)s[o]=this._valuesEnd[o];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},n.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},n.prototype._setupProperties=function(t,e,i,s,o){for(var r in i){var a=t[r],l=Array.isArray(a),c=l?"array":typeof a,h=!l&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(h){var u=i[r];if(u.length===0)continue;for(var f=[a],g=0,v=u.length;g<v;g+=1){var p=this._handleRelativeValue(a,u[g]);if(isNaN(p)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(p)}h&&(i[r]=f)}if((c==="object"||l)&&a&&!h){e[r]=l?[]:{};var m=a;for(var A in m)e[r][A]=m[A];s[r]=l?[]:{};var u=i[r];if(!this._isDynamic){var w={};for(var A in u)w[A]=u[A];i[r]=u=w}this._setupProperties(m,e[r],u,s[r],o)}else(typeof e[r]=="undefined"||o)&&(e[r]=a),l||(e[r]*=1),h?s[r]=i[r].slice().reverse():s[r]=e[r]||0}}},n.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},n.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},n.prototype.pause=function(t){return t===void 0&&(t=bn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},n.prototype.resume=function(t){return t===void 0&&(t=bn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},n.prototype.group=function(t){return t===void 0&&(t=Vr),this._group=t,this},n.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},n.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},n.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},n.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},n.prototype.easing=function(t){return t===void 0&&(t=Kt.Linear.None),this._easingFunction=t,this},n.prototype.interpolation=function(t){return t===void 0&&(t=Hi.Linear),this._interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},n.prototype.onStart=function(t){return this._onStartCallback=t,this},n.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},n.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},n.prototype.onStop=function(t){return this._onStopCallback=t,this},n.prototype.update=function(t,e){var i=this,s;if(t===void 0&&(t=bn()),e===void 0&&(e=!0),this._isPaused)return!0;var o,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,l=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(i._duration===0||a>c)return 1;var m=Math.trunc(a/l),A=a-m*l,w=Math.min(A/i._duration,1);return w===0&&a===i._duration?1:w},u=h(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var v=0,p=this._chainedTweens.length;v<p;v++)this._chainedTweens[v].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},n.prototype._updateProperties=function(t,e,i,s){for(var o in i)if(e[o]!==void 0){var r=e[o]||0,a=i[o],l=Array.isArray(t[o]),c=Array.isArray(a),h=!l&&c;h?t[o]=this._interpolationFunction(a,s):typeof a=="object"&&a?this._updateProperties(t[o],r,a,s):(a=this._handleRelativeValue(r,a),typeof a=="number"&&(t[o]=r+(a-r)*s))}},n.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},n.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},n}(),Km="23.1.1",$m=Or.nextId,$t=Vr,ep=$t.getAll.bind($t),tp=$t.removeAll.bind($t),ip=$t.add.bind($t),Ec=$t.remove.bind($t),np=$t.update.bind($t),kc={Easing:Kt,Group:Mc,Interpolation:Hi,now:bn,Sequence:Or,nextId:$m,Tween:uo,VERSION:Km,getAll:ep,removeAll:tp,add:ip,remove:Ec,update:np};function sp(n,t,e,i=Kt.Linear.None){const s=new uo(n).to(t,e).easing(i).start();function o(r){s.update(r)&&requestAnimationFrame(o)}return requestAnimationFrame(o),s}var fi=(n=>(n.Drawline="Drawline",n.Undo="Undo",n.Exit="Exit",n))(fi||{});const ms=Symbol("$$PAINT_BRUSH_EVENT$$");function fo(n){return n[ms]||(n[ms]={}),n[ms]}function op(n){n[ms]||delete n[ms]}let rp=class{hasListener(t){const e=fo(this);return e&&e[t]&&e[t].length>0}on(t,e,i){const s=fo(this);return s[t]||(s[t]=[]),s[t].push([e,i||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){op(this);return}const i=fo(this);if(i[t]||(i[t]=[]),e===void 0){i[t].length=0;return}let s=0;for(;s<i[t].length&&i[t][s][0]!==e;s++);s<i[t].length&&i[t].splice(s,1)}emit(t,...e){let i=!1;const o=fo(this)[t]||[];for(let r of o.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(i=!0)}return i}};function ki(){return((1+Math.random())*65536|0).toString(16).substring(1)}function lt(){return(ki()+ki()+"-"+ki()+"-4"+ki().substr(0,3)+"-"+ki()+"-"+ki()+ki()+ki()).toLowerCase()}const ap=`
1
+ (function(ee,N){typeof exports=="object"&&typeof module!="undefined"?N(exports,require("three"),require("three/examples/jsm/renderers/CSS3DRenderer"),require("@realsee/five/line"),require("animejs"),require("@realsee/five"),require("hammerjs"),require("three/examples/jsm/loaders/FBXLoader"),require("earcut"),require("@realsee/five/gltf-loader")):typeof define=="function"&&define.amd?define(["exports","three","three/examples/jsm/renderers/CSS3DRenderer","@realsee/five/line","animejs","@realsee/five","hammerjs","three/examples/jsm/loaders/FBXLoader","earcut","@realsee/five/gltf-loader"],N):(ee=typeof globalThis!="undefined"?globalThis:ee||self,N(ee.dnalogel={},ee.THREE,ee.CSS3DRenderer,ee.Line,ee.anime,ee.FiveSDK,ee.Hammer,ee.FBXLoader,ee.earcut,ee.GLTFLoader))})(this,function(ee,N,He,wt,Wi,Xe,vn,An,ui,gs){"use strict";var Cx=Object.defineProperty,Px=Object.defineProperties;var Ix=Object.getOwnPropertyDescriptors;var jr=Object.getOwnPropertySymbols;var Gm=Object.prototype.hasOwnProperty,Qm=Object.prototype.propertyIsEnumerable;var yc=(ee,N,He)=>N in ee?Cx(ee,N,{enumerable:!0,configurable:!0,writable:!0,value:He}):ee[N]=He,x=(ee,N)=>{for(var He in N||(N={}))Gm.call(N,He)&&yc(ee,He,N[He]);if(jr)for(var He of jr(N))Qm.call(N,He)&&yc(ee,He,N[He]);return ee},ne=(ee,N)=>Px(ee,Ix(N));var fs=(ee,N)=>{var He={};for(var wt in ee)Gm.call(ee,wt)&&N.indexOf(wt)<0&&(He[wt]=ee[wt]);if(ee!=null&&jr)for(var wt of jr(ee))N.indexOf(wt)<0&&Qm.call(ee,wt)&&(He[wt]=ee[wt]);return He};var d=(ee,N,He)=>(yc(ee,typeof N!="symbol"?N+"":N,He),He);var H=(ee,N,He)=>new Promise((wt,Wi)=>{var Xe=ui=>{try{An(He.next(ui))}catch(gs){Wi(gs)}},vn=ui=>{try{An(He.throw(ui))}catch(gs){Wi(gs)}},An=ui=>ui.done?wt(ui.value):Promise.resolve(ui.value).then(Xe,vn);An((He=He.apply(ee,N)).next())});function Um(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const y=Um(N);function Ym(){console.debug("%c %c@realsee/dnalogel %cv3.47.2",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function Xm(){const n=typeof OffscreenCanvas!="undefined",t=n&&new OffscreenCanvas(1,1).getContext("webgl")!==null;n&&!t&&Object.assign(window,{OffscreenCanvas:function(e,i){const s=document.createElement("canvas");return s.width=e,s.height=i,s}})}function wc(){}const Cc=()=>Promise.resolve(),Pc={__queue:Promise.resolve()};function Zm(n=Cc){Pc.__queue=Pc.__queue.then(n).catch(Cc)}function lo(n,t,e){const i=n.x,s=n.y,o=Math.floor(i/t*1e4)/1e4,r=Math.floor(s/e*1e4)/1e4;return{x:o,y:r}}function zr(n,t,e){const{x:i,y:s}=n,o=i*t,r=s*e;return{x:o,y:r}}function co(n){if(n.length<2)return{};const t=n.slice(-2),e=t[0],i={x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};return{control:e,end:i}}function Jm(n,t,e=wc){new Promise(i=>{setTimeout(()=>{e(),i(!0)},t*n)})}const qm=window,Ic=window.requestAnimationFrame||qm.webkitRequestAnimationFrame||(n=>setTimeout(n,16));function ho(n,t=0){t<=0?Ic(n):Ic(()=>ho(n,t-1))}var Kt=Object.freeze({Linear:Object.freeze({None:function(n){return n},In:function(n){return this.None(n)},Out:function(n){return this.None(n)},InOut:function(n){return this.None(n)}}),Quadratic:Object.freeze({In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(n){var t=1.70158;return n===1?1:n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return n===0?0:--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}}),Bounce:Object.freeze({In:function(n){return 1-Kt.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Kt.Bounce.In(n*2)*.5:Kt.Bounce.Out(n*2-1)*.5+.5}}),generatePow:function(n){return n===void 0&&(n=4),n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return Math.pow(t,n)},Out:function(t){return 1-Math.pow(1-t,n)},InOut:function(t){return t<.5?Math.pow(t*2,n)/2:(1-Math.pow(2-t*2,n))/2+.5}}}}),bn=function(){return performance.now()},Mc=function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},n.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},n.prototype.update=function(t,e){t===void 0&&(t=bn()),e===void 0&&(e=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var o=this._tweens[i[s]],r=!e;o&&o.update(t,r)===!1&&!e&&delete this._tweens[i[s]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},n}(),Hi={Linear:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=Hi.Utils.Linear;return t<0?o(n[0],n[1],i):t>1?o(n[e],n[e-1],e-i):o(n[s],n[s+1>e?e:s+1],i-s)},Bezier:function(n,t){for(var e=0,i=n.length-1,s=Math.pow,o=Hi.Utils.Bernstein,r=0;r<=i;r++)e+=s(1-t,i-r)*s(t,r)*n[r]*o(i,r);return e},CatmullRom:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=Hi.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(s=Math.floor(i=e*(1+t))),o(n[(s-1+e)%e],n[s],n[(s+1)%e],n[(s+2)%e],i-s)):t<0?n[0]-(o(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[e]-(o(n[e],n[e],n[e-1],n[e-1],i-e)-n[e]):o(n[s?s-1:0],n[s],n[e<s+1?e:s+1],n[e<s+2?e:s+2],i-s)},Utils:{Linear:function(n,t,e){return(t-n)*e+n},Bernstein:function(n,t){var e=Hi.Utils.Factorial;return e(n)/e(t)/e(n-t)},Factorial:function(){var n=[1];return function(t){var e=1;if(n[t])return n[t];for(var i=t;i>1;i--)e*=i;return n[t]=e,e}}(),CatmullRom:function(n,t,e,i,s){var o=(e-n)*.5,r=(i-t)*.5,a=s*s,l=s*a;return(2*t-2*e+o+r)*l+(-3*t+3*e-2*o-r)*a+o*s+t}}},Or=function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n}(),Vr=new Mc,uo=function(){function n(t,e){e===void 0&&(e=Vr),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Kt.Linear.None,this._interpolationFunction=Hi.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Or.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.getDuration=function(){return this._duration},n.prototype.to=function(t,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},n.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},n.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},n.prototype.start=function(t,e){if(t===void 0&&(t=bn()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var o in this._valuesEnd)s[o]=this._valuesEnd[o];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},n.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},n.prototype._setupProperties=function(t,e,i,s,o){for(var r in i){var a=t[r],l=Array.isArray(a),c=l?"array":typeof a,h=!l&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(h){var u=i[r];if(u.length===0)continue;for(var f=[a],g=0,v=u.length;g<v;g+=1){var p=this._handleRelativeValue(a,u[g]);if(isNaN(p)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(p)}h&&(i[r]=f)}if((c==="object"||l)&&a&&!h){e[r]=l?[]:{};var m=a;for(var A in m)e[r][A]=m[A];s[r]=l?[]:{};var u=i[r];if(!this._isDynamic){var w={};for(var A in u)w[A]=u[A];i[r]=u=w}this._setupProperties(m,e[r],u,s[r],o)}else(typeof e[r]=="undefined"||o)&&(e[r]=a),l||(e[r]*=1),h?s[r]=i[r].slice().reverse():s[r]=e[r]||0}}},n.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},n.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},n.prototype.pause=function(t){return t===void 0&&(t=bn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},n.prototype.resume=function(t){return t===void 0&&(t=bn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},n.prototype.group=function(t){return t===void 0&&(t=Vr),this._group=t,this},n.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},n.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},n.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},n.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},n.prototype.easing=function(t){return t===void 0&&(t=Kt.Linear.None),this._easingFunction=t,this},n.prototype.interpolation=function(t){return t===void 0&&(t=Hi.Linear),this._interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},n.prototype.onStart=function(t){return this._onStartCallback=t,this},n.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},n.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},n.prototype.onStop=function(t){return this._onStopCallback=t,this},n.prototype.update=function(t,e){var i=this,s;if(t===void 0&&(t=bn()),e===void 0&&(e=!0),this._isPaused)return!0;var o,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,l=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(i._duration===0||a>c)return 1;var m=Math.trunc(a/l),A=a-m*l,w=Math.min(A/i._duration,1);return w===0&&a===i._duration?1:w},u=h(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var v=0,p=this._chainedTweens.length;v<p;v++)this._chainedTweens[v].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},n.prototype._updateProperties=function(t,e,i,s){for(var o in i)if(e[o]!==void 0){var r=e[o]||0,a=i[o],l=Array.isArray(t[o]),c=Array.isArray(a),h=!l&&c;h?t[o]=this._interpolationFunction(a,s):typeof a=="object"&&a?this._updateProperties(t[o],r,a,s):(a=this._handleRelativeValue(r,a),typeof a=="number"&&(t[o]=r+(a-r)*s))}},n.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},n.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},n}(),Km="23.1.1",$m=Or.nextId,$t=Vr,ep=$t.getAll.bind($t),tp=$t.removeAll.bind($t),ip=$t.add.bind($t),Ec=$t.remove.bind($t),np=$t.update.bind($t),kc={Easing:Kt,Group:Mc,Interpolation:Hi,now:bn,Sequence:Or,nextId:$m,Tween:uo,VERSION:Km,getAll:ep,removeAll:tp,add:ip,remove:Ec,update:np};function sp(n,t,e,i=Kt.Linear.None){const s=new uo(n).to(t,e).easing(i).start();function o(r){s.update(r)&&requestAnimationFrame(o)}return requestAnimationFrame(o),s}var fi=(n=>(n.Drawline="Drawline",n.Undo="Undo",n.Exit="Exit",n))(fi||{});const ms=Symbol("$$PAINT_BRUSH_EVENT$$");function fo(n){return n[ms]||(n[ms]={}),n[ms]}function op(n){n[ms]||delete n[ms]}let rp=class{hasListener(t){const e=fo(this);return e&&e[t]&&e[t].length>0}on(t,e,i){const s=fo(this);return s[t]||(s[t]=[]),s[t].push([e,i||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){op(this);return}const i=fo(this);if(i[t]||(i[t]=[]),e===void 0){i[t].length=0;return}let s=0;for(;s<i[t].length&&i[t][s][0]!==e;s++);s<i[t].length&&i[t].splice(s,1)}emit(t,...e){let i=!1;const o=fo(this)[t]||[];for(let r of o.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(i=!0)}return i}};function ki(){return((1+Math.random())*65536|0).toString(16).substring(1)}function lt(){return(ki()+ki()+"-"+ki()+"-4"+ki().substr(0,3)+"-"+ki()+"-"+ki()+ki()+ki()).toLowerCase()}const ap=`
2
2
  <style type="text/css">
3
3
 
4
4
  #_gl_paintBrush {
@@ -174,7 +174,7 @@ void main() {
174
174
  float match = 1.0 - uv.x;
175
175
  gl_FragColor = vec4(1.0,1.0,1.0,match);
176
176
  }
177
- `;function Sp(){const n=new y.PlaneGeometry(.4,.4),t=Ep,e=new y.TextureLoader().load(t);e.encoding=y.sRGBEncoding,e.minFilter=y.LinearFilter;const i=new y.MeshBasicMaterial({map:e,transparent:!0,depthTest:!1});return new y.Mesh(n,i)}function Lp(){const n=new y.CurvePath;n.add(new y.LineCurve3(new y.Vector3(0,0,0),new y.Vector3(0,0,.1)));const t=new y.TubeGeometry(n,8,.003),e=new y.ShaderMaterial({vertexShader:xp,fragmentShader:Dp,depthTest:!1,transparent:!0});return new y.Mesh(t,e)}function Tp(){const n=new y.SphereGeometry(.01,20,20),t=new y.MeshBasicMaterial({color:10349931,depthTest:!1,transparent:!0,side:y.DoubleSide}),e=new y.Mesh(n,t);return e.position.set(0,0,.1),e}function jp(){const t=new ch({pointerEvents:"none",cornerPoints:[new y.Vector3(-.2,.2,0),new y.Vector3(-.2,-.2,0),new y.Vector3(.2,-.2,0),new y.Vector3(.2,.2,0)]}),e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.backgroundImage=`url(${Sc})`,e.style.backgroundSize="100%",e.style.backgroundRepeat="no-repeat",t.container.appendChild(e),t}class jc extends y.Object3D{constructor(e){super();d(this,"planeMesh");d(this,"lineMesh");d(this,"ballMesh");d(this,"borderMesh");this.planeMesh=Sp(),this.lineMesh=Lp(),this.ballMesh=Tp(),this.borderMesh=jp(),this.add(this.planeMesh,this.lineMesh,this.ballMesh,this.borderMesh),Tc(e)}updateWithIntersect(e){if(!e.face)return;const i=new y.Vector3().addVectors(e.point,e.face.normal);this.position.copy(e.point),this.lookAt(i)}show(){this.visible=!0,this.borderMesh.parent||this.add(this.borderMesh)}hide(){this.visible=!1,this.remove(this.borderMesh)}dispose(){var e;(e=this.planeMesh.material.map)==null||e.dispose()}}const zp=16777215,zc=16777215,Op=2,yn=.6;class Oc extends wt.Line{constructor(...t){super(...t)}toJSON(){return{type:"FiveLine",points:this.points.toJSON()}}}class Vp extends wt.THREE_Line2{constructor(...t){super(...t)}toJSON(){return{type:"Five_THREE_Line2",geometryAttributes:this.geometry.attributes}}}class Vc extends wt.LineGeometry{constructor(...t){super(...t)}toJSON(){return{type:"FiveLineGeometry",attributes:this.attributes}}}class Bp extends wt.LineMaterial{constructor(...t){super(...t)}toJSON(){return{type:"FiveLineMaterial",color:this.color}}}class St extends N.Object3D{constructor(){super();d(this,"name","IObject3D");d(this,"needsRender")}removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...e){const i=e.filter(Boolean);return i.length===0?this:super.add(...i)}addIfNotExists(...e){return e.forEach(i=>{this.children.includes(i)||this.add(i)}),this}remove(...e){if(e.length===0)return this;const i=e.filter(Boolean);return super.remove(...i)}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}}function Rp(n,t){const{x:e,y:i,z:s}=t.clone().project(n);return s>1?void 0:{leftPercent:(e+1)/2*100,topPercent:(-i+1)/2*100}}const Bc="LightTagContainer_shgjakdhwakjdhsja";class Nr{constructor(t,e,i){d(this,"container");d(this,"visible",!1);d(this,"enabled",!1);d(this,"wrapper");d(this,"tagWrapper");d(this,"five");d(this,"originPosition");d(this,"transformedPosition");d(this,"disposer");d(this,"config");d(this,"onCameraUpdate",()=>{this.visible!==!1&&this.updateScreenPosition()});d(this,"onFiveEveryReady",()=>{var t;if(this.visible&&this.five.state.mode!=="Panorama"){const e=new y.Raycaster;e.set(this.five.camera.position,this.transformedPosition.clone().sub(this.five.camera.position));const i=(t=Bt(this.five).intersectRaycaster(e))==null?void 0:t[0];(i==null?void 0:i.distance)>this.transformedPosition.distanceTo(this.five.camera.position)?(this.container.style.opacity="1",this.container.style.pointerEvents="auto"):(this.container.style.opacity="0",this.container.style.pointerEvents="none")}});var s;this.five=t,this.originPosition=e?Ge(e).clone():void 0,this.transformedPosition=(s=this.originPosition)==null?void 0:s.clone(),this.container=(()=>{const o=document.createElement("div");return o.style.width="0",o.style.height="0",o.style.position="absolute",o})(),this.config=i!=null?i:{},this.enable(),this.show()}show(){this.visible=!0,this.container.style.opacity="1",this.container.style.pointerEvents="auto",this.container.style.transition="opacity 0.2s linear",this.onCameraUpdate()}hide(t){this.visible=!1,t!=null&&t.withAnimation?this.container.style.transition="opacity 0.2s linear":this.container.style.transition="",this.container.style.opacity="0",this.container.style.pointerEvents="none"}enable(){var i,s,o,r;if(this.enabled)return;this.enabled=!0,this.wrapper=(o=(s=this.config.wrapper)!=null?s:(i=this.five.getElement())==null?void 0:i.parentElement)!=null?o:document.body,this.tagWrapper||(this.tagWrapper=(r=document.getElementById(Bc))!=null?r:(()=>{const a=document.createElement("div");return a.id=Bc,a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.pointerEvents="none",a})(),this.wrapper.contains(this.tagWrapper)||this.wrapper.appendChild(this.tagWrapper)),this.tagWrapper.appendChild(this.container);let t=!1;const e=()=>{t||(t=!0,this.five.ready().then(()=>{this.onFiveEveryReady(),t=!1}))};this.five.on("cameraUpdate",e),this.five.on("cameraUpdate",this.onCameraUpdate),this.disposer=()=>{this.five.off("cameraUpdate",e),this.five.off("cameraUpdate",this.onCameraUpdate)}}disable(){var t;this.enabled&&(this.enabled=!1,this.tagWrapper.removeChild(this.container),(t=this.disposer)==null||t.call(this))}destroy(){this.disable(),this.container.remove()}setTransformMatrix(t){var e;this.transformedPosition=(e=this.originPosition)==null?void 0:e.clone().applyMatrix4(t),this.onCameraUpdate()}setPosition(t){this.transformedPosition=t,this.onCameraUpdate()}updateScreenPosition(){if(!this.transformedPosition){this.container.style.left="-100%",this.container.style.top="-100%";return}const t=Rp(this.five.camera,this.transformedPosition);t?(this.container.style.left=t.leftPercent+"%",this.container.style.top=t.topPercent+"%"):(this.container.style.left="-100%",this.container.style.top="-100%")}}function Fp(n,t,e){return new Nr(n,t,e)}const Np={auto:"",pen:"","pen-forbidden":"","pen-crosshair":"","pne-polygon":"","pen-circle":"","crosshair-rectangle":"","crosshair-circle":""};class _p{constructor(t){d(this,"container");this.container=t}setType(t){const e=Np[t];e?this.container.style.cursor=`url(${e}), auto`:this.container.style.cursor=t}tip(t){return()=>this.closeTip()}closeTip(){}reset(){this.container.style.cursor="auto"}}class Rc extends ut{constructor(e){super();d(this,"five");this.five=e}}const vs=(n,t)=>{if(!t)return n;const e=new y.Vector3,i=new y.Quaternion,s=new y.Vector3;return t.decompose(e,i,s),n.clone().multiply(s).applyQuaternion(i).add(e)},_r=new Map;class Gp extends Rc{constructor(e){super(e);d(this,"_workCode")}get fromType(){var s,o;const e=this.workCode;if(_r.has(e))return _r.get(e);const i=(o=(s=JSON.parse(this.work.raw.works[0]))==null?void 0:s.from_type)!=null?o:"vr";return _r.set(e,i),i}set workCode(e){this._workCode=e}get workCode(){var e;return(e=this._workCode)!=null?e:this.five.state.workCode}get work(){var e,i;return(i=(e=this.five.works)==null?void 0:e.find(s=>s.workCode===this.workCode))!=null?i:this.five.work}get observers(){var e;return(e=this.work)==null?void 0:e.observers}get transform(){var i,s,o,r;const e=(r=(i=this.work)==null?void 0:i.transform)!=null?r:(o=(s=this.work)==null?void 0:s.options)==null?void 0:o.transform;return e?e.clone():new y.Matrix4}getObserverPosition(e){var s;const i=(s=this.getObserver(e))==null?void 0:s.position;if(i)return vs(i,this.transform)}getObserverStandingPosition(e){var s;const i=(s=this.getObserver(e))==null?void 0:s.standingPosition;if(i)return vs(i,this.transform)}getObserver(e){var i;return(i=this.observers)==null?void 0:i[e]}}class Gr extends Rc{constructor(e){super(e);d(this,"workUtil",new Gp(this.five))}get version(){return this.five.constructor.version}get majorVersion(){return Number(this.version.split(".")[0])}get model(){return Bt(this.five)}moveToPano(e,i){const s=this.majorVersion===5?e:{workCode:this.workUtil.workCode,panoIndex:e};return this.five.moveToPano(s,i)}}let Di=class{constructor(t,e){d(this,"VERSION","3.47.0");d(this,"NAME");d(this,"five");d(this,"workUtil");d(this,"fiveUtil");d(this,"hooks",new ut);d(this,"staticPrefix","//vr-image-4.realsee-cdn.cn");this.updateFive(t),e!=null&&e.staticPrefix&&(this.staticPrefix=e.staticPrefix)}set workCode(t){this.workUtil.workCode=t,this.onWorkCodeChange()}get workCode(){return this.workUtil.workCode}updateFive(t){this.five=t,this.fiveUtil=new Gr(t),this.workUtil=this.fiveUtil.workUtil}getCurrentState(){return this.state}absoluteUrl(t){return aa(this.staticPrefix,t)}onWorkCodeChange(){}};function Fc(n,t,e){if(e){const s=new y.Vector3().subVectors(n.position,e).applyQuaternion(n.quaternion.clone().inverse()).applyQuaternion(t).add(e);n.position.copy(s)}n.quaternion.copy(t)}const Qr=new y.Vector3;class Qp extends y.Sphere{expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Qr.subVectors(t,this.center);const e=Qr.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(Qr,s/i),this.radius+=s}return this}}function Wp(n){const{max:t,min:e}=n;return[new y.Vector3(t.x,t.y,t.z),new y.Vector3(e.x,t.y,t.z),new y.Vector3(e.x,e.y,t.z),new y.Vector3(t.x,e.y,t.z),new y.Vector3(t.x,t.y,e.z),new y.Vector3(e.x,t.y,e.z),new y.Vector3(e.x,e.y,e.z),new y.Vector3(t.x,e.y,e.z)]}function gi(n,t){const{max:e,min:i}=n;switch(t){case 0:return new y.Vector3(e.x,e.y,e.z);case 1:return new y.Vector3(i.x,e.y,e.z);case 2:return new y.Vector3(i.x,i.y,e.z);case 3:return new y.Vector3(e.x,i.y,e.z);case 4:return new y.Vector3(e.x,e.y,i.z);case 5:return new y.Vector3(i.x,e.y,i.z);case 6:return new y.Vector3(i.x,i.y,i.z);case 7:return new y.Vector3(e.x,i.y,i.z)}}function wn(n){return Wr(n,"box3")}function Nc(n){return Wr(n,"sphere")}function Hp(n){return Ao(n,"box3")}function _c(n){return Ao(n,"sphere")}function Ao(n,t){const e=t==="box3"?new y.Box3:new Qp,i=new y.Vector3;if(n.updateWorldMatrix(!1,!1),n.traverse(s=>{var r;if(s.name==="shadow"||s.type==="Line2")return;const o=s.geometry;if(s.updateWorldMatrix(!1,!1),o!==void 0){const a=(r=o==null?void 0:o.attributes)==null?void 0:r.position;if(a)for(let l=0,c=a.count;l<c;l++)i.fromBufferAttribute(a,l).applyMatrix4(s.matrixWorld),e.expandByPoint(i);else o.vertices&&o.vertices.forEach(l=>{const c=l.clone().applyMatrix4(s.matrixWorld);e.expandByPoint(c)})}}),!e.isEmpty())return e}function Wr(n,t){const e=Ao(n,t);return e&&e.applyMatrix4(Up(n.matrixWorld.clone())),e}const Up=n=>{const t=n.elements,e=t[0],i=t[1],s=t[2],o=t[3],r=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],f=t[10],g=t[11],v=t[12],p=t[13],m=t[14],A=t[15],w=u*m*c-p*f*c+p*l*g-a*m*g-u*l*A+a*f*A,I=v*f*c-h*m*c-v*l*g+r*m*g+h*l*A-r*f*A,P=h*p*c-v*u*c+v*a*g-r*p*g-h*a*A+r*u*A,k=v*u*l-h*p*l-v*a*f+r*p*f+h*a*m-r*u*m,M=e*w+i*I+s*P+o*k;if(M===0)return n.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/M;return t[0]=w*T,t[1]=(p*f*o-u*m*o-p*s*g+i*m*g+u*s*A-i*f*A)*T,t[2]=(a*m*o-p*l*o+p*s*c-i*m*c-a*s*A+i*l*A)*T,t[3]=(u*l*o-a*f*o-u*s*c+i*f*c+a*s*g-i*l*g)*T,t[4]=I*T,t[5]=(h*m*o-v*f*o+v*s*g-e*m*g-h*s*A+e*f*A)*T,t[6]=(v*l*o-r*m*o-v*s*c+e*m*c+r*s*A-e*l*A)*T,t[7]=(r*f*o-h*l*o+h*s*c-e*f*c-r*s*g+e*l*g)*T,t[8]=P*T,t[9]=(v*u*o-h*p*o-v*i*g+e*p*g+h*i*A-e*u*A)*T,t[10]=(r*p*o-v*a*o+v*i*c-e*p*c-r*i*A+e*a*A)*T,t[11]=(h*a*o-r*u*o-h*i*c+e*u*c+r*i*g-e*a*g)*T,t[12]=k*T,t[13]=(h*p*s-v*u*s+v*i*f-e*p*f-h*i*m+e*u*m)*T,t[14]=(v*a*s-r*p*s-v*i*l+e*p*l+r*i*m-e*a*m)*T,t[15]=(r*u*s-h*a*s+h*i*l-e*u*l-r*i*f+e*a*f)*T,n};class As extends St{constructor(e,i){var s,o;super();d(this,"originObject3D");d(this,"onRender");d(this,"positionFrom");this.originObject3D=e,this.onRender=(s=i==null?void 0:i.onRender)!=null?s:()=>{},this.positionFrom=(o=i==null?void 0:i.positionFrom)!=null?o:"objectPosition"}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(e,i=[]){return e.intersectObject(this,!0,i)}initialPosition(e){var i,s;this.positionFrom==="objectPosition"?this.position.copy(this.originObject3D.position):this.positionFrom==="boundingBox"?this.position.copy((i=wn(this.originObject3D))==null?void 0:i.getCenter(new y.Vector3)):this.positionFrom==="boundingSphere"?this.position.copy((s=Nc(this.originObject3D))==null?void 0:s.center):this.positionFrom instanceof N.Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),e&&this.position.add(e)}setScaleByCamera(e){}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(e,i){this.scale.applyMatrix4(e)}setHelperQuaternion(e,i){Fc(this,e,i)}applyHelperQuaternion(e,i){if(i){const s=new N.Vector3().subVectors(this.position,i).applyQuaternion(e).add(i);this.position.copy(s)}this.applyQuaternion(e)}dispose(){this.removeFromParent()}}class Yp extends As{}class Xp extends As{}class Zp extends As{}class Jp extends As{}class qp extends As{}class Kp extends y.Group{constructor(e){super();d(this,"direction");this.direction=e||"x"}}class Gc extends y.Mesh{constructor(e,i,s){super(e,i);d(this,"direction");this.direction=s||"x"}}function $p(n,t){const{offsetWidth:e,offsetHeight:i}=t,{top:s,left:o}=t.getBoundingClientRect();return Object.assign(new y.Vector2,{x:(n.x-o)/e*2-1,y:-(n.y-s)/i*2+1})}function bo(n,t,e){if(!t||!e||!n)return;const i=$p(t,e);if(Math.abs(i.x)===1||Math.abs(i.y)===1)return;const s=new y.Raycaster;return s.setFromCamera(i,n),s}function ev(n,t){return!(Math.abs(n.x-t.x)>1e-5||Math.abs(n.y-t.y)>1e-5||Math.abs(n.z-t.z)>1e-5)}class Hr extends Kp{constructor(e){var h;super(e.direction);d(this,"line");d(this,"arrow");d(this,"lineHeight",.4);d(this,"arrowHeight",.1);this.name="ArrowGroup";const i=new y.Color((h=e.color)!=null?h:16214315),s=new y.MeshBasicMaterial({color:i,depthTest:!1,depthWrite:!1,opacity:1,transparent:!0,side:y.DoubleSide});this.renderOrder=50;const o=new y.ConeGeometry(.04,.1,32),r=new Gc(o,s.clone(),e.direction);r.name=`arrow-${e.direction}`,this.arrow=r;const a=.004,l=new y.CylinderGeometry(a,a,.4,32),c=new Gc(l,s.clone(),e.direction);c.name=`line-${e.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const Ur={X:15618642,Y:4765519,Z:4227839};class Cn{static get X(){return new y.Color(Ur.X).convertSRGBToLinear().clone()}static get Y(){return new y.Color(Ur.Y).convertSRGBToLinear().clone()}static get Z(){return new y.Color(Ur.Z).convertSRGBToLinear().clone()}}function Yr(n,t){const s=n.position.distanceTo(t),o=n.fov,r=s/3,a=o/90;return r*a}class tv extends Yp{constructor(e,i){super(e,i);d(this,"xArrow");d(this,"yArrow");d(this,"zArrow");i.xArrowEnable!==!1&&(this.xArrow=new Hr({direction:"x",color:Cn.X})),i.yArrowEnable!==!1&&(this.yArrow=new Hr({direction:"y",color:Cn.Y})),i.zArrowEnable!==!1&&(this.zArrow=new Hr({direction:"z",color:Cn.Z})),this.add(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean))}show(){super.show(),this.xArrow&&(this.xArrow.visible=!0),this.yArrow&&(this.yArrow.visible=!0),this.zArrow&&(this.zArrow.visible=!0)}setScaleByCamera(e){this.scale.setScalar(Yr(e,this.position))}showDraggingHelper(e){this.xArrow&&(this.xArrow.visible=e.includes("x")),this.yArrow&&(this.yArrow.visible=e.includes("y")),this.zArrow&&(this.zArrow.visible=e.includes("z"))}dispose(){this.remove(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean)),super.dispose()}}function Yi(n,t){return iv(document.createElement(t!=null?t:"div"),n)}function iv(n,t){if(!t)return n;for(const e in t)e&&t[e]&&(n.style[e]=t[e]);return n}function nv(n){const t=Yi(x({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},n)),e=()=>{t.style.display!=="block"&&t.style.top&&t.style.left&&(t.style.display="block")};return{element:t,show:e,hide:()=>{t.style.display="none",t.style.top="",t.style.left=""},setLeftTop:(o,r)=>{t.style.left=o,t.style.top=r,e()}}}class sv extends Zp{constructor(e,i){super(e,i);d(this,"xCircle");d(this,"yCircle");d(this,"zCircle");d(this,"children",[]);d(this,"angleTips");d(this,"container");(i==null?void 0:i.yzCircleEnable)!==!1&&(this.xCircle=new Xr({direction:"x",color:Cn.X})),(i==null?void 0:i.xzCircleEnable)!==!1&&(this.yCircle=new Xr({direction:"y",color:Cn.Y})),(i==null?void 0:i.xyCircleEnable)!==!1&&(this.zCircle=new Xr({direction:"z",color:Cn.Z})),i!=null&&i.container&&(i==null?void 0:i.angleTipsEnable)!==!1&&(this.container=i==null?void 0:i.container,this.angleTips=nv({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(e=>e.hide())}show(){var e;this.children.forEach(i=>i.showCircle()),(e=this.angleTips)==null||e.hide()}setScaleByCamera(e){this.scale.setScalar(Yr(e,this.position))}showDraggingHelper(e){var i;this.hide(),this.children.filter(s=>e.includes(s.direction)).forEach(s=>s.showRing()),(i=this.angleTips)==null||i.show()}dispose(){var e,i;this.removeFromParent(),(i=(e=this.angleTips)==null?void 0:e.element)==null||i.remove()}}class Xr extends y.Group{constructor(e){super();d(this,"direction");d(this,"circle");d(this,"ring");d(this,"angleSector");this.direction=e.direction,this.circle=new ov(e),this.ring=new rv(e),this.angleSector=new av(e),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}let ov=class extends y.Mesh{constructor(e){var i;super();d(this,"direction");d(this,"gapAngle",.02);d(this,"geometry",new y.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new y.MeshBasicMaterial({opacity:.6,color:(i=e.color)!=null?i:16777215,transparent:!0,side:y.DoubleSide,depthTest:!1,depthWrite:!1}),this.renderOrder=50,this.direction=e.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}};class rv extends y.Group{constructor(e){super();d(this,"direction");this.direction=e.direction;const i=.015,s=new Array(8).fill(null).map((o,r)=>{const a=new y.RingGeometry(.25,.3,20,8,Math.PI/4*r+i,Math.PI/4-i*2),l=new y.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide});this.renderOrder=50;const c=new y.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${r}`,c});this.add(...s)}}class av extends y.Mesh{constructor(e){var s;super();d(this,"direction");d(this,"baseAxes");d(this,"angleDirection");switch(e.direction){case"x":this.baseAxes=new y.Vector3(0,0,1);break;case"y":this.baseAxes=new y.Vector3(1,0,0);break;case"z":this.baseAxes=new y.Vector3(1,0,0);break}const i=.3+5e-4;this.geometry=new y.CircleGeometry(i,48,0,1e-4),this.material=new y.MeshBasicMaterial({opacity:.4,color:(s=e.color)!=null?s:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide}),this.renderOrder=50,this.direction=e.direction,this.angleDirection=this.direction==="z"?1:-1}}function lv(){const n=Yi({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),t=Yi({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),e=Yi({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});n.appendChild(t),t.appendChild(e);const i="-4px",s={direction:"nesw",element:Si({cursor:"nesw-resize",left:i,bottom:i})},o={direction:"ns",element:Si({cursor:"ns-resize",bottom:i})},r={direction:"nwse",element:Si({cursor:"nwse-resize",right:i,bottom:i})},a={direction:"ew",element:Si({cursor:"ew-resize",right:i})},l={direction:"nesw",element:Si({cursor:"nesw-resize",right:i,top:i})},c={direction:"ns",element:Si({cursor:"ns-resize",top:i})},h={direction:"nwse",element:Si({cursor:"nwse-resize",left:i,top:i})},u={direction:"ew",element:Si({cursor:"ew-resize",left:i})};return new Array(o,a,c,u,s,r,l,h).forEach(g=>t.appendChild(g.element)),{container:n,squares:[s,o,r,a,l,c,h,u]}}function Si(n){const t=Yi(x({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},n)),e=Yi({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),i=Yi({width:"15px",height:"15px",cursor:n==null?void 0:n.cursor,pointerEvents:"auto",background:"transparent"});return i.draggable=!0,e.appendChild(i),t.appendChild(e),t}class cv extends qp{constructor(e,i,s,o){super(e);d(this,"points",[]);d(this,"cornerPositions",[]);d(this,"css3DInstance");d(this,"plane");d(this,"css3DRenderer",new Sn);d(this,"camera");d(this,"scene");d(this,"container");d(this,"enabled",!1);this.camera=s,this.scene=o,this.container=i,this.initRectangleScaleHelper()}get helperObject(){var e;if(!((e=this.css3DInstance)!=null&&e.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(e){var i;super.applyMatrix4(e),this.helperObject.applyMatrix4(e),(i=this.plane)==null||i.applyMatrix4(e),this.cornerPositions.forEach(s=>s.applyMatrix4(e))}showDraggingHelper(){}applyHelperScaleMatrix4(e,i){var s;(s=this.plane)==null||s.scale.applyMatrix4(e),this.helperObject.applyScaleMatrix4(e)}updatePoints(){const e=this.calculatePointPosition(this.cornerPositions);this.points.forEach((i,s)=>{i.position.copy(e[s])})}applyHelperQuaternion(e,i){var o;const s=(o=this.css3DInstance)==null?void 0:o.css3DObject;if(s){const r=new y.Vector3().subVectors(s.position,i).applyQuaternion(e).add(i);s.position.copy(r),s.applyQuaternion(e)}if(this.plane){const r=new y.Vector3().subVectors(this.plane.position,i).applyQuaternion(e).add(i);this.plane.position.copy(r),this.plane.applyQuaternion(e)}this.cornerPositions.forEach(r=>{const a=new y.Vector3().subVectors(r,i).applyQuaternion(e).add(i);r.copy(a)})}enable(){var e;this.enabled||(this.enabled=!0,(e=this.css3DInstance)==null||e.enable(),this.plane&&this.scene.add(this.plane))}disable(){var e;this.enabled&&(this.enabled=!1,(e=this.css3DInstance)==null||e.disable(),this.plane&&this.scene.remove(this.plane))}show(){var e;(e=this.css3DInstance)==null||e.show(),this.plane&&(this.plane.visible=!0)}hide(){var e;(e=this.css3DInstance)==null||e.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const e=this.getCornerPositions();if(!e)return;this.cornerPositions=e;const i=this.css3DRenderer.create3DElement(this.camera,e,{ratio:.003});if(!i)return;this.css3DInstance=i,i.appendToElement(this.container);const s=i.css3DObject.container,{container:o,squares:r}=lv();this.points=r.map((c,h)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(e)[h]})),s.insertBefore(o,(a=s.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:e}=this;if(e.isCSS3DObjectPlus)return e.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(e){return[e[0].clone(),e[0].clone().add(e[1]).divideScalar(2),e[1].clone(),e[1].clone().add(e[2]).divideScalar(2),e[2].clone(),e[2].clone().add(e[3]).divideScalar(2),e[3].clone(),e[3].clone().add(e[0]).divideScalar(2)]}}class hv extends Xp{constructor(e){super(e);d(this,"box");d(this,"outline");d(this,"originObject");d(this,"positionAttribute");this.originObject=e,this.positionAttribute=new y.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(e,i){return e.intersectObject(this,!1,i)}raycast(e,i){this.box.raycast(e,i)}update(){const e=wn(this.originObject);if(!e)return;const{min:i,max:s}=e;this.positionAttribute.setXYZ(0,s.x,s.y,s.z),this.positionAttribute.setXYZ(1,i.x,s.y,s.z),this.positionAttribute.setXYZ(2,i.x,i.y,s.z),this.positionAttribute.setXYZ(3,s.x,i.y,s.z),this.positionAttribute.setXYZ(4,s.x,s.y,i.z),this.positionAttribute.setXYZ(5,i.x,s.y,i.z),this.positionAttribute.setXYZ(6,i.x,i.y,i.z),this.positionAttribute.setXYZ(7,s.x,i.y,i.z),this.positionAttribute.needsUpdate=!0}createOutline(){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new y.BufferGeometry;i.setIndex(new y.BufferAttribute(e,1)),i.setAttribute("position",this.positionAttribute);const s=new y.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),o=new y.LineSegments(i,s);return o.matrixAutoUpdate=!1,o}createBox(){const e=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),i=new y.BufferGeometry;i.setIndex(new y.BufferAttribute(e,1)),i.setAttribute("position",this.positionAttribute);const s=new y.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new y.Mesh(i,s)}}function Re(n,t){this._camera=n||null,this._domElement=t||document,this._raycaster=new y.Raycaster,this._selected=null,this._boundObjs={};var e=this;this._$onClick=function(){e._onClick.apply(e,arguments)},this._$onDblClick=function(){e._onDblClick.apply(e,arguments)},this._$onMouseMove=function(){e._onMouseMove.apply(e,arguments)},this._$onMouseDown=function(){e._onMouseDown.apply(e,arguments)},this._$onMouseUp=function(){e._onMouseUp.apply(e,arguments)},this._$onTouchMove=function(){e._onTouchMove.apply(e,arguments)},this._$onTouchStart=function(){e._onTouchStart.apply(e,arguments)},this._$onTouchEnd=function(){e._onTouchEnd.apply(e,arguments)},this._$onContextmenu=function(){e._onContextmenu.apply(e,arguments)},this._domElement.addEventListener("click",this._$onClick,!1),this._domElement.addEventListener("dblclick",this._$onDblClick,!1),this._domElement.addEventListener("mousemove",this._$onMouseMove,!1),this._domElement.addEventListener("mousedown",this._$onMouseDown,!1),this._domElement.addEventListener("mouseup",this._$onMouseUp,!1),this._domElement.addEventListener("touchmove",this._$onTouchMove,!1),this._domElement.addEventListener("touchstart",this._$onTouchStart,!1),this._domElement.addEventListener("touchend",this._$onTouchEnd,!1),this._domElement.addEventListener("contextmenu",this._$onContextmenu,!1)}Re.prototype.destroy=function(){this._domElement.removeEventListener("click",this._$onClick,!1),this._domElement.removeEventListener("dblclick",this._$onDblClick,!1),this._domElement.removeEventListener("mousemove",this._$onMouseMove,!1),this._domElement.removeEventListener("mousedown",this._$onMouseDown,!1),this._domElement.removeEventListener("mouseup",this._$onMouseUp,!1),this._domElement.removeEventListener("touchmove",this._$onTouchMove,!1),this._domElement.removeEventListener("touchstart",this._$onTouchStart,!1),this._domElement.removeEventListener("touchend",this._$onTouchEnd,!1),this._domElement.removeEventListener("contextmenu",this._$onContextmenu,!1)},Re.eventNames=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu","touchstart","touchend"],Re.prototype._getRelativeMouseXY=function(n){var t=n.target||n.srcElement;t.nodeType===3&&(t=t.parentNode);var e={x:0,y:0},i=t,s=getComputedStyle(i,null);e.y+=parseInt(s.getPropertyValue("padding-top"),10),e.x+=parseInt(s.getPropertyValue("padding-left"),10);do e.x+=i.offsetLeft,e.y+=i.offsetTop,s=getComputedStyle(i,null),e.x+=parseInt(s.getPropertyValue("border-left-width"),10),e.y+=parseInt(s.getPropertyValue("border-top-width"),10);while(i=i.offsetParent);var o={width:t===window?window.innerWidth:t.offsetWidth,height:t===window?window.innerHeight:t.offsetHeight};return{x:Number((n.pageX-e.x)/o.width)*2-1,y:-((n.pageY-e.y)/o.height)*2+1}},Re.prototype._objectCtxInit=function(n){n._3xDomEvent={}},Re.prototype._objectCtxDeinit=function(n){delete n._3xDomEvent},Re.prototype._objectCtxIsInit=function(n){return!!n._3xDomEvent},Re.prototype._objectCtxGet=function(n){return n._3xDomEvent},Re.prototype.camera=function(n){return n&&(this._camera=n),this._camera},Re.prototype.bind=function(n,t,e,i){console.assert(Re.eventNames.indexOf(t)!==-1,"not available events:"+t),this._objectCtxIsInit(n)||this._objectCtxInit(n);var s=this._objectCtxGet(n);s[t+"Handlers"]||(s[t+"Handlers"]=[]),s[t+"Handlers"].push({callback:e,useCapture:i}),this._boundObjs[t]===void 0&&(this._boundObjs[t]=[]),this._boundObjs[t].push(n)},Re.prototype.addEventListener=Re.prototype.bind,Re.prototype.unbind=function(n,t,e,i){console.assert(Re.eventNames.indexOf(t)!==-1,"not available events:"+t),this._objectCtxIsInit(n)||this._objectCtxInit(n);var s=this._objectCtxGet(n);s[t+"Handlers"]||(s[t+"Handlers"]=[]);for(var o=s[t+"Handlers"],r=0;r<o.length;r++){var a=o[r];if(e==a.callback&&i==a.useCapture){o.splice(r,1);break}}var l=this._boundObjs[t].indexOf(n);this._boundObjs[t].splice(l,1)},Re.prototype.removeEventListener=Re.prototype.unbind,Re.prototype._bound=function(n,t){var e=this._objectCtxGet(t);return e?!!e[n+"Handlers"]:!1},Re.prototype._onMove=function(n,t,e,i){var s=this._boundObjs[n];if(!(s===void 0||s.length===0)){var o=new y.Vector2;o.set(t,e),this._raycaster.setFromCamera(o,this._camera);var r=this._raycaster.intersectObjects(s),a=this._selected;if(r.length>0){var l,c,h,u=r[0],f=u.object;this._selected=f,h=this._bound("mousemove",f),a!=f&&(l=this._bound("mouseover",f),c=a&&this._bound("mouseout",a))}else c=a&&this._bound("mouseout",a),this._selected=null;h&&this._notify("mousemove",f,i,u),l&&this._notify("mouseover",f,i,u),c&&this._notify("mouseout",a,i,u)}},Re.prototype._onEvent=function(n,t,e,i){var s=this._boundObjs[n];if(!(s===void 0||s.length===0)){var o=new y.Vector2;o.set(t,e),this._raycaster.setFromCamera(o,this._camera);var r=this._raycaster.intersectObjects(s,!0);if(r.length!==0){for(var a=r[0],l=a.object,c=this._objectCtxGet(l),h=l.parent;typeof c=="undefined"&&h;)c=this._objectCtxGet(h),h=h.parent;c&&this._notify(n,l,i,a)}}},Re.prototype._notify=function(n,t,e,i){var s=this._objectCtxGet(t),o=s?s[n+"Handlers"]:null;if(!s||!o||o.length===0){t.parent&&this._notify(n,t.parent,e,i);return}for(var o=s[n+"Handlers"],r=0;r<o.length;r++){var a=o[r],l=!0;a.callback({type:n,target:t,origDomEvent:e,intersect:i,stopPropagation:function(){l=!1}}),l&&a.useCapture===!1&&t.parent&&this._notify(n,t.parent,e,i)}},Re.prototype._onMouseDown=function(n){return this._onMouseEvent("mousedown",n)},Re.prototype._onMouseUp=function(n){return this._onMouseEvent("mouseup",n)},Re.prototype._onMouseEvent=function(n,t){var e=this._getRelativeMouseXY(t);this._onEvent(n,e.x,e.y,t)},Re.prototype._onMouseMove=function(n){var t=this._getRelativeMouseXY(n);this._onMove("mousemove",t.x,t.y,n),this._onMove("mouseover",t.x,t.y,n),this._onMove("mouseout",t.x,t.y,n)},Re.prototype._onClick=function(n){this._onMouseEvent("click",n)},Re.prototype._onDblClick=function(n){this._onMouseEvent("dblclick",n)},Re.prototype._onContextmenu=function(n){this._onMouseEvent("contextmenu",n)},Re.prototype._onTouchStart=function(n){return this._onTouchEvent("touchstart",n)},Re.prototype._onTouchEnd=function(n){return this._onTouchEvent("touchend",n)},Re.prototype._onTouchMove=function(n){if(n.touches.length==1){var t=Number(n.touches[0].pageX/window.innerWidth)*2-1,e=-(n.touches[0].pageY/window.innerHeight)*2+1;this._onMove("mousemove",t,e,n),this._onMove("mouseover",t,e,n),this._onMove("mouseout",t,e,n)}},Re.prototype._onTouchEvent=function(n,t){var e=t.touches;if(e.length==0&&(e=t.changedTouches),e.length==1){var i=Number(e[0].pageX/window.innerWidth)*2-1,s=-(e[0].pageY/window.innerHeight)*2+1;this._onEvent(n,i,s,t)}};function mi(n){return!ke(n)}function ke(n){return n!=null}function pi(n){return arguments.length===0?[]:Array.isArray(n)?n:[n]}let bs=class{constructor(t,e){d(this,"originObject3D");d(this,"hooks");d(this,"preventTapDefaultEvent",!1);d(this,"internalHooks");d(this,"disposers",[]);d(this,"helperObject3D");d(this,"camera");d(this,"model");d(this,"scene");d(this,"container");d(this,"domEvents");d(this,"isDragging",!1);d(this,"enabled",!1);d(this,"name","BaseController");d(this,"boundingBox");d(this,"config");d(this,"onRender");d(this,"onWantsTapGesture",t=>{if(this.getIntersectObject(t))return!1});d(this,"onWantsUpdateCameraDistance",()=>{if(this.camera.isPerspectiveCamera){const t=this.camera;this.helperObject3D.setScaleByCamera(t)}});d(this,"getBox",()=>this.boundingBox?this.boundingBox:(this.boundingBox=wn(this.originObject3D),this.boundingBox));var h,u,f;this.hooks=(h=t.sharedHooks)!=null?h:new ut,this.internalHooks=(u=t.sharedInternalHooks)!=null?u:new ut,this.camera=t.camera,this.model=t.model,this.originObject3D=t.originObject3D,this.helperObject3D=t.helperObject3D,this.container=t.container,this.scene=t.scene,this.domEvents=new Re(t.camera,t.container),this.onRender=(f=t.onRender)!=null?f:()=>{},this.config=e!=null?e:{},this.initialHelperPosition(),this.initialHelperQuaternion(),this.onWantsUpdateCameraDistance(),this.enable();const i=this.onSetOriginObjectScale.bind(this),s=this.onSetOriginObjectRotate.bind(this),o=this.onSetOriginObjectPosition.bind(this),r=this.onApplyOriginObjectScale.bind(this),a=this.onApplyOriginObjectRotate.bind(this),l=this.onApplyOriginObjectPosition.bind(this),c=this.initialHelperPosition.bind(this);this.internalHooks.on("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",c),this.internalHooks.on("setObjectScale",i),this.internalHooks.on("setObjectRotate",s),this.internalHooks.on("setObjectPosition",o),this.internalHooks.on("applyObjectPosition",l),this.internalHooks.on("applyObjectRotate",a),this.internalHooks.on("applyObjectScale",r),this.disposers.push(()=>{this.internalHooks.off("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",c),this.internalHooks.off("setObjectScale",i),this.internalHooks.off("setObjectRotate",s),this.internalHooks.off("setObjectPosition",o),this.internalHooks.off("applyObjectPosition",l),this.internalHooks.off("applyObjectRotate",a),this.internalHooks.off("applyObjectScale",r)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){var a,l,c;this.helperObject3D.initQuaternion();const t=(a=this.config.xAxis)!=null?a:new y.Vector3(1,0,0),e=(l=this.config.yAxis)!=null?l:new y.Vector3(0,1,0),i=(c=this.config.zAxis)!=null?c:new y.Vector3(0,0,1),s=new y.Quaternion;s.setFromUnitVectors(new y.Vector3(1,0,0),t.normalize());const o=new y.Quaternion;o.setFromUnitVectors(new y.Vector3(0,1,0),e.normalize());const r=new y.Quaternion;r.setFromUnitVectors(new y.Vector3(0,0,1),i.normalize()),this.helperObject3D.quaternion.premultiply(s),this.helperObject3D.quaternion.premultiply(o),this.helperObject3D.quaternion.premultiply(r)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var t;(t=this.disposers)==null||t.forEach(e=>e==null?void 0:e()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(t){this.helperObject3D.applyMatrix4(t)}applyHelperQuaternion(t,e){this.helperObject3D.applyHelperQuaternion(t,e)}applyHelperScaleMatrix4(t,e){this.helperObject3D.applyHelperScaleMatrix4(t,e)}onWantsGesture(t,e,i){if(this.isDragging)return!1}onIntersectionOnModelUpdate(t){}onApplyOriginObjectScale(t){this.applyHelperScaleMatrix4(t.matrix,t.origin)}onApplyOriginObjectRotate(t){this.applyHelperQuaternion(t.quaternion,t.origin)}onApplyOriginObjectPosition(t){this.applyHelperMatrix4(t.matrix)}onSetOriginObjectScale(t){this.helperObject3D.scale.copy(t),this.updateOffsetByScale(t)}onSetOriginObjectRotate(t,e){this.helperObject3D.setHelperQuaternion(t,e)}onSetOriginObjectPosition(t){this.helperObject3D.position.copy(t.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(t){if(this.boundingBox&&this.config.offset){const e=this.originObject3D.position,i=new y.Vector3().subVectors(this.boundingBox.max,e).multiply(t).add(e),s=new y.Vector3().subVectors(this.boundingBox.min,e).multiply(t).add(e),o=this.calculateOffset(this.config.offset,{min:s,max:i});this.helperObject3D.initialPosition(o)}}hoverListener(t,e=16777215,i=1){const s=pi(t).filter(ke),o=[];for(const r of s)if(r.material||r instanceof y.Group){const a=r instanceof y.Group?r.children.filter(f=>f instanceof y.Mesh):[r];a.forEach(f=>{f.__originalColor__=f.material.color.clone(),f.__originalOpacity__=f.material.opacity});const l=()=>{a.forEach(f=>{f.material.color.set(e),f.material.opacity=i}),this.render()},c=()=>{a.forEach(f=>{f.material.color.copy(f.__originalColor__),f.material.opacity=f.__originalOpacity__}),this.render()},h=()=>{this.isDragging||l()},u=()=>{this.isDragging||c()};for(const f of a)this.domEvents.addEventListener(f,"mouseover",h),this.domEvents.addEventListener(f,"mouseout",u),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),o.push(()=>{this.domEvents.removeEventListener(f,"mouseover",h),this.domEvents.removeEventListener(f,"mouseout",u),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>o.forEach(r=>r==null?void 0:r())}getIntersectObject(t){const e=this.camera.position,i=this.helperObject3D;if(!i)return;const s=this.helperObject3D.raycasterIntersectObject(t)[0];if(!s)return;const o=s;if(o.object=i,this.model.intersectRaycaster){const r=this.model.intersectRaycaster(t)[0];if(r&&r.point.distanceTo(e)<o.point.distanceTo(e))return}return o.object}calculateOffset(t,e){const i=new y.Vector3(0,0,0);if(!t)return i;const s=()=>e||this.getBox();if(typeof t.x=="number")i.setX(t.x);else if(typeof t.x=="object"){const o=s();i.setX((o.max.x-o.min.x)*t.x.percents)}if(typeof t.y=="number")i.setY(t.y);else if(typeof t.y=="object"){const o=s();i.setY((o.max.y-o.min.y)*t.y.percents)}if(typeof t.z=="number")i.setZ(t.z);else if(typeof t.z=="object"){const o=s();i.setZ((o.max.z-o.min.z)*t.z.percents)}return i}};const dv=new y.Vector3;function Xi(n){var f;const{raycaster:t,line:e,clampToLine:i=!0}=n;if(((f=t.camera)==null?void 0:f.type)==="OrthographicCamera"){const g=t.ray.origin.clone();return e.closestPointToPoint(g,!1,new y.Vector3)}const s=new y.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(),t.ray.origin),o=s.projectPoint(e.start,new y.Vector3),r=s.projectPoint(e.end,new y.Vector3),a=new y.Line3(o,r),l=a.closestPointToPoint(t.ray.origin,i,dv),c=l.distanceTo(r),h=l.distanceTo(o),u=a.distance();if(c>h&&c>u){const g=-l.distanceTo(o)/u,v=e.start.clone().sub(e.end).normalize();return e.start.sub(v.clone().multiplyScalar(g*e.distance()))}else{const g=l.distanceTo(o)/u;return new y.Vector3().lerpVectors(e.start,e.end,g)}}let uv=class extends bs{constructor(...e){super(...e);d(this,"name","MoveController");d(this,"startInfo");d(this,"_moveByMouse",{enabled:!1});d(this,"mouseInfo");d(this,"mousedownEventListenerDisposer");const i=this.helperObject3D;this.hoverListener([i.xArrow,i.yArrow,i.zArrow]);const s=this.dragStart.bind(this),o=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",s),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),this.hooks.on("rotateStart",l),this.hooks.on("rotateEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",s),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.hooks.off("rotateStart",l),this.hooks.off("rotateEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouse.enabled}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(i=>i==null?void 0:i())}moveByMouse(e){this._moveByMouse={enabled:!0,useFaceNormal:e==null?void 0:e.useFaceNormal},this.preventTapDefaultEvent=!0;const i=this.handleMouseDown.bind(this),s=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",i),this.container.addEventListener("mouseup",s)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",i),this.container.removeEventListener("mouseup",s)}}disableMoveByMouse(){var e;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit("moveByMouseDisable"),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){var r,a,l;if(!this.moveByMouseEnable)return;const{point:i,face:s}=e;if(!this.hooks.emit("wantToMove",i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.enable!==!1)&&s!=null&&s.normal){const c=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0})(),h=new y.Vector3((r=c.x)!=null?r:0,(a=c.y)!=null?a:0,(l=c.z)!=null?l:0),u=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(s.normal):s.normal)();this.originObject3D.quaternion.setFromUnitVectors(h,u),this.internalHooks.emit("setObjectRotate",this.originObject3D.quaternion.clone())}this.internalHooks.emit("setObjectPosition",i),this.hooks.emit("move",i)}}handleMouseDown(e){const{x:i,y:s}=e;this.mouseInfo={x:i,y:s,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;const{x:i,y:s}=e;this.mouseInfo.x===i&&this.mouseInfo.y===s&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}dragStart(e){if(this.moveByMouseEnable||this.isDragging)return;const i=e==null?void 0:e.intersect;if(!i)return this.dragEnd();const s=(i==null?void 0:i.object).direction;if(!s)return this.dragEnd();const o=new y.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),r=new y.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new y.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(s){case"x":return o;case"y":return r;case"z":return a}})(),c=i.point.clone(),h=new y.Line3(c.clone().sub(l.normalize()),c.clone().add(l.normalize()));this.startInfo={startVectorProject:c,line:h},this.helperObject3D.showDraggingHelper([s]),this.hooks.emit("moveStart"),this.isDragging=!0}dragging(e){if(!this.isDragging||!this.startInfo)return;const i=bo(this.camera,e,this.container);return i?(this.move(i),!1):this.dragEnd()}move(e){if(!this.startInfo)return this.dragEnd();const{line:i,startVectorProject:s}=this.startInfo,o=this.originObject3D,r=Xi({raycaster:e,line:i,clampToLine:!1}),a=r.clone().sub(s),l=new y.Matrix4;l.setPosition(a);const c=o.position.clone().applyMatrix4(l);this.hooks.emit("wantToMove",c)||(o.applyMatrix4(l),s.copy(r),this.internalHooks.emit("applyObjectPosition",{matrix:l}),this.hooks.emit("move",c))}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))}};class ys{constructor(t,e,i,s,o,r,a){d(this,"helperController");d(this,"five");d(this,"onFiveWantsUpdateCameraDistance",()=>{var t,e;this.helperController&&((e=(t=this.helperController).onWantsUpdateCameraDistance)==null||e.call(t))});d(this,"onFiveWantsTapGesture",t=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;const e=this.helperController.onWantsTapGesture(t);return this.five.needsRender=!0,e});d(this,"onFiveWantsGesture",(...t)=>{if(!this.helperController)return;const e=this.helperController.onWantsGesture(...t);return this.five.needsRender=!0,e});d(this,"onFiveIntersectionOnModelUpdate",(...t)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...t)});const{camera:l,model:c,scene:h}=t,u=t.getElement();if(this.five=t,!l||!c||!u||!h)return;const f=()=>{t.needsRender=!0};this.helperController=new e({camera:l,model:c,originObject3D:i,helperObject3D:s,container:u,scene:h,onRender:f,sharedHooks:r,sharedInternalHooks:a},o),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsGesture",this.onFiveWantsGesture),t.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),t.on("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),t.on("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance)}dispose(){var t;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),this.five.off("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),this.five.off("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance),(t=this.helperController)==null||t.dispose()}}const Zr="Object3DHelper@v1.0.1",fv=()=>{console.error(`${Zr} is disposed`)},gv=()=>{console.warn(`${Zr} is disabled`)},mv=()=>{console.error(`${Zr} is disabled`)};class pv{constructor(t){d(this,"controllers",{});d(this,"state",{visible:!0,enabled:!0,disposed:!1});d(this,"hooks",new ut);d(this,"eventListener",{});t&&this.addControllers(t),this.setState(this.state)}show(t){return H(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return H(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,e){if(this.state.disposed)return fv();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return mv();const i=x({},this.state);this.state=x(x({},this.state),t),t.disposed!==void 0&&t.disposed!==i.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&this.handleVisible(t.visible),t.enabled!==void 0&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:i})}addControllers(t){this.controllers=x(x({},this.controllers),t),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(t,e=!0){t?(this.everyControllerDo(i=>{i.enable()}),this.hooks.emit("enable",{userAction:e})):(this.everyControllerDo(i=>{i.disable()}),this.hooks.emit("disable",{userAction:e})),this.state.enabled=t}handleVisible(t,e=!0){t?(this.everyControllerDo(i=>{i.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:e}))):(this.everyControllerDo(i=>{i.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:e}))),this.state.visible=t}everyControllerDo(t){Object.values(this.controllers).forEach(e=>{e&&t(e)})}handleDispose(){var t,e;Object.values(this.controllers).forEach(i=>{i==null||i.dispose()});for(const i in this.controllers){if(!i)continue;const s=i;(e=(t=this.eventListener)[s])==null||e.call(t)}}actionIfStateIsEnabled(t,e){if(this.state.enabled)return t();e!=null&&e.warnLog&&gv()}}function Jr(n){return n*180/Math.PI}function qr(n){return n*Math.PI/180}const Kr=new y.Quaternion;class vv extends bs{constructor(...e){var c,h,u;super(...e);d(this,"name","RotateController");d(this,"startInfo");d(this,"removeListener");const i=this.helperObject3D;this.hoverListener([(c=i.xCircle)==null?void 0:c.circle,(h=i.yCircle)==null?void 0:h.circle,(u=i.zCircle)==null?void 0:u.circle].filter(Boolean));const s=this.dragStart.bind(this),o=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",s),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.removeListener=()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",s),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}}get rotateCenter(){return this.helperObject3D.position.clone()}setRotateAngle(e){const{x:i=0,y:s=0,z:o=0}=e,r=new y.Euler(qr(i),qr(s),qr(o)),a=new y.Quaternion().setFromEuler(r);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:h}=this;Fc(c,a,h),this.internalHooks.emit("setObjectRotate",a,h),this.hooks.emit("rotate",a),this.render()}dispose(){this.removeListener(),super.dispose()}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;const i=e==null?void 0:e.intersect;if(!i)return this.dragEnd();const s=(i==null?void 0:i.object).direction;if(!s)return this.dragEnd();const o=i.point,r=this.getAngleHelper(s);this.setTipsAngle(0);const a=o.clone();a.y+=.2,this.setTipsPosition(a);const l=this.helperObject3D.quaternion.clone(),c=(()=>{if(s==="x")return new y.Vector3(1,0,0).applyQuaternion(l);if(s==="y")return new y.Vector3(0,1,0).applyQuaternion(l);if(s==="z")return new y.Vector3(0,0,1).applyQuaternion(l)})(),h=new y.Plane().setFromNormalAndCoplanarPoint(c,o),f=h.projectPoint(o.clone(),new y.Vector3).clone().sub(this.rotateCenter),g=f.angleTo(r.baseAxes.clone().applyQuaternion(l));this.setAngleHelperStart(s,g),this.setAngleHelperLength(s,0),this.startInfo={direction:s,startVector:f,plane:h,angleHelper:r,angle:0,helperQuaternion:l.clone()},Kr.copy(l),this.helperObject3D.showDraggingHelper([s]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const i=bo(this.camera,e,this.container);return i?(this.rotate(i),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();const{startVector:i,plane:s,angleHelper:o,direction:r,helperQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=e.ray.intersectPlane(s,new y.Vector3);if(!c)return;const h=this.rotateCenter.clone(),f=s.projectPoint(c.clone(),new y.Vector3).clone().sub(h);if(i.angleTo(f)===0)return;const g=new y.Quaternion().setFromUnitVectors(i.clone().normalize(),f.clone().normalize()),v=l.quaternion.clone().premultiply(g);if(this.hooks.emit("wantToRotate",v))return;const A=new y.Euler().setFromQuaternion(new y.Quaternion().setFromUnitVectors(i.clone().normalize().applyQuaternion(a.clone().inverse()),f.clone().normalize().applyQuaternion(a.clone().inverse())),`${r.toUpperCase()}${"XZY".replace(r.toUpperCase(),"")}`)[r]*o.angleDirection;if(this.startInfo.angle+=A,this.setAngleHelperLength(r,this.startInfo.angle),this.setTipsAngle(Jr(this.startInfo.angle)),h){const w=new y.Vector3().subVectors(l.position,h).applyQuaternion(g).add(h);l.position.copy(w)}l.applyQuaternion(g),Kr.premultiply(g),this.internalHooks.emit("applyObjectRotate",{quaternion:g,origin:h}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=f}dragEnd(){this.isDragging&&(this.internalHooks.emit("setObjectRotate",Kr,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(e){var i,s,o;switch(e){case"x":return(i=this.helperObject3D.xCircle)==null?void 0:i.angleSector;case"y":return(s=this.helperObject3D.yCircle)==null?void 0:s.angleSector;case"z":return(o=this.helperObject3D.zCircle)==null?void 0:o.angleSector}}setAngleHelperStart(e,i){const s=this.getAngleHelper(e);if(!s){console.warn("angleHelper is undefined");return}if(s instanceof y.Mesh&&s.geometry instanceof y.CircleGeometry){const{radius:o,segments:r,thetaLength:a}=s.geometry.parameters;s.geometry=new y.CircleGeometry(o,r,i,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(e,i){const o=i>=0?Math.max(i,.001):Math.min(i,-.001),r=this.getAngleHelper(e);if(r instanceof y.Mesh&&r.geometry instanceof y.CircleGeometry){const{radius:a,thetaStart:l}=r.geometry.parameters,c=Math.ceil(Math.abs(o)*(40/(2*Math.PI)));r.geometry=new y.CircleGeometry(a,c,l,o)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(e){var s;const i=(s=this.helperObject3D.angleTips)==null?void 0:s.element;i&&(i.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){const i=this.helperObject3D.angleTips;if(!i)return;const s=e.project(this.camera),{x:o,y:r,z:a}=s;if(a>1)return;const l=(o+1)/2*100+"%",c=(-r+1)/2*100+"%";i.setLeftTop(l,c)}}class Av extends bs{constructor(...e){super(...e);d(this,"startInfo");d(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(e){this.isDragging||super.onApplyOriginObjectPosition(e)}onApplyOriginObjectScale(e){this.helperObject3D.applyHelperScaleMatrix4(e.matrix,e.origin)}getDragPlane(){const e=new y.Plane,i=this.helperObject3D.cornerPositions;if(i.length!==0)return i.length<3?e.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new N.Vector3),i[0]):e.setFromCoplanarPoints(i[0],i[1],i[2]),e}dragStart(e,i){var o,r;(r=(o=this.helperObject3D).updatePoints)==null||r.call(o);const s=this.getDragPlane();if(!s)return this.dragEnd();this.startInfo={startPoint:{position:i.position.clone(),direction:i.direction},plane:s},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const i=bo(this.camera,e,this.container);if(!i)return this.dragEnd();this.scale(i)}scale(e){var Y,G;if(!this.startInfo)return;const i=this.originObject3D,{startPoint:s,plane:o}=this.startInfo,r=this.helperObject3D.cornerPositions;if(r.length<4)return this.dragEnd();const a=e.ray.intersectPlane(o,new N.Vector3);if(!a||ev(a,this.camera.position))return;const l=new N.Vector3().addVectors(r[0],r[2]).divideScalar(2),{position:c,direction:h}=s,u=new N.Vector3().subVectors(r[1],r[0]),f=new N.Vector3().subVectors(r[3],r[0]),g=Q=>{const W=new N.Vector3(0,0,0);if(!this.startInfo)return W;const _=(Q==="ew"?u:f).clone(),U=c.clone().projectOnVector(_),F=a.clone().projectOnVector(_),X=l.clone().projectOnVector(_);if(F.equals(U))return W;if(Q==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const le=new N.Vector3().subVectors(F,X),ae=le.x<0&&_.x>=0,Ie=le.y<0&&_.y>=0,Ae=le.z<0&&_.z>=0;this.startInfo.dragPointInCenterBottom=ae||Ie||Ae}if(Q==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const le=new N.Vector3().subVectors(F,X),ae=le.x<0&&_.x>=0,Ie=le.y<0&&_.y>=0,Ae=le.z<0&&_.z>=0;this.startInfo.dragPointInCenterLeft=ae||Ie||Ae}const J=new N.Vector3().subVectors(F,U),q=J.length();return q>.3?(console.warn("offset.length() > 0.3, skipped",q),W):J},v=g("ew"),p=g("ns"),m=()=>{const Q=v;this.helperObject3D.cornerPositions.forEach((W,_)=>{var U;(U=this.startInfo)!=null&&U.dragPointInCenterLeft?(_===0||_===3)&&W.add(Q):(_===1||_===2)&&W.add(Q)})},A=()=>{const Q=p;this.helperObject3D.cornerPositions.forEach((W,_)=>{var U;(U=this.startInfo)!=null&&U.dragPointInCenterBottom?(_===0||_===1)&&W.add(Q):(_===2||_===3)&&W.add(Q)})};switch(h){case"ew":m();break;case"ns":A();break;case"nesw":case"nwse":m(),A()}const w=new N.Vector3().subVectors(r[1],r[0]).length()/u.length(),I=new N.Vector3().subVectors(r[3],r[0]).length()/f.length(),P=new N.Vector3(w,I,1),k=new y.Matrix4().scale(P);i.isCSS3DObjectPlus?i.applyScaleMatrix4(k):i.scale.applyMatrix4(k),s.position.copy(a);const M=new N.Vector3().addVectors(r[0],r[2]).divideScalar(2),T=new N.Vector3().subVectors(M,l),R=new y.Matrix4().setPosition(T);i.applyMatrix4(R),(Y=this.helperObject3D.css3DInstance)==null||Y.css3DObject.applyMatrix4(R),(G=this.helperObject3D.plane)==null||G.applyMatrix4(R),this.internalHooks.emit("applyObjectScale",{matrix:k}),this.internalHooks.emit("applyObjectPosition",{matrix:R}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class bv extends Av{constructor(...e){super(...e);d(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(e=>{if(!e)return;const i=e.point,s=a=>this.dragStart(a,e),o=this.dragging.bind(this),r=this.dragEnd.bind(this);i.addEventListener("dragstart",s),i.addEventListener("drag",o),i.addEventListener("dragend",r)})}}const Qt=document.createElement("div");Qt.classList.add("behindFiveElement"),Qt.style.position="absolute",Qt.style.top="0",Qt.style.left="0",Qt.style.width="100%",Qt.style.height="100%",Qt.style.pointerEvents="none";function Qc(n){var i,s,o,r,a;const t=(a=(s=$r(n.getElement()))!=null?s:$r((i=n.getElement())==null?void 0:i.parentElement))!=null?a:$r((r=(o=n.getElement())==null?void 0:o.parentElement)==null?void 0:r.parentElement),e=t==null?void 0:t.parentElement;if(e)return e.contains(Qt)||t.parentElement.insertBefore(Qt,t),Qt;console.error("Can not find a valid element to insert behindFiveElement. How to fix it: https://github.com/realsee-developer/dnalogel/tree/main/plugins/src/CSS3DRenderPlugin/README.md")}function $r(n){var a;if(!n)return;const t=(a=n.style.position)!=null?a:getComputedStyle(n).position;if(t!=="fixed"&&t!=="absolute"&&t!=="relative")return;const e=getComputedStyle(n),i=e.backgroundColor,s=e.backgroundImage;if(!(i!=="transparent"&&i!=="rgba(0, 0, 0, 0)"&&i!==""||s!=="none"&&s!==""))return n}class yv extends bs{constructor(...e){super(...e);d(this,"name","BoundingBoxController")}}class wv extends Jp{constructor(e,i){super(e,i);d(this,"scaleMeshes",[]);d(this,"positions",[]);i&&(this.positions=i.positions)}initialPosition(e){this.position.copy(this.originObject3D.position),this.scaleMeshes.length&&this.remove(...this.scaleMeshes);const i=typeof this.positions=="function"?this.positions():this.positions;i&&(this.scaleMeshes=i.map(s=>{const o=Cv();return o.position.copy(s.handlePosition),o.scalePosition=s,o}),this.add(...this.scaleMeshes))}setScaleByCamera(e){this.scaleMeshes.forEach(i=>{i.scale.setScalar(Yr(e,i.scalePosition.handlePosition.clone().applyMatrix4(this.matrixWorld)))})}}function Cv(){const t=new y.BoxGeometry(.05,.05,.05),e=new y.MeshBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide}),i=new y.Mesh(t,e);return i.renderOrder=10,i}class Pv extends bs{constructor(...e){super(...e);d(this,"name","ScaleController");d(this,"startInfo");d(this,"dragStart",e=>{if(this.isDragging)return;this.isDragging=!0;const{intersect:i}=e,s=this.camera.position,o=i.object,r=o.scalePosition.basePosition.clone(),l=o.scalePosition.handlePosition.clone().clone().sub(r).clone(),c=new y.Line3(r,r.clone().add(l.normalize().multiplyScalar(5)));c.applyMatrix4(this.helperObject3D.matrixWorld);const h=new y.Raycaster(s,i.point.clone().sub(s)),u=Xi({raycaster:h,line:c});this.startInfo={line:c,scaleStartPoint:u,draggingObject:o},this.hooks.emit("scaleStart")});d(this,"dragging",e=>{if(!this.isDragging||!this.startInfo)return;const i=bo(this.camera,e,this.container);return i?(this.scale(i),!1):this.dragEnd()});d(this,"scale",e=>{var c,h;if(!this.startInfo)return;const{line:i,scaleStartPoint:s,draggingObject:o}=this.startInfo,{scalePosition:r}=o,{basePosition:a}=r,l=Xi({raycaster:e,line:i});l.applyMatrix4(new y.Matrix4().getInverse(this.helperObject3D.matrixWorld.clone())),(h=(c=this.config)==null?void 0:c.scaleCallback)==null||h.call(c,{ratio:l.distanceTo(a)/s.distanceTo(a),intersectPoint:l,scalePosition:r}),o.position.copy(l.clone())});d(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.internalHooks.emit("initialHelperPosition"),this.hooks.emit("scaleEnd"))});this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd)}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}initialHelperPosition(){this.helperObject3D.initialPosition();const e=this;e.offHoverListener&&e.offHoverListener(),e.offHoverListener=this.hoverListener(this.helperObject3D.scaleMeshes)}setScale(e){var l,c,h;let i=1,s=1,o=1;typeof e=="number"?(i=e,s=e,o=e):typeof e=="object"&&(i=(l=e.x)!=null?l:1,s=(c=e.y)!=null?c:1,o=(h=e.z)!=null?h:1);const r=new y.Vector3(i,s,o);this.hooks.emit("wantToScale",r)||(this.originObject3D.scale.copy(r),this.internalHooks.emit("setObjectScale",r),this.hooks.emit("scale",r),this.render())}}function Pn(n){return H(this,null,function*(){return new Promise(t=>{if(Iv(n))t();else{const e=i=>{const s=Bt(n);i===s&&(n.off("modelLoaded",e),t())};n.on("modelLoaded",e)}})})}function Iv(n){var t;return(t=Bt(n))==null?void 0:t.loaded}const ea="Object3DHelperPlugin",yo=ea,Mv=()=>{console.error(`${yo} is disposed`)},Ev=()=>{console.warn(`${yo} is disabled`)},kv=()=>{console.error(`${yo} is disabled`)};class ta extends Di{constructor(e){super(e);d(this,"name",ea);d(this,"state",{visible:!0,enabled:!0,disposed:!1});d(this,"objectHelperMap",new Map);d(this,"css3DObjectParentMap",new Map);d(this,"css3DRender");this.five=e,this.css3DRender=new Sn(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${ea.toUpperCase()}_DEBUG__`]:this})}show(e){return H(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return H(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,i){if(this.state.disposed)return Mv();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return kv();const s=x({},this.state);this.state=x(x({},this.state),e),e.disposed!==void 0&&e.disposed!==s.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==s.visible&&this.handleVisible(e.visible),e.enabled!==void 0&&e.enabled!==s.enabled&&this.handleEnable(e.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:s})}getObject3DHelper(e){return this.objectHelperMap.get(e)}addObject3DHelper(e,i={}){var A;if(!e){console.error("Object3D is undefined");return}if(this.objectHelperMap.has(e)){console.warn(`Object3DHelperPlugin: object3D ${e.name} is already has helper`);return}const s=new pv,o=[],r=(A=this.five.getElement())==null?void 0:A.parentElement,a=this.five.camera,c=x(x({},{moveHelper:!0,rotateHelper:!0,scaleHelper:!0,boundingBoxHelper:!1,positionFrom:"objectPosition"}),i),{moveHelper:h,rotateHelper:u,scaleHelper:f,boundingBoxHelper:g}=c,v=new ut,p=new ut,m=w=>{if(w)return typeof w=="boolean"?w:w.enable};if(m(h)){const w=x(x({},this.getConfig(c.moveHelper)),c),I=new tv(e,x({},w)),P=new ys(this.five,uv,e,I,w,v,p);s.addControllers({moveController:P.helperController}),o.push(()=>P.dispose())}if(m(u)){const w=x(x({},this.getConfig(c.rotateHelper)),c),I=new sv(e,x({container:r},w)),P=new ys(this.five,vv,e,I,w,v,p);s.addControllers({rotateController:P.helperController}),o.push(()=>P.dispose())}if(m(g)){const w=new hv(e),I=new ys(this.five,yv,e,w,void 0,v,p);s.addControllers({boundingBoxController:I.helperController})}if(m(f))if(e.isCSS3DObjectPlus&&r){const w=new cv(e,r,a,this.five.scene),I=new ys(this.five,bv,e,w,void 0,v,p);s.addControllers({scaleController:I.helperController}),o.push(()=>I.dispose()),Pn(this.five).then(()=>{var P,k;if(e.isCSS3DObjectPlus){const M=e;if(!M||M.mode!=="front")return;const T=(P=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?P:Qc(this.five);T&&(this.css3DObjectParentMap.set(M,M.parent),M.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(T),(k=this.css3DRender.getBehindCSS3DObjectGroup())==null||k.add(M),this.css3DRender.render(this.five.camera))}})}else{const w=x(x({},this.getConfig(c.scaleHelper)),c),I=new wv(e,w),P=new ys(this.five,Pv,e,I,w,v,p);s.addControllers({scaleController:P.helperController}),o.push(()=>P.dispose())}return this.objectHelperMap.set(e,{helper:s,disposers:o}),s.controllers}removeObject3DHelper(e){if(!this.objectHelperMap.has(e))return;const{helper:i,disposers:s}=this.objectHelperMap.get(e);if(i){if(e.isCSS3DObjectPlus){const o=e,r=this.css3DObjectParentMap.get(o);r&&r.add(o),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(e),i.dispose(),s==null||s.forEach(o=>o==null?void 0:o())}}handleEnable(e,i=!0){e?(this.everyHelperDo(s=>s.enable()),this.hooks.emit("enable",{userAction:i})):(this.everyHelperDo(s=>s.disable()),this.hooks.emit("disable",{userAction:i})),this.state.enabled=e}handleVisible(e,i=!0){e?(this.everyHelperDo(s=>s.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):(this.everyHelperDo(s=>s.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=e}handleDispose(){this.everyHelperDo((e,i)=>{e.dispose(),i==null||i.forEach(s=>s==null?void 0:s())})}everyHelperDo(e){this.objectHelperMap.forEach(({helper:i,disposers:s})=>{i&&e(i,s)})}actionIfStateIsEnabled(e,i){if(this.state.enabled)return e();i!=null&&i.warnLog&&Ev()}getConfig(e){if(e&&typeof e!="boolean"&&e.enable)return e}}const xv=n=>new ta(n);function Wc(n,t){const{top:e,left:i,width:s,height:o}=t.getBoundingClientRect();return new y.Vector2((n.x-i)/s*2-1,-(n.y-e)/o*2+1)}class Hc extends y.Raycaster{intersectObject(t,e=!0,i=[]){return ia(t,this,i,e),i.sort(Uc),i}intersectObjects(t,e=!0,i=[]){for(let s=0,o=t.length;s<o;s++)ia(t[s],this,i,e);return i.sort(Uc),i}}function Uc(n,t){return n.distance-t.distance}function ia(n,t,e,i){let s=!0;if(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0){const o=n.children;for(let r=0,a=o.length;r<a;r++)ia(o[r],t,e,!0)}}function na(n,t,e,i){let s=!0;if(n.type!=="Line2"&&(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0)){const o=n.children;for(let r=0,a=o.length;r<a;r++)o[r].type!=="Line2"&&na(o[r],t,e,!0)}}class sa{constructor(t,e){d(this,"five");d(this,"dragging",!1);d(this,"boundObject",{});d(this,"config");d(this,"lastMouseDownEvent");d(this,"handleWantsGesture",(t,e)=>{if(e.length!==1)return;const i=e[0];if(i.raycaster){const s=new Hc;s.ray=i.raycaster.ray,s.near=i.raycaster.near,s.far=i.raycaster.far,s.camera=i.raycaster.camera,s.layers=i.raycaster.layers,s.params=i.raycaster.params,i.raycaster=s}if(i){if(t==="mouseMove"&&this.onDomEvent("hover",i),t==="tap"){const s=this.lastMouseDownEvent,o=this.onDomEvent("click",i,s),r=this.onDomEvent("wantDblclick",i,s,this.boundObject.dblclick);if(o===!1||r===!1)return!1}if(this.dragging)return!1}});d(this,"handleDomEvent",(t,e,i)=>{const s={x:e.clientX,y:e.clientY};this.onDomEvent(t,s,e,i)});d(this,"handleMouseEvent",t=>{this.handleDomEvent(t.type,t)});d(this,"handleMousedown",t=>{this.lastMouseDownEvent=t,this.handleDomEvent("mousedown",t),this.handleDomEvent("dragstart",t,this.haveDragEventObject)});d(this,"handleMouseup",t=>{var e;this.dragging=!1,(e=this.haveDragEventObject)==null||e.forEach(i=>{i._dragging&&(i._dragging=!1,this.notify({eventName:"dragend",object:i,originEvent:t,raycaster:this.getRaycaster({x:t.clientX,y:t.clientY})}))}),this.handleDomEvent("mouseup",t)});d(this,"handleMousemove",t=>{var e;this.dragging&&((e=this.boundObject.drag)==null||e.forEach(i=>{i._dragging&&this.notify({eventName:"drag",object:i,originEvent:t,raycaster:this.getRaycaster({x:t.clientX,y:t.clientY})})}))});d(this,"onDomEvent",(t,e,i,s=this.boundObject[t])=>{var f,g,v,p,m;if(!e||!s||(s==null?void 0:s.length)===0)return;const o=[];((f=this.config)==null?void 0:f.fiveModels)!==null&&((g=this.config)!=null&&g.fiveModels?o.push(...this.config.fiveModels):o.push(this.model));const r=o.filter(A=>A.loaded),a=(v=e.raycaster)!=null?v:this.getRaycaster(e);a.params.Points.threshold=.02;const l=a.intersectObjects(s,!0),c=[];r.forEach(A=>{const w=A.intersectRaycaster(a);c.push(...w)});const h=.01;if(c.length>0&&l.length>0&&c[0].distance+h<l[0].distance)return;const u=(p=l==null?void 0:l[0])==null?void 0:p.object;if(t==="wantDblclick")return!1;if((!u||!this.objectIsBound(u))&&t==="hover")for(const A of(m=this.boundObject.hover)!=null?m:[])A._hovered&&this.notify({eventName:"unHover",object:A});if(u&&u&&this.notify({eventName:t,object:u,originEvent:i,raycaster:a,intersects:l}))return!1});d(this,"objectIsBound",t=>{let e=t._domEvent,i=t.parent;for(;typeof e=="undefined"&&i;)e=i._domEvent,i=i.parent;return!!e});d(this,"notify",t=>{var f,g,v;const{eventName:e,object:i,originEvent:s,raycaster:o,intersects:r}=t;let a=!1,l=[];const c=[];let h=i;for(c.push(h);h.parent;)h=h.parent,c.push(h);const u=c.at(-1);if(!((f=this.config)!=null&&f.noEmitWhenNotInScene&&u.type!=="Scene")){for(const p of c){if(a)break;p.draggable&&(e==="dragstart"&&(p._dragging=!0,this.dragging=!0),e==="dragend"&&(p._dragging=!1,this.dragging=!1));const m=p._domEvent;if(!m)continue;const A=m[`${e}Handler`];if(A)for(const[w,I]of A){if(I!=null&&I.noEmitWhenNotInScene&&u.type!=="Scene"||((g=this.config)!=null&&g.noEmitWhenHide||I!=null&&I.noEmitWhenHide)&&!Rr(p))continue;if(e==="hover"){if(p._hovered)continue;p._hovered=!0;for(const k of(v=this.boundObject.hover)!=null?v:[])k!==p&&k._hovered&&this.notify({eventName:"unHover",object:k})}if(e==="unHover"){if(!p._hovered)continue;p._hovered=!1}const P=w({type:e,target:p,origDomEvent:s,raycaster:o,intersects:r,stopPropagation:()=>{a=!0}});l.push(P!=null?P:!0)}}if(e==="click"||e==="wantDblclick")return l.some(p=>p===!0)}});this.five=t,this.config=e,t.on("wantsGesture",this.handleWantsGesture),document.addEventListener("mousedown",this.handleMousedown),document.addEventListener("dblclick",this.handleMouseEvent),document.addEventListener("mouseup",this.handleMouseup),document.addEventListener("mousemove",this.handleMousemove)}get haveDragEventObject(){return[...new Set([this.boundObject.dragend,this.boundObject.drag,this.boundObject.dragstart].flat())].filter(Boolean)}get model(){return Bt(this.five)}addAutoBindEventListener(t,e,i,s){const o=()=>this.addEventListener(t,e,i,s),r=()=>this.removeEventListener(t,e,i,s);return t.addEventListener("added",o),t.addEventListener("removed",r),t.addEventListener("dispose",r),()=>{t.removeEventListener("added",o),t.removeEventListener("removed",r),t.removeEventListener("dispose",r)}}addEventListener(t,e,i,s){t._domEvent||(t._domEvent={}),t._domEvent[`${e}Handler`]||(t._domEvent[`${e}Handler`]=[]),this.boundObject[e]||(this.boundObject[e]=[]),this.boundObject[e].includes(t)||this.boundObject[e].push(t),t._domEvent[`${e}Handler`].push([i,x({noEmitWhenHide:!1,noEmitWhenNotInScene:!1},s)])}removeEventListener(t,e,i,...s){var r,a;if(!t._domEvent||(e===void 0&&(Object.keys(this.boundObject).forEach(l=>{var h,u;const c=(h=this.boundObject[l])==null?void 0:h.findIndex(f=>f===t);c!==-1&&((u=this.boundObject[l])==null||u.splice(c,1))}),t._domEvent={}),!t._domEvent[`${e}Handler`]))return;if(i===void 0){delete t._domEvent[`${e}Handler`];return}const o=t._domEvent[`${e}Handler`].findIndex(l=>l[0]===i);if(o!==-1&&(t._domEvent[`${e}Handler`].splice(o,1),t._domEvent[`${e}Handler`].length===0&&delete t._domEvent[`${e}Handler`],t._domEvent&&Object.keys(t._domEvent).length===0&&delete t._domEvent,!t._domEvent)){const l=(r=this.boundObject[e])==null?void 0:r.findIndex(c=>c===t);l!==-1&&((a=this.boundObject[e])==null||a.splice(l,1))}}clear(){this.boundObject={}}dispose(){var t;(t=this.five)==null||t.off("wantsGesture",this.handleWantsGesture),document.removeEventListener("mousedown",this.handleMousedown),document.removeEventListener("mouseup",this.handleMouseup),document.removeEventListener("mousemove",this.handleMousemove),this.boundObject={}}toJSON(){return{boundObject:this.boundObject}}getRaycaster(t){const e=this.five.getElement();if(!e)return;const i=Wc(t,e),s=new Hc;return s.setFromCamera(i,this.five.camera),s}}const Yc="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;function Dv(n,t){const{x:e,y:i}=t,s=e*2-1,o=i*2-1,r=new y.Raycaster;return r.setFromCamera({x:s,y:o},n.camera),r.params.Points.threshold=.02,r}function ws(n,t,e){const i=Sv(n,t);return e!=null&&e.virtualPoint?i!=null?i:Xc(t):i}function Xc(n,t=3){const e=new y.Vector3().addVectors(n.ray.origin,n.ray.direction.clone().normalize().multiplyScalar(t)),i=n.ray.direction.clone().negate();return{distance:t,point:e,object:new y.Object3D,face:new y.Face3(0,0,0,i),raycaster:n,isVirtual:!0}}function Sv(n,t){const s=Bt(n).intersectRaycaster(t)[0];if(s)return ne(x({},s),{raycaster:t,isVirtual:!1})}const Lv=new y.Vector3,In=()=>!1;class Zc extends ut{constructor(e,i){var r,a,l;super();d(this,"outOfFive",!1);d(this,"enabled",!1);d(this,"actionIfNoModelUnderMouse","virtualPoint");d(this,"plane");d(this,"pointSelectorHelper");d(this,"hook",this);d(this,"five");d(this,"hammer");d(this,"mode");d(this,"pressDown",!1);d(this,"adherePoints");d(this,"adherePointsRadius",.1);d(this,"lastFiveHelperVisible");d(this,"lastIntersection");d(this,"mousePosition");d(this,"config",{});d(this,"select",e=>{e&&this.updatePointSelectorHelperIntersect(e);const i=this.emit("wantsSelect",this.position);return i||(this.pointSelectorHelper.hide(),this.emit("select",this.position),console.debug(this.position)),!i});d(this,"onEnter",()=>{this.pointSelectorHelper.show(),this.outOfFive=!1,this.emit("intersectionUpdate",this.position)});d(this,"onLeave",()=>{this.pointSelectorHelper.hide(),this.outOfFive=!0,this.emit("intersectionUpdate",null)});d(this,"onTap",e=>{e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),this.select()});d(this,"onPan",e=>{this.pressDown&&(e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),this.mouseNdcPosition&&this.updateByNdcPosition(this.mouseNdcPosition))});d(this,"onPress",e=>{if(e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),!this.mouseNdcPosition)return;const i=this.updateByNdcPosition(this.mouseNdcPosition);this.pressDown=i});d(this,"onPanEnd",()=>{this.pressDown&&(this.pressDown=!1,this.select())});d(this,"updateByMousePosition",e=>{this.five.getElement()&&(this.mousePosition=e,this.updateByNdcPosition(this.mouseNdcPosition))});d(this,"updateByNdcPosition",e=>{var o,r;const i=Dv(this.five,e),s=ws(this.five,i);if(s)return this.updatePointSelectorHelperIntersect(s),this.lastIntersection=s,!0;if(this.plane){const a=i.ray.intersectPlane(this.plane,Lv);if(a){const l={distance:this.five.camera.position.distanceTo(a),point:a.clone(),object:new y.Object3D,face:new y.Face3(0,0,0,this.plane.normal.clone()),raycaster:i,isVirtual:!0};return this.updatePointSelectorHelperIntersect(l),!0}}if(this.actionIfNoModelUnderMouse==="lastPoint")return this.updatePointSelectorHelperIntersect(this.lastIntersection),!0;if(this.actionIfNoModelUnderMouse==="virtualPoint"){const a=Xc(i,(o=this.lastIntersection)==null?void 0:o.distance);return a.face=new y.Face3(0,0,0,(r=this.lastIntersection)==null?void 0:r.face.normal),this.lastIntersection=a,this.updatePointSelectorHelperIntersect(a),!0}else if(this.actionIfNoModelUnderMouse==="disable")return this.updatePointSelectorHelperIntersect(null),!1});d(this,"updatePointSelectorHelperIntersect",e=>{if(!e){this.onLeave(),this.five.getElement().style.cursor=`url("data:image/svg+xml,%3Csvg width='12px' height='12px' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpath d='M6,12 C9.3137085,12 12,9.3137085 12,6 C12,2.6862915 9.3137085,0 6,0 C2.6862915,0 0,2.6862915 0,6 C0,9.3137085 2.6862915,12 6,12 Z' fill='%23FF5959'%3E%3C/path%3E%3Cg transform='translate(2, 2)' stroke='%23FFFFFF'%3E%3Ccircle cx='4' cy='4' r='4'%3E%3C/circle%3E%3Cline x1='1.07141075' y1='1.23997894' x2='6.64700843' y2='6.81557662'%3E%3C/line%3E%3C/g%3E%3C/g%3E%3C/svg%3E"), auto`;return}this.onEnter(),this.five.getElement().style.cursor="";const i=x({},e);let s=!1;if(typeof this.adherePoints=="function"&&typeof this.adherePointsRadius=="number"){for(const o of this.adherePoints({intersection:e,pointSelectorInstance:this}))if(o.distanceTo(e.point)<this.adherePointsRadius){i.point=o.clone(),s=!0;break}}this.pointSelectorHelper.updateWithIntersect(i,{emitEvent:!1}),this.emit("intersectionUpdate",i,s)});d(this,"mousePositionToNdcPosition",e=>{const i=this.five.getElement();if(!i)return null;const{top:s,left:o,width:r,height:a}=i.getBoundingClientRect(),{clientX:l,clientY:c}=e;return{x:(l-o)/r,y:1-(c-s)/a}});d(this,"onFiveWantsPanGesture",()=>{if(this.pressDown)return!1});d(this,"renderScreenCenter",()=>{this.updateByNdcPosition({x:.5,y:.5})});d(this,"emitIntersectionUpdate",e=>{this.emit("intersectionUpdate",e)});this.five=e,this.config=x(x({},this.config),i),this.actionIfNoModelUnderMouse=(r=i==null?void 0:i.actionIfNoModelUnderMouse)!=null?r:"virtualPoint";const s=(a=i==null?void 0:i.mode)!=null?a:"auto";s==="auto"?this.mode=Yc?"fixed":"cursor":this.mode=s;const o={autoFixPCPosition:this.mode==="cursor",initialPosition:this.mode==="fixed"?{left:"35%",top:"20%"}:void 0};this.pointSelectorHelper=new eh(this.five,ne(x({},i==null?void 0:i.helper),{magnifierParams:x(x({},o),(l=i==null?void 0:i.helper)==null?void 0:l.magnifierParams)})),this.pointSelectorHelper.hide()}get position(){return this.outOfFive?null:this.pointSelectorHelper.position}get mouseNdcPosition(){return this.mousePosition?this.mousePositionToNdcPosition(this.mousePosition):null}enable(){if(this.enabled)return;this.enabled=!0,this.outOfFive=!1,this.pointSelectorHelper.enable();const e=this.five.getElement();if(!e)throw new Error("five element not found");this.hammer||(this.hammer=new vn(e)),this.mode==="cursor"?(this.five.on("wantsPanGesture",this.onFiveWantsPanGesture),this.five.on("wantsMoveToPano",In),this.five.on("wantsChangeMode",In),this.five.on("wantsTapGesture",In),e.addEventListener("mousemove",this.updateByMousePosition),e.addEventListener("wheel",this.updateByMousePosition),e.addEventListener("mouseenter",this.onEnter),e.addEventListener("mouseout",this.onLeave),this.hammer.on("tap",this.onTap),this.hammer.on("pan",this.onPan),this.hammer.on("press",this.onPress),this.hammer.on("panend",this.onPanEnd)):this.mode==="fixed"&&(this.five.on("panoArrived",this.renderScreenCenter),this.five.on("panGesture",this.renderScreenCenter),this.five.on("interiaPan",this.renderScreenCenter),this.renderScreenCenter(),this.pointSelectorHelper.show()),this.pointSelectorHelper.hooks.on("intersectionUpdate",this.emitIntersectionUpdate),this.lastFiveHelperVisible=this.five.helperVisible,this.five.helperVisible=!1,this.emit("enable")}disable(){if(!this.enabled)return;this.enabled=!1,this.pointSelectorHelper.disable(),this.five.getElement().style.cursor="";const e=this.five.getElement();this.five.off("wantsPanGesture",this.onFiveWantsPanGesture),this.five.off("wantsMoveToPano",In),this.five.off("wantsChangeMode",In),this.five.off("wantsTapGesture",In),this.five.helperVisible=this.lastFiveHelperVisible,e==null||e.removeEventListener("mousemove",this.updateByMousePosition),e==null||e.removeEventListener("wheel",this.updateByMousePosition),e==null||e.removeEventListener("mouseenter",this.onEnter),e==null||e.removeEventListener("mouseout",this.onLeave),this.hammer.off("tap",this.onTap),this.hammer.off("pan",this.onPan),this.hammer.off("press",this.onPress),this.hammer.off("panend",this.onPanEnd),this.five.off("panoArrived",this.renderScreenCenter),this.five.off("panGesture",this.renderScreenCenter),this.five.off("interiaPan",this.renderScreenCenter),this.pointSelectorHelper.hooks.off("intersectionUpdate",this.emitIntersectionUpdate),this.emit("disable")}dispose(){this.disable(),this.pointSelectorHelper.dispose()}setAdherePoints(e,i){e?typeof e=="function"?this.adherePoints=e:this.adherePoints=()=>e:this.adherePoints=null,typeof i=="number"&&(this.adherePointsRadius=i)}}class Tv{constructor(){d(this,"five");d(this,"_cursor");d(this,"_pointSelector");d(this,"_fiveDomEvents");d(this,"_object3DHelper");d(this,"inited",!1);d(this,"init",t=>{this.inited=!0,this.five=t,this._cursor=void 0,this._pointSelector=void 0,this._fiveDomEvents=void 0,this._object3DHelper=void 0})}get cursor(){if(!this.inited)throw new Error("Global not inited");return this._cursor?this._cursor:(this._cursor=new _p(this.five.getElement()),this._cursor)}get pointSelector(){if(!this.inited)throw new Error("Global not inited");return this._pointSelector?this._pointSelector:(this._pointSelector=new Zc(this.five),this._pointSelector)}get fiveDomEvents(){if(!this.inited)throw new Error("Global not inited");return this._fiveDomEvents?this._fiveDomEvents:(this._fiveDomEvents=new sa(this.five,{noEmitWhenNotInScene:!0}),this._fiveDomEvents)}get object3DHelper(){if(!this.inited)throw new Error("Global not inited");return this._object3DHelper?this._object3DHelper:(this._object3DHelper=new ta(this.five),this._object3DHelper)}}const oa=new Tv;window.globalModules=oa;function Jc(n){qc(n),n.traverse(t=>qc(t))}function qc(n){Array.isArray(n.lengthDoms)&&n.lengthDoms[0]instanceof Nr&&n.lengthDoms.forEach(e=>e.destroy())}class Kc extends Bp{constructor(e){var i,s;super(e);d(this,"_three_color");ke(e==null?void 0:e.color)&&(this.three_color=(i=e==null?void 0:e.color)!=null?i:16777215),Object.keys(e).forEach(o=>{["color","dashed","dashScale","dashSize","gapSize","resolution"].includes(o)||o in this&&(this[o]=e[o])}),this.setDashed((s=e==null?void 0:e.dashed)!=null?s:!1)}get three_color(){return this._three_color}set three_color(e){this._three_color=e,this.color=e}setDashed(e){this.dashed=e,e?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}}class $c extends Vp{constructor(e,i){super(e,i);d(this,"name","Line3")}}class Wt extends St{constructor(e){var r,a,l,c,h;super();d(this,"name","LineMesh");d(this,"points");d(this,"lengthDoms",[]);d(this,"highlighted",!1);d(this,"line");d(this,"backLine");d(this,"opacityBeforeHighlight");d(this,"paramsStyle",{});this.paramsStyle=e!=null?e:{};const i=new Vc,s=new Kc({color:new y.Color((r=e==null?void 0:e.lineColor)!=null?r:zc),linewidth:(a=e==null?void 0:e.lineWidth)!=null?a:Op,dashScale:40,opacity:(l=e==null?void 0:e.opacity)!=null?l:1,transparent:!0,dashed:(c=e==null?void 0:e.dashed)!=null?c:!1}),o=new Kc({color:new y.Color((h=e==null?void 0:e.lineColor)!=null?h:zc),linewidth:s.linewidth*.9,dashScale:s.dashScale,opacity:s.opacity*.8,depthTest:!1,depthWrite:!1,transparent:!0,resolution:s.resolution});this.line=new $c(i,s),this.backLine=new $c(i,o),this.line.renderOrder=1,this.backLine.renderOrder=0,this.line.name="lineFrontMaterial",this.backLine.name="lineBackMaterial",e&&this.setStyle(e),e!=null&&e.points&&this.setPoints(e.points),this.addEventListener("removed",()=>{Jc(this)})}get style(){return{lineColor:this.color,lineWidth:this.lineWidth,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:this.paramsStyle.lengthEnable}}get lineWidth(){return this.line.material.linewidth}get color(){return new y.Color(this.line.material.three_color)}get dashed(){return this.line.material.dashed}get occlusionVisibility(){return this.backLine.visible||this.line.material.depthTest===!1}get occlusionMode(){return this.line.material.depthTest===!1?"depthTest":"translucence"}setPoints(e){const i=e.map(Ge).filter(ke);if(this.points=i,i.length<2)return;this.addIfNotExists(this.line,this.backLine);const s=i.flatMap(o=>[o.x,o.y,o.z]);s.length>2&&(this.line.geometry.dispose(),this.line.geometry=new Vc,this.backLine.geometry=this.line.geometry),this.line.geometry.setPositions(s),this.line.computeLineDistances(),this.updateLengthItems(),this.needsRender=!0}setResolution(e,i){const s=this.line.material.resolution;(s.x!==e||s.y!==i)&&(s.set(e,i),this.needsRender=!0);const o=this.backLine.material.resolution;(o.x!==e||o.y!==i)&&(o.set(e,i),this.needsRender=!0)}setStyle(e){var o,r,a;this.paramsStyle=x(x({},this.paramsStyle),e),ke(e.lineColor)&&(this.line.material.three_color=new y.Color(e.lineColor),this.backLine.material.three_color=new y.Color(e.lineColor)),ke(e.lineWidth)&&(this.line.material.linewidth=e.lineWidth),ke(e.dashed)&&this.line.material.setDashed(e.dashed),ke(e.opacity)&&(this.line.material.opacity=e.opacity,this.backLine.material.opacity=this.line.material.opacity*.2),this.updateLengthItems();const i=(o=e.occlusionVisibility)!=null?o:this.paramsStyle.occlusionVisibility,s=(a=(r=e.occlusionMode)!=null?r:this.paramsStyle.occlusionMode)!=null?a:"translucence";i?s==="depthTest"?(this.line.material.depthTest=!1,this.backLine.visible=!1):s==="translucence"&&(this.line.material.depthTest=!0,this.backLine.visible=!0,this.line.material.opacity===1?this.backLine.material.setDashed(!0):this.backLine.material.setDashed(this.line.material.dashed)):(this.line.material.depthTest=!0,this.backLine.visible=!1),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.line.material.opacity,this.line.material.opacity=this.opacityBeforeHighlight*yn,this.backLine.material.opacity=this.backLine.material.opacity*yn,this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.line.material.opacity=this.opacityBeforeHighlight,this.backLine.material.opacity=.2,this.needsRender=!0)}updateLengthItems(){var e,i;if(this.paramsStyle.lengthEnable){const s=(i=(e=this.points)==null?void 0:e.map((o,r)=>{if(r!==0)return[this.points[r-1],o]}).filter(ke))!=null?i:[];s.forEach(([o,r],a)=>{var h;const l=ei(o,r),c=o.distanceTo(r).toFixed(2)+"m";this.lengthDoms[a]=(h=this.lengthDoms[a])!=null?h:new Nr(oa.five),this.lengthDoms[a].setPosition(l),this.lengthDoms[a].container.innerHTML=`<div style="pointer-events:none;color:white;">${c}</div>`}),this.lengthDoms.length>s.length&&(this.lengthDoms.slice(s.length).forEach(o=>o.destroy()),this.lengthDoms.length=s.length)}else this.lengthDoms.forEach(s=>s.destroy()),this.lengthDoms=[]}}class jv extends He.CSS3DSprite{constructor(){super(...arguments);d(this,"isCSS3DSprite",!0)}}const zv=`
177
+ `;function Sp(){const n=new y.PlaneGeometry(.4,.4),t=Ep,e=new y.TextureLoader().load(t);e.encoding=y.sRGBEncoding,e.minFilter=y.LinearFilter;const i=new y.MeshBasicMaterial({map:e,transparent:!0,depthTest:!1});return new y.Mesh(n,i)}function Lp(){const n=new y.CurvePath;n.add(new y.LineCurve3(new y.Vector3(0,0,0),new y.Vector3(0,0,.1)));const t=new y.TubeGeometry(n,8,.003),e=new y.ShaderMaterial({vertexShader:xp,fragmentShader:Dp,depthTest:!1,transparent:!0});return new y.Mesh(t,e)}function Tp(){const n=new y.SphereGeometry(.01,20,20),t=new y.MeshBasicMaterial({color:10349931,depthTest:!1,transparent:!0,side:y.DoubleSide}),e=new y.Mesh(n,t);return e.position.set(0,0,.1),e}function jp(){const t=new ch({pointerEvents:"none",cornerPoints:[new y.Vector3(-.2,.2,0),new y.Vector3(-.2,-.2,0),new y.Vector3(.2,-.2,0),new y.Vector3(.2,.2,0)]}),e=document.createElement("div");return e.style.width="100%",e.style.height="100%",e.style.backgroundImage=`url(${Sc})`,e.style.backgroundSize="100%",e.style.backgroundRepeat="no-repeat",t.container.appendChild(e),t}class jc extends y.Object3D{constructor(e){super();d(this,"planeMesh");d(this,"lineMesh");d(this,"ballMesh");d(this,"borderMesh");this.planeMesh=Sp(),this.lineMesh=Lp(),this.ballMesh=Tp(),this.borderMesh=jp(),this.add(this.planeMesh,this.lineMesh,this.ballMesh,this.borderMesh),Tc(e)}updateWithIntersect(e){if(!e.face)return;const i=new y.Vector3().addVectors(e.point,e.face.normal);this.position.copy(e.point),this.lookAt(i)}show(){this.visible=!0,this.borderMesh.parent||this.add(this.borderMesh)}hide(){this.visible=!1,this.remove(this.borderMesh)}dispose(){var e;(e=this.planeMesh.material.map)==null||e.dispose()}}const zp=16777215,zc=16777215,Op=2,yn=.6;class Oc extends wt.Line{constructor(...t){super(...t)}toJSON(){return{type:"FiveLine",points:this.points.toJSON()}}}class Vp extends wt.THREE_Line2{constructor(...t){super(...t)}toJSON(){return{type:"Five_THREE_Line2",geometryAttributes:this.geometry.attributes}}}class Vc extends wt.LineGeometry{constructor(...t){super(...t)}toJSON(){return{type:"FiveLineGeometry",attributes:this.attributes}}}class Bp extends wt.LineMaterial{constructor(...t){super(...t)}toJSON(){return{type:"FiveLineMaterial",color:this.color}}}class St extends N.Object3D{constructor(){super();d(this,"name","IObject3D");d(this,"needsRender")}removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...e){const i=e.filter(Boolean);return i.length===0?this:super.add(...i)}addIfNotExists(...e){return e.forEach(i=>{this.children.includes(i)||this.add(i)}),this}remove(...e){if(e.length===0)return this;const i=e.filter(Boolean);return super.remove(...i)}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}}function Rp(n,t){const{x:e,y:i,z:s}=t.clone().project(n);return s>1?void 0:{leftPercent:(e+1)/2*100,topPercent:(-i+1)/2*100}}const Bc="LightTagContainer_shgjakdhwakjdhsja";class Nr{constructor(t,e,i){d(this,"container");d(this,"visible",!1);d(this,"enabled",!1);d(this,"wrapper");d(this,"tagWrapper");d(this,"five");d(this,"originPosition");d(this,"transformedPosition");d(this,"disposer");d(this,"config");d(this,"onCameraUpdate",()=>{this.visible!==!1&&this.updateScreenPosition()});d(this,"onFiveEveryReady",()=>{var t;if(this.visible&&this.five.state.mode!=="Panorama"){const e=new y.Raycaster;e.set(this.five.camera.position,this.transformedPosition.clone().sub(this.five.camera.position));const i=(t=Bt(this.five).intersectRaycaster(e))==null?void 0:t[0];(i==null?void 0:i.distance)>this.transformedPosition.distanceTo(this.five.camera.position)?(this.container.style.opacity="1",this.container.style.pointerEvents="auto"):(this.container.style.opacity="0",this.container.style.pointerEvents="none")}});var s;this.five=t,this.originPosition=e?Ge(e).clone():void 0,this.transformedPosition=(s=this.originPosition)==null?void 0:s.clone(),this.container=(()=>{const o=document.createElement("div");return o.style.width="0",o.style.height="0",o.style.position="absolute",o})(),this.config=i!=null?i:{},this.enable(),this.show()}show(){this.visible=!0,this.container.style.opacity="1",this.container.style.pointerEvents="auto",this.container.style.transition="opacity 0.2s linear",this.onCameraUpdate()}hide(t){this.visible=!1,t!=null&&t.withAnimation?this.container.style.transition="opacity 0.2s linear":this.container.style.transition="",this.container.style.opacity="0",this.container.style.pointerEvents="none"}enable(){var i,s,o,r;if(this.enabled)return;this.enabled=!0,this.wrapper=(o=(s=this.config.wrapper)!=null?s:(i=this.five.getElement())==null?void 0:i.parentElement)!=null?o:document.body,this.tagWrapper||(this.tagWrapper=(r=document.getElementById(Bc))!=null?r:(()=>{const a=document.createElement("div");return a.id=Bc,a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.pointerEvents="none",a})(),this.wrapper.contains(this.tagWrapper)||this.wrapper.appendChild(this.tagWrapper)),this.tagWrapper.appendChild(this.container);let t=!1;const e=()=>{t||(t=!0,this.five.ready().then(()=>{this.onFiveEveryReady(),t=!1}))};this.five.on("cameraUpdate",e),this.five.on("cameraUpdate",this.onCameraUpdate),this.disposer=()=>{this.five.off("cameraUpdate",e),this.five.off("cameraUpdate",this.onCameraUpdate)}}disable(){var t;this.enabled&&(this.enabled=!1,this.tagWrapper.removeChild(this.container),(t=this.disposer)==null||t.call(this))}destroy(){this.disable(),this.container.remove()}setTransformMatrix(t){var e;this.transformedPosition=(e=this.originPosition)==null?void 0:e.clone().applyMatrix4(t),this.onCameraUpdate()}setPosition(t){this.transformedPosition=t,this.onCameraUpdate()}updateScreenPosition(){if(!this.transformedPosition){this.container.style.left="-100%",this.container.style.top="-100%";return}const t=Rp(this.five.camera,this.transformedPosition);t?(this.container.style.left=t.leftPercent+"%",this.container.style.top=t.topPercent+"%"):(this.container.style.left="-100%",this.container.style.top="-100%")}}function Fp(n,t,e){return new Nr(n,t,e)}const Np={auto:"",pen:"","pen-forbidden":"","pen-crosshair":"","pne-polygon":"","pen-circle":"","crosshair-rectangle":"","crosshair-circle":""};class _p{constructor(t){d(this,"container");this.container=t}setType(t){const e=Np[t];e?this.container.style.cursor=`url(${e}), auto`:this.container.style.cursor=t}tip(t){return()=>this.closeTip()}closeTip(){}reset(){this.container.style.cursor="auto"}}class Rc extends ut{constructor(e){super();d(this,"five");this.five=e}}const vs=(n,t)=>{if(!t)return n;const e=new y.Vector3,i=new y.Quaternion,s=new y.Vector3;return t.decompose(e,i,s),n.clone().multiply(s).applyQuaternion(i).add(e)},_r=new Map;class Gp extends Rc{constructor(e){super(e);d(this,"_workCode")}get fromType(){var s,o;const e=this.workCode;if(_r.has(e))return _r.get(e);const i=(o=(s=JSON.parse(this.work.raw.works[0]))==null?void 0:s.from_type)!=null?o:"vr";return _r.set(e,i),i}set workCode(e){this._workCode=e}get workCode(){var e;return(e=this._workCode)!=null?e:this.five.state.workCode}get work(){var e,i;return(i=(e=this.five.works)==null?void 0:e.find(s=>s.workCode===this.workCode))!=null?i:this.five.work}get observers(){var e;return(e=this.work)==null?void 0:e.observers}get transform(){var i,s,o,r;const e=(r=(i=this.work)==null?void 0:i.transform)!=null?r:(o=(s=this.work)==null?void 0:s.options)==null?void 0:o.transform;return e?e.clone():new y.Matrix4}getObserverPosition(e){var s;const i=(s=this.getObserver(e))==null?void 0:s.position;if(i)return vs(i,this.transform)}getObserverStandingPosition(e){var s;const i=(s=this.getObserver(e))==null?void 0:s.standingPosition;if(i)return vs(i,this.transform)}getObserver(e){var i;return(i=this.observers)==null?void 0:i[e]}}class Gr extends Rc{constructor(e){super(e);d(this,"workUtil",new Gp(this.five))}get version(){return this.five.constructor.version}get majorVersion(){return Number(this.version.split(".")[0])}get model(){return Bt(this.five)}moveToPano(e,i){const s=this.majorVersion===5?e:{workCode:this.workUtil.workCode,panoIndex:e};return this.five.moveToPano(s,i)}}let Di=class{constructor(t,e){d(this,"VERSION","3.47.2");d(this,"NAME");d(this,"five");d(this,"workUtil");d(this,"fiveUtil");d(this,"hooks",new ut);d(this,"staticPrefix","//vr-image-4.realsee-cdn.cn");this.updateFive(t),e!=null&&e.staticPrefix&&(this.staticPrefix=e.staticPrefix)}set workCode(t){this.workUtil.workCode=t,this.onWorkCodeChange()}get workCode(){return this.workUtil.workCode}updateFive(t){this.five=t,this.fiveUtil=new Gr(t),this.workUtil=this.fiveUtil.workUtil}getCurrentState(){return this.state}absoluteUrl(t){return aa(this.staticPrefix,t)}onWorkCodeChange(){}};function Fc(n,t,e){if(e){const s=new y.Vector3().subVectors(n.position,e).applyQuaternion(n.quaternion.clone().inverse()).applyQuaternion(t).add(e);n.position.copy(s)}n.quaternion.copy(t)}const Qr=new y.Vector3;class Qp extends y.Sphere{expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Qr.subVectors(t,this.center);const e=Qr.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(Qr,s/i),this.radius+=s}return this}}function Wp(n){const{max:t,min:e}=n;return[new y.Vector3(t.x,t.y,t.z),new y.Vector3(e.x,t.y,t.z),new y.Vector3(e.x,e.y,t.z),new y.Vector3(t.x,e.y,t.z),new y.Vector3(t.x,t.y,e.z),new y.Vector3(e.x,t.y,e.z),new y.Vector3(e.x,e.y,e.z),new y.Vector3(t.x,e.y,e.z)]}function gi(n,t){const{max:e,min:i}=n;switch(t){case 0:return new y.Vector3(e.x,e.y,e.z);case 1:return new y.Vector3(i.x,e.y,e.z);case 2:return new y.Vector3(i.x,i.y,e.z);case 3:return new y.Vector3(e.x,i.y,e.z);case 4:return new y.Vector3(e.x,e.y,i.z);case 5:return new y.Vector3(i.x,e.y,i.z);case 6:return new y.Vector3(i.x,i.y,i.z);case 7:return new y.Vector3(e.x,i.y,i.z)}}function wn(n){return Wr(n,"box3")}function Nc(n){return Wr(n,"sphere")}function Hp(n){return Ao(n,"box3")}function _c(n){return Ao(n,"sphere")}function Ao(n,t){const e=t==="box3"?new y.Box3:new Qp,i=new y.Vector3;if(n.updateWorldMatrix(!1,!1),n.traverse(s=>{var r;if(s.name==="shadow"||s.type==="Line2")return;const o=s.geometry;if(s.updateWorldMatrix(!1,!1),o!==void 0){const a=(r=o==null?void 0:o.attributes)==null?void 0:r.position;if(a)for(let l=0,c=a.count;l<c;l++)i.fromBufferAttribute(a,l).applyMatrix4(s.matrixWorld),e.expandByPoint(i);else o.vertices&&o.vertices.forEach(l=>{const c=l.clone().applyMatrix4(s.matrixWorld);e.expandByPoint(c)})}}),!e.isEmpty())return e}function Wr(n,t){const e=Ao(n,t);return e&&e.applyMatrix4(Up(n.matrixWorld.clone())),e}const Up=n=>{const t=n.elements,e=t[0],i=t[1],s=t[2],o=t[3],r=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],f=t[10],g=t[11],v=t[12],p=t[13],m=t[14],A=t[15],w=u*m*c-p*f*c+p*l*g-a*m*g-u*l*A+a*f*A,I=v*f*c-h*m*c-v*l*g+r*m*g+h*l*A-r*f*A,P=h*p*c-v*u*c+v*a*g-r*p*g-h*a*A+r*u*A,k=v*u*l-h*p*l-v*a*f+r*p*f+h*a*m-r*u*m,M=e*w+i*I+s*P+o*k;if(M===0)return n.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/M;return t[0]=w*T,t[1]=(p*f*o-u*m*o-p*s*g+i*m*g+u*s*A-i*f*A)*T,t[2]=(a*m*o-p*l*o+p*s*c-i*m*c-a*s*A+i*l*A)*T,t[3]=(u*l*o-a*f*o-u*s*c+i*f*c+a*s*g-i*l*g)*T,t[4]=I*T,t[5]=(h*m*o-v*f*o+v*s*g-e*m*g-h*s*A+e*f*A)*T,t[6]=(v*l*o-r*m*o-v*s*c+e*m*c+r*s*A-e*l*A)*T,t[7]=(r*f*o-h*l*o+h*s*c-e*f*c-r*s*g+e*l*g)*T,t[8]=P*T,t[9]=(v*u*o-h*p*o-v*i*g+e*p*g+h*i*A-e*u*A)*T,t[10]=(r*p*o-v*a*o+v*i*c-e*p*c-r*i*A+e*a*A)*T,t[11]=(h*a*o-r*u*o-h*i*c+e*u*c+r*i*g-e*a*g)*T,t[12]=k*T,t[13]=(h*p*s-v*u*s+v*i*f-e*p*f-h*i*m+e*u*m)*T,t[14]=(v*a*s-r*p*s-v*i*l+e*p*l+r*i*m-e*a*m)*T,t[15]=(r*u*s-h*a*s+h*i*l-e*u*l-r*i*f+e*a*f)*T,n};class As extends St{constructor(e,i){var s,o;super();d(this,"originObject3D");d(this,"onRender");d(this,"positionFrom");this.originObject3D=e,this.onRender=(s=i==null?void 0:i.onRender)!=null?s:()=>{},this.positionFrom=(o=i==null?void 0:i.positionFrom)!=null?o:"objectPosition"}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(e,i=[]){return e.intersectObject(this,!0,i)}initialPosition(e){var i,s;this.positionFrom==="objectPosition"?this.position.copy(this.originObject3D.position):this.positionFrom==="boundingBox"?this.position.copy((i=wn(this.originObject3D))==null?void 0:i.getCenter(new y.Vector3)):this.positionFrom==="boundingSphere"?this.position.copy((s=Nc(this.originObject3D))==null?void 0:s.center):this.positionFrom instanceof N.Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),e&&this.position.add(e)}setScaleByCamera(e){}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(e,i){this.scale.applyMatrix4(e)}setHelperQuaternion(e,i){Fc(this,e,i)}applyHelperQuaternion(e,i){if(i){const s=new N.Vector3().subVectors(this.position,i).applyQuaternion(e).add(i);this.position.copy(s)}this.applyQuaternion(e)}dispose(){this.removeFromParent()}}class Yp extends As{}class Xp extends As{}class Zp extends As{}class Jp extends As{}class qp extends As{}class Kp extends y.Group{constructor(e){super();d(this,"direction");this.direction=e||"x"}}class Gc extends y.Mesh{constructor(e,i,s){super(e,i);d(this,"direction");this.direction=s||"x"}}function $p(n,t){const{offsetWidth:e,offsetHeight:i}=t,{top:s,left:o}=t.getBoundingClientRect();return Object.assign(new y.Vector2,{x:(n.x-o)/e*2-1,y:-(n.y-s)/i*2+1})}function bo(n,t,e){if(!t||!e||!n)return;const i=$p(t,e);if(Math.abs(i.x)===1||Math.abs(i.y)===1)return;const s=new y.Raycaster;return s.setFromCamera(i,n),s}function ev(n,t){return!(Math.abs(n.x-t.x)>1e-5||Math.abs(n.y-t.y)>1e-5||Math.abs(n.z-t.z)>1e-5)}class Hr extends Kp{constructor(e){var h;super(e.direction);d(this,"line");d(this,"arrow");d(this,"lineHeight",.4);d(this,"arrowHeight",.1);this.name="ArrowGroup";const i=new y.Color((h=e.color)!=null?h:16214315),s=new y.MeshBasicMaterial({color:i,depthTest:!1,depthWrite:!1,opacity:1,transparent:!0,side:y.DoubleSide});this.renderOrder=50;const o=new y.ConeGeometry(.04,.1,32),r=new Gc(o,s.clone(),e.direction);r.name=`arrow-${e.direction}`,this.arrow=r;const a=.004,l=new y.CylinderGeometry(a,a,.4,32),c=new Gc(l,s.clone(),e.direction);c.name=`line-${e.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const Ur={X:15618642,Y:4765519,Z:4227839};class Cn{static get X(){return new y.Color(Ur.X).convertSRGBToLinear().clone()}static get Y(){return new y.Color(Ur.Y).convertSRGBToLinear().clone()}static get Z(){return new y.Color(Ur.Z).convertSRGBToLinear().clone()}}function Yr(n,t){const s=n.position.distanceTo(t),o=n.fov,r=s/3,a=o/90;return r*a}class tv extends Yp{constructor(e,i){super(e,i);d(this,"xArrow");d(this,"yArrow");d(this,"zArrow");i.xArrowEnable!==!1&&(this.xArrow=new Hr({direction:"x",color:Cn.X})),i.yArrowEnable!==!1&&(this.yArrow=new Hr({direction:"y",color:Cn.Y})),i.zArrowEnable!==!1&&(this.zArrow=new Hr({direction:"z",color:Cn.Z})),this.add(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean))}show(){super.show(),this.xArrow&&(this.xArrow.visible=!0),this.yArrow&&(this.yArrow.visible=!0),this.zArrow&&(this.zArrow.visible=!0)}setScaleByCamera(e){this.scale.setScalar(Yr(e,this.position))}showDraggingHelper(e){this.xArrow&&(this.xArrow.visible=e.includes("x")),this.yArrow&&(this.yArrow.visible=e.includes("y")),this.zArrow&&(this.zArrow.visible=e.includes("z"))}dispose(){this.remove(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean)),super.dispose()}}function Yi(n,t){return iv(document.createElement(t!=null?t:"div"),n)}function iv(n,t){if(!t)return n;for(const e in t)e&&t[e]&&(n.style[e]=t[e]);return n}function nv(n){const t=Yi(x({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},n)),e=()=>{t.style.display!=="block"&&t.style.top&&t.style.left&&(t.style.display="block")};return{element:t,show:e,hide:()=>{t.style.display="none",t.style.top="",t.style.left=""},setLeftTop:(o,r)=>{t.style.left=o,t.style.top=r,e()}}}class sv extends Zp{constructor(e,i){super(e,i);d(this,"xCircle");d(this,"yCircle");d(this,"zCircle");d(this,"children",[]);d(this,"angleTips");d(this,"container");(i==null?void 0:i.yzCircleEnable)!==!1&&(this.xCircle=new Xr({direction:"x",color:Cn.X})),(i==null?void 0:i.xzCircleEnable)!==!1&&(this.yCircle=new Xr({direction:"y",color:Cn.Y})),(i==null?void 0:i.xyCircleEnable)!==!1&&(this.zCircle=new Xr({direction:"z",color:Cn.Z})),i!=null&&i.container&&(i==null?void 0:i.angleTipsEnable)!==!1&&(this.container=i==null?void 0:i.container,this.angleTips=nv({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(e=>e.hide())}show(){var e;this.children.forEach(i=>i.showCircle()),(e=this.angleTips)==null||e.hide()}setScaleByCamera(e){this.scale.setScalar(Yr(e,this.position))}showDraggingHelper(e){var i;this.hide(),this.children.filter(s=>e.includes(s.direction)).forEach(s=>s.showRing()),(i=this.angleTips)==null||i.show()}dispose(){var e,i;this.removeFromParent(),(i=(e=this.angleTips)==null?void 0:e.element)==null||i.remove()}}class Xr extends y.Group{constructor(e){super();d(this,"direction");d(this,"circle");d(this,"ring");d(this,"angleSector");this.direction=e.direction,this.circle=new ov(e),this.ring=new rv(e),this.angleSector=new av(e),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}let ov=class extends y.Mesh{constructor(e){var i;super();d(this,"direction");d(this,"gapAngle",.02);d(this,"geometry",new y.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new y.MeshBasicMaterial({opacity:.6,color:(i=e.color)!=null?i:16777215,transparent:!0,side:y.DoubleSide,depthTest:!1,depthWrite:!1}),this.renderOrder=50,this.direction=e.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}};class rv extends y.Group{constructor(e){super();d(this,"direction");this.direction=e.direction;const i=.015,s=new Array(8).fill(null).map((o,r)=>{const a=new y.RingGeometry(.25,.3,20,8,Math.PI/4*r+i,Math.PI/4-i*2),l=new y.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide});this.renderOrder=50;const c=new y.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${r}`,c});this.add(...s)}}class av extends y.Mesh{constructor(e){var s;super();d(this,"direction");d(this,"baseAxes");d(this,"angleDirection");switch(e.direction){case"x":this.baseAxes=new y.Vector3(0,0,1);break;case"y":this.baseAxes=new y.Vector3(1,0,0);break;case"z":this.baseAxes=new y.Vector3(1,0,0);break}const i=.3+5e-4;this.geometry=new y.CircleGeometry(i,48,0,1e-4),this.material=new y.MeshBasicMaterial({opacity:.4,color:(s=e.color)!=null?s:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide}),this.renderOrder=50,this.direction=e.direction,this.angleDirection=this.direction==="z"?1:-1}}function lv(){const n=Yi({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),t=Yi({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),e=Yi({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});n.appendChild(t),t.appendChild(e);const i="-4px",s={direction:"nesw",element:Si({cursor:"nesw-resize",left:i,bottom:i})},o={direction:"ns",element:Si({cursor:"ns-resize",bottom:i})},r={direction:"nwse",element:Si({cursor:"nwse-resize",right:i,bottom:i})},a={direction:"ew",element:Si({cursor:"ew-resize",right:i})},l={direction:"nesw",element:Si({cursor:"nesw-resize",right:i,top:i})},c={direction:"ns",element:Si({cursor:"ns-resize",top:i})},h={direction:"nwse",element:Si({cursor:"nwse-resize",left:i,top:i})},u={direction:"ew",element:Si({cursor:"ew-resize",left:i})};return new Array(o,a,c,u,s,r,l,h).forEach(g=>t.appendChild(g.element)),{container:n,squares:[s,o,r,a,l,c,h,u]}}function Si(n){const t=Yi(x({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},n)),e=Yi({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),i=Yi({width:"15px",height:"15px",cursor:n==null?void 0:n.cursor,pointerEvents:"auto",background:"transparent"});return i.draggable=!0,e.appendChild(i),t.appendChild(e),t}class cv extends qp{constructor(e,i,s,o){super(e);d(this,"points",[]);d(this,"cornerPositions",[]);d(this,"css3DInstance");d(this,"plane");d(this,"css3DRenderer",new Sn);d(this,"camera");d(this,"scene");d(this,"container");d(this,"enabled",!1);this.camera=s,this.scene=o,this.container=i,this.initRectangleScaleHelper()}get helperObject(){var e;if(!((e=this.css3DInstance)!=null&&e.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(e){var i;super.applyMatrix4(e),this.helperObject.applyMatrix4(e),(i=this.plane)==null||i.applyMatrix4(e),this.cornerPositions.forEach(s=>s.applyMatrix4(e))}showDraggingHelper(){}applyHelperScaleMatrix4(e,i){var s;(s=this.plane)==null||s.scale.applyMatrix4(e),this.helperObject.applyScaleMatrix4(e)}updatePoints(){const e=this.calculatePointPosition(this.cornerPositions);this.points.forEach((i,s)=>{i.position.copy(e[s])})}applyHelperQuaternion(e,i){var o;const s=(o=this.css3DInstance)==null?void 0:o.css3DObject;if(s){const r=new y.Vector3().subVectors(s.position,i).applyQuaternion(e).add(i);s.position.copy(r),s.applyQuaternion(e)}if(this.plane){const r=new y.Vector3().subVectors(this.plane.position,i).applyQuaternion(e).add(i);this.plane.position.copy(r),this.plane.applyQuaternion(e)}this.cornerPositions.forEach(r=>{const a=new y.Vector3().subVectors(r,i).applyQuaternion(e).add(i);r.copy(a)})}enable(){var e;this.enabled||(this.enabled=!0,(e=this.css3DInstance)==null||e.enable(),this.plane&&this.scene.add(this.plane))}disable(){var e;this.enabled&&(this.enabled=!1,(e=this.css3DInstance)==null||e.disable(),this.plane&&this.scene.remove(this.plane))}show(){var e;(e=this.css3DInstance)==null||e.show(),this.plane&&(this.plane.visible=!0)}hide(){var e;(e=this.css3DInstance)==null||e.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const e=this.getCornerPositions();if(!e)return;this.cornerPositions=e;const i=this.css3DRenderer.create3DElement(this.camera,e,{ratio:.003});if(!i)return;this.css3DInstance=i,i.appendToElement(this.container);const s=i.css3DObject.container,{container:o,squares:r}=lv();this.points=r.map((c,h)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(e)[h]})),s.insertBefore(o,(a=s.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:e}=this;if(e.isCSS3DObjectPlus)return e.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(e){return[e[0].clone(),e[0].clone().add(e[1]).divideScalar(2),e[1].clone(),e[1].clone().add(e[2]).divideScalar(2),e[2].clone(),e[2].clone().add(e[3]).divideScalar(2),e[3].clone(),e[3].clone().add(e[0]).divideScalar(2)]}}class hv extends Xp{constructor(e){super(e);d(this,"box");d(this,"outline");d(this,"originObject");d(this,"positionAttribute");this.originObject=e,this.positionAttribute=new y.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(e,i){return e.intersectObject(this,!1,i)}raycast(e,i){this.box.raycast(e,i)}update(){const e=wn(this.originObject);if(!e)return;const{min:i,max:s}=e;this.positionAttribute.setXYZ(0,s.x,s.y,s.z),this.positionAttribute.setXYZ(1,i.x,s.y,s.z),this.positionAttribute.setXYZ(2,i.x,i.y,s.z),this.positionAttribute.setXYZ(3,s.x,i.y,s.z),this.positionAttribute.setXYZ(4,s.x,s.y,i.z),this.positionAttribute.setXYZ(5,i.x,s.y,i.z),this.positionAttribute.setXYZ(6,i.x,i.y,i.z),this.positionAttribute.setXYZ(7,s.x,i.y,i.z),this.positionAttribute.needsUpdate=!0}createOutline(){const e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new y.BufferGeometry;i.setIndex(new y.BufferAttribute(e,1)),i.setAttribute("position",this.positionAttribute);const s=new y.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),o=new y.LineSegments(i,s);return o.matrixAutoUpdate=!1,o}createBox(){const e=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),i=new y.BufferGeometry;i.setIndex(new y.BufferAttribute(e,1)),i.setAttribute("position",this.positionAttribute);const s=new y.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new y.Mesh(i,s)}}function Re(n,t){this._camera=n||null,this._domElement=t||document,this._raycaster=new y.Raycaster,this._selected=null,this._boundObjs={};var e=this;this._$onClick=function(){e._onClick.apply(e,arguments)},this._$onDblClick=function(){e._onDblClick.apply(e,arguments)},this._$onMouseMove=function(){e._onMouseMove.apply(e,arguments)},this._$onMouseDown=function(){e._onMouseDown.apply(e,arguments)},this._$onMouseUp=function(){e._onMouseUp.apply(e,arguments)},this._$onTouchMove=function(){e._onTouchMove.apply(e,arguments)},this._$onTouchStart=function(){e._onTouchStart.apply(e,arguments)},this._$onTouchEnd=function(){e._onTouchEnd.apply(e,arguments)},this._$onContextmenu=function(){e._onContextmenu.apply(e,arguments)},this._domElement.addEventListener("click",this._$onClick,!1),this._domElement.addEventListener("dblclick",this._$onDblClick,!1),this._domElement.addEventListener("mousemove",this._$onMouseMove,!1),this._domElement.addEventListener("mousedown",this._$onMouseDown,!1),this._domElement.addEventListener("mouseup",this._$onMouseUp,!1),this._domElement.addEventListener("touchmove",this._$onTouchMove,!1),this._domElement.addEventListener("touchstart",this._$onTouchStart,!1),this._domElement.addEventListener("touchend",this._$onTouchEnd,!1),this._domElement.addEventListener("contextmenu",this._$onContextmenu,!1)}Re.prototype.destroy=function(){this._domElement.removeEventListener("click",this._$onClick,!1),this._domElement.removeEventListener("dblclick",this._$onDblClick,!1),this._domElement.removeEventListener("mousemove",this._$onMouseMove,!1),this._domElement.removeEventListener("mousedown",this._$onMouseDown,!1),this._domElement.removeEventListener("mouseup",this._$onMouseUp,!1),this._domElement.removeEventListener("touchmove",this._$onTouchMove,!1),this._domElement.removeEventListener("touchstart",this._$onTouchStart,!1),this._domElement.removeEventListener("touchend",this._$onTouchEnd,!1),this._domElement.removeEventListener("contextmenu",this._$onContextmenu,!1)},Re.eventNames=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu","touchstart","touchend"],Re.prototype._getRelativeMouseXY=function(n){var t=n.target||n.srcElement;t.nodeType===3&&(t=t.parentNode);var e={x:0,y:0},i=t,s=getComputedStyle(i,null);e.y+=parseInt(s.getPropertyValue("padding-top"),10),e.x+=parseInt(s.getPropertyValue("padding-left"),10);do e.x+=i.offsetLeft,e.y+=i.offsetTop,s=getComputedStyle(i,null),e.x+=parseInt(s.getPropertyValue("border-left-width"),10),e.y+=parseInt(s.getPropertyValue("border-top-width"),10);while(i=i.offsetParent);var o={width:t===window?window.innerWidth:t.offsetWidth,height:t===window?window.innerHeight:t.offsetHeight};return{x:Number((n.pageX-e.x)/o.width)*2-1,y:-((n.pageY-e.y)/o.height)*2+1}},Re.prototype._objectCtxInit=function(n){n._3xDomEvent={}},Re.prototype._objectCtxDeinit=function(n){delete n._3xDomEvent},Re.prototype._objectCtxIsInit=function(n){return!!n._3xDomEvent},Re.prototype._objectCtxGet=function(n){return n._3xDomEvent},Re.prototype.camera=function(n){return n&&(this._camera=n),this._camera},Re.prototype.bind=function(n,t,e,i){console.assert(Re.eventNames.indexOf(t)!==-1,"not available events:"+t),this._objectCtxIsInit(n)||this._objectCtxInit(n);var s=this._objectCtxGet(n);s[t+"Handlers"]||(s[t+"Handlers"]=[]),s[t+"Handlers"].push({callback:e,useCapture:i}),this._boundObjs[t]===void 0&&(this._boundObjs[t]=[]),this._boundObjs[t].push(n)},Re.prototype.addEventListener=Re.prototype.bind,Re.prototype.unbind=function(n,t,e,i){console.assert(Re.eventNames.indexOf(t)!==-1,"not available events:"+t),this._objectCtxIsInit(n)||this._objectCtxInit(n);var s=this._objectCtxGet(n);s[t+"Handlers"]||(s[t+"Handlers"]=[]);for(var o=s[t+"Handlers"],r=0;r<o.length;r++){var a=o[r];if(e==a.callback&&i==a.useCapture){o.splice(r,1);break}}var l=this._boundObjs[t].indexOf(n);this._boundObjs[t].splice(l,1)},Re.prototype.removeEventListener=Re.prototype.unbind,Re.prototype._bound=function(n,t){var e=this._objectCtxGet(t);return e?!!e[n+"Handlers"]:!1},Re.prototype._onMove=function(n,t,e,i){var s=this._boundObjs[n];if(!(s===void 0||s.length===0)){var o=new y.Vector2;o.set(t,e),this._raycaster.setFromCamera(o,this._camera);var r=this._raycaster.intersectObjects(s),a=this._selected;if(r.length>0){var l,c,h,u=r[0],f=u.object;this._selected=f,h=this._bound("mousemove",f),a!=f&&(l=this._bound("mouseover",f),c=a&&this._bound("mouseout",a))}else c=a&&this._bound("mouseout",a),this._selected=null;h&&this._notify("mousemove",f,i,u),l&&this._notify("mouseover",f,i,u),c&&this._notify("mouseout",a,i,u)}},Re.prototype._onEvent=function(n,t,e,i){var s=this._boundObjs[n];if(!(s===void 0||s.length===0)){var o=new y.Vector2;o.set(t,e),this._raycaster.setFromCamera(o,this._camera);var r=this._raycaster.intersectObjects(s,!0);if(r.length!==0){for(var a=r[0],l=a.object,c=this._objectCtxGet(l),h=l.parent;typeof c=="undefined"&&h;)c=this._objectCtxGet(h),h=h.parent;c&&this._notify(n,l,i,a)}}},Re.prototype._notify=function(n,t,e,i){var s=this._objectCtxGet(t),o=s?s[n+"Handlers"]:null;if(!s||!o||o.length===0){t.parent&&this._notify(n,t.parent,e,i);return}for(var o=s[n+"Handlers"],r=0;r<o.length;r++){var a=o[r],l=!0;a.callback({type:n,target:t,origDomEvent:e,intersect:i,stopPropagation:function(){l=!1}}),l&&a.useCapture===!1&&t.parent&&this._notify(n,t.parent,e,i)}},Re.prototype._onMouseDown=function(n){return this._onMouseEvent("mousedown",n)},Re.prototype._onMouseUp=function(n){return this._onMouseEvent("mouseup",n)},Re.prototype._onMouseEvent=function(n,t){var e=this._getRelativeMouseXY(t);this._onEvent(n,e.x,e.y,t)},Re.prototype._onMouseMove=function(n){var t=this._getRelativeMouseXY(n);this._onMove("mousemove",t.x,t.y,n),this._onMove("mouseover",t.x,t.y,n),this._onMove("mouseout",t.x,t.y,n)},Re.prototype._onClick=function(n){this._onMouseEvent("click",n)},Re.prototype._onDblClick=function(n){this._onMouseEvent("dblclick",n)},Re.prototype._onContextmenu=function(n){this._onMouseEvent("contextmenu",n)},Re.prototype._onTouchStart=function(n){return this._onTouchEvent("touchstart",n)},Re.prototype._onTouchEnd=function(n){return this._onTouchEvent("touchend",n)},Re.prototype._onTouchMove=function(n){if(n.touches.length==1){var t=Number(n.touches[0].pageX/window.innerWidth)*2-1,e=-(n.touches[0].pageY/window.innerHeight)*2+1;this._onMove("mousemove",t,e,n),this._onMove("mouseover",t,e,n),this._onMove("mouseout",t,e,n)}},Re.prototype._onTouchEvent=function(n,t){var e=t.touches;if(e.length==0&&(e=t.changedTouches),e.length==1){var i=Number(e[0].pageX/window.innerWidth)*2-1,s=-(e[0].pageY/window.innerHeight)*2+1;this._onEvent(n,i,s,t)}};function mi(n){return!ke(n)}function ke(n){return n!=null}function pi(n){return arguments.length===0?[]:Array.isArray(n)?n:[n]}let bs=class{constructor(t,e){d(this,"originObject3D");d(this,"hooks");d(this,"preventTapDefaultEvent",!1);d(this,"internalHooks");d(this,"disposers",[]);d(this,"helperObject3D");d(this,"camera");d(this,"model");d(this,"scene");d(this,"container");d(this,"domEvents");d(this,"isDragging",!1);d(this,"enabled",!1);d(this,"name","BaseController");d(this,"boundingBox");d(this,"config");d(this,"onRender");d(this,"onWantsTapGesture",t=>{if(this.getIntersectObject(t))return!1});d(this,"onWantsUpdateCameraDistance",()=>{if(this.camera.isPerspectiveCamera){const t=this.camera;this.helperObject3D.setScaleByCamera(t)}});d(this,"getBox",()=>this.boundingBox?this.boundingBox:(this.boundingBox=wn(this.originObject3D),this.boundingBox));var h,u,f;this.hooks=(h=t.sharedHooks)!=null?h:new ut,this.internalHooks=(u=t.sharedInternalHooks)!=null?u:new ut,this.camera=t.camera,this.model=t.model,this.originObject3D=t.originObject3D,this.helperObject3D=t.helperObject3D,this.container=t.container,this.scene=t.scene,this.domEvents=new Re(t.camera,t.container),this.onRender=(f=t.onRender)!=null?f:()=>{},this.config=e!=null?e:{},this.initialHelperPosition(),this.initialHelperQuaternion(),this.onWantsUpdateCameraDistance(),this.enable();const i=this.onSetOriginObjectScale.bind(this),s=this.onSetOriginObjectRotate.bind(this),o=this.onSetOriginObjectPosition.bind(this),r=this.onApplyOriginObjectScale.bind(this),a=this.onApplyOriginObjectRotate.bind(this),l=this.onApplyOriginObjectPosition.bind(this),c=this.initialHelperPosition.bind(this);this.internalHooks.on("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",c),this.internalHooks.on("setObjectScale",i),this.internalHooks.on("setObjectRotate",s),this.internalHooks.on("setObjectPosition",o),this.internalHooks.on("applyObjectPosition",l),this.internalHooks.on("applyObjectRotate",a),this.internalHooks.on("applyObjectScale",r),this.disposers.push(()=>{this.internalHooks.off("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",c),this.internalHooks.off("setObjectScale",i),this.internalHooks.off("setObjectRotate",s),this.internalHooks.off("setObjectPosition",o),this.internalHooks.off("applyObjectPosition",l),this.internalHooks.off("applyObjectRotate",a),this.internalHooks.off("applyObjectScale",r)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){var a,l,c;this.helperObject3D.initQuaternion();const t=(a=this.config.xAxis)!=null?a:new y.Vector3(1,0,0),e=(l=this.config.yAxis)!=null?l:new y.Vector3(0,1,0),i=(c=this.config.zAxis)!=null?c:new y.Vector3(0,0,1),s=new y.Quaternion;s.setFromUnitVectors(new y.Vector3(1,0,0),t.normalize());const o=new y.Quaternion;o.setFromUnitVectors(new y.Vector3(0,1,0),e.normalize());const r=new y.Quaternion;r.setFromUnitVectors(new y.Vector3(0,0,1),i.normalize()),this.helperObject3D.quaternion.premultiply(s),this.helperObject3D.quaternion.premultiply(o),this.helperObject3D.quaternion.premultiply(r)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var t;(t=this.disposers)==null||t.forEach(e=>e==null?void 0:e()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(t){this.helperObject3D.applyMatrix4(t)}applyHelperQuaternion(t,e){this.helperObject3D.applyHelperQuaternion(t,e)}applyHelperScaleMatrix4(t,e){this.helperObject3D.applyHelperScaleMatrix4(t,e)}onWantsGesture(t,e,i){if(this.isDragging)return!1}onIntersectionOnModelUpdate(t){}onApplyOriginObjectScale(t){this.applyHelperScaleMatrix4(t.matrix,t.origin)}onApplyOriginObjectRotate(t){this.applyHelperQuaternion(t.quaternion,t.origin)}onApplyOriginObjectPosition(t){this.applyHelperMatrix4(t.matrix)}onSetOriginObjectScale(t){this.helperObject3D.scale.copy(t),this.updateOffsetByScale(t)}onSetOriginObjectRotate(t,e){this.helperObject3D.setHelperQuaternion(t,e)}onSetOriginObjectPosition(t){this.helperObject3D.position.copy(t.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(t){if(this.boundingBox&&this.config.offset){const e=this.originObject3D.position,i=new y.Vector3().subVectors(this.boundingBox.max,e).multiply(t).add(e),s=new y.Vector3().subVectors(this.boundingBox.min,e).multiply(t).add(e),o=this.calculateOffset(this.config.offset,{min:s,max:i});this.helperObject3D.initialPosition(o)}}hoverListener(t,e=16777215,i=1){const s=pi(t).filter(ke),o=[];for(const r of s)if(r.material||r instanceof y.Group){const a=r instanceof y.Group?r.children.filter(f=>f instanceof y.Mesh):[r];a.forEach(f=>{f.__originalColor__=f.material.color.clone(),f.__originalOpacity__=f.material.opacity});const l=()=>{a.forEach(f=>{f.material.color.set(e),f.material.opacity=i}),this.render()},c=()=>{a.forEach(f=>{f.material.color.copy(f.__originalColor__),f.material.opacity=f.__originalOpacity__}),this.render()},h=()=>{this.isDragging||l()},u=()=>{this.isDragging||c()};for(const f of a)this.domEvents.addEventListener(f,"mouseover",h),this.domEvents.addEventListener(f,"mouseout",u),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),o.push(()=>{this.domEvents.removeEventListener(f,"mouseover",h),this.domEvents.removeEventListener(f,"mouseout",u),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>o.forEach(r=>r==null?void 0:r())}getIntersectObject(t){const e=this.camera.position,i=this.helperObject3D;if(!i)return;const s=this.helperObject3D.raycasterIntersectObject(t)[0];if(!s)return;const o=s;if(o.object=i,this.model.intersectRaycaster){const r=this.model.intersectRaycaster(t)[0];if(r&&r.point.distanceTo(e)<o.point.distanceTo(e))return}return o.object}calculateOffset(t,e){const i=new y.Vector3(0,0,0);if(!t)return i;const s=()=>e||this.getBox();if(typeof t.x=="number")i.setX(t.x);else if(typeof t.x=="object"){const o=s();i.setX((o.max.x-o.min.x)*t.x.percents)}if(typeof t.y=="number")i.setY(t.y);else if(typeof t.y=="object"){const o=s();i.setY((o.max.y-o.min.y)*t.y.percents)}if(typeof t.z=="number")i.setZ(t.z);else if(typeof t.z=="object"){const o=s();i.setZ((o.max.z-o.min.z)*t.z.percents)}return i}};const dv=new y.Vector3;function Xi(n){var f;const{raycaster:t,line:e,clampToLine:i=!0}=n;if(((f=t.camera)==null?void 0:f.type)==="OrthographicCamera"){const g=t.ray.origin.clone();return e.closestPointToPoint(g,!1,new y.Vector3)}const s=new y.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(),t.ray.origin),o=s.projectPoint(e.start,new y.Vector3),r=s.projectPoint(e.end,new y.Vector3),a=new y.Line3(o,r),l=a.closestPointToPoint(t.ray.origin,i,dv),c=l.distanceTo(r),h=l.distanceTo(o),u=a.distance();if(c>h&&c>u){const g=-l.distanceTo(o)/u,v=e.start.clone().sub(e.end).normalize();return e.start.sub(v.clone().multiplyScalar(g*e.distance()))}else{const g=l.distanceTo(o)/u;return new y.Vector3().lerpVectors(e.start,e.end,g)}}let uv=class extends bs{constructor(...e){super(...e);d(this,"name","MoveController");d(this,"startInfo");d(this,"_moveByMouse",{enabled:!1});d(this,"mouseInfo");d(this,"mousedownEventListenerDisposer");const i=this.helperObject3D;this.hoverListener([i.xArrow,i.yArrow,i.zArrow]);const s=this.dragStart.bind(this),o=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",s),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),this.hooks.on("rotateStart",l),this.hooks.on("rotateEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",s),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.hooks.off("rotateStart",l),this.hooks.off("rotateEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouse.enabled}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(i=>i==null?void 0:i())}moveByMouse(e){this._moveByMouse={enabled:!0,useFaceNormal:e==null?void 0:e.useFaceNormal},this.preventTapDefaultEvent=!0;const i=this.handleMouseDown.bind(this),s=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",i),this.container.addEventListener("mouseup",s)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",i),this.container.removeEventListener("mouseup",s)}}disableMoveByMouse(){var e;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit("moveByMouseDisable"),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){var r,a,l;if(!this.moveByMouseEnable)return;const{point:i,face:s}=e;if(!this.hooks.emit("wantToMove",i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.enable!==!1)&&s!=null&&s.normal){const c=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0})(),h=new y.Vector3((r=c.x)!=null?r:0,(a=c.y)!=null?a:0,(l=c.z)!=null?l:0),u=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(s.normal):s.normal)();this.originObject3D.quaternion.setFromUnitVectors(h,u),this.internalHooks.emit("setObjectRotate",this.originObject3D.quaternion.clone())}this.internalHooks.emit("setObjectPosition",i),this.hooks.emit("move",i)}}handleMouseDown(e){const{x:i,y:s}=e;this.mouseInfo={x:i,y:s,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;const{x:i,y:s}=e;this.mouseInfo.x===i&&this.mouseInfo.y===s&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}dragStart(e){if(this.moveByMouseEnable||this.isDragging)return;const i=e==null?void 0:e.intersect;if(!i)return this.dragEnd();const s=(i==null?void 0:i.object).direction;if(!s)return this.dragEnd();const o=new y.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),r=new y.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new y.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(s){case"x":return o;case"y":return r;case"z":return a}})(),c=i.point.clone(),h=new y.Line3(c.clone().sub(l.normalize()),c.clone().add(l.normalize()));this.startInfo={startVectorProject:c,line:h},this.helperObject3D.showDraggingHelper([s]),this.hooks.emit("moveStart"),this.isDragging=!0}dragging(e){if(!this.isDragging||!this.startInfo)return;const i=bo(this.camera,e,this.container);return i?(this.move(i),!1):this.dragEnd()}move(e){if(!this.startInfo)return this.dragEnd();const{line:i,startVectorProject:s}=this.startInfo,o=this.originObject3D,r=Xi({raycaster:e,line:i,clampToLine:!1}),a=r.clone().sub(s),l=new y.Matrix4;l.setPosition(a);const c=o.position.clone().applyMatrix4(l);this.hooks.emit("wantToMove",c)||(o.applyMatrix4(l),s.copy(r),this.internalHooks.emit("applyObjectPosition",{matrix:l}),this.hooks.emit("move",c))}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))}};class ys{constructor(t,e,i,s,o,r,a){d(this,"helperController");d(this,"five");d(this,"onFiveWantsUpdateCameraDistance",()=>{var t,e;this.helperController&&((e=(t=this.helperController).onWantsUpdateCameraDistance)==null||e.call(t))});d(this,"onFiveWantsTapGesture",t=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;const e=this.helperController.onWantsTapGesture(t);return this.five.needsRender=!0,e});d(this,"onFiveWantsGesture",(...t)=>{if(!this.helperController)return;const e=this.helperController.onWantsGesture(...t);return this.five.needsRender=!0,e});d(this,"onFiveIntersectionOnModelUpdate",(...t)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...t)});const{camera:l,model:c,scene:h}=t,u=t.getElement();if(this.five=t,!l||!c||!u||!h)return;const f=()=>{t.needsRender=!0};this.helperController=new e({camera:l,model:c,originObject3D:i,helperObject3D:s,container:u,scene:h,onRender:f,sharedHooks:r,sharedInternalHooks:a},o),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsGesture",this.onFiveWantsGesture),t.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),t.on("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),t.on("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance)}dispose(){var t;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),this.five.off("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),this.five.off("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance),(t=this.helperController)==null||t.dispose()}}const Zr="Object3DHelper@v1.0.1",fv=()=>{console.error(`${Zr} is disposed`)},gv=()=>{console.warn(`${Zr} is disabled`)},mv=()=>{console.error(`${Zr} is disabled`)};class pv{constructor(t){d(this,"controllers",{});d(this,"state",{visible:!0,enabled:!0,disposed:!1});d(this,"hooks",new ut);d(this,"eventListener",{});t&&this.addControllers(t),this.setState(this.state)}show(t){return H(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return H(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,e){if(this.state.disposed)return fv();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return mv();const i=x({},this.state);this.state=x(x({},this.state),t),t.disposed!==void 0&&t.disposed!==i.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&this.handleVisible(t.visible),t.enabled!==void 0&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:i})}addControllers(t){this.controllers=x(x({},this.controllers),t),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(t,e=!0){t?(this.everyControllerDo(i=>{i.enable()}),this.hooks.emit("enable",{userAction:e})):(this.everyControllerDo(i=>{i.disable()}),this.hooks.emit("disable",{userAction:e})),this.state.enabled=t}handleVisible(t,e=!0){t?(this.everyControllerDo(i=>{i.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:e}))):(this.everyControllerDo(i=>{i.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:e}))),this.state.visible=t}everyControllerDo(t){Object.values(this.controllers).forEach(e=>{e&&t(e)})}handleDispose(){var t,e;Object.values(this.controllers).forEach(i=>{i==null||i.dispose()});for(const i in this.controllers){if(!i)continue;const s=i;(e=(t=this.eventListener)[s])==null||e.call(t)}}actionIfStateIsEnabled(t,e){if(this.state.enabled)return t();e!=null&&e.warnLog&&gv()}}function Jr(n){return n*180/Math.PI}function qr(n){return n*Math.PI/180}const Kr=new y.Quaternion;class vv extends bs{constructor(...e){var c,h,u;super(...e);d(this,"name","RotateController");d(this,"startInfo");d(this,"removeListener");const i=this.helperObject3D;this.hoverListener([(c=i.xCircle)==null?void 0:c.circle,(h=i.yCircle)==null?void 0:h.circle,(u=i.zCircle)==null?void 0:u.circle].filter(Boolean));const s=this.dragStart.bind(this),o=this.dragging.bind(this),r=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",s),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.removeListener=()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",s),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)}}get rotateCenter(){return this.helperObject3D.position.clone()}setRotateAngle(e){const{x:i=0,y:s=0,z:o=0}=e,r=new y.Euler(qr(i),qr(s),qr(o)),a=new y.Quaternion().setFromEuler(r);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:h}=this;Fc(c,a,h),this.internalHooks.emit("setObjectRotate",a,h),this.hooks.emit("rotate",a),this.render()}dispose(){this.removeListener(),super.dispose()}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;const i=e==null?void 0:e.intersect;if(!i)return this.dragEnd();const s=(i==null?void 0:i.object).direction;if(!s)return this.dragEnd();const o=i.point,r=this.getAngleHelper(s);this.setTipsAngle(0);const a=o.clone();a.y+=.2,this.setTipsPosition(a);const l=this.helperObject3D.quaternion.clone(),c=(()=>{if(s==="x")return new y.Vector3(1,0,0).applyQuaternion(l);if(s==="y")return new y.Vector3(0,1,0).applyQuaternion(l);if(s==="z")return new y.Vector3(0,0,1).applyQuaternion(l)})(),h=new y.Plane().setFromNormalAndCoplanarPoint(c,o),f=h.projectPoint(o.clone(),new y.Vector3).clone().sub(this.rotateCenter),g=f.angleTo(r.baseAxes.clone().applyQuaternion(l));this.setAngleHelperStart(s,g),this.setAngleHelperLength(s,0),this.startInfo={direction:s,startVector:f,plane:h,angleHelper:r,angle:0,helperQuaternion:l.clone()},Kr.copy(l),this.helperObject3D.showDraggingHelper([s]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const i=bo(this.camera,e,this.container);return i?(this.rotate(i),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();const{startVector:i,plane:s,angleHelper:o,direction:r,helperQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=e.ray.intersectPlane(s,new y.Vector3);if(!c)return;const h=this.rotateCenter.clone(),f=s.projectPoint(c.clone(),new y.Vector3).clone().sub(h);if(i.angleTo(f)===0)return;const g=new y.Quaternion().setFromUnitVectors(i.clone().normalize(),f.clone().normalize()),v=l.quaternion.clone().premultiply(g);if(this.hooks.emit("wantToRotate",v))return;const A=new y.Euler().setFromQuaternion(new y.Quaternion().setFromUnitVectors(i.clone().normalize().applyQuaternion(a.clone().inverse()),f.clone().normalize().applyQuaternion(a.clone().inverse())),`${r.toUpperCase()}${"XZY".replace(r.toUpperCase(),"")}`)[r]*o.angleDirection;if(this.startInfo.angle+=A,this.setAngleHelperLength(r,this.startInfo.angle),this.setTipsAngle(Jr(this.startInfo.angle)),h){const w=new y.Vector3().subVectors(l.position,h).applyQuaternion(g).add(h);l.position.copy(w)}l.applyQuaternion(g),Kr.premultiply(g),this.internalHooks.emit("applyObjectRotate",{quaternion:g,origin:h}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=f}dragEnd(){this.isDragging&&(this.internalHooks.emit("setObjectRotate",Kr,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(e){var i,s,o;switch(e){case"x":return(i=this.helperObject3D.xCircle)==null?void 0:i.angleSector;case"y":return(s=this.helperObject3D.yCircle)==null?void 0:s.angleSector;case"z":return(o=this.helperObject3D.zCircle)==null?void 0:o.angleSector}}setAngleHelperStart(e,i){const s=this.getAngleHelper(e);if(!s){console.warn("angleHelper is undefined");return}if(s instanceof y.Mesh&&s.geometry instanceof y.CircleGeometry){const{radius:o,segments:r,thetaLength:a}=s.geometry.parameters;s.geometry=new y.CircleGeometry(o,r,i,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(e,i){const o=i>=0?Math.max(i,.001):Math.min(i,-.001),r=this.getAngleHelper(e);if(r instanceof y.Mesh&&r.geometry instanceof y.CircleGeometry){const{radius:a,thetaStart:l}=r.geometry.parameters,c=Math.ceil(Math.abs(o)*(40/(2*Math.PI)));r.geometry=new y.CircleGeometry(a,c,l,o)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(e){var s;const i=(s=this.helperObject3D.angleTips)==null?void 0:s.element;i&&(i.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){const i=this.helperObject3D.angleTips;if(!i)return;const s=e.project(this.camera),{x:o,y:r,z:a}=s;if(a>1)return;const l=(o+1)/2*100+"%",c=(-r+1)/2*100+"%";i.setLeftTop(l,c)}}class Av extends bs{constructor(...e){super(...e);d(this,"startInfo");d(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(e){this.isDragging||super.onApplyOriginObjectPosition(e)}onApplyOriginObjectScale(e){this.helperObject3D.applyHelperScaleMatrix4(e.matrix,e.origin)}getDragPlane(){const e=new y.Plane,i=this.helperObject3D.cornerPositions;if(i.length!==0)return i.length<3?e.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new N.Vector3),i[0]):e.setFromCoplanarPoints(i[0],i[1],i[2]),e}dragStart(e,i){var o,r;(r=(o=this.helperObject3D).updatePoints)==null||r.call(o);const s=this.getDragPlane();if(!s)return this.dragEnd();this.startInfo={startPoint:{position:i.position.clone(),direction:i.direction},plane:s},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(e){if(!this.isDragging)return;const i=bo(this.camera,e,this.container);if(!i)return this.dragEnd();this.scale(i)}scale(e){var Y,G;if(!this.startInfo)return;const i=this.originObject3D,{startPoint:s,plane:o}=this.startInfo,r=this.helperObject3D.cornerPositions;if(r.length<4)return this.dragEnd();const a=e.ray.intersectPlane(o,new N.Vector3);if(!a||ev(a,this.camera.position))return;const l=new N.Vector3().addVectors(r[0],r[2]).divideScalar(2),{position:c,direction:h}=s,u=new N.Vector3().subVectors(r[1],r[0]),f=new N.Vector3().subVectors(r[3],r[0]),g=Q=>{const W=new N.Vector3(0,0,0);if(!this.startInfo)return W;const _=(Q==="ew"?u:f).clone(),U=c.clone().projectOnVector(_),F=a.clone().projectOnVector(_),X=l.clone().projectOnVector(_);if(F.equals(U))return W;if(Q==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const le=new N.Vector3().subVectors(F,X),ae=le.x<0&&_.x>=0,Ie=le.y<0&&_.y>=0,Ae=le.z<0&&_.z>=0;this.startInfo.dragPointInCenterBottom=ae||Ie||Ae}if(Q==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const le=new N.Vector3().subVectors(F,X),ae=le.x<0&&_.x>=0,Ie=le.y<0&&_.y>=0,Ae=le.z<0&&_.z>=0;this.startInfo.dragPointInCenterLeft=ae||Ie||Ae}const J=new N.Vector3().subVectors(F,U),q=J.length();return q>.3?(console.warn("offset.length() > 0.3, skipped",q),W):J},v=g("ew"),p=g("ns"),m=()=>{const Q=v;this.helperObject3D.cornerPositions.forEach((W,_)=>{var U;(U=this.startInfo)!=null&&U.dragPointInCenterLeft?(_===0||_===3)&&W.add(Q):(_===1||_===2)&&W.add(Q)})},A=()=>{const Q=p;this.helperObject3D.cornerPositions.forEach((W,_)=>{var U;(U=this.startInfo)!=null&&U.dragPointInCenterBottom?(_===0||_===1)&&W.add(Q):(_===2||_===3)&&W.add(Q)})};switch(h){case"ew":m();break;case"ns":A();break;case"nesw":case"nwse":m(),A()}const w=new N.Vector3().subVectors(r[1],r[0]).length()/u.length(),I=new N.Vector3().subVectors(r[3],r[0]).length()/f.length(),P=new N.Vector3(w,I,1),k=new y.Matrix4().scale(P);i.isCSS3DObjectPlus?i.applyScaleMatrix4(k):i.scale.applyMatrix4(k),s.position.copy(a);const M=new N.Vector3().addVectors(r[0],r[2]).divideScalar(2),T=new N.Vector3().subVectors(M,l),R=new y.Matrix4().setPosition(T);i.applyMatrix4(R),(Y=this.helperObject3D.css3DInstance)==null||Y.css3DObject.applyMatrix4(R),(G=this.helperObject3D.plane)==null||G.applyMatrix4(R),this.internalHooks.emit("applyObjectScale",{matrix:k}),this.internalHooks.emit("applyObjectPosition",{matrix:R}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class bv extends Av{constructor(...e){super(...e);d(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(e=>{if(!e)return;const i=e.point,s=a=>this.dragStart(a,e),o=this.dragging.bind(this),r=this.dragEnd.bind(this);i.addEventListener("dragstart",s),i.addEventListener("drag",o),i.addEventListener("dragend",r)})}}const Qt=document.createElement("div");Qt.classList.add("behindFiveElement"),Qt.style.position="absolute",Qt.style.top="0",Qt.style.left="0",Qt.style.width="100%",Qt.style.height="100%",Qt.style.pointerEvents="none";function Qc(n){var i,s,o,r,a;const t=(a=(s=$r(n.getElement()))!=null?s:$r((i=n.getElement())==null?void 0:i.parentElement))!=null?a:$r((r=(o=n.getElement())==null?void 0:o.parentElement)==null?void 0:r.parentElement),e=t==null?void 0:t.parentElement;if(e)return e.contains(Qt)||t.parentElement.insertBefore(Qt,t),Qt;console.error("Can not find a valid element to insert behindFiveElement. How to fix it: https://github.com/realsee-developer/dnalogel/tree/main/plugins/src/CSS3DRenderPlugin/README.md")}function $r(n){var a;if(!n)return;const t=(a=n.style.position)!=null?a:getComputedStyle(n).position;if(t!=="fixed"&&t!=="absolute"&&t!=="relative")return;const e=getComputedStyle(n),i=e.backgroundColor,s=e.backgroundImage;if(!(i!=="transparent"&&i!=="rgba(0, 0, 0, 0)"&&i!==""||s!=="none"&&s!==""))return n}class yv extends bs{constructor(...e){super(...e);d(this,"name","BoundingBoxController")}}class wv extends Jp{constructor(e,i){super(e,i);d(this,"scaleMeshes",[]);d(this,"positions",[]);i&&(this.positions=i.positions)}initialPosition(e){this.position.copy(this.originObject3D.position),this.scaleMeshes.length&&this.remove(...this.scaleMeshes);const i=typeof this.positions=="function"?this.positions():this.positions;i&&(this.scaleMeshes=i.map(s=>{const o=Cv();return o.position.copy(s.handlePosition),o.scalePosition=s,o}),this.add(...this.scaleMeshes))}setScaleByCamera(e){this.scaleMeshes.forEach(i=>{i.scale.setScalar(Yr(e,i.scalePosition.handlePosition.clone().applyMatrix4(this.matrixWorld)))})}}function Cv(){const t=new y.BoxGeometry(.05,.05,.05),e=new y.MeshBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1,transparent:!0,side:y.DoubleSide}),i=new y.Mesh(t,e);return i.renderOrder=10,i}class Pv extends bs{constructor(...e){super(...e);d(this,"name","ScaleController");d(this,"startInfo");d(this,"dragStart",e=>{if(this.isDragging)return;this.isDragging=!0;const{intersect:i}=e,s=this.camera.position,o=i.object,r=o.scalePosition.basePosition.clone(),l=o.scalePosition.handlePosition.clone().clone().sub(r).clone(),c=new y.Line3(r,r.clone().add(l.normalize().multiplyScalar(5)));c.applyMatrix4(this.helperObject3D.matrixWorld);const h=new y.Raycaster(s,i.point.clone().sub(s)),u=Xi({raycaster:h,line:c});this.startInfo={line:c,scaleStartPoint:u,draggingObject:o},this.hooks.emit("scaleStart")});d(this,"dragging",e=>{if(!this.isDragging||!this.startInfo)return;const i=bo(this.camera,e,this.container);return i?(this.scale(i),!1):this.dragEnd()});d(this,"scale",e=>{var c,h;if(!this.startInfo)return;const{line:i,scaleStartPoint:s,draggingObject:o}=this.startInfo,{scalePosition:r}=o,{basePosition:a}=r,l=Xi({raycaster:e,line:i});l.applyMatrix4(new y.Matrix4().getInverse(this.helperObject3D.matrixWorld.clone())),(h=(c=this.config)==null?void 0:c.scaleCallback)==null||h.call(c,{ratio:l.distanceTo(a)/s.distanceTo(a),intersectPoint:l,scalePosition:r}),o.position.copy(l.clone())});d(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.internalHooks.emit("initialHelperPosition"),this.hooks.emit("scaleEnd"))});this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd)}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}initialHelperPosition(){this.helperObject3D.initialPosition();const e=this;e.offHoverListener&&e.offHoverListener(),e.offHoverListener=this.hoverListener(this.helperObject3D.scaleMeshes)}setScale(e){var l,c,h;let i=1,s=1,o=1;typeof e=="number"?(i=e,s=e,o=e):typeof e=="object"&&(i=(l=e.x)!=null?l:1,s=(c=e.y)!=null?c:1,o=(h=e.z)!=null?h:1);const r=new y.Vector3(i,s,o);this.hooks.emit("wantToScale",r)||(this.originObject3D.scale.copy(r),this.internalHooks.emit("setObjectScale",r),this.hooks.emit("scale",r),this.render())}}function Pn(n){return H(this,null,function*(){return new Promise(t=>{if(Iv(n))t();else{const e=i=>{const s=Bt(n);i===s&&(n.off("modelLoaded",e),t())};n.on("modelLoaded",e)}})})}function Iv(n){var t;return(t=Bt(n))==null?void 0:t.loaded}const ea="Object3DHelperPlugin",yo=ea,Mv=()=>{console.error(`${yo} is disposed`)},Ev=()=>{console.warn(`${yo} is disabled`)},kv=()=>{console.error(`${yo} is disabled`)};class ta extends Di{constructor(e){super(e);d(this,"name",ea);d(this,"state",{visible:!0,enabled:!0,disposed:!1});d(this,"objectHelperMap",new Map);d(this,"css3DObjectParentMap",new Map);d(this,"css3DRender");this.five=e,this.css3DRender=new Sn(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${ea.toUpperCase()}_DEBUG__`]:this})}show(e){return H(this,null,function*(){this.setState({visible:!0},e)})}hide(e){return H(this,null,function*(){this.setState({visible:!1},e)})}enable(e){this.setState({enabled:!0},e)}disable(e){this.setState({enabled:!1},e)}dispose(){this.setState({disposed:!0})}setState(e,i){if(this.state.disposed)return Mv();if(!this.state.enabled&&e.enabled!==!0&&e.disposed!==!0)return kv();const s=x({},this.state);this.state=x(x({},this.state),e),e.disposed!==void 0&&e.disposed!==s.disposed&&e.disposed&&this.handleDispose(),e.visible!==void 0&&e.visible!==s.visible&&this.handleVisible(e.visible),e.enabled!==void 0&&e.enabled!==s.enabled&&this.handleEnable(e.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:s})}getObject3DHelper(e){return this.objectHelperMap.get(e)}addObject3DHelper(e,i={}){var A;if(!e){console.error("Object3D is undefined");return}if(this.objectHelperMap.has(e)){console.warn(`Object3DHelperPlugin: object3D ${e.name} is already has helper`);return}const s=new pv,o=[],r=(A=this.five.getElement())==null?void 0:A.parentElement,a=this.five.camera,c=x(x({},{moveHelper:!0,rotateHelper:!0,scaleHelper:!0,boundingBoxHelper:!1,positionFrom:"objectPosition"}),i),{moveHelper:h,rotateHelper:u,scaleHelper:f,boundingBoxHelper:g}=c,v=new ut,p=new ut,m=w=>{if(w)return typeof w=="boolean"?w:w.enable};if(m(h)){const w=x(x({},this.getConfig(c.moveHelper)),c),I=new tv(e,x({},w)),P=new ys(this.five,uv,e,I,w,v,p);s.addControllers({moveController:P.helperController}),o.push(()=>P.dispose())}if(m(u)){const w=x(x({},this.getConfig(c.rotateHelper)),c),I=new sv(e,x({container:r},w)),P=new ys(this.five,vv,e,I,w,v,p);s.addControllers({rotateController:P.helperController}),o.push(()=>P.dispose())}if(m(g)){const w=new hv(e),I=new ys(this.five,yv,e,w,void 0,v,p);s.addControllers({boundingBoxController:I.helperController})}if(m(f))if(e.isCSS3DObjectPlus&&r){const w=new cv(e,r,a,this.five.scene),I=new ys(this.five,bv,e,w,void 0,v,p);s.addControllers({scaleController:I.helperController}),o.push(()=>I.dispose()),Pn(this.five).then(()=>{var P,k;if(e.isCSS3DObjectPlus){const M=e;if(!M||M.mode!=="front")return;const T=(P=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?P:Qc(this.five);T&&(this.css3DObjectParentMap.set(M,M.parent),M.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(T),(k=this.css3DRender.getBehindCSS3DObjectGroup())==null||k.add(M),this.css3DRender.render(this.five.camera))}})}else{const w=x(x({},this.getConfig(c.scaleHelper)),c),I=new wv(e,w),P=new ys(this.five,Pv,e,I,w,v,p);s.addControllers({scaleController:P.helperController}),o.push(()=>P.dispose())}return this.objectHelperMap.set(e,{helper:s,disposers:o}),s.controllers}removeObject3DHelper(e){if(!this.objectHelperMap.has(e))return;const{helper:i,disposers:s}=this.objectHelperMap.get(e);if(i){if(e.isCSS3DObjectPlus){const o=e,r=this.css3DObjectParentMap.get(o);r&&r.add(o),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(e),i.dispose(),s==null||s.forEach(o=>o==null?void 0:o())}}handleEnable(e,i=!0){e?(this.everyHelperDo(s=>s.enable()),this.hooks.emit("enable",{userAction:i})):(this.everyHelperDo(s=>s.disable()),this.hooks.emit("disable",{userAction:i})),this.state.enabled=e}handleVisible(e,i=!0){e?(this.everyHelperDo(s=>s.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):(this.everyHelperDo(s=>s.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=e}handleDispose(){this.everyHelperDo((e,i)=>{e.dispose(),i==null||i.forEach(s=>s==null?void 0:s())})}everyHelperDo(e){this.objectHelperMap.forEach(({helper:i,disposers:s})=>{i&&e(i,s)})}actionIfStateIsEnabled(e,i){if(this.state.enabled)return e();i!=null&&i.warnLog&&Ev()}getConfig(e){if(e&&typeof e!="boolean"&&e.enable)return e}}const xv=n=>new ta(n);function Wc(n,t){const{top:e,left:i,width:s,height:o}=t.getBoundingClientRect();return new y.Vector2((n.x-i)/s*2-1,-(n.y-e)/o*2+1)}class Hc extends y.Raycaster{intersectObject(t,e=!0,i=[]){return ia(t,this,i,e),i.sort(Uc),i}intersectObjects(t,e=!0,i=[]){for(let s=0,o=t.length;s<o;s++)ia(t[s],this,i,e);return i.sort(Uc),i}}function Uc(n,t){return n.distance-t.distance}function ia(n,t,e,i){let s=!0;if(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0){const o=n.children;for(let r=0,a=o.length;r<a;r++)ia(o[r],t,e,!0)}}function na(n,t,e,i){let s=!0;if(n.type!=="Line2"&&(n.layers.test(t.layers)&&n.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0)){const o=n.children;for(let r=0,a=o.length;r<a;r++)o[r].type!=="Line2"&&na(o[r],t,e,!0)}}class sa{constructor(t,e){d(this,"five");d(this,"dragging",!1);d(this,"boundObject",{});d(this,"config");d(this,"lastMouseDownEvent");d(this,"handleWantsGesture",(t,e)=>{if(e.length!==1)return;const i=e[0];if(i.raycaster){const s=new Hc;s.ray=i.raycaster.ray,s.near=i.raycaster.near,s.far=i.raycaster.far,s.camera=i.raycaster.camera,s.layers=i.raycaster.layers,s.params=i.raycaster.params,i.raycaster=s}if(i){if(t==="mouseMove"&&this.onDomEvent("hover",i),t==="tap"){const s=this.lastMouseDownEvent,o=this.onDomEvent("click",i,s),r=this.onDomEvent("wantDblclick",i,s,this.boundObject.dblclick);if(o===!1||r===!1)return!1}if(this.dragging)return!1}});d(this,"handleDomEvent",(t,e,i)=>{const s={x:e.clientX,y:e.clientY};this.onDomEvent(t,s,e,i)});d(this,"handleMouseEvent",t=>{this.handleDomEvent(t.type,t)});d(this,"handleMousedown",t=>{this.lastMouseDownEvent=t,this.handleDomEvent("mousedown",t),this.handleDomEvent("dragstart",t,this.haveDragEventObject)});d(this,"handleMouseup",t=>{var e;this.dragging=!1,(e=this.haveDragEventObject)==null||e.forEach(i=>{i._dragging&&(i._dragging=!1,this.notify({eventName:"dragend",object:i,originEvent:t,raycaster:this.getRaycaster({x:t.clientX,y:t.clientY})}))}),this.handleDomEvent("mouseup",t)});d(this,"handleMousemove",t=>{var e;this.dragging&&((e=this.boundObject.drag)==null||e.forEach(i=>{i._dragging&&this.notify({eventName:"drag",object:i,originEvent:t,raycaster:this.getRaycaster({x:t.clientX,y:t.clientY})})}))});d(this,"onDomEvent",(t,e,i,s=this.boundObject[t])=>{var f,g,v,p,m;if(!e||!s||(s==null?void 0:s.length)===0)return;const o=[];((f=this.config)==null?void 0:f.fiveModels)!==null&&((g=this.config)!=null&&g.fiveModels?o.push(...this.config.fiveModels):o.push(this.model));const r=o.filter(A=>A.loaded),a=(v=e.raycaster)!=null?v:this.getRaycaster(e);a.params.Points.threshold=.02;const l=a.intersectObjects(s,!0),c=[];r.forEach(A=>{const w=A.intersectRaycaster(a);c.push(...w)});const h=.01;if(c.length>0&&l.length>0&&c[0].distance+h<l[0].distance)return;const u=(p=l==null?void 0:l[0])==null?void 0:p.object;if(t==="wantDblclick")return!1;if((!u||!this.objectIsBound(u))&&t==="hover")for(const A of(m=this.boundObject.hover)!=null?m:[])A._hovered&&this.notify({eventName:"unHover",object:A});if(u&&u&&this.notify({eventName:t,object:u,originEvent:i,raycaster:a,intersects:l}))return!1});d(this,"objectIsBound",t=>{let e=t._domEvent,i=t.parent;for(;typeof e=="undefined"&&i;)e=i._domEvent,i=i.parent;return!!e});d(this,"notify",t=>{var f,g,v;const{eventName:e,object:i,originEvent:s,raycaster:o,intersects:r}=t;let a=!1,l=[];const c=[];let h=i;for(c.push(h);h.parent;)h=h.parent,c.push(h);const u=c.at(-1);if(!((f=this.config)!=null&&f.noEmitWhenNotInScene&&u.type!=="Scene")){for(const p of c){if(a)break;p.draggable&&(e==="dragstart"&&(p._dragging=!0,this.dragging=!0),e==="dragend"&&(p._dragging=!1,this.dragging=!1));const m=p._domEvent;if(!m)continue;const A=m[`${e}Handler`];if(A)for(const[w,I]of A){if(I!=null&&I.noEmitWhenNotInScene&&u.type!=="Scene"||((g=this.config)!=null&&g.noEmitWhenHide||I!=null&&I.noEmitWhenHide)&&!Rr(p))continue;if(e==="hover"){if(p._hovered)continue;p._hovered=!0;for(const k of(v=this.boundObject.hover)!=null?v:[])k!==p&&k._hovered&&this.notify({eventName:"unHover",object:k})}if(e==="unHover"){if(!p._hovered)continue;p._hovered=!1}const P=w({type:e,target:p,origDomEvent:s,raycaster:o,intersects:r,stopPropagation:()=>{a=!0}});l.push(P!=null?P:!0)}}if(e==="click"||e==="wantDblclick")return l.some(p=>p===!0)}});this.five=t,this.config=e,t.on("wantsGesture",this.handleWantsGesture),document.addEventListener("mousedown",this.handleMousedown),document.addEventListener("dblclick",this.handleMouseEvent),document.addEventListener("mouseup",this.handleMouseup),document.addEventListener("mousemove",this.handleMousemove)}get haveDragEventObject(){return[...new Set([this.boundObject.dragend,this.boundObject.drag,this.boundObject.dragstart].flat())].filter(Boolean)}get model(){return Bt(this.five)}addAutoBindEventListener(t,e,i,s){const o=()=>this.addEventListener(t,e,i,s),r=()=>this.removeEventListener(t,e,i,s);return t.addEventListener("added",o),t.addEventListener("removed",r),t.addEventListener("dispose",r),()=>{t.removeEventListener("added",o),t.removeEventListener("removed",r),t.removeEventListener("dispose",r)}}addEventListener(t,e,i,s){t._domEvent||(t._domEvent={}),t._domEvent[`${e}Handler`]||(t._domEvent[`${e}Handler`]=[]),this.boundObject[e]||(this.boundObject[e]=[]),this.boundObject[e].includes(t)||this.boundObject[e].push(t),t._domEvent[`${e}Handler`].push([i,x({noEmitWhenHide:!1,noEmitWhenNotInScene:!1},s)])}removeEventListener(t,e,i,...s){var r,a;if(!t._domEvent||(e===void 0&&(Object.keys(this.boundObject).forEach(l=>{var h,u;const c=(h=this.boundObject[l])==null?void 0:h.findIndex(f=>f===t);c!==-1&&((u=this.boundObject[l])==null||u.splice(c,1))}),t._domEvent={}),!t._domEvent[`${e}Handler`]))return;if(i===void 0){delete t._domEvent[`${e}Handler`];return}const o=t._domEvent[`${e}Handler`].findIndex(l=>l[0]===i);if(o!==-1&&(t._domEvent[`${e}Handler`].splice(o,1),t._domEvent[`${e}Handler`].length===0&&delete t._domEvent[`${e}Handler`],t._domEvent&&Object.keys(t._domEvent).length===0&&delete t._domEvent,!t._domEvent)){const l=(r=this.boundObject[e])==null?void 0:r.findIndex(c=>c===t);l!==-1&&((a=this.boundObject[e])==null||a.splice(l,1))}}clear(){this.boundObject={}}dispose(){var t;(t=this.five)==null||t.off("wantsGesture",this.handleWantsGesture),document.removeEventListener("mousedown",this.handleMousedown),document.removeEventListener("mouseup",this.handleMouseup),document.removeEventListener("mousemove",this.handleMousemove),this.boundObject={}}toJSON(){return{boundObject:this.boundObject}}getRaycaster(t){const e=this.five.getElement();if(!e)return;const i=Wc(t,e),s=new Hc;return s.setFromCamera(i,this.five.camera),s}}const Yc="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;function Dv(n,t){const{x:e,y:i}=t,s=e*2-1,o=i*2-1,r=new y.Raycaster;return r.setFromCamera({x:s,y:o},n.camera),r.params.Points.threshold=.02,r}function ws(n,t,e){const i=Sv(n,t);return e!=null&&e.virtualPoint?i!=null?i:Xc(t):i}function Xc(n,t=3){const e=new y.Vector3().addVectors(n.ray.origin,n.ray.direction.clone().normalize().multiplyScalar(t)),i=n.ray.direction.clone().negate();return{distance:t,point:e,object:new y.Object3D,face:new y.Face3(0,0,0,i),raycaster:n,isVirtual:!0}}function Sv(n,t){const s=Bt(n).intersectRaycaster(t)[0];if(s)return ne(x({},s),{raycaster:t,isVirtual:!1})}const Lv=new y.Vector3,In=()=>!1;class Zc extends ut{constructor(e,i){var r,a,l;super();d(this,"outOfFive",!1);d(this,"enabled",!1);d(this,"actionIfNoModelUnderMouse","virtualPoint");d(this,"plane");d(this,"pointSelectorHelper");d(this,"hook",this);d(this,"five");d(this,"hammer");d(this,"mode");d(this,"pressDown",!1);d(this,"adherePoints");d(this,"adherePointsRadius",.1);d(this,"lastFiveHelperVisible");d(this,"lastIntersection");d(this,"mousePosition");d(this,"config",{});d(this,"select",e=>{e&&this.updatePointSelectorHelperIntersect(e);const i=this.emit("wantsSelect",this.position);return i||(this.pointSelectorHelper.hide(),this.emit("select",this.position),console.debug(this.position)),!i});d(this,"onEnter",()=>{this.pointSelectorHelper.show(),this.outOfFive=!1,this.emit("intersectionUpdate",this.position)});d(this,"onLeave",()=>{this.pointSelectorHelper.hide(),this.outOfFive=!0,this.emit("intersectionUpdate",null)});d(this,"onTap",e=>{e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),this.select()});d(this,"onPan",e=>{this.pressDown&&(e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),this.mouseNdcPosition&&this.updateByNdcPosition(this.mouseNdcPosition))});d(this,"onPress",e=>{if(e!=null&&e.center&&(this.mousePosition={clientX:e.center.x,clientY:e.center.y}),!this.mouseNdcPosition)return;const i=this.updateByNdcPosition(this.mouseNdcPosition);this.pressDown=i});d(this,"onPanEnd",()=>{this.pressDown&&(this.pressDown=!1,this.select())});d(this,"updateByMousePosition",e=>{this.five.getElement()&&(this.mousePosition=e,this.updateByNdcPosition(this.mouseNdcPosition))});d(this,"updateByNdcPosition",e=>{var o,r;const i=Dv(this.five,e),s=ws(this.five,i);if(s)return this.updatePointSelectorHelperIntersect(s),this.lastIntersection=s,!0;if(this.plane){const a=i.ray.intersectPlane(this.plane,Lv);if(a){const l={distance:this.five.camera.position.distanceTo(a),point:a.clone(),object:new y.Object3D,face:new y.Face3(0,0,0,this.plane.normal.clone()),raycaster:i,isVirtual:!0};return this.updatePointSelectorHelperIntersect(l),!0}}if(this.actionIfNoModelUnderMouse==="lastPoint")return this.updatePointSelectorHelperIntersect(this.lastIntersection),!0;if(this.actionIfNoModelUnderMouse==="virtualPoint"){const a=Xc(i,(o=this.lastIntersection)==null?void 0:o.distance);return a.face=new y.Face3(0,0,0,(r=this.lastIntersection)==null?void 0:r.face.normal),this.lastIntersection=a,this.updatePointSelectorHelperIntersect(a),!0}else if(this.actionIfNoModelUnderMouse==="disable")return this.updatePointSelectorHelperIntersect(null),!1});d(this,"updatePointSelectorHelperIntersect",e=>{if(!e){this.onLeave(),this.five.getElement().style.cursor=`url("data:image/svg+xml,%3Csvg width='12px' height='12px' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cpath d='M6,12 C9.3137085,12 12,9.3137085 12,6 C12,2.6862915 9.3137085,0 6,0 C2.6862915,0 0,2.6862915 0,6 C0,9.3137085 2.6862915,12 6,12 Z' fill='%23FF5959'%3E%3C/path%3E%3Cg transform='translate(2, 2)' stroke='%23FFFFFF'%3E%3Ccircle cx='4' cy='4' r='4'%3E%3C/circle%3E%3Cline x1='1.07141075' y1='1.23997894' x2='6.64700843' y2='6.81557662'%3E%3C/line%3E%3C/g%3E%3C/g%3E%3C/svg%3E"), auto`;return}this.onEnter(),this.five.getElement().style.cursor="";const i=x({},e);let s=!1;if(typeof this.adherePoints=="function"&&typeof this.adherePointsRadius=="number"){for(const o of this.adherePoints({intersection:e,pointSelectorInstance:this}))if(o.distanceTo(e.point)<this.adherePointsRadius){i.point=o.clone(),s=!0;break}}this.pointSelectorHelper.updateWithIntersect(i,{emitEvent:!1}),this.emit("intersectionUpdate",i,s)});d(this,"mousePositionToNdcPosition",e=>{const i=this.five.getElement();if(!i)return null;const{top:s,left:o,width:r,height:a}=i.getBoundingClientRect(),{clientX:l,clientY:c}=e;return{x:(l-o)/r,y:1-(c-s)/a}});d(this,"onFiveWantsPanGesture",()=>{if(this.pressDown)return!1});d(this,"renderScreenCenter",()=>{this.updateByNdcPosition({x:.5,y:.5})});d(this,"emitIntersectionUpdate",e=>{this.emit("intersectionUpdate",e)});this.five=e,this.config=x(x({},this.config),i),this.actionIfNoModelUnderMouse=(r=i==null?void 0:i.actionIfNoModelUnderMouse)!=null?r:"virtualPoint";const s=(a=i==null?void 0:i.mode)!=null?a:"auto";s==="auto"?this.mode=Yc?"fixed":"cursor":this.mode=s;const o={autoFixPCPosition:this.mode==="cursor",initialPosition:this.mode==="fixed"?{left:"35%",top:"20%"}:void 0};this.pointSelectorHelper=new eh(this.five,ne(x({},i==null?void 0:i.helper),{magnifierParams:x(x({},o),(l=i==null?void 0:i.helper)==null?void 0:l.magnifierParams)})),this.pointSelectorHelper.hide()}get position(){return this.outOfFive?null:this.pointSelectorHelper.position}get mouseNdcPosition(){return this.mousePosition?this.mousePositionToNdcPosition(this.mousePosition):null}enable(){if(this.enabled)return;this.enabled=!0,this.outOfFive=!1,this.pointSelectorHelper.enable();const e=this.five.getElement();if(!e)throw new Error("five element not found");this.hammer||(this.hammer=new vn(e)),this.mode==="cursor"?(this.five.on("wantsPanGesture",this.onFiveWantsPanGesture),this.five.on("wantsMoveToPano",In),this.five.on("wantsChangeMode",In),this.five.on("wantsTapGesture",In),e.addEventListener("mousemove",this.updateByMousePosition),e.addEventListener("wheel",this.updateByMousePosition),e.addEventListener("mouseenter",this.onEnter),e.addEventListener("mouseout",this.onLeave),this.hammer.on("tap",this.onTap),this.hammer.on("pan",this.onPan),this.hammer.on("press",this.onPress),this.hammer.on("panend",this.onPanEnd)):this.mode==="fixed"&&(this.five.on("panoArrived",this.renderScreenCenter),this.five.on("panGesture",this.renderScreenCenter),this.five.on("interiaPan",this.renderScreenCenter),this.renderScreenCenter(),this.pointSelectorHelper.show()),this.pointSelectorHelper.hooks.on("intersectionUpdate",this.emitIntersectionUpdate),this.lastFiveHelperVisible=this.five.helperVisible,this.five.helperVisible=!1,this.emit("enable")}disable(){if(!this.enabled)return;this.enabled=!1,this.pointSelectorHelper.disable(),this.five.getElement().style.cursor="";const e=this.five.getElement();this.five.off("wantsPanGesture",this.onFiveWantsPanGesture),this.five.off("wantsMoveToPano",In),this.five.off("wantsChangeMode",In),this.five.off("wantsTapGesture",In),this.five.helperVisible=this.lastFiveHelperVisible,e==null||e.removeEventListener("mousemove",this.updateByMousePosition),e==null||e.removeEventListener("wheel",this.updateByMousePosition),e==null||e.removeEventListener("mouseenter",this.onEnter),e==null||e.removeEventListener("mouseout",this.onLeave),this.hammer.off("tap",this.onTap),this.hammer.off("pan",this.onPan),this.hammer.off("press",this.onPress),this.hammer.off("panend",this.onPanEnd),this.five.off("panoArrived",this.renderScreenCenter),this.five.off("panGesture",this.renderScreenCenter),this.five.off("interiaPan",this.renderScreenCenter),this.pointSelectorHelper.hooks.off("intersectionUpdate",this.emitIntersectionUpdate),this.emit("disable")}dispose(){this.disable(),this.pointSelectorHelper.dispose()}setAdherePoints(e,i){e?typeof e=="function"?this.adherePoints=e:this.adherePoints=()=>e:this.adherePoints=null,typeof i=="number"&&(this.adherePointsRadius=i)}}class Tv{constructor(){d(this,"five");d(this,"_cursor");d(this,"_pointSelector");d(this,"_fiveDomEvents");d(this,"_object3DHelper");d(this,"inited",!1);d(this,"init",t=>{this.inited=!0,this.five=t,this._cursor=void 0,this._pointSelector=void 0,this._fiveDomEvents=void 0,this._object3DHelper=void 0})}get cursor(){if(!this.inited)throw new Error("Global not inited");return this._cursor?this._cursor:(this._cursor=new _p(this.five.getElement()),this._cursor)}get pointSelector(){if(!this.inited)throw new Error("Global not inited");return this._pointSelector?this._pointSelector:(this._pointSelector=new Zc(this.five),this._pointSelector)}get fiveDomEvents(){if(!this.inited)throw new Error("Global not inited");return this._fiveDomEvents?this._fiveDomEvents:(this._fiveDomEvents=new sa(this.five,{noEmitWhenNotInScene:!0}),this._fiveDomEvents)}get object3DHelper(){if(!this.inited)throw new Error("Global not inited");return this._object3DHelper?this._object3DHelper:(this._object3DHelper=new ta(this.five),this._object3DHelper)}}const oa=new Tv;window.globalModules=oa;function Jc(n){qc(n),n.traverse(t=>qc(t))}function qc(n){Array.isArray(n.lengthDoms)&&n.lengthDoms[0]instanceof Nr&&n.lengthDoms.forEach(e=>e.destroy())}class Kc extends Bp{constructor(e){var i,s;super(e);d(this,"_three_color");ke(e==null?void 0:e.color)&&(this.three_color=(i=e==null?void 0:e.color)!=null?i:16777215),Object.keys(e).forEach(o=>{["color","dashed","dashScale","dashSize","gapSize","resolution"].includes(o)||o in this&&(this[o]=e[o])}),this.setDashed((s=e==null?void 0:e.dashed)!=null?s:!1)}get three_color(){return this._three_color}set three_color(e){this._three_color=e,this.color=e}setDashed(e){this.dashed=e,e?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}}class $c extends Vp{constructor(e,i){super(e,i);d(this,"name","Line3")}}class Wt extends St{constructor(e){var r,a,l,c,h;super();d(this,"name","LineMesh");d(this,"points");d(this,"lengthDoms",[]);d(this,"highlighted",!1);d(this,"line");d(this,"backLine");d(this,"opacityBeforeHighlight");d(this,"paramsStyle",{});this.paramsStyle=e!=null?e:{};const i=new Vc,s=new Kc({color:new y.Color((r=e==null?void 0:e.lineColor)!=null?r:zc),linewidth:(a=e==null?void 0:e.lineWidth)!=null?a:Op,dashScale:40,opacity:(l=e==null?void 0:e.opacity)!=null?l:1,transparent:!0,dashed:(c=e==null?void 0:e.dashed)!=null?c:!1}),o=new Kc({color:new y.Color((h=e==null?void 0:e.lineColor)!=null?h:zc),linewidth:s.linewidth*.9,dashScale:s.dashScale,opacity:s.opacity*.8,depthTest:!1,depthWrite:!1,transparent:!0,resolution:s.resolution});this.line=new $c(i,s),this.backLine=new $c(i,o),this.line.renderOrder=1,this.backLine.renderOrder=0,this.line.name="lineFrontMaterial",this.backLine.name="lineBackMaterial",e&&this.setStyle(e),e!=null&&e.points&&this.setPoints(e.points),this.addEventListener("removed",()=>{Jc(this)})}get style(){return{lineColor:this.color,lineWidth:this.lineWidth,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:this.paramsStyle.lengthEnable}}get lineWidth(){return this.line.material.linewidth}get color(){return new y.Color(this.line.material.three_color)}get dashed(){return this.line.material.dashed}get occlusionVisibility(){return this.backLine.visible||this.line.material.depthTest===!1}get occlusionMode(){return this.line.material.depthTest===!1?"depthTest":"translucence"}setPoints(e){const i=e.map(Ge).filter(ke);if(this.points=i,i.length<2)return;this.addIfNotExists(this.line,this.backLine);const s=i.flatMap(o=>[o.x,o.y,o.z]);s.length>2&&(this.line.geometry.dispose(),this.line.geometry=new Vc,this.backLine.geometry=this.line.geometry),this.line.geometry.setPositions(s),this.line.computeLineDistances(),this.updateLengthItems(),this.needsRender=!0}setResolution(e,i){const s=this.line.material.resolution;(s.x!==e||s.y!==i)&&(s.set(e,i),this.needsRender=!0);const o=this.backLine.material.resolution;(o.x!==e||o.y!==i)&&(o.set(e,i),this.needsRender=!0)}setStyle(e){var o,r,a;this.paramsStyle=x(x({},this.paramsStyle),e),ke(e.lineColor)&&(this.line.material.three_color=new y.Color(e.lineColor),this.backLine.material.three_color=new y.Color(e.lineColor)),ke(e.lineWidth)&&(this.line.material.linewidth=e.lineWidth),ke(e.dashed)&&this.line.material.setDashed(e.dashed),ke(e.opacity)&&(this.line.material.opacity=e.opacity,this.backLine.material.opacity=this.line.material.opacity*.2),this.updateLengthItems();const i=(o=e.occlusionVisibility)!=null?o:this.paramsStyle.occlusionVisibility,s=(a=(r=e.occlusionMode)!=null?r:this.paramsStyle.occlusionMode)!=null?a:"translucence";i?s==="depthTest"?(this.line.material.depthTest=!1,this.backLine.visible=!1):s==="translucence"&&(this.line.material.depthTest=!0,this.backLine.visible=!0,this.line.material.opacity===1?this.backLine.material.setDashed(!0):this.backLine.material.setDashed(this.line.material.dashed)):(this.line.material.depthTest=!0,this.backLine.visible=!1),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.line.material.opacity,this.line.material.opacity=this.opacityBeforeHighlight*yn,this.backLine.material.opacity=this.backLine.material.opacity*yn,this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.line.material.opacity=this.opacityBeforeHighlight,this.backLine.material.opacity=.2,this.needsRender=!0)}updateLengthItems(){var e,i;if(this.paramsStyle.lengthEnable){const s=(i=(e=this.points)==null?void 0:e.map((o,r)=>{if(r!==0)return[this.points[r-1],o]}).filter(ke))!=null?i:[];s.forEach(([o,r],a)=>{var h;const l=ei(o,r),c=o.distanceTo(r).toFixed(2)+"m";this.lengthDoms[a]=(h=this.lengthDoms[a])!=null?h:new Nr(oa.five),this.lengthDoms[a].setPosition(l),this.lengthDoms[a].container.innerHTML=`<div style="pointer-events:none;color:white;">${c}</div>`}),this.lengthDoms.length>s.length&&(this.lengthDoms.slice(s.length).forEach(o=>o.destroy()),this.lengthDoms.length=s.length)}else this.lengthDoms.forEach(s=>s.destroy()),this.lengthDoms=[]}}class jv extends He.CSS3DSprite{constructor(){super(...arguments);d(this,"isCSS3DSprite",!0)}}const zv=`
178
178
  varying vec2 vUv;
179
179
  varying float vRadius;
180
180
  varying float vDistanceToCamera;
@@ -615,7 +615,7 @@ void main() {
615
615
  void main() {
616
616
  gl_FragColor = texture2D(map, vUv);
617
617
  }
618
- `);this.uniforms={map:{value:e}}}}class xg extends y.Mesh{constructor(){super(...arguments);d(this,"name","MediaPlane");d(this,"src")}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}dispose(){this.traverse(e=>{if(e.isMesh){const i=e;i.geometry.dispose(),(i.material instanceof Array?i.material:[i.material]).forEach(o=>{o.dispose()})}})}}class Dg extends xg{constructor(e,i,s){var a;super();d(this,"name","PanoTagPluginImagePlane");this.src=e;const o=(a=s==null?void 0:s.resolveZFighting)!=null?a:!0;let r=i;if(o){const l=Ss(i,5e-4);r=i.map(c=>c.clone().add(l))}Bd(e).then(({texture:l,transparent:c})=>{var p;const h=new y.MeshBasicMaterial({map:l,transparent:c}),u=Bs((p=s==null?void 0:s.objectFit)!=null?p:"contain",r,l.image.width/l.image.height),f=ei(...u),g=u.map(m=>m.clone().sub(f)),v=new kg(g);this.position.copy(f),this.geometry=v,this.material=h}).catch(l=>{console.error(`Imageplane error ${l==null?void 0:l.message}`)})}}class Sg extends xg{constructor(e,i,s){const{videoCoverSrc:o,objectFit:r="contain",playButton:a="withText",paused:l=!0,videoTextureMap:c,ImageTextureMap:h,domEvents:u}=s!=null?s:{};super();d(this,"isVideoPlane",!0);d(this,"name","PanoTagPluginImagePlane");d(this,"videoInstance");d(this,"onVideoReady");d(this,"objectFit");d(this,"buttonSrc");d(this,"videoCoverSrc");d(this,"domEvents");d(this,"disposers",[]);d(this,"cornerPoints");d(this,"videoMesh");d(this,"coverMesh");d(this,"buttonMesh");d(this,"videoTextureMap");d(this,"ImageTextureMap");this.cornerPoints=i,this.src=e,this.buttonSrc=(()=>a==="withText"?Ua:a==="withoutText"?Ya:typeof a=="string"?a:Ya)(),this.videoCoverSrc=o,this.objectFit=r,this.videoTextureMap=c,this.ImageTextureMap=h,this.domEvents=u,this.position.copy(ei(...i)),this.videoCoverSrc&&l?this.addCoverMesh().then(()=>this.addButtonMesh()):this.addVideoMesh().then(()=>{l?this.addButtonMesh():this.play(!0)}),this.addEventListener("removed",()=>{this.remove(...this.children)}),this.addEventListener("dispose",()=>{var f;(f=this.disposers)==null||f.forEach(g=>g==null?void 0:g())})}play(e=!1){return H(this,null,function*(){this.videoMesh||(yield this.addVideoMesh()),this.showPlayUI(),this.videoInstance.paused&&this.videoInstance.play().then(()=>this.showPlayUI()).catch(i=>{this.pause(),console.error("play error",i)}),this.videoInstance.muted=e,this.render()})}pause(){this.videoInstance&&(this.videoInstance.pause(),this.showPauseUI().then(()=>this.render()))}initialRenderHooks(e){const s=e(()=>{var o;this.videoMesh&&((o=this.videoInstance)==null?void 0:o.paused)===!1&&(this.videoMesh.needsRender=!0)});this.disposers.push(()=>s)}showPlayUI(){this.coverMesh&&(this.coverMesh.visible=!1),this.remove(this.buttonMesh),this.videoMesh.visible=!0}showPauseUI(){return H(this,null,function*(){this.coverMesh?(this.coverMesh.visible=!0,this.videoMesh&&(this.videoMesh.visible=!1)):(yield this.addCoverMesh(),this.coverMesh&&(this.videoMesh.visible=!1)),this.addButtonMesh().then(()=>this.render())})}render(){var e;this.videoMesh&&(this.videoMesh.needsRender=!0),this.coverMesh&&(this.coverMesh.needsRender=!0),this.buttonMesh&&(this.buttonMesh.needsRender=!0),this.videoMesh&&((e=this.videoInstance)==null?void 0:e.paused)===!1&&(this.videoMesh.needsRender=!0)}addCoverMesh(){return H(this,null,function*(){if(this.children.includes(this.coverMesh))return;const e=yield(()=>H(this,null,function*(){if(this.coverMesh)return this.coverMesh;if(!this.videoCoverSrc)return;const{texture:i,transparent:s}=yield this.getImageTexture(this.videoCoverSrc),o=new y.MeshBasicMaterial({transparent:!1,map:i}),r=Bs(this.objectFit,this.cornerPoints,i.image.width/i.image.height),a=new fl(r,o);return a.position.copy(new N.Vector3(0,0,0)),a.name="videoCoverMesh",a}))();return e&&(this.children.includes(this.coverMesh)||(this.add(e),this.coverMesh=e)),e})}addVideoMesh(){return H(this,null,function*(){if(this.children.includes(this.videoMesh))return;const e=yield(()=>H(this,null,function*(){if(this.videoMesh)return this.videoMesh;if(!this.src)return;const s=this.getVideoTexture(this.src),o=new y.MeshBasicMaterial({transparent:!1,map:s}),r=yield new Promise(l=>{s.metadataLoaded?l(Bs(this.objectFit,this.cornerPoints,s.image.videoWidth/s.image.videoHeight)):s.addEventListener("videoLoaded",()=>l(Bs(this.objectFit,this.cornerPoints,s.image.videoWidth/s.image.videoHeight)))}),a=new fl(r,o);return a.name="videoMesh",a.position.copy(new N.Vector3(0,0,0)),a}))();if(!e)return;this.domEvents.addAutoBindEventListener(e,"click",()=>{!this.videoInstance.paused&&this.videoInstance.muted?this.videoInstance.muted=!1:this.pause()},{noEmitWhenHide:!0});const i=e.material.map.image;return i.addEventListener("playing",()=>{this.coverMesh||this.remove(this.buttonMesh),this.render()}),i.addEventListener("pause",()=>{this.videoInstance.paused&&(this.showPauseUI(),this.render())}),this.children.includes(this.videoMesh)||(this.add(e),this.videoMesh=e,this.videoInstance=i),e})}addButtonMesh(){return H(this,null,function*(){if(this.children.includes(this.buttonMesh))return;const e=yield(()=>H(this,null,function*(){var g,v,p,m;if(this.buttonMesh)return this.buttonMesh;const i=(v=(g=this.videoMesh)==null?void 0:g.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3]))!=null?v:1/0,s=(m=(p=this.coverMesh)==null?void 0:p.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3]))!=null?m:1/0,o=this.cornerPoints[0].distanceTo(this.cornerPoints[3]),a=Math.min(i,s,o)/o*.3,{texture:l,transparent:c}=yield this.getImageTexture(this.buttonSrc),h=Bs("contain",this.cornerPoints,l.image.width/l.image.height),u=new fl(h,new _E(l));u.position.copy(new N.Vector3(0,0,0)),u.name="buttonMesh",u.scale.set(a,a,a),this.domEvents.addAutoBindEventListener(u,"click",()=>{this.play()},{noEmitWhenHide:!0});const f=Ss(h,5e-4);return u.position.add(f),u}))();return this.children.includes(this.buttonMesh)||(this.add(e),this.buttonMesh=e),e})}getImageTexture(e){return H(this,null,function*(){var s,o;if((s=this.ImageTextureMap)!=null&&s.has(e))return this.ImageTextureMap.get(e);const i=yield Bd(e);return(o=this.ImageTextureMap)==null||o.set(e,i),i})}getVideoTexture(e){var s,o;if((s=this.videoTextureMap)!=null&&s.has(e))return this.videoTextureMap.get(e);const i=NE(e);return(o=this.videoTextureMap)==null||o.set(e,i),i}}function Lg(n){return Object.entries(n)}function Tg(n){var e,i;typeof n.visibleConfig=="object"&&n.visibleConfig.keep&&(n.visibleConfig.keep==="visible"?n.visibleConfig={keep:n.visibleConfig.keep,visibleFiveMode:(e=n.visibleConfig)==null?void 0:e.visibleFiveMode}:n.visibleConfig.keep==="hidden"&&(n.visibleConfig={keep:n.visibleConfig.keep})),typeof n.unfoldedConfig=="object"&&(n.unfoldedConfig.disableFold&&(n.unfoldedConfig={keep:"unfolded"}),n.unfoldedConfig.disableUnfold&&(n.unfoldedConfig={keep:"folded"}),n.unfoldedConfig.keep&&(n.unfoldedConfig={keep:n.unfoldedConfig.keep}));const t=(i=n.initialState)!=null?i:{};return typeof n.unfoldedConfig=="object"&&(n.unfoldedConfig.keep==="unfolded"?t.unfolded=!0:n.unfoldedConfig.keep==="folded"&&(t.unfolded=!1)),typeof n.visibleConfig=="object"&&(n.visibleConfig.keep==="visible"?t.visible=!0:n.visibleConfig.keep==="hidden"&&(t.visible=!1)),n.initialState=t,n}const jg={visibleConfig:{intersectRaycaster:{enabled:!0,distanceAccuracy:.01,checkPoints:"corner",needPassed:1}},clickable:!0,simulate3D:!1,renderType:"Dom"};var zg=(n=>(n.PointTag="PointTag",n.PlaneTag="PlaneTag",n))(zg||{}),Og=(n=>(n.Audio="Audio",n.Text="Text",n.ImageText="ImageText",n.Image="Image",n.Video="Video",n.Link="Link",n.Sticker="Sticker",n.VRLink="VRLink",n.PanoLink="PanoLink",n.Marketing="Marketing",n.MediaPlane="MediaPlane",n.MediaModel="MediaModel",n.Model="Model",n.Panorama="Panorama",n.Custom="Custom",n.Unknown="Unknown",n))(Og||{}),Vg=(n=>(n.Two="2D",n.Three="3D",n))(Vg||{});function gl(n,t,e){var g,v,p,m,A;const i=(g=e==null?void 0:e.useCache)!=null?g:!0;if(!n)return(v=t.globalConfig)!=null?v:{};if(i){if((p=n==null?void 0:n.computedConfig)!=null&&p._isMerged)return n.computedConfig;if((m=n==null?void 0:n.config)!=null&&m._isMerged)return n.config}const s={},o={},r={};t.contentTypeConfig&&Object.entries(t.contentTypeConfig).forEach(([w,I])=>{var G,Q;const P=w,k=P.split("-"),M=w.startsWith("["),T=M?k[0].slice(1,-1):void 0,R=M?k.slice(1):k,Y=T?["PanoramaLike","ModelLike"].includes(T)?(G=o[T])!=null?G:o[T]={}:(Q=r[T])!=null?Q:r[T]={}:s;if(!Y[P]){if(R.length===0&&(Y[P]=I),R.length===1){const[W]=R;(n.contentType===W||W==="Any")&&(Y[P]=I)}if(R.length===2){const[W="Any",_="Any"]=R;W==="Mixin"&&n.contentType===_&&(Y[P]=I),(n.stickType===W||W==="Any")&&(n.contentType===_||_==="Any")&&(Y[P]=I)}if(R.length===3){const[W="Any",_,U]=R;if(_==="Audio"&&n.contentType==="Audio"){const F=n;(F.stickType===W||W==="Any")&&F.data.appearance===U&&(Y[P]=I)}}}});const a=(A=n.initialConfig)!=null?A:{},l=Qe({},jg,t.globalConfig,...Object.values(s)),c=Qe({},l,a),h={},u=Object.values(Xe.Five.Mode);Lg(o).forEach(([w,I])=>{u.forEach(P=>{(w==="PanoramaLike"&&Ui(P)||w==="ModelLike"&&Gt(P))&&(h[P]=Qe({},l,...Object.values(I),a,{_isMerged:!0}))})}),Lg(r).forEach(([w,I])=>{const P=h[w];h[w]=Qe({},l,P,...Object.values(I),a,{_isMerged:!0})});const f=ne(x({},c),{configWithFiveMode:h});return Tg(f),Object.values(h).forEach(w=>Tg(w)),f._isMerged=!0,f}function Bg(n){const t=n.split("?")[0].split(".").pop();return t?t.toLowerCase():""}function GE(n,t){if(!n)return 0;const e=n.observers;if(!t||!e)return console.error("getFloorIndex: invalid arguments: ",{point:t,observer:e}),0;const i=[];e.forEach(o=>{var a,l,c;const r=(l=(a=o.floorIndex)!=null?a:o.floor_index)!=null?l:0;i[r]||(i[r]=[]),i[r].push(vs(o.position,(c=n.options)==null?void 0:c.transform).y)});const s=i.map(o=>o.reduce((r,a)=>r+a,0)/o.length);for(let o=s.length-1;o>0;o--)if(t.y>=s[o])return o;return 0}class Rs{constructor(){d(this,"cache_raycasterDistance",new Map);d(this,"cache_visible",new Map)}clear(){this.cache_visible.clear(),this.cache_raycasterDistance.clear()}static generateCameraTagKey(t,e,i=3){const s=x(x({},e.five.getCurrentState()),t),o=s.mode==="Panorama"?e.workUtil.getObserverPosition(s.panoIndex):e.five.camera.position;return o?[o.x.toFixed(i),o.y.toFixed(i),o.z.toFixed(i),e.id].join(","):void 0}getVisible(t,e,i=1){const s=Rs.generateCameraTagKey(e,t,i);if(s)return this.cache_visible.get(s)}setVisible(t,e,i,s=1){const o=Rs.generateCameraTagKey(e,t,s);o&&this.cache_visible.set(o,i)}}function Rg(n){return new Promise(t=>{setTimeout(()=>{t()},n)})}const hr=new y.Raycaster;hr.params.Points.threshold=.1;class ml{constructor(t,e){d(this,"plugin");d(this,"id");d(this,"contentType");d(this,"stickType");d(this,"enabled");d(this,"config");d(this,"data");d(this,"state");d(this,"temporaryState",{visible:!0});d(this,"originPosition");d(this,"position");d(this,"fiveState");d(this,"model");d(this,"matrix");d(this,"screenPosition");d(this,"normal");d(this,"mediaPlane");d(this,"hooks");d(this,"zIndex");d(this,"play");d(this,"pause");d(this,"tag3DContentSvelte");d(this,"dom");d(this,"contentDom");d(this,"initialConfig");d(this,"computedConfig");d(this,"cache");d(this,"entryFromModel");var l,c,h,u;this.plugin=t;const i=qa(e);e.stickType=i;const s=JSON.parse(JSON.stringify(e.data)),o=(l=e.initialConfig)!=null?l:e.config?JSON.parse(JSON.stringify(e.config)):{};e.initialConfig=o;const r=gl(e,t.config),a=this.getConfig(e);e.config=a,this.id=(c=e.id)!=null?c:lt(),this.enabled=(h=e.enabled)!=null?h:!0,this.contentType=e.contentType,this.data=(u=a.initialData)!=null&&u.important?Qe(e.data,s,a.initialData):Qe(e.data,a.initialData,s),this.state=x({visible:void 0,unfolded:!this.can("fold")},a.initialState),this.originPosition=e.position,e.originPosition=this.originPosition,this.position=(()=>{const f=e.originPosition;if(!f)return;const g=t.workUtil.transform;return Array.isArray(f)&&f.length===4?f.map(Ge).map(v=>vs(v,g).toArray()):vs(Ge(f),g).toArray()})(),this.matrix=e.matrix?(()=>{const f=new y.Matrix4().fromArray(e.matrix);return f.premultiply(t.workUtil.transform),f.elements})():e.matrix,this.initialConfig=o,this.computedConfig=r,this.stickType=i,this.config=e.config,this.fiveState=e.fiveState,this.normal=e.normal,this.cache=new Rs,this.hooks=new ut,Object.keys(e).forEach(f=>{this[f]===void 0&&e[f]!==void 0&&(this[f]=e[f])})}get five(){return this.plugin.five}get fiveUtil(){return this.plugin.fiveUtil}get workUtil(){return this.plugin.workUtil}get centerPosition(){const t=Ja(this);return ei(...Array.isArray(t)?t:[t])}get currentConfig(){var s,o;const t=gl(this,this.plugin.config,{useCache:!0}),e=this.five.getCurrentState().mode,i=(s=t.configWithFiveMode)==null?void 0:s[e];return(o=i!=null?i:t)!=null?o:{}}get currentVisible(){return!(!this.plugin.state.enabled||!this.plugin.state.visible||!this.enabled||!this.state.visible)}get sharedCache(){return this.plugin.cache}applyVisible(){throw new Error("Method not implemented.")}find(t){return H(this,null,function*(){var s;const e=this.fiveState;if(!this.fiveState)return;const i=(s=t==null?void 0:t.targetMode)!=null?s:this.five.state.mode;if(i==="Panorama"){const o=e==null?void 0:e.panoIndex;if(mi(o))return;const r=this.workUtil.getObserverPosition(o),a=this.centerPosition.clone().sub(r).normalize();this.five.setState(x({mode:"Panorama",workCode:this.workUtil.workCode,panoIndex:o},Ps(a))),yield this.five.ready()}else i==="Mapview"&&(yield oh(this.five,this.centerPosition,t==null?void 0:t.pointConfig))})}blink(t){return H(this,null,function*(){var a,l;const e=(a=this.enabled)!=null?a:!0,i=(l=this.state)==null?void 0:l.visible,s=e&&i;s===!1&&(this.state.visible=!0,this.enabled=!0,this.applyVisible(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.plugin.render(),yield Rg(0),this.dom&&(this.dom.style.visibility="hidden"),this.contentDom&&(this.contentDom.style.visibility="hidden"));const o=(()=>{var h;const c=[];return c.push(this.dom),this.stickType!=="2DPoint"&&c.push(this.contentDom),c.push((h=this.model)==null?void 0:h.object),c.push(this.mediaPlane),c.filter(Boolean)})();if(!o.length)return;yield(s?wo:sh)(o,x({begin:()=>{s===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))},updateRender:()=>{this.five.needsRender=!0}},t)).finished,e===!1&&(this.enabled=!1),i===!1&&this.updateVisible(),s===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))})}unfold(){}unfoldAndFoldOthers(){}fold(){}enable(){this.enabled=!0,this.hooks.emit("enable"),this.applyVisible()}disable(){this.enabled=!1,this.hooks.emit("disable"),this.applyVisible()}changeData(t,e=!0){return this.setData(t,e)}changePosition(t){return this.setPosition(t)}setData(t,e=!0){e?this.data=Qe(this.data,t):this.data=x(x({},this.data),t),this.hooks.emit("dataChanged",this.data)}setPosition(t){throw new Error("Method not implemented.")}set(t,e=!0){this.plugin.tagsLengthWillUpdate=!0,e?Qe(this,t):Object.assign(this,t),this.cache.clear()}updateConfig(){var i;const t=this.getConfig(void 0,{useCache:!1});this.computedConfig=t;const e=this.getConfig();if(this.config=e,this.config.initialData){const s=JSON.parse(JSON.stringify(this.data));this.data=(i=e.initialData)!=null&&i.important?Qe(this.data,s,e.initialData):Qe(this.data,e.initialData,s)}this.cache.clear()}updateVisible(){this.state.visible=this.getVisible(),this.applyVisible()}updateZIndex(){const t=this.getDistance();this.zIndex=Math.round((1e4-(t!=null?t:0))*100)}getConfig(t,e){var r,a,l;const i=gl(t!=null?t:this,this.plugin.config,{useCache:e==null?void 0:e.useCache}),s=(r=e==null?void 0:e.fiveMode)!=null?r:this.five.getCurrentState().mode,o=(a=i.configWithFiveMode)==null?void 0:a[s];return(l=o!=null?o:i)!=null?l:{}}getDistance(t,e=3){const i=x(x({},this.five.getCurrentState()),t),{panoIndex:s,mode:o}=i,r=o==="Panorama"?this.workUtil.getObserverPosition(s):this.five.camera.position,a=this.centerPosition;return!r||!a?-1:r.distanceTo(a)}getVisible(t){if(!this.enabled||!this.plugin.state.enabled||!this.fiveUtil.model)return!1;const e=x(x({},this.five.getCurrentState()),t);let i=this.cache.getVisible(this,e);return mi(i)&&(i=this.computeVisible(e).value,this.cache.setVisible(this,e,i)),i}getUnfoldedByPanoIndex(t){if(!this.currentVisible)return;const i=this.computeUnfoldedByPanoIndex(t);return i&&this.getUnfoldedByCamera()}getUnfoldedByCamera(){return this.currentVisible?this.computeUnfoldedByCamera():void 0}can(t){const e=this.currentConfig;if(!e||typeof e!="object")return!0;if(t==="show"||t==="hide"){if(!e.visibleConfig||typeof e.visibleConfig!="object")return!0;if(t==="show"&&e.visibleConfig.keep==="hidden"||t==="hide"&&(e.visibleConfig.keep==="visible"||e.visibleConfig.alwaysShowWhenMovePano))return!1}if(t==="fold"||t==="unfold"){if(!e.unfoldedConfig||typeof e.unfoldedConfig!="object")return!0;if(t==="fold"&&e.unfoldedConfig.keep==="unfolded"||t==="unfold"&&e.unfoldedConfig.keep==="folded")return!1}return!0}onClick(t){}computeRenderType(){const t=(()=>{if(this.stickType==="3DPoint")return"Dom";const e=this.getConfig();if(!e||typeof e!="object"||!e.renderType)return;const i=this.data.mediaData;if(!(!i||i.length===0)&&e.renderType==="Mesh"){if(nP(this)){if(i.length===1){if(i[0].type==="Video")return navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1?"Dom":"Mesh";if(i[0].type==="Image")return Bg(i[0].url)==="gif"?"Dom":"Mesh"}}else if(oi(this))return i.length===1&&i[0].type==="Image"?Bg(i[0].url)==="gif"?"Dom":"Mesh":"BehindDom"}})();return t!=null?t:"Dom"}computeVisible(t){const e=x(x({},this.five.getCurrentState()),t),{panoIndex:i,mode:s}=e,o=[];return(()=>{var c,u,f;const l=(c=this.getConfig().visibleConfig)!=null?c:{};if(typeof l=="function")return{value:l(this.five,{tag:this,distance:this.getDistance(e,void 0)}),checkedList:o,reason:"config function result"};{if(l.keep==="hidden")return{value:!1,checkedList:o,reason:"config.keep is hidden"};if(l.keep==="visible")return{value:!0,checkedList:o,reason:"config.keep is visible"};const g=this.computeVisibleByFiveMode(l,s);if((g==null?void 0:g.value)===!1)return g;if(l.followModelVisibility===!0&&["poincare","aerophoto","sand"].includes(this.workUtil.fromType)&&(s==="Floorplan"||s==="Mapview")){const h=this.computeVisibleByFloorIndex(),{value:v}=h,p=fs(h,["value"]);if(v===!1)return x({value:!1,checkedList:o,reason:"followModelVisibility check failed"},p)}if(Ui(s)&&l.visiblePanoIndex!==void 0&&l.visiblePanoIndex!=="all"&&i!==void 0){if(o.push("visiblePanoIndex"),Array.isArray(l.visiblePanoIndex)&&!l.visiblePanoIndex.includes(i))return{value:!1,checkedList:o,reason:`current panoIndex is not included in visiblePano. currentPanoIndex: ${i}, visiblePanoIndex: ${l.visiblePanoIndex}`};if(l.visiblePanoIndex==="current"&&i!==((u=this.fiveState)==null?void 0:u.panoIndex))return{value:!1,checkedList:o,reason:`current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${i}, tag.panoIndex: ${(f=this.fiveState)==null?void 0:f.panoIndex}`}}if(l.visibleDistance!==void 0&&(o.push("visibleDistance"),l.visibleDistance!=="unLimited")){const v=this.getDistance(e,1);if(er(v,l.visibleDistance)===!1)return{value:!1,checkedList:o,panoIndex:i,visibleDistance:l.visibleDistance,reason:`distance is not in visibleDistance. distance: ${v}, visibleDistance: ${l.visibleDistance.min} - ${l.visibleDistance.max}`}}if(l.intersectRaycaster!==!1&&(typeof l.intersectRaycaster!="object"||l.intersectRaycaster.enabled!==!1)){if(o.push("intersectRaycaster"),i===void 0)return{value:!1,checkedList:o,reason:`intersectRaycaster check failed: panoIndex is ${i}`};const v=this.computeVisibleByIntersect(i);if(v.value===!1)return Object.assign(v,{checkedList:o})}return{value:!0,checkedList:o,reason:"all check passed"}}})()}computeVisibleByFiveMode(t,e){const i=()=>{var r,a;let o=typeof t.visibleFiveMode=="function"?t.visibleFiveMode(this):t.visibleFiveMode;if(o||(o=(a=(r=this.fiveState)==null?void 0:r.mode)!=null?a:this.workUtil.observers.length?"Panorama":"ModelLike"),Array.isArray(o))return o.includes(e);if(o==="ModelLike")return Gt(e);if(o==="PanoramaLike")return!Ui(e);if(o==="all")return!0;if(typeof o=="string")return o===e};if((()=>{var r;const o=i();if(ke((r=this.fiveState)==null?void 0:r.panoIndex)&&t.entryFromModel){if(Gt(e)&&o?this.entryFromModel=!1:this.entryFromModel=!0,Gt(e))return!0}else this.entryFromModel=!1;return o})()===!1)return{value:!1,reason:"current mode is not included in visibleFiveMode",visibleFiveMode:t.visibleFiveMode,mode:e}}computeVisibleByIntersect(t){var l,c,h,u;const e=nn(nn((l=this.getConfig().visibleConfig)!=null?l:{}).intersectRaycaster),i=t!=null?t:this.five.getCurrentState().panoIndex,s=Ui(this.five.getCurrentState().mode)?this.workUtil.getObserverPosition(i):this.five.camera.position;if(s===void 0)return{value:!1,reason:{type:"startPosition is undefined",fivePanoIndex:i}};const o=pi((()=>{var g;const f=(g=e.checkPoints)!=null?g:"center";return f==="center"?Yu(this):f==="corner"?Ja(this):Array.isArray(f)?f:[]})());let r=0,a=0;for(const f of o){const g=new y.Vector3().subVectors(f,s).normalize();let v;hr.set(s,g);const[p]=this.fiveUtil.model.intersectRaycaster(hr);v=p==null?void 0:p.distance;const m=(()=>{if(!oi(this))return;const k=this.plugin.tags.filter(oi).map(T=>{var R;return(R=T.model)==null?void 0:R.object}).filter(ke),[M]=hr.intersectObjects(k,!0);return M})(),A=s.distanceTo(f),w=(c=e.distanceAccuracy)!=null?c:.01;v=Math.min(v!=null?v:1/0,(h=m==null?void 0:m.distance)!=null?h:1/0),v+w>=A?r++:a++;const P=(u=e.needPassed)!=null?u:1;if(r>=P)return{value:!0}}return a===0?{value:!0}:{value:!1,reason:{type:"intersectRaycaster check failed",passedCount:r,needPassed:e.needPassed,model:this.fiveUtil.model.name}}}computeVisibleByFloorIndex(){var s,o,r,a,l,c,h;let t=0;const e=(s=this.fiveState)==null?void 0:s.panoIndex;e!==void 0?t=(o=this.workUtil.getObserver(e))==null?void 0:o.floorIndex:t=GE(this.workUtil.work,(h=(c=(a=(r=this.model)==null?void 0:r.object)==null?void 0:a.position)!=null?c:(l=this.mediaPlane)==null?void 0:l.position)!=null?h:Yu(this));const i=this.fiveUtil.model.shownFloor;return{value:i===null||i===t,currentFiveFloorIndex:i,tagFloorIndex:t}}computeUnfoldedByPanoIndex(t){const e=this.getConfig().unfoldedConfig;if(e){if(typeof e=="function")return e(this.five,{tag:this,distance:this.getDistance({panoIndex:t})});if(e.keep==="folded")return!1;if(e.keep==="unfolded")return!0;if(e.unfoldDistance&&er(this.getDistance({panoIndex:t}),e.unfoldDistance)===!1)return!1}}computeUnfoldedByCamera(){var e;if(this.entryFromModel&&Gt(this.five.state.mode))return!1;const t=this.getConfig().unfoldedConfig;if(t){if(typeof t=="function")return t(this.five,{tag:this,distance:this.getDistance()});if(t.keep==="folded")return!1;if(t.keep==="unfolded")return!0;if(t.autoUnfold===void 0||t.autoUnfold===!1||t.autoUnfold.enable===!1||!t.autoUnfold.strategy)return;if(t.autoUnfold.strategy==="ScreenPostion"){const i=this.computeTagProject();if(i&&er(i.x,t.autoUnfold.autoUnfoldProjectX)===!1)return!1}if(t.autoUnfold.strategy==="MinimumDistance"){const o=this.plugin.filterPointTag.filter(a=>a.currentVisible).filter(a=>{const l=this.computeTagProject();if(!l)return!1;const{x:c,y:h,z:u}=l;return!(Math.abs(u)>1||Math.abs(c)>1||Math.abs(h)>1)}).map(a=>({tag:a,id:a.id,tagConfig:a.getConfig().unfoldedConfig})).filter(({tagConfig:a})=>{var l,c;return!(typeof a=="function"||a.keep||a.autoUnfold===!1||((l=a.autoUnfold)==null?void 0:l.enable)===!1||((c=a.autoUnfold)==null?void 0:c.strategy)!=="MinimumDistance")}).map(a=>ne(x({},a),{distance:a.tag.getDistance()})).filter(({distance:a,tagConfig:l})=>{const c=l.autoUnfold.distance;return!(c&&er(a,c)===!1)}).sort((a,l)=>a.distance-l.distance).findIndex(a=>a.id===this.id);if(o===-1||o<=((e=t.autoUnfold.maxNumber)!=null?e:1)-1===!1)return!1}return t.autoUnfold.strategy!=="FoldWhenMove"}}computeTagProject(){const t=this.centerPosition;if(!t)return;const{x:e,y:i,z:s}=t.project(this.five.camera);if(!(s>1))return{x:e,y:i,z:s}}addObjectClickHandler(t,e,i){if(!e||!this.plugin.domEvents)return()=>{};const s=()=>!(!t.currentVisible||t.loading),o=r=>{if(!s())return!1;i(r.origDomEvent)};return this.plugin.domEvents.addEventListener(e,"click",o),()=>{var r;(r=this.plugin.domEvents)==null||r.removeEventListener(e,"click",o)}}whyHide(){var e;if(!this.plugin.state.enabled)return{reason:`plugin.state.enabled is ${this.plugin.state.enabled}`};if(!this.plugin.state.visible)return{reason:`plugin.state.visible is ${this.plugin.state.visible}`};if(!this.enabled)return{reason:`tag ${this.id} enabled is: ${this.enabled}`};const t=ne(x({},this.computeVisible()),{tagInstance:this});return t.value!==this.state.visible?{reason:"插件故障,请联系维护人员, err: 0",info:t}:this.state.visible?{reason:"应该是能看见才对",info:t}:t.value===!0?{reason:"插件故障,请联系维护人员, err: 1",info:t}:{reason:(e=t.reason.type)!=null?e:t.reason,info:t}}destroy(){this.disable(),this.hooks.off(),this.cache.clear();const t=this.plugin.tags.findIndex(e=>e.id===this.id);t!==-1&&(this.plugin.tags.splice(t,1),this.plugin.tagsLengthWillUpdate=!0,this.plugin.hooks.emit("tagsLengthChange"))}}class Fg extends ml{constructor(e,i){super(e,i);d(this,"loading",!1);d(this,"loadModel",()=>H(this,null,function*(){var r;const e=this.data.modelUrl;if(!e)return;this.loading=!0;const i=VE(e).then(a=>H(this,null,function*(){var h;const l=Object.assign(a.scene,{customID:this.id,isTagModel:!0,removeEventListener:this.getConfig().clickable===!1?()=>{}:this.addObjectClickHandler(this,a.scene,u=>{this.plugin.hooks.emit("click",{target:"TagModel",tag:this,event:u})})});return l.visible=this.currentVisible,new y.Matrix4().fromArray(this.matrix).decompose(l.position,l.quaternion,l.scale),l.updateWorldMatrix(!0,!0),l.visible=yield this.getVisible(),(h=this.getConfig().modelConfig)!=null&&h.autoLookAtEnabled&&l.lookAt(this.five.camera.position.clone().setY(l.position.y)),l}));this.model={promise:i};const s=yield i;if(this.loading=!1,((r=this.model)==null?void 0:r.promise)!==i||!this.plugin.tags.includes(this))return;this.model.object=s;const o=this.plugin.gltfObjectGroup.children.find(a=>a.customID===this.id);if(o&&(this.plugin.gltfObjectGroup.remove(o),o.removeEventListener()),this.plugin.updateRender3DDomTag(),oi(this)){if(this.computeRenderType()==="Mesh"&&!this.mediaPlane){const a=this.data.mediaPosition.map(xi);this.mediaPlane=new Dg(this.data.mediaData[0].url,this.data.mediaPosition.map(xi),{objectFit:this.data.objectFit});const l=new y.Vector3().addVectors(a[0],a[2]).divideScalar(2);this.mediaPlane.position.copy(l),s.add(this.mediaPlane)}this.computeRenderType()!=="Mesh"&&(s.updateTagCss3DObjectMatrix=()=>this.plugin.updateTagCss3DObjectMatrix(this,s),s.updateTagCss3DObjectMatrix())}return this.plugin.gltfObjectGroup.add(s),s}));this.state.unfolded=!0}applyVisible(){var e,i,s;(e=this.model)!=null&&e.object&&(this.model.object.visible=this.currentVisible),(i=this.tag3DContentSvelte)==null||i.svelteApp.$set({tag:this,state:this.plugin.state}),(s=this.tag3DContentSvelte)==null||s.css3DInstance.setVisible(this.currentVisible)}computeNormal(){return Uu(this.data.mediaPosition)}}function QE(n){me(n,"svelte-elzzn6",'@font-face{font-family:"TG-TYPE";font-style:normal;font-weight:400;src:local("TG-TYPE-Bold"), url(data:application/font-woff2;charset=utf-8;base64,T1RUTwAKAIAAAwAgQ0ZGINFD4CEAAAaQAAAHC0dTVUIAAQAAAAANnAAAAApPUy8yaB5pEwAAAjQAAABgY21hcEItjGUAAAT0AAABfGhlYWQS1WWOAAAAtAAAADZoaGVhBfMBxwAAAhAAAAAkaG10eJ9gBO8AAADsAAABJG1heHAASVAAAAAArAAAAAZuYW1lqczkZQAAApQAAAJecG9zdP+4ADIAAAZwAAAAIAAAUAAASQAAAAEAAAABAADkeHeyXw889QADA+gAAAAA2NoRKwAAAADY2hErACn/OAHgAyAAAQADAAIAAAAAAAAB9ABdAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACCAA7AcwAdwIIADMCCAA0AhwAMwISADkCCAAuAfQANAH+ACsB/gApAggANAEeAFABHgBQAR4AUAIIADQCCAAuAR4AUAEeAFABfAAxAAEAAAPo/zgAAAIcACkAKQHgAAEAAAAAAAAAAAAAAAAAAABJAAMCLgGQAAUACAKKAlgAAABLAooCWAAAAV4AMgEsAAAAAAgAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFVLV04AIAAg/xsDIP84AMgD6ADIAAAAAQAAAAAB9AK8AAAAIAAAAAAAEADGAAEAAAAAAAEADAAAAAEAAAAAAAIABAAMAAEAAAAAAAMAGwAQAAEAAAAAAAQAEQArAAEAAAAAAAUAPAA8AAEAAAAAAAYAEAB4AAEAAAAAAAgADAAAAAEAAAAAAAkADAAAAAMAAQQJAAEAGACIAAMAAQQJAAIACACgAAMAAQQJAAMANgCoAAMAAQQJAAQAIgDeAAMAAQQJAAUAeAEAAAMAAQQJAAYAIAF4AAMAAQQJAAgAGACIAAMAAQQJAAkAGACIQUxJQkFCQSBGb250Qm9sZDEuMDAwO1VLV047QUxJQkFCQUZvbnQtQm9sZEFMSUJBQkEgRm9udCBCb2xkVmVyc2lvbiAxLjAwMDtQUyAwMDEuMDAwO2hvdGNvbnYgMS4wLjg4O21ha2VvdGYubGliMi41LjY0Nzc1QUxJQkFCQUZvbnQtQm9sZABBAEwASQBCAEEAQgBBACAARgBvAG4AdABCAG8AbABkADEALgAwADAAMAA7AFUASwBXAE4AOwBBAEwASQBCAEEAQgBBAEYAbwBuAHQALQBCAG8AbABkAEEATABJAEIAQQBCAEEAIABGAG8AbgB0ACAAQgBvAGwAZABWAGUAcgBzAGkAbwBuACAAMQAuADAAMAAwADsAUABTACAAMAAwADEALgAwADAAMAA7AGgAbwB0AGMAbwBuAHYAIAAxAC4AMAAuADgAOAA7AG0AYQBrAGUAbwB0AGYALgBsAGkAYgAyAC4ANQAuADYANAA3ADcANQBBAEwASQBCAEEAQgBBAEYAbwBuAHQALQBCAG8AbABkAAAAAAADAAAAAwAAASIAAQAAAAAAHAADAAEAAAEiAAABBgAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABCSEMANjc4OTo7PD0+PwAAAAAAAAACAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGwAAAAAAABwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAFoAAAAQABAAAwAAACAALgA5AFoAegCl/xv//wAAACAALAAwAEEAYQCl/xr////hAAAABv/B/7v/nwAAAAEAAAAOAAAAAAAAAAAACgAAAEIASABDAEYARwADAAAAAAAA/7UAMgAAAAAAAAAAAAAAAAAAAAAAAAAAAQAEAgABAQERQUxJQkFCQUZvbnQtQm9sZAABAQEg+A8A+CAB+CEC+BgEtPtc+HT5tAX3KA/3UBGcHAZWEgAHAQENExoiKTpLbmluZS4wMDEuMDAxbW9uZXkudW5pRkYxQm5pbmUuMDAxdW5pRkYxQWNvcHlyaWdodCBtaXNzaW5nQUxJQkFCQSBGb250IEJvbGQAAAEAAQAAIhkAQhkAEQkBhwABigAADQAADwAAZAABiAABiwABiQAADgAASQIAAQCtAK4ArwCwALEAsgCzALQAtQC2ALcAuAC5ALoAuwC8AL0AvgC/AMAAwQDCAMMAxADFAMYAxwDIAMkAygDLAMwAzQDOAM8A0ADRANIA0wDUANUA1gDXANgA2QDaANsA3ADdAN4A3wDgAOEA4gFDAVoBqwIsAloCuAMcAzkDzwQ4BDoEPARRBFMEVQTNBOIE8QUEmPtc0Ky6rKKsuqzHrKPDoa2irLCspq2vraWssKzOAejVrKytrKzYA/gu+bQV+9H+fPfRBj76ORVqSWbNavs6rM2wSqwH7vsVFUXNafs68wfNaRVqZ6wG704VaklFJ6zNsEmsB/c6TxUn+zqt9xnNB6z7DhX7Bfs69wWsO++6anRpwwfv+0EV+wX7OvcFB/cZahUnXO8GrFMVamsHRVwF8Wr7OqwG0boFRawGDg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4OrIr5UQH3OPdUA/ebihVmaZSdbB9Mr2TL0xr3vgewlK2eqh7Kr86y1BuvrIJ5qh/HZrJIQhr7vgdngmp5bR5OZ0tkQxv46ARUX2FSH/u+B1a5YMDAs7TCHve+B8RjtVYeDnD4utkB93HzA/cL+QgVPfH8vPP5UgcOrIn5UgG++DYD+GmJFfw28wb3svfUBZ2glKSnGsNduFBWXF1UiB4ijgaMsJWsnqoIyLHMstYbsa6Ceawfy2ezSUAaVndXZ2Me+2/7jQX3pwYOrIvy92Tz90ryEr/zM/L3SvMu8hPy+B/3/xUT7LCwpMDDGq6CrHqoHsZnTK5DG2lrg3puH09pZk5EGobykAe4tba6vrViXFZiYlcedyOfBhPyxLpdUlJcW1JSXLvEH5ojfAdllGiebB5LsM5j1xuwrpSeqx/KsLPO1xrKcMNerx4OwPL1Affi8gP4dPdlFWD4fPshBvuJ/HkF+wH3ryPy87YH+8z1Ffc69+QF++QHDrb3ZNf3ZfAB9zX3YwP3nRZlaJSebB9LsGPO1xrzBlK6XMTEubrEHtcHxF26UlJcXFIeI/g0+BYh+677JAaorK2ZsBuwroJ4qx/LZrNHPxo/B2aCaHhrHktmR2NAGw6si/X3b/IBufX3b/ID95n4QBWAg4uKhh/3EfelBfsHBvtK/CMFfnCFbm0aZJVnnmoeSrLPYdobsq6Vnqwfy7K10dgasoGueKwey2RHtT4b+9YETlu7yMe8vcfHvVlPT1laTx8OmIr5UQG/+B8D93iKFfsIBvdo+OYF+6T2+B8oBg6iifL3bPX3QPEStvNB8vc/8jXxE/L4EvgHFRPss7Cnu78arYOreqgexWpNr0YbaWyDem4fUmlmTUcaXqBftGAeE/JWYmROSxpklWieax5Ksc9i2BuxrpWerB/LsbTP2BrHaMVath4T7PsN93QVu7FjXFtlZltcZbC7urGzuh8T8oX8ghVPW7zHx7q6yMa9W1BPWVpQHw6i96Tz92/0AbTz93DzA/hp+HkVsIGveKwezmNFtUAbZGeBeGofSmNiRT8aZJVnnmseSrHPYtoboAb7EvukBfcHBvdL+CEFmaySqaQa+9gWxry+yJ6dhoGcHq12oWZmGk5YW1BMXLnKHg4gCiEK+11L91IlCvdiyhWtb6hpJgoeJAoOIQogCqz3pe/3b/UBufX3bfQD+G74dxWyga94rB7NZEW0PhtlaIF4ah9KY2FFPxo7tkTPZh6MjIqKjB+TiJCIjYoIjgaCoKGHoRuanY6QoB+IgfsB+6QF9wcG9y/4IgWYppGnqhr7a/sCFVBbvMjHu7zGyLxbTk5aWk4fDvtd+AojCoz7jBUmCh8kCq1vqGkeDvtdi/cS94wjCvwKBCIKDiD3ru8BvPeuA7z4EhUn967vBw4eoDf/DAmLDAv47BT4exWcEwAHAQFBXW97ipCarPcv8+7yAfdl8gP4aPf6FfIjB+r3gwUiBi77gwWHBjH3gwUkBuP7gwUnJPcxKPsxI/cx+y/y9y/3MPP7MO4GDvtdi/cSJQr3JBZkcqOzsKSksrCkcWdlcnFmHw6up6eurm+naGhvb2hop2+uHwv3EiUK9yP4ChUiCgt3SgWxBrnmBZGVj5eZGgsB2/cSAwtobm5paqBzqoYLAAABAAAAAAAAAAAAAA==) format("woff2")}*{-webkit-tap-highlight-color:transparent}.content__container.svelte-elzzn6{position:relative;left:50%;top:50%;transform:translate(-50%, -50%);font-family:PingFangSC, Segoe UI, Rototo, sans-serif;transition:opacity 0.2s linear}.content__container.unClickable.svelte-elzzn6{pointer-events:none !important}.content__container.unClickable.svelte-elzzn6 *{pointer-events:none !important}.content__wrapper.svelte-elzzn6{pointer-events:none;width:100%;height:100%}.content__container.hide.svelte-elzzn6{opacity:0;pointer-events:none}.content__container.hide.svelte-elzzn6 *{pointer-events:none !important}.content__container.disable.svelte-elzzn6{display:none}.content.svelte-elzzn6{position:relative;width:100%;height:100%;font-size:0.75rem;color:#fff}.content.svelte-elzzn6:not(.unfolded){pointer-events:none}.content.svelte-elzzn6:not(.unfolded) *{pointer-events:none !important}.content.unfolded.svelte-elzzn6{pointer-events:auto}')}function WE(n){let t,e;return{c(){t=S("div"),C(t,"data-info","tag content is keep folded"),C(t,"data-id",e=n[0].id)},m(i,s){O(i,t,s)},p(i,s){s&1&&e!==(e=i[0].id)&&C(t,"data-id",e)},i:K,o:K,d(i){i&&z(t)}}}function HE(n){let t,e,i,s,o,r,a,l,c,h,u,f,g,v,p,m,A;const w=[$E,KE,qE,JE,ZE,XE,YE],I=[];function P(k,M){return M&9&&(s=null),M&9&&(o=null),M&9&&(r=null),M&9&&(a=null),M&9&&(l=null),M&9&&(c=null),M&9&&(h=null),s==null&&(s=!!(["Text"].includes(k[0].contentType)||["Text"].includes(k[3].get(k[0].contentType)))),s?0:(o==null&&(o=!!(["ImageText","Image","Video"].includes(k[0].contentType)||["ImageText","Image","Video"].includes(k[3].get(k[0].contentType)))),o?1:(r==null&&(r=!!(["Audio"].includes(k[0].contentType)||["Audio"].includes(k[3].get(k[0].contentType)))),r?2:(a==null&&(a=!!(["Marketing"].includes(k[0].contentType)||["Marketing"].includes(k[3].get(k[0].contentType)))),a?3:(l==null&&(l=!!(["Link","VRLink","PanoLink","Sticker"].includes(k[0].contentType)||["Link","VRLink","PanoLink","Sticker"].includes(k[3].get(k[0].contentType)))),l?4:(c==null&&(c=!!(["MediaPlane","MediaModel"].includes(k[0].contentType)||["MediaPlane","MediaModel"].includes(k[3].get(k[0].contentType)))),c?5:(h==null&&(h=!!(["Panorama"].includes(k[0].contentType)||["Panorama"].includes(k[3].get(k[0].contentType)))),h?6:-1))))))}return~(u=P(n,-1))&&(f=I[u]=w[u](n)),{c(){var k;t=S("div"),e=S("div"),i=S("div"),f&&f.c(),C(i,"class","content svelte-elzzn6"),ie(i,"unfolded",(k=n[0].state)==null?void 0:k.unfolded),C(e,"class","content__wrapper svelte-elzzn6"),C(t,"class",g=tt(Tt("content__container",n[0].className))+" svelte-elzzn6"),C(t,"data-id",v=n[0].id),ie(t,"disable",n[0].enabled===!1),ie(t,"hide",n[5]),ie(t,"unClickable",n[0].config.clickable===!1),L(t,"width",n[0].stickType==="Plane"||n[0].contentType==="MediaModel"?"100%":0),L(t,"height",n[0].stickType==="Plane"||n[0].contentType==="MediaModel"?"100%":0)},m(k,M){O(k,t,M),j(t,e),j(e,i),~u&&I[u].m(i,null),n[16](t),p=!0,m||(A=Ce(t,"click",n[17],!0),m=!0)},p(k,M){var R;let T=u;u=P(k,M),u===T?~u&&I[u].p(k,M):(f&&(fe(),V(I[T],1,1,()=>{I[T]=null}),ge()),~u?(f=I[u],f?f.p(k,M):(f=I[u]=w[u](k),f.c()),D(f,1),f.m(i,null)):f=null),(!p||M&1)&&ie(i,"unfolded",(R=k[0].state)==null?void 0:R.unfolded),(!p||M&1&&g!==(g=tt(Tt("content__container",k[0].className))+" svelte-elzzn6"))&&C(t,"class",g),(!p||M&1&&v!==(v=k[0].id))&&C(t,"data-id",v),(!p||M&1)&&ie(t,"disable",k[0].enabled===!1),(!p||M&33)&&ie(t,"hide",k[5]),(!p||M&1)&&ie(t,"unClickable",k[0].config.clickable===!1),M&1&&L(t,"width",k[0].stickType==="Plane"||k[0].contentType==="MediaModel"?"100%":0),M&1&&L(t,"height",k[0].stickType==="Plane"||k[0].contentType==="MediaModel"?"100%":0)},i(k){p||(D(f),p=!0)},o(k){V(f),p=!1},d(k){k&&z(t),~u&&I[u].d(),n[16](null),m=!1,A()}}}function UE(n){let t,e,i,s,o,r,a;return e=new zE({props:{tag:Ke(n[0]),rendererMap:n[2]}}),{c(){t=S("div"),re(e.$$.fragment),C(t,"class",i=tt(Tt("content__container",n[0].className))+" svelte-elzzn6"),C(t,"data-id",s=n[0].id),ie(t,"custom-tag-disable",n[0].enabled===!1),ie(t,"custom-tag-hide",n[5])},m(l,c){O(l,t,c),se(e,t,null),n[14](t),o=!0,r||(a=Ce(t,"click",n[15]),r=!0)},p(l,c){const h={};c&1&&(h.tag=Ke(l[0])),c&4&&(h.rendererMap=l[2]),e.$set(h),(!o||c&1&&i!==(i=tt(Tt("content__container",l[0].className))+" svelte-elzzn6"))&&C(t,"class",i),(!o||c&1&&s!==(s=l[0].id))&&C(t,"data-id",s),(!o||c&1)&&ie(t,"custom-tag-disable",l[0].enabled===!1),(!o||c&33)&&ie(t,"custom-tag-hide",l[5])},i(l){o||(D(e.$$.fragment,l),o=!0)},o(l){V(e.$$.fragment,l),o=!1},d(l){l&&z(t),oe(e),n[14](null),r=!1,a()}}}function YE(n){let t,e;return t=new DE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function XE(n){let t,e;return t=new lE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function ZE(n){let t,e;return t=new ME({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function JE(n){let t,e;return t=new OM({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function qE(n){let t,e;return t=new sE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function KE(n){let t,e;return t=new LM({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function $E(n){let t,e;return t=new JP({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function e3(n){let t,e,i,s,o;const r=[UE,HE,WE],a=[];function l(c,h){return h&5&&(t=null),t==null&&(t=!!(c[0].element||c[2].has(c[0].contentType))),t?0:c[4]?1:2}return e=l(n,-1),i=a[e]=r[e](n),{c(){i.c(),s=Ee()},m(c,h){a[e].m(c,h),O(c,s,h),o=!0},p(c,[h]){let u=e;e=l(c,h),e===u?a[e].p(c,h):(fe(),V(a[u],1,1,()=>{a[u]=null}),ge(),i=a[e],i?i.p(c,h):(i=a[e]=r[e](c),i.c()),D(i,1),i.m(s.parentNode,s))},i(c){o||(D(i),o=!0)},o(c){V(i),o=!1},d(c){a[e].d(c),c&&z(s)}}}function t3(n,t,e){let i,s,o,r,a,l,{tag:c}=t,{hooks:h}=t,{rendererMap:u=new Map}=t,{contentTypeMap:f=new Map}=t,{state:g}=t,{mediaStore:v}=t,{temporaryState:p}=t;pa("hooks",h),pa("mediaStore",v);let m,A;function w(R){R?h.emit("exposure",{id:r,type:"start"}):h.emit("exposure",{id:r,type:"end"})}function I(R,Y,G){var Q,W;return!(!Y.visible||!Y.enabled||!G.visible||!((Q=R.state)!=null&&Q.visible)||((W=R.temporaryState)==null?void 0:W.visible)===!1||R instanceof Fg&&R.loading)}function P(R){Ue[R?"unshift":"push"](()=>{c.contentDom=R,e(0,c)})}const k=R=>h.emit("click",{event:R,target:"TagContent",tag:c});function M(R){Ue[R?"unshift":"push"](()=>{c.contentDom=R,e(0,c)})}const T=R=>{c.entryFromModel&&Gt(c.five.state.mode)?(R.stopPropagation(),c.find({targetMode:"Panorama"})):h.emit("click",{event:R,target:"TagContent",tag:c})};return n.$$set=R=>{"tag"in R&&e(0,c=R.tag),"hooks"in R&&e(1,h=R.hooks),"rendererMap"in R&&e(2,u=R.rendererMap),"contentTypeMap"in R&&e(3,f=R.contentTypeMap),"state"in R&&e(6,g=R.state),"mediaStore"in R&&e(7,v=R.mediaStore),"temporaryState"in R&&e(8,p=R.temporaryState)},n.$$.update=()=>{var R,Y,G,Q,W,_,U,F,X,J,q;n.$$.dirty&1&&e(12,i=(R=c.state)==null?void 0:R.unfolded),n.$$.dirty&1&&e(11,s=(Y=c.state)==null?void 0:Y.visible),n.$$.dirty&321&&e(13,o=g.visible&&p.visible&&((G=c.state)==null?void 0:G.visible)),n.$$.dirty&1&&(r=c.id),n.$$.dirty&321&&e(5,a=!I(c,g,p)),n.$$.dirty&8192&&w(o),n.$$.dirty&7681&&c.hooks&&(i!==void 0&&i!==A&&(e(10,A=i),i?(W=(Q=c.hooks).emit)==null||W.call(Q,"unfolded"):(U=c==null?void 0:(_=c.hooks).emit)==null||U.call(_,"folded")),s!==void 0&&s!==m&&(e(9,m=s),s?(X=(F=c.hooks).emit)==null||X.call(F,"show"):(q=(J=c.hooks).emit)==null||q.call(J,"hide"))),n.$$.dirty&1&&e(4,l=(()=>!(typeof c.config.unfoldedConfig=="object"&&c.config.unfoldedConfig.keep==="folded"))())},[c,h,u,f,l,a,g,v,p,m,A,s,i,o,P,k,M,T]}let Ng=class extends ue{constructor(t){super(),de(this,t,t3,e3,he,{tag:0,hooks:1,rendererMap:2,contentTypeMap:3,state:6,mediaStore:7,temporaryState:8},QE)}};const i3={globalConfig:{visibleConfig:{followModelVisibility:!0,visibleDistance:{max:30}},unfoldedConfig:{autoUnfold:{enable:!0,strategy:"MinimumDistance",distance:{max:5}}},tag3DConfig:{ratio:.0035}},contentTypeConfig:{"[Mapview]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"[Floorplan]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"Any-Audio-plane":{unfoldedConfig:{keep:"unfolded"}},Link:{unfoldedConfig:{keep:"unfolded"}},Panorama:{unfoldedConfig:{keep:"unfolded"}},VRLink:{unfoldedConfig:{keep:"unfolded"}},PanoLink:{unfoldedConfig:{keep:"unfolded"}},MediaPlane:{unfoldedConfig:{keep:"unfolded"},visibleConfig:{alwaysShowWhenMovePano:!0},initialData:{autoplayConfig:{autoplayCarousel:!0,autoplayVideo:!1,autoplayVideoInCarousel:!1}}},"Model-Any":{unfoldedConfig:{keep:"unfolded"},visibleConfig:{visibleFiveMode:"all",alwaysShowWhenMovePano:!0}}}};class n3 extends Di{constructor(e){super(e);d(this,"tags",[]);d(this,"cache",new Rs);d(this,"config",i3);d(this,"renderQueue",new Map);d(this,"params");d(this,"mediaStore",ka({currentMediaElement:null}));d(this,"store",{disposers:[],disposed:!1,resizeObserverDisposerAdding:!1,css3DRenderDisposer:new Map});d(this,"domEvents",new sa(this.five));d(this,"_cache_pointTag");d(this,"_cache_2DPointTag");d(this,"_cache_css3DTag");d(this,"_container",null);d(this,"_css3DRenderPlugin");d(this,"whyHide",e=>{const i=this.getTagById(e);return i?i.whyHide():{reason:`tag ${e} not found`}});d(this,"loadVideoFirstFrame",()=>{FE&&this.hooks.emit("loadVideoFirstFrame")});this.mediaStore.subscribe(({currentMediaElement:i})=>{this.tags.forEach(s=>{var o;if(s.mediaPlane instanceof Sg&&i!==s.mediaPlane.videoInstance){if(!((o=s.mediaPlane.videoInstance)!=null&&o.src)||i===s.mediaPlane.videoInstance)return;s.mediaPlane.pause()}})})}get container(){var e;return this._container||((e=this.five.getElement())==null?void 0:e.parentElement)}set container(e){this._container=e}set tagsLengthWillUpdate(e){e&&(this._cache_pointTag=this.tags.filter(i=>i.stickType==="2DPoint"||i.stickType==="3DPoint").filter(i=>i.position),this._cache_2DPointTag=this.tags.filter(i=>i.stickType==="2DPoint").filter(i=>i.position),this._cache_css3DTag=this.tags.filter(i=>i.stickType==="3DPoint"||i.stickType==="Plane"||i.stickType==="Model"&&i.contentType==="MediaModel").filter(i=>{const s=i.computeRenderType();return s==="BehindDom"||s==="Dom"}))}get css3DRenderPlugin(){var e,i,s;if(!this._css3DRenderPlugin){const o=ks(this.five);this._css3DRenderPlugin=o,(e=o.frontModeCSS3DRenderer)!=null&&e.domElementWrapper&&(o.frontModeCSS3DRenderer.domElementWrapper.style.zIndex=(s=(i=this.params.containerZIndex)==null?void 0:i.toString())!=null?s:"")}return this._css3DRenderPlugin}get filterPointTag(){var e;return(e=this._cache_pointTag)!=null?e:[]}get filter2DPointTag(){var e;return(e=this._cache_2DPointTag)!=null?e:[]}get filterCSS3DTag(){var e;return(e=this._cache_css3DTag)!=null?e:[]}addRenderQueue(e){var r,a;const{type:i,keys:s=[],tags:o=[]}=e;this.renderQueue.has(i)?this.renderQueue.set(i,{keys:Array.from(new Set([...(r=this.renderQueue.get(i).keys)!=null?r:[],...s])),tags:Array.from(new Set([...(a=this.renderQueue.get(i).tags)!=null?a:[],...o]))}):this.renderQueue.set(i,{keys:s,tags:o})}getTagById(e){const i=this.tags.find(s=>s.id===e);if(!i){console.warn(`getTagById Error: can't find tag id: ${e}`);return}return i}pauseCurrentMedia(){this.mediaStore.set({currentMediaElement:null})}getPositions(e){if(eP(e))return e.position;if(oi(e))return e.data.mediaPosition;if(tP(e))return sP(this.five.camera.position,Ge(e.position),Ge(e.normal))}addObjectClickHandler(e,i,s){if(!i||!this.domEvents)return()=>{};const o=()=>!(!e.currentVisible||e.loading),r=a=>{if(!o())return!1;s(a.origDomEvent)};return this.domEvents.addEventListener(i,"click",r),()=>{var a;(a=this.domEvents)==null||a.removeEventListener(i,"click",r)}}checkDisposed(){return this.store.disposed?(console.error("PanoTagPluginController has been disposed"),!0):!1}}class s3 extends n3{constructor(e){super(e);d(this,"rendererMap",new Map);d(this,"contentTypeMap",new Map);d(this,"group",new N.Group);d(this,"imagePlaneGroup",new N.Group);d(this,"gltfObjectGroup",new N.Group);d(this,"enabledModelTagSet",new Set);d(this,"temporaryState",{visible:!0});d(this,"TagContainerSvelte");this.group.name="PanoTagPluginModelGroup",this.gltfObjectGroup.name="PanoTagPluginGLTFObjectGroup",this.imagePlaneGroup.name="ImagePlaneGroup",this.group.add(this.gltfObjectGroup),this.group.add(this.imagePlaneGroup)}registerRenderer(e,i,s){var o;this.rendererMap.set(e,{renderer:i,usePoint:(o=s==null?void 0:s.usePoint)!=null?o:!1})}bindRenderer(e,i){this.contentTypeMap.set(e,i)}clearTags(){var e;this.tags.length&&(this.tags.forEach(i=>{var s,o;(o=(s=i.mediaPlane)==null?void 0:s.parent)==null||o.remove(i.mediaPlane)}),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(e=this.TagContainerSvelte)==null||e.$destroy(),this.TagContainerSvelte=void 0,this.disposeAllCSS3DContainer()),this.enabledModelTagSet.clear(),this.cache.clear()}updateRender3DDomTag(e){(e?pi(e):this.filterCSS3DTag).forEach(s=>{var o,r,a,l,c,h;if(s.tag3DContentSvelte){const{svelteApp:u,css3DInstance:f,initialNormal:g,currentNormal:v}=s.tag3DContentSvelte;if((r=f==null?void 0:f.css3DObject)==null||r.setVisible((this.state.visible&&((o=s.state)==null?void 0:o.visible))!==!1),u.$set({tag:s,hooks:this.hooks,state:this.state,temporaryState:this.temporaryState}),!g.equals(v)){const p=new N.Quaternion().setFromUnitVectors(g,v);f.css3DObject.setRotationFromQuaternion(p)}return}else{if(oi(s)&&!((a=s.model)!=null&&a.object)||((l=s.state)==null?void 0:l.visible)===!1||!this.state.visible||!this.state.enabled||!this.css3DRenderPlugin)return;if(s.stickType==="3DPoint"&&!s.normal)return console.error("updateRenderPlaneTag: 三维点标签缺少法向量!");const u=this.getPositions(s);if(!u)return;const f=s.computeNormal();if(!f)return;const g=s.getConfig(),v=x({wrapperStyle:{zIndex:`${Math.round((1e4-((c=s.getDistance())!=null?c:0))*100)}`}},g.tag3DConfig);if(s.computeRenderType()==="BehindDom"||v.mode==="behind"){v.mode="behind",v.container=document.createElement("div");const A="black";v.container.style.backgroundColor=A,v.container.style.border=`3px solid ${A}`,this.css3DRenderPlugin.hooks.on("render",()=>{var w;if(p.css3DObject.opacityMesh&&g.clickable!==!1){const I=this.addObjectClickHandler(s,p.css3DObject.opacityMesh,P=>{this.hooks.emit("click",{event:P,target:"TagContent",tag:s})});(w=this.store.css3DRenderDisposer.get(s.id))==null||w.push(I)}})}const p=this.css3DRenderPlugin.create3DDomContainer(u,v);if(!p)return;this.store.css3DRenderDisposer.set(s.id,[p.dispose]);const m=new Ng({target:p.container,props:{tag:s,hooks:this.hooks,state:this.state,mediaStore:this.mediaStore,temporaryState:this.temporaryState}});s.tag3DContentSvelte={svelteApp:m,domContainer:p,css3DInstance:p,initialNormal:f,currentNormal:f,dispose:()=>{m.$destroy(),p.dispose()}},oi(s)&&((h=s.model)!=null&&h.object)&&this.updateTagCss3DObjectMatrix(s,s.model.object)}}),this.clearUnusedPanelTag()}updateTagCss3DObjectMatrix(e,i){var p,m,A;const s=(m=(p=e.getConfig().tag3DConfig)==null?void 0:p.ratio)!=null?m:.00216,o=(A=e.tag3DContentSvelte)==null?void 0:A.css3DInstance.css3DObject;if(!o)return;const r=oi(e)?e.data.mediaPosition:e.position;if(!r||r.length!==4||!Array.isArray(r[0])||!Array.isArray(r[2]))return;i.updateWorldMatrix(!1,!1);const a=i.matrixWorld,l=new N.Vector3().fromArray(r[0]),c=new N.Vector3().fromArray(r[2]),h=ei(l,c).add(new N.Vector3(0,0,5e-4)),u=new N.Matrix4().setPosition(h),f=new N.Matrix4().makeScale(s,s,s),g=new N.Matrix4().multiply(a).multiply(u).multiply(f);g.decompose(o.position,o.quaternion,o.scale);const v=o.opacityMesh;v&&g.decompose(v.position,v.quaternion,v.scale)}addMediaModelTag(e){return H(this,null,function*(){const i=e.filter(s=>s.stickType==="Model").map(s=>s.loadModel());yield Promise.all(i),e.forEach(s=>s.updateVisible())})}disposeAllCSS3DContainer(){for(const[,e]of this.store.css3DRenderDisposer)e==null||e.forEach(i=>i==null?void 0:i());this.store.css3DRenderDisposer=new Map}clearUnusedPanelTag(){this.filter2DPointTag.forEach(e=>{var i;(i=e.tag3DContentSvelte)==null||i.css3DInstance.dispose(),e.tag3DContentSvelte=void 0});for(const[e,i]of this.store.css3DRenderDisposer){const s=this.getTagById(e);(!s||s.stickType==="2DPoint")&&(i==null||i.forEach(o=>o==null?void 0:o()),this.store.css3DRenderDisposer.delete(e))}}}class o3{constructor(t){d(this,"plugin");d(this,"logBinded",!1);this.plugin=t}get debug(){return this.plugin.debug}addDebugPoints(){try{$C(this.plugin.five,this.plugin.tags)}catch(t){console.error(t)}}bindLog(){if(this.logBinded)return;this.logBinded=!0;const t=e=>{Object.getOwnPropertyNames(e).forEach(i=>{typeof e[i]=="function"&&(e[i]=new Proxy(e[i],{apply:(s,o,r)=>(["render"].includes(i)||this.addLog(i,...r),s.apply(o,r))}))})};t(this.plugin),t(this.plugin.constructor.prototype)}addLog(t,...e){if(this.debug){let i=new Error().stack;console.debug(`%cPanoTagPlugin%c${t}`,"background-color: #35e0ed; color: black; padding:0 6px; border-radius: 3px","padding: 0 3px; color: #f3f47c",...e,{stack:i})}}closeIntersectRaycaster(){this.plugin.tags.forEach(t=>{var e;nn((e=t==null?void 0:t.initialConfig)==null?void 0:e.visibleConfig).intersectRaycaster&&(t.initialConfig.visibleConfig.intersectRaycaster.enabled=!1)}),this.plugin.changeGlobalConfig({visibleConfig:{intersectRaycaster:{enabled:!1}}})}}function r3(n,t){if(typeof window.requestIdleCallback!==void 0)return window.requestIdleCallback(n,t);var e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)}function a3(n){if(typeof window.cancelIdleCallback!==void 0)return window.cancelIdleCallback(n);clearTimeout(n)}const l3=new y.Vector2;class c3 extends ml{constructor(e,i){super(e,i);d(this,"__Object__");d(this,"requestIdleCallbackId")}unfoldAndFoldOthers(){const e=this.can("fold"),i=this.can("unfold");e&&i&&(this.state.unfolded=!this.state.unfolded,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.state.unfolded&&this.plugin.tags.forEach(s=>{s.id!==this.id&&s.fold()}))}onClick(e){e.target==="TagPoint"&&this.unfoldAndFoldOthers()}updateVisible(){this.requestIdleCallbackId&&a3(this.requestIdleCallbackId),this.requestIdleCallbackId=r3(()=>{super.updateVisible()})}applyVisible(){var e,i,s,o;this.currentVisible&&this.updateScreenPosition(),(s=(i=(e=this.tag3DContentSvelte)==null?void 0:e.css3DInstance)==null?void 0:i.css3DObject)==null||s.setVisible(this.currentVisible),(o=this.tag3DContentSvelte)==null||o.svelteApp.$set({state:this.plugin.state,temporaryState:this.temporaryState}),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}unfold(){this.setUnfold(!0)}fold(){this.setUnfold(!1)}setUnfold(e){const i=this.can("fold"),s=this.can("unfold");i&&s&&(this.state.unfolded=e,this.hooks.emit(e?"unfolded":"folded"),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))}setPosition(e){this.originPosition=e,this.position=e,this.cache.clear(),this.updateVisible(),this.updateScreenPosition(),this.updateZIndex(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateScreenPosition(e){var a;if(this.stickType!=="2DPoint"&&this.stickType!=="3DPoint")return;const{force:i=!1}=e!=null?e:{},s=i?this.state.visible:this.currentVisible,o=(a=this.__Object__)!=null?a:{timeoutId:void 0,inAnimation:!1};if(this.__Object__=o,!s&&this.screenPosition?(o.inAnimation=!0,o.timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{this.currentVisible||(o.inAnimation=!1,this.screenPosition=null,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))})},1e3)):o.timeoutId&&(clearTimeout(o.timeoutId),o.inAnimation=!1,o.timeoutId=void 0),!s&&!o.inAnimation)return;const r=this.computeTagProject();if(r){const l=(()=>{if(!this.currentConfig.simulate3D)return 1;const h=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),u=this.getDistance(void 0,1);return Math.max(Math.min(1-h*u/40,1),.5)})(),c=this.five.renderer.getSize(l3);this.screenPosition={leftPx:(r.x+1)/2*c.x,topPx:(-r.y+1)/2*c.y,scale:l}}else this.screenPosition=null;this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateUnfoldedByPanoIndex(){const e=this.getUnfoldedByPanoIndex();if(this.state&&(e!==void 0&&(this.state.unfolded=e),e&&!this.state.visible)){const i=this.getConfig();typeof i.unfoldedConfig=="object"&&i.unfoldedConfig.autoFoldWhenHide!==!1&&(this.state.unfolded=!1)}}computeNormal(){return new y.Vector3().fromArray(this.normal)}destroy(){this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}}const h3=new Map,d3=new Map;class u3 extends ml{constructor(t,e){super(t,e),this.state.unfolded=!0}applyVisible(){var e,i,s,o,r,a;this.computeRenderType()==="Mesh"?((i=(e=this.data.mediaData)==null?void 0:e[0])==null?void 0:i.type)==="Video"?this.renderVideoPlane():((o=(s=this.data.mediaData)==null?void 0:s[0])==null?void 0:o.type)==="Image"&&this.renderImagePlane():((r=this.tag3DContentSvelte)==null||r.svelteApp.$set({tag:this,state:this.plugin.state}),(a=this.tag3DContentSvelte)==null||a.css3DInstance.setVisible(this.currentVisible))}renderVideoPlane(){var a;const t=this.data.mediaData[0];if(!t)return;const{url:e}=t;if(!e)return;const i=this.currentVisible,s=(()=>!!(this.mediaPlane&&!i))(),o=(()=>!!(!this.mediaPlane&&i))(),r=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==e))();if((s||r)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),o||r){const l=this.position.map(xi),c=new Sg(e,l,{videoCoverSrc:t.videoCoverUrl,playButton:this.data.playIcon,paused:!((a=this.data.autoplayConfig)!=null&&a.autoplayVideo),objectFit:this.data.objectFit,videoTextureMap:h3,ImageTextureMap:d3,domEvents:this.plugin.domEvents});c.onVideoReady=u=>{u.addEventListener("play",()=>this.plugin.mediaStore.set({currentMediaElement:c.videoInstance}))};const h=u=>(this.five.on("renderFrame",u),()=>this.five.off("renderFrame",u));c.initialRenderHooks(h),this.mediaPlane=c,this.plugin.imagePlaneGroup.add(this.mediaPlane)}this.five.needsRender=!0}renderImagePlane(){const t=this.data.mediaData[0];if(!t)return;const{url:e}=t;if(!e)return;const i=this.position.map(xi),s=this.currentVisible,o=(()=>!!(this.mediaPlane&&!s))(),r=(()=>!!(!this.mediaPlane&&s))(),a=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==e))();(o||a)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),(r||a)&&(this.mediaPlane=new Dg(e,i,{objectFit:this.data.objectFit}),this.getConfig().clickable!==!1&&this.plugin.domEvents.addAutoBindEventListener(this.mediaPlane,"click",l=>{this.plugin.hooks.emit("click",{tag:this,target:"TagContent",event:l.origDomEvent})},{noEmitWhenHide:!0}),this.plugin.imagePlaneGroup.add(this.mediaPlane)),this.five.needsRender=!0}computeNormal(){return Uu(this.position)}}function f3(n){me(n,"svelte-7aiuwz",'@charset "UTF-8";.tag-point-click-helper.svelte-7aiuwz.svelte-7aiuwz{position:absolute;pointer-events:auto;cursor:pointer;width:calc(100% + 0.75rem);height:calc(100% + 0.75rem);left:50%;top:50%;transform:translate(-50%, -50%)}.tag-point-wrapper.svelte-7aiuwz.svelte-7aiuwz{pointer-events:none;position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.tag-folded-point.svelte-7aiuwz.svelte-7aiuwz,.tag-unfolded-point.svelte-7aiuwz.svelte-7aiuwz{transition:all 0.5s}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{display:flex;justify-content:center;align-items:center;position:absolute;width:100%;height:100%;border-radius:50%}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.3125rem;height:0.3125rem;border-radius:50%;background-color:white}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:before{content:"";position:absolute;width:0.875rem;height:0.875rem;border-radius:50%;background-color:rgba(0, 0, 0, 0.2)}.tag-point-wrapper.folded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:1;scale:1}.tag-point-wrapper.folded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:0;scale:1}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:0;scale:0.2}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:1;scale:1}')}function g3(n){let t,e,i,s,o,r,a,l,c,h,u,f;return s=new Zt({props:{center:!0,blurRadius:15,spreadRadius:5,opacity:.3}}),c=new Pg({props:{icon:n[2],width:n[1]}}),c.$on("iconLoaded",n[7]),{c(){t=S("div"),e=S("div"),i=te(),re(s.$$.fragment),o=te(),r=S("div"),a=te(),l=S("div"),re(c.$$.fragment),C(e,"class","tag-point-click-helper svelte-7aiuwz"),C(r,"class","tag-unfolded-point svelte-7aiuwz"),L(r,"transition-delay",(n[3]?n[5]:0)+"ms"),C(l,"class","tag-folded-point svelte-7aiuwz"),L(l,"transition-delay",(n[3]?n[5]:0)+"ms"),C(t,"class","tag-point-wrapper svelte-7aiuwz"),ie(t,"unfolded",n[0]),ie(t,"folded",n[3])},m(g,v){O(g,t,v),j(t,e),j(t,i),se(s,t,null),j(t,o),j(t,r),j(t,a),j(t,l),se(c,l,null),h=!0,u||(f=Ce(e,"click",n[4]),u=!0)},p(g,[v]){v&8&&L(r,"transition-delay",(g[3]?g[5]:0)+"ms");const p={};v&4&&(p.icon=g[2]),v&2&&(p.width=g[1]),c.$set(p),v&8&&L(l,"transition-delay",(g[3]?g[5]:0)+"ms"),(!h||v&1)&&ie(t,"unfolded",g[0]),(!h||v&8)&&ie(t,"folded",g[3])},i(g){h||(D(s.$$.fragment,g),D(c.$$.fragment,g),h=!0)},o(g){V(s.$$.fragment,g),V(c.$$.fragment,g),h=!1},d(g){g&&z(t),oe(s),oe(c),u=!1,f()}}}function m3(n,t,e){let i,s,o,r;const a=Ti("hooks");let{tag:l}=t,c,h=!1;const u=()=>{c!==void 0&&clearTimeout(c),h=!0,c=setTimeout(()=>{h=!1},800)},f=p=>{h||(l.entryFromModel&&Gt(l.five.state.mode)?l.find({targetMode:"Panorama"}).then(()=>l.unfoldAndFoldOthers()):a.emit("click",{event:p,target:"TagPoint",tag:l}))},g=(()=>l.contentType==="Text"&&l.data.appearance==="plane"?500:800)();function v(p){Vn.call(this,n,p)}return n.$$set=p=>{"tag"in p&&e(6,l=p.tag)},n.$$.update=()=>{var p,m,A,w;n.$$.dirty&64&&e(0,i=(p=l.state)==null?void 0:p.unfolded),n.$$.dirty&1&&e(3,s=!i),n.$$.dirty&64&&e(2,o=(A=(m=l.style)==null?void 0:m.point)!=null&&A.url?(w=l.style)==null?void 0:w.point:{url:$w}),n.$$.dirty&64&&e(1,r=(()=>{var k,M,T,R;const I=(M=(k=l.style)==null?void 0:k.point)==null?void 0:M.width;if(typeof I=="number")return I;const P=(R=(T=l.style)==null?void 0:T.point)==null?void 0:R.size;if(typeof P=="number")return P;if(P==="S")return 18;if(P==="M")return 20;if(P==="L")return 24;if(P==="XL")return 28})())},u(),[i,r,o,s,f,g,l,v]}class p3 extends ue{constructor(t){super(),de(this,t,m3,g3,he,{tag:6},f3)}}function v3(n){me(n,"svelte-2g2g8a",".tag.svelte-2g2g8a{position:absolute;width:0rem;height:0rem;overflow:visible;pointer-events:auto;will-change:opacity;transition:opacity 0.2s linear}.tag.enableZIndex.svelte-2g2g8a{position:absolute}.tag.hide.svelte-2g2g8a{opacity:0;pointer-events:none}.tag.hide.svelte-2g2g8a *{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a *{pointer-events:none !important}")}function _g(n){let t,e,i,s,o,r,a,l,c;const h=[b3,A3],u=[];function f(m,A){return m[8]?0:1}e=f(n),i=u[e]=h[e](n);const g=[w3,y3],v=[];function p(m,A){return m[15]?0:1}return o=p(n),r=v[o]=g[o](n),{c(){t=S("div"),i.c(),s=te(),r.c(),C(t,"class","tag svelte-2g2g8a"),C(t,"data-tag-id",n[14]),C(t,"data-tag-unfolded",n[6]),C(t,"data-content-type",a=n[0].contentType),C(t,"id",l=`tag-${n[14]}`),ie(t,"unClickable",n[0].config.clickable===!1),ie(t,"hide",n[12]),ie(t,"enableZIndex",n[9]),L(t,"z-index",n[9]),L(t,"transform",`translate3d(${n[11]}, ${n[10]}, 0) scale(${n[7].scale})`)},m(m,A){O(m,t,A),u[e].m(t,null),j(t,s),v[o].m(t,null),n[17](t),c=!0},p(m,A){let w=e;e=f(m),e===w?u[e].p(m,A):(fe(),V(u[w],1,1,()=>{u[w]=null}),ge(),i=u[e],i?i.p(m,A):(i=u[e]=h[e](m),i.c()),D(i,1),i.m(t,s));let I=o;o=p(m),o===I?v[o].p(m,A):(fe(),V(v[I],1,1,()=>{v[I]=null}),ge(),r=v[o],r?r.p(m,A):(r=v[o]=g[o](m),r.c()),D(r,1),r.m(t,null)),(!c||A&16384)&&C(t,"data-tag-id",m[14]),(!c||A&64)&&C(t,"data-tag-unfolded",m[6]),(!c||A&1&&a!==(a=m[0].contentType))&&C(t,"data-content-type",a),(!c||A&16384&&l!==(l=`tag-${m[14]}`))&&C(t,"id",l),(!c||A&1)&&ie(t,"unClickable",m[0].config.clickable===!1),(!c||A&4096)&&ie(t,"hide",m[12]),(!c||A&512)&&ie(t,"enableZIndex",m[9]),A&512&&L(t,"z-index",m[9]),A&3200&&L(t,"transform",`translate3d(${m[11]}, ${m[10]}, 0) scale(${m[7].scale})`)},i(m){c||(D(i),D(r),c=!0)},o(m){V(i),V(r),c=!1},d(m){m&&z(t),u[e].d(),v[o].d(),n[17](null)}}}function A3(n){let t;return{c(){t=S("div"),C(t,"data-info","tag point is disable")},m(e,i){O(e,t,i)},p:K,i:K,o:K,d(e){e&&z(t)}}}function b3(n){let t,e;return t=new p3({props:{tag:n[0]}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=i[0]),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function y3(n){let t;return{c(){t=S("div"),C(t,"data-info","tag content is disable")},m(e,i){O(e,t,i)},p:K,i:K,o:K,d(e){e&&z(t)}}}function w3(n){let t,e;return t=new Ng({props:{mediaStore:n[1],tag:Ke(n[0]),hooks:n[16],state:n[4],temporaryState:n[5],rendererMap:n[2],contentTypeMap:n[3]}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&2&&(o.mediaStore=i[1]),s&1&&(o.tag=Ke(i[0])),s&16&&(o.state=i[4]),s&32&&(o.temporaryState=i[5]),s&4&&(o.rendererMap=i[2]),s&8&&(o.contentTypeMap=i[3]),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function C3(n){let t,e,i=n[7]&&!n[13]&&_g(n);return{c(){i&&i.c(),t=Ee()},m(s,o){i&&i.m(s,o),O(s,t,o),e=!0},p(s,[o]){s[7]&&!s[13]?i?(i.p(s,o),o&8320&&D(i,1)):(i=_g(s),i.c(),D(i,1),i.m(t.parentNode,t)):i&&(fe(),V(i,1,1,()=>{i=null}),ge())},i(s){e||(D(i),e=!0)},o(s){V(i),e=!1},d(s){i&&i.d(s),s&&z(t)}}}function P3(n,t,e){let i,s,o,r,a,l,c,h,u,f,{tag:g}=t,{mediaStore:v}=t,{rendererMap:p=new Map}=t,{contentTypeMap:m=new Map}=t,{state:A}=t,{temporaryState:w}=t;const I=Ti("hooks");function P(k){Ue[k?"unshift":"push"](()=>{g.dom=k,e(0,g)})}return n.$$set=k=>{"tag"in k&&e(0,g=k.tag),"mediaStore"in k&&e(1,v=k.mediaStore),"rendererMap"in k&&e(2,p=k.rendererMap),"contentTypeMap"in k&&e(3,m=k.contentTypeMap),"state"in k&&e(4,A=k.state),"temporaryState"in k&&e(5,w=k.temporaryState)},n.$$.update=()=>{var k,M,T,R;n.$$.dirty&5&&e(8,i=(()=>{var Y,G,Q;return!(((G=(Y=g.style)==null?void 0:Y.point)==null?void 0:G.enabled)===!1||((Q=p.get(g.contentType))==null?void 0:Q.usePoint)===!1||g.contentType==="Sticker"||g.contentType==="Link"||g.contentType==="VRLink"||g.contentType==="PanoLink"||g.contentType==="Panorama"||g.contentType==="Audio"&&g.data.appearance==="plane")})()),n.$$.dirty&257&&e(15,s=(()=>!(g.stickType!=="2DPoint"||g.entryFromModel&&Gt(g.five.state.mode)&&i))()),n.$$.dirty&1&&e(14,o=g.id),n.$$.dirty&1&&e(7,r=g.screenPosition),n.$$.dirty&1&&e(13,a=g.enabled===!1||!g.state),n.$$.dirty&129&&e(12,l=!((k=g.state)!=null&&k.visible)||((M=g.temporaryState)==null?void 0:M.visible)===!1||!r),n.$$.dirty&1&&e(6,c=(T=g.state)==null?void 0:T.unfolded),n.$$.dirty&128&&e(11,h=(r==null?void 0:r.leftPx)+"px"),n.$$.dirty&128&&e(10,u=(r==null?void 0:r.topPx)+"px"),n.$$.dirty&65&&e(9,f=c?((R=g.zIndex)!=null?R:0)+(c?1e6:0):void 0)},[g,v,p,m,A,w,c,r,i,f,u,h,l,a,o,s,I,P]}class I3 extends ue{constructor(t){super(),de(this,t,P3,C3,he,{tag:0,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5},v3)}}function M3(n){me(n,"svelte-1owzhnq",".tag--container.svelte-1owzhnq{box-sizing:border-box;position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:1;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:translate3d(0, 0, 0);transition:opacity 0.2s linear}.tag--container.hide.svelte-1owzhnq{opacity:0;pointer-events:none}.tag--container.hide.svelte-1owzhnq *{pointer-events:none !important}")}function Gg(n,t,e){const i=n.slice();return i[8]=t[e],i}function Qg(n){let t,e=[],i=new Map,s,o,r=n[0];const a=l=>l[8].id;for(let l=0;l<r.length;l+=1){let c=Gg(n,r,l),h=a(c);i.set(h,e[l]=Wg(h,c))}return{c(){var l;t=S("div");for(let c=0;c<e.length;c+=1)e[c].c();C(t,"class","tag--container svelte-1owzhnq"),ie(t,"hide",!n[4].visible||!n[5].visible),L(t,"z-index",(l=n[6])!=null?l:"")},m(l,c){O(l,t,c);for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(t,null);o=!0},p(l,c){var h;c&63&&(r=l[0],fe(),e=Xt(e,c,a,1,l,r,i,t,zi,Wg,null,Gg),ge()),(!o||c&48)&&ie(t,"hide",!l[4].visible||!l[5].visible),c&64&&L(t,"z-index",(h=l[6])!=null?h:"")},i(l){if(!o){for(let c=0;c<r.length;c+=1)D(e[c]);s||it(()=>{s=ji(t,gt,{}),s.start()}),o=!0}},o(l){for(let c=0;c<e.length;c+=1)V(e[c]);o=!1},d(l){l&&z(t);for(let c=0;c<e.length;c+=1)e[c].d()}}}function Wg(n,t){let e,i,s;return i=new I3({props:{state:t[4],temporaryState:t[5],tag:t[8],mediaStore:t[1],rendererMap:t[2],contentTypeMap:t[3]}}),{key:n,first:null,c(){e=Ee(),re(i.$$.fragment),this.first=e},m(o,r){O(o,e,r),se(i,o,r),s=!0},p(o,r){t=o;const a={};r&16&&(a.state=t[4]),r&32&&(a.temporaryState=t[5]),r&1&&(a.tag=t[8]),r&2&&(a.mediaStore=t[1]),r&4&&(a.rendererMap=t[2]),r&8&&(a.contentTypeMap=t[3]),i.$set(a)},i(o){s||(D(i.$$.fragment,o),s=!0)},o(o){V(i.$$.fragment,o),s=!1},d(o){o&&z(e),oe(i,o)}}}function E3(n){let t,e,i=n[4].enabled&&Qg(n);return{c(){i&&i.c(),t=Ee()},m(s,o){i&&i.m(s,o),O(s,t,o),e=!0},p(s,[o]){s[4].enabled?i?(i.p(s,o),o&16&&D(i,1)):(i=Qg(s),i.c(),D(i,1),i.m(t.parentNode,t)):i&&(fe(),V(i,1,1,()=>{i=null}),ge())},i(s){e||(D(i),e=!0)},o(s){V(i),e=!1},d(s){i&&i.d(s),s&&z(t)}}}function k3(n,t,e){let{tags:i=[]}=t,{hooks:s}=t,{mediaStore:o}=t,{rendererMap:r}=t,{contentTypeMap:a}=t,{state:l}=t,{temporaryState:c}=t,{zIndex:h=void 0}=t;return pa("hooks",s),n.$$set=u=>{"tags"in u&&e(0,i=u.tags),"hooks"in u&&e(7,s=u.hooks),"mediaStore"in u&&e(1,o=u.mediaStore),"rendererMap"in u&&e(2,r=u.rendererMap),"contentTypeMap"in u&&e(3,a=u.contentTypeMap),"state"in u&&e(4,l=u.state),"temporaryState"in u&&e(5,c=u.temporaryState),"zIndex"in u&&e(6,h=u.zIndex)},[i,o,r,a,l,c,h,s]}class x3 extends ue{constructor(t){super(),de(this,t,k3,E3,he,{tags:0,hooks:7,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5,zIndex:6},M3)}}const Hg="Dnalogel-PanoTagPlugin",D3=n=>`${Hg}--${n}`;class dr extends s3{constructor(e,i){super(e);d(this,"state",{enabled:!0,visible:!0});d(this,"debug");d(this,"debugUtil",new o3(this));d(this,"changeTagModel",(e,i)=>H(this,null,function*(){var s;e.data=Qe({},e.data,i),yield(s=e.loadModel)==null?void 0:s.call(e)}));d(this,"handleFiveModeChange",e=>{const i=()=>{this.tags.forEach(s=>{s.state.visible=!1,s.applyVisible(),this.five.ready().then(()=>{s.updateVisible(),oi(s)&&e!=="Panorama"&&this.changeTagMode(s,"behind")})})};this.tags.length<500?i():this.five.ready().then(()=>i())});d(this,"handleFiveWantsMoveToPano",e=>{if(this.tags.length>500){this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]});return}else this.tags.forEach(i=>{i.getVisible({panoIndex:e})&&(i.state.visible=!0);const o=i.getConfig();typeof o.visibleConfig=="object"&&i.temporaryState&&(o.visibleConfig.keep?i.temporaryState.visible=o.visibleConfig.keep==="visible":i.temporaryState.visible=!!o.visibleConfig.alwaysShowWhenMovePano)}),this.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.tags.forEach(i=>i.applyVisible())});d(this,"clickhandler",e=>{e.tag.onClick(e)});d(this,"handleFiveCameraUpdate",()=>{this.filterPointTag.forEach(e=>e.updateScreenPosition())});d(this,"handleFiveCameraFovUpdate",()=>{this.handleFiveCameraUpdate(),this.five.off("render.prepare",this.handleFiveCameraUpdate),this.five.on("render.prepare",this.handleFiveCameraUpdate),setTimeout(()=>{this.five.off("render.prepare",this.handleFiveCameraUpdate)},1e3)});d(this,"handleFivePanoArrived",()=>H(this,null,function*(){this.tags.forEach(e=>{e.state.visible=!1,e.temporaryState=ne(x({},e.temporaryState),{visible:!0}),e.applyVisible(),e.updateVisible()}),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}),yield this.setUnfolded(),this.updateRender3DDomTag(),this.tags.filter(iP).filter(e=>{var i;return(i=e.getConfig().modelConfig)==null?void 0:i.autoLookAtEnabled}).forEach(e=>{var c;const i=new y.Mesh(new y.BoxGeometry,new y.MeshBasicMaterial),s=(c=e.model)==null?void 0:c.object;if(!s)return;i.position.copy(s.position),i.quaternion.copy(s.quaternion);const o=this.five.camera.position;i.lookAt(o.clone().setY(i.position.y));const r=s.quaternion.clone(),a=i.quaternion.clone(),l=Is();l.onUpdate(({progress:h})=>{s.quaternion.copy(r.clone().slerp(a,h))}),l.play()})}));d(this,"handleFiveModelShownFloorChange",()=>{this.tags.forEach(e=>e.updateVisible())});d(this,"onFiveEveryReady",()=>{this.setUnfoldedByCamera(),Gt(this.five.getCurrentState().mode)&&this.tags.forEach(e=>e.updateVisible())});d(this,"render",()=>{this.renderQueue.forEach((e,i)=>{const{keys:s}=e;if(i==="TagContainerSvelte"){const r=this.filterPointTag.filter(l=>l.screenPosition),a={hooks:this.hooks,tags:r,state:this.state,temporaryState:this.temporaryState,mediaStore:this.mediaStore,rendererMap:this.rendererMap,contentTypeMap:this.contentTypeMap,zIndex:this.params.containerZIndex};if(this.TagContainerSvelte){let l={};if(s.length===0)l=a;else for(const c of s)l[c]=a[c];this.TagContainerSvelte.$set(l)}else{if(!this.container)return console.error("updateRenderPlaneTag: tag2DContainer not found");this.TagContainerSvelte=new x3({target:this.container,props:ne(x({},a),{state:ne(x({},this.state),{enabled:!1})})}),Ms(()=>{var l;(l=this.TagContainerSvelte)==null||l.$set({state:this.state})})}}}),this.renderQueue.clear()});this.params=Qe({},{debug:!1,config:this.config},x({},i)),this.debug=this.params.debug,this.config=this.params.config,this.debug&&this.debugUtil.bindLog(),cP(1,{namespace:Ka.PlayAudio});try{Array.isArray(window.__PANOTAGPLUGIN_DEBUG_LIST__)||(window.__PANOTAGPLUGIN_DEBUG_LIST__=[]),window.__PANOTAGPLUGIN_DEBUG_LIST__.push(this),window.__PANOTAGPLUGIN_DEBUG__||Object.defineProperty(window,"__PANOTAGPLUGIN_DEBUG__",{get:function(){return window.__PANOTAGPLUGIN_DEBUG_LIST__.sort((s,o)=>o.tags.length-s.tags.length)[0]}})}catch(s){}}appendTo(e){var s,o,r,a;this.debugUtil.addLog("appendTo"),this.container=e,(s=this.css3DRenderPlugin)==null||s.appendToFrontFiveContainer(this.container);const i=(r=(o=this.TagContainerSvelte)==null?void 0:o.$$)==null?void 0:r.root;i&&i!==this.container&&((a=this.TagContainerSvelte)==null||a.$destroy(),this.TagContainerSvelte=void 0)}load(e){return H(this,null,function*(){var s,o;this.clearTags(),console.debug(Hg," load:",{data:JSON.parse(JSON.stringify(e))}),this.config=Qe({},this.config,{globalConfig:(s=e.globalConfig)!=null?s:{},contentTypeConfig:(o=e.contentTypeConfig)!=null?o:{}});const i=yield this.addTag(e.tagList);return this.hooks.emit("loaded"),i})}addTag(e){return H(this,null,function*(){const s=(Array.isArray(e)?e:[e]).filter(o=>o.position).map(o=>{const r=qa(o);if(r==="2DPoint"||r==="3DPoint")return new c3(this,o);if(r==="Model")return new Fg(this,o);if(r==="Plane")return new u3(this,o)});return s.forEach(aP),this.tags.push(...s),this.tagsLengthWillUpdate=!0,Pn(this.five).then(()=>H(this,null,function*(){var o,r;this.store.eventListenerDisposer&&((r=(o=this.store).eventListenerDisposer)==null||r.call(o)),this.state.enabled&&this.handleEnable(),this.addResizeListener(),this.clearUnusedPanelTag(),this.addMediaModelTag(s),s.forEach(a=>{a.updateVisible(),a.updateZIndex()}),this.setUnfolded(),this.addRenderQueue({type:"TagContainerSvelte"}),this.hooks.emit("tagsLengthChange")}))})}changeConfig(e,i=!0){i?this.config=Qe({},this.config,e):this.config=e,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}changeGlobalConfig(e,i=!0){i?this.config.globalConfig=Qe({},this.config.globalConfig,e):this.config.globalConfig=e,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}changeContentTypeConfig(e,i,s=!0){this.config.contentTypeConfig||(this.config.contentTypeConfig={}),s?this.config.contentTypeConfig[e]=Qe({},this.config.contentTypeConfig[e],i):this.config.contentTypeConfig[e]=i,this.tags.forEach(o=>{o.updateConfig(),o.updateVisible()})}show(e){return H(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({visible:!0},{userAction:i}),this.hooks.emit("show",{userAction:i})})}hide(e){return H(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({visible:!1},{userAction:i}),this.hooks.emit("hide",{userAction:i})})}enable(e){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({enabled:!0},{userAction:i}),this.hooks.emit("enable",{userAction:i})}disable(e){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({enabled:!1},{userAction:i}),this.hooks.emit("disable",{userAction:i})}setState(e,i){if(this.checkDisposed())return;const{userAction:s=!0}=i!=null?i:{},o=x({},this.state);this.state=Object.assign(this.state,e),o.visible!==this.state.visible&&(e.visible?this.handleShow():this.handleHide()),o.enabled!==this.state.enabled&&(e.enabled?this.handleEnable():this.handleDisable()),this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:s})}dispose(){var e,i,s,o,r,a;this.pauseCurrentMedia(),this.disposeAllCSS3DContainer(),(e=this.TagContainerSvelte)==null||e.$destroy(),this.filterCSS3DTag.forEach(l=>{var c;return(c=l.tag3DContentSvelte)==null?void 0:c.svelteApp.$destroy()}),this.tags.forEach(l=>l.cache.clear()),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(i=this.store.disposers)==null||i.forEach(l=>l==null?void 0:l()),this.store.disposers=[],(o=(s=this.store).eventListenerDisposer)==null||o.call(s),this.store.eventListenerDisposer=void 0,(a=(r=this.store).resizeObserverDisposer)==null||a.call(r),this.store.resizeObserverDisposer=void 0,this.store.resizeObserverDisposerAdding=!1,this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.gltfObjectGroup.remove(...this.gltfObjectGroup.children),this.imagePlaneGroup.remove(...this.imagePlaneGroup.children),this.five.needsRender=!0,this.store.disposed=!0,this.hooks.emit("dispose")}blinkTagById(e,i){return H(this,null,function*(){var s;return(s=this.getTagById(e))==null?void 0:s.blink(i)})}changeUnfoldedById(e,i){const s=this.getTagById(e);i?s==null||s.unfold():s==null||s.fold()}changeEnabledById(e,i){var o;const s=this.getTagById(e);s&&(s.enabled=i,(o=s.hooks)==null||o.emit(i?"enable":"disable"))}changeTagNormalById(e,i){const s=this.getTagById(e);s&&s.tag3DContentSvelte&&(s.tag3DContentSvelte.currentNormal=xi(i))}changePositionById(e,i){const s=this.getTagById(e);s&&s.setPosition(i)}changeDataById(e,i,s=!0){const o=this.getTagById(e);o&&(o.setData(i,s),this.clearUnusedPanelTag(),o.hooks.emit("dataChanged",o.data))}changeStickTypeById(e,i,s=!0){this.changeTagById(e,i,s)}changeTagById(e,i,s=!0){const o=this.getTagById(e);o&&(o.set(i),o.updateVisible(),this.clearUnusedPanelTag(),o.hooks.emit("dataChanged",o.data))}destroyTagById(e){(Array.isArray(e)?e:[e]).forEach(s=>{var o;return(o=this.getTagById(s))==null?void 0:o.destroy()})}updateRenderAllTags(){this.tags.forEach(e=>e.updateVisible()),this.five.needsRender=!0}setUnfolded(){return H(this,null,function*(){return new Promise(e=>{setTimeout(()=>{this.setUnfoldedByCamera(),e()},100)})})}handleShow(){this.state.visible=!0,this.group.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleHide(){this.pauseCurrentMedia(),this.state.visible=!1,this.group.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleEnable(){this.state.enabled=!0,this.store.eventListenerDisposer=this.addEventListener(),this.five.scene.children.includes(this.group)||this.five.scene.add(this.group),this.group.traverse(e=>{var i;(i=e==null?void 0:e.updateTagCss3DObjectMatrix)==null||i.call(e)}),this.updateRender3DDomTag(),this.five.needsRender=!0}handleDisable(){var e,i,s;this.pauseCurrentMedia(),this.state.enabled=!1,(i=(e=this.store).eventListenerDisposer)==null||i.call(e),this.five.scene.remove(this.group),(s=this.TagContainerSvelte)==null||s.$set({tags:[]}),this.filterCSS3DTag.forEach(o=>{var r;(r=o.tag3DContentSvelte)==null||r.dispose(),o.tag3DContentSvelte=void 0}),this.five.needsRender=!0}addResizeListener(){if(!this.store.resizeObserverDisposer&&!this.store.resizeObserverDisposerAdding){const e=this.addResizeObserver();this.store.resizeObserverDisposerAdding=!0,setTimeout(()=>{this.store.resizeObserverDisposer=e,this.store.resizeObserverDisposerAdding=!1},200)}}addResizeObserver(){if(this.store.disposed)return;const e=this.five.getElement(),i=()=>{this.state.enabled&&(this.filterPointTag.forEach(c=>c.updateScreenPosition({force:!0})),this.show())},s=()=>{this.state.enabled&&this.hide()},{observe:o,unobserve:r}=$a(Xu(()=>{this.store.resizeObserverDisposer&&s()},500),e),{observe:a,unobserve:l}=$a(oP(()=>i(),400),e);return o(),a(),()=>{r(),l()}}setUnfoldedByCamera(){let e=!1;this.filterPointTag.forEach(i=>{const s=i.getUnfoldedByCamera();if(i.state&&s!==void 0){if(s===!0&&i.screenPosition){const o=i.getConfig().unfoldedConfig;nn(o).keep!=="unfolded"&&(e=!0)}i.state.unfolded=s}}),e&&this.filterPointTag.forEach(i=>{const s=i.getConfig().unfoldedConfig;typeof s=="object"&&(s.autoUnfold||s.autoUnfold===!1||nn(s.autoUnfold).enable===!1||s.keep)||i.state&&(i.state.unfolded=!1)})}changeTagMode(e,i){var s,o,r,a,l,c;((s=e.config)==null?void 0:s.renderType)!=="Mesh"&&((a=(r=(o=e.tag3DContentSvelte)==null?void 0:o.css3DInstance)==null?void 0:r.css3DObject)==null?void 0:a.mode)!==i&&((l=e.config)!=null&&l.tag3DConfig?e.config.tag3DConfig.mode=i:e.config?e.config.tag3DConfig={mode:i}:e.config={tag3DConfig:{mode:i}},(c=this.store.css3DRenderDisposer.get(e.id))==null||c.forEach(h=>h==null?void 0:h()),e.tag3DContentSvelte=void 0)}addEventListener(){const{five:e,hooks:i}=this;let s=!1;const o=Xu(()=>{s||(s=!0,e.ready().then(()=>{this.onFiveEveryReady(),s=!1}))},150);return e.on("cameraUpdate",o),this.handleFivePanoArrived(),e.on("wantsMoveToPano",this.handleFiveWantsMoveToPano),e.on("models.refined",this.onFiveEveryReady),e.on("modeChange",this.handleFiveModeChange),e.on("modelShownFloorChange",this.handleFiveModelShownFloorChange),e.on("cameraUpdate",this.handleFiveCameraUpdate),e.on("cameraFovUpdate",this.handleFiveCameraFovUpdate),e.on("panoArrived",this.handleFivePanoArrived),e.on("panoArrived",this.loadVideoFirstFrame),e.on("render.prepare",this.render),i.on("click",this.clickhandler),()=>{e.off("wantsMoveToPano",this.handleFiveWantsMoveToPano),e.off("models.refined",this.onFiveEveryReady),e.off("modeChange",this.handleFiveModeChange),e.off("modelShownFloorChange",this.handleFiveModelShownFloorChange),e.off("cameraUpdate",this.handleFiveCameraUpdate),e.off("cameraFovUpdate",this.handleFiveCameraFovUpdate),e.off("cameraUpdate",o),e.off("panoArrived",this.handleFivePanoArrived),e.off("panoArrived",this.loadVideoFirstFrame),e.off("render.prepare",this.render),i.off("click",this.clickhandler),this.store.eventListenerDisposer=void 0}}}const S3=(n,t)=>new dr(n,t);function L3(n){me(n,"svelte-4qjwer",".guide-line__tag.svelte-4qjwer.svelte-4qjwer{position:relative}.text-with-distance.svelte-4qjwer.svelte-4qjwer{display:flex;flex-direction:column;position:relative;padding:0.125rem 0.25rem;border-radius:0.125rem;background:linear-gradient(to top, rgba(147, 147, 147, 0.3), rgba(74, 74, 74, 0.3));box-shadow:0 0.125rem 0.5rem 0 rgba(0, 0, 0, 0.2)}.text-with-distance.svelte-4qjwer .border.svelte-4qjwer{position:absolute;top:-50%;right:-50%;bottom:-50%;left:-50%;padding:0.0625rem;border-radius:0.25rem;background:linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2));-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask-composite:exclude;-webkit-mask-composite:xor;transform:scale(0.5)}.distance-and-name.svelte-4qjwer.svelte-4qjwer{display:flex;gap:0.1875rem}.distance.svelte-4qjwer.svelte-4qjwer{white-space:nowrap;font-size:0.625rem;line-height:0.875rem;color:#66afff}.name.svelte-4qjwer.svelte-4qjwer{opacity:0.6;font-size:0.625rem;line-height:0.875rem;white-space:nowrap;color:#ffffff}.line-name.svelte-4qjwer.svelte-4qjwer{color:#fff;white-space:nowrap;font-size:0.625rem;line-height:0.875rem}.guide-line__tag-point.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.4375rem;height:0.125rem;transform:translateX(-50%);background:#fff;border-radius:50%;opacity:0.5}.guide-line__tag-line.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.0625rem;height:1.875rem;transform:translateX(-50%);background:linear-gradient(to top, #fff, rgba(255, 255, 255, 0))}.guide-line__tag-content.svelte-4qjwer.svelte-4qjwer{position:absolute;left:-0.9375rem;bottom:1.9375rem;display:flex}.guide-line__tag-icon.svelte-4qjwer.svelte-4qjwer{width:1.875rem;height:1.875rem;background-size:100%}.guide-line__tag-text.svelte-4qjwer.svelte-4qjwer{box-sizing:content-box;height:0.875rem;width:-moz-max-content;width:max-content;margin-top:0.3125rem;transform:translateX(-0.1875rem);white-space:nowrap;font-size:0.625rem;line-height:0.875rem;border:solid transparent;border-width:0.125rem 0.5rem 0.125rem 0.375rem;border-image-slice:6 25 6 18 fill;color:#fff}")}function Ug(n){let t,e;return{c(){t=S("div"),e=Se(n[0]),C(t,"class","guide-line__tag-text svelte-4qjwer"),L(t,"border-image-source",`url(${n[6]})`)},m(i,s){O(i,t,s),j(t,e)},p(i,s){s&1&&Le(e,i[0])},d(i){i&&z(t)}}}function Yg(n){let t,e,i,s,o=n[5]("全程")+"",r,a,l=n[5]("米")+"",c,h,u,f,g,v,p=n[4]&&Xg(n);return{c(){t=S("div"),p&&p.c(),e=te(),i=S("div"),s=S("span"),r=Se(o),a=Se(n[2]),c=Se(l),h=te(),u=S("span"),f=Se(n[0]),g=te(),v=S("div"),C(s,"class","distance svelte-4qjwer"),C(u,"class","name svelte-4qjwer"),C(i,"class","distance-and-name svelte-4qjwer"),C(v,"class","border svelte-4qjwer"),C(t,"class","text-with-distance svelte-4qjwer")},m(m,A){O(m,t,A),p&&p.m(t,null),j(t,e),j(t,i),j(i,s),j(s,r),j(s,a),j(s,c),j(i,h),j(i,u),j(u,f),j(t,g),j(t,v)},p(m,A){m[4]?p?p.p(m,A):(p=Xg(m),p.c(),p.m(t,e)):p&&(p.d(1),p=null),A&32&&o!==(o=m[5]("全程")+"")&&Le(r,o),A&4&&Le(a,m[2]),A&32&&l!==(l=m[5]("米")+"")&&Le(c,l),A&1&&Le(f,m[0])},d(m){m&&z(t),p&&p.d()}}}function Xg(n){let t,e;return{c(){t=S("span"),e=Se(n[4]),C(t,"class","line-name svelte-4qjwer")},m(i,s){O(i,t,s),j(t,e)},p(i,s){s&16&&Le(e,i[4])},d(i){i&&z(t)}}}function T3(n){let t,e,i,s,o,r,a,l,c,h=n[0]&&!n[2]&&Ug(n),u=n[2]&&Yg(n);return{c(){t=S("div"),e=S("div"),i=te(),s=S("div"),o=te(),r=S("div"),a=S("div"),l=te(),h&&h.c(),c=te(),u&&u.c(),C(e,"class","guide-line__tag-point svelte-4qjwer"),C(s,"class","guide-line__tag-line svelte-4qjwer"),C(a,"class","guide-line__tag-icon svelte-4qjwer"),L(a,"background-image",`url(${n[1]})`),C(r,"class","guide-line__tag-content svelte-4qjwer"),C(t,"class","guide-line__tag svelte-4qjwer"),L(t,"opacity",n[3])},m(f,g){O(f,t,g),j(t,e),j(t,i),j(t,s),j(t,o),j(t,r),j(r,a),j(r,l),h&&h.m(r,null),j(r,c),u&&u.m(r,null)},p(f,[g]){g&2&&L(a,"background-image",`url(${f[1]})`),f[0]&&!f[2]?h?h.p(f,g):(h=Ug(f),h.c(),h.m(r,c)):h&&(h.d(1),h=null),f[2]?u?u.p(f,g):(u=Yg(f),u.c(),u.m(r,null)):u&&(u.d(1),u=null),g&8&&L(t,"opacity",f[3])},i:K,o:K,d(f){f&&z(t),h&&h.d(),u&&u.d()}}}function j3(n,t,e){let{text:i=""}=t,{icon_url:s=""}=t,{distance:o=0}=t,{opacity:r=1}=t,{name:a=""}=t,{i18n:l=h=>h}=t;const c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHUAAAA2CAMAAADOFiZMAAACEFBMVEUAAACIiIheXl5oaGh6enpsbGxiYmJ9fX1wcHBXV1eBgYFzc3NSUlKNjY2Dg4NOTk51dXVXV1dmZmZTU1N3d3dcXFyMjIyEhIRNTU2QkJC0tLS5ubnHx8fOzs6np6exsbHKysqoqKi9vb3U1NTPz8/Nzc2vr6/Dw8OysrK/v7/X19fS0tKurq62traqqqrJycmurq64uLifn5/Dw8O6urqQkJC6urro6Ojt7e3o6OjU1NS3t7fBwcGjo6Ozs7Orq6u1tbXAwMCurq6rq6vy8vLx8fHr6+vp6enZ2dnd3d3a2trX19fV1dW/v7/IyMihoaGampqVlZWLi4uCgoK+vr6urq7m5ubw8PDk5OTu7u7i4uLg4ODe3t7q6urS0tLi4uLOzs7e3t7Hx8fa2tqrq6vExMTAwMCnp6efn5+WlpaHh4ezs7OoqKiJiYm6urqZmZmurq59fX29vb23t7e4uLipqanp6enc3Nza2trW1tbT09Pm5ubj4+PQ0NDg4ODExMTCwsK7u7vBwcG8vLy5ubm8vLy+vr64uLiysrKdnZ3CwsJoaGisrKzHx8ekpKTExMTv7+/i4uLa2trm5ubk5OTLy8vKysrExMTQ0NDX19ecnJzT09N/f3+dnZ12dnaQkJCXl5etra3Pz8+4uLiXl5fGxsaqqqrr6+vQ0NDKysrNzc3W1takpKShoaGsrKysrKyduRZkAAAAsHRSTlMATE1NTExMTUxNTExMTExNTExMTU1MTU1MTICFc313fnl0iIWAe3h3aYqIgXx7eXZzcnFwaGggxLiog4J0dG9mZF82FMfEtK2pkYqKh3x4cm1rZmEmH8G/vry6trOxoZ2clpKOe3ptbWZjYmFgXFpaVlFPSDYlx7CspaSjoJ6akY6HfXt4bGpmY1xUU0g2LSzCuK6lopiWhoF3YmFaVlZUUU5KPyEJCcl/fXNdXFxZUIUrIQsAAAV6SURBVFjDvZj3VxNBEMePBBIOQgmEQGghISSASSBBUQFBVIpUEaR3aVJExN4F6fbee6//opPN2507E3P7fD4+b54z+935zt7lvPsBYbZ5lyXT7R5xms2ppaVpV615eVeuXL48PPzw4YPBwYsX+/vPnT1bW1t75u7p0729PT13urs7O9vbt2/ffurUp1OQ2ts7O7u77/T09PaevnvmTG3t2XPn+vsvDg4+GH5UVjl/SAjGe29La2vr5EFgm4+WlpYDgNfrbW7etQuuKDPTPTIy4nSa4bJ8lKYBV69arXmA1WpN81FamgqYzU6n0+12ZwI+qzPtyvDlR0dPCoGsecW4FEZcShwEyUDIGvtD+DcOZlrzFvcE3qylFXZ1cTqIgGk0K1xRSL84abaWtwl/8KM5kTiok04B2BpAPUWXAoGnQK3gn0xNW90ryDhpafXvJsYlJuoSdRCyTJHqBOxR9IvbUl1/PN5pL9tFR4gTJJmi7N+wl8qf7k33S+YQE0VRJwZz42RogDZcAxx+sTn1jSDho6VFBKAbp9K1XqfXi3oRgmSqQ2AGePziNpfs2GN2lV5Pp+IJkkwIrDFz+Y+Y90h/Yvtz+f0o1YGnc/lVXvshASk8IHUm6ZMIYhI6YAEyqyHkE/n8Kkuh5AX6ZVdBlypJpRJVIgTJ0IluEGCb1BDYCzWFx79h/yl5ZV3PVUSVAQIDFhCyLO/h9E9KfuOPriOqzUFjmRYYueOqTWLGfhPfHZcGrkOlgcAGskZdAV7/eIVA2eN6qZGA3Yhcxxozn3+mkD3ZQ64Z3EnQJEBouMB+Xr+68LpAuTZBOokDoPXfNIK85vZP5AqUreNqdYI6AUINkBrAtUatgaA67mEft38GvxRThWopOAFrBbj9kYXsa3z0mnrTsLAHe3yRzxGhjoBQ0BT848foqfONkT6FAAWrce3PeEpA5vZPsDf23aIhgpfIiEiIiH/mKftPfKJxTjaNv8bM6zlSzk5dmIsMDk7EGrMEbj+e+q5xLjoyOrQbGiCCaZh5/PgLzy8YiIrgNPmaZtQovP6J3ezNafTvxEfHQ2An8v/2K47hV4J0ExVBDbNCD4e/nH0lKj1+1RBvMEQboiEMUJI1BOmmGq0pVOP1z3nYF3G53EAIN4SHx4djNyxAkutQA1QnGeD2z3rY199RIZ+EtVxDPaDm9VdspYcWj65pteFaonIDBghpzeXyzNNTbyy8CpgCyCehjnvYx+uf9RTTU9cbo7SbRPmKQBnzaKMI2igthD8jVAvIuM/rXytjfyz4MFqBDgLWPGuA05/sqRQobaOzsBMbFQsRhaAWco/A6Z92FAuU446wWL+aHJWcHJtMOzEDwWrU+PyvHEcFRlkutELInT4NFiCRGqA6yQDWfH5jWdFegXLL8V3qDIsNIySHoRsWIGMN/wBY8/mXRosFxrrDCE20EwJzCGQ9XP7crBN46AdHbthmkPvluICccLzgchnDjBD/eqaxKOOtIKGyiEzDqSFOCt7D4X/dlHFDkNCWPu3fjTHGQBgpbI06TkeIpuQ37bbltAlSKstM/g6EdYcEr0jJv2rLfrZXkFKcPhVjMsWY0GGSrTn00H7TakbD11sChd7qa+gCSKdJVitpyvWLlab6uifsieKtLk1N7QZWtvpYXl4aGxsrAtIJBQVNWVlZOTkZGRm2z7bHW0q2lJRkZ2c3NOTn19fV19fn5zfAsmQL8Nhmg66cHOhvKigoSC/Iysk+vH9//jd2n8g6TG7yjbXZYCAMq6s7fBiah4aGLl0aGLhw4f758zuBmpq+vurq6h07dnR1dXTcrqqq2uejqup2R0dXF8jV1X19NTU1O3feu3f+/oWBgUtD++uePHtbLAThNzRClbi+VnseAAAAAElFTkSuQmCC";return n.$$set=h=>{"text"in h&&e(0,i=h.text),"icon_url"in h&&e(1,s=h.icon_url),"distance"in h&&e(2,o=h.distance),"opacity"in h&&e(3,r=h.opacity),"name"in h&&e(4,a=h.name),"i18n"in h&&e(5,l=h.i18n)},[i,s,o,r,a,l,c]}class z3 extends ue{constructor(t){super(),de(this,t,j3,T3,he,{text:0,icon_url:1,distance:2,opacity:3,name:4,i18n:5},L3)}}function O3(n){return n.length===0?[]:n.filter((t,e)=>t!==n[e-1])}const V3=`
618
+ `);this.uniforms={map:{value:e}}}}class xg extends y.Mesh{constructor(){super(...arguments);d(this,"name","MediaPlane");d(this,"src")}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}dispose(){this.traverse(e=>{if(e.isMesh){const i=e;i.geometry.dispose(),(i.material instanceof Array?i.material:[i.material]).forEach(o=>{o.dispose()})}})}}class Dg extends xg{constructor(e,i,s){var a;super();d(this,"name","PanoTagPluginImagePlane");this.src=e;const o=(a=s==null?void 0:s.resolveZFighting)!=null?a:!0;let r=i;if(o){const l=Ss(i,5e-4);r=i.map(c=>c.clone().add(l))}Bd(e).then(({texture:l,transparent:c})=>{var p;const h=new y.MeshBasicMaterial({map:l,transparent:c}),u=Bs((p=s==null?void 0:s.objectFit)!=null?p:"contain",r,l.image.width/l.image.height),f=ei(...u),g=u.map(m=>m.clone().sub(f)),v=new kg(g);this.position.copy(f),this.geometry=v,this.material=h}).catch(l=>{console.error(`Imageplane error ${l==null?void 0:l.message}`)})}}class Sg extends xg{constructor(e,i,s){const{videoCoverSrc:o,objectFit:r="contain",playButton:a="withText",paused:l=!0,videoTextureMap:c,ImageTextureMap:h,domEvents:u}=s!=null?s:{};super();d(this,"isVideoPlane",!0);d(this,"name","PanoTagPluginImagePlane");d(this,"videoInstance");d(this,"onVideoReady");d(this,"objectFit");d(this,"buttonSrc");d(this,"videoCoverSrc");d(this,"domEvents");d(this,"disposers",[]);d(this,"cornerPoints");d(this,"videoMesh");d(this,"coverMesh");d(this,"buttonMesh");d(this,"videoTextureMap");d(this,"ImageTextureMap");this.cornerPoints=i,this.src=e,this.buttonSrc=(()=>a==="withText"?Ua:a==="withoutText"?Ya:typeof a=="string"?a:Ya)(),this.videoCoverSrc=o,this.objectFit=r,this.videoTextureMap=c,this.ImageTextureMap=h,this.domEvents=u,this.position.copy(ei(...i)),this.videoCoverSrc&&l?this.addCoverMesh().then(()=>this.addButtonMesh()):this.addVideoMesh().then(()=>{l?this.addButtonMesh():this.play(!0)}),this.addEventListener("removed",()=>{this.remove(...this.children)}),this.addEventListener("dispose",()=>{var f;(f=this.disposers)==null||f.forEach(g=>g==null?void 0:g())})}play(e=!1){return H(this,null,function*(){this.videoMesh||(yield this.addVideoMesh()),this.showPlayUI(),this.videoInstance.paused&&this.videoInstance.play().then(()=>this.showPlayUI()).catch(i=>{this.pause(),console.error("play error",i)}),this.videoInstance.muted=e,this.render()})}pause(){this.videoInstance&&(this.videoInstance.pause(),this.showPauseUI().then(()=>this.render()))}initialRenderHooks(e){const s=e(()=>{var o;this.videoMesh&&((o=this.videoInstance)==null?void 0:o.paused)===!1&&(this.videoMesh.needsRender=!0)});this.disposers.push(()=>s)}showPlayUI(){this.coverMesh&&(this.coverMesh.visible=!1),this.remove(this.buttonMesh),this.videoMesh.visible=!0}showPauseUI(){return H(this,null,function*(){this.coverMesh?(this.coverMesh.visible=!0,this.videoMesh&&(this.videoMesh.visible=!1)):(yield this.addCoverMesh(),this.coverMesh&&(this.videoMesh.visible=!1)),this.addButtonMesh().then(()=>this.render())})}render(){var e;this.videoMesh&&(this.videoMesh.needsRender=!0),this.coverMesh&&(this.coverMesh.needsRender=!0),this.buttonMesh&&(this.buttonMesh.needsRender=!0),this.videoMesh&&((e=this.videoInstance)==null?void 0:e.paused)===!1&&(this.videoMesh.needsRender=!0)}addCoverMesh(){return H(this,null,function*(){if(this.children.includes(this.coverMesh))return;const e=yield(()=>H(this,null,function*(){if(this.coverMesh)return this.coverMesh;if(!this.videoCoverSrc)return;const{texture:i,transparent:s}=yield this.getImageTexture(this.videoCoverSrc),o=new y.MeshBasicMaterial({transparent:!1,map:i}),r=Bs(this.objectFit,this.cornerPoints,i.image.width/i.image.height),a=new fl(r,o);return a.position.copy(new N.Vector3(0,0,0)),a.name="videoCoverMesh",a}))();return e&&(this.children.includes(this.coverMesh)||(this.add(e),this.coverMesh=e)),e})}addVideoMesh(){return H(this,null,function*(){if(this.children.includes(this.videoMesh))return;const e=yield(()=>H(this,null,function*(){if(this.videoMesh)return this.videoMesh;if(!this.src)return;const s=this.getVideoTexture(this.src),o=new y.MeshBasicMaterial({transparent:!1,map:s}),r=yield new Promise(l=>{s.metadataLoaded?l(Bs(this.objectFit,this.cornerPoints,s.image.videoWidth/s.image.videoHeight)):s.addEventListener("videoLoaded",()=>l(Bs(this.objectFit,this.cornerPoints,s.image.videoWidth/s.image.videoHeight)))}),a=new fl(r,o);return a.name="videoMesh",a.position.copy(new N.Vector3(0,0,0)),a}))();if(!e)return;this.domEvents.addAutoBindEventListener(e,"click",()=>{!this.videoInstance.paused&&this.videoInstance.muted?this.videoInstance.muted=!1:this.pause()},{noEmitWhenHide:!0});const i=e.material.map.image;return i.addEventListener("playing",()=>{this.coverMesh||this.remove(this.buttonMesh),this.render()}),i.addEventListener("pause",()=>{this.videoInstance.paused&&(this.showPauseUI(),this.render())}),this.children.includes(this.videoMesh)||(this.add(e),this.videoMesh=e,this.videoInstance=i),e})}addButtonMesh(){return H(this,null,function*(){if(this.children.includes(this.buttonMesh))return;const e=yield(()=>H(this,null,function*(){var g,v,p,m;if(this.buttonMesh)return this.buttonMesh;const i=(v=(g=this.videoMesh)==null?void 0:g.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3]))!=null?v:1/0,s=(m=(p=this.coverMesh)==null?void 0:p.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3]))!=null?m:1/0,o=this.cornerPoints[0].distanceTo(this.cornerPoints[3]),a=Math.min(i,s,o)/o*.3,{texture:l,transparent:c}=yield this.getImageTexture(this.buttonSrc),h=Bs("contain",this.cornerPoints,l.image.width/l.image.height),u=new fl(h,new _E(l));u.position.copy(new N.Vector3(0,0,0)),u.name="buttonMesh",u.scale.set(a,a,a),this.domEvents.addAutoBindEventListener(u,"click",()=>{this.play()},{noEmitWhenHide:!0});const f=Ss(h,5e-4);return u.position.add(f),u}))();return this.children.includes(this.buttonMesh)||(this.add(e),this.buttonMesh=e),e})}getImageTexture(e){return H(this,null,function*(){var s,o;if((s=this.ImageTextureMap)!=null&&s.has(e))return this.ImageTextureMap.get(e);const i=yield Bd(e);return(o=this.ImageTextureMap)==null||o.set(e,i),i})}getVideoTexture(e){var s,o;if((s=this.videoTextureMap)!=null&&s.has(e))return this.videoTextureMap.get(e);const i=NE(e);return(o=this.videoTextureMap)==null||o.set(e,i),i}}function Lg(n){return Object.entries(n)}function Tg(n){var e,i;typeof n.visibleConfig=="object"&&n.visibleConfig.keep&&(n.visibleConfig.keep==="visible"?n.visibleConfig={keep:n.visibleConfig.keep,visibleFiveMode:(e=n.visibleConfig)==null?void 0:e.visibleFiveMode}:n.visibleConfig.keep==="hidden"&&(n.visibleConfig={keep:n.visibleConfig.keep})),typeof n.unfoldedConfig=="object"&&(n.unfoldedConfig.disableFold&&(n.unfoldedConfig={keep:"unfolded"}),n.unfoldedConfig.disableUnfold&&(n.unfoldedConfig={keep:"folded"}),n.unfoldedConfig.keep&&(n.unfoldedConfig={keep:n.unfoldedConfig.keep}));const t=(i=n.initialState)!=null?i:{};return typeof n.unfoldedConfig=="object"&&(n.unfoldedConfig.keep==="unfolded"?t.unfolded=!0:n.unfoldedConfig.keep==="folded"&&(t.unfolded=!1)),typeof n.visibleConfig=="object"&&(n.visibleConfig.keep==="visible"?t.visible=!0:n.visibleConfig.keep==="hidden"&&(t.visible=!1)),n.initialState=t,n}const jg={visibleConfig:{intersectRaycaster:{enabled:!0,distanceAccuracy:.01,checkPoints:"corner",needPassed:1}},clickable:!0,simulate3D:!1,renderType:"Dom"};var zg=(n=>(n.PointTag="PointTag",n.PlaneTag="PlaneTag",n))(zg||{}),Og=(n=>(n.Audio="Audio",n.Text="Text",n.ImageText="ImageText",n.Image="Image",n.Video="Video",n.Link="Link",n.Sticker="Sticker",n.VRLink="VRLink",n.PanoLink="PanoLink",n.Marketing="Marketing",n.MediaPlane="MediaPlane",n.MediaModel="MediaModel",n.Model="Model",n.Panorama="Panorama",n.Custom="Custom",n.Unknown="Unknown",n))(Og||{}),Vg=(n=>(n.Two="2D",n.Three="3D",n))(Vg||{});function gl(n,t,e){var g,v,p,m,A;const i=(g=e==null?void 0:e.useCache)!=null?g:!0;if(!n)return(v=t.globalConfig)!=null?v:{};if(i){if((p=n==null?void 0:n.computedConfig)!=null&&p._isMerged)return n.computedConfig;if((m=n==null?void 0:n.config)!=null&&m._isMerged)return n.config}const s={},o={},r={};t.contentTypeConfig&&Object.entries(t.contentTypeConfig).forEach(([w,I])=>{var G,Q;const P=w,k=P.split("-"),M=w.startsWith("["),T=M?k[0].slice(1,-1):void 0,R=M?k.slice(1):k,Y=T?["PanoramaLike","ModelLike"].includes(T)?(G=o[T])!=null?G:o[T]={}:(Q=r[T])!=null?Q:r[T]={}:s;if(!Y[P]){if(R.length===0&&(Y[P]=I),R.length===1){const[W]=R;(n.contentType===W||W==="Any")&&(Y[P]=I)}if(R.length===2){const[W="Any",_="Any"]=R;W==="Mixin"&&n.contentType===_&&(Y[P]=I),(n.stickType===W||W==="Any")&&(n.contentType===_||_==="Any")&&(Y[P]=I)}if(R.length===3){const[W="Any",_,U]=R;if(_==="Audio"&&n.contentType==="Audio"){const F=n;(F.stickType===W||W==="Any")&&F.data.appearance===U&&(Y[P]=I)}}}});const a=(A=n.initialConfig)!=null?A:{},l=Qe({},jg,t.globalConfig,...Object.values(s)),c=Qe({},l,a),h={},u=Object.values(Xe.Five.Mode);Lg(o).forEach(([w,I])=>{u.forEach(P=>{(w==="PanoramaLike"&&Ui(P)||w==="ModelLike"&&Gt(P))&&(h[P]=Qe({},l,...Object.values(I),a,{_isMerged:!0}))})}),Lg(r).forEach(([w,I])=>{const P=h[w];h[w]=Qe({},l,P,...Object.values(I),a,{_isMerged:!0})});const f=ne(x({},c),{configWithFiveMode:h});return Tg(f),Object.values(h).forEach(w=>Tg(w)),f._isMerged=!0,f}function Bg(n){const t=n.split("?")[0].split(".").pop();return t?t.toLowerCase():""}function GE(n,t){if(!n)return 0;const e=n.observers;if(!t||!e)return console.error("getFloorIndex: invalid arguments: ",{point:t,observer:e}),0;const i=[];e.forEach(o=>{var a,l,c;const r=(l=(a=o.floorIndex)!=null?a:o.floor_index)!=null?l:0;i[r]||(i[r]=[]),i[r].push(vs(o.position,(c=n.options)==null?void 0:c.transform).y)});const s=i.map(o=>o.reduce((r,a)=>r+a,0)/o.length);for(let o=s.length-1;o>0;o--)if(t.y>=s[o])return o;return 0}class Rs{constructor(){d(this,"cache_raycasterDistance",new Map);d(this,"cache_visible",new Map)}clear(){this.cache_visible.clear(),this.cache_raycasterDistance.clear()}static generateCameraTagKey(t,e,i=3){const s=x(x({},e.five.getCurrentState()),t),o=s.mode==="Panorama"?e.workUtil.getObserverPosition(s.panoIndex):e.five.camera.position;return o?[o.x.toFixed(i),o.y.toFixed(i),o.z.toFixed(i),e.id].join(","):void 0}getVisible(t,e,i=1){const s=Rs.generateCameraTagKey(e,t,i);if(s)return this.cache_visible.get(s)}setVisible(t,e,i,s=1){const o=Rs.generateCameraTagKey(e,t,s);o&&this.cache_visible.set(o,i)}}function Rg(n){return new Promise(t=>{setTimeout(()=>{t()},n)})}const hr=new y.Raycaster;hr.params.Points.threshold=.1;class ml{constructor(t,e){d(this,"plugin");d(this,"id");d(this,"contentType");d(this,"stickType");d(this,"enabled");d(this,"config");d(this,"data");d(this,"state");d(this,"temporaryState",{visible:!0});d(this,"originPosition");d(this,"position");d(this,"fiveState");d(this,"model");d(this,"matrix");d(this,"screenPosition");d(this,"normal");d(this,"mediaPlane");d(this,"hooks");d(this,"zIndex");d(this,"play");d(this,"pause");d(this,"tag3DContentSvelte");d(this,"dom");d(this,"contentDom");d(this,"initialConfig");d(this,"computedConfig");d(this,"cache");d(this,"entryFromModel");var l,c,h,u;this.plugin=t;const i=qa(e);e.stickType=i;const s=JSON.parse(JSON.stringify(e.data)),o=(l=e.initialConfig)!=null?l:e.config?JSON.parse(JSON.stringify(e.config)):{};e.initialConfig=o;const r=gl(e,t.config),a=this.getConfig(e);e.config=a,this.id=(c=e.id)!=null?c:lt(),this.enabled=(h=e.enabled)!=null?h:!0,this.contentType=e.contentType,this.data=(u=a.initialData)!=null&&u.important?Qe(e.data,s,a.initialData):Qe(e.data,a.initialData,s),this.state=x({visible:void 0,unfolded:!this.can("fold")},a.initialState),this.originPosition=e.position,e.originPosition=this.originPosition,this.position=(()=>{const f=e.originPosition;if(!f)return;const g=t.workUtil.transform;return Array.isArray(f)&&f.length===4?f.map(Ge).map(v=>vs(v,g).toArray()):vs(Ge(f),g).toArray()})(),this.matrix=e.matrix?(()=>{const f=new y.Matrix4().fromArray(e.matrix);return f.premultiply(t.workUtil.transform),f.elements})():e.matrix,this.initialConfig=o,this.computedConfig=r,this.stickType=i,this.config=e.config,this.fiveState=e.fiveState,this.normal=e.normal,this.cache=new Rs,this.hooks=new ut,Object.keys(e).forEach(f=>{this[f]===void 0&&e[f]!==void 0&&(this[f]=e[f])})}get five(){return this.plugin.five}get fiveUtil(){return this.plugin.fiveUtil}get workUtil(){return this.plugin.workUtil}get centerPosition(){const t=Ja(this);return ei(...Array.isArray(t)?t:[t])}get currentConfig(){var s,o;const t=gl(this,this.plugin.config,{useCache:!0}),e=this.five.getCurrentState().mode,i=(s=t.configWithFiveMode)==null?void 0:s[e];return(o=i!=null?i:t)!=null?o:{}}get currentVisible(){return!(!this.plugin.state.enabled||!this.plugin.state.visible||!this.enabled||!this.state.visible)}get sharedCache(){return this.plugin.cache}applyVisible(){throw new Error("Method not implemented.")}find(t){return H(this,null,function*(){var s;const e=this.fiveState;if(!this.fiveState)return;const i=(s=t==null?void 0:t.targetMode)!=null?s:this.five.state.mode;if(i==="Panorama"){const o=e==null?void 0:e.panoIndex;if(mi(o))return;const r=this.workUtil.getObserverPosition(o),a=this.centerPosition.clone().sub(r).normalize();this.five.setState(x({mode:"Panorama",workCode:this.workUtil.workCode,panoIndex:o},Ps(a))),yield this.five.ready()}else i==="Mapview"&&(yield oh(this.five,this.centerPosition,t==null?void 0:t.pointConfig))})}blink(t){return H(this,null,function*(){var a,l;const e=(a=this.enabled)!=null?a:!0,i=(l=this.state)==null?void 0:l.visible,s=e&&i;s===!1&&(this.state.visible=!0,this.enabled=!0,this.applyVisible(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.plugin.render(),yield Rg(0),this.dom&&(this.dom.style.visibility="hidden"),this.contentDom&&(this.contentDom.style.visibility="hidden"));const o=(()=>{var h;const c=[];return c.push(this.dom),this.stickType!=="2DPoint"&&c.push(this.contentDom),c.push((h=this.model)==null?void 0:h.object),c.push(this.mediaPlane),c.filter(Boolean)})();if(!o.length)return;yield(s?wo:sh)(o,x({begin:()=>{s===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))},updateRender:()=>{this.five.needsRender=!0}},t)).finished,e===!1&&(this.enabled=!1),i===!1&&this.updateVisible(),s===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))})}unfold(){}unfoldAndFoldOthers(){}fold(){}enable(){this.enabled=!0,this.hooks.emit("enable"),this.applyVisible()}disable(){this.enabled=!1,this.hooks.emit("disable"),this.applyVisible()}changeData(t,e=!0){return this.setData(t,e)}changePosition(t){return this.setPosition(t)}setData(t,e=!0){e?this.data=Qe(this.data,t):this.data=x(x({},this.data),t),this.hooks.emit("dataChanged",this.data)}setPosition(t){throw new Error("Method not implemented.")}set(t,e=!0){this.plugin.tagsLengthWillUpdate=!0,e?Qe(this,t):Object.assign(this,t),this.cache.clear()}updateConfig(){var i;const t=this.getConfig(void 0,{useCache:!1});this.computedConfig=t;const e=this.getConfig();if(this.config=e,this.config.initialData){const s=JSON.parse(JSON.stringify(this.data));this.data=(i=e.initialData)!=null&&i.important?Qe(this.data,s,e.initialData):Qe(this.data,e.initialData,s)}this.cache.clear()}updateVisible(){this.state.visible=this.getVisible(),this.applyVisible()}updateZIndex(){const t=this.getDistance();this.zIndex=Math.round((1e4-(t!=null?t:0))*100)}getConfig(t,e){var r,a,l;const i=gl(t!=null?t:this,this.plugin.config,{useCache:e==null?void 0:e.useCache}),s=(r=e==null?void 0:e.fiveMode)!=null?r:this.five.getCurrentState().mode,o=(a=i.configWithFiveMode)==null?void 0:a[s];return(l=o!=null?o:i)!=null?l:{}}getDistance(t,e=3){const i=x(x({},this.five.getCurrentState()),t),{panoIndex:s,mode:o}=i,r=o==="Panorama"?this.workUtil.getObserverPosition(s):this.five.camera.position,a=this.centerPosition;return!r||!a?-1:r.distanceTo(a)}getVisible(t){if(!this.enabled||!this.plugin.state.enabled||!this.fiveUtil.model)return!1;const e=x(x({},this.five.getCurrentState()),t);let i=this.cache.getVisible(this,e);return mi(i)&&(i=this.computeVisible(e).value,this.cache.setVisible(this,e,i)),i}getUnfoldedByPanoIndex(t){if(!this.currentVisible)return;const i=this.computeUnfoldedByPanoIndex(t);return i&&this.getUnfoldedByCamera()}getUnfoldedByCamera(){return this.currentVisible?this.computeUnfoldedByCamera():void 0}can(t){const e=this.currentConfig;if(!e||typeof e!="object")return!0;if(t==="show"||t==="hide"){if(!e.visibleConfig||typeof e.visibleConfig!="object")return!0;if(t==="show"&&e.visibleConfig.keep==="hidden"||t==="hide"&&(e.visibleConfig.keep==="visible"||e.visibleConfig.alwaysShowWhenMovePano))return!1}if(t==="fold"||t==="unfold"){if(!e.unfoldedConfig||typeof e.unfoldedConfig!="object")return!0;if(t==="fold"&&e.unfoldedConfig.keep==="unfolded"||t==="unfold"&&e.unfoldedConfig.keep==="folded")return!1}return!0}onClick(t){}computeRenderType(){const t=(()=>{if(this.stickType==="3DPoint")return"Dom";const e=this.getConfig();if(!e||typeof e!="object"||!e.renderType)return;const i=this.data.mediaData;if(!(!i||i.length===0)&&e.renderType==="Mesh"){if(nP(this)){if(i.length===1){if(i[0].type==="Video")return navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1?"Dom":"Mesh";if(i[0].type==="Image")return Bg(i[0].url)==="gif"?"Dom":"Mesh"}}else if(oi(this))return i.length===1&&i[0].type==="Image"?Bg(i[0].url)==="gif"?"Dom":"Mesh":"BehindDom"}})();return t!=null?t:"Dom"}computeVisible(t){const e=x(x({},this.five.getCurrentState()),t),{panoIndex:i,mode:s}=e,o=[];return(()=>{var c,u,f;const l=(c=this.getConfig().visibleConfig)!=null?c:{};if(typeof l=="function")return{value:l(this.five,{tag:this,distance:this.getDistance(e,void 0)}),checkedList:o,reason:"config function result"};{if(l.keep==="hidden")return{value:!1,checkedList:o,reason:"config.keep is hidden"};if(l.keep==="visible")return{value:!0,checkedList:o,reason:"config.keep is visible"};const g=this.computeVisibleByFiveMode(l,s);if((g==null?void 0:g.value)===!1)return g;if(l.followModelVisibility===!0&&["poincare","aerophoto","sand"].includes(this.workUtil.fromType)&&(s==="Floorplan"||s==="Mapview")){const h=this.computeVisibleByFloorIndex(),{value:v}=h,p=fs(h,["value"]);if(v===!1)return x({value:!1,checkedList:o,reason:"followModelVisibility check failed"},p)}if(Ui(s)&&l.visiblePanoIndex!==void 0&&l.visiblePanoIndex!=="all"&&i!==void 0){if(o.push("visiblePanoIndex"),Array.isArray(l.visiblePanoIndex)&&!l.visiblePanoIndex.includes(i))return{value:!1,checkedList:o,reason:`current panoIndex is not included in visiblePano. currentPanoIndex: ${i}, visiblePanoIndex: ${l.visiblePanoIndex}`};if(l.visiblePanoIndex==="current"&&i!==((u=this.fiveState)==null?void 0:u.panoIndex))return{value:!1,checkedList:o,reason:`current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${i}, tag.panoIndex: ${(f=this.fiveState)==null?void 0:f.panoIndex}`}}if(l.visibleDistance!==void 0&&(o.push("visibleDistance"),l.visibleDistance!=="unLimited")){const v=this.getDistance(e,1);if(er(v,l.visibleDistance)===!1)return{value:!1,checkedList:o,panoIndex:i,visibleDistance:l.visibleDistance,reason:`distance is not in visibleDistance. distance: ${v}, visibleDistance: ${l.visibleDistance.min} - ${l.visibleDistance.max}`}}if(l.intersectRaycaster!==!1&&(typeof l.intersectRaycaster!="object"||l.intersectRaycaster.enabled!==!1)){if(o.push("intersectRaycaster"),i===void 0)return{value:!1,checkedList:o,reason:`intersectRaycaster check failed: panoIndex is ${i}`};const v=this.computeVisibleByIntersect(i);if(v.value===!1)return Object.assign(v,{checkedList:o})}return{value:!0,checkedList:o,reason:"all check passed"}}})()}computeVisibleByFiveMode(t,e){const i=()=>{var r,a;let o=typeof t.visibleFiveMode=="function"?t.visibleFiveMode(this):t.visibleFiveMode;if(o||(o=(a=(r=this.fiveState)==null?void 0:r.mode)!=null?a:this.workUtil.observers.length?"Panorama":"ModelLike"),Array.isArray(o))return o.includes(e);if(o==="ModelLike")return Gt(e);if(o==="PanoramaLike")return!Ui(e);if(o==="all")return!0;if(typeof o=="string")return o===e};if((()=>{var r;const o=i();if(ke((r=this.fiveState)==null?void 0:r.panoIndex)&&t.entryFromModel){if(Gt(e)&&o?this.entryFromModel=!1:this.entryFromModel=!0,Gt(e))return!0}else this.entryFromModel=!1;return o})()===!1)return{value:!1,reason:"current mode is not included in visibleFiveMode",visibleFiveMode:t.visibleFiveMode,mode:e}}computeVisibleByIntersect(t){var l,c,h,u;const e=nn(nn((l=this.getConfig().visibleConfig)!=null?l:{}).intersectRaycaster),i=t!=null?t:this.five.getCurrentState().panoIndex,s=Ui(this.five.getCurrentState().mode)?this.workUtil.getObserverPosition(i):this.five.camera.position;if(s===void 0)return{value:!1,reason:{type:"startPosition is undefined",fivePanoIndex:i}};const o=pi((()=>{var g;const f=(g=e.checkPoints)!=null?g:"center";return f==="center"?Yu(this):f==="corner"?Ja(this):Array.isArray(f)?f:[]})());let r=0,a=0;for(const f of o){const g=new y.Vector3().subVectors(f,s).normalize();let v;hr.set(s,g);const[p]=this.fiveUtil.model.intersectRaycaster(hr);v=p==null?void 0:p.distance;const m=(()=>{if(!oi(this))return;const k=this.plugin.tags.filter(oi).map(T=>{var R;return(R=T.model)==null?void 0:R.object}).filter(ke),[M]=hr.intersectObjects(k,!0);return M})(),A=s.distanceTo(f),w=(c=e.distanceAccuracy)!=null?c:.01;v=Math.min(v!=null?v:1/0,(h=m==null?void 0:m.distance)!=null?h:1/0),v+w>=A?r++:a++;const P=(u=e.needPassed)!=null?u:1;if(r>=P)return{value:!0}}return a===0?{value:!0}:{value:!1,reason:{type:"intersectRaycaster check failed",passedCount:r,needPassed:e.needPassed,model:this.fiveUtil.model.name}}}computeVisibleByFloorIndex(){var s,o,r,a,l,c,h;let t=0;const e=(s=this.fiveState)==null?void 0:s.panoIndex;e!==void 0?t=(o=this.workUtil.getObserver(e))==null?void 0:o.floorIndex:t=GE(this.workUtil.work,(h=(c=(a=(r=this.model)==null?void 0:r.object)==null?void 0:a.position)!=null?c:(l=this.mediaPlane)==null?void 0:l.position)!=null?h:Yu(this));const i=this.fiveUtil.model.shownFloor;return{value:i===null||i===t,currentFiveFloorIndex:i,tagFloorIndex:t}}computeUnfoldedByPanoIndex(t){const e=this.getConfig().unfoldedConfig;if(e){if(typeof e=="function")return e(this.five,{tag:this,distance:this.getDistance({panoIndex:t})});if(e.keep==="folded")return!1;if(e.keep==="unfolded")return!0;if(e.unfoldDistance&&er(this.getDistance({panoIndex:t}),e.unfoldDistance)===!1)return!1}}computeUnfoldedByCamera(){var e;if(this.entryFromModel&&Gt(this.five.state.mode))return!1;const t=this.getConfig().unfoldedConfig;if(t){if(typeof t=="function")return t(this.five,{tag:this,distance:this.getDistance()});if(t.keep==="folded")return!1;if(t.keep==="unfolded")return!0;if(t.autoUnfold===void 0||t.autoUnfold===!1||t.autoUnfold.enable===!1||!t.autoUnfold.strategy)return;if(t.autoUnfold.strategy==="ScreenPostion"){const i=this.computeTagProject();if(i&&er(i.x,t.autoUnfold.autoUnfoldProjectX)===!1)return!1}if(t.autoUnfold.strategy==="MinimumDistance"){const o=this.plugin.filterPointTag.filter(a=>a.currentVisible).filter(a=>{const l=this.computeTagProject();if(!l)return!1;const{x:c,y:h,z:u}=l;return!(Math.abs(u)>1||Math.abs(c)>1||Math.abs(h)>1)}).map(a=>({tag:a,id:a.id,tagConfig:a.getConfig().unfoldedConfig})).filter(({tagConfig:a})=>{var l,c;return!(typeof a=="function"||a.keep||a.autoUnfold===!1||((l=a.autoUnfold)==null?void 0:l.enable)===!1||((c=a.autoUnfold)==null?void 0:c.strategy)!=="MinimumDistance")}).map(a=>ne(x({},a),{distance:a.tag.getDistance()})).filter(({distance:a,tagConfig:l})=>{const c=l.autoUnfold.distance;return!(c&&er(a,c)===!1)}).sort((a,l)=>a.distance-l.distance).findIndex(a=>a.id===this.id);if(o===-1||o<=((e=t.autoUnfold.maxNumber)!=null?e:1)-1===!1)return!1}return t.autoUnfold.strategy!=="FoldWhenMove"}}computeTagProject(){const t=this.centerPosition;if(!t)return;const{x:e,y:i,z:s}=t.project(this.five.camera);if(!(s>1))return{x:e,y:i,z:s}}addObjectClickHandler(t,e,i){if(!e||!this.plugin.domEvents)return()=>{};const s=()=>!(!t.currentVisible||t.loading),o=r=>{if(!s())return!1;i(r.origDomEvent)};return this.plugin.domEvents.addEventListener(e,"click",o),()=>{var r;(r=this.plugin.domEvents)==null||r.removeEventListener(e,"click",o)}}whyHide(){var e;if(!this.plugin.state.enabled)return{reason:`plugin.state.enabled is ${this.plugin.state.enabled}`};if(!this.plugin.state.visible)return{reason:`plugin.state.visible is ${this.plugin.state.visible}`};if(!this.enabled)return{reason:`tag ${this.id} enabled is: ${this.enabled}`};const t=ne(x({},this.computeVisible()),{tagInstance:this});return t.value!==this.state.visible?{reason:"插件故障,请联系维护人员, err: 0",info:t}:this.state.visible?{reason:"应该是能看见才对",info:t}:t.value===!0?{reason:"插件故障,请联系维护人员, err: 1",info:t}:{reason:(e=t.reason.type)!=null?e:t.reason,info:t}}destroy(){this.disable(),this.hooks.off(),this.cache.clear();const t=this.plugin.tags.findIndex(e=>e.id===this.id);t!==-1&&(this.plugin.tags.splice(t,1),this.plugin.tagsLengthWillUpdate=!0,this.plugin.hooks.emit("tagsLengthChange"))}}class Fg extends ml{constructor(e,i){super(e,i);d(this,"loading",!1);d(this,"loadModel",()=>H(this,null,function*(){var r;const e=this.data.modelUrl;if(!e)return;this.loading=!0;const i=VE(e).then(a=>H(this,null,function*(){var h;const l=Object.assign(a.scene,{customID:this.id,isTagModel:!0,removeEventListener:this.getConfig().clickable===!1?()=>{}:this.addObjectClickHandler(this,a.scene,u=>{this.plugin.hooks.emit("click",{target:"TagModel",tag:this,event:u})})});return l.visible=this.currentVisible,new y.Matrix4().fromArray(this.matrix).decompose(l.position,l.quaternion,l.scale),l.updateWorldMatrix(!0,!0),l.visible=yield this.getVisible(),(h=this.getConfig().modelConfig)!=null&&h.autoLookAtEnabled&&l.lookAt(this.five.camera.position.clone().setY(l.position.y)),l}));this.model={promise:i};const s=yield i;if(this.loading=!1,((r=this.model)==null?void 0:r.promise)!==i||!this.plugin.tags.includes(this))return;this.model.object=s;const o=this.plugin.gltfObjectGroup.children.find(a=>a.customID===this.id);if(o&&(this.plugin.gltfObjectGroup.remove(o),o.removeEventListener()),this.plugin.updateRender3DDomTag(),oi(this)){if(this.computeRenderType()==="Mesh"&&!this.mediaPlane){const a=this.data.mediaPosition.map(xi);this.mediaPlane=new Dg(this.data.mediaData[0].url,this.data.mediaPosition.map(xi),{objectFit:this.data.objectFit});const l=new y.Vector3().addVectors(a[0],a[2]).divideScalar(2);this.mediaPlane.position.copy(l),s.add(this.mediaPlane)}this.computeRenderType()!=="Mesh"&&(s.updateTagCss3DObjectMatrix=()=>this.plugin.updateTagCss3DObjectMatrix(this,s),s.updateTagCss3DObjectMatrix())}return this.plugin.gltfObjectGroup.add(s),s}));this.state.unfolded=!0}applyVisible(){var e,i,s;(e=this.model)!=null&&e.object&&(this.model.object.visible=this.currentVisible),(i=this.tag3DContentSvelte)==null||i.svelteApp.$set({tag:this,state:this.plugin.state}),(s=this.tag3DContentSvelte)==null||s.css3DInstance.setVisible(this.currentVisible)}computeNormal(){return Uu(this.data.mediaPosition)}}function QE(n){me(n,"svelte-elzzn6",'@font-face{font-family:"TG-TYPE";font-style:normal;font-weight:400;src:local("TG-TYPE-Bold"), url(data:application/font-woff2;charset=utf-8;base64,T1RUTwAKAIAAAwAgQ0ZGINFD4CEAAAaQAAAHC0dTVUIAAQAAAAANnAAAAApPUy8yaB5pEwAAAjQAAABgY21hcEItjGUAAAT0AAABfGhlYWQS1WWOAAAAtAAAADZoaGVhBfMBxwAAAhAAAAAkaG10eJ9gBO8AAADsAAABJG1heHAASVAAAAAArAAAAAZuYW1lqczkZQAAApQAAAJecG9zdP+4ADIAAAZwAAAAIAAAUAAASQAAAAEAAAABAADkeHeyXw889QADA+gAAAAA2NoRKwAAAADY2hErACn/OAHgAyAAAQADAAIAAAAAAAAB9ABdAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACWAAAAlgAAAJYAAACCAA7AcwAdwIIADMCCAA0AhwAMwISADkCCAAuAfQANAH+ACsB/gApAggANAEeAFABHgBQAR4AUAIIADQCCAAuAR4AUAEeAFABfAAxAAEAAAPo/zgAAAIcACkAKQHgAAEAAAAAAAAAAAAAAAAAAABJAAMCLgGQAAUACAKKAlgAAABLAooCWAAAAV4AMgEsAAAAAAgAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFVLV04AIAAg/xsDIP84AMgD6ADIAAAAAQAAAAAB9AK8AAAAIAAAAAAAEADGAAEAAAAAAAEADAAAAAEAAAAAAAIABAAMAAEAAAAAAAMAGwAQAAEAAAAAAAQAEQArAAEAAAAAAAUAPAA8AAEAAAAAAAYAEAB4AAEAAAAAAAgADAAAAAEAAAAAAAkADAAAAAMAAQQJAAEAGACIAAMAAQQJAAIACACgAAMAAQQJAAMANgCoAAMAAQQJAAQAIgDeAAMAAQQJAAUAeAEAAAMAAQQJAAYAIAF4AAMAAQQJAAgAGACIAAMAAQQJAAkAGACIQUxJQkFCQSBGb250Qm9sZDEuMDAwO1VLV047QUxJQkFCQUZvbnQtQm9sZEFMSUJBQkEgRm9udCBCb2xkVmVyc2lvbiAxLjAwMDtQUyAwMDEuMDAwO2hvdGNvbnYgMS4wLjg4O21ha2VvdGYubGliMi41LjY0Nzc1QUxJQkFCQUZvbnQtQm9sZABBAEwASQBCAEEAQgBBACAARgBvAG4AdABCAG8AbABkADEALgAwADAAMAA7AFUASwBXAE4AOwBBAEwASQBCAEEAQgBBAEYAbwBuAHQALQBCAG8AbABkAEEATABJAEIAQQBCAEEAIABGAG8AbgB0ACAAQgBvAGwAZABWAGUAcgBzAGkAbwBuACAAMQAuADAAMAAwADsAUABTACAAMAAwADEALgAwADAAMAA7AGgAbwB0AGMAbwBuAHYAIAAxAC4AMAAuADgAOAA7AG0AYQBrAGUAbwB0AGYALgBsAGkAYgAyAC4ANQAuADYANAA3ADcANQBBAEwASQBCAEEAQgBBAEYAbwBuAHQALQBCAG8AbABkAAAAAAADAAAAAwAAASIAAQAAAAAAHAADAAEAAAEiAAABBgAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAABCSEMANjc4OTo7PD0+PwAAAAAAAAACAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGwAAAAAAABwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAFoAAAAQABAAAwAAACAALgA5AFoAegCl/xv//wAAACAALAAwAEEAYQCl/xr////hAAAABv/B/7v/nwAAAAEAAAAOAAAAAAAAAAAACgAAAEIASABDAEYARwADAAAAAAAA/7UAMgAAAAAAAAAAAAAAAAAAAAAAAAAAAQAEAgABAQERQUxJQkFCQUZvbnQtQm9sZAABAQEg+A8A+CAB+CEC+BgEtPtc+HT5tAX3KA/3UBGcHAZWEgAHAQENExoiKTpLbmluZS4wMDEuMDAxbW9uZXkudW5pRkYxQm5pbmUuMDAxdW5pRkYxQWNvcHlyaWdodCBtaXNzaW5nQUxJQkFCQSBGb250IEJvbGQAAAEAAQAAIhkAQhkAEQkBhwABigAADQAADwAAZAABiAABiwABiQAADgAASQIAAQCtAK4ArwCwALEAsgCzALQAtQC2ALcAuAC5ALoAuwC8AL0AvgC/AMAAwQDCAMMAxADFAMYAxwDIAMkAygDLAMwAzQDOAM8A0ADRANIA0wDUANUA1gDXANgA2QDaANsA3ADdAN4A3wDgAOEA4gFDAVoBqwIsAloCuAMcAzkDzwQ4BDoEPARRBFMEVQTNBOIE8QUEmPtc0Ky6rKKsuqzHrKPDoa2irLCspq2vraWssKzOAejVrKytrKzYA/gu+bQV+9H+fPfRBj76ORVqSWbNavs6rM2wSqwH7vsVFUXNafs68wfNaRVqZ6wG704VaklFJ6zNsEmsB/c6TxUn+zqt9xnNB6z7DhX7Bfs69wWsO++6anRpwwfv+0EV+wX7OvcFB/cZahUnXO8GrFMVamsHRVwF8Wr7OqwG0boFRawGDg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4OrIr5UQH3OPdUA/ebihVmaZSdbB9Mr2TL0xr3vgewlK2eqh7Kr86y1BuvrIJ5qh/HZrJIQhr7vgdngmp5bR5OZ0tkQxv46ARUX2FSH/u+B1a5YMDAs7TCHve+B8RjtVYeDnD4utkB93HzA/cL+QgVPfH8vPP5UgcOrIn5UgG++DYD+GmJFfw28wb3svfUBZ2glKSnGsNduFBWXF1UiB4ijgaMsJWsnqoIyLHMstYbsa6Ceawfy2ezSUAaVndXZ2Me+2/7jQX3pwYOrIvy92Tz90ryEr/zM/L3SvMu8hPy+B/3/xUT7LCwpMDDGq6CrHqoHsZnTK5DG2lrg3puH09pZk5EGobykAe4tba6vrViXFZiYlcedyOfBhPyxLpdUlJcW1JSXLvEH5ojfAdllGiebB5LsM5j1xuwrpSeqx/KsLPO1xrKcMNerx4OwPL1Affi8gP4dPdlFWD4fPshBvuJ/HkF+wH3ryPy87YH+8z1Ffc69+QF++QHDrb3ZNf3ZfAB9zX3YwP3nRZlaJSebB9LsGPO1xrzBlK6XMTEubrEHtcHxF26UlJcXFIeI/g0+BYh+677JAaorK2ZsBuwroJ4qx/LZrNHPxo/B2aCaHhrHktmR2NAGw6si/X3b/IBufX3b/ID95n4QBWAg4uKhh/3EfelBfsHBvtK/CMFfnCFbm0aZJVnnmoeSrLPYdobsq6Vnqwfy7K10dgasoGueKwey2RHtT4b+9YETlu7yMe8vcfHvVlPT1laTx8OmIr5UQG/+B8D93iKFfsIBvdo+OYF+6T2+B8oBg6iifL3bPX3QPEStvNB8vc/8jXxE/L4EvgHFRPss7Cnu78arYOreqgexWpNr0YbaWyDem4fUmlmTUcaXqBftGAeE/JWYmROSxpklWieax5Ksc9i2BuxrpWerB/LsbTP2BrHaMVath4T7PsN93QVu7FjXFtlZltcZbC7urGzuh8T8oX8ghVPW7zHx7q6yMa9W1BPWVpQHw6i96Tz92/0AbTz93DzA/hp+HkVsIGveKwezmNFtUAbZGeBeGofSmNiRT8aZJVnnmseSrHPYtoboAb7EvukBfcHBvdL+CEFmaySqaQa+9gWxry+yJ6dhoGcHq12oWZmGk5YW1BMXLnKHg4gCiEK+11L91IlCvdiyhWtb6hpJgoeJAoOIQogCqz3pe/3b/UBufX3bfQD+G74dxWyga94rB7NZEW0PhtlaIF4ah9KY2FFPxo7tkTPZh6MjIqKjB+TiJCIjYoIjgaCoKGHoRuanY6QoB+IgfsB+6QF9wcG9y/4IgWYppGnqhr7a/sCFVBbvMjHu7zGyLxbTk5aWk4fDvtd+AojCoz7jBUmCh8kCq1vqGkeDvtdi/cS94wjCvwKBCIKDiD3ru8BvPeuA7z4EhUn967vBw4eoDf/DAmLDAv47BT4exWcEwAHAQFBXW97ipCarPcv8+7yAfdl8gP4aPf6FfIjB+r3gwUiBi77gwWHBjH3gwUkBuP7gwUnJPcxKPsxI/cx+y/y9y/3MPP7MO4GDvtdi/cSJQr3JBZkcqOzsKSksrCkcWdlcnFmHw6up6eurm+naGhvb2hop2+uHwv3EiUK9yP4ChUiCgt3SgWxBrnmBZGVj5eZGgsB2/cSAwtobm5paqBzqoYLAAABAAAAAAAAAAAAAA==) format("woff2")}*{-webkit-tap-highlight-color:transparent}.content__container.svelte-elzzn6{position:relative;left:50%;top:50%;transform:translate(-50%, -50%);font-family:PingFangSC, Segoe UI, Rototo, sans-serif;transition:opacity 0.2s linear}.content__container.unClickable.svelte-elzzn6{pointer-events:none !important}.content__container.unClickable.svelte-elzzn6 *{pointer-events:none !important}.content__wrapper.svelte-elzzn6{pointer-events:none;width:100%;height:100%}.content__container.hide.svelte-elzzn6{opacity:0;pointer-events:none}.content__container.hide.svelte-elzzn6 *{pointer-events:none !important}.content__container.disable.svelte-elzzn6{display:none}.content.svelte-elzzn6{position:relative;width:100%;height:100%;font-size:0.75rem;color:#fff}.content.svelte-elzzn6:not(.unfolded){pointer-events:none}.content.svelte-elzzn6:not(.unfolded) *{pointer-events:none !important}.content.unfolded.svelte-elzzn6{pointer-events:auto}')}function WE(n){let t,e;return{c(){t=S("div"),C(t,"data-info","tag content is keep folded"),C(t,"data-id",e=n[0].id)},m(i,s){O(i,t,s)},p(i,s){s&1&&e!==(e=i[0].id)&&C(t,"data-id",e)},i:K,o:K,d(i){i&&z(t)}}}function HE(n){let t,e,i,s,o,r,a,l,c,h,u,f,g,v,p,m,A;const w=[$E,KE,qE,JE,ZE,XE,YE],I=[];function P(k,M){return M&9&&(s=null),M&9&&(o=null),M&9&&(r=null),M&9&&(a=null),M&9&&(l=null),M&9&&(c=null),M&9&&(h=null),s==null&&(s=!!(["Text"].includes(k[0].contentType)||["Text"].includes(k[3].get(k[0].contentType)))),s?0:(o==null&&(o=!!(["ImageText","Image","Video"].includes(k[0].contentType)||["ImageText","Image","Video"].includes(k[3].get(k[0].contentType)))),o?1:(r==null&&(r=!!(["Audio"].includes(k[0].contentType)||["Audio"].includes(k[3].get(k[0].contentType)))),r?2:(a==null&&(a=!!(["Marketing"].includes(k[0].contentType)||["Marketing"].includes(k[3].get(k[0].contentType)))),a?3:(l==null&&(l=!!(["Link","VRLink","PanoLink","Sticker"].includes(k[0].contentType)||["Link","VRLink","PanoLink","Sticker"].includes(k[3].get(k[0].contentType)))),l?4:(c==null&&(c=!!(["MediaPlane","MediaModel"].includes(k[0].contentType)||["MediaPlane","MediaModel"].includes(k[3].get(k[0].contentType)))),c?5:(h==null&&(h=!!(["Panorama"].includes(k[0].contentType)||["Panorama"].includes(k[3].get(k[0].contentType)))),h?6:-1))))))}return~(u=P(n,-1))&&(f=I[u]=w[u](n)),{c(){var k;t=S("div"),e=S("div"),i=S("div"),f&&f.c(),C(i,"class","content svelte-elzzn6"),ie(i,"unfolded",(k=n[0].state)==null?void 0:k.unfolded),C(e,"class","content__wrapper svelte-elzzn6"),C(t,"class",g=tt(Tt("content__container",n[0].className))+" svelte-elzzn6"),C(t,"data-id",v=n[0].id),ie(t,"disable",n[0].enabled===!1),ie(t,"hide",n[5]),ie(t,"unClickable",n[0].config.clickable===!1),L(t,"width",n[0].stickType==="Plane"||n[0].contentType==="MediaModel"?"100%":0),L(t,"height",n[0].stickType==="Plane"||n[0].contentType==="MediaModel"?"100%":0)},m(k,M){O(k,t,M),j(t,e),j(e,i),~u&&I[u].m(i,null),n[16](t),p=!0,m||(A=Ce(t,"click",n[17],!0),m=!0)},p(k,M){var R;let T=u;u=P(k,M),u===T?~u&&I[u].p(k,M):(f&&(fe(),V(I[T],1,1,()=>{I[T]=null}),ge()),~u?(f=I[u],f?f.p(k,M):(f=I[u]=w[u](k),f.c()),D(f,1),f.m(i,null)):f=null),(!p||M&1)&&ie(i,"unfolded",(R=k[0].state)==null?void 0:R.unfolded),(!p||M&1&&g!==(g=tt(Tt("content__container",k[0].className))+" svelte-elzzn6"))&&C(t,"class",g),(!p||M&1&&v!==(v=k[0].id))&&C(t,"data-id",v),(!p||M&1)&&ie(t,"disable",k[0].enabled===!1),(!p||M&33)&&ie(t,"hide",k[5]),(!p||M&1)&&ie(t,"unClickable",k[0].config.clickable===!1),M&1&&L(t,"width",k[0].stickType==="Plane"||k[0].contentType==="MediaModel"?"100%":0),M&1&&L(t,"height",k[0].stickType==="Plane"||k[0].contentType==="MediaModel"?"100%":0)},i(k){p||(D(f),p=!0)},o(k){V(f),p=!1},d(k){k&&z(t),~u&&I[u].d(),n[16](null),m=!1,A()}}}function UE(n){let t,e,i,s,o,r,a;return e=new zE({props:{tag:Ke(n[0]),rendererMap:n[2]}}),{c(){t=S("div"),re(e.$$.fragment),C(t,"class",i=tt(Tt("content__container",n[0].className))+" svelte-elzzn6"),C(t,"data-id",s=n[0].id),ie(t,"custom-tag-disable",n[0].enabled===!1),ie(t,"custom-tag-hide",n[5])},m(l,c){O(l,t,c),se(e,t,null),n[14](t),o=!0,r||(a=Ce(t,"click",n[15]),r=!0)},p(l,c){const h={};c&1&&(h.tag=Ke(l[0])),c&4&&(h.rendererMap=l[2]),e.$set(h),(!o||c&1&&i!==(i=tt(Tt("content__container",l[0].className))+" svelte-elzzn6"))&&C(t,"class",i),(!o||c&1&&s!==(s=l[0].id))&&C(t,"data-id",s),(!o||c&1)&&ie(t,"custom-tag-disable",l[0].enabled===!1),(!o||c&33)&&ie(t,"custom-tag-hide",l[5])},i(l){o||(D(e.$$.fragment,l),o=!0)},o(l){V(e.$$.fragment,l),o=!1},d(l){l&&z(t),oe(e),n[14](null),r=!1,a()}}}function YE(n){let t,e;return t=new DE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function XE(n){let t,e;return t=new lE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function ZE(n){let t,e;return t=new ME({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function JE(n){let t,e;return t=new OM({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function qE(n){let t,e;return t=new sE({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function KE(n){let t,e;return t=new LM({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function $E(n){let t,e;return t=new JP({props:{tag:Ke(n[0])}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=Ke(i[0])),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function e3(n){let t,e,i,s,o;const r=[UE,HE,WE],a=[];function l(c,h){return h&5&&(t=null),t==null&&(t=!!(c[0].element||c[2].has(c[0].contentType))),t?0:c[4]?1:2}return e=l(n,-1),i=a[e]=r[e](n),{c(){i.c(),s=Ee()},m(c,h){a[e].m(c,h),O(c,s,h),o=!0},p(c,[h]){let u=e;e=l(c,h),e===u?a[e].p(c,h):(fe(),V(a[u],1,1,()=>{a[u]=null}),ge(),i=a[e],i?i.p(c,h):(i=a[e]=r[e](c),i.c()),D(i,1),i.m(s.parentNode,s))},i(c){o||(D(i),o=!0)},o(c){V(i),o=!1},d(c){a[e].d(c),c&&z(s)}}}function t3(n,t,e){let i,s,o,r,a,l,{tag:c}=t,{hooks:h}=t,{rendererMap:u=new Map}=t,{contentTypeMap:f=new Map}=t,{state:g}=t,{mediaStore:v}=t,{temporaryState:p}=t;pa("hooks",h),pa("mediaStore",v);let m,A;function w(R){R?h.emit("exposure",{id:r,type:"start"}):h.emit("exposure",{id:r,type:"end"})}function I(R,Y,G){var Q,W;return!(!Y.visible||!Y.enabled||!G.visible||!((Q=R.state)!=null&&Q.visible)||((W=R.temporaryState)==null?void 0:W.visible)===!1||R instanceof Fg&&R.loading)}function P(R){Ue[R?"unshift":"push"](()=>{c.contentDom=R,e(0,c)})}const k=R=>h.emit("click",{event:R,target:"TagContent",tag:c});function M(R){Ue[R?"unshift":"push"](()=>{c.contentDom=R,e(0,c)})}const T=R=>{c.entryFromModel&&Gt(c.five.state.mode)?(R.stopPropagation(),c.find({targetMode:"Panorama"})):h.emit("click",{event:R,target:"TagContent",tag:c})};return n.$$set=R=>{"tag"in R&&e(0,c=R.tag),"hooks"in R&&e(1,h=R.hooks),"rendererMap"in R&&e(2,u=R.rendererMap),"contentTypeMap"in R&&e(3,f=R.contentTypeMap),"state"in R&&e(6,g=R.state),"mediaStore"in R&&e(7,v=R.mediaStore),"temporaryState"in R&&e(8,p=R.temporaryState)},n.$$.update=()=>{var R,Y,G,Q,W,_,U,F,X,J,q;n.$$.dirty&1&&e(12,i=(R=c.state)==null?void 0:R.unfolded),n.$$.dirty&1&&e(11,s=(Y=c.state)==null?void 0:Y.visible),n.$$.dirty&321&&e(13,o=g.visible&&p.visible&&((G=c.state)==null?void 0:G.visible)),n.$$.dirty&1&&(r=c.id),n.$$.dirty&321&&e(5,a=!I(c,g,p)),n.$$.dirty&8192&&w(o),n.$$.dirty&7681&&c.hooks&&(i!==void 0&&i!==A&&(e(10,A=i),i?(W=(Q=c.hooks).emit)==null||W.call(Q,"unfolded"):(U=c==null?void 0:(_=c.hooks).emit)==null||U.call(_,"folded")),s!==void 0&&s!==m&&(e(9,m=s),s?(X=(F=c.hooks).emit)==null||X.call(F,"show"):(q=(J=c.hooks).emit)==null||q.call(J,"hide"))),n.$$.dirty&1&&e(4,l=(()=>!(typeof c.config.unfoldedConfig=="object"&&c.config.unfoldedConfig.keep==="folded"))())},[c,h,u,f,l,a,g,v,p,m,A,s,i,o,P,k,M,T]}let Ng=class extends ue{constructor(t){super(),de(this,t,t3,e3,he,{tag:0,hooks:1,rendererMap:2,contentTypeMap:3,state:6,mediaStore:7,temporaryState:8},QE)}};const i3={globalConfig:{visibleConfig:{followModelVisibility:!0},unfoldedConfig:{autoUnfold:{enable:!0,strategy:"MinimumDistance",distance:{max:5}}},tag3DConfig:{ratio:.0035}},contentTypeConfig:{"[Mapview]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"[Floorplan]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"Any-Audio-plane":{unfoldedConfig:{keep:"unfolded"}},Link:{unfoldedConfig:{keep:"unfolded"}},Panorama:{unfoldedConfig:{keep:"unfolded"}},VRLink:{unfoldedConfig:{keep:"unfolded"}},PanoLink:{unfoldedConfig:{keep:"unfolded"}},MediaPlane:{unfoldedConfig:{keep:"unfolded"},visibleConfig:{alwaysShowWhenMovePano:!0},initialData:{autoplayConfig:{autoplayCarousel:!0,autoplayVideo:!1,autoplayVideoInCarousel:!1}}},"Model-Any":{unfoldedConfig:{keep:"unfolded"},visibleConfig:{visibleFiveMode:"all",alwaysShowWhenMovePano:!0}}}};class n3 extends Di{constructor(e){super(e);d(this,"tags",[]);d(this,"cache",new Rs);d(this,"config",i3);d(this,"renderQueue",new Map);d(this,"params");d(this,"mediaStore",ka({currentMediaElement:null}));d(this,"store",{disposers:[],disposed:!1,resizeObserverDisposerAdding:!1,css3DRenderDisposer:new Map});d(this,"domEvents",new sa(this.five));d(this,"_cache_pointTag");d(this,"_cache_2DPointTag");d(this,"_cache_css3DTag");d(this,"_container",null);d(this,"_css3DRenderPlugin");d(this,"whyHide",e=>{const i=this.getTagById(e);return i?i.whyHide():{reason:`tag ${e} not found`}});d(this,"loadVideoFirstFrame",()=>{FE&&this.hooks.emit("loadVideoFirstFrame")});this.mediaStore.subscribe(({currentMediaElement:i})=>{this.tags.forEach(s=>{var o;if(s.mediaPlane instanceof Sg&&i!==s.mediaPlane.videoInstance){if(!((o=s.mediaPlane.videoInstance)!=null&&o.src)||i===s.mediaPlane.videoInstance)return;s.mediaPlane.pause()}})})}get container(){var e;return this._container||((e=this.five.getElement())==null?void 0:e.parentElement)}set container(e){this._container=e}set tagsLengthWillUpdate(e){e&&(this._cache_pointTag=this.tags.filter(i=>i.stickType==="2DPoint"||i.stickType==="3DPoint").filter(i=>i.position),this._cache_2DPointTag=this.tags.filter(i=>i.stickType==="2DPoint").filter(i=>i.position),this._cache_css3DTag=this.tags.filter(i=>i.stickType==="3DPoint"||i.stickType==="Plane"||i.stickType==="Model"&&i.contentType==="MediaModel").filter(i=>{const s=i.computeRenderType();return s==="BehindDom"||s==="Dom"}))}get css3DRenderPlugin(){var e,i,s;if(!this._css3DRenderPlugin){const o=ks(this.five);this._css3DRenderPlugin=o,(e=o.frontModeCSS3DRenderer)!=null&&e.domElementWrapper&&(o.frontModeCSS3DRenderer.domElementWrapper.style.zIndex=(s=(i=this.params.containerZIndex)==null?void 0:i.toString())!=null?s:"")}return this._css3DRenderPlugin}get filterPointTag(){var e;return(e=this._cache_pointTag)!=null?e:[]}get filter2DPointTag(){var e;return(e=this._cache_2DPointTag)!=null?e:[]}get filterCSS3DTag(){var e;return(e=this._cache_css3DTag)!=null?e:[]}addRenderQueue(e){var r,a;const{type:i,keys:s=[],tags:o=[]}=e;this.renderQueue.has(i)?this.renderQueue.set(i,{keys:Array.from(new Set([...(r=this.renderQueue.get(i).keys)!=null?r:[],...s])),tags:Array.from(new Set([...(a=this.renderQueue.get(i).tags)!=null?a:[],...o]))}):this.renderQueue.set(i,{keys:s,tags:o})}getTagById(e){const i=this.tags.find(s=>s.id===e);if(!i){console.warn(`getTagById Error: can't find tag id: ${e}`);return}return i}pauseCurrentMedia(){this.mediaStore.set({currentMediaElement:null})}getPositions(e){if(eP(e))return e.position;if(oi(e))return e.data.mediaPosition;if(tP(e))return sP(this.five.camera.position,Ge(e.position),Ge(e.normal))}addObjectClickHandler(e,i,s){if(!i||!this.domEvents)return()=>{};const o=()=>!(!e.currentVisible||e.loading),r=a=>{if(!o())return!1;s(a.origDomEvent)};return this.domEvents.addEventListener(i,"click",r),()=>{var a;(a=this.domEvents)==null||a.removeEventListener(i,"click",r)}}checkDisposed(){return this.store.disposed?(console.error("PanoTagPluginController has been disposed"),!0):!1}}class s3 extends n3{constructor(e){super(e);d(this,"rendererMap",new Map);d(this,"contentTypeMap",new Map);d(this,"group",new N.Group);d(this,"imagePlaneGroup",new N.Group);d(this,"gltfObjectGroup",new N.Group);d(this,"enabledModelTagSet",new Set);d(this,"temporaryState",{visible:!0});d(this,"TagContainerSvelte");this.group.name="PanoTagPluginModelGroup",this.gltfObjectGroup.name="PanoTagPluginGLTFObjectGroup",this.imagePlaneGroup.name="ImagePlaneGroup",this.group.add(this.gltfObjectGroup),this.group.add(this.imagePlaneGroup)}registerRenderer(e,i,s){var o;this.rendererMap.set(e,{renderer:i,usePoint:(o=s==null?void 0:s.usePoint)!=null?o:!1})}bindRenderer(e,i){this.contentTypeMap.set(e,i)}clearTags(){var e;this.tags.length&&(this.tags.forEach(i=>{var s,o;(o=(s=i.mediaPlane)==null?void 0:s.parent)==null||o.remove(i.mediaPlane)}),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(e=this.TagContainerSvelte)==null||e.$destroy(),this.TagContainerSvelte=void 0,this.disposeAllCSS3DContainer()),this.enabledModelTagSet.clear(),this.cache.clear()}updateRender3DDomTag(e){(e?pi(e):this.filterCSS3DTag).forEach(s=>{var o,r,a,l,c,h;if(s.tag3DContentSvelte){const{svelteApp:u,css3DInstance:f,initialNormal:g,currentNormal:v}=s.tag3DContentSvelte;if((r=f==null?void 0:f.css3DObject)==null||r.setVisible((this.state.visible&&((o=s.state)==null?void 0:o.visible))!==!1),u.$set({tag:s,hooks:this.hooks,state:this.state,temporaryState:this.temporaryState}),!g.equals(v)){const p=new N.Quaternion().setFromUnitVectors(g,v);f.css3DObject.setRotationFromQuaternion(p)}return}else{if(oi(s)&&!((a=s.model)!=null&&a.object)||((l=s.state)==null?void 0:l.visible)===!1||!this.state.visible||!this.state.enabled||!this.css3DRenderPlugin)return;if(s.stickType==="3DPoint"&&!s.normal)return console.error("updateRenderPlaneTag: 三维点标签缺少法向量!");const u=this.getPositions(s);if(!u)return;const f=s.computeNormal();if(!f)return;const g=s.getConfig(),v=x({wrapperStyle:{zIndex:`${Math.round((1e4-((c=s.getDistance())!=null?c:0))*100)}`}},g.tag3DConfig);if(s.computeRenderType()==="BehindDom"||v.mode==="behind"){v.mode="behind",v.container=document.createElement("div");const A="black";v.container.style.backgroundColor=A,v.container.style.border=`3px solid ${A}`,this.css3DRenderPlugin.hooks.on("render",()=>{var w;if(p.css3DObject.opacityMesh&&g.clickable!==!1){const I=this.addObjectClickHandler(s,p.css3DObject.opacityMesh,P=>{this.hooks.emit("click",{event:P,target:"TagContent",tag:s})});(w=this.store.css3DRenderDisposer.get(s.id))==null||w.push(I)}})}const p=this.css3DRenderPlugin.create3DDomContainer(u,v);if(!p)return;this.store.css3DRenderDisposer.set(s.id,[p.dispose]);const m=new Ng({target:p.container,props:{tag:s,hooks:this.hooks,state:this.state,mediaStore:this.mediaStore,temporaryState:this.temporaryState}});s.tag3DContentSvelte={svelteApp:m,domContainer:p,css3DInstance:p,initialNormal:f,currentNormal:f,dispose:()=>{m.$destroy(),p.dispose()}},oi(s)&&((h=s.model)!=null&&h.object)&&this.updateTagCss3DObjectMatrix(s,s.model.object)}}),this.clearUnusedPanelTag()}updateTagCss3DObjectMatrix(e,i){var p,m,A;const s=(m=(p=e.getConfig().tag3DConfig)==null?void 0:p.ratio)!=null?m:.00216,o=(A=e.tag3DContentSvelte)==null?void 0:A.css3DInstance.css3DObject;if(!o)return;const r=oi(e)?e.data.mediaPosition:e.position;if(!r||r.length!==4||!Array.isArray(r[0])||!Array.isArray(r[2]))return;i.updateWorldMatrix(!1,!1);const a=i.matrixWorld,l=new N.Vector3().fromArray(r[0]),c=new N.Vector3().fromArray(r[2]),h=ei(l,c).add(new N.Vector3(0,0,5e-4)),u=new N.Matrix4().setPosition(h),f=new N.Matrix4().makeScale(s,s,s),g=new N.Matrix4().multiply(a).multiply(u).multiply(f);g.decompose(o.position,o.quaternion,o.scale);const v=o.opacityMesh;v&&g.decompose(v.position,v.quaternion,v.scale)}addMediaModelTag(e){return H(this,null,function*(){const i=e.filter(s=>s.stickType==="Model").map(s=>s.loadModel());yield Promise.all(i),e.forEach(s=>s.updateVisible())})}disposeAllCSS3DContainer(){for(const[,e]of this.store.css3DRenderDisposer)e==null||e.forEach(i=>i==null?void 0:i());this.store.css3DRenderDisposer=new Map}clearUnusedPanelTag(){this.filter2DPointTag.forEach(e=>{var i;(i=e.tag3DContentSvelte)==null||i.css3DInstance.dispose(),e.tag3DContentSvelte=void 0});for(const[e,i]of this.store.css3DRenderDisposer){const s=this.getTagById(e);(!s||s.stickType==="2DPoint")&&(i==null||i.forEach(o=>o==null?void 0:o()),this.store.css3DRenderDisposer.delete(e))}}}class o3{constructor(t){d(this,"plugin");d(this,"logBinded",!1);this.plugin=t}get debug(){return this.plugin.debug}addDebugPoints(){try{$C(this.plugin.five,this.plugin.tags)}catch(t){console.error(t)}}bindLog(){if(this.logBinded)return;this.logBinded=!0;const t=e=>{Object.getOwnPropertyNames(e).forEach(i=>{typeof e[i]=="function"&&(e[i]=new Proxy(e[i],{apply:(s,o,r)=>(["render"].includes(i)||this.addLog(i,...r),s.apply(o,r))}))})};t(this.plugin),t(this.plugin.constructor.prototype)}addLog(t,...e){if(this.debug){let i=new Error().stack;console.debug(`%cPanoTagPlugin%c${t}`,"background-color: #35e0ed; color: black; padding:0 6px; border-radius: 3px","padding: 0 3px; color: #f3f47c",...e,{stack:i})}}closeIntersectRaycaster(){this.plugin.tags.forEach(t=>{var e;nn((e=t==null?void 0:t.initialConfig)==null?void 0:e.visibleConfig).intersectRaycaster&&(t.initialConfig.visibleConfig.intersectRaycaster.enabled=!1)}),this.plugin.changeGlobalConfig({visibleConfig:{intersectRaycaster:{enabled:!1}}})}}function r3(n,t){if(typeof window.requestIdleCallback!==void 0)return window.requestIdleCallback(n,t);var e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)}function a3(n){if(typeof window.cancelIdleCallback!==void 0)return window.cancelIdleCallback(n);clearTimeout(n)}const l3=new y.Vector2;class c3 extends ml{constructor(e,i){super(e,i);d(this,"__Object__");d(this,"requestIdleCallbackId")}unfoldAndFoldOthers(){const e=this.can("fold"),i=this.can("unfold");e&&i&&(this.state.unfolded=!this.state.unfolded,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.state.unfolded&&this.plugin.tags.forEach(s=>{s.id!==this.id&&s.fold()}))}onClick(e){e.target==="TagPoint"&&this.unfoldAndFoldOthers()}updateVisible(){this.requestIdleCallbackId&&a3(this.requestIdleCallbackId),this.requestIdleCallbackId=r3(()=>{super.updateVisible()})}applyVisible(){var e,i,s,o;this.currentVisible&&this.updateScreenPosition(),(s=(i=(e=this.tag3DContentSvelte)==null?void 0:e.css3DInstance)==null?void 0:i.css3DObject)==null||s.setVisible(this.currentVisible),(o=this.tag3DContentSvelte)==null||o.svelteApp.$set({state:this.plugin.state,temporaryState:this.temporaryState}),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}unfold(){this.setUnfold(!0)}fold(){this.setUnfold(!1)}setUnfold(e){const i=this.can("fold"),s=this.can("unfold");i&&s&&(this.state.unfolded=e,this.hooks.emit(e?"unfolded":"folded"),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))}setPosition(e){this.originPosition=e,this.position=e,this.cache.clear(),this.updateVisible(),this.updateScreenPosition(),this.updateZIndex(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateScreenPosition(e){var a;if(this.stickType!=="2DPoint"&&this.stickType!=="3DPoint")return;const{force:i=!1}=e!=null?e:{},s=i?this.state.visible:this.currentVisible,o=(a=this.__Object__)!=null?a:{timeoutId:void 0,inAnimation:!1};if(this.__Object__=o,!s&&this.screenPosition?(o.inAnimation=!0,o.timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{this.currentVisible||(o.inAnimation=!1,this.screenPosition=null,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))})},1e3)):o.timeoutId&&(clearTimeout(o.timeoutId),o.inAnimation=!1,o.timeoutId=void 0),!s&&!o.inAnimation)return;const r=this.computeTagProject();if(r){const l=(()=>{if(!this.currentConfig.simulate3D)return 1;const h=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),u=this.getDistance(void 0,1);return Math.max(Math.min(1-h*u/40,1),.5)})(),c=this.five.renderer.getSize(l3);this.screenPosition={leftPx:(r.x+1)/2*c.x,topPx:(-r.y+1)/2*c.y,scale:l}}else this.screenPosition=null;this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateUnfoldedByPanoIndex(){const e=this.getUnfoldedByPanoIndex();if(this.state&&(e!==void 0&&(this.state.unfolded=e),e&&!this.state.visible)){const i=this.getConfig();typeof i.unfoldedConfig=="object"&&i.unfoldedConfig.autoFoldWhenHide!==!1&&(this.state.unfolded=!1)}}computeNormal(){return new y.Vector3().fromArray(this.normal)}destroy(){this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}}const h3=new Map,d3=new Map;class u3 extends ml{constructor(t,e){super(t,e),this.state.unfolded=!0}applyVisible(){var e,i,s,o,r,a;this.computeRenderType()==="Mesh"?((i=(e=this.data.mediaData)==null?void 0:e[0])==null?void 0:i.type)==="Video"?this.renderVideoPlane():((o=(s=this.data.mediaData)==null?void 0:s[0])==null?void 0:o.type)==="Image"&&this.renderImagePlane():((r=this.tag3DContentSvelte)==null||r.svelteApp.$set({tag:this,state:this.plugin.state}),(a=this.tag3DContentSvelte)==null||a.css3DInstance.setVisible(this.currentVisible))}renderVideoPlane(){var a;const t=this.data.mediaData[0];if(!t)return;const{url:e}=t;if(!e)return;const i=this.currentVisible,s=(()=>!!(this.mediaPlane&&!i))(),o=(()=>!!(!this.mediaPlane&&i))(),r=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==e))();if((s||r)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),o||r){const l=this.position.map(xi),c=new Sg(e,l,{videoCoverSrc:t.videoCoverUrl,playButton:this.data.playIcon,paused:!((a=this.data.autoplayConfig)!=null&&a.autoplayVideo),objectFit:this.data.objectFit,videoTextureMap:h3,ImageTextureMap:d3,domEvents:this.plugin.domEvents});c.onVideoReady=u=>{u.addEventListener("play",()=>this.plugin.mediaStore.set({currentMediaElement:c.videoInstance}))};const h=u=>(this.five.on("renderFrame",u),()=>this.five.off("renderFrame",u));c.initialRenderHooks(h),this.mediaPlane=c,this.plugin.imagePlaneGroup.add(this.mediaPlane)}this.five.needsRender=!0}renderImagePlane(){const t=this.data.mediaData[0];if(!t)return;const{url:e}=t;if(!e)return;const i=this.position.map(xi),s=this.currentVisible,o=(()=>!!(this.mediaPlane&&!s))(),r=(()=>!!(!this.mediaPlane&&s))(),a=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==e))();(o||a)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),(r||a)&&(this.mediaPlane=new Dg(e,i,{objectFit:this.data.objectFit}),this.getConfig().clickable!==!1&&this.plugin.domEvents.addAutoBindEventListener(this.mediaPlane,"click",l=>{this.plugin.hooks.emit("click",{tag:this,target:"TagContent",event:l.origDomEvent})},{noEmitWhenHide:!0}),this.plugin.imagePlaneGroup.add(this.mediaPlane)),this.five.needsRender=!0}computeNormal(){return Uu(this.position)}}function f3(n){me(n,"svelte-7aiuwz",'@charset "UTF-8";.tag-point-click-helper.svelte-7aiuwz.svelte-7aiuwz{position:absolute;pointer-events:auto;cursor:pointer;width:calc(100% + 0.75rem);height:calc(100% + 0.75rem);left:50%;top:50%;transform:translate(-50%, -50%)}.tag-point-wrapper.svelte-7aiuwz.svelte-7aiuwz{pointer-events:none;position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.tag-folded-point.svelte-7aiuwz.svelte-7aiuwz,.tag-unfolded-point.svelte-7aiuwz.svelte-7aiuwz{transition:all 0.5s}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{display:flex;justify-content:center;align-items:center;position:absolute;width:100%;height:100%;border-radius:50%}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.3125rem;height:0.3125rem;border-radius:50%;background-color:white}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:before{content:"";position:absolute;width:0.875rem;height:0.875rem;border-radius:50%;background-color:rgba(0, 0, 0, 0.2)}.tag-point-wrapper.folded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:1;scale:1}.tag-point-wrapper.folded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:0;scale:1}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:0;scale:0.2}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:1;scale:1}')}function g3(n){let t,e,i,s,o,r,a,l,c,h,u,f;return s=new Zt({props:{center:!0,blurRadius:15,spreadRadius:5,opacity:.3}}),c=new Pg({props:{icon:n[2],width:n[1]}}),c.$on("iconLoaded",n[7]),{c(){t=S("div"),e=S("div"),i=te(),re(s.$$.fragment),o=te(),r=S("div"),a=te(),l=S("div"),re(c.$$.fragment),C(e,"class","tag-point-click-helper svelte-7aiuwz"),C(r,"class","tag-unfolded-point svelte-7aiuwz"),L(r,"transition-delay",(n[3]?n[5]:0)+"ms"),C(l,"class","tag-folded-point svelte-7aiuwz"),L(l,"transition-delay",(n[3]?n[5]:0)+"ms"),C(t,"class","tag-point-wrapper svelte-7aiuwz"),ie(t,"unfolded",n[0]),ie(t,"folded",n[3])},m(g,v){O(g,t,v),j(t,e),j(t,i),se(s,t,null),j(t,o),j(t,r),j(t,a),j(t,l),se(c,l,null),h=!0,u||(f=Ce(e,"click",n[4]),u=!0)},p(g,[v]){v&8&&L(r,"transition-delay",(g[3]?g[5]:0)+"ms");const p={};v&4&&(p.icon=g[2]),v&2&&(p.width=g[1]),c.$set(p),v&8&&L(l,"transition-delay",(g[3]?g[5]:0)+"ms"),(!h||v&1)&&ie(t,"unfolded",g[0]),(!h||v&8)&&ie(t,"folded",g[3])},i(g){h||(D(s.$$.fragment,g),D(c.$$.fragment,g),h=!0)},o(g){V(s.$$.fragment,g),V(c.$$.fragment,g),h=!1},d(g){g&&z(t),oe(s),oe(c),u=!1,f()}}}function m3(n,t,e){let i,s,o,r;const a=Ti("hooks");let{tag:l}=t,c,h=!1;const u=()=>{c!==void 0&&clearTimeout(c),h=!0,c=setTimeout(()=>{h=!1},800)},f=p=>{h||(l.entryFromModel&&Gt(l.five.state.mode)?l.find({targetMode:"Panorama"}).then(()=>l.unfoldAndFoldOthers()):a.emit("click",{event:p,target:"TagPoint",tag:l}))},g=(()=>l.contentType==="Text"&&l.data.appearance==="plane"?500:800)();function v(p){Vn.call(this,n,p)}return n.$$set=p=>{"tag"in p&&e(6,l=p.tag)},n.$$.update=()=>{var p,m,A,w;n.$$.dirty&64&&e(0,i=(p=l.state)==null?void 0:p.unfolded),n.$$.dirty&1&&e(3,s=!i),n.$$.dirty&64&&e(2,o=(A=(m=l.style)==null?void 0:m.point)!=null&&A.url?(w=l.style)==null?void 0:w.point:{url:$w}),n.$$.dirty&64&&e(1,r=(()=>{var k,M,T,R;const I=(M=(k=l.style)==null?void 0:k.point)==null?void 0:M.width;if(typeof I=="number")return I;const P=(R=(T=l.style)==null?void 0:T.point)==null?void 0:R.size;if(typeof P=="number")return P;if(P==="S")return 18;if(P==="M")return 20;if(P==="L")return 24;if(P==="XL")return 28})())},u(),[i,r,o,s,f,g,l,v]}class p3 extends ue{constructor(t){super(),de(this,t,m3,g3,he,{tag:6},f3)}}function v3(n){me(n,"svelte-2g2g8a",".tag.svelte-2g2g8a{position:absolute;width:0rem;height:0rem;overflow:visible;pointer-events:auto;will-change:opacity;transition:opacity 0.2s linear}.tag.enableZIndex.svelte-2g2g8a{position:absolute}.tag.hide.svelte-2g2g8a{opacity:0;pointer-events:none}.tag.hide.svelte-2g2g8a *{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a *{pointer-events:none !important}")}function _g(n){let t,e,i,s,o,r,a,l,c;const h=[b3,A3],u=[];function f(m,A){return m[8]?0:1}e=f(n),i=u[e]=h[e](n);const g=[w3,y3],v=[];function p(m,A){return m[15]?0:1}return o=p(n),r=v[o]=g[o](n),{c(){t=S("div"),i.c(),s=te(),r.c(),C(t,"class","tag svelte-2g2g8a"),C(t,"data-tag-id",n[14]),C(t,"data-tag-unfolded",n[6]),C(t,"data-content-type",a=n[0].contentType),C(t,"id",l=`tag-${n[14]}`),ie(t,"unClickable",n[0].config.clickable===!1),ie(t,"hide",n[12]),ie(t,"enableZIndex",n[9]),L(t,"z-index",n[9]),L(t,"transform",`translate3d(${n[11]}, ${n[10]}, 0) scale(${n[7].scale})`)},m(m,A){O(m,t,A),u[e].m(t,null),j(t,s),v[o].m(t,null),n[17](t),c=!0},p(m,A){let w=e;e=f(m),e===w?u[e].p(m,A):(fe(),V(u[w],1,1,()=>{u[w]=null}),ge(),i=u[e],i?i.p(m,A):(i=u[e]=h[e](m),i.c()),D(i,1),i.m(t,s));let I=o;o=p(m),o===I?v[o].p(m,A):(fe(),V(v[I],1,1,()=>{v[I]=null}),ge(),r=v[o],r?r.p(m,A):(r=v[o]=g[o](m),r.c()),D(r,1),r.m(t,null)),(!c||A&16384)&&C(t,"data-tag-id",m[14]),(!c||A&64)&&C(t,"data-tag-unfolded",m[6]),(!c||A&1&&a!==(a=m[0].contentType))&&C(t,"data-content-type",a),(!c||A&16384&&l!==(l=`tag-${m[14]}`))&&C(t,"id",l),(!c||A&1)&&ie(t,"unClickable",m[0].config.clickable===!1),(!c||A&4096)&&ie(t,"hide",m[12]),(!c||A&512)&&ie(t,"enableZIndex",m[9]),A&512&&L(t,"z-index",m[9]),A&3200&&L(t,"transform",`translate3d(${m[11]}, ${m[10]}, 0) scale(${m[7].scale})`)},i(m){c||(D(i),D(r),c=!0)},o(m){V(i),V(r),c=!1},d(m){m&&z(t),u[e].d(),v[o].d(),n[17](null)}}}function A3(n){let t;return{c(){t=S("div"),C(t,"data-info","tag point is disable")},m(e,i){O(e,t,i)},p:K,i:K,o:K,d(e){e&&z(t)}}}function b3(n){let t,e;return t=new p3({props:{tag:n[0]}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&1&&(o.tag=i[0]),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function y3(n){let t;return{c(){t=S("div"),C(t,"data-info","tag content is disable")},m(e,i){O(e,t,i)},p:K,i:K,o:K,d(e){e&&z(t)}}}function w3(n){let t,e;return t=new Ng({props:{mediaStore:n[1],tag:Ke(n[0]),hooks:n[16],state:n[4],temporaryState:n[5],rendererMap:n[2],contentTypeMap:n[3]}}),{c(){re(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const o={};s&2&&(o.mediaStore=i[1]),s&1&&(o.tag=Ke(i[0])),s&16&&(o.state=i[4]),s&32&&(o.temporaryState=i[5]),s&4&&(o.rendererMap=i[2]),s&8&&(o.contentTypeMap=i[3]),t.$set(o)},i(i){e||(D(t.$$.fragment,i),e=!0)},o(i){V(t.$$.fragment,i),e=!1},d(i){oe(t,i)}}}function C3(n){let t,e,i=n[7]&&!n[13]&&_g(n);return{c(){i&&i.c(),t=Ee()},m(s,o){i&&i.m(s,o),O(s,t,o),e=!0},p(s,[o]){s[7]&&!s[13]?i?(i.p(s,o),o&8320&&D(i,1)):(i=_g(s),i.c(),D(i,1),i.m(t.parentNode,t)):i&&(fe(),V(i,1,1,()=>{i=null}),ge())},i(s){e||(D(i),e=!0)},o(s){V(i),e=!1},d(s){i&&i.d(s),s&&z(t)}}}function P3(n,t,e){let i,s,o,r,a,l,c,h,u,f,{tag:g}=t,{mediaStore:v}=t,{rendererMap:p=new Map}=t,{contentTypeMap:m=new Map}=t,{state:A}=t,{temporaryState:w}=t;const I=Ti("hooks");function P(k){Ue[k?"unshift":"push"](()=>{g.dom=k,e(0,g)})}return n.$$set=k=>{"tag"in k&&e(0,g=k.tag),"mediaStore"in k&&e(1,v=k.mediaStore),"rendererMap"in k&&e(2,p=k.rendererMap),"contentTypeMap"in k&&e(3,m=k.contentTypeMap),"state"in k&&e(4,A=k.state),"temporaryState"in k&&e(5,w=k.temporaryState)},n.$$.update=()=>{var k,M,T,R;n.$$.dirty&5&&e(8,i=(()=>{var Y,G,Q;return!(((G=(Y=g.style)==null?void 0:Y.point)==null?void 0:G.enabled)===!1||((Q=p.get(g.contentType))==null?void 0:Q.usePoint)===!1||g.contentType==="Sticker"||g.contentType==="Link"||g.contentType==="VRLink"||g.contentType==="PanoLink"||g.contentType==="Panorama"||g.contentType==="Audio"&&g.data.appearance==="plane")})()),n.$$.dirty&257&&e(15,s=(()=>!(g.stickType!=="2DPoint"||g.entryFromModel&&Gt(g.five.state.mode)&&i))()),n.$$.dirty&1&&e(14,o=g.id),n.$$.dirty&1&&e(7,r=g.screenPosition),n.$$.dirty&1&&e(13,a=g.enabled===!1||!g.state),n.$$.dirty&129&&e(12,l=!((k=g.state)!=null&&k.visible)||((M=g.temporaryState)==null?void 0:M.visible)===!1||!r),n.$$.dirty&1&&e(6,c=(T=g.state)==null?void 0:T.unfolded),n.$$.dirty&128&&e(11,h=(r==null?void 0:r.leftPx)+"px"),n.$$.dirty&128&&e(10,u=(r==null?void 0:r.topPx)+"px"),n.$$.dirty&65&&e(9,f=c?((R=g.zIndex)!=null?R:0)+(c?1e6:0):void 0)},[g,v,p,m,A,w,c,r,i,f,u,h,l,a,o,s,I,P]}class I3 extends ue{constructor(t){super(),de(this,t,P3,C3,he,{tag:0,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5},v3)}}function M3(n){me(n,"svelte-1owzhnq",".tag--container.svelte-1owzhnq{box-sizing:border-box;position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:1;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:translate3d(0, 0, 0);transition:opacity 0.2s linear}.tag--container.hide.svelte-1owzhnq{opacity:0;pointer-events:none}.tag--container.hide.svelte-1owzhnq *{pointer-events:none !important}")}function Gg(n,t,e){const i=n.slice();return i[8]=t[e],i}function Qg(n){let t,e=[],i=new Map,s,o,r=n[0];const a=l=>l[8].id;for(let l=0;l<r.length;l+=1){let c=Gg(n,r,l),h=a(c);i.set(h,e[l]=Wg(h,c))}return{c(){var l;t=S("div");for(let c=0;c<e.length;c+=1)e[c].c();C(t,"class","tag--container svelte-1owzhnq"),ie(t,"hide",!n[4].visible||!n[5].visible),L(t,"z-index",(l=n[6])!=null?l:"")},m(l,c){O(l,t,c);for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(t,null);o=!0},p(l,c){var h;c&63&&(r=l[0],fe(),e=Xt(e,c,a,1,l,r,i,t,zi,Wg,null,Gg),ge()),(!o||c&48)&&ie(t,"hide",!l[4].visible||!l[5].visible),c&64&&L(t,"z-index",(h=l[6])!=null?h:"")},i(l){if(!o){for(let c=0;c<r.length;c+=1)D(e[c]);s||it(()=>{s=ji(t,gt,{}),s.start()}),o=!0}},o(l){for(let c=0;c<e.length;c+=1)V(e[c]);o=!1},d(l){l&&z(t);for(let c=0;c<e.length;c+=1)e[c].d()}}}function Wg(n,t){let e,i,s;return i=new I3({props:{state:t[4],temporaryState:t[5],tag:t[8],mediaStore:t[1],rendererMap:t[2],contentTypeMap:t[3]}}),{key:n,first:null,c(){e=Ee(),re(i.$$.fragment),this.first=e},m(o,r){O(o,e,r),se(i,o,r),s=!0},p(o,r){t=o;const a={};r&16&&(a.state=t[4]),r&32&&(a.temporaryState=t[5]),r&1&&(a.tag=t[8]),r&2&&(a.mediaStore=t[1]),r&4&&(a.rendererMap=t[2]),r&8&&(a.contentTypeMap=t[3]),i.$set(a)},i(o){s||(D(i.$$.fragment,o),s=!0)},o(o){V(i.$$.fragment,o),s=!1},d(o){o&&z(e),oe(i,o)}}}function E3(n){let t,e,i=n[4].enabled&&Qg(n);return{c(){i&&i.c(),t=Ee()},m(s,o){i&&i.m(s,o),O(s,t,o),e=!0},p(s,[o]){s[4].enabled?i?(i.p(s,o),o&16&&D(i,1)):(i=Qg(s),i.c(),D(i,1),i.m(t.parentNode,t)):i&&(fe(),V(i,1,1,()=>{i=null}),ge())},i(s){e||(D(i),e=!0)},o(s){V(i),e=!1},d(s){i&&i.d(s),s&&z(t)}}}function k3(n,t,e){let{tags:i=[]}=t,{hooks:s}=t,{mediaStore:o}=t,{rendererMap:r}=t,{contentTypeMap:a}=t,{state:l}=t,{temporaryState:c}=t,{zIndex:h=void 0}=t;return pa("hooks",s),n.$$set=u=>{"tags"in u&&e(0,i=u.tags),"hooks"in u&&e(7,s=u.hooks),"mediaStore"in u&&e(1,o=u.mediaStore),"rendererMap"in u&&e(2,r=u.rendererMap),"contentTypeMap"in u&&e(3,a=u.contentTypeMap),"state"in u&&e(4,l=u.state),"temporaryState"in u&&e(5,c=u.temporaryState),"zIndex"in u&&e(6,h=u.zIndex)},[i,o,r,a,l,c,h,s]}class x3 extends ue{constructor(t){super(),de(this,t,k3,E3,he,{tags:0,hooks:7,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5,zIndex:6},M3)}}const Hg="Dnalogel-PanoTagPlugin",D3=n=>`${Hg}--${n}`;class dr extends s3{constructor(e,i){super(e);d(this,"state",{enabled:!0,visible:!0});d(this,"debug");d(this,"debugUtil",new o3(this));d(this,"changeTagModel",(e,i)=>H(this,null,function*(){var s;e.data=Qe({},e.data,i),yield(s=e.loadModel)==null?void 0:s.call(e)}));d(this,"handleFiveModeChange",e=>{const i=()=>{this.tags.forEach(s=>{s.state.visible=!1,s.applyVisible(),this.five.ready().then(()=>{s.updateVisible(),oi(s)&&e!=="Panorama"&&this.changeTagMode(s,"behind")})})};this.tags.length<500?i():this.five.ready().then(()=>i())});d(this,"handleFiveWantsMoveToPano",e=>{if(this.tags.length>500){this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]});return}else this.tags.forEach(i=>{i.getVisible({panoIndex:e})&&(i.state.visible=!0);const o=i.getConfig();typeof o.visibleConfig=="object"&&i.temporaryState&&(o.visibleConfig.keep?i.temporaryState.visible=o.visibleConfig.keep==="visible":i.temporaryState.visible=!!o.visibleConfig.alwaysShowWhenMovePano)}),this.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.tags.forEach(i=>i.applyVisible())});d(this,"clickhandler",e=>{e.tag.onClick(e)});d(this,"handleFiveCameraUpdate",()=>{this.filterPointTag.forEach(e=>e.updateScreenPosition())});d(this,"handleFiveCameraFovUpdate",()=>{this.handleFiveCameraUpdate(),this.five.off("render.prepare",this.handleFiveCameraUpdate),this.five.on("render.prepare",this.handleFiveCameraUpdate),setTimeout(()=>{this.five.off("render.prepare",this.handleFiveCameraUpdate)},1e3)});d(this,"handleFivePanoArrived",()=>H(this,null,function*(){this.tags.forEach(e=>{e.state.visible=!1,e.temporaryState=ne(x({},e.temporaryState),{visible:!0}),e.applyVisible(),e.updateVisible()}),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}),yield this.setUnfolded(),this.updateRender3DDomTag(),this.tags.filter(iP).filter(e=>{var i;return(i=e.getConfig().modelConfig)==null?void 0:i.autoLookAtEnabled}).forEach(e=>{var c;const i=new y.Mesh(new y.BoxGeometry,new y.MeshBasicMaterial),s=(c=e.model)==null?void 0:c.object;if(!s)return;i.position.copy(s.position),i.quaternion.copy(s.quaternion);const o=this.five.camera.position;i.lookAt(o.clone().setY(i.position.y));const r=s.quaternion.clone(),a=i.quaternion.clone(),l=Is();l.onUpdate(({progress:h})=>{s.quaternion.copy(r.clone().slerp(a,h))}),l.play()})}));d(this,"handleFiveModelShownFloorChange",()=>{this.tags.forEach(e=>e.updateVisible())});d(this,"onFiveEveryReady",()=>{this.setUnfoldedByCamera(),Gt(this.five.getCurrentState().mode)&&this.tags.forEach(e=>e.updateVisible())});d(this,"render",()=>{this.renderQueue.forEach((e,i)=>{const{keys:s}=e;if(i==="TagContainerSvelte"){const r=this.filterPointTag.filter(l=>l.screenPosition),a={hooks:this.hooks,tags:r,state:this.state,temporaryState:this.temporaryState,mediaStore:this.mediaStore,rendererMap:this.rendererMap,contentTypeMap:this.contentTypeMap,zIndex:this.params.containerZIndex};if(this.TagContainerSvelte){let l={};if(s.length===0)l=a;else for(const c of s)l[c]=a[c];this.TagContainerSvelte.$set(l)}else{if(!this.container)return console.error("updateRenderPlaneTag: tag2DContainer not found");this.TagContainerSvelte=new x3({target:this.container,props:ne(x({},a),{state:ne(x({},this.state),{enabled:!1})})}),Ms(()=>{var l;(l=this.TagContainerSvelte)==null||l.$set({state:this.state})})}}}),this.renderQueue.clear()});this.params=Qe({},{debug:!1,config:this.config},x({},i)),this.debug=this.params.debug,this.config=this.params.config,this.debug&&this.debugUtil.bindLog(),cP(1,{namespace:Ka.PlayAudio});try{Array.isArray(window.__PANOTAGPLUGIN_DEBUG_LIST__)||(window.__PANOTAGPLUGIN_DEBUG_LIST__=[]),window.__PANOTAGPLUGIN_DEBUG_LIST__.push(this),window.__PANOTAGPLUGIN_DEBUG__||Object.defineProperty(window,"__PANOTAGPLUGIN_DEBUG__",{get:function(){return window.__PANOTAGPLUGIN_DEBUG_LIST__.sort((s,o)=>o.tags.length-s.tags.length)[0]}})}catch(s){}}appendTo(e){var s,o,r,a;this.debugUtil.addLog("appendTo"),this.container=e,(s=this.css3DRenderPlugin)==null||s.appendToFrontFiveContainer(this.container);const i=(r=(o=this.TagContainerSvelte)==null?void 0:o.$$)==null?void 0:r.root;i&&i!==this.container&&((a=this.TagContainerSvelte)==null||a.$destroy(),this.TagContainerSvelte=void 0)}load(e){return H(this,null,function*(){var s,o;this.clearTags(),console.debug(Hg," load:",{data:JSON.parse(JSON.stringify(e))}),this.config=Qe({},this.config,{globalConfig:(s=e.globalConfig)!=null?s:{},contentTypeConfig:(o=e.contentTypeConfig)!=null?o:{}});const i=yield this.addTag(e.tagList);return this.hooks.emit("loaded"),i})}addTag(e){return H(this,null,function*(){const s=(Array.isArray(e)?e:[e]).filter(o=>o.position).map(o=>{const r=qa(o);if(r==="2DPoint"||r==="3DPoint")return new c3(this,o);if(r==="Model")return new Fg(this,o);if(r==="Plane")return new u3(this,o)});return s.forEach(aP),this.tags.push(...s),this.tagsLengthWillUpdate=!0,Pn(this.five).then(()=>H(this,null,function*(){var o,r;this.store.eventListenerDisposer&&((r=(o=this.store).eventListenerDisposer)==null||r.call(o)),this.state.enabled&&this.handleEnable(),this.addResizeListener(),this.clearUnusedPanelTag(),this.addMediaModelTag(s),s.forEach(a=>{a.updateVisible(),a.updateZIndex()}),this.setUnfolded(),this.addRenderQueue({type:"TagContainerSvelte"}),this.hooks.emit("tagsLengthChange")}))})}changeConfig(e,i=!0){i?this.config=Qe({},this.config,e):this.config=e,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}changeGlobalConfig(e,i=!0){i?this.config.globalConfig=Qe({},this.config.globalConfig,e):this.config.globalConfig=e,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}changeContentTypeConfig(e,i,s=!0){this.config.contentTypeConfig||(this.config.contentTypeConfig={}),s?this.config.contentTypeConfig[e]=Qe({},this.config.contentTypeConfig[e],i):this.config.contentTypeConfig[e]=i,this.tags.forEach(o=>{o.updateConfig(),o.updateVisible()})}show(e){return H(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({visible:!0},{userAction:i}),this.hooks.emit("show",{userAction:i})})}hide(e){return H(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({visible:!1},{userAction:i}),this.hooks.emit("hide",{userAction:i})})}enable(e){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({enabled:!0},{userAction:i}),this.hooks.emit("enable",{userAction:i})}disable(e){if(this.checkDisposed())return;const{userAction:i=!0}=e!=null?e:{};this.setState({enabled:!1},{userAction:i}),this.hooks.emit("disable",{userAction:i})}setState(e,i){if(this.checkDisposed())return;const{userAction:s=!0}=i!=null?i:{},o=x({},this.state);this.state=Object.assign(this.state,e),o.visible!==this.state.visible&&(e.visible?this.handleShow():this.handleHide()),o.enabled!==this.state.enabled&&(e.enabled?this.handleEnable():this.handleDisable()),this.hooks.emit("stateChange",{state:this.state,prevState:o,userAction:s})}dispose(){var e,i,s,o,r,a;this.pauseCurrentMedia(),this.disposeAllCSS3DContainer(),(e=this.TagContainerSvelte)==null||e.$destroy(),this.filterCSS3DTag.forEach(l=>{var c;return(c=l.tag3DContentSvelte)==null?void 0:c.svelteApp.$destroy()}),this.tags.forEach(l=>l.cache.clear()),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(i=this.store.disposers)==null||i.forEach(l=>l==null?void 0:l()),this.store.disposers=[],(o=(s=this.store).eventListenerDisposer)==null||o.call(s),this.store.eventListenerDisposer=void 0,(a=(r=this.store).resizeObserverDisposer)==null||a.call(r),this.store.resizeObserverDisposer=void 0,this.store.resizeObserverDisposerAdding=!1,this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.gltfObjectGroup.remove(...this.gltfObjectGroup.children),this.imagePlaneGroup.remove(...this.imagePlaneGroup.children),this.five.needsRender=!0,this.store.disposed=!0,this.hooks.emit("dispose")}blinkTagById(e,i){return H(this,null,function*(){var s;return(s=this.getTagById(e))==null?void 0:s.blink(i)})}changeUnfoldedById(e,i){const s=this.getTagById(e);i?s==null||s.unfold():s==null||s.fold()}changeEnabledById(e,i){var o;const s=this.getTagById(e);s&&(s.enabled=i,(o=s.hooks)==null||o.emit(i?"enable":"disable"))}changeTagNormalById(e,i){const s=this.getTagById(e);s&&s.tag3DContentSvelte&&(s.tag3DContentSvelte.currentNormal=xi(i))}changePositionById(e,i){const s=this.getTagById(e);s&&s.setPosition(i)}changeDataById(e,i,s=!0){const o=this.getTagById(e);o&&(o.setData(i,s),this.clearUnusedPanelTag(),o.hooks.emit("dataChanged",o.data))}changeStickTypeById(e,i,s=!0){this.changeTagById(e,i,s)}changeTagById(e,i,s=!0){const o=this.getTagById(e);o&&(o.set(i),o.updateVisible(),this.clearUnusedPanelTag(),o.hooks.emit("dataChanged",o.data))}destroyTagById(e){(Array.isArray(e)?e:[e]).forEach(s=>{var o;return(o=this.getTagById(s))==null?void 0:o.destroy()})}updateRenderAllTags(){this.tags.forEach(e=>e.updateVisible()),this.five.needsRender=!0}setUnfolded(){return H(this,null,function*(){return new Promise(e=>{setTimeout(()=>{this.setUnfoldedByCamera(),e()},100)})})}handleShow(){this.state.visible=!0,this.group.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleHide(){this.pauseCurrentMedia(),this.state.visible=!1,this.group.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleEnable(){this.state.enabled=!0,this.store.eventListenerDisposer=this.addEventListener(),this.five.scene.children.includes(this.group)||this.five.scene.add(this.group),this.group.traverse(e=>{var i;(i=e==null?void 0:e.updateTagCss3DObjectMatrix)==null||i.call(e)}),this.updateRender3DDomTag(),this.five.needsRender=!0}handleDisable(){var e,i,s;this.pauseCurrentMedia(),this.state.enabled=!1,(i=(e=this.store).eventListenerDisposer)==null||i.call(e),this.five.scene.remove(this.group),(s=this.TagContainerSvelte)==null||s.$set({tags:[]}),this.filterCSS3DTag.forEach(o=>{var r;(r=o.tag3DContentSvelte)==null||r.dispose(),o.tag3DContentSvelte=void 0}),this.five.needsRender=!0}addResizeListener(){if(!this.store.resizeObserverDisposer&&!this.store.resizeObserverDisposerAdding){const e=this.addResizeObserver();this.store.resizeObserverDisposerAdding=!0,setTimeout(()=>{this.store.resizeObserverDisposer=e,this.store.resizeObserverDisposerAdding=!1},200)}}addResizeObserver(){if(this.store.disposed)return;const e=this.five.getElement(),i=()=>{this.state.enabled&&(this.filterPointTag.forEach(c=>c.updateScreenPosition({force:!0})),this.show())},s=()=>{this.state.enabled&&this.hide()},{observe:o,unobserve:r}=$a(Xu(()=>{this.store.resizeObserverDisposer&&s()},500),e),{observe:a,unobserve:l}=$a(oP(()=>i(),400),e);return o(),a(),()=>{r(),l()}}setUnfoldedByCamera(){let e=!1;this.filterPointTag.forEach(i=>{const s=i.getUnfoldedByCamera();if(i.state&&s!==void 0){if(s===!0&&i.screenPosition){const o=i.getConfig().unfoldedConfig;nn(o).keep!=="unfolded"&&(e=!0)}i.state.unfolded=s}}),e&&this.filterPointTag.forEach(i=>{const s=i.getConfig().unfoldedConfig;typeof s=="object"&&(s.autoUnfold||s.autoUnfold===!1||nn(s.autoUnfold).enable===!1||s.keep)||i.state&&(i.state.unfolded=!1)})}changeTagMode(e,i){var s,o,r,a,l,c;((s=e.config)==null?void 0:s.renderType)!=="Mesh"&&((a=(r=(o=e.tag3DContentSvelte)==null?void 0:o.css3DInstance)==null?void 0:r.css3DObject)==null?void 0:a.mode)!==i&&((l=e.config)!=null&&l.tag3DConfig?e.config.tag3DConfig.mode=i:e.config?e.config.tag3DConfig={mode:i}:e.config={tag3DConfig:{mode:i}},(c=this.store.css3DRenderDisposer.get(e.id))==null||c.forEach(h=>h==null?void 0:h()),e.tag3DContentSvelte=void 0)}addEventListener(){const{five:e,hooks:i}=this;let s=!1;const o=Xu(()=>{s||(s=!0,e.ready().then(()=>{this.onFiveEveryReady(),s=!1}))},150);return e.on("cameraUpdate",o),this.handleFivePanoArrived(),e.on("wantsMoveToPano",this.handleFiveWantsMoveToPano),e.on("models.refined",this.onFiveEveryReady),e.on("modeChange",this.handleFiveModeChange),e.on("modelShownFloorChange",this.handleFiveModelShownFloorChange),e.on("cameraUpdate",this.handleFiveCameraUpdate),e.on("cameraFovUpdate",this.handleFiveCameraFovUpdate),e.on("panoArrived",this.handleFivePanoArrived),e.on("panoArrived",this.loadVideoFirstFrame),e.on("render.prepare",this.render),i.on("click",this.clickhandler),()=>{e.off("wantsMoveToPano",this.handleFiveWantsMoveToPano),e.off("models.refined",this.onFiveEveryReady),e.off("modeChange",this.handleFiveModeChange),e.off("modelShownFloorChange",this.handleFiveModelShownFloorChange),e.off("cameraUpdate",this.handleFiveCameraUpdate),e.off("cameraFovUpdate",this.handleFiveCameraFovUpdate),e.off("cameraUpdate",o),e.off("panoArrived",this.handleFivePanoArrived),e.off("panoArrived",this.loadVideoFirstFrame),e.off("render.prepare",this.render),i.off("click",this.clickhandler),this.store.eventListenerDisposer=void 0}}}const S3=(n,t)=>new dr(n,t);function L3(n){me(n,"svelte-4qjwer",".guide-line__tag.svelte-4qjwer.svelte-4qjwer{position:relative}.text-with-distance.svelte-4qjwer.svelte-4qjwer{display:flex;flex-direction:column;position:relative;padding:0.125rem 0.25rem;border-radius:0.125rem;background:linear-gradient(to top, rgba(147, 147, 147, 0.3), rgba(74, 74, 74, 0.3));box-shadow:0 0.125rem 0.5rem 0 rgba(0, 0, 0, 0.2)}.text-with-distance.svelte-4qjwer .border.svelte-4qjwer{position:absolute;top:-50%;right:-50%;bottom:-50%;left:-50%;padding:0.0625rem;border-radius:0.25rem;background:linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2));-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask-composite:exclude;-webkit-mask-composite:xor;transform:scale(0.5)}.distance-and-name.svelte-4qjwer.svelte-4qjwer{display:flex;gap:0.1875rem}.distance.svelte-4qjwer.svelte-4qjwer{white-space:nowrap;font-size:0.625rem;line-height:0.875rem;color:#66afff}.name.svelte-4qjwer.svelte-4qjwer{opacity:0.6;font-size:0.625rem;line-height:0.875rem;white-space:nowrap;color:#ffffff}.line-name.svelte-4qjwer.svelte-4qjwer{color:#fff;white-space:nowrap;font-size:0.625rem;line-height:0.875rem}.guide-line__tag-point.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.4375rem;height:0.125rem;transform:translateX(-50%);background:#fff;border-radius:50%;opacity:0.5}.guide-line__tag-line.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.0625rem;height:1.875rem;transform:translateX(-50%);background:linear-gradient(to top, #fff, rgba(255, 255, 255, 0))}.guide-line__tag-content.svelte-4qjwer.svelte-4qjwer{position:absolute;left:-0.9375rem;bottom:1.9375rem;display:flex}.guide-line__tag-icon.svelte-4qjwer.svelte-4qjwer{width:1.875rem;height:1.875rem;background-size:100%}.guide-line__tag-text.svelte-4qjwer.svelte-4qjwer{box-sizing:content-box;height:0.875rem;width:-moz-max-content;width:max-content;margin-top:0.3125rem;transform:translateX(-0.1875rem);white-space:nowrap;font-size:0.625rem;line-height:0.875rem;border:solid transparent;border-width:0.125rem 0.5rem 0.125rem 0.375rem;border-image-slice:6 25 6 18 fill;color:#fff}")}function Ug(n){let t,e;return{c(){t=S("div"),e=Se(n[0]),C(t,"class","guide-line__tag-text svelte-4qjwer"),L(t,"border-image-source",`url(${n[6]})`)},m(i,s){O(i,t,s),j(t,e)},p(i,s){s&1&&Le(e,i[0])},d(i){i&&z(t)}}}function Yg(n){let t,e,i,s,o=n[5]("全程")+"",r,a,l=n[5]("米")+"",c,h,u,f,g,v,p=n[4]&&Xg(n);return{c(){t=S("div"),p&&p.c(),e=te(),i=S("div"),s=S("span"),r=Se(o),a=Se(n[2]),c=Se(l),h=te(),u=S("span"),f=Se(n[0]),g=te(),v=S("div"),C(s,"class","distance svelte-4qjwer"),C(u,"class","name svelte-4qjwer"),C(i,"class","distance-and-name svelte-4qjwer"),C(v,"class","border svelte-4qjwer"),C(t,"class","text-with-distance svelte-4qjwer")},m(m,A){O(m,t,A),p&&p.m(t,null),j(t,e),j(t,i),j(i,s),j(s,r),j(s,a),j(s,c),j(i,h),j(i,u),j(u,f),j(t,g),j(t,v)},p(m,A){m[4]?p?p.p(m,A):(p=Xg(m),p.c(),p.m(t,e)):p&&(p.d(1),p=null),A&32&&o!==(o=m[5]("全程")+"")&&Le(r,o),A&4&&Le(a,m[2]),A&32&&l!==(l=m[5]("米")+"")&&Le(c,l),A&1&&Le(f,m[0])},d(m){m&&z(t),p&&p.d()}}}function Xg(n){let t,e;return{c(){t=S("span"),e=Se(n[4]),C(t,"class","line-name svelte-4qjwer")},m(i,s){O(i,t,s),j(t,e)},p(i,s){s&16&&Le(e,i[4])},d(i){i&&z(t)}}}function T3(n){let t,e,i,s,o,r,a,l,c,h=n[0]&&!n[2]&&Ug(n),u=n[2]&&Yg(n);return{c(){t=S("div"),e=S("div"),i=te(),s=S("div"),o=te(),r=S("div"),a=S("div"),l=te(),h&&h.c(),c=te(),u&&u.c(),C(e,"class","guide-line__tag-point svelte-4qjwer"),C(s,"class","guide-line__tag-line svelte-4qjwer"),C(a,"class","guide-line__tag-icon svelte-4qjwer"),L(a,"background-image",`url(${n[1]})`),C(r,"class","guide-line__tag-content svelte-4qjwer"),C(t,"class","guide-line__tag svelte-4qjwer"),L(t,"opacity",n[3])},m(f,g){O(f,t,g),j(t,e),j(t,i),j(t,s),j(t,o),j(t,r),j(r,a),j(r,l),h&&h.m(r,null),j(r,c),u&&u.m(r,null)},p(f,[g]){g&2&&L(a,"background-image",`url(${f[1]})`),f[0]&&!f[2]?h?h.p(f,g):(h=Ug(f),h.c(),h.m(r,c)):h&&(h.d(1),h=null),f[2]?u?u.p(f,g):(u=Yg(f),u.c(),u.m(r,null)):u&&(u.d(1),u=null),g&8&&L(t,"opacity",f[3])},i:K,o:K,d(f){f&&z(t),h&&h.d(),u&&u.d()}}}function j3(n,t,e){let{text:i=""}=t,{icon_url:s=""}=t,{distance:o=0}=t,{opacity:r=1}=t,{name:a=""}=t,{i18n:l=h=>h}=t;const c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHUAAAA2CAMAAADOFiZMAAACEFBMVEUAAACIiIheXl5oaGh6enpsbGxiYmJ9fX1wcHBXV1eBgYFzc3NSUlKNjY2Dg4NOTk51dXVXV1dmZmZTU1N3d3dcXFyMjIyEhIRNTU2QkJC0tLS5ubnHx8fOzs6np6exsbHKysqoqKi9vb3U1NTPz8/Nzc2vr6/Dw8OysrK/v7/X19fS0tKurq62traqqqrJycmurq64uLifn5/Dw8O6urqQkJC6urro6Ojt7e3o6OjU1NS3t7fBwcGjo6Ozs7Orq6u1tbXAwMCurq6rq6vy8vLx8fHr6+vp6enZ2dnd3d3a2trX19fV1dW/v7/IyMihoaGampqVlZWLi4uCgoK+vr6urq7m5ubw8PDk5OTu7u7i4uLg4ODe3t7q6urS0tLi4uLOzs7e3t7Hx8fa2tqrq6vExMTAwMCnp6efn5+WlpaHh4ezs7OoqKiJiYm6urqZmZmurq59fX29vb23t7e4uLipqanp6enc3Nza2trW1tbT09Pm5ubj4+PQ0NDg4ODExMTCwsK7u7vBwcG8vLy5ubm8vLy+vr64uLiysrKdnZ3CwsJoaGisrKzHx8ekpKTExMTv7+/i4uLa2trm5ubk5OTLy8vKysrExMTQ0NDX19ecnJzT09N/f3+dnZ12dnaQkJCXl5etra3Pz8+4uLiXl5fGxsaqqqrr6+vQ0NDKysrNzc3W1takpKShoaGsrKysrKyduRZkAAAAsHRSTlMATE1NTExMTUxNTExMTExNTExMTU1MTU1MTICFc313fnl0iIWAe3h3aYqIgXx7eXZzcnFwaGggxLiog4J0dG9mZF82FMfEtK2pkYqKh3x4cm1rZmEmH8G/vry6trOxoZ2clpKOe3ptbWZjYmFgXFpaVlFPSDYlx7CspaSjoJ6akY6HfXt4bGpmY1xUU0g2LSzCuK6lopiWhoF3YmFaVlZUUU5KPyEJCcl/fXNdXFxZUIUrIQsAAAV6SURBVFjDvZj3VxNBEMePBBIOQgmEQGghISSASSBBUQFBVIpUEaR3aVJExN4F6fbee6//opPN2507E3P7fD4+b54z+935zt7lvPsBYbZ5lyXT7R5xms2ppaVpV615eVeuXL48PPzw4YPBwYsX+/vPnT1bW1t75u7p0729PT13urs7O9vbt2/ffurUp1OQ2ts7O7u77/T09PaevnvmTG3t2XPn+vsvDg4+GH5UVjl/SAjGe29La2vr5EFgm4+WlpYDgNfrbW7etQuuKDPTPTIy4nSa4bJ8lKYBV69arXmA1WpN81FamgqYzU6n0+12ZwI+qzPtyvDlR0dPCoGsecW4FEZcShwEyUDIGvtD+DcOZlrzFvcE3qylFXZ1cTqIgGk0K1xRSL84abaWtwl/8KM5kTiok04B2BpAPUWXAoGnQK3gn0xNW90ryDhpafXvJsYlJuoSdRCyTJHqBOxR9IvbUl1/PN5pL9tFR4gTJJmi7N+wl8qf7k33S+YQE0VRJwZz42RogDZcAxx+sTn1jSDho6VFBKAbp9K1XqfXi3oRgmSqQ2AGePziNpfs2GN2lV5Pp+IJkkwIrDFz+Y+Y90h/Yvtz+f0o1YGnc/lVXvshASk8IHUm6ZMIYhI6YAEyqyHkE/n8Kkuh5AX6ZVdBlypJpRJVIgTJ0IluEGCb1BDYCzWFx79h/yl5ZV3PVUSVAQIDFhCyLO/h9E9KfuOPriOqzUFjmRYYueOqTWLGfhPfHZcGrkOlgcAGskZdAV7/eIVA2eN6qZGA3Yhcxxozn3+mkD3ZQ64Z3EnQJEBouMB+Xr+68LpAuTZBOokDoPXfNIK85vZP5AqUreNqdYI6AUINkBrAtUatgaA67mEft38GvxRThWopOAFrBbj9kYXsa3z0mnrTsLAHe3yRzxGhjoBQ0BT848foqfONkT6FAAWrce3PeEpA5vZPsDf23aIhgpfIiEiIiH/mKftPfKJxTjaNv8bM6zlSzk5dmIsMDk7EGrMEbj+e+q5xLjoyOrQbGiCCaZh5/PgLzy8YiIrgNPmaZtQovP6J3ezNafTvxEfHQ2An8v/2K47hV4J0ExVBDbNCD4e/nH0lKj1+1RBvMEQboiEMUJI1BOmmGq0pVOP1z3nYF3G53EAIN4SHx4djNyxAkutQA1QnGeD2z3rY199RIZ+EtVxDPaDm9VdspYcWj65pteFaonIDBghpzeXyzNNTbyy8CpgCyCehjnvYx+uf9RTTU9cbo7SbRPmKQBnzaKMI2igthD8jVAvIuM/rXytjfyz4MFqBDgLWPGuA05/sqRQobaOzsBMbFQsRhaAWco/A6Z92FAuU446wWL+aHJWcHJtMOzEDwWrU+PyvHEcFRlkutELInT4NFiCRGqA6yQDWfH5jWdFegXLL8V3qDIsNIySHoRsWIGMN/wBY8/mXRosFxrrDCE20EwJzCGQ9XP7crBN46AdHbthmkPvluICccLzgchnDjBD/eqaxKOOtIKGyiEzDqSFOCt7D4X/dlHFDkNCWPu3fjTHGQBgpbI06TkeIpuQ37bbltAlSKstM/g6EdYcEr0jJv2rLfrZXkFKcPhVjMsWY0GGSrTn00H7TakbD11sChd7qa+gCSKdJVitpyvWLlab6uifsieKtLk1N7QZWtvpYXl4aGxsrAtIJBQVNWVlZOTkZGRm2z7bHW0q2lJRkZ2c3NOTn19fV19fn5zfAsmQL8Nhmg66cHOhvKigoSC/Iysk+vH9//jd2n8g6TG7yjbXZYCAMq6s7fBiah4aGLl0aGLhw4f758zuBmpq+vurq6h07dnR1dXTcrqqq2uejqup2R0dXF8jV1X19NTU1O3feu3f+/oWBgUtD++uePHtbLAThNzRClbi+VnseAAAAAElFTkSuQmCC";return n.$$set=h=>{"text"in h&&e(0,i=h.text),"icon_url"in h&&e(1,s=h.icon_url),"distance"in h&&e(2,o=h.distance),"opacity"in h&&e(3,r=h.opacity),"name"in h&&e(4,a=h.name),"i18n"in h&&e(5,l=h.i18n)},[i,s,o,r,a,l,c]}class z3 extends ue{constructor(t){super(),de(this,t,j3,T3,he,{text:0,icon_url:1,distance:2,opacity:3,name:4,i18n:5},L3)}}function O3(n){return n.length===0?[]:n.filter((t,e)=>t!==n[e-1])}const V3=`
619
619
  varying vec2 vUv;
620
620
  varying float ignoreAnimationMap;
621
621
  attribute float animationWillError;