soonspacejs 2.6.21 → 2.6.22

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.esm.js CHANGED
@@ -1,10 +1,10 @@
1
- import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as A,LineCurve3 as x,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as _,Mesh as k,EdgesGeometry as L,LineSegments as N,MeshStandardMaterial as U,PerspectiveCamera as j,OrthographicCamera as F,WebGLRenderer as z,PCFSoftShadowMap as G,Sphere as H,REVISION as V,Camera as W,BasicDepthPacking as Y,UnsignedByteType as Q,MeshNormalMaterial as X,WebGLRenderTarget as Z,NearestFilter as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,Uniform as te,RepeatWrapping as ne,LoadingManager as ie,LinearFilter as re,RGBAFormat as se,ShaderMaterial as oe,NoBlending as ae,RGBADepthPacking as le,EventDispatcher as ce,BackSide as ue,DoubleSide as he,FrontSide as de,MeshDepthMaterial as fe,FloatType as pe,DataTexture as ge,LuminanceFormat as me,LinearEncoding as ve,sRGBEncoding as ye,Vector4 as we,Material as be,RedFormat as Ae,RGFormat as xe,ShaderChunk as Se,WebGLCubeRenderTarget as Te,CubeCamera as Ee,PMREMGenerator as De,WebGLMultipleRenderTargets as Ce,FramebufferTexture as Ie,Matrix3 as Be,TangentSpaceNormalMap as Me,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as _e,Frustum as ke,MOUSE as Le,TOUCH as Ne,Spherical as Ue,MeshBasicMaterial as je,PlaneGeometry as Fe,Clock as ze,Raycaster as Ge,AnimationMixer as He,UVMapping as Ve,ACESFilmicToneMapping as We,NoToneMapping as Ye,LinearToneMapping as Qe,ReinhardToneMapping as Xe,CineonToneMapping as Ze,Sprite as Ke,SpriteMaterial as qe,SphereGeometry as Je,CircleGeometry as $e,ShapeGeometry as et,Shape as tt,AmbientLight as nt,DirectionalLight as it,HemisphereLight as rt,SpotLight as st,PointLight as ot,RectAreaLight as at,Loader as lt,LoaderUtils as ct,FileLoader as ut,ClampToEdgeWrapping as ht,Group as dt,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as gt,ImageLoader as mt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,DirectionalLightHelper as At,HemisphereLightHelper as xt,SpotLightHelper as St,PointLightHelper as Tt,Box2 as Et,Plane as Dt,CanvasTexture as Ct,MeshPhongMaterial as It}from"three";export*from"three";import{RGBELoader as Bt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Mt}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Pt}from"three/examples/jsm/environments/RoomEnvironment.js";import Ot from"three/examples/jsm/libs/stats.module.js";import{Sky as Rt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as _t}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Lt,computeBoundsTree as Nt,disposeBoundsTree as Ut,acceleratedRaycast as jt}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Ft}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as zt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Ht}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Vt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Wt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Yt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Qt="soonspacejs",Xt="2.6.21",Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Kt(){throw new Error("setTimeout has not been defined")}function qt(){throw new Error("clearTimeout has not been defined")}var Jt=Kt,$t=qt;function en(e){if(Jt===setTimeout)return setTimeout(e,0);if((Jt===Kt||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(e,0);try{return Jt(e,0)}catch(t){try{return Jt.call(null,e,0)}catch(t){return Jt.call(this,e,0)}}}"function"==typeof Zt.setTimeout&&(Jt=setTimeout),"function"==typeof Zt.clearTimeout&&($t=clearTimeout);var tn,nn=[],rn=!1,sn=-1;function on(){rn&&tn&&(rn=!1,tn.length?nn=tn.concat(nn):sn=-1,nn.length&&an())}function an(){if(!rn){var e=en(on);rn=!0;for(var t=nn.length;t;){for(tn=nn,nn=[];++sn<t;)tn&&tn[sn].run();sn=-1,t=nn.length}tn=null,rn=!1,function(e){if($t===clearTimeout)return clearTimeout(e);if(($t===qt||!$t)&&clearTimeout)return $t=clearTimeout,clearTimeout(e);try{$t(e)}catch(t){try{return $t.call(null,e)}catch(t){return $t.call(this,e)}}}(e)}}function ln(e,t){this.fun=e,this.array=t}ln.prototype.run=function(){this.fun.apply(null,this.array)};function cn(){}var un=cn,hn=cn,dn=cn,fn=cn,pn=cn,gn=cn,mn=cn;var vn=Zt.performance||{},yn=vn.now||vn.mozNow||vn.msNow||vn.oNow||vn.webkitNow||function(){return(new Date).getTime()};var wn=new Date;var bn,An={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];nn.push(new ln(e,t)),1!==nn.length||rn||en(an)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:un,addListener:hn,once:dn,off:fn,removeListener:pn,removeAllListeners:gn,emit:mn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*yn.call(vn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-wn)/1e3}},xn={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-xn.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*xn.Bounce.In(2*e):.5*xn.Bounce.Out(2*e-1)+.5}}},Sn="undefined"==typeof self&&void 0!==An&&An.hrtime?function(){var e=An.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Tn=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Sn()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),En={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=En.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=En.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(bn=[1],function(e){var t=1;if(bn[e])return bn[e];for(var n=e;n>1;n--)t*=n;return bn[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},Dn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Cn=new Tn,In=function(){function e(e,t){void 0===t&&(t=Cn),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=xn.Linear.None,this._interpolationFunction=En.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Dn.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?Sn()+parseFloat(e):e:Sn(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var u in t[r]=o?[]:{},s)t[r][u]=s[u];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.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},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Sn()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Sn()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=Sn()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),Bn=Dn.nextId,Mn=Cn,Pn=Mn.getAll.bind(Mn),On=Mn.removeAll.bind(Mn),Rn=Mn.add.bind(Mn),_n=Mn.remove.bind(Mn),kn=Mn.update.bind(Mn),Ln={Easing:xn,Group:Tn,Interpolation:En,now:Sn,Sequence:Dn,nextId:Bn,Tween:In,VERSION:"18.6.4",getAll:Pn,removeAll:On,add:Rn,remove:_n,update:kn};const Nn="[soonspacejs]: ",Un="Group",jn="Light",Fn="Model",zn="Poi",Gn="PoiNode",Hn="Canvas3D",Vn="Topology",Wn="Helper",Yn="PluginObject",Qn="In soonspacejs: ",Xn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Zn=e=>{console.warn(Qn+e)};function Kn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function qn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Jn(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function $n(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function ei(e,t){const i=$n("x",e,t),r=$n("y",e,t),s=$n("z",e,t);return new n(i.x,r.y,s.z,t.order)}function ti(e){return Math.PI/180*e}function ni(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ii(e,t){const n=ni(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function ri(e){return!!e.visible&&(!e.parent||ri(e.parent))}class si{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}async function oi(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=Ri(n);if("hdr"===e||"pic"===e){const e=await(new Bt).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function ai(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const li=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function ci(e){return Ci(e)?function(e){return e.map((e=>ci(e)))}(e):Ii(e)?function(e){if(Ii(e)){const t={};for(const n in e)t[n]=ci(e[n]);return t}return e}(e):e}const ui=(e,t)=>Ci(e)?e.map(t):t(e),hi=e=>ui(e,(e=>e.clone())),di=e=>ui(e,(e=>e.dispose())),fi=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},pi=new t,gi=new t,mi=new t;function vi(e,t){const n=pi.setFromMatrixPosition(e.matrixWorld),i=gi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(mi);return r.angleTo(s)>Math.PI/2}function yi(e,t,n,i){const r=pi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const wi=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var bi=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Ai(e){return fi(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new bi).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class xi{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Si=Object.prototype.hasOwnProperty,Ti=e=>"String"===Mi(e),Ei=e=>"Boolean"===Mi(e),Di=e=>"Number"===Mi(e),Ci=Array.isArray,Ii=e=>"Object"===Mi(e),Bi=e=>"Function"===Mi(e),Mi=e=>Object.prototype.toString.call(e).slice(8,-1),Pi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Oi=()=>Nn+Math.random().toString(36).substring(7).split("").join("_"),Ri=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var _i=Object.freeze({__proto__:null,IVector3ToEuler:qn,IVector3ToVector3:Kn,MinHeap:si,cloneDeep:ci,cloneMaterials:hi,deg2Euler:ti,disposeMaterials:di,error:e=>{console.error(Qn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{const r=new Mt;r.register((e=>new xi(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:fi,getAsciiString:Pi,getBoundingBox:Jn,getExtension:Ri,getSpaceAttributeFromObject:ni,getTexture:oi,getValueType:Mi,gradientTexture:ai,hasOwn:(e,t)=>Si.call(e,t),idleTask:wi,isArray:Ci,isBoolean:Ei,isDate:e=>"Date"===Mi(e),isFunction:Bi,isNull:e=>"Null"===Mi(e),isNumber:Di,isObject:Ii,isObjectBehindCamera:vi,isObjectOccludeVisible:yi,isObjectVisible:ri,isPromise:e=>"Promise"===Mi(e),isString:Ti,isSymbol:e=>"Symbol"===Mi(e),isUndefined:e=>"Undefined"===Mi(e),log:Xn,materialHandle:ui,parseFilePath:li,randomString:Oi,rotationAFix:ei,rotationAxisFix:$n,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ii,warn:Zn,xmlToJson:Ai});const ki={"Linear.None":xn.Linear.None,"Quadratic.In":xn.Quadratic.In,"Quadratic.Out":xn.Quadratic.Out,"Quadratic.InOut":xn.Quadratic.InOut,"Cubic.In":xn.Cubic.In,"Cubic.Out":xn.Cubic.Out,"Cubic.InOut":xn.Cubic.InOut,"Quartic.In":xn.Quartic.In,"Quartic.Out":xn.Quartic.Out,"Quartic.InOut":xn.Quartic.InOut,"Quintic.In":xn.Quintic.In,"Quintic.Out":xn.Quintic.Out,"Quintic.InOut":xn.Quintic.InOut,"Sinusoidal.In":xn.Sinusoidal.In,"Sinusoidal.Out":xn.Sinusoidal.Out,"Sinusoidal.InOut":xn.Sinusoidal.InOut,"Exponential.In":xn.Exponential.In,"Exponential.Out":xn.Exponential.Out,"Exponential.InOut":xn.Exponential.InOut,"Circular.In":xn.Circular.In,"Circular.Out":xn.Circular.Out,"Circular.InOut":xn.Circular.InOut,"Elastic.In":xn.Elastic.In,"Elastic.Out":xn.Elastic.Out,"Elastic.InOut":xn.Elastic.InOut,"Back.In":xn.Back.In,"Back.Out":xn.Back.Out,"Back.InOut":xn.Back.InOut,"Bounce.In":xn.Bounce.In,"Bounce.Out":xn.Bounce.Out,"Bounce.InOut":xn.Bounce.InOut};function Li(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=ki[h],p=new In(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Di(u)?p.repeat(u):Ei(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class Ni{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=Kn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=Kn(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await Li(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Ui=Object.defineProperty,ji=(e,t,n)=>(((e,t,n)=>{t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Fi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function zi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Gi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Hi(e){const{curve:t}=e;let n=t.getLength();const i=Gi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Vi(e,t){const n=Gi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Wi(i,{...t,lengths:r})}function Wi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??Qi(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Yi(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Wi(e,t):Vi(e,t);return new v(r,n)}function Qi(e){const t=Xi(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Xi(e){const t=[];return e.reduce(((e,n)=>{const i=new y(e,n);return t.push(i),n})),t}function Zi(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function Ki(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=qi(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function qi(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function Ji(e){const t=new b,n=null==e[0].z?A:x;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var $i=(e=>(e.back="back",e.front="front",e))($i||{});function er(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function tr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const nr=new t,ir=new t(1,1,1);new r;const rr=new d;function sr(e){const{joints:t,axials:n}=e;if(t)var i=ar(t);else i=n?or(e):lr(e);return i}function or(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function ar(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),or({axials:t,start:e[0]})}function lr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),or({axials:r,start:t})}function cr(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function ur(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),cr({...e,start:o,axial:a,number:n.bones.length})}function hr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??rr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Xi(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=Ki(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function dr(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=sr(e);i.add(r[0]);const s=new D(r);return i.bind(s),hr({...e,skeleton:s}),i}function fr(e){const{skeleton:t}=e,n=pr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function pr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),hr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function gr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=sr(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=mr({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function mr(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?pr({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)mr({...e,target:t,parent:s});return s}function vr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function yr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function wr(e){return yr(e)??e[0]}function br(e){return e.curve?Ar(e):Cr(e)}function Ar(e){const{keyframeTracks:t,duration:n}=xr(e);return new C(e.name,n,t)}function xr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Hi(e).division,s=Sr(e,t.getLength()),o=P,a=[],l=Er(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Dr(c),{points:h,rotates:d}=Tr(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Sr(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function Tr(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??nr).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=rr.clone(),A=rr.clone(),x=ir.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,A=o.matrixWorld,x=o.scale,S=o.up);const T=b.clone().invert(),E=A.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,_=R-1;let{distance:k,curveLength:L,lengths:N}=a??{};k=k??0;let U=O;0!==k&&(N||(N=zi(s,y,w).lengths),null==L&&(L=N[_]),U=(e,t)=>{const n=P(e);let i=(N[t]+k)/L;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let j=e=>{const t=y[e],n=U(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);j=c?function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e).normalize();o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o).normalize(),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l.normalize()}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=j(e);f.push(t),B=(new d).compose(nr,t,x)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function Er(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Dr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function Cr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=Ir(e);else{const t=Ji(n);var{keyframeTracks:i,duration:r}=xr({...e,curve:t})}return new C(e.name,r,i)}function Ir(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=Qi(n),o=Sr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=Br({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function Br(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Xi(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const A=(e.anchor??nr).clone();let x=rr.clone(),S=rr.clone(),T=ir.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),x=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=x.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=x.clone().setPosition(0,0,0),R=O,_=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);_=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e).normalize();a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a).normalize(),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s).normalize();const n=e.clone().projectOnPlane(s).normalize(),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(f)if(e<g){const t=_(e);m.push(t),O=(new d).compose(nr,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=A.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=A.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function Mr(e){const t=e.mixer,n=gr(e),{model:i,skeleton:r}=n,s=Pr({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function Pr(e){const{boneTracks:t,duration:n}=Or(e),i=t.flat();return new C(e.name,n,i)}function Or(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=Rr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function Rr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=Hi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,A=new r,x=new t;w.decompose(b,A,x);const S=Sr(e,p),T=Er(f),E=Dr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=Tr({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(A).normalize();const i=(new d).compose(e,n,x);return i.premultiply(g),i})),_=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:_,matrixs:R}],L=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=er({curve:i,distance:n,fromU:r,length:p,side:$i.front,tolerance:h*n});return{u:s,point:a?o:null}},N=l.length,U=N-1;for(let e=1;e<N;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),A=u-1,x=A<0?C:k[A].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=L(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=x[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),A=m[t];y.sub(A).normalize();const D=w[t],C=(new d).compose(A,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P).normalize(),f.compose(A,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const _=(new d).compose(c,T,E);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T).normalize(),s[t]=n,_.compose(c,n,E)}_.premultiply(f),a.push(_)}}return{times:E,boneSampleDatas:k,duration:S}}function _r(e){const{boneTracks:t,targetTracks:n,duration:i}=kr(e),r=n.concat(t.flat());return new C(e.name,i,r)}function kr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=Lr(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function Lr(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=Hi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const A=b[0],x=new t,S=new r,T=new t;A.decompose(x,S,T);const E=Sr(e,f),D=Er(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=Tr({...e,curve:n,target:c,position:!0,rotate:!0,anchor:x,front:I,ts:D}),P=Dr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},_=[],k=O.map((e=>(_.push(S.clone()),e.clone().multiply(A)))),L=D.length,N=n.getLengths(h).map((e=>e/f)),U=[{rotates:_,us:N,matrixs:k}],j=s?function(e,t,i){const r=U[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=er({curve:n,distance:i,fromU:r,length:f,side:$i.front,tolerance:u*i});return{u:s,point:a?o:null}},F=a.length,z=F-1;for(let e=1;e<F;e++){const i=[],s=[],o=[],a=[];U.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,A=new r,x=new t;f.decompose(y,A,x);const S=u-1,T=S<0?O:U[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<L;t++){const{point:c,u:h}=j(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,x),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(A).normalize(),f.compose(S,M,x),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const _=c.length();c.copy(E).multiplyScalar(_/B),i.push(c);const k=(new d).compose(c,D,C);if(e===z){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:U,targetSampleDatas:R,duration:E}}function Nr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class Ur{constructor(e){ji(this,"_tracksTimeRatios",null),ji(this,"_lastGetTime",0),ji(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=Nr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class jr extends Ur{constructor(e){super(e.getClip()),ji(this,"_trackNames"),ji(this,"_positionTrackName"),ji(this,"_quaternionTrackName"),ji(this,"_rotationTrackName"),ji(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class Fr extends jr{forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function zr(e){const t=new Fr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Gr{constructor(e){ji(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&zr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function Hr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Vr extends Gr{constructor(e,t=[]){super(e),ji(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Hr}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function Wr(e){const t=new Vr(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function Yr(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function Qr(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=Yr(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}ji(Vr,"updateGUI",Hr);var Xr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Zr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Kr={},qr={},Jr=function(e,t){return Jr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Jr(e,t)};var $r=function(){return $r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},$r.apply(this,arguments)};function es(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var ts=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function ns(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function is(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function rs(e){return this instanceof rs?(this.v=e,this):new rs(e)}var ss=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function os(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function as(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var ls=Object.freeze({__proto__:null,get __assign(){return $r},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:rs(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof rs?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ns(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:rs,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:os,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:as,__createBinding:ts,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ts(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Jr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&ts(t,e,n);return ss(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:is,__rest:es,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(is(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:ns}),cs=Zr(ls),us={},hs={},ds={},fs={};Object.defineProperty(fs,"__esModule",{value:!0});var ps=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();fs.SlotList=ps;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});var ms=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();gs.Slot=ms,Object.defineProperty(ds,"__esModule",{value:!0});var vs=fs,ys=gs,ws=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=vs.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=vs.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new ys.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();ds.OnceSignal=ws,Object.defineProperty(hs,"__esModule",{value:!0});var bs=cs,As=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return bs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(ds.OnceSignal);hs.Signal=As,Object.defineProperty(us,"__esModule",{value:!0});var xs=cs,Ss=gs,Ts=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xs.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Ss.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(hs.Signal);us.PrioritySignal=Ts,Object.defineProperty(qr,"__esModule",{value:!0});var Es=cs,Ds=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return Es.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(us.PrioritySignal);qr.DeluxeSignal=Ds;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var Is=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();Cs.GenericEvent=Is;var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.IOnceSignal=Symbol("IOnceSignal");var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.IPrioritySignal=Symbol("IPrioritySignal");var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.ISignal=Symbol("ISignal");var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.ISlot=Symbol("ISlot");var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var _s=gs,ks=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new _s.Slot(e,this,t)},e}();Rs.MonoSignal=ks;var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var Ns=cs,Us=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ns.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(ds.OnceSignal);Ls.Promise=Us,Object.defineProperty(Kr,"__esModule",{value:!0});var js=qr;Kr.DeluxeSignal=js.DeluxeSignal;var Fs=Cs;Kr.GenericEvent=Fs.GenericEvent;var zs=Bs;Kr.IOnceSignal=zs.IOnceSignal;var Gs=Ms;Kr.IPrioritySignal=Gs.IPrioritySignal;var Hs=Ps;Kr.ISignal=Hs.ISignal;var Vs=Os;Kr.ISlot=Vs.ISlot;var Ws=Rs;Kr.MonoSignal=Ws.MonoSignal;var Ys=ds;Kr.OnceSignal=Ys.OnceSignal;var Qs=us;Kr.PrioritySignal=Qs.PrioritySignal;var Xs=Ls;Kr.Promise=Xs.Promise;var Zs=hs,Ks=Kr.Signal=Zs.Signal,qs=gs;Kr.Slot=qs.Slot;var Js=fs;Kr.SlotList=Js.SlotList;const $s=new R;$s.name="Scene";class eo{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=$s.clone(),this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void Zn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),ui(n.material,t)}e instanceof ih&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new _(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return Ci(e)?e.forEach((e=>i(e))):Ii(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new th({id:e.uuid});return e.traverse((n=>{if(n instanceof k){const i=new L(n.geometry,89),r=new N(i,new m({color:s,transparent:!0,opacity:o}));ii(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),Ci(e)?Promise.all(e.map((e=>a(e)))):Ii(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){const t=hi(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=ui(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>s(e)))):Ii(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof U&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material),ui(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>s(e)))):Ii(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof U&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Li({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material),ui(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>l(e)))):Ii(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Ln.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;ui(e.material,t),di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ci(e)?Promise.all(e.map((e=>n(e)))):Ii(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof eh)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class to extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof to&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const no=new t,io=new d,ro=new d,so=new t,oo=new t;class ao{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),io.copy(t.matrixWorldInverse),ro.multiplyMatrices(t.projectionMatrix,io),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof to&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof to){const t=e.parent;if(t.occlude){const t=!vi(e,this.viewport.camera)&&yi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}no.setFromMatrixPosition(e.matrixWorld),no.applyMatrix4(ro);const o=ri(e)&&no.z>=-1&&no.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(no.x*i+i)+"px,"+(-no.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return so.setFromMatrixPosition(e.matrixWorld),oo.setFromMatrixPosition(t.matrixWorld),so.distanceToSquared(oo)}}}const lo=new t,co=new r,uo=new t;class ho extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ho&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class fo extends ho{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const po=new d,go=new d;class mo{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function u(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,u)=>{const d=u.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=u instanceof j?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof F&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof F?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof ho){const t=e.parent;if(t.occlude){const t=!vi(e,this.viewport.camera)&&yi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=ri(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof fo?(po.copy(n.matrixWorldInverse),po.transpose(),0!==e.rotation2D&&po.multiply(go.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(lo,co,uo),po.setPosition(lo),po.scale(uo),po.elements[3]=0,po.elements[7]=0,po.elements[11]=0,po.elements[15]=1,t=u(po)):t=u(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)h(e.children[i],t,n)}}}class vo{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new z({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new ao(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new mo(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const yo=new d,wo=(e,t)=>{const i=yo.clone(),r=yo.clone(),s=yo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},bo=wo(-Math.PI/2,-Math.PI/4),Ao=wo(Math.PI/2,-Math.PI/4),xo=wo(-Math.PI/4,-Math.PI/4),So=wo(Math.PI/4,-Math.PI/4),To=wo(1.25*Math.PI,-Math.PI/4),Eo=wo(.75*Math.PI,-Math.PI/4),Do={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(bo.x,bo.y,bo.z),RIGHTTOP:new n(Ao.x,Ao.y,Ao.z),LEFTFRONTTOP:new n(xo.x,xo.y,xo.z),RIGHTFRONTTOP:new n(So.x,So.y,So.z),LEFTBACKTOP:new n(To.x,To.y,To.z),RIGHTBACKTOP:new n(Eo.x,Eo.y,Eo.z)},Co=e=>Di(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Io=new t,Bo=new n,Mo=new j(50,1,.1,5e5);Mo.position.set(500,1e3,500),Mo.lookAt(Io.set(0,0,0)),Mo.name="Camera";class Po{constructor(e){this.viewport=e,this.mainCamera=Mo.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Mo.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Ii(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(Ii(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return Li(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Li({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(Ti(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Bo.copy(this.currentCamera.rotation):Do[e]&&Bo.copy(Do[e])}else t instanceof n?Bo.copy(t):Ii(t)&&Bo.set(t.x,t.y,t.z);Bo.copy(ei(this.currentCamera.rotation,Bo.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Bo,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void Zn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ti(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Do[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Zn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=qn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Io),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=Bo.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof ah||e instanceof ih){const{padding:t=50}=i,r=Co(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Jn(e),o=s.getSize(Io);let a=0;if(Ti(r)){const e=Math.max(o.x,o.y,o.z);a=Co(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(Io.set(l/2,c/2,l/2)),s.min.sub(Io.set(l/2,c/2,l/2))),s.isEmpty()&&(Io.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Io,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=Kn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Li({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(Io);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Io);(new t).subVectors(i,n).normalize();let r=new H;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof eh&&(e=(new i).setFromObject(e)),e.isEmpty())return Zn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Io),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Ti(n)?Do[n.toLocaleUpperCase()]:qn(n),a(Io.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Io).clone():new t}}
1
+ import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as A,LineCurve3 as x,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as _,Mesh as k,EdgesGeometry as L,LineSegments as N,MeshStandardMaterial as U,PerspectiveCamera as j,OrthographicCamera as F,WebGLRenderer as z,PCFSoftShadowMap as G,Sphere as H,REVISION as V,Camera as W,BasicDepthPacking as Y,UnsignedByteType as Q,MeshNormalMaterial as X,WebGLRenderTarget as Z,NearestFilter as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,Uniform as te,RepeatWrapping as ne,LoadingManager as ie,LinearFilter as re,RGBAFormat as se,ShaderMaterial as oe,NoBlending as ae,RGBADepthPacking as le,EventDispatcher as ce,BackSide as ue,DoubleSide as he,FrontSide as de,MeshDepthMaterial as fe,FloatType as pe,DataTexture as ge,LuminanceFormat as me,LinearEncoding as ve,sRGBEncoding as ye,Vector4 as we,Material as be,RedFormat as Ae,RGFormat as xe,ShaderChunk as Se,WebGLCubeRenderTarget as Te,CubeCamera as Ee,PMREMGenerator as De,WebGLMultipleRenderTargets as Ce,FramebufferTexture as Ie,Matrix3 as Be,TangentSpaceNormalMap as Me,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as _e,Frustum as ke,MOUSE as Le,TOUCH as Ne,Spherical as Ue,MeshBasicMaterial as je,PlaneGeometry as Fe,Clock as ze,Raycaster as Ge,AnimationMixer as He,UVMapping as Ve,ACESFilmicToneMapping as We,NoToneMapping as Ye,LinearToneMapping as Qe,ReinhardToneMapping as Xe,CineonToneMapping as Ze,Sprite as Ke,SpriteMaterial as qe,SphereGeometry as Je,CircleGeometry as $e,ShapeGeometry as et,Shape as tt,AmbientLight as nt,DirectionalLight as it,HemisphereLight as rt,SpotLight as st,PointLight as ot,RectAreaLight as at,Loader as lt,LoaderUtils as ct,FileLoader as ut,ClampToEdgeWrapping as ht,Group as dt,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as gt,ImageLoader as mt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,DirectionalLightHelper as At,HemisphereLightHelper as xt,SpotLightHelper as St,PointLightHelper as Tt,Box2 as Et,Plane as Dt,CanvasTexture as Ct,MeshPhongMaterial as It}from"three";export*from"three";import{RGBELoader as Bt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Mt}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Pt}from"three/examples/jsm/environments/RoomEnvironment.js";import Ot from"three/examples/jsm/libs/stats.module.js";import{Sky as Rt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as _t}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Lt,computeBoundsTree as Nt,disposeBoundsTree as Ut,acceleratedRaycast as jt}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Ft}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as zt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Ht}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Vt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Wt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Yt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Qt="soonspacejs",Xt="2.6.22",Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Kt(){throw new Error("setTimeout has not been defined")}function qt(){throw new Error("clearTimeout has not been defined")}var Jt=Kt,$t=qt;function en(e){if(Jt===setTimeout)return setTimeout(e,0);if((Jt===Kt||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(e,0);try{return Jt(e,0)}catch(t){try{return Jt.call(null,e,0)}catch(t){return Jt.call(this,e,0)}}}"function"==typeof Zt.setTimeout&&(Jt=setTimeout),"function"==typeof Zt.clearTimeout&&($t=clearTimeout);var tn,nn=[],rn=!1,sn=-1;function on(){rn&&tn&&(rn=!1,tn.length?nn=tn.concat(nn):sn=-1,nn.length&&an())}function an(){if(!rn){var e=en(on);rn=!0;for(var t=nn.length;t;){for(tn=nn,nn=[];++sn<t;)tn&&tn[sn].run();sn=-1,t=nn.length}tn=null,rn=!1,function(e){if($t===clearTimeout)return clearTimeout(e);if(($t===qt||!$t)&&clearTimeout)return $t=clearTimeout,clearTimeout(e);try{$t(e)}catch(t){try{return $t.call(null,e)}catch(t){return $t.call(this,e)}}}(e)}}function ln(e,t){this.fun=e,this.array=t}ln.prototype.run=function(){this.fun.apply(null,this.array)};function cn(){}var un=cn,hn=cn,dn=cn,fn=cn,pn=cn,gn=cn,mn=cn;var vn=Zt.performance||{},yn=vn.now||vn.mozNow||vn.msNow||vn.oNow||vn.webkitNow||function(){return(new Date).getTime()};var wn=new Date;var bn,An={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];nn.push(new ln(e,t)),1!==nn.length||rn||en(an)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:un,addListener:hn,once:dn,off:fn,removeListener:pn,removeAllListeners:gn,emit:mn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*yn.call(vn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-wn)/1e3}},xn={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-xn.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*xn.Bounce.In(2*e):.5*xn.Bounce.Out(2*e-1)+.5}}},Sn="undefined"==typeof self&&void 0!==An&&An.hrtime?function(){var e=An.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Tn=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Sn()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),En={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=En.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=En.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(bn=[1],function(e){var t=1;if(bn[e])return bn[e];for(var n=e;n>1;n--)t*=n;return bn[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},Dn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Cn=new Tn,In=function(){function e(e,t){void 0===t&&(t=Cn),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=xn.Linear.None,this._interpolationFunction=En.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Dn.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?Sn()+parseFloat(e):e:Sn(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var u in t[r]=o?[]:{},s)t[r][u]=s[u];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.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},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Sn()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Sn()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=Sn()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),Bn=Dn.nextId,Mn=Cn,Pn=Mn.getAll.bind(Mn),On=Mn.removeAll.bind(Mn),Rn=Mn.add.bind(Mn),_n=Mn.remove.bind(Mn),kn=Mn.update.bind(Mn),Ln={Easing:xn,Group:Tn,Interpolation:En,now:Sn,Sequence:Dn,nextId:Bn,Tween:In,VERSION:"18.6.4",getAll:Pn,removeAll:On,add:Rn,remove:_n,update:kn};const Nn="[soonspacejs]: ",Un="Group",jn="Light",Fn="Model",zn="Poi",Gn="PoiNode",Hn="Canvas3D",Vn="Topology",Wn="Helper",Yn="PluginObject",Qn="In soonspacejs: ",Xn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Zn=e=>{console.warn(Qn+e)};function Kn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function qn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Jn(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function $n(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function ei(e,t){const i=$n("x",e,t),r=$n("y",e,t),s=$n("z",e,t);return new n(i.x,r.y,s.z,t.order)}function ti(e){return Math.PI/180*e}function ni(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ii(e,t){const n=ni(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function ri(e){return!!e.visible&&(!e.parent||ri(e.parent))}class si{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}async function oi(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=Ri(n);if("hdr"===e||"pic"===e){const e=await(new Bt).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function ai(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const li=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function ci(e){return Ci(e)?function(e){return e.map((e=>ci(e)))}(e):Ii(e)?function(e){if(Ii(e)){const t={};for(const n in e)t[n]=ci(e[n]);return t}return e}(e):e}const ui=(e,t)=>Ci(e)?e.map(t):t(e),hi=e=>ui(e,(e=>e.clone())),di=e=>ui(e,(e=>e.dispose())),fi=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},pi=new t,gi=new t,mi=new t;function vi(e,t){const n=pi.setFromMatrixPosition(e.matrixWorld),i=gi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(mi);return r.angleTo(s)>Math.PI/2}function yi(e,t,n,i){const r=pi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const wi=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var bi=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Ai(e){return fi(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new bi).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class xi{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Si=Object.prototype.hasOwnProperty,Ti=e=>"String"===Mi(e),Ei=e=>"Boolean"===Mi(e),Di=e=>"Number"===Mi(e),Ci=Array.isArray,Ii=e=>"Object"===Mi(e),Bi=e=>"Function"===Mi(e),Mi=e=>Object.prototype.toString.call(e).slice(8,-1),Pi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Oi=()=>Nn+Math.random().toString(36).substring(7).split("").join("_"),Ri=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var _i=Object.freeze({__proto__:null,IVector3ToEuler:qn,IVector3ToVector3:Kn,MinHeap:si,cloneDeep:ci,cloneMaterials:hi,deg2Euler:ti,disposeMaterials:di,error:e=>{console.error(Qn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{const r=new Mt;r.register((e=>new xi(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:fi,getAsciiString:Pi,getBoundingBox:Jn,getExtension:Ri,getSpaceAttributeFromObject:ni,getTexture:oi,getValueType:Mi,gradientTexture:ai,hasOwn:(e,t)=>Si.call(e,t),idleTask:wi,isArray:Ci,isBoolean:Ei,isDate:e=>"Date"===Mi(e),isFunction:Bi,isNull:e=>"Null"===Mi(e),isNumber:Di,isObject:Ii,isObjectBehindCamera:vi,isObjectOccludeVisible:yi,isObjectVisible:ri,isPromise:e=>"Promise"===Mi(e),isString:Ti,isSymbol:e=>"Symbol"===Mi(e),isUndefined:e=>"Undefined"===Mi(e),log:Xn,materialHandle:ui,parseFilePath:li,randomString:Oi,rotationAFix:ei,rotationAxisFix:$n,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ii,warn:Zn,xmlToJson:Ai});const ki={"Linear.None":xn.Linear.None,"Quadratic.In":xn.Quadratic.In,"Quadratic.Out":xn.Quadratic.Out,"Quadratic.InOut":xn.Quadratic.InOut,"Cubic.In":xn.Cubic.In,"Cubic.Out":xn.Cubic.Out,"Cubic.InOut":xn.Cubic.InOut,"Quartic.In":xn.Quartic.In,"Quartic.Out":xn.Quartic.Out,"Quartic.InOut":xn.Quartic.InOut,"Quintic.In":xn.Quintic.In,"Quintic.Out":xn.Quintic.Out,"Quintic.InOut":xn.Quintic.InOut,"Sinusoidal.In":xn.Sinusoidal.In,"Sinusoidal.Out":xn.Sinusoidal.Out,"Sinusoidal.InOut":xn.Sinusoidal.InOut,"Exponential.In":xn.Exponential.In,"Exponential.Out":xn.Exponential.Out,"Exponential.InOut":xn.Exponential.InOut,"Circular.In":xn.Circular.In,"Circular.Out":xn.Circular.Out,"Circular.InOut":xn.Circular.InOut,"Elastic.In":xn.Elastic.In,"Elastic.Out":xn.Elastic.Out,"Elastic.InOut":xn.Elastic.InOut,"Back.In":xn.Back.In,"Back.Out":xn.Back.Out,"Back.InOut":xn.Back.InOut,"Bounce.In":xn.Bounce.In,"Bounce.Out":xn.Bounce.Out,"Bounce.InOut":xn.Bounce.InOut};function Li(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=ki[h],p=new In(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Di(u)?p.repeat(u):Ei(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class Ni{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=Kn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=Kn(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await Li(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Ui=Object.defineProperty,ji=(e,t,n)=>(((e,t,n)=>{t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Fi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function zi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Gi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Hi(e){const{curve:t}=e;let n=t.getLength();const i=Gi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Vi(e,t){const n=Gi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Wi(i,{...t,lengths:r})}function Wi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??Qi(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Yi(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Wi(e,t):Vi(e,t);return new v(r,n)}function Qi(e){const t=Xi(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Xi(e){const t=[];return e.reduce(((e,n)=>{const i=new y(e,n);return t.push(i),n})),t}function Zi(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function Ki(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=qi(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function qi(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function Ji(e){const t=new b,n=null==e[0].z?A:x;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var $i=(e=>(e.back="back",e.front="front",e))($i||{});function er(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function tr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const nr=new t,ir=new t(1,1,1);new r;const rr=new d;function sr(e){const{joints:t,axials:n}=e;if(t)var i=ar(t);else i=n?or(e):lr(e);return i}function or(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function ar(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),or({axials:t,start:e[0]})}function lr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),or({axials:r,start:t})}function cr(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function ur(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),cr({...e,start:o,axial:a,number:n.bones.length})}function hr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??rr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Xi(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=Ki(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function dr(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=sr(e);i.add(r[0]);const s=new D(r);return i.bind(s),hr({...e,skeleton:s}),i}function fr(e){const{skeleton:t}=e,n=pr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function pr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),hr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function gr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=sr(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=mr({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function mr(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?pr({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)mr({...e,target:t,parent:s});return s}function vr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function yr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function wr(e){return yr(e)??e[0]}function br(e){return e.curve?Ar(e):Cr(e)}function Ar(e){const{keyframeTracks:t,duration:n}=xr(e);return new C(e.name,n,t)}function xr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Hi(e).division,s=Sr(e,t.getLength()),o=P,a=[],l=Er(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Dr(c),{points:h,rotates:d}=Tr(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Sr(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function Tr(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??nr).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=rr.clone(),A=rr.clone(),x=ir.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,A=o.matrixWorld,x=o.scale,S=o.up);const T=b.clone().invert(),E=A.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,_=R-1;let{distance:k,curveLength:L,lengths:N}=a??{};k=k??0;let U=O;0!==k&&(N||(N=zi(s,y,w).lengths),null==L&&(L=N[_]),U=(e,t)=>{const n=P(e);let i=(N[t]+k)/L;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let j=e=>{const t=y[e],n=U(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);j=c?function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e).normalize();o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o).normalize(),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l.normalize()}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=j(e);f.push(t),B=(new d).compose(nr,t,x)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function Er(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Dr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function Cr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=Ir(e);else{const t=Ji(n);var{keyframeTracks:i,duration:r}=xr({...e,curve:t})}return new C(e.name,r,i)}function Ir(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=Qi(n),o=Sr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=Br({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function Br(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Xi(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const A=(e.anchor??nr).clone();let x=rr.clone(),S=rr.clone(),T=ir.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),x=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=x.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=x.clone().setPosition(0,0,0),R=O,_=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);_=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e).normalize();a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a).normalize(),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s).normalize();const n=e.clone().projectOnPlane(s).normalize(),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(f)if(e<g){const t=_(e);m.push(t),O=(new d).compose(nr,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=A.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=A.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function Mr(e){const t=e.mixer,n=gr(e),{model:i,skeleton:r}=n,s=Pr({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function Pr(e){const{boneTracks:t,duration:n}=Or(e),i=t.flat();return new C(e.name,n,i)}function Or(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=Rr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function Rr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=Hi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,A=new r,x=new t;w.decompose(b,A,x);const S=Sr(e,p),T=Er(f),E=Dr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=Tr({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(A).normalize();const i=(new d).compose(e,n,x);return i.premultiply(g),i})),_=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:_,matrixs:R}],L=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=er({curve:i,distance:n,fromU:r,length:p,side:$i.front,tolerance:h*n});return{u:s,point:a?o:null}},N=l.length,U=N-1;for(let e=1;e<N;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),A=u-1,x=A<0?C:k[A].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=L(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=x[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),A=m[t];y.sub(A).normalize();const D=w[t],C=(new d).compose(A,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P).normalize(),f.compose(A,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const _=(new d).compose(c,T,E);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T).normalize(),s[t]=n,_.compose(c,n,E)}_.premultiply(f),a.push(_)}}return{times:E,boneSampleDatas:k,duration:S}}function _r(e){const{boneTracks:t,targetTracks:n,duration:i}=kr(e),r=n.concat(t.flat());return new C(e.name,i,r)}function kr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=Lr(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function Lr(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=Hi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const A=b[0],x=new t,S=new r,T=new t;A.decompose(x,S,T);const E=Sr(e,f),D=Er(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=Tr({...e,curve:n,target:c,position:!0,rotate:!0,anchor:x,front:I,ts:D}),P=Dr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},_=[],k=O.map((e=>(_.push(S.clone()),e.clone().multiply(A)))),L=D.length,N=n.getLengths(h).map((e=>e/f)),U=[{rotates:_,us:N,matrixs:k}],j=s?function(e,t,i){const r=U[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=er({curve:n,distance:i,fromU:r,length:f,side:$i.front,tolerance:u*i});return{u:s,point:a?o:null}},F=a.length,z=F-1;for(let e=1;e<F;e++){const i=[],s=[],o=[],a=[];U.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,A=new r,x=new t;f.decompose(y,A,x);const S=u-1,T=S<0?O:U[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<L;t++){const{point:c,u:h}=j(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,x),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(A).normalize(),f.compose(S,M,x),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const _=c.length();c.copy(E).multiplyScalar(_/B),i.push(c);const k=(new d).compose(c,D,C);if(e===z){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:U,targetSampleDatas:R,duration:E}}function Nr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class Ur{constructor(e){ji(this,"_tracksTimeRatios",null),ji(this,"_lastGetTime",0),ji(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=Nr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class jr extends Ur{constructor(e){super(e.getClip()),ji(this,"_trackNames"),ji(this,"_positionTrackName"),ji(this,"_quaternionTrackName"),ji(this,"_rotationTrackName"),ji(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class Fr extends jr{forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function zr(e){const t=new Fr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Gr{constructor(e){ji(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&zr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function Hr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Vr extends Gr{constructor(e,t=[]){super(e),ji(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Hr}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function Wr(e){const t=new Vr(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function Yr(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function Qr(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=Yr(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}ji(Vr,"updateGUI",Hr);var Xr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Zr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Kr={},qr={},Jr=function(e,t){return Jr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Jr(e,t)};var $r=function(){return $r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},$r.apply(this,arguments)};function es(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var ts=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function ns(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function is(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function rs(e){return this instanceof rs?(this.v=e,this):new rs(e)}var ss=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function os(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function as(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var ls=Object.freeze({__proto__:null,get __assign(){return $r},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:rs(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof rs?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ns(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:rs,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:os,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:as,__createBinding:ts,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ts(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Jr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&ts(t,e,n);return ss(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:is,__rest:es,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(is(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:ns}),cs=Zr(ls),us={},hs={},ds={},fs={};Object.defineProperty(fs,"__esModule",{value:!0});var ps=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();fs.SlotList=ps;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});var ms=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();gs.Slot=ms,Object.defineProperty(ds,"__esModule",{value:!0});var vs=fs,ys=gs,ws=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=vs.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=vs.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new ys.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();ds.OnceSignal=ws,Object.defineProperty(hs,"__esModule",{value:!0});var bs=cs,As=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return bs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(ds.OnceSignal);hs.Signal=As,Object.defineProperty(us,"__esModule",{value:!0});var xs=cs,Ss=gs,Ts=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xs.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Ss.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(hs.Signal);us.PrioritySignal=Ts,Object.defineProperty(qr,"__esModule",{value:!0});var Es=cs,Ds=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return Es.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(us.PrioritySignal);qr.DeluxeSignal=Ds;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});var Is=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();Cs.GenericEvent=Is;var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.IOnceSignal=Symbol("IOnceSignal");var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.IPrioritySignal=Symbol("IPrioritySignal");var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.ISignal=Symbol("ISignal");var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.ISlot=Symbol("ISlot");var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var _s=gs,ks=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new _s.Slot(e,this,t)},e}();Rs.MonoSignal=ks;var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var Ns=cs,Us=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ns.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(ds.OnceSignal);Ls.Promise=Us,Object.defineProperty(Kr,"__esModule",{value:!0});var js=qr;Kr.DeluxeSignal=js.DeluxeSignal;var Fs=Cs;Kr.GenericEvent=Fs.GenericEvent;var zs=Bs;Kr.IOnceSignal=zs.IOnceSignal;var Gs=Ms;Kr.IPrioritySignal=Gs.IPrioritySignal;var Hs=Ps;Kr.ISignal=Hs.ISignal;var Vs=Os;Kr.ISlot=Vs.ISlot;var Ws=Rs;Kr.MonoSignal=Ws.MonoSignal;var Ys=ds;Kr.OnceSignal=Ys.OnceSignal;var Qs=us;Kr.PrioritySignal=Qs.PrioritySignal;var Xs=Ls;Kr.Promise=Xs.Promise;var Zs=hs,Ks=Kr.Signal=Zs.Signal,qs=gs;Kr.Slot=qs.Slot;var Js=fs;Kr.SlotList=Js.SlotList;const $s=new R;$s.name="Scene";class eo{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=$s.clone(),this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void Zn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),ui(n.material,t)}e instanceof ih&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new _(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return Ci(e)?e.forEach((e=>i(e))):Ii(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new th({id:e.uuid});return e.traverse((n=>{if(n instanceof k){const i=new L(n.geometry,89),r=new N(i,new m({color:s,transparent:!0,opacity:o}));ii(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),Ci(e)?Promise.all(e.map((e=>a(e)))):Ii(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){const t=hi(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=ui(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>s(e)))):Ii(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof U&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material),ui(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>s(e)))):Ii(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ci(e)?Promise.all(e.map((e=>t(e)))):Ii(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof U&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Li({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material),ui(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ci(e)?Promise.all(e.map((e=>l(e)))):Ii(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Ln.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;ui(e.material,t),di(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ci(e)?Promise.all(e.map((e=>n(e)))):Ii(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof eh)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class to extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof to&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const no=new t,io=new d,ro=new d,so=new t,oo=new t;class ao{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),io.copy(t.matrixWorldInverse),ro.multiplyMatrices(t.projectionMatrix,io),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof to&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof to){const t=e.parent;if(t.occlude){const t=!vi(e,this.viewport.camera)&&yi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}no.setFromMatrixPosition(e.matrixWorld),no.applyMatrix4(ro);const o=ri(e)&&no.z>=-1&&no.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(no.x*i+i)+"px,"+(-no.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return so.setFromMatrixPosition(e.matrixWorld),oo.setFromMatrixPosition(t.matrixWorld),so.distanceToSquared(oo)}}}const lo=new t,co=new r,uo=new t;class ho extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ho&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class fo extends ho{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const po=new d,go=new d;class mo{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function u(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,u)=>{const d=u.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=u instanceof j?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof F&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof F?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof ho){const t=e.parent;if(t.occlude){const t=!vi(e,this.viewport.camera)&&yi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=ri(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof fo?(po.copy(n.matrixWorldInverse),po.transpose(),0!==e.rotation2D&&po.multiply(go.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(lo,co,uo),po.setPosition(lo),po.scale(uo),po.elements[3]=0,po.elements[7]=0,po.elements[11]=0,po.elements[15]=1,t=u(po)):t=u(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)h(e.children[i],t,n)}}}class vo{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new z({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new ao(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new mo(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const yo=new d,wo=(e,t)=>{const i=yo.clone(),r=yo.clone(),s=yo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},bo=wo(-Math.PI/2,-Math.PI/4),Ao=wo(Math.PI/2,-Math.PI/4),xo=wo(-Math.PI/4,-Math.PI/4),So=wo(Math.PI/4,-Math.PI/4),To=wo(1.25*Math.PI,-Math.PI/4),Eo=wo(.75*Math.PI,-Math.PI/4),Do={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(bo.x,bo.y,bo.z),RIGHTTOP:new n(Ao.x,Ao.y,Ao.z),LEFTFRONTTOP:new n(xo.x,xo.y,xo.z),RIGHTFRONTTOP:new n(So.x,So.y,So.z),LEFTBACKTOP:new n(To.x,To.y,To.z),RIGHTBACKTOP:new n(Eo.x,Eo.y,Eo.z)},Co=e=>Di(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Io=new t,Bo=new n,Mo=new j(50,1,.1,5e5);Mo.position.set(500,1e3,500),Mo.lookAt(Io.set(0,0,0)),Mo.name="Camera";class Po{constructor(e){this.viewport=e,this.mainCamera=Mo.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Mo.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Ii(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(Ii(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return Li(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Li({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(Ti(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Bo.copy(this.currentCamera.rotation):Do[e]&&Bo.copy(Do[e])}else t instanceof n?Bo.copy(t):Ii(t)&&Bo.set(t.x,t.y,t.z);Bo.copy(ei(this.currentCamera.rotation,Bo.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Bo,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void Zn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ti(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Do[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Zn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=qn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Io),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=Bo.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof ah||e instanceof ih){const{padding:t=50}=i,r=Co(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Jn(e),o=s.getSize(Io);let a=0;if(Ti(r)){const e=Math.max(o.x,o.y,o.z);a=Co(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(Io.set(l/2,c/2,l/2)),s.min.sub(Io.set(l/2,c/2,l/2))),s.isEmpty()&&(Io.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Io,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=Kn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Li({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(Io);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Io);(new t).subVectors(i,n).normalize();let r=new H;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof eh&&(e=(new i).setFromObject(e)),e.isEmpty())return Zn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Io),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Ti(n)?Do[n.toLocaleUpperCase()]:qn(n),a(Io.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Io).clone():new t}}
2
2
  /**
3
3
  * postprocessing v6.31.0 build Sun May 07 2023
4
4
  * https://github.com/pmndrs/postprocessing
5
5
  * Copyright 2015-2023 Raoul van Rüschen
6
6
  * @license Zlib
7
- */var Oo="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Ro="",_o="srgb",ko="srgb-linear",Lo=Number(V.replace(/\D+/g,""))>=152,No=new Map([[ve,ko],[ye,_o]]),Uo=new Map([[ko,ve],[_o,ye]]);function jo(e){return null===e?null:Lo?e.outputColorSpace:No.get(e.outputEncoding)}function Fo(e,t){null!==e&&(Lo?e.colorSpace=t:e.encoding=Uo.get(t))}function zo(e,t,n){return e*(t-n)-t}function Go(e,t,n){return Math.min(Math.max((e+t)/(t-n),0),1)}var Ho=0,Vo=1,Wo=2,Yo=3,Qo=4,Xo=5,Zo=6,Ko=7,qo=8,Jo=9,$o=10,ea=11,ta=12,na=13,ia=14,ra=15,sa=16,oa=17,aa=18,la=19,ca=20,ua=21,ha=22,da=23,fa=24,pa=25,ga=26,ma=27,va=28,ya=29,wa=30,ba=31,Aa=32,xa=2,Sa={NONE:0,DEPTH:1,CONVOLUTION:2},Ta={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Ea=0,Da=2,Ca=3,Ia=0,Ba=0,Ma=1,Pa=2,Oa=3,Ra=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],_a=class extends oe{constructor(e=new we){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new we),scale:new te(1),kernel:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.setTexelSize(e.x,e.y),this.kernelSize=Da}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return Ra[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){const n=1/e,i=1/t;this.uniforms.texelSize.value.set(n,i,.5*n,.5*i)}},ka=class extends oe{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new te(null),opacity:new te(1)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <encodings_fragment>\n#include <dithering_fragment>\n}",vertexShader:Oo})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},La=class extends oe{constructor(e=null,t){super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),cameraNear:new te(.3),cameraFar:new te(1e3)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;varying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.depthBuffer=e,this.depthPacking=le,this.copyCameraSettings(t)}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=le){this.depthBuffer=e,this.depthPacking=t}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},Na=class extends oe{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),normalBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\n#ifdef DOWNSAMPLE_NORMALS\nuniform lowp sampler2D normalBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[]=float[4](abs(c-samples[0]),abs(c-samples[1]),abs(c-samples[2]),abs(c-samples[3]));float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[]=float[4](readDepth(vUv0),readDepth(vUv1),readDepth(vUv2),readDepth(vUv3));int index=findBestDepth(d);\n#ifdef DOWNSAMPLE_NORMALS\nvec3 n[]=vec3[4](texture2D(normalBuffer,vUv0).rgb,texture2D(normalBuffer,vUv1).rgb,texture2D(normalBuffer,vUv2).rgb,texture2D(normalBuffer,vUv3).rgb);\n#else\nvec3 n[]=vec3[4](vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));\n#endif\ngl_FragColor=vec4(n[index],d[index]);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"})}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ua=class extends oe{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},ja=class extends oe{constructor(e=new h,t=xa){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new te(null),depthBuffer:new te(null),predicationBuffer:new te(null),texelSize:new te(e)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include <common>\n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Fa=class extends oe{constructor(e,t,n,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new te(null),depthBuffer:new te(null),resolution:new te(new h),texelSize:new te(new h),cameraNear:new te(.3),cameraFar:new te(1e3),aspect:new te(1),time:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE gl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <encodings_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(Ta.FRAGMENT_HEAD,e.get(Ta.FRAGMENT_HEAD)||"").replace(Ta.FRAGMENT_MAIN_UV,e.get(Ta.FRAGMENT_MAIN_UV)||"").replace(Ta.FRAGMENT_MAIN_IMAGE,e.get(Ta.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(Ta.VERTEX_HEAD,e.get(Ta.VERTEX_HEAD)||"").replace(Ta.VERTEX_MAIN_SUPPORT,e.get(Ta.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(const t of e)this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return Ta}},za=class extends oe{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,"")},uniforms:{inputBuffer:new te(null),threshold:new te(0),smoothing:new te(1),range:new te(null)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:Oo}),this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},Ga=class extends oe{constructor(e=new h){super({name:"OutlineMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.uniforms.texelSize.value.set(e.x,e.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ha=class extends oe{constructor(e=new h,t=new h){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new te(null),searchTexture:new te(null),areaTexture:new te(null),resolution:new te(t),texelSize:new te(e)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){const t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){const t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){const t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){const n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.resolution.value.set(e,t)}},Va=class extends oe{constructor(e){super({name:"SSAOMaterial",defines:{SAMPLES_INT:"0",INV_SAMPLES_FLOAT:"0.0",SPIRAL_TURNS:"0.0",RADIUS:"1.0",RADIUS_SQ:"1.0",DISTANCE_SCALING:"1",DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),normalBuffer:new te(null),normalDepthBuffer:new te(null),noiseTexture:new te(null),inverseProjectionMatrix:new te(new d),projectionMatrix:new te(new d),texelSize:new te(new h),cameraNearFar:new te(new h),distanceCutoff:new te(new h),proximityCutoff:new te(new h),noiseScale:new te(new h),minRadiusScale:new te(.33),intensity:new te(1),fade:new te(.01),bias:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){return texture2D(normalDepthBuffer,uv).a;}\n#else\nuniform lowp sampler2D normalBuffer;\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\nuniform lowp sampler2D noiseTexture;uniform mat4 inverseProjectionMatrix;uniform mat4 projectionMatrix;uniform vec2 texelSize;uniform vec2 cameraNearFar;uniform float intensity;uniform float minRadiusScale;uniform float fade;uniform float bias;uniform vec2 distanceCutoff;uniform vec2 proximityCutoff;varying vec2 vUv;varying vec2 vUv2;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}vec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}float getAmbientOcclusion(const in vec3 p,const in vec3 n,const in float depth,const in vec2 uv){float radiusScale=1.0-smoothstep(0.0,distanceCutoff.y,depth);radiusScale=radiusScale*(1.0-minRadiusScale)+minRadiusScale;float radius=RADIUS*radiusScale;float noise=texture2D(noiseTexture,vUv2).r;float baseAngle=noise*PI2;float rings=SPIRAL_TURNS*PI2;float occlusion=0.0;int taps=0;for(int i=0;i<SAMPLES_INT;++i){float alpha=(float(i)+0.5)*INV_SAMPLES_FLOAT;float angle=alpha*rings+baseAngle;vec2 rotation=vec2(cos(angle),sin(angle));vec2 coords=alpha*radius*rotation*texelSize+uv;if(coords.s<0.0||coords.s>1.0||coords.t<0.0||coords.t>1.0){continue;}float sampleDepth=readDepth(coords);float viewZ=getViewZ(sampleDepth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearSampleDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearSampleDepth=sampleDepth;\n#endif\nfloat proximity=abs(depth-linearSampleDepth);if(proximity<proximityCutoff.y){float falloff=1.0-smoothstep(proximityCutoff.x,proximityCutoff.y,proximity);vec3 Q=getViewPosition(coords,sampleDepth,viewZ);vec3 v=Q-p;float vv=dot(v,v);float vn=dot(v,n)-bias;float f=max(RADIUS_SQ-vv,0.0)/RADIUS_SQ;occlusion+=(f*f*f*max(vn/(fade+vv),0.0))*falloff;}++taps;}return occlusion/(4.0*max(float(taps),1.0));}void main(){\n#ifdef NORMAL_DEPTH\nvec4 normalDepth=texture2D(normalDepthBuffer,vUv);\n#else\nvec4 normalDepth=vec4(texture2D(normalBuffer,vUv).xyz,readDepth(vUv));\n#endif\nfloat ao=0.0;float depth=normalDepth.a;float viewZ=getViewZ(depth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearDepth=depth;\n#endif\nif(linearDepth<distanceCutoff.y){vec3 viewPosition=getViewPosition(vUv,depth,viewZ);vec3 viewNormal=unpackRGBToNormal(normalDepth.rgb);ao+=getAmbientOcclusion(viewPosition,viewNormal,linearDepth,vUv);float d=smoothstep(distanceCutoff.x,distanceCutoff.y,linearDepth);ao=mix(ao,0.0,d);\n#ifdef LEGACY_INTENSITY\nao=clamp(1.0-pow(1.0-ao,abs(intensity)),0.0,1.0);\n#endif\n}gl_FragColor.r=ao;}",vertexShader:"uniform vec2 noiseScale;varying vec2 vUv;varying vec2 vUv2;void main(){vUv=position.xy*0.5+0.5;vUv2=vUv*noiseScale;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.copyCameraSettings(e),this.resolution=new h,this.r=1}get near(){return this.uniforms.cameraNearFar.value.x}get far(){return this.uniforms.cameraNearFar.value.y}set normalDepthBuffer(e){this.uniforms.normalDepthBuffer.value=e,null!==e?this.defines.NORMAL_DEPTH="1":delete this.defines.NORMAL_DEPTH,this.needsUpdate=!0}setNormalDepthBuffer(e){this.normalDepthBuffer=e}set normalBuffer(e){this.uniforms.normalBuffer.value=e}setNormalBuffer(e){this.uniforms.normalBuffer.value=e}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}set noiseTexture(e){this.uniforms.noiseTexture.value=e}setNoiseTexture(e){this.uniforms.noiseTexture.value=e}get samples(){return Number(this.defines.SAMPLES_INT)}set samples(e){this.defines.SAMPLES_INT=e.toFixed(0),this.defines.INV_SAMPLES_FLOAT=(1/e).toFixed(9),this.needsUpdate=!0}getSamples(){return this.samples}setSamples(e){this.samples=e}get rings(){return Number(this.defines.SPIRAL_TURNS)}set rings(e){this.defines.SPIRAL_TURNS=e.toFixed(1),this.needsUpdate=!0}getRings(){return this.rings}setRings(e){this.rings=e}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e,void 0===this.defines.LEGACY_INTENSITY&&(this.defines.LEGACY_INTENSITY="1",this.needsUpdate=!0)}getIntensity(){return this.uniforms.intensity.value}setIntensity(e){this.uniforms.intensity.value=e}get fade(){return this.uniforms.fade.value}set fade(e){this.uniforms.fade.value=e}getFade(){return this.uniforms.fade.value}setFade(e){this.uniforms.fade.value=e}get bias(){return this.uniforms.bias.value}set bias(e){this.uniforms.bias.value=e}getBias(){return this.uniforms.bias.value}setBias(e){this.uniforms.bias.value=e}get minRadiusScale(){return this.uniforms.minRadiusScale.value}set minRadiusScale(e){this.uniforms.minRadiusScale.value=e}getMinRadiusScale(){return this.uniforms.minRadiusScale.value}setMinRadiusScale(e){this.uniforms.minRadiusScale.value=e}updateRadius(){const e=this.r*this.resolution.height;this.defines.RADIUS=e.toFixed(11),this.defines.RADIUS_SQ=(e*e).toFixed(11),this.needsUpdate=!0}get radius(){return this.r}set radius(e){this.r=Math.min(Math.max(e,1e-6),1),this.updateRadius()}getRadius(){return this.radius}setRadius(e){this.radius=e}get distanceScaling(){return!0}set distanceScaling(e){}isDistanceScalingEnabled(){return this.distanceScaling}setDistanceScalingEnabled(e){this.distanceScaling=e}get distanceThreshold(){return this.uniforms.distanceCutoff.value.x}set distanceThreshold(e){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.distanceFalloff,0),1))}get worldDistanceThreshold(){return-zo(this.distanceThreshold,this.near,this.far)}set worldDistanceThreshold(e){this.distanceThreshold=Go(-e,this.near,this.far)}get distanceFalloff(){return this.uniforms.distanceCutoff.value.y-this.distanceThreshold}set distanceFalloff(e){this.uniforms.distanceCutoff.value.y=Math.min(Math.max(this.distanceThreshold+e,0),1)}get worldDistanceFalloff(){return-zo(this.distanceFalloff,this.near,this.far)}set worldDistanceFalloff(e){this.distanceFalloff=Go(-e,this.near,this.far)}setDistanceCutoff(e,t){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}get proximityThreshold(){return this.uniforms.proximityCutoff.value.x}set proximityThreshold(e){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.proximityFalloff,0),1))}get worldProximityThreshold(){return-zo(this.proximityThreshold,this.near,this.far)}set worldProximityThreshold(e){this.proximityThreshold=Go(-e,this.near,this.far)}get proximityFalloff(){return this.uniforms.proximityCutoff.value.y-this.proximityThreshold}set proximityFalloff(e){this.uniforms.proximityCutoff.value.y=Math.min(Math.max(this.proximityThreshold+e,0),1)}get worldProximityFalloff(){return-zo(this.proximityFalloff,this.near,this.far)}set worldProximityFalloff(e){this.proximityFalloff=Go(-e,this.near,this.far)}setProximityCutoff(e,t){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),this.uniforms.projectionMatrix.value.copy(e.projectionMatrix),this.uniforms.inverseProjectionMatrix.value.copy(e.projectionMatrix).invert(),e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms,i=n.noiseTexture.value;null!==i&&n.noiseScale.value.set(e/i.image.width,t/i.image.height),n.texelSize.value.set(1/e,1/t),this.resolution.set(e,t),this.updateRadius()}},Wa=class extends oe{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new te(null),supportBuffer:new te(null),texelSize:new te(new h),radius:new te(.85)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ya=new W,Qa=null;var Xa=class{constructor(e="Pass",t=new R,n=Ya){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:(t=new k(function(){if(null===Qa){const e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(Qa=new p).setAttribute?(Qa.setAttribute("position",new f(e,3)),Qa.setAttribute("uv",new f(t,2))):(Qa.addAttribute("position",new f(e,3)),Qa.addAttribute("uv",new f(t,2)))}return Qa}(),e),t.frustumCulled=!1,null===this.scene&&(this.scene=new R),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=Y){}render(e,t,n,i,r){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof Z||t instanceof be||t instanceof u||t instanceof Xa)&&this[e].dispose()}}},Za=class extends Xa{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new ka,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new Z(1,1,{minFilter:re,magFilter:re,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==Q?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":jo(e)===_o&&Fo(this.renderTarget.texture,_o))}},Ka=class extends Xa{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,i,r){const s=e.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},qa=new c,Ja=class extends Xa{constructor(e=!0,t=!0,n=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,i,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=e.getClearAlpha(),l=null!==s,c=o>=0;l?(e.getClearColor(qa),e.setClearColor(s,c?o:a)):c&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(qa,a):c&&e.setClearAlpha(a)}},$a=-1,el=class extends ce{constructor(e,t=-1,n=-1,i=1){super(),this.resizable=e,this.baseSize=new h(1,1),this.preferredSize=new h(t,n),this.target=this.preferredSize,this.s=i,this.effectiveSize=new h,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,i=this.scale;t.width!==$a?n.width=t.width:t.height!==$a?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*i),t.height!==$a?n.height=t.height:t.width!==$a?n.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar($a),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){this.baseSize.width===e&&this.baseSize.height===t||(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){this.preferredSize.width===e&&this.preferredSize.height===t||(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return $a}},tl=!1,nl=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case he:t=this.materialsFlatShadedDoubleSide;break;case ue:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case he:t=this.materialsDoubleSide;break;case ue:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof oe))return e.clone();const t=e.uniforms,n=new Map;for(const e in t){const i=t[e].value;i.isRenderTargetTexture&&(t[e].value=null,n.set(e,i))}const i=e.clone();for(const e of n)t[e[0]].value=e[1],i.uniforms[e[0]].value=e[1];return i}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){const t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(const n of t)n.uniforms=Object.assign({},e.uniforms),n.side=de;t[2].skinning=!0,this.materialsBackSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=ue,n})),this.materialsDoubleSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=he,n})),this.materialsFlatShaded=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n})),this.materialsFlatShadedBackSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=ue,n})),this.materialsFlatShadedDoubleSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=he,n}))}}render(e,t,n){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,tl){const i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n);for(const e of i)e[0].material=e[1];this.meshCount!==i.size&&i.clear()}else{const i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return tl}static set workaroundEnabled(e){tl=e}},il=class extends Xa{constructor(e,t,n=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new Ja,this.overrideMaterialManager=null===n?null:new nl(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new nl(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,u=e.shadowMap.autoUpdate,h=this.renderToScreen?null:t;null!==a&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(h),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,o):e.render(s,o),o.layers.mask=l,s.background=c,e.shadowMap.autoUpdate=u}},rl=class extends Xa{constructor(e,t,{renderTarget:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new il(e,t,new fe({depthPacking:le}));const l=this.renderPass;l.skipShadowMapUpdate=!0,l.ignoreBackground=!0;const u=l.getClearPass();u.overrideClearColor=new c(16777215),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K}),this.renderTarget.texture.name="DepthPass.Target");const h=this.resolution=new el(this,o,a,i);h.addEventListener("change",(e=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},sl=class extends Xa{constructor({normalBuffer:e=null,resolutionScale:t=.5,width:n=el.AUTO_SIZE,height:i=el.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}={}){super("DepthDownsamplingPass");const o=new Na;o.normalBuffer=e,this.fullscreenMaterial=o,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K,depthBuffer:!1,type:pe}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const a=this.resolution=new el(this,r,s,t);a.addEventListener("change",(e=>this.setSize(a.baseWidth,a.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(e,t=Y){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,i,r){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){const i=e.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}};function ol(e,t,n){for(const i of t){const t="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),r=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(r,t))}}function al(e,t,n){let i=t.getFragmentShader(),r=t.getVertexShader();const s=void 0!==i&&/mainImage/.test(i),o=void 0!==i&&/mainUv/.test(i);if(n.attributes|=t.getAttributes(),void 0===i)throw new Error(`Missing fragment shader (${t.name})`);if(o&&0!=(n.attributes&Sa.CONVOLUTION))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(!s&&!o)throw new Error(`Could not find mainImage or mainUv function (${t.name})`);{const a=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=n.shaderParts;let c=l.get(Ta.FRAGMENT_HEAD)||"",u=l.get(Ta.FRAGMENT_MAIN_UV)||"",h=l.get(Ta.FRAGMENT_MAIN_IMAGE)||"",d=l.get(Ta.VERTEX_HEAD)||"",f=l.get(Ta.VERTEX_MAIN_SUPPORT)||"";const p=new Set,g=new Set;if(o&&(u+=`\t${e}MainUv(UV);\n`,n.uvTransformation=!0),null!==r&&/mainSupport/.test(r)){const t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);f+=`\t${e}MainSupport(`,f+=t?"vUv);\n":");\n";for(const e of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const t of e[1].split(/\s*,\s*/))n.varyings.add(t),p.add(t),g.add(t);for(const e of r.matchAll(a))g.add(e[1])}for(const e of i.matchAll(a))g.add(e[1]);for(const e of t.defines.keys())g.add(e.replace(/\([\w\s,]*\)/g,""));for(const e of t.uniforms.keys())g.add(e);g.delete("while"),g.delete("for"),g.delete("if"),t.uniforms.forEach(((t,i)=>n.uniforms.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),t.defines.forEach(((t,i)=>n.defines.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)));const m=new Map([["fragment",i],["vertex",r]]);ol(e,g,n.defines),ol(e,g,m),i=m.get("fragment"),r=m.get("vertex");const v=t.blendMode;if(n.blendModes.set(v.blendFunction,v),s){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(h+=t.inputColorSpace===_o?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),t.outputColorSpace!==Ro?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace);const r=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;h+=`${e}MainImage(color0, UV, `,0!=(n.attributes&Sa.DEPTH)&&r.test(i)&&(h+="depth, ",n.readDepth=!0),h+="color1);\n\t";const s=e+"BlendOpacity";n.uniforms.set(s,v.opacity),h+=`color0 = blend${v.blendFunction}(color0, color1, ${s});\n\n\t`,c+=`uniform float ${s};\n\n`}if(c+=i+"\n",null!==r&&(d+=r+"\n"),l.set(Ta.FRAGMENT_HEAD,c),l.set(Ta.FRAGMENT_MAIN_UV,u),l.set(Ta.FRAGMENT_MAIN_IMAGE,h),l.set(Ta.VERTEX_HEAD,d),l.set(Ta.VERTEX_MAIN_SUPPORT,f),null!==t.extensions)for(const e of t.extensions)n.extensions.add(e)}}var ll=class extends Xa{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new Fa(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[],this.setEffects(t),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(e){for(const t of this.effects)t.mainScene=e}set mainCamera(e){this.fullscreenMaterial.copyCameraSettings(e);for(const t of this.effects)t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){const t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=e.sort(((e,t)=>t.attributes-e.attributes));for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const e=new ml;let t=0;for(const n of this.effects)if(n.blendMode.blendFunction===Jo)e.attributes|=n.getAttributes()&Sa.DEPTH;else{if(0!=(e.attributes&n.getAttributes()&Sa.CONVOLUTION))throw new Error(`Convolution effects cannot be merged (${n.name})`);al("e"+t++,n,e)}let n=e.shaderParts.get(Ta.FRAGMENT_HEAD),i=e.shaderParts.get(Ta.FRAGMENT_MAIN_IMAGE),r=e.shaderParts.get(Ta.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const t of e.blendModes.values())n+=t.getShaderCode().replace(s,`blend${t.blendFunction}`)+"\n";0!=(e.attributes&Sa.DEPTH)?(e.readDepth&&(i="float depth = readDepth(UV);\n\n\t"+i),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===_o&&(i+="color0 = sRGBToLinear(color0);\n\t"),e.uvTransformation?(r="vec2 transformedUv = vUv;\n"+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(Ta.FRAGMENT_HEAD,n),e.shaderParts.set(Ta.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(Ta.FRAGMENT_MAIN_UV,r);for(const[t,n]of e.shaderParts)null!==n&&e.shaderParts.set(t,n.trim().replace(/^#/,"\n#"));this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=Y){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const n of this.effects)n.setDepthTexture(e,t)}render(e,t,n,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const r=this.fullscreenMaterial;r.inputBuffer=t.texture,r.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const n of this.effects)n.setSize(e,t)}initialize(e,t,n){this.renderer=e;for(const i of this.effects)i.initialize(e,t,n);this.updateMaterial(),void 0!==n&&n!==Q&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){if("change"===e.type)this.recompile()}},cl=class extends Xa{constructor({kernelSize:e=Da,resolutionScale:t=.5,width:n=el.AUTO_SIZE,height:i=el.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}={}){super("KawaseBlurPass"),this.renderTargetA=new Z(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new el(this,r,s,t);o.addEventListener("change",(e=>this.setSize(o.baseWidth,o.baseHeight))),this._blurMaterial=new _a,this._blurMaterial.kernelSize=e,this.copyMaterial=new ka}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,u=c.kernelSequence;let h=t;this.fullscreenMaterial=c;for(let t=0,n=u.length;t<n;++t){const n=0==(1&t)?a:l;c.kernel=u[t],c.inputBuffer=h.texture,e.setRenderTarget(n),e.render(s,o),h=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=h.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(s,o)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.renderTargetA.setSize(i,r),this.renderTargetB.setSize(i,r),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,n!==Q?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):jo(e)===_o&&(Fo(this.renderTargetA.texture,_o),Fo(this.renderTargetB.texture,_o)))}static get AUTO_SIZE(){return el.AUTO_SIZE}},ul=class extends Xa{constructor({renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("LuminancePass"),this.fullscreenMaterial=new za(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new el(this,o,a,i);l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&n!==Q&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},hl=class extends Xa{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new Ja(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,i,r){const s=e.getContext(),o=e.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?0:1,h=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,n))),this.renderToScreen?(e.setRenderTarget(null),e.render(a,l)):(e.setRenderTarget(t),e.render(a,l),e.setRenderTarget(n),e.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},dl=class extends Xa{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new Ua,this.upsamplingMaterial=new Wa,this.resolution=new h}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){const t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){const e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,i=e-1;n<i;++n){const e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,i,r){const{scene:s,camera:o}=this,{downsamplingMaterial:a,upsamplingMaterial:l}=this,{downsamplingMipmaps:c,upsamplingMipmaps:u}=this;let h=t;this.fullscreenMaterial=a;for(let t=0,n=c.length;t<n;++t){const n=c[t];a.setSize(h.width,h.height),a.inputBuffer=h.texture,e.setRenderTarget(n),e.render(s,o),h=n}this.fullscreenMaterial=l;for(let t=u.length-1;t>=0;--t){const n=u[t];l.setSize(h.width,h.height),l.inputBuffer=h.texture,l.supportBuffer=c[t].texture,e.setRenderTarget(n),e.render(s,o),h=n}}setSize(e,t){const n=this.resolution;n.set(e,t);let i=n.width,r=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)i=Math.round(.5*i),r=Math.round(.5*r),this.downsamplingMipmaps[e].setSize(i,r),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(i,r)}initialize(e,t,n){if(void 0!==n){const t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const e of t)e.texture.type=n;if(n!==Q)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(jo(e)===_o)for(const e of t)Fo(e.texture,_o)}}dispose(){super.dispose();for(const e of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))e.dispose()}},fl=class extends Xa{constructor(e,t,{renderTarget:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new il(e,t,new X);const l=this.renderPass;l.ignoreBackground=!0,l.skipShadowMapUpdate=!0;const u=l.getClearPass();u.overrideClearColor=new c(7829503),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K}),this.renderTarget.texture.name="NormalPass.Target");const h=this.resolution=new el(this,o,a,i);h.addEventListener("change",(e=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},pl=class extends Xa{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.input=t}setInput(e){this.input=e}render(e,t,n,i,r){const s=this.fullscreenMaterial.uniforms;null!==t&&void 0!==s&&void 0!==s[this.input]&&(s[this.input].value=t.texture),e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}initialize(e,t,n){void 0!==n&&n!==Q&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},gl=.001,ml=class{constructor(){this.shaderParts=new Map([[Ta.FRAGMENT_HEAD,null],[Ta.FRAGMENT_MAIN_UV,null],[Ta.FRAGMENT_MAIN_IMAGE,null],[Ta.VERTEX_HEAD,null],[Ta.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Sa.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ko}},vl=class extends Set{constructor(e,t=10){super(),this.l=t,this.exclusive=!1,void 0!==e&&this.set(e)}get layer(){return this.l}set layer(e){const t=this.l;for(const n of this)n.layers.disable(t),n.layers.enable(e);this.l=e}getLayer(){return this.layer}setLayer(e){this.layer=e}isExclusive(){return this.exclusive}setExclusive(e){this.exclusive=e}clear(){const e=this.layer;for(const t of this)t.layers.disable(e);return super.clear()}set(e){this.clear();for(const t of e)this.add(t);return this}indexOf(e){return this.has(e)?0:-1}add(e){return this.exclusive?e.layers.set(this.layer):e.layers.enable(this.layer),super.add(e)}delete(e){return this.has(e)&&e.layers.disable(this.layer),super.delete(e)}toggle(e){let t;return this.has(e)?(this.delete(e),t=!1):(this.add(e),t=!0),t}setVisible(e){for(const t of this)e?t.layers.enable(0):t.layers.disable(0);return this}},yl=new Map([[Ho,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[Vo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[Wo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[Yo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[Xo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[Zo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[Ko,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[qo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[Jo,null],[$o,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[ea,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[ta,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[na,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[ia,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[ra,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[sa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[oa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[aa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[la,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[ca,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[ua,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[ha,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[da,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[fa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[pa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[ga,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[ma,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[va,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[ya,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[wa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[ba,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[Aa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),wl=class extends ce{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new te(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return yl.get(this.blendFunction)}},bl=class extends ce{constructor(e,t,{attributes:n=Sa.NONE,blendFunction:i=da,defines:r=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=a,this.defines=r,this.uniforms=s,this.extensions=o,this.blendMode=new wl(i),this.blendMode.addEventListener("change",(e=>this.setChanged())),this._inputColorSpace=ko,this._outputColorSpace=Ro}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=Y){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof Z||t instanceof be||t instanceof u||t instanceof Xa)&&this[e].dispose()}}},Al=class extends bl{constructor({blendFunction:e=va,luminanceThreshold:t=.9,luminanceSmoothing:n=.025,mipmapBlur:i=!1,intensity:r=1,radius:s=.85,levels:o=8,kernelSize:a=Ca,resolutionScale:l=.5,width:c=el.AUTO_SIZE,height:u=el.AUTO_SIZE,resolutionX:h=c,resolutionY:d=u}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}",{blendFunction:e,uniforms:new Map([["map",new te(null)],["intensity",new te(r)]])}),this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new cl({kernelSize:a}),this.luminancePass=new ul({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new dl,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const f=this.resolution=new el(this,h,d,l);f.addEventListener("change",(e=>this.setSize(f.baseWidth,f.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){const i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,r.renderTarget):this.blurPass.render(e,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,jo(e)===_o&&Fo(this.renderTarget.texture,_o))}};var xl=class extends ge{constructor(e,t,n=me,i=Q){super(function(e,t,n){const i=new Map([[me,1],[Ae,1],[xe,2],[se,4]]);let r;if(i.has(t)||console.error("Invalid noise texture format"),n===Q){r=new Uint8Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=255*Math.random()+.5}else{r=new Float32Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=Math.random()}return r}(e*t,n,i),e,t,n,i),this.needsUpdate=!0}};new t,new d,new c;var Sl=class extends bl{constructor(e,t,{blendFunction:n=va,patternTexture:i=null,patternScale:r=1,edgeStrength:s=1,pulseSpeed:o=0,visibleEdgeColor:a=16777215,hiddenEdgeColor:l=2230538,kernelSize:u=Ea,blur:h=!1,xRay:d=!0,multisampling:f=0,resolutionScale:p=.5,width:g=el.AUTO_SIZE,height:m=el.AUTO_SIZE,resolutionX:v=g,resolutionY:y=m}={}){super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texture2D(patternTexture,vUvPattern);\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new te(null)],["edgeTexture",new te(null)],["edgeStrength",new te(s)],["visibleEdgeColor",new te(new c(a))],["hiddenEdgeColor",new te(new c(l))],["pulse",new te(1)],["patternScale",new te(r)],["patternTexture",new te(null)]])}),this.blendMode.addEventListener("change",(e=>{this.blendMode.blendFunction===Vo?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.blendFunction=n,this.patternTexture=i,this.xRay=d,this.scene=e,this.camera=t,this.renderTargetMask=new Z(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new Z(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new Ja,this.clearPass.overrideClearColor=new c(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new rl(e,t),this.maskPass=new il(e,t,new La(this.depthPass.texture,t));const w=this.maskPass.clearPass;w.overrideClearColor=new c(16777215),w.overrideClearAlpha=1,this.blurPass=new cl({resolutionScale:p,resolutionX:v,resolutionY:y,kernelSize:u}),this.blurPass.enabled=h;const b=this.blurPass.resolution;b.addEventListener("change",(e=>this.setSize(b.baseWidth,b.baseHeight))),this.outlinePass=new pl(new Ga);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.active=!1,this.selection=new vl,this.selection.layer=10,this.pulseSpeed=o}set mainScene(e){this.scene=e,this.depthPass.mainScene=e,this.maskPass.mainScene=e}set mainCamera(e){this.camera=e,this.depthPass.mainCamera=e,this.maskPass.mainCamera=e,this.maskPass.overrideMaterial.copyCameraSettings(e)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(e){this.renderTargetMask.samples=e,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(e){this.uniforms.get("patternScale").value=e}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(e){this.uniforms.get("edgeStrength").value=e}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(e){this.uniforms.get("visibleEdgeColor").value=e}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(e){this.uniforms.get("hiddenEdgeColor").value=e}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(e){this.pulseSpeed=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get selectionLayer(){return this.selection.layer}set selectionLayer(e){this.selection.layer=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get blur(){return this.blurPass.enabled}set blur(e){this.blurPass.enabled=e}get xRay(){return this.defines.has("X_RAY")}set xRay(e){this.xRay!==e&&(e?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(e){this.xRay=e}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(e){null!==e?(e.wrapS=e.wrapT=ne,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),this.uniforms.get("patternTexture").value=e,this.setChanged()}setPatternTexture(e){this.patternTexture=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}setSelection(e){return this.selection.set(e),this}clearSelection(){return this.selection.clear(),this}selectObject(e){return this.selection.add(e),this}deselectObject(e){return this.selection.delete(e),this}update(e,t,n){const i=this.scene,r=this.camera,s=this.selection,o=this.uniforms.get("pulse"),a=i.background,l=r.layers.mask;s.size>0?(i.background=null,o.value=1,this.pulseSpeed>0&&(o.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.active=!0,this.time+=n,s.setVisible(!1),this.depthPass.render(e),s.setVisible(!0),r.layers.set(s.layer),this.maskPass.render(e,this.renderTargetMask),r.layers.mask=l,i.background=a,this.outlinePass.render(e,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(e,this.renderTargetOutline,this.renderTargetOutline)):this.active&&(this.clearPass.render(e,this.renderTargetOutline),this.active=!1)}setSize(e,t){this.blurPass.setSize(e,t),this.renderTargetMask.setSize(e,t);const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.depthPass.setSize(i,r),this.renderTargetOutline.setSize(i,r),this.outlinePass.fullscreenMaterial.setSize(i,r)}initialize(e,t,n){this.blurPass.initialize(e,t,Q),void 0!==n&&(this.depthPass.initialize(e,t,n),this.maskPass.initialize(e,t,n),this.outlinePass.initialize(e,t,n))}};new t,new t;var Tl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",El="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlA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MvSEsoENIKrgALHNiMox+94K7tl9qnnMio8MSf6SNwGpYVjCDk/Ju7isq496fCqX0BkDeqlWwKwic1gAQSpzGREnFgREz01eALLvvq2Kfi45m6cf3qBXdsfxRbJMho8dimqOhEK8cXQRr9QVpvPoDNMXQP9A3ACELFxPh+jACkP0fLIKFCCRRqKuPUdqjlC9o07JZwKVNHeBC94DQcZO0XAAkmgotAk9QYrR9f/BvByYfMSATDVMzwTXMM3QMDAVAgVHCZ7/MaQK4QZUHiNCbBQlqUw74YCb7gcmYkelC9YFlwvVv7RRAorTuBkECU9asCID9/x9B935zYzyKkqpfiNHxcA0gLQgvBAaPVkCqm3h2AtC5m/RyEqzw/4xhGL3hD++MmslgqCbgUfLKAcRrmTlBzDN0DA1tAXUlWcDm1IOIIJAjlT/Fd05lbFQFwjdtgGcewesFt7Rc/Gx8iWjUCjGCT1YvWT1MwgUqrf3NG45tTbcu0aximWx9xENcEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",Dl=class extends bl{constructor({blendFunction:e=wa,preset:t=Ma,edgeDetectionMode:n=xa,predicationMode:i=Ia}={}){let r,s;super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:e,attributes:Sa.CONVOLUTION|Sa.DEPTH,uniforms:new Map([["weightMap",new te(null)]])}),arguments.length>1&&(r=arguments[0],s=arguments[1],arguments.length>2&&(t=arguments[2]),arguments.length>3&&(n=arguments[3])),this.renderTargetEdges=new Z(1,1,{depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new Ja(!0,!1,!1),this.clearPass.overrideClearColor=new c(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new pl(new ja),this.edgeDetectionMaterial.edgeDetectionMode=n,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new pl(new Ha);const o=new ie;o.onLoad=()=>{const e=new u(r);e.name="SMAA.Search",e.magFilter=K,e.minFilter=K,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!0,this.weightsMaterial.searchTexture=e;const t=new u(s);t.name="SMAA.Area",t.magFilter=re,t.minFilter=re,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!1,this.weightsMaterial.areaTexture=t,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==r&&void 0!==s?(o.itemEnd("search"),o.itemEnd("area")):"undefined"!=typeof Image&&(r=new Image,s=new Image,r.addEventListener("load",(()=>o.itemEnd("search"))),s.addEventListener("load",(()=>o.itemEnd("area"))),r.src=Tl,s.src=El),this.applyPreset(t)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){const t=this.edgeDetectionMaterial,n=this.weightsMaterial;switch(e){case Ba:t.edgeDetectionThreshold=.15,n.orthogonalSearchSteps=4,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Ma:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=8,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Pa:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=16,n.diagonalSearchSteps=8,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0;break;case Oa:t.edgeDetectionThreshold=.05,n.orthogonalSearchSteps=32,n.diagonalSearchSteps=16,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0}}setDepthTexture(e,t=Y){this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,n){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){const{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Tl}static get areaImageDataURL(){return El}},Cl=class extends bl{constructor(e,t,{blendFunction:n=ua,samples:i=9,rings:r=7,normalDepthBuffer:s=null,depthAwareUpsampling:o=!0,worldDistanceThreshold:a,worldDistanceFalloff:l,worldProximityThreshold:c,worldProximityFalloff:u,distanceThreshold:h=.97,distanceFalloff:d=.03,rangeThreshold:f=5e-4,rangeFalloff:p=.001,minRadiusScale:g=.1,luminanceInfluence:m=.7,radius:v=.1825,intensity:y=1,bias:w=.025,fade:b=.01,color:A=null,resolutionScale:x=1,width:S=el.AUTO_SIZE,height:T=el.AUTO_SIZE,resolutionX:E=S,resolutionY:D=T}={}){super("SSAOEffect","uniform lowp sampler2D aoBuffer;uniform float luminanceInfluence;uniform float intensity;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH)\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\n#endif\n#ifdef COLORIZE\nuniform vec3 color;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){float aoLinear=texture2D(aoBuffer,uv).r;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH) && __VERSION__ == 300\nvec4 normalDepth[4];normalDepth[0]=textureOffset(normalDepthBuffer,uv,ivec2(0,0));normalDepth[1]=textureOffset(normalDepthBuffer,uv,ivec2(0,1));normalDepth[2]=textureOffset(normalDepthBuffer,uv,ivec2(1,0));normalDepth[3]=textureOffset(normalDepthBuffer,uv,ivec2(1,1));float dot01=dot(normalDepth[0].rgb,normalDepth[1].rgb);float dot02=dot(normalDepth[0].rgb,normalDepth[2].rgb);float dot03=dot(normalDepth[0].rgb,normalDepth[3].rgb);float minDot=min(dot01,min(dot02,dot03));float s=step(THRESHOLD,minDot);float smallestDistance=1.0;int index;for(int i=0;i<4;++i){float distance=abs(depth-normalDepth[i].a);if(distance<smallestDistance){smallestDistance=distance;index=i;}}ivec2 offsets[4];offsets[0]=ivec2(0,0);offsets[1]=ivec2(0,1);offsets[2]=ivec2(1,0);offsets[3]=ivec2(1,1);ivec2 coord=ivec2(uv*vec2(textureSize(aoBuffer,0)))+offsets[index];float aoNearest=texelFetch(aoBuffer,coord,0).r;float ao=mix(aoNearest,aoLinear,s);\n#else\nfloat ao=aoLinear;\n#endif\nfloat l=luminance(inputColor.rgb);ao=mix(ao,0.0,l*luminanceInfluence);ao=clamp(ao*intensity,0.0,1.0);\n#ifdef COLORIZE\noutputColor=vec4(1.0-ao*(1.0-color),inputColor.a);\n#else\noutputColor=vec4(vec3(1.0-ao),inputColor.a);\n#endif\n}",{blendFunction:n,attributes:Sa.DEPTH,defines:new Map([["THRESHOLD","0.997"]]),uniforms:new Map([["aoBuffer",new te(null)],["normalDepthBuffer",new te(s)],["luminanceInfluence",new te(m)],["color",new te(null)],["intensity",new te(y)],["scale",new te(0)]])}),this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="AO.Target",this.uniforms.get("aoBuffer").value=this.renderTarget.texture;const C=this.resolution=new el(this,E,D,x);C.addEventListener("change",(e=>this.setSize(C.baseWidth,C.baseHeight))),this.camera=e,this.depthDownsamplingPass=new sl({normalBuffer:t,resolutionScale:x}),this.depthDownsamplingPass.enabled=null===s,this.ssaoPass=new pl(new Va(e));const I=new xl(64,64,se);I.wrapS=I.wrapT=ne;const B=this.ssaoMaterial;B.normalBuffer=t,B.noiseTexture=I,B.minRadiusScale=g,B.samples=i,B.radius=v,B.rings=r,B.fade=b,B.bias=w,B.distanceThreshold=h,B.distanceFalloff=d,B.proximityThreshold=f,B.proximityFalloff=p,void 0!==a&&(B.worldDistanceThreshold=a),void 0!==l&&(B.worldDistanceFalloff=l),void 0!==c&&(B.worldProximityThreshold=c),void 0!==u&&(B.worldProximityFalloff=u),null!==s&&(this.ssaoMaterial.normalDepthBuffer=s,this.defines.set("NORMAL_DEPTH","1")),this.depthAwareUpsampling=o,this.color=A}set mainCamera(e){this.camera=e,this.ssaoMaterial.copyCameraSettings(e)}get normalBuffer(){return this.ssaoMaterial.normalBuffer}set normalBuffer(e){this.ssaoMaterial.normalBuffer=e,this.depthDownsamplingPass.fullscreenMaterial.normalBuffer=e}getResolution(){return this.resolution}get ssaoMaterial(){return this.ssaoPass.fullscreenMaterial}getSSAOMaterial(){return this.ssaoMaterial}get samples(){return this.ssaoMaterial.samples}set samples(e){this.ssaoMaterial.samples=e}get rings(){return this.ssaoMaterial.rings}set rings(e){this.ssaoMaterial.rings=e}get radius(){return this.ssaoMaterial.radius}set radius(e){this.ssaoMaterial.radius=e}get depthAwareUpsampling(){return this.defines.has("DEPTH_AWARE_UPSAMPLING")}set depthAwareUpsampling(e){this.depthAwareUpsampling!==e&&(e?this.defines.set("DEPTH_AWARE_UPSAMPLING","1"):this.defines.delete("DEPTH_AWARE_UPSAMPLING"),this.setChanged())}isDepthAwareUpsamplingEnabled(){return this.depthAwareUpsampling}setDepthAwareUpsamplingEnabled(e){this.depthAwareUpsampling=e}get distanceScaling(){return!0}set distanceScaling(e){}get color(){return this.uniforms.get("color").value}set color(e){const t=this.uniforms,n=this.defines;null!==e?n.has("COLORIZE")?t.get("color").value.set(e):(n.set("COLORIZE","1"),t.get("color").value=new c(e),this.setChanged()):n.has("COLORIZE")&&(n.delete("COLORIZE"),t.get("color").value=null,this.setChanged())}get luminanceInfluence(){return this.uniforms.get("luminanceInfluence").value}set luminanceInfluence(e){this.uniforms.get("luminanceInfluence").value=e}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getColor(){return this.color}setColor(e){this.color=e}setDistanceCutoff(e,t){this.ssaoMaterial.distanceThreshold=e,this.ssaoMaterial.distanceFalloff=t}setProximityCutoff(e,t){this.ssaoMaterial.proximityThreshold=e,this.ssaoMaterial.proximityFalloff=t}setDepthTexture(e,t=Y){this.depthDownsamplingPass.setDepthTexture(e,t),this.ssaoMaterial.depthBuffer=e,this.ssaoMaterial.depthPacking=t}update(e,t,n){const i=this.renderTarget;this.depthDownsamplingPass.enabled&&this.depthDownsamplingPass.render(e),this.ssaoPass.render(e,null,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.ssaoMaterial.copyCameraSettings(this.camera),this.ssaoMaterial.setSize(i,r),this.renderTarget.setSize(i,r),this.depthDownsamplingPass.resolution.scale=n.scale,this.depthDownsamplingPass.setSize(e,t)}initialize(e,t,n){try{let i=this.uniforms.get("normalDepthBuffer").value;null===i&&(this.depthDownsamplingPass.initialize(e,t,n),i=this.depthDownsamplingPass.texture,this.uniforms.get("normalDepthBuffer").value=i,this.ssaoMaterial.normalDepthBuffer=i,this.defines.set("NORMAL_DEPTH","1"))}catch(e){this.depthDownsamplingPass.enabled=!1}}};function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Il.apply(this,arguments)}var Bl="#define GLSLIFY 1\nvec3 getViewPosition(const float depth){float clipW=_projectionMatrix[2][3]*depth+_projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(_inverseProjectionMatrix*clipPosition).xyz;}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 screenSpaceToWorldSpace(const vec2 uv,const float depth){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=_inverseProjectionMatrix*ndc;vec4 view=cameraMatrixWorld*(clip/clip.w);return view.xyz;}\n#define Scale (vec3(0.8, 0.8, 0.8))\n#define K (19.19)\nvec3 hash(vec3 a){a=fract(a*Scale);a+=dot(a,a.yxz+K);return fract((a.xxy+a.yxx)*a.zyx);}float fresnel_dielectric_cos(float cosi,float eta){float c=abs(cosi);float g=eta*eta-1.0+c*c;float result;if(g>0.0){g=sqrt(g);float A=(g-c)/(g+c);float B=(c*(g+c)-1.0)/(c*(g-c)+1.0);result=0.5*A*A*(1.0+B*B);}else{result=1.0;}return result;}float fresnel_dielectric(vec3 Incoming,vec3 Normal,float eta){float cosine=dot(Incoming,Normal);return min(1.0,5.0*fresnel_dielectric_cos(cosine,eta));}";class Ml extends oe{constructor(){super({type:"MRTMaterial",defines:{USE_UV:"",TEMPORAL_RESOLVE:""},uniforms:{opacity:new te(1),normalMap:new te(null),normalScale:new te(new h(1,1)),uvTransform:new te(new Be),roughness:new te(1),roughnessMap:new te(null)},vertexShader:"\n #ifdef USE_MRT\n varying vec2 vHighPrecisionZW;\n #endif\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <common>\n #include <uv_pars_vertex>\n #include <displacementmap_pars_vertex>\n #include <normal_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n void main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n #endif\n #ifdef USE_MRT\n vHighPrecisionZW = gl_Position.zw;\n #endif \n #ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n }\n ",fragmentShader:"\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <packing>\n #include <uv_pars_fragment>\n #include <normal_pars_fragment>\n #include <bumpmap_pars_fragment>\n #include <normalmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n #include <roughnessmap_pars_fragment>\n \n #ifdef USE_MRT\n layout(location = 0) out vec4 gNormal;\n layout(location = 1) out vec4 gDepth;\n \n varying vec2 vHighPrecisionZW;\n #endif\n uniform float roughness;\n void main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n float roughnessFactor = roughness;\n \n if(roughness > 10.0e9){\n roughnessFactor = 1.;\n }else{\n #ifdef useRoughnessMap\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n }\n\n vec3 normalColor = packNormalToRGB( normal );\n #ifdef USE_MRT\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n vec4 depthColor = packDepthToRGBA( fragCoordZ );\n gNormal = vec4( normalColor, roughnessFactor );\n gDepth = depthColor;\n #else\n gl_FragColor = vec4(normalColor, roughnessFactor);\n #endif\n }\n ",toneMapped:!1}),this.normalMapType=Me,this.normalScale=new h(1,1),Object.defineProperty(this,"glslVersion",{get(){return"USE_MRT"in this.defines?Pe:null},set(e){}})}}class Pl extends oe{constructor(){super({type:"ReflectionsMaterial",uniforms:{inputTexture:new te(null),accumulatedTexture:new te(null),normalTexture:new te(null),depthTexture:new te(null),_projectionMatrix:new te(new d),_inverseProjectionMatrix:new te(new d),cameraMatrixWorld:new te(new d),cameraNear:new te(0),cameraFar:new te(0),rayDistance:new te(0),intensity:new te(0),roughnessFade:new te(0),fade:new te(0),thickness:new te(0),ior:new te(0),maxDepthDifference:new te(0),jitter:new te(0),jitterRoughness:new te(0),maxRoughness:new te(0),samples:new te(0),envMap:new te(null),envMapPosition:new te(new t),envMapSize:new te(new t),viewMatrix:new te(new d)},defines:{steps:20,refineSteps:5,CUBEUV_TEXEL_WIDTH:0,CUBEUV_TEXEL_HEIGHT:0,CUBEUV_MAX_MIP:0,vWorldPosition:"worldPos"},fragmentShader:"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D normalTexture;uniform sampler2D depthTexture;uniform sampler2D envMap;uniform mat4 _projectionMatrix;uniform mat4 _inverseProjectionMatrix;uniform mat4 cameraMatrixWorld;uniform float cameraNear;uniform float cameraFar;uniform float rayDistance;uniform float intensity;uniform float maxDepthDifference;uniform float roughnessFade;uniform float maxRoughness;uniform float fade;uniform float thickness;uniform float ior;uniform float samples;uniform float jitter;uniform float jitterRoughness;\n#define INVALID_RAY_COORDS vec2(-1.0);\n#define EARLY_OUT_COLOR vec4(0.0, 0.0, 0.0, 1.0)\n#define FLOAT_EPSILON 0.00001\nfloat nearMinusFar;float nearMulFar;float farMinusNear;\n#include <packing>\n#include <helperFunctions>\nvec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);float fastGetViewZ(const in float depth);vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness);void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.0);if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON){gl_FragColor=EARLY_OUT_COLOR;return;}float unpackedDepth=unpackRGBAToDepth(depthTexel);vec4 normalTexel=textureLod(normalTexture,vUv,0.0);float roughness=normalTexel.a;float specular=1.0-roughness;nearMinusFar=cameraNear-cameraFar;nearMulFar=cameraNear*cameraFar;farMinusNear=cameraFar-cameraNear;normalTexel.rgb=unpackRGBToNormal(normalTexel.rgb);float depth=fastGetViewZ(unpackedDepth);vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 viewNormal=normalTexel.xyz;vec3 worldPos=screenSpaceToWorldSpace(vUv,unpackedDepth);vec3 jitt=vec3(0.0);if(jitterRoughness!=0.0||jitter!=0.0){vec3 randomJitter=hash(50.0*samples*worldPos)-0.5;float spread=((2.0-specular)+roughness*jitterRoughness);float jitterMix=jitter*0.25+jitterRoughness*roughness;if(jitterMix>1.0)jitterMix=1.0;jitt=mix(vec3(0.0),randomJitter*spread,jitterMix);}viewNormal+=jitt;float fresnelFactor=fresnel_dielectric(viewDir,viewNormal,ior);vec3 iblRadiance=getIBLRadiance(-viewDir,viewNormal,0.)*fresnelFactor;float lastFrameAlpha=textureLod(accumulatedTexture,vUv,0.0).a;if(roughness>maxRoughness||(roughness>1.0-FLOAT_EPSILON&&roughnessFade>1.0-FLOAT_EPSILON)){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec3 reflected=reflect(viewDir,viewNormal);vec3 rayDir=reflected*-viewPos.z;vec3 hitPos=viewPos;float rayHitDepthDifference;vec2 coords=RayMarch(rayDir,hitPos,rayHitDepthDifference);if(coords.x==-1.0){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec4 SSRTexel=textureLod(inputTexture,coords.xy,0.0);vec4 SSRTexelReflected=textureLod(accumulatedTexture,coords.xy,0.0);vec3 SSR=SSRTexel.rgb+SSRTexelReflected.rgb;float roughnessFactor=mix(specular,1.0,max(0.0,1.0-roughnessFade));vec2 coordsNDC=(coords.xy*2.0-1.0);float screenFade=0.1;float maxDimension=min(1.0,max(abs(coordsNDC.x),abs(coordsNDC.y)));float reflectionIntensity=1.0-(max(0.0,maxDimension-screenFade)/(1.0-screenFade));reflectionIntensity=max(0.,reflectionIntensity);vec3 finalSSR=mix(iblRadiance,SSR,reflectionIntensity)*roughnessFactor;if(fade!=0.0){vec3 hitWorldPos=screenSpaceToWorldSpace(coords,rayHitDepthDifference);float reflectionDistance=distance(hitWorldPos,worldPos)+1.0;float opacity=1.0/(reflectionDistance*fade*0.1);if(opacity>1.0)opacity=1.0;finalSSR*=opacity;}finalSSR*=fresnelFactor*intensity;finalSSR=min(vec3(1.0),finalSSR);float alpha=hitPos.z==1.0 ? 1.0 : SSRTexelReflected.a;alpha=min(lastFrameAlpha,alpha);gl_FragColor=vec4(finalSSR,alpha);}vec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){dir=normalize(dir);dir*=rayDistance/float(steps);float depth;vec4 projectedCoord;vec4 lastProjectedCoord;float unpackedDepth;vec4 depthTexel;for(int i=0;i<steps;i++){hitPos+=dir;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;\n#ifndef missedRays\nif(projectedCoord.x<0.0||projectedCoord.x>1.0||projectedCoord.y<0.0||projectedCoord.y>1.0){return INVALID_RAY_COORDS;}\n#endif\ndepthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;if(rayHitDepthDifference>=0.0&&rayHitDepthDifference<thickness){\n#if refineSteps == 0\nif(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;\n#else\nreturn BinarySearch(dir,hitPos,rayHitDepthDifference);\n#endif\n}\n#ifndef missedRays\nif(hitPos.z>0.0){return INVALID_RAY_COORDS;}\n#endif\nlastProjectedCoord=projectedCoord;}hitPos.z=1.0;\n#ifndef missedRays\nreturn INVALID_RAY_COORDS;\n#endif\nrayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){float depth;vec4 projectedCoord;vec2 lastMinProjectedCoordXY;float unpackedDepth;vec4 depthTexel;for(int i=0;i<refineSteps;i++){projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;depthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;dir*=0.5;if(rayHitDepthDifference>0.0){hitPos-=dir;}else{hitPos+=dir;}}if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;if(abs(rayHitDepthDifference)>maxDepthDifference)return INVALID_RAY_COORDS;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;rayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}float fastGetViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn nearMulFar/(farMinusNear*depth-cameraFar);\n#else\nreturn depth*nearMinusFar-cameraNear;\n#endif\n}\n#include <common>\n#include <cube_uv_reflection_fragment>\nvec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){\n#if defined(ENVMAP_TYPE_CUBE_UV)\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*intensity;\n#else\nreturn vec3(0.0);\n#endif\n}".replace("#include <helperFunctions>",Bl),vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",toneMapped:!1,depthWrite:!1,depthTest:!1})}}const Ol=e=>{const t=[e],n=[];for(;0!==t.length;){const e=t.shift();e.material&&n.push(e);for(const n of e.children)n.visible&&t.push(n)}return n},Rl=(e,t,n)=>{e.uniforms.envMap.value=t;const i=(e=>{const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}})({envMapCubeUVHeight:n});e.defines.ENVMAP_TYPE_CUBE_UV="",e.defines.CUBEUV_TEXEL_WIDTH=i.texelWidth,e.defines.CUBEUV_TEXEL_HEIGHT=i.texelHeight,e.defines.CUBEUV_MAX_MIP=i.maxMip+".0",e.needsUpdate=!0};class _l extends Xa{constructor(e,t={}){super("ReflectionsPass"),this.ssrEffect=void 0,this.cachedMaterials=new WeakMap,this.USE_MRT=!1,this.webgl1DepthPass=null,this.visibleMeshes=[],this.ssrEffect=e,this._scene=e._scene,this._camera=e._camera,this.fullscreenMaterial=new Pl,e._camera.isPerspectiveCamera&&(this.fullscreenMaterial.defines.PERSPECTIVE_CAMERA="");const n=t.width||"undefined"!=typeof window?window.innerWidth:2e3,i=t.height||"undefined"!=typeof window?window.innerHeight:1e3;this.renderTarget=new Z(n,i,{minFilter:re,magFilter:re,type:o,depthBuffer:!1}),this.renderPass=new il(this._scene,this._camera),this.USE_MRT=(()=>{try{const e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}})(),this.USE_MRT?(this.gBuffersRenderTarget=new Ce(n,i,2,{minFilter:re,magFilter:re}),this.normalTexture=this.gBuffersRenderTarget.texture[0],this.depthTexture=this.gBuffersRenderTarget.texture[1]):(this.webgl1DepthPass=new rl(this._scene,this._camera),this.webgl1DepthPass.renderTarget.minFilter=re,this.webgl1DepthPass.renderTarget.magFilter=re,this.webgl1DepthPass.renderTarget.texture.minFilter=re,this.webgl1DepthPass.renderTarget.texture.magFilter=re,this.webgl1DepthPass.setSize("undefined"!=typeof window?window.innerWidth:2e3,"undefined"!=typeof window?window.innerHeight:1e3),this.gBuffersRenderTarget=new Z(n,i,{minFilter:re,magFilter:re}),this.normalTexture=this.gBuffersRenderTarget.texture,this.depthTexture=this.webgl1DepthPass.texture),this.fullscreenMaterial.uniforms.normalTexture.value=this.normalTexture,this.fullscreenMaterial.uniforms.depthTexture.value=this.depthTexture,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.uniforms.cameraMatrixWorld.value=this._camera.matrixWorld,this.fullscreenMaterial.uniforms._projectionMatrix.value=this._camera.projectionMatrix,this.fullscreenMaterial.uniforms._inverseProjectionMatrix.value=this._camera.projectionMatrixInverse}setSize(e,t){this.renderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.gBuffersRenderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.gBuffersRenderTarget.dispose(),this.renderPass.dispose(),this.USE_MRT||this.webgl1DepthPass.dispose(),this.fullscreenMaterial.dispose(),this.normalTexture=null,this.depthTexture=null,this.velocityTexture=null}keepMaterialMapUpdated(e,t,n,i){this.ssrEffect[i]?t[n]!==e[n]&&(e[n]=t[n],e.uniforms[n].value=t[n],t[n]?e.defines[i]="":delete e.defines[i],e.needsUpdate=!0):void 0!==e[n]&&(e[n]=void 0,e.uniforms[n].value=void 0,delete e.defines[i],e.needsUpdate=!0)}setMRTMaterialInScene(){this.visibleMeshes=Ol(this._scene);for(const e of this.visibleMeshes)if(e.material){const t=e.material;let[n,i]=this.cachedMaterials.get(e)||[];if(t!==n){i&&i.dispose(),i=new Ml,this.USE_MRT&&(i.defines.USE_MRT=""),i.normalScale=t.normalScale,i.uniforms.normalScale.value=t.normalScale;const n=t.map||t.normalMap||t.roughnessMap||t.metalnessMap;n&&(i.uniforms.uvTransform.value=n.matrix),this.cachedMaterials.set(e,[t,i])}this.keepMaterialMapUpdated(i,t,"normalMap","useNormalMap"),this.keepMaterialMapUpdated(i,t,"roughnessMap","useRoughnessMap"),i.uniforms.roughness.value=0===this.ssrEffect.selection.size||this.ssrEffect.selection.has(e)?t.roughness||0:1e11,e.material=i}}unsetMRTMaterialInScene(){for(const t of this.visibleMeshes){var e;if("MRTMaterial"===(null==(e=t.material)?void 0:e.type)){t.visible=!0;const[e]=this.cachedMaterials.get(t);t.material=e}}}render(e,t){this.setMRTMaterialInScene(),e.setRenderTarget(this.gBuffersRenderTarget),this.renderPass.render(e,this.gBuffersRenderTarget),this.unsetMRTMaterialInScene(),this.USE_MRT||this.webgl1DepthPass.renderPass.render(e,this.webgl1DepthPass.renderTarget),this.fullscreenMaterial.uniforms.inputTexture.value=t.texture,this.fullscreenMaterial.uniforms.samples.value=this.ssrEffect.temporalResolvePass.samples,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.viewMatrix.value.copy(this._camera.matrixWorldInverse),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}const kl={intensity:1,exponent:1,distance:10,fade:0,roughnessFade:1,thickness:10,ior:1.45,maxRoughness:1,maxDepthDifference:10,blend:.9,correction:1,correctionRadius:1,blur:.5,blurKernel:1,blurSharpness:10,jitter:0,jitterRoughness:0,steps:20,refineSteps:5,missedRays:!0,useNormalMap:!0,useRoughnessMap:!0,resolutionScale:1,velocityResolutionScale:1};class Ll extends oe{constructor(e){const t="#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D velocityTexture;uniform sampler2D lastVelocityTexture;uniform float blend;uniform float correction;uniform float exponent;uniform float samples;uniform vec2 invTexSize;uniform mat4 curInverseProjectionMatrix;uniform mat4 curCameraMatrixWorld;uniform mat4 prevInverseProjectionMatrix;uniform mat4 prevCameraMatrixWorld;varying vec2 vUv;\n#define MAX_NEIGHBOR_DEPTH_DIFFERENCE 0.001\n#define FLOAT_EPSILON 0.00001\n#define FLOAT_ONE_MINUS_EPSILON 0.99999\nvec3 transformexponent;vec3 undoColorTransformExponent;vec3 transformColor(vec3 color){if(exponent==1.0)return color;return pow(abs(color),transformexponent);}vec3 undoColorTransform(vec3 color){if(exponent==1.0)return color;return max(pow(abs(color),undoColorTransformExponent),vec3(0.0));}void main(){if(exponent!=1.0){transformexponent=vec3(1.0/exponent);undoColorTransformExponent=vec3(exponent);}vec4 inputTexel=textureLod(inputTexture,vUv,0.0);vec4 accumulatedTexel;vec3 inputColor=transformColor(inputTexel.rgb);vec3 accumulatedColor;float alpha=inputTexel.a;float velocityDisocclusion;bool didReproject=false;\n#ifdef boxBlur\nvec3 boxBlurredColor=inputTexel.rgb;\n#endif\nvec4 velocity=textureLod(velocityTexture,vUv,0.0);bool isMoving=alpha<1.0||dot(velocity.xy,velocity.xy)>0.0;if(isMoving){vec3 minNeighborColor=inputColor;vec3 maxNeighborColor=inputColor;vec3 col;vec2 neighborUv;vec2 reprojectedUv=vUv-velocity.xy;vec4 lastVelocity=textureLod(lastVelocityTexture,reprojectedUv,0.0);float depth=velocity.b;float closestDepth=depth;float lastClosestDepth=lastVelocity.b;float neighborDepth;float lastNeighborDepth;for(int x=-correctionRadius;x<=correctionRadius;x++){for(int y=-correctionRadius;y<=correctionRadius;y++){if(x!=0||y!=0){neighborUv=vUv+vec2(x,y)*invTexSize;vec4 neigborVelocity=textureLod(velocityTexture,neighborUv,0.0);neighborDepth=neigborVelocity.b;col=textureLod(inputTexture,neighborUv,0.0).xyz;int absX=abs(x);int absY=abs(y);\n#ifdef dilation\nif(absX==1&&absY==1){if(neighborDepth>closestDepth){velocity=neigborVelocity;closestDepth=neighborDepth;}vec4 lastNeighborVelocity=textureLod(velocityTexture,vUv+vec2(x,y)*invTexSize,0.0);lastNeighborDepth=lastNeighborVelocity.b;if(neighborDepth>closestDepth){lastVelocity=lastNeighborVelocity;lastClosestDepth=lastNeighborDepth;}}\n#endif\nif(abs(depth-neighborDepth)<MAX_NEIGHBOR_DEPTH_DIFFERENCE){\n#ifdef boxBlur\nif(absX<=2&&absY<=2)boxBlurredColor+=col;\n#endif\ncol=transformColor(col);minNeighborColor=min(col,minNeighborColor);maxNeighborColor=max(col,maxNeighborColor);}}}}float velocityLength=length(lastVelocity.xy-velocity.xy);velocityDisocclusion=(velocityLength-0.000005)*10.0;velocityDisocclusion*=velocityDisocclusion;reprojectedUv=vUv-velocity.xy;\n#ifdef boxBlur\nfloat pxRadius=correctionRadius>5 ? 121.0 : pow(float(correctionRadius*2+1),2.0);boxBlurredColor/=pxRadius;boxBlurredColor=transformColor(boxBlurredColor);\n#endif\nif(reprojectedUv.x>=0.0&&reprojectedUv.x<=1.0&&reprojectedUv.y>=0.0&&reprojectedUv.y<=1.0){accumulatedTexel=textureLod(accumulatedTexture,reprojectedUv,0.0);accumulatedColor=transformColor(accumulatedTexel.rgb);vec3 clampedColor=clamp(accumulatedColor,minNeighborColor,maxNeighborColor);accumulatedColor=mix(accumulatedColor,clampedColor,correction);didReproject=true;}else{\n#ifdef boxBlur\naccumulatedColor=boxBlurredColor;\n#else\naccumulatedColor=inputColor;\n#endif\n}if(velocity.r>FLOAT_ONE_MINUS_EPSILON&&velocity.g>FLOAT_ONE_MINUS_EPSILON){alpha=0.0;velocityDisocclusion=1.0;}}else{accumulatedColor=transformColor(textureLod(accumulatedTexture,vUv,0.0).rgb);}vec3 outputColor=inputColor;\n#include <custom_compose_shader>\ngl_FragColor=vec4(undoColorTransform(outputColor),alpha);}".replace("#include <custom_compose_shader>",e);super({type:"TemporalResolveMaterial",uniforms:{inputTexture:new te(null),accumulatedTexture:new te(null),velocityTexture:new te(null),lastVelocityTexture:new te(null),samples:new te(1),blend:new te(.5),correction:new te(1),exponent:new te(1),invTexSize:new te(new h)},defines:{correctionRadius:1},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:t})}}const Nl=`\n\t\tvec3 transformed;\n\n\t\t// Get the normal\n\t\t${Se.skinbase_vertex}\n\t\t${Se.beginnormal_vertex}\n\t\t${Se.skinnormal_vertex}\n\t\t${Se.defaultnormal_vertex}\n\n\t\t// Get the current vertex position\n\t\ttransformed = vec3( position );\n\t\t${Se.skinning_vertex}\n\t\tnewPosition = velocityMatrix * vec4( transformed, 1.0 );\n\n\t\t// Get the previous vertex position\n\t\ttransformed = vec3( position );\n\t\t${Se.skinbase_vertex.replace(/mat4 /g,"").replace(/getBoneMatrix/g,"getPrevBoneMatrix")}\n\t\t${Se.skinning_vertex.replace(/vec4 /g,"")}\n\t\tprevPosition = prevVelocityMatrix * vec4( transformed, 1.0 );\n\n\t\tgl_Position = newPosition;\n`;class Ul extends oe{constructor(){super({uniforms:{prevVelocityMatrix:{value:new d},velocityMatrix:{value:new d},prevBoneTexture:{value:null},interpolateGeometry:{value:0},intensity:{value:1},boneTexture:{value:null},alphaTest:{value:0},map:{value:null},alphaMap:{value:null},opacity:{value:1}},vertexShader:`\n #define MAX_BONES 1024\n \n ${Se.skinning_pars_vertex}\n \n\t\t#ifdef USE_SKINNING\n\t\t#ifdef BONE_TEXTURE\n\t\t\tuniform sampler2D prevBoneTexture;\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tfloat j = i * 4.0;\n\t\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\t\ty = dy * ( y + 0.5 );\n\t\t\t\tvec4 v1 = texture2D( prevBoneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\t\tvec4 v2 = texture2D( prevBoneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\t\tvec4 v3 = texture2D( prevBoneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\t\tvec4 v4 = texture2D( prevBoneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#else\n\t\t\tuniform mat4 prevBoneMatrices[ MAX_BONES ];\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tmat4 bone = prevBoneMatrices[ int(i) ];\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#endif\n\t\t#endif\n\n \n uniform mat4 velocityMatrix;\n uniform mat4 prevVelocityMatrix;\n uniform float interpolateGeometry;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n \n ${Nl}\n\n\t\t\t\t\t\tvHighPrecisionZW = gl_Position.zw;\n \n }`,fragmentShader:"\n uniform float intensity;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n\t\t\t\t\t\t#ifdef FULL_MOVEMENT\n\t\t\t\t\t\tgl_FragColor = vec4( 1., 1., 1. - gl_FragCoord.z, 0. );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t#endif\n\n vec2 pos0 = (prevPosition.xy / prevPosition.w) * 0.5 + 0.5;\n vec2 pos1 = (newPosition.xy / newPosition.w) * 0.5 + 0.5;\n \n vec2 vel = pos1 - pos0;\n\n\t\t\t\t\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n \n gl_FragColor = vec4( vel, 1. - fragCoordZ, 0. );\n \n }"}),this.isVelocityMaterial=!0}}const jl=new c(0),Fl=["visible","wireframe","side"];class zl extends Xa{constructor(e,n){var i,s;super("VelocityPass"),this.cachedMaterials=new WeakMap,this.lastCameraTransform={position:new t,quaternion:new r},this.visibleMeshes=[],this.renderedMeshesThisFrame=0,this.renderedMeshesLastFrame=0,this._scene=e,this._camera=n,this.renderTarget=new Z((null==(i=window)?void 0:i.innerWidth)||1e3,(null==(s=window)?void 0:s.innerHeight)||1e3,{type:o})}setVelocityMaterialInScene(){this.renderedMeshesThisFrame=0,this.visibleMeshes=Ol(this._scene);for(const n of this.visibleMeshes){var e;const i=n.material;let[r,s]=this.cachedMaterials.get(n)||[];var t;if(i!==r)s=new Ul,s.lastMatrixWorld=new d,n.material=s,null!=(t=n.skeleton)&&t.boneTexture&&this.saveBoneTexture(n),this.cachedMaterials.set(n,[i,s]);if(s.uniforms.velocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,n.modelViewMatrix),n.userData.needsUpdatedReflections||i.map instanceof Oe?("FULL_MOVEMENT"in s.defines||(s.needsUpdate=!0),s.defines.FULL_MOVEMENT=""):"FULL_MOVEMENT"in s.defines&&(delete s.defines.FULL_MOVEMENT,s.needsUpdate=!0),n.visible=this.cameraMovedThisFrame||!n.matrixWorld.equals(s.lastMatrixWorld)||n.skeleton||"FULL_MOVEMENT"in s.defines,n.material=s,n.visible){this.renderedMeshesThisFrame++;for(const e of Fl)s[e]=i[e];null!=(e=n.skeleton)&&e.boneTexture&&(s.defines.USE_SKINNING="",s.defines.BONE_TEXTURE="",s.uniforms.boneTexture.value=n.skeleton.boneTexture)}}}saveBoneTexture(e){let t=e.material.uniforms.prevBoneTexture.value;if(t&&t.image.width===e.skeleton.boneTexture.width)t=e.material.uniforms.prevBoneTexture.value,t.image.data.set(e.skeleton.boneTexture.image.data);else{var n;null==(n=t)||n.dispose();const i=e.skeleton.boneTexture.image.data.slice(),r=e.skeleton.boneTexture.image.width;t=new ge(i,r,r,se,pe),e.material.uniforms.prevBoneTexture.value=t,t.needsUpdate=!0}}unsetVelocityMaterialInScene(){for(const t of this.visibleMeshes){var e;if(t.material.isVelocityMaterial)t.visible=!0,t.material.lastMatrixWorld.copy(t.matrixWorld),t.material.uniforms.prevVelocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,t.modelViewMatrix),null!=(e=t.skeleton)&&e.boneTexture&&this.saveBoneTexture(t),t.material=this.cachedMaterials.get(t)[0]}}setSize(e,t){this.renderTarget.setSize(e,t)}renderVelocity(e){if(e.setRenderTarget(this.renderTarget),this.renderedMeshesThisFrame>0){const{background:t}=this._scene;this._scene.background=jl,e.render(this._scene,this._camera),this._scene.background=t}else e.clearColor()}checkCameraMoved(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));return(e>1e-6||t>1e-6)&&(this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion),!0)}render(e){this.cameraMovedThisFrame=this.checkCameraMoved(),this.setVelocityMaterialInScene(),(this.renderedMeshesThisFrame>0||this.renderedMeshesLastFrame>0)&&this.renderVelocity(e),this.unsetVelocityMaterialInScene(),this.renderedMeshesLastFrame=this.renderedMeshesThisFrame}}const Gl=new h;class Hl extends Xa{constructor(e,n,i,s={}){super("TemporalResolvePass"),this.velocityPass=null,this.velocityResolutionScale=1,this.samples=1,this.lastCameraTransform={position:new t,quaternion:new r},this._scene=e,this._camera=n,this.renderTarget=new Z(1,1,{minFilter:re,magFilter:re,type:o,depthBuffer:!1}),this.velocityPass=new zl(e,n),this.fullscreenMaterial=new Ll(i),this.fullscreenMaterial.defines.correctionRadius=s.correctionRadius||1,s.dilation&&(this.fullscreenMaterial.defines.dilation=""),s.boxBlur&&(this.fullscreenMaterial.defines.boxBlur=""),this.setupFramebuffers(1,1),this.checkCanUseSharedVelocityTexture()}dispose(){this._scene.userData.velocityTexture===this.velocityPass.renderTarget.texture&&(delete this._scene.userData.velocityTexture,delete this._scene.userData.lastVelocityTexture),this.renderTarget.dispose(),this.accumulatedTexture.dispose(),this.fullscreenMaterial.dispose(),this.velocityPass.dispose()}setSize(e,t){this.renderTarget.setSize(e,t),this.velocityPass.setSize(e*this.velocityResolutionScale,t*this.velocityResolutionScale),this.velocityPass.renderTarget.texture.minFilter=1===this.velocityResolutionScale?K:re,this.velocityPass.renderTarget.texture.magFilter=1===this.velocityResolutionScale?K:re,this.velocityPass.renderTarget.texture.needsUpdate=!0,this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t),this.setupFramebuffers(e,t)}setupFramebuffers(e,t){this.accumulatedTexture&&this.accumulatedTexture.dispose(),this.lastVelocityTexture&&this.lastVelocityTexture.dispose(),this.accumulatedTexture=new Ie(e,t,se),this.accumulatedTexture.minFilter=re,this.accumulatedTexture.magFilter=re,this.accumulatedTexture.type=o,this.lastVelocityTexture=new Ie(e*this.velocityResolutionScale,t*this.velocityResolutionScale,se),this.lastVelocityTexture.minFilter=1===this.velocityResolutionScale?K:re,this.lastVelocityTexture.magFilter=1===this.velocityResolutionScale?K:re,this.lastVelocityTexture.type=o,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.accumulatedTexture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0}checkCanUseSharedVelocityTexture(){return this._scene.userData.velocityTexture&&this.velocityPass.renderTarget.texture!==this._scene.userData.velocityTexture?this.velocityPass.renderTarget.texture===this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this._scene.userData.lastVelocityTexture,this.fullscreenMaterial.uniforms.velocityTexture.value=this._scene.userData.velocityTexture,this.fullscreenMaterial.needsUpdate=!0):this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.velocityTexture.value=this.velocityPass.renderTarget.texture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0,this._scene.userData.velocityTexture||(this._scene.userData.velocityTexture=this.velocityPass.renderTarget.texture,this._scene.userData.lastVelocityTexture=this.lastVelocityTexture)),this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value}checkNeedsResample(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));(e>1e-6||t>1e-6)&&(this.samples=1,this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion))}render(e){this.samples++,this.checkNeedsResample(),this.fullscreenMaterial.uniforms.samples.value=this.samples,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),e.copyFramebufferToTexture(Gl,this.accumulatedTexture),e.setRenderTarget(this.velocityPass.renderTarget),e.copyFramebufferToTexture(Gl,this.lastVelocityTexture)}}const Vl=function(e,t){let n=1,i=0;for(;e>0;)n/=t,i+=n*(e%t),e=~~(e/t);return i};function Wl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Yl="\n#if defined( USE_ENVMAP ) || defined( ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #ifdef BOX_PROJECTED_ENV_MAP\n vWorldPosition = worldPosition.xyz;\n #endif\n#endif\n",Ql="\n#ifdef BOX_PROJECTED_ENV_MAP\n uniform vec3 envMapSize;\n uniform vec3 envMapPosition;\n varying vec3 vWorldPosition;\n \n vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {\n vec3 nDir = normalize( v );\n\n vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n\n vec3 rbminmax;\n\n rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;\n rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;\n rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;\n\n float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );\n vec3 boxIntersection = vWorldPosition + nDir * correction;\n \n return boxIntersection - cubePos;\n }\n#endif\n",Xl="\n#ifdef BOX_PROJECTED_ENV_MAP\n worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );\n#endif\n",Zl="\n#ifdef BOX_PROJECTED_ENV_MAP\n reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );\n#endif\n";const Kl="#define GLSLIFY 1\n#define MODE_DEFAULT 0\n#define MODE_REFLECTIONS 1\n#define MODE_RAW_REFLECTION 2\n#define MODE_BLURRED_REFLECTIONS 3\n#define MODE_INPUT 4\n#define MODE_BLUR_MIX 5\n#define FLOAT_EPSILON 0.00001\nuniform sampler2D inputTexture;uniform sampler2D reflectionsTexture;uniform float samples;\n#include <boxBlur>\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 reflectionsTexel=texture2D(reflectionsTexture,vUv);ivec2 size=textureSize(reflectionsTexture,0);vec2 invTexSize=1./vec2(size.x,size.y);vec3 reflectionClr=reflectionsTexel.xyz;if(blur>FLOAT_EPSILON){vec3 blurredReflectionsColor=denoise(reflectionsTexel.rgb,reflectionsTexture,vUv,invTexSize,blur,blurSharpness,blurKernel);reflectionClr=mix(reflectionClr,blurredReflectionsColor.rgb,blur);}\n#if RENDER_MODE == MODE_DEFAULT\noutputColor=vec4(inputColor.rgb+reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_REFLECTIONS\noutputColor=vec4(reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_RAW_REFLECTION\noutputColor=vec4(reflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLURRED_REFLECTIONS\noutputColor=vec4(blurredReflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_INPUT\noutputColor=vec4(inputColor.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLUR_MIX\noutputColor=vec4(vec3(blur),1.0);\n#endif\n}".replace("#include <helperFunctions>",Bl).replace("#include <boxBlur>","#define GLSLIFY 1\nuniform float blur;uniform float blurSharpness;uniform int blurKernel;vec3 denoise(vec3 center,sampler2D tex,vec2 uv,vec2 invTexSize,float blur,float blurSharpness,int blurKernel){vec3 color;float total;vec3 col;float weight;for(int x=-blurKernel;x<=blurKernel;x++){for(int y=-blurKernel;y<=blurKernel;y++){col=textureLod(tex,uv+vec2(x,y)*invTexSize,0.).rgb;weight=1.0-abs(dot(col-center,vec3(0.25)));weight=pow(weight,blurSharpness);color+=col*weight;total+=weight;}}return color/total;}"),ql=["blur","blurSharpness","blurKernel"],Jl=new Te(1);let $l;class ec extends bl{constructor(e,t,n=kl){super("SSREffect",Kl,{type:"FinalSSRMaterial",uniforms:new Map([["reflectionsTexture",new te(null)],["blur",new te(0)],["blurSharpness",new te(0)],["blurKernel",new te(0)]]),defines:new Map([["RENDER_MODE","0"]])}),this.haltonSequence=(e=>{const t=[];let n=1;const i=n+e;for(;n<i;n++)t.push([Vl(n,2)-.5,Vl(n,3)-.5]);return t})(1024),this.haltonIndex=0,this.selection=new vl,this.lastSize=void 0,this.cubeCamera=new Ee(.001,1e3,Jl),this.usingBoxProjectedEnvMap=!1,this._scene=e,this._camera=t;n=Il({},kl,n,{boxBlur:!0,dilation:!0}),this.temporalResolvePass=new Hl(e,t,"#define GLSLIFY 1\n#define INV_EULER 0.36787944117144233\nalpha=velocityDisocclusion<FLOAT_EPSILON ?(alpha+0.0075): 0.0;alpha=clamp(alpha,0.0,1.0);bool needsBlur=!didReproject||velocityDisocclusion>0.5;\n#ifdef boxBlur\nif(needsBlur)inputColor=boxBlurredColor;\n#endif\nif(alpha==1.0){outputColor=accumulatedColor;}else{float m=mix(alpha,1.0,blend);if(needsBlur)m=0.0;outputColor=accumulatedColor*m+inputColor*(1.0-m);}",n),this.uniforms.get("reflectionsTexture").value=this.temporalResolvePass.renderTarget.texture,this.reflectionsPass=new _l(this,n),this.temporalResolvePass.fullscreenMaterial.uniforms.inputTexture.value=this.reflectionsPass.renderTarget.texture,this.lastSize={width:n.width,height:n.height,resolutionScale:n.resolutionScale,velocityResolutionScale:n.velocityResolutionScale},this.setSize(n.width,n.height),this.makeOptionsReactive(n)}makeOptionsReactive(e){let t=!1;const n=this.reflectionsPass.fullscreenMaterial.uniforms,i=Object.keys(n);for(const r of Object.keys(e))Object.defineProperty(this,r,{get:()=>e[r],set(s){if(e[r]!==s||!t)switch(e[r]=s,ql.includes(r)||this.setSize(this.lastSize.width,this.lastSize.height,!0),r){case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height);break;case"velocityResolutionScale":this.temporalResolvePass.velocityResolutionScale=s,this.setSize(this.lastSize.width,this.lastSize.height,!0);break;case"blur":this.uniforms.get("blur").value=s;break;case"blurSharpness":this.uniforms.get("blurSharpness").value=s;break;case"blurKernel":this.uniforms.get("blurKernel").value=s;break;case"steps":this.reflectionsPass.fullscreenMaterial.defines.steps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"refineSteps":this.reflectionsPass.fullscreenMaterial.defines.refineSteps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"missedRays":s?this.reflectionsPass.fullscreenMaterial.defines.missedRays="":delete this.reflectionsPass.fullscreenMaterial.defines.missedRays,this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"correctionRadius":this.temporalResolvePass.fullscreenMaterial.defines.correctionRadius=Math.round(s),this.temporalResolvePass.fullscreenMaterial.needsUpdate=t;break;case"blend":this.temporalResolvePass.fullscreenMaterial.uniforms.blend.value=s;break;case"correction":this.temporalResolvePass.fullscreenMaterial.uniforms.correction.value=s;break;case"exponent":this.temporalResolvePass.fullscreenMaterial.uniforms.exponent.value=s;break;case"distance":n.rayDistance.value=s;default:i.includes(r)&&(n[r].value=s)}}}),this[r]=e[r];t=!0}setSize(e,t,n=!1){(n||e!==this.lastSize.width||t!==this.lastSize.height||this.resolutionScale!==this.lastSize.resolutionScale||this.velocityResolutionScale!==this.lastSize.velocityResolutionScale)&&(this.temporalResolvePass.setSize(e,t),this.reflectionsPass.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale,velocityResolutionScale:this.velocityResolutionScale})}generateBoxProjectedEnvMapFallback(e,n=new t,i=new t,r=512){this.cubeCamera.renderTarget.dispose(),this.cubeCamera.renderTarget=new Te(r),this.cubeCamera.position.copy(n),this.cubeCamera.updateMatrixWorld(),this.cubeCamera.update(e,this._scene),$l||($l=new De(e),$l.compileCubemapShader());const s=$l.fromCubemap(this.cubeCamera.renderTarget.texture).texture;s.minFilter=re,s.magFilter=re;const o=this.reflectionsPass.fullscreenMaterial;return function(e,t,n){e.defines.BOX_PROJECTED_ENV_MAP="",e.uniforms.envMapPosition={value:t},e.uniforms.envMapSize={value:n};const i=new RegExp(Wl("vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;").replaceAll(" ","\\s*"),"g"),r=new RegExp(Wl("reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;").replaceAll(" ","\\s*"),"g");e.vertexShader="varying vec3 vWorldPosition;\n"+e.vertexShader.replace("#include <worldpos_vertex>",Yl),e.fragmentShader=Ql+"\n"+e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",Se.envmap_physical_pars_fragment).replace(i,`vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n ${Xl}`).replace(r,`reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n ${Zl}`)}(o,n,i),o.fragmentShader=o.fragmentShader.replace("vec3 worldPos","worldPos").replace("varying vec3 vWorldPosition;","vec3 worldPos;"),o.uniforms.envMapPosition.value.copy(n),o.uniforms.envMapSize.value.copy(i),Rl(o,s,r),this.usingBoxProjectedEnvMap=!0,s}setIBLRadiance(e,t){this._scene.traverse((n=>{if(n.material){var i;const r=null==(i=t.properties.get(n.material))?void 0:i.uniforms;r&&"disableIBLRadiance"in r&&(r.disableIBLRadiance.value=e)}}))}deleteBoxProjectedEnvMapFallback(){const e=this.reflectionsPass.fullscreenMaterial;e.uniforms.envMap.value=null,e.fragmentShader=e.fragmentShader.replace("worldPos = ","vec3 worldPos = "),delete e.defines.BOX_PROJECTED_ENV_MAP,e.needsUpdate=!0,this.usingBoxProjectedEnvMap=!1}dispose(){super.dispose(),this.reflectionsPass.dispose(),this.temporalResolvePass.dispose()}update(e,t){if(!this.usingBoxProjectedEnvMap&&this._scene.environment){const t=this.reflectionsPass.fullscreenMaterial;let n=null;if(this._scene.traverse((t=>{if(!n&&t.material&&!t.material.envMap){const i=e.properties.get(t.material);"envMap"in i&&i.envMap instanceof u&&(n=i.envMap)}})),n){const e=this._scene.environment.image.height;Rl(t,n,e)}}this.haltonIndex=(this.haltonIndex+1)%this.haltonSequence.length;const[n,i]=this.haltonSequence[this.haltonIndex],{width:r,height:s}=this.lastSize;this.temporalResolvePass.velocityPass.render(e),this._camera.setViewOffset&&this._camera.setViewOffset(r,s,n,i,r,s),this.reflectionsPass.render(e,t),this.temporalResolvePass.render(e),this._camera.clearViewOffset()}static patchDirectEnvIntensity(e=0){Se.envmap_physical_pars_fragment=0===e?Se.envmap_physical_pars_fragment.replace("vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {","vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { return vec3(0.0);"):Se.envmap_physical_pars_fragment.replace("vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );","vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ) * "+e.toFixed(5)+";")}}const tc="EffectPass";class nc{constructor(e,t,n){this.renderer=e,this.scene=t,this.camera=n,this.passesMap=new Map,this.effectsMap=new Map,this.effectsNeedsUpddate=!0,this.effectComposer=this._initEffectComposer(),this._initPasses(),this._initEffects()}updateEffectPass(){if(!this.effectsNeedsUpddate)return;this.effectsNeedsUpddate=!1;const{effectComposer:e}=this;e.passes.forEach((t=>{t.name===tc&&(e.removePass(t),t.dispose())}));const t=Array.from(this.effectsMap).filter((e=>{let[,{enabled:t}]=e;return t})).map((e=>{let[,{effect:t}]=e;return t})),n=new ll(this.camera,...t);n.enabled=!!t.length,this.passesMap.set(nc.CONSTANTS.effectPass,n),e.addPass(n)}updateCamera(e){const{passesMap:t,effectsMap:n}=this,{CONSTANTS:i}=nc,r=t.get(i.renderPass),s=t.get(i.normalPass),o=t.get(i.effectPass);r.mainCamera=e,s.mainCamera=e,o.mainCamera=e;n.get(i.outlineEffect).effect.mainCamera=e}_initEffectComposer(){const e=new class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:r}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Za,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"undefined"!=typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return this._delta*gl}get fixedDelta(){return this._fixedDelta*gl}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return this._elapsed*gl}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==e?e:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}handleEvent(e){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){const t=e.getSize(new h),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===Q&&jo(e)===_o&&(Fo(this.inputBuffer.texture,_o),Fo(this.outputBuffer.texture,_o),this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const t of this.passes)t.initialize(e,n,i)}}replaceRenderer(e,t=!0){const n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){const e=this.depthTexture=new q;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=J,e.type=$):e.type=ee,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,n,i){const r=this.renderer,s=null===r?new h:r.getDrawingBufferSize(new h),o={minFilter:re,magFilter:re,stencilBuffer:t,depthBuffer:e,type:n},a=new Z(s.width,s.height,o);return i>0&&(a.ignoreDepthForMultisampleCopy=!1,a.samples=i),n===Q&&jo(r)===_o&&Fo(a.texture,_o),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new h),s=i.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.setRenderer(i),e.setSize(r.width,r.height),e.initialize(i,s,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const t=this.createDepthTexture();for(e of n)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture){const n=(e,t)=>e||t.needsDepthTexture;t.reduce(n,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let i,r,s,o=this.inputBuffer,a=this.outputBuffer,l=!1;void 0===e&&(this.timer.update(),e=this.timer.delta);for(const c of this.passes)c.enabled&&(c.render(t,o,a,e,l),c.needsSwap&&(l&&(n.renderToScreen=c.renderToScreen,i=t.getContext(),r=t.state.buffers.stencil,r.setFunc(i.NOTEQUAL,1,4294967295),n.render(t,o,a,e,l),r.setFunc(i.EQUAL,1,4294967295)),s=o,o=a,a=s),c instanceof hl?l=!0:c instanceof Ka&&(l=!1))}setSize(e,t,n){const i=this.renderer,r=i.getSize(new h);void 0!==e&&void 0!==t||(e=r.width,t=r.height),r.width===e&&r.height===t||i.setSize(e,t,n);const s=i.getDrawingBufferSize(new h);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const e of this.passes)e.setSize(s.width,s.height)}reset(){const e=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=e}dispose(){for(const e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(this.renderer,{multisampling:8,frameBufferType:o});return e}_initPasses(){const{effectComposer:e}=this,t=this._initRenderPass(),n=this._initNormalPass(),i=this._initEffectPass();this.passesMap.set(nc.CONSTANTS.renderPass,t),this.passesMap.set(nc.CONSTANTS.normalPass,n),this.passesMap.set(nc.CONSTANTS.effectPass,i),e.addPass(t),e.addPass(n),e.addPass(i)}_initRenderPass(){return new il(this.scene,this.camera)}_initNormalPass(){const e=new fl(this.scene,this.camera,{resolutionScale:1});return e.enabled=!1,e}_initEffectPass(){const e=new ll(this.camera);return e.name=tc,e}_initEffects(){const{CONSTANTS:e}=nc,t=this._initSMAAEffect(),n=this._initOutlineEffect(),i=this._initSSREffect(),r=this._initBloomEffect(),s=this._initSSAOEffect();this.effectsMap.set(e.smaaEffect,{enabled:!0,effect:t}),this.effectsMap.set(e.outlineEffect,{enabled:!1,effect:n}),this.effectsMap.set(e.ssrEffect,{enabled:!1,effect:i}),this.effectsMap.set(e.bloomEffect,{enabled:!1,effect:r}),this.effectsMap.set(e.ssaoEffect,{enabled:!1,effect:s})}_initSMAAEffect(){return new Dl({preset:Pa,edgeDetectionMode:xa})}_initSSREffect(){return new ec(this.scene,this.camera)}_initBloomEffect(){return new Al({blendFunction:Ho})}_initOutlineEffect(){return new Sl(this.scene,this.camera,{blendFunction:va})}_initSSAOEffect(){const{CONSTANTS:e}=nc,t=this.passesMap.get(e.normalPass);return new Cl(this.camera,t.texture,{blendFunction:ua})}}nc.CONSTANTS={renderPass:"renderPass",normalPass:"normalPass",velocityDepthNormalPass:"velocityDepthNormalPass",effectPass:"effectPass",smaaEffect:"smaaEffect",ssgiEffect:"ssgiEffect",ssaoEffect:"ssaoEffect",outlineEffect:"outlineEffect",ssrEffect:"ssrEffect",bloomEffect:"bloomEffect"};const ic=new class{constructor(){this.workerPool=new kt(4)}generate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{workerPool:n}=this;return new Promise(((r,s)=>{if(e.attributes.position instanceof Re)throw new Error("GenerateMeshBVHWorker: GLBufferAttribute are not supported for the geometry attributes.");_t(e);const o=e.index?e.index.array:null,a=e.attributes.position.array;n.postMessage({index:o,position:a,options:Object.assign(Object.assign({},t),{onProgress:null,includedProgressCallback:Boolean(t.onProgress),groups:[...e.groups]})}).then((n=>{const{data:o}=n;if(o)if(o.error)s(new Error(o.error));else if(o.serialized){const{serialized:n,position:s}=o,a=Lt.deserialize(n,e,{setIndex:!1}),l=Object.assign({setBoundingBox:!1},t);if(e.attributes.position instanceof _e?e.attributes.position.data.array=s:e.attributes.position instanceof f&&(e.attributes.position.array=s),e.index)e.index.array=n.index;else{const t=new f(n.index,1,!1);e.setIndex(t)}l.setBoundingBox&&(e.boundingBox=a.getBoundingBox(new i)),r(a)}else t.onProgress&&t.onProgress(o.progress)}))}))}dispose(){this.workerPool.dispose()}};class rc{constructor(e){this.viewport=e,this.cameraChanging=!1,this.timer=null,this.computedGeometriesUuid=new Map,this.generateMeshBVHWorker=ic,this.viewport.signals.cameraChange.add((()=>{this.cameraChanging=!0,this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=window.setTimeout((()=>{this.cameraChanging=!1}),1e3)}))}computeModelsBoundsTree(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:n="slice",force:i=!1,frameSliceCount:r=500,workerCreator:s}=t,{meshOfModelList:o}=this.viewport.scener.intersectsList,a=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:async e=>e.geometry.computeBoundsTree({setBoundingBox:!1});!i&&e.computedGeometriesUuid.has(t.geometry.uuid)||n(t).then((()=>{e.computedGeometriesUuid.set(t.geometry.uuid,t.geometry.uuid)}))};return new Promise(((e,t)=>{if("block"===n)o.forEach((e=>a(e))),e();else if("slice"===n){let t=0,n=0;const i=()=>{if(t=requestAnimationFrame(i),!this.cameraChanging){for(const e of o.slice(n,n+r))a(e),n+=1;n>=o.length&&(cancelAnimationFrame(t),e())}};i()}else if("worker"===n)if(s){this.generateMeshBVHWorker.workerPool.setWorkerCreator(s);const t=e=>this.generateMeshBVHWorker.generate(e.geometry).then((t=>t&&(e.geometry.boundsTree=t)));Promise.allSettled(o.map((e=>a(e,t)))).then((()=>e()))}else t("请设置 workerCreator")}))}dispose(){this.generateMeshBVHWorker.dispose()}}const sc=navigator.userAgent.toLowerCase().includes("mac");var oc;!function(e){e[e.NONE=-1]="NONE",e[e.ROTATE=0]="ROTATE",e[e.ZOOM=1]="ZOOM",e[e.PAN=2]="PAN"}(oc||(oc={}));const ac=new t,lc=[new t,new t,new t],cc=[new t,new t,new t];let uc=new DOMRect;class hc{constructor(e){this.viewport=e,this.camera=this.viewport.cameraManager.mainCamera,this.domElement=this.viewport.interactiveContainer,this.interactivePosition=null,this.fallbackInteractivePosition=null,this.enabled=!0,this.enabledMousePointInteractive=!0,this.enableZoom=!0,this.zoomSpeed=1,this.zoomMinDistance=1,this.zoomMaxDistance=1e5,this.zoomMinStepDistance=.1,this.zoomMaxStepDistance=2e4,this.enableRotate=!0,this.enableRotateX=!0,this.enableRotateY=!0,this.rotateSpeed=1,this.rotateTiltRange={max:Math.PI,min:0},this.enableAutoRotate=!1,this.autoRotateSpeed=1,this.autoRotateClockwise=!0,this.enableOutOfScene=!0,this.unOffsetOfScene=0,this.enablePan=!0,this.enablePanX=!0,this.enablePanY=!0,this.enablePanAxisX=!0,this.enablePanAxisY=!0,this.enablePanAxisZ=!0,this.panSpeed=2,this.state=oc.NONE,this.sceneBoxCenter=new t,this.dispose=()=>{},this.domElement=e.interactiveContainer,this.init()}init(){const e=e=>{e.preventDefault(),!1!==this.enabled&&(0===e.button?this.state=oc.ROTATE:1===e.button?this.state=oc.ZOOM:2===e.button&&(this.state=oc.PAN),uc=this.domElement.getBoundingClientRect(),this.state!==oc.ROTATE&&this.state!==oc.PAN||(this.interactivePosition=this.getInteractivePosition(e),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("mousemove",n,!1),window.addEventListener("mouseup",i,!0)))},n=e=>{if(e.preventDefault(),!1===this.enabled)return;const{movementX:n,movementY:i}=e;this.state===oc.ROTATE?this.rotate(new t(.00375*-n,.00375*-i,0)):this.state===oc.PAN&&this.pan(new t(-n,i,0))},i=e=>{e.preventDefault(),this.domElement.removeEventListener("mousemove",n,!1),window.removeEventListener("mouseup",i,!0),this.state=oc.NONE},r=e=>{if(e.preventDefault(),!this.enabled)return;let n=0;n=sc&&e.shiftKey?120*-e.deltaX:120*-e.deltaY,this.zoom_on_point(new t(0,0,n),e)},s=e=>{if(e.preventDefault(),!1===this.enabled)return;uc=this.domElement.getBoundingClientRect();const n=e.touches;switch(n.length){case 1:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[0].clientX,n[0].clientY,0);break;case 2:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[1].clientX,n[1].clientY,0);break;case 3:case 4:case 5:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[2].clientX,n[2].clientY,0)}const i=new t(uc.x,uc.y,0);lc[0].sub(i),lc[1].sub(i),cc[0].copy(lc[0]),cc[1].copy(lc[1]),this.interactivePosition=this.getInteractivePosition({offsetX:(lc[0].x+lc[1].x)/2,offsetY:(lc[0].y+lc[1].y)/2}),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("touchmove",o,{passive:!1}),this.domElement.addEventListener("touchend",a,!1)},o=e=>{if(e.preventDefault(),!1===this.enabled)return;function n(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y";const r=new h(e[1].x-e[0].x,e[1].y-e[0].y),s=new h(n[1].x-n[0].x,n[1].y-n[0].y),o=r.angle(),a=s.angle();r.normalize(),s.normalize();const l=n[0].y-e[0].y;return"y"===i?new t(0,.005*l,0):"x"===i?new t(o-a,0,0):new t}switch(e.touches.length){case 1:{lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0);const t=lc[0].clone().sub(((e,t)=>{let n=t[0];for(const i in t)n.distanceTo(e)>t[i].distanceTo(e)&&(n=t[i]);return n})(lc[0],cc));t.x=-t.x;const n=t.multiplyScalar(.9);this.pan(n);break}case 2:{lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[1].clientX-uc.x,e.touches[1].clientY-uc.y,0);const i=cc[0].distanceTo(cc[1])-lc[0].distanceTo(lc[1]);this.zoom_touch(new t(0,0,i*this.zoomSpeed/25)),this.rotate(n(lc,cc,"x"));break}case 3:case 4:case 5:lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[2].clientX-uc.x,e.touches[2].clientY-uc.y,0),this.rotate(n(lc,cc,"y"))}cc[0].copy(lc[0]),cc[1].copy(lc[1])},a=e=>{e.preventDefault(),this.state=oc.NONE,this.domElement.removeEventListener("touchmove",o,!1),this.domElement.removeEventListener("touchend",a,!1)};this.domElement.addEventListener("mousedown",e,!1),this.domElement.addEventListener("wheel",r,{passive:!1}),this.domElement.addEventListener("touchstart",s,{passive:!1}),this.dispose=()=>{this.domElement.removeEventListener("mousedown",e),this.domElement.removeEventListener("wheel",r),this.domElement.removeEventListener("touchstart",s)}}getInteractivePosition(e){if(this.enabledMousePointInteractive){const t=this.viewport.getIntersects(e,void 0,{isFilterHideObject:!0});if(t.length){const[{point:e}]=t;return e.clone()}return this.fallbackInteractivePosition}return this.fallbackInteractivePosition}intersectsBox(e){const n=this.getSceneBbox(),i=new t;n.getSize(i);let r=Math.max(i.x,i.y,i.z);0!=this.unOffsetOfScene&&(r=this.unOffsetOfScene);const s=n.clone();s.min.addScalar(r/2),s.max.addScalar(-r/2);const o=(new j).copy(this.camera);o.position.add(e),o.updateMatrixWorld(),o.updateProjectionMatrix();return(new ke).setFromProjectionMatrix((new d).multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse)).intersectsBox(n)}caculateContainPoint(e,n){const i=(new t).copy(e).applyMatrix4(n.matrixWorldInverse).applyMatrix4(n.projectionMatrix);return!(Math.abs(i.x)>1||Math.abs(i.y)>1||Math.abs(i.z)>1)}panLeft(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[0]),this.enablePanAxisY&&n.setY(i[1]),this.enablePanAxisZ&&n.setZ(i[2]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}panUp(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[4]),this.enablePanAxisY&&n.setY(i[5]),this.enablePanAxisZ&&n.setZ(i[6]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}pan(e){var t;if(!this.enablePan)return;this.enablePanX||e.setX(0),this.enablePanY||e.setY(0);const n=null!==(t=this.interactivePosition)&&void 0!==t?t:this.sceneBoxCenter;let i=this.camera.position.clone().sub(n).length();i*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(this.panSpeed*e.x*i/uc.height),this.panUp(this.panSpeed*e.y*i/uc.height),this.viewport.signals.cameraChange.dispatch()}zoom_on_point(e,n){if(!this.enableZoom)return;this.interactivePosition=this.getInteractivePosition(n);let i=e.z>0?6:-6;const r=new t(0,0,0);let s;if(this.interactivePosition){s=this.interactivePosition.distanceTo(this.camera.position);const e=this.domElement.getBoundingClientRect();r.set(n.offsetX/e.width*2-1,-n.offsetY/e.height*2+1,.1)}else s=this.camera.position.length(),r.set(0,0,.1);let o=!1;s>this.zoomMaxDistance&&i<0?(o=!0,s=this.zoomMaxDistance,i*=2):s<this.zoomMinDistance&&i>0&&(o=!0,s=this.zoomMinDistance,i*=2),r.unproject(this.camera),r.sub(this.camera.position);let a=s/i*this.zoomSpeed;if(a>0?a>this.zoomMaxStepDistance?a=this.zoomMaxStepDistance:a<this.zoomMinStepDistance&&(a=this.zoomMinStepDistance):a<0&&(a<-this.zoomMaxStepDistance?a=-this.zoomMaxStepDistance:a>-this.zoomMinStepDistance&&(a=-this.zoomMinStepDistance)),o&&!n.shiftKey)return;const l=this.camera.position.clone().addVectors(this.camera.position,r.setLength(a));this.camera.position.copy(l),this.viewport.signals.cameraChange.dispatch()}zoom_touch(e){if(!this.enableZoom)return;let n=e.z;const i=new t(0,0,0);let r;if(this.interactivePosition){const e={offsetX:(cc[0].x+cc[1].x)/2,offsetY:(cc[0].y+cc[1].y)/2};r=this.interactivePosition.distanceTo(this.camera.position),i.set(e.offsetX/uc.width*2-1,-e.offsetY/uc.height*2+1,.1)}else r=this.camera.position.length(),i.set(0,0,.1);if(r>this.zoomMaxDistance&&n>0?(r=this.zoomMaxDistance,n=0):r<this.zoomMinDistance&&n<0&&(r=this.zoomMinDistance),0===n)return;i.unproject(this.camera),i.sub(this.camera.position);let s=r*-n*this.zoomSpeed*.1;s>0?s>this.zoomMaxStepDistance?s=this.zoomMaxStepDistance:s<this.zoomMinStepDistance&&(s=this.zoomMinStepDistance):s<0&&(s<-this.zoomMaxStepDistance?s=-this.zoomMaxStepDistance:s>-this.zoomMinStepDistance&&(s=-this.zoomMinStepDistance));const o=this.camera.position.clone().addVectors(this.camera.position,i.setLength(s));this.camera.position.copy(o),this.viewport.signals.cameraChange.dispatch()}rotate(e){var n;if(!this.enableRotate)return;e.x*=this.rotateSpeed,e.y*=this.rotateSpeed;const i=new t(0,0,-1);i.applyQuaternion(this.camera.quaternion);const r=i.angleTo(new t(0,1,0));(r-e.y>this.rotateTiltRange.max&&e.y<0||r-e.y<this.rotateTiltRange.min&&e.y>0)&&(e.y=0);const s=null!==(n=this.interactivePosition)&&void 0!==n?n:this.sceneBoxCenter;ac.copy(this.camera.position).sub(s);const o=new d,a=new t(1,0,0);this.enableRotateX&&o.makeRotationAxis(new t(0,1,0),e.x);const l=new d;this.enableRotateY&&(a.applyEuler(this.camera.rotation),l.makeRotationAxis(a,e.y),o.multiply(l)),ac.applyMatrix4(o),i.applyMatrix4(o),this.camera.position.copy(s).add(ac),this.camera.lookAt(i.add(this.camera.position)),this.viewport.signals.cameraChange.dispatch()}autoRotate(){const e=this.autoRotateClockwise?.01:-.01;this.rotate(new t(e*this.autoRotateSpeed,0,0))}update(){this.enableAutoRotate&&this.autoRotate()}getSceneBbox(){const e=this.viewport.scene,t=new i;return t.setFromObject(e),t}}const dc={type:"change"},fc={type:"start"},pc={type:"end"};class gc extends ce{constructor(e,n){super(),this.object=e,this.domElement=n,this.enabled=!0,this.target=new t,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.enableAutoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Le.ROTATE,MIDDLE:Le.DOLLY,RIGHT:Le.PAN},this.touches={ONE:Ne.ROTATE,TWO:Ne.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.userData.zoom,this._domElementKeyEvents=null,this.domElement.style.touchAction="none",this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",Q),this._domElementKeyEvents=e},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.userData.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.userData.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(dc),i.update(),o=s.NONE},this.update=function(){const n=new t,h=(new r).setFromUnitVectors(e.up,new t(0,1,0)),p=h.clone().invert(),g=new t,m=new r,v=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(h),l.setFromVector3(n),i.enableAutoRotate&&o===s.NONE&&D(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(l.theta+=c.theta*i.dampingFactor,l.phi+=c.phi*i.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let t=i.minAzimuthAngle,r=i.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=v:t>Math.PI&&(t-=v),r<-Math.PI?r+=v:r>Math.PI&&(r-=v),l.theta=t<=r?Math.max(t,Math.min(r,l.theta)):l.theta>(t+r)/2?Math.max(t,l.theta):Math.min(r,l.theta)),l.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=u,l.radius=Math.max(i.minDistance,Math.min(i.maxDistance,l.radius)),!0===i.enableDamping?i.target.addScaledVector(d,i.dampingFactor):i.target.add(d),n.setFromSpherical(l),n.applyQuaternion(p),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,d.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),d.set(0,0,0)),u=1,!!(f||g.distanceToSquared(i.object.position)>a||8*(1-m.dot(i.object.quaternion))>a)&&(i.dispatchEvent(dc),g.copy(i.object.position),m.copy(i.object.quaternion),f=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",X),i.domElement.removeEventListener("pointerdown",G),i.domElement.removeEventListener("pointercancel",W),i.domElement.removeEventListener("wheel",Y),i.domElement.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",Q)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=s.NONE;const a=1e-6,l=new Ue,c=new Ue;let u=1;const d=new t;let f=!1;const p=new h,g=new h,m=new h,v=new h,y=new h,w=new h,b=new h,A=new h,x=new h,S=[],T={};function E(){return Math.pow(.95,i.zoomSpeed)}function D(e){c.theta-=e}function C(e){c.phi-=e}const I=function(){const e=new t;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),d.add(e)}}(),B=function(){const e=new t;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),d.add(e)}}(),M=function(){const e=new t;return function(t,n){const r=i.domElement;if(i.object instanceof j){const s=i.object.position;e.copy(s).sub(i.target);let o=e.length();o*=Math.tan(i.object.fov/2*Math.PI/180),I(2*t*o/r.clientHeight,i.object.matrix),B(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(t*(i.object.right-i.object.left)/i.object.userData.zoom/r.clientWidth,i.object.matrix),B(n*(i.object.top-i.object.bottom)/i.object.userData.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function P(e){i.object instanceof j?u/=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom*e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function O(e){i.object instanceof j?u*=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom/e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function R(e){p.set(e.clientX,e.clientY)}function _(e){v.set(e.clientX,e.clientY)}function k(){if(1===S.length)p.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);p.set(e,t)}}function L(){if(1===S.length)v.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);v.set(e,t)}}function N(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function U(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}m.subVectors(g,p).multiplyScalar(i.rotateSpeed);const t=i.domElement;D(2*Math.PI*m.x/t.clientHeight),C(2*Math.PI*m.y/t.clientHeight),p.copy(g)}function F(e){if(1===S.length)y.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);y.set(n,i)}w.subVectors(y,v).multiplyScalar(i.panSpeed),M(w.x,w.y),v.copy(y)}function z(e){const t=q(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);A.set(0,s),x.set(0,Math.pow(A.y/b.y,i.zoomSpeed)),P(x.y),b.copy(A)}function G(e){!1!==i.enabled&&(0===S.length&&(i.domElement.addEventListener("pointermove",H),window.addEventListener("pointerup",V)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(K(e),S.length){case 1:switch(i.touches.ONE){case Ne.ROTATE:if(!1===i.enableRotate)return;k(),o=s.TOUCH_ROTATE;break;case Ne.PAN:if(!1===i.enablePan)return;L(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case Ne.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&N(),i.enablePan&&L(),o=s.TOUCH_DOLLY_PAN;break;case Ne.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&N(),i.enableRotate&&k(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(fc)}(e):function(e){let t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Le.DOLLY:if(!1===i.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),o=s.DOLLY;break;case Le.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;_(e),o=s.PAN}else{if(!1===i.enableRotate)return;R(e),o=s.ROTATE}break;case Le.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;R(e),o=s.ROTATE}else{if(!1===i.enablePan)return;_(e),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(fc)}(e))}function H(e){e.preventDefault(),!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(K(e),o){case s.TOUCH_ROTATE:if(!1===i.enableRotate)return;U(e),i.update();break;case s.TOUCH_PAN:if(!1===i.enablePan)return;F(e),i.update();break;case s.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&z(e),i.enablePan&&F(e)}(e),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&z(e),i.enableRotate&&U(e)}(e),i.update();break;default:o=s.NONE}}(e):function(e){switch(o){case s.ROTATE:if(!1===i.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),m.subVectors(g,p).multiplyScalar(i.rotateSpeed);const t=i.domElement;D(2*Math.PI*m.x/t.clientHeight),C(2*Math.PI*m.y/t.clientHeight),p.copy(g),i.update()}(e);break;case s.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),x.subVectors(A,b),x.y>0?P(E()):x.y<0&&O(E()),b.copy(A),i.update()}(e);break;case s.PAN:if(!1===i.enablePan)return;!function(e){y.set(e.clientX,e.clientY),w.subVectors(y,v).multiplyScalar(i.panSpeed),M(w.x,w.y),v.copy(y),i.update()}(e)}}(e))}function V(e){Z(e),0===S.length&&(i.domElement.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V)),i.dispatchEvent(pc),o=s.NONE}function W(e){Z(e)}function Y(e){!1!==i.enabled&&!1!==i.enableZoom&&o===s.NONE&&(e.preventDefault(),i.dispatchEvent(fc),function(e){e.deltaY<0?O(E()):e.deltaY>0&&P(E()),i.update()}(e),i.dispatchEvent(pc))}function Q(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:M(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:M(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:M(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:M(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function X(e){!1!==i.enabled&&e.preventDefault()}function Z(e){delete T[e.pointerId];for(let t=0;t<S.length;t++)if(S[t].pointerId==e.pointerId)return void S.splice(t,1)}function K(e){let t=T[e.pointerId];void 0===t&&(t=new h,T[e.pointerId]=t),t.set(e.pageX,e.pageY)}function q(e){const t=e.pointerId===S[0].pointerId?S[1]:S[0];return T[t.pointerId]}i.domElement.addEventListener("contextmenu",X),i.domElement.addEventListener("pointerdown",G),i.domElement.addEventListener("pointercancel",W),i.domElement.addEventListener("wheel",Y,{passive:!1})}}class mc{get options(){return this._options}set options(e){this._options=e,e.type||(this._options.type="free"),this._onChangeCallback()}constructor(e){this.viewport=e,this._options={type:"free"},this._disposeList=new Set,this.currentControls=new hc(this.viewport)}handleFreeControls(){const e=es(this.options,["type"]),{postRender:t}=this.viewport,n=this.currentControls=new hc(this.viewport);Object.assign(n,e),t.set("FreeControlsUpdate",(()=>{n.update()})),this._disposeList.add((()=>{t.delete("FreeControlsUpdate")}))}handleOrbitControls(){const e=es(Object.assign({},this.options),["type"]),{cameraManager:{mainCamera:t},interactiveContainer:n,postRender:i}=this.viewport,r=this.currentControls=new gc(t,n);Object.assign(r,e),r.update();const s=()=>{this.viewport.signals.cameraChange.dispatch()};if(r.addEventListener("change",s),this._disposeList.add((()=>{r.removeEventListener("change",s)})),e.enableDamping||e.enableAutoRotate)i.set("OrbitControlsUpdate",(()=>{this.viewport.render((()=>{r.update()}))})),this._disposeList.add((()=>{i.delete("OrbitControlsUpdate")}));else{const e=e=>{e&&r.update()};this.viewport.signals.cameraChange.add(e),this._disposeList.add((()=>{this.viewport.signals.cameraChange.remove(e)}))}}_onChangeCallback(){switch(this.dispose(),this.options.type){case"free":default:this.handleFreeControls();break;case"orbit":this.handleOrbitControls()}this.viewport.triggerRender()}setOptions(e){this.options=e}dispose(){this.currentControls.dispose(),this._disposeList.forEach((e=>e())),this._disposeList.clear()}}var vc="0123456789abcdefghijklmnopqrstuvwxyz";function yc(e){return vc.charAt(e)}function wc(e,t){return e&t}function bc(e,t){return e|t}function Ac(e,t){return e^t}function xc(e,t){return e&~t}function Sc(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Tc(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Ec,Dc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cc="=";function Ic(e){var t,n,i="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),i+=Dc.charAt(n>>6)+Dc.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),i+=Dc.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),i+=Dc.charAt(n>>2)+Dc.charAt((3&n)<<4));(3&i.length)>0;)i+=Cc;return i}function Bc(e){var t,n="",i=0,r=0;for(t=0;t<e.length&&e.charAt(t)!=Cc;++t){var s=Dc.indexOf(e.charAt(t));s<0||(0==i?(n+=yc(s>>2),r=3&s,i=1):1==i?(n+=yc(r<<2|s>>4),r=15&s,i=2):2==i?(n+=yc(r),n+=yc(s>>2),r=3&s,i=3):(n+=yc(r<<2|s>>4),n+=yc(15&s),i=0))}return 1==i&&(n+=yc(r<<2)),n}var Mc,Pc=function(e){var t;if(void 0===Ec){var n="0123456789ABCDEF",i=" \f\n\r\t \u2028\u2029";for(Ec={},t=0;t<16;++t)Ec[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Ec[n.charAt(t)]=t;for(t=0;t<i.length;++t)Ec[i.charAt(t)]=-1}var r=[],s=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=Ec[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);s|=a,++o>=2?(r[r.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return r},Oc={decode:function(e){var t;if(void 0===Mc){var n="= \f\n\r\t \u2028\u2029";for(Mc=Object.create(null),t=0;t<64;++t)Mc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(Mc["-"]=62,Mc._=63,t=0;t<n.length;++t)Mc[n.charAt(t)]=-1}var i=[],r=0,s=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=Mc[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);r|=o,++s>=4?(i[i.length]=r>>16,i[i.length]=r>>8&255,i[i.length]=255&r,r=0,s=0):r<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:i[i.length]=r>>10;break;case 3:i[i.length]=r>>16,i[i.length]=r>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=Oc.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return Oc.decode(e)}},Rc=1e13,_c=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,i,r=this.buf,s=r.length;for(n=0;n<s;++n)(i=r[n]*e+t)<Rc?t=0:i-=(t=0|i/Rc)*Rc,r[n]=i;t>0&&(r[n]=t)},e.prototype.sub=function(e){var t,n,i=this.buf,r=i.length;for(t=0;t<r;++t)(n=i[t]-e)<0?(n+=Rc,e=1):e=0,i[t]=n;for(;0===i[i.length-1];)i.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),i=t.length-2;i>=0;--i)n+=(Rc+t[i]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*Rc+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),kc="…",Lc=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Nc=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Uc(e,t){return e.length>t&&(e=e.substring(0,t)+kc),e}var jc,Fc=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var i="",r=e;r<t;++r)if(i+=this.hexByte(this.get(r)),!0!==n)switch(15&r){case 7:i+=" ";break;case 15:i+="\n";break;default:i+=" "}return i},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var i=this.get(n);if(i<32||i>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",i=e;i<t;++i)n+=String.fromCharCode(this.get(i));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",i=e;i<t;){var r=this.get(i++);n+=r<128?String.fromCharCode(r):r>191&&r<224?String.fromCharCode((31&r)<<6|63&this.get(i++)):String.fromCharCode((15&r)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,i,r="",s=e;s<t;)n=this.get(s++),i=this.get(s++),r+=String.fromCharCode(n<<8|i);return r},e.prototype.parseTime=function(e,t,n){var i=this.parseStringISO(e,t),r=(n?Lc:Nc).exec(i);return r?(n&&(r[1]=+r[1],r[1]+=+r[1]<70?2e3:1900),i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(e,t){for(var n,i=this.get(e),r=i>127,s=r?255:0,o="";i==s&&++e<t;)i=this.get(e);if(0===(n=t-e))return r?-1:0;if(n>4){for(o=i,n<<=3;0==(128&(+o^s));)o=+o<<1,--n;o="("+n+" bit)\n"}r&&(i-=256);for(var a=new _c(i),l=e+1;l<t;++l)a.mulAdd(256,this.get(l));return o+a.toString()},e.prototype.parseBitString=function(e,t,n){for(var i=this.get(e),r="("+((t-e-1<<3)-i)+" bit)\n",s="",o=e+1;o<t;++o){for(var a=this.get(o),l=o==t-1?i:0,c=7;c>=l;--c)s+=a>>c&1?"1":"0";if(s.length>n)return r+Uc(s,n)}return r+s},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return Uc(this.parseStringISO(e,t),n);var i=t-e,r="("+i+" byte)\n";i>(n/=2)&&(t=e+n);for(var s=e;s<t;++s)r+=this.hexByte(this.get(s));return i>n&&(r+=kc),r},e.prototype.parseOID=function(e,t,n){for(var i="",r=new _c,s=0,o=e;o<t;++o){var a=this.get(o);if(r.mulAdd(128,127&a),s+=7,!(128&a)){if(""===i)if((r=r.simplify())instanceof _c)r.sub(80),i="2."+r.toString();else{var l=r<80?r<40?0:1:2;i=l+"."+(r-40*l)}else i+="."+r.toString();if(i.length>n)return Uc(i,n);r=new _c,s=0}}return s>0&&(i+=".incomplete"),i},e}(),zc=function(){function e(e,t,n,i,r){if(!(i instanceof Gc))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=i,this.sub=r}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Uc(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return Uc(this.stream.parseStringISO(t,t+n),e);case 30:return Uc(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,i=this.sub.length;n<i;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var i=0;i<n;++i)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof Fc?t:new Fc(t,0);var i=new Fc(n),r=new Gc(n),s=e.decodeLength(n),o=n.pos,a=o-i.pos,l=null,c=function(){var t=[];if(null!==s){for(var i=o+s;n.pos<i;)t[t.length]=e.decode(n);if(n.pos!=i)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var r=e.decode(n);if(r.tag.isEOC())break;t[t.length]=r}s=o-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(r.tagConstructed)l=c();else if(r.isUniversal()&&(3==r.tagNumber||4==r.tagNumber))try{if(3==r.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");l=c();for(var u=0;u<l.length;++u)if(l[u].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){l=null}if(null===l){if(null===s)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(s)}return new e(i,a,s,r,l)},e}(),Gc=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=0!=(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new _c;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),Hc=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Vc=(1<<26)/Hc[Hc.length-1],Wc=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this[o]>>a)>0&&(r=!0,s=yc(n));o>=0;)a<t?(n=(this[o]&(1<<a)-1)<<t-a,n|=this[--o]>>(a+=this.DB-t)):(n=this[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),n>0&&(r=!0),r&&(s+=yc(n));return r?s:"0"},e.prototype.negate=function(){var t=Kc();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ru(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=Kc();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new Qc(t):new Xc(t),this.exp(e,n)},e.prototype.clone=function(){var e=Kc();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,i=this.DB-e*this.DB%8,r=0;if(e-- >0)for(i<this.DB&&(n=this[e]>>i)!=(this.s&this.DM)>>i&&(t[r++]=n|this.s<<this.DB-i);e>=0;)i<8?(n=(this[e]&(1<<i)-1)<<8-i,n|=this[--e]>>(i+=this.DB-8)):(n=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(t[r++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=Kc();return this.bitwiseTo(e,wc,t),t},e.prototype.or=function(e){var t=Kc();return this.bitwiseTo(e,bc,t),t},e.prototype.xor=function(e){var t=Kc();return this.bitwiseTo(e,Ac,t),t},e.prototype.andNot=function(e){var t=Kc();return this.bitwiseTo(e,xc,t),t},e.prototype.not=function(){for(var e=Kc(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=Kc();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=Kc();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Sc(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=Tc(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,bc)},e.prototype.clearBit=function(e){return this.changeBit(e,xc)},e.prototype.flipBit=function(e){return this.changeBit(e,Ac)},e.prototype.add=function(e){var t=Kc();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=Kc();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=Kc();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=Kc();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=Kc();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=Kc(),n=Kc();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,i,r=e.bitLength(),s=iu(1);if(r<=0)return s;n=r<18?1:r<48?3:r<144?4:r<768?5:6,i=r<8?new Qc(t):t.isEven()?new Zc(t):new Xc(t);var o=[],a=3,l=n-1,c=(1<<n)-1;if(o[1]=i.convert(this),n>1){var u=Kc();for(i.sqrTo(o[1],u);a<=c;)o[a]=Kc(),i.mulTo(u,o[a-2],o[a]),a+=2}var h,d,f=e.t-1,p=!0,g=Kc();for(r=ru(e[f])-1;f>=0;){for(r>=l?h=e[f]>>r-l&c:(h=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(h|=e[f-1]>>this.DB+r-l)),a=n;0==(1&h);)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[h].copyTo(s),p=!1;else{for(;a>1;)i.sqrTo(s,g),i.sqrTo(g,s),a-=2;a>0?i.sqrTo(s,g):(d=s,s=g,g=d),i.mulTo(g,o[h],s)}for(;f>=0&&0==(e[f]&1<<r);)i.sqrTo(s,g),d=s,s=g,g=d,--r<0&&(r=this.DB-1,--f)}return i.revert(s)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var i=t.clone(),r=this.clone(),s=iu(1),o=iu(0),a=iu(0),l=iu(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),n?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(t,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);i.compareTo(r)>=0?(i.subTo(r,i),n&&s.subTo(a,s),o.subTo(l,o)):(r.subTo(i,r),n&&a.subTo(s,a),l.subTo(o,l))}return 0!=r.compareTo(e.ONE)?e.ZERO:l.compareTo(t)>=0?l.subtract(t):l.signum()<0?(l.addTo(t,l),l.signum()<0?l.add(t):l):l},e.prototype.pow=function(e){return this.exp(e,new Yc)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var i=t;t=n,n=i}var r=t.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)return t;for(r<s&&(s=r),s>0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return s>0&&n.lShiftTo(s,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=Hc[Hc.length-1]){for(t=0;t<Hc.length;++t)if(n[0]==Hc[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Hc.length;){for(var i=Hc[t],r=t+1;r<Hc.length&&i<Vc;)i*=Hc[r++];for(i=n.modInt(i);t<r;)if(i%Hc[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var i;if(16==n)i=4;else if(8==n)i=3;else if(256==n)i=8;else if(2==n)i=1;else if(32==n)i=5;else{if(4!=n)return void this.fromRadix(t,n);i=2}this.t=0,this.s=0;for(var r=t.length,s=!1,o=0;--r>=0;){var a=8==i?255&+t[r]:nu(t,r);a<0?"-"==t.charAt(r)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,i=this.DB-n,r=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM,a=this.t-1;a>=0;--a)t[a+s+1]=this[a]>>i|o,o=(this[a]&r)<<n;for(a=s-1;a>=0;--a)t[a]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var i=e%this.DB,r=this.DB-i,s=(1<<i)-1;t[0]=this[n]>>i;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&s)<<r,t[o-n]=this[o]>>i;i>0&&(t[this.t-n-1]|=(this.s&s)<<r),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var i=this.abs(),r=t.abs(),s=i.t;for(n.t=s+r.t;--s>=0;)n[s]=0;for(s=0;s<r.t;++s)n[s+i.t]=i.am(0,r[s],n,s,0,i.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,i){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=n&&n.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=Kc());var o=Kc(),a=this.s,l=t.s,c=this.DB-ru(r[r.t-1]);c>0?(r.lShiftTo(c,o),s.lShiftTo(c,i)):(r.copyTo(o),s.copyTo(i));var u=o.t,h=o[u-1];if(0!=h){var d=h*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,g=1<<this.F2,m=i.t,v=m-u,y=null==n?Kc():n;for(o.dlShiftTo(v,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),e.ONE.dlShiftTo(u,y),y.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--v>=0;){var w=i[--m]==h?this.DM:Math.floor(i[m]*f+(i[m-1]+g)*p);if((i[m]+=o.am(0,w,i,v,0,u))<w)for(o.dlShiftTo(v,y),i.subTo(y,i);i[m]<--w;)i.subTo(y,i)}null!=n&&(i.drShiftTo(u,n),a!=l&&e.ZERO.subTo(n,n)),i.t=u,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&e.ZERO.subTo(i,i)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var i=Kc(),r=Kc(),s=n.convert(this),o=ru(t)-1;for(s.copyTo(i);--o>=0;)if(n.sqrTo(i,r),(t&1<<o)>0)n.mulTo(r,s,i);else{var a=i;i=r,r=a}return n.revert(i)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),i=iu(n),r=Kc(),s=Kc(),o="";for(this.divRemTo(i,r,s);r.signum()>0;)o=(n+s.intValue()).toString(e).substr(1)+o,r.divRemTo(i,r,s);return s.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var i=this.chunkSize(n),r=Math.pow(n,i),s=!1,o=0,a=0,l=0;l<t.length;++l){var c=nu(t,l);c<0?"-"==t.charAt(l)&&0==this.signum()&&(s=!0):(a=n*a+c,++o>=i&&(this.dMultiply(r),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(a,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,i){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),bc,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var r=[],s=7&t;r.length=1+(t>>3),n.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},e.prototype.bitwiseTo=function(e,t,n){var i,r,s=Math.min(e.t,this.t);for(i=0;i<s;++i)n[i]=t(this[i],e[i]);if(e.t<this.t){for(r=e.s&this.DM,i=s;i<this.t;++i)n[i]=t(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=s;i<e.t;++i)n[i]=t(r,e[i]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var i=e.ONE.shiftLeft(t);return this.bitwiseTo(i,n,i),i},e.prototype.addTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(var r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,e[i],n,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e[i],n,i,0,t-i);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var i=n.t=this.t+e.t-t;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)n[this.t+i-t]=this.am(t-i,e[i],n,0,0,this.t+i-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var i=this.t-1;i>=0;--i)n=(t*n+this[i])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),i=n.getLowestSetBit();if(i<=0)return!1;var r=n.shiftRight(i);(t=t+1>>1)>Hc.length&&(t=Hc.length);for(var s=Kc(),o=0;o<t;++o){s.fromInt(Hc[Math.floor(Math.random()*Hc.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(n)){for(var l=1;l++<i&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=Kc();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(n.compareTo(i)<0){var r=n;n=i,i=r}var s=n.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)t(n);else{s<o&&(o=s),o>0&&(n.rShiftTo(o,n),i.rShiftTo(o,i));var a=function(){(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),n.compareTo(i)>=0?(n.subTo(i,n),n.rShiftTo(1,n)):(i.subTo(n,i),i.rShiftTo(1,i)),n.signum()>0?setTimeout(a,0):(o>0&&i.lShiftTo(o,i),setTimeout((function(){t(i)}),0))};setTimeout(a,10)}},e.prototype.fromNumberAsync=function(t,n,i,r){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),bc,this),this.isEven()&&this.dAddOffset(1,0);var s=this,o=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(e.ONE.shiftLeft(t-1),s),s.isProbablePrime(n)?setTimeout((function(){r()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var a=[],l=7&t;a.length=1+(t>>3),n.nextBytes(a),l>0?a[0]&=(1<<l)-1:a[0]=0,this.fromString(a,256)}},e}(),Yc=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Qc=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Xc=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=Kc();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Wc.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Kc();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Zc=function(){function e(e){this.m=e,this.r2=Kc(),this.q3=Kc(),Wc.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Kc();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function Kc(){return new Wc(null)}function qc(e,t){return new Wc(e,t)}var Jc="undefined"!=typeof navigator;Jc&&"Microsoft Internet Explorer"==navigator.appName?(Wc.prototype.am=function(e,t,n,i,r,s){for(var o=32767&t,a=t>>15;--s>=0;){var l=32767&this[e],c=this[e++]>>15,u=a*l+c*o;r=((l=o*l+((32767&u)<<15)+n[i]+(1073741823&r))>>>30)+(u>>>15)+a*c+(r>>>30),n[i++]=1073741823&l}return r},jc=30):Jc&&"Netscape"!=navigator.appName?(Wc.prototype.am=function(e,t,n,i,r,s){for(;--s>=0;){var o=t*this[e++]+n[i]+r;r=Math.floor(o/67108864),n[i++]=67108863&o}return r},jc=26):(Wc.prototype.am=function(e,t,n,i,r,s){for(var o=16383&t,a=t>>14;--s>=0;){var l=16383&this[e],c=this[e++]>>14,u=a*l+c*o;r=((l=o*l+((16383&u)<<14)+n[i]+r)>>28)+(u>>14)+a*c,n[i++]=268435455&l}return r},jc=28),Wc.prototype.DB=jc,Wc.prototype.DM=(1<<jc)-1,Wc.prototype.DV=1<<jc;Wc.prototype.FV=Math.pow(2,52),Wc.prototype.F1=52-jc,Wc.prototype.F2=2*jc-52;var $c,eu,tu=[];for($c="0".charCodeAt(0),eu=0;eu<=9;++eu)tu[$c++]=eu;for($c="a".charCodeAt(0),eu=10;eu<36;++eu)tu[$c++]=eu;for($c="A".charCodeAt(0),eu=10;eu<36;++eu)tu[$c++]=eu;function nu(e,t){var n=tu[e.charCodeAt(t)];return null==n?-1:n}function iu(e){var t=Kc();return t.fromInt(e),t}function ru(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}Wc.ZERO=iu(0),Wc.ONE=iu(1);var su=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,i;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,i=this.S[t],this.S[t]=this.S[n],this.S[n]=i;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var ou,au,lu=256,cu=null;if(null==cu){cu=[],au=0;var uu=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var hu=new Uint32Array(256);for(window.crypto.getRandomValues(hu),uu=0;uu<hu.length;++uu)cu[au++]=255&hu[uu]}var du=0,fu=function(e){if((du=du||0)>=256||au>=lu)window.removeEventListener?window.removeEventListener("mousemove",fu,!1):window.detachEvent&&window.detachEvent("onmousemove",fu);else try{var t=e.x+e.y;cu[au++]=255&t,du+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",fu,!1):window.attachEvent&&window.attachEvent("onmousemove",fu))}function pu(){if(null==ou){for(ou=new su;au<lu;){var e=Math.floor(65536*Math.random());cu[au++]=255&e}for(ou.init(cu),au=0;au<cu.length;++au)cu[au]=0;au=0}return ou.next()}var gu=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=pu()},e}();var mu=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],i=e.length-1;i>=0&&t>0;){var r=e.charCodeAt(i--);r<128?n[--t]=r:r>127&&r<2048?(n[--t]=63&r|128,n[--t]=r>>6|192):(n[--t]=63&r|128,n[--t]=r>>6&63|128,n[--t]=r>>12|224)}n[--t]=0;for(var s=new gu,o=[];t>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new Wc(n)}(e,t);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;for(var r=i.toString(16),s=r.length,o=0;o<2*t-s;o++)r="0"+r;return r},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16),this.d=qc(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,i,r,s,o,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16),this.d=qc(n,16),this.p=qc(i,16),this.q=qc(r,16),this.dmp1=qc(s,16),this.dmq1=qc(o,16),this.coeff=qc(a,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new gu,i=e>>1;this.e=parseInt(t,16);for(var r=new Wc(t,16);;){for(;this.p=new Wc(e-i,1,n),0!=this.p.subtract(Wc.ONE).gcd(r).compareTo(Wc.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Wc(i,1,n),0!=this.q.subtract(Wc.ONE).gcd(r).compareTo(Wc.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(Wc.ONE),a=this.q.subtract(Wc.ONE),l=o.multiply(a);if(0==l.gcd(r).compareTo(Wc.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(l),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=qc(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),i=0;for(;i<n.length&&0==n[i];)++i;if(n.length-i!=t-1||2!=n[i])return null;++i;for(;0!=n[i];)if(++i>=n.length)return null;var r="";for(;++i<n.length;){var s=255&n[i];s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((31&s)<<6|63&n[i+1]),++i):(r+=String.fromCharCode((15&s)<<12|(63&n[i+1])<<6|63&n[i+2]),i+=2)}return r}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var i=new gu,r=e>>1;this.e=parseInt(t,16);var s=new Wc(t,16),o=this,a=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(Wc.ONE),i=o.q.subtract(Wc.ONE),r=t.multiply(i);0==r.gcd(s).compareTo(Wc.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(r),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(i),o.coeff=o.q.modInverse(o.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},l=function(){o.q=Kc(),o.q.fromNumberAsync(r,1,i,(function(){o.q.subtract(Wc.ONE).gcda(s,(function(e){0==e.compareTo(Wc.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(l,0)}))}))},c=function(){o.p=Kc(),o.p.fromNumberAsync(e-r,1,i,(function(){o.p.subtract(Wc.ONE).gcda(s,(function(e){0==e.compareTo(Wc.ONE)&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},e.prototype.sign=function(e,t,n){var i=function(e){return vu[e]||""}(n),r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,i="",r=0;r<n;r+=2)i+="ff";return qc("0001"+i+"00"+e,16)}(i+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var s=this.doPrivate(r);if(null==s)return null;var o=s.toString(16);return 0==(1&o.length)?o:"0"+o},e.prototype.verify=function(e,t,n){var i=qc(t,16),r=this.doPublic(i);return null==r?null:function(e){for(var t in vu)if(vu.hasOwnProperty(t)){var n=vu[t],i=n.length;if(e.substr(0,i)==n)return e.substr(i)}return e}
7
+ */var Oo="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Ro="",_o="srgb",ko="srgb-linear",Lo=Number(V.replace(/\D+/g,""))>=152,No=new Map([[ve,ko],[ye,_o]]),Uo=new Map([[ko,ve],[_o,ye]]);function jo(e){return null===e?null:Lo?e.outputColorSpace:No.get(e.outputEncoding)}function Fo(e,t){null!==e&&(Lo?e.colorSpace=t:e.encoding=Uo.get(t))}function zo(e,t,n){return e*(t-n)-t}function Go(e,t,n){return Math.min(Math.max((e+t)/(t-n),0),1)}var Ho=0,Vo=1,Wo=2,Yo=3,Qo=4,Xo=5,Zo=6,Ko=7,qo=8,Jo=9,$o=10,ea=11,ta=12,na=13,ia=14,ra=15,sa=16,oa=17,aa=18,la=19,ca=20,ua=21,ha=22,da=23,fa=24,pa=25,ga=26,ma=27,va=28,ya=29,wa=30,ba=31,Aa=32,xa=2,Sa={NONE:0,DEPTH:1,CONVOLUTION:2},Ta={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Ea=0,Da=2,Ca=3,Ia=0,Ba=0,Ma=1,Pa=2,Oa=3,Ra=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],_a=class extends oe{constructor(e=new we){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new we),scale:new te(1),kernel:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.setTexelSize(e.x,e.y),this.kernelSize=Da}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return Ra[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){const n=1/e,i=1/t;this.uniforms.texelSize.value.set(n,i,.5*n,.5*i)}},ka=class extends oe{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new te(null),opacity:new te(1)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <encodings_fragment>\n#include <dithering_fragment>\n}",vertexShader:Oo})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},La=class extends oe{constructor(e=null,t){super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),cameraNear:new te(.3),cameraFar:new te(1e3)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;varying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.depthBuffer=e,this.depthPacking=le,this.copyCameraSettings(t)}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=le){this.depthBuffer=e,this.depthPacking=t}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},Na=class extends oe{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),normalBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\n#ifdef DOWNSAMPLE_NORMALS\nuniform lowp sampler2D normalBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[]=float[4](abs(c-samples[0]),abs(c-samples[1]),abs(c-samples[2]),abs(c-samples[3]));float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[]=float[4](readDepth(vUv0),readDepth(vUv1),readDepth(vUv2),readDepth(vUv3));int index=findBestDepth(d);\n#ifdef DOWNSAMPLE_NORMALS\nvec3 n[]=vec3[4](texture2D(normalBuffer,vUv0).rgb,texture2D(normalBuffer,vUv1).rgb,texture2D(normalBuffer,vUv2).rgb,texture2D(normalBuffer,vUv3).rgb);\n#else\nvec3 n[]=vec3[4](vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));\n#endif\ngl_FragColor=vec4(n[index],d[index]);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"})}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ua=class extends oe{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},ja=class extends oe{constructor(e=new h,t=xa){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new te(null),depthBuffer:new te(null),predicationBuffer:new te(null),texelSize:new te(e)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include <common>\n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Fa=class extends oe{constructor(e,t,n,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new te(null),depthBuffer:new te(null),resolution:new te(new h),texelSize:new te(new h),cameraNear:new te(.3),cameraFar:new te(1e3),aspect:new te(1),time:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE gl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <encodings_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(Ta.FRAGMENT_HEAD,e.get(Ta.FRAGMENT_HEAD)||"").replace(Ta.FRAGMENT_MAIN_UV,e.get(Ta.FRAGMENT_MAIN_UV)||"").replace(Ta.FRAGMENT_MAIN_IMAGE,e.get(Ta.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(Ta.VERTEX_HEAD,e.get(Ta.VERTEX_HEAD)||"").replace(Ta.VERTEX_MAIN_SUPPORT,e.get(Ta.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(const t of e)this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return Ta}},za=class extends oe{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:V.replace(/\D+/g,"")},uniforms:{inputBuffer:new te(null),threshold:new te(0),smoothing:new te(1),range:new te(null)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:Oo}),this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},Ga=class extends oe{constructor(e=new h){super({name:"OutlineMaterial",uniforms:{inputBuffer:new te(null),texelSize:new te(new h)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.uniforms.texelSize.value.set(e.x,e.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ha=class extends oe{constructor(e=new h,t=new h){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new te(null),searchTexture:new te(null),areaTexture:new te(null),resolution:new te(t),texelSize:new te(e)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){const t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){const t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){const t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){const n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.resolution.value.set(e,t)}},Va=class extends oe{constructor(e){super({name:"SSAOMaterial",defines:{SAMPLES_INT:"0",INV_SAMPLES_FLOAT:"0.0",SPIRAL_TURNS:"0.0",RADIUS:"1.0",RADIUS_SQ:"1.0",DISTANCE_SCALING:"1",DEPTH_PACKING:"0"},uniforms:{depthBuffer:new te(null),normalBuffer:new te(null),normalDepthBuffer:new te(null),noiseTexture:new te(null),inverseProjectionMatrix:new te(new d),projectionMatrix:new te(new d),texelSize:new te(new h),cameraNearFar:new te(new h),distanceCutoff:new te(new h),proximityCutoff:new te(new h),noiseScale:new te(new h),minRadiusScale:new te(.33),intensity:new te(1),fade:new te(.01),bias:new te(0)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){return texture2D(normalDepthBuffer,uv).a;}\n#else\nuniform lowp sampler2D normalBuffer;\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\nuniform lowp sampler2D noiseTexture;uniform mat4 inverseProjectionMatrix;uniform mat4 projectionMatrix;uniform vec2 texelSize;uniform vec2 cameraNearFar;uniform float intensity;uniform float minRadiusScale;uniform float fade;uniform float bias;uniform vec2 distanceCutoff;uniform vec2 proximityCutoff;varying vec2 vUv;varying vec2 vUv2;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}vec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}float getAmbientOcclusion(const in vec3 p,const in vec3 n,const in float depth,const in vec2 uv){float radiusScale=1.0-smoothstep(0.0,distanceCutoff.y,depth);radiusScale=radiusScale*(1.0-minRadiusScale)+minRadiusScale;float radius=RADIUS*radiusScale;float noise=texture2D(noiseTexture,vUv2).r;float baseAngle=noise*PI2;float rings=SPIRAL_TURNS*PI2;float occlusion=0.0;int taps=0;for(int i=0;i<SAMPLES_INT;++i){float alpha=(float(i)+0.5)*INV_SAMPLES_FLOAT;float angle=alpha*rings+baseAngle;vec2 rotation=vec2(cos(angle),sin(angle));vec2 coords=alpha*radius*rotation*texelSize+uv;if(coords.s<0.0||coords.s>1.0||coords.t<0.0||coords.t>1.0){continue;}float sampleDepth=readDepth(coords);float viewZ=getViewZ(sampleDepth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearSampleDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearSampleDepth=sampleDepth;\n#endif\nfloat proximity=abs(depth-linearSampleDepth);if(proximity<proximityCutoff.y){float falloff=1.0-smoothstep(proximityCutoff.x,proximityCutoff.y,proximity);vec3 Q=getViewPosition(coords,sampleDepth,viewZ);vec3 v=Q-p;float vv=dot(v,v);float vn=dot(v,n)-bias;float f=max(RADIUS_SQ-vv,0.0)/RADIUS_SQ;occlusion+=(f*f*f*max(vn/(fade+vv),0.0))*falloff;}++taps;}return occlusion/(4.0*max(float(taps),1.0));}void main(){\n#ifdef NORMAL_DEPTH\nvec4 normalDepth=texture2D(normalDepthBuffer,vUv);\n#else\nvec4 normalDepth=vec4(texture2D(normalBuffer,vUv).xyz,readDepth(vUv));\n#endif\nfloat ao=0.0;float depth=normalDepth.a;float viewZ=getViewZ(depth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearDepth=depth;\n#endif\nif(linearDepth<distanceCutoff.y){vec3 viewPosition=getViewPosition(vUv,depth,viewZ);vec3 viewNormal=unpackRGBToNormal(normalDepth.rgb);ao+=getAmbientOcclusion(viewPosition,viewNormal,linearDepth,vUv);float d=smoothstep(distanceCutoff.x,distanceCutoff.y,linearDepth);ao=mix(ao,0.0,d);\n#ifdef LEGACY_INTENSITY\nao=clamp(1.0-pow(1.0-ao,abs(intensity)),0.0,1.0);\n#endif\n}gl_FragColor.r=ao;}",vertexShader:"uniform vec2 noiseScale;varying vec2 vUv;varying vec2 vUv2;void main(){vUv=position.xy*0.5+0.5;vUv2=vUv*noiseScale;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.copyCameraSettings(e),this.resolution=new h,this.r=1}get near(){return this.uniforms.cameraNearFar.value.x}get far(){return this.uniforms.cameraNearFar.value.y}set normalDepthBuffer(e){this.uniforms.normalDepthBuffer.value=e,null!==e?this.defines.NORMAL_DEPTH="1":delete this.defines.NORMAL_DEPTH,this.needsUpdate=!0}setNormalDepthBuffer(e){this.normalDepthBuffer=e}set normalBuffer(e){this.uniforms.normalBuffer.value=e}setNormalBuffer(e){this.uniforms.normalBuffer.value=e}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=Y){this.depthBuffer=e,this.depthPacking=t}set noiseTexture(e){this.uniforms.noiseTexture.value=e}setNoiseTexture(e){this.uniforms.noiseTexture.value=e}get samples(){return Number(this.defines.SAMPLES_INT)}set samples(e){this.defines.SAMPLES_INT=e.toFixed(0),this.defines.INV_SAMPLES_FLOAT=(1/e).toFixed(9),this.needsUpdate=!0}getSamples(){return this.samples}setSamples(e){this.samples=e}get rings(){return Number(this.defines.SPIRAL_TURNS)}set rings(e){this.defines.SPIRAL_TURNS=e.toFixed(1),this.needsUpdate=!0}getRings(){return this.rings}setRings(e){this.rings=e}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e,void 0===this.defines.LEGACY_INTENSITY&&(this.defines.LEGACY_INTENSITY="1",this.needsUpdate=!0)}getIntensity(){return this.uniforms.intensity.value}setIntensity(e){this.uniforms.intensity.value=e}get fade(){return this.uniforms.fade.value}set fade(e){this.uniforms.fade.value=e}getFade(){return this.uniforms.fade.value}setFade(e){this.uniforms.fade.value=e}get bias(){return this.uniforms.bias.value}set bias(e){this.uniforms.bias.value=e}getBias(){return this.uniforms.bias.value}setBias(e){this.uniforms.bias.value=e}get minRadiusScale(){return this.uniforms.minRadiusScale.value}set minRadiusScale(e){this.uniforms.minRadiusScale.value=e}getMinRadiusScale(){return this.uniforms.minRadiusScale.value}setMinRadiusScale(e){this.uniforms.minRadiusScale.value=e}updateRadius(){const e=this.r*this.resolution.height;this.defines.RADIUS=e.toFixed(11),this.defines.RADIUS_SQ=(e*e).toFixed(11),this.needsUpdate=!0}get radius(){return this.r}set radius(e){this.r=Math.min(Math.max(e,1e-6),1),this.updateRadius()}getRadius(){return this.radius}setRadius(e){this.radius=e}get distanceScaling(){return!0}set distanceScaling(e){}isDistanceScalingEnabled(){return this.distanceScaling}setDistanceScalingEnabled(e){this.distanceScaling=e}get distanceThreshold(){return this.uniforms.distanceCutoff.value.x}set distanceThreshold(e){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.distanceFalloff,0),1))}get worldDistanceThreshold(){return-zo(this.distanceThreshold,this.near,this.far)}set worldDistanceThreshold(e){this.distanceThreshold=Go(-e,this.near,this.far)}get distanceFalloff(){return this.uniforms.distanceCutoff.value.y-this.distanceThreshold}set distanceFalloff(e){this.uniforms.distanceCutoff.value.y=Math.min(Math.max(this.distanceThreshold+e,0),1)}get worldDistanceFalloff(){return-zo(this.distanceFalloff,this.near,this.far)}set worldDistanceFalloff(e){this.distanceFalloff=Go(-e,this.near,this.far)}setDistanceCutoff(e,t){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}get proximityThreshold(){return this.uniforms.proximityCutoff.value.x}set proximityThreshold(e){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.proximityFalloff,0),1))}get worldProximityThreshold(){return-zo(this.proximityThreshold,this.near,this.far)}set worldProximityThreshold(e){this.proximityThreshold=Go(-e,this.near,this.far)}get proximityFalloff(){return this.uniforms.proximityCutoff.value.y-this.proximityThreshold}set proximityFalloff(e){this.uniforms.proximityCutoff.value.y=Math.min(Math.max(this.proximityThreshold+e,0),1)}get worldProximityFalloff(){return-zo(this.proximityFalloff,this.near,this.far)}set worldProximityFalloff(e){this.proximityFalloff=Go(-e,this.near,this.far)}setProximityCutoff(e,t){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),this.uniforms.projectionMatrix.value.copy(e.projectionMatrix),this.uniforms.inverseProjectionMatrix.value.copy(e.projectionMatrix).invert(),e instanceof j?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms,i=n.noiseTexture.value;null!==i&&n.noiseScale.value.set(e/i.image.width,t/i.image.height),n.texelSize.value.set(1/e,1/t),this.resolution.set(e,t),this.updateRadius()}},Wa=class extends oe{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new te(null),supportBuffer:new te(null),texelSize:new te(new h),radius:new te(.85)},blending:ae,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Ya=new W,Qa=null;var Xa=class{constructor(e="Pass",t=new R,n=Ya){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:(t=new k(function(){if(null===Qa){const e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(Qa=new p).setAttribute?(Qa.setAttribute("position",new f(e,3)),Qa.setAttribute("uv",new f(t,2))):(Qa.addAttribute("position",new f(e,3)),Qa.addAttribute("uv",new f(t,2)))}return Qa}(),e),t.frustumCulled=!1,null===this.scene&&(this.scene=new R),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=Y){}render(e,t,n,i,r){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof Z||t instanceof be||t instanceof u||t instanceof Xa)&&this[e].dispose()}}},Za=class extends Xa{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new ka,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new Z(1,1,{minFilter:re,magFilter:re,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==Q?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":jo(e)===_o&&Fo(this.renderTarget.texture,_o))}},Ka=class extends Xa{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,i,r){const s=e.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},qa=new c,Ja=class extends Xa{constructor(e=!0,t=!0,n=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,i,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=e.getClearAlpha(),l=null!==s,c=o>=0;l?(e.getClearColor(qa),e.setClearColor(s,c?o:a)):c&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(qa,a):c&&e.setClearAlpha(a)}},$a=-1,el=class extends ce{constructor(e,t=-1,n=-1,i=1){super(),this.resizable=e,this.baseSize=new h(1,1),this.preferredSize=new h(t,n),this.target=this.preferredSize,this.s=i,this.effectiveSize=new h,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,i=this.scale;t.width!==$a?n.width=t.width:t.height!==$a?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*i),t.height!==$a?n.height=t.height:t.width!==$a?n.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar($a),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){this.baseSize.width===e&&this.baseSize.height===t||(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){this.preferredSize.width===e&&this.preferredSize.height===t||(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return $a}},tl=!1,nl=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case he:t=this.materialsFlatShadedDoubleSide;break;case ue:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case he:t=this.materialsDoubleSide;break;case ue:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof oe))return e.clone();const t=e.uniforms,n=new Map;for(const e in t){const i=t[e].value;i.isRenderTargetTexture&&(t[e].value=null,n.set(e,i))}const i=e.clone();for(const e of n)t[e[0]].value=e[1],i.uniforms[e[0]].value=e[1];return i}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){const t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(const n of t)n.uniforms=Object.assign({},e.uniforms),n.side=de;t[2].skinning=!0,this.materialsBackSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=ue,n})),this.materialsDoubleSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=he,n})),this.materialsFlatShaded=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n})),this.materialsFlatShadedBackSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=ue,n})),this.materialsFlatShadedDoubleSide=t.map((t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=he,n}))}}render(e,t,n){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,tl){const i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n);for(const e of i)e[0].material=e[1];this.meshCount!==i.size&&i.clear()}else{const i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return tl}static set workaroundEnabled(e){tl=e}},il=class extends Xa{constructor(e,t,n=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new Ja,this.overrideMaterialManager=null===n?null:new nl(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new nl(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,u=e.shadowMap.autoUpdate,h=this.renderToScreen?null:t;null!==a&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(h),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,o):e.render(s,o),o.layers.mask=l,s.background=c,e.shadowMap.autoUpdate=u}},rl=class extends Xa{constructor(e,t,{renderTarget:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new il(e,t,new fe({depthPacking:le}));const l=this.renderPass;l.skipShadowMapUpdate=!0,l.ignoreBackground=!0;const u=l.getClearPass();u.overrideClearColor=new c(16777215),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K}),this.renderTarget.texture.name="DepthPass.Target");const h=this.resolution=new el(this,o,a,i);h.addEventListener("change",(e=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},sl=class extends Xa{constructor({normalBuffer:e=null,resolutionScale:t=.5,width:n=el.AUTO_SIZE,height:i=el.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}={}){super("DepthDownsamplingPass");const o=new Na;o.normalBuffer=e,this.fullscreenMaterial=o,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K,depthBuffer:!1,type:pe}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const a=this.resolution=new el(this,r,s,t);a.addEventListener("change",(e=>this.setSize(a.baseWidth,a.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(e,t=Y){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,i,r){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){const i=e.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}};function ol(e,t,n){for(const i of t){const t="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),r=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(r,t))}}function al(e,t,n){let i=t.getFragmentShader(),r=t.getVertexShader();const s=void 0!==i&&/mainImage/.test(i),o=void 0!==i&&/mainUv/.test(i);if(n.attributes|=t.getAttributes(),void 0===i)throw new Error(`Missing fragment shader (${t.name})`);if(o&&0!=(n.attributes&Sa.CONVOLUTION))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(!s&&!o)throw new Error(`Could not find mainImage or mainUv function (${t.name})`);{const a=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=n.shaderParts;let c=l.get(Ta.FRAGMENT_HEAD)||"",u=l.get(Ta.FRAGMENT_MAIN_UV)||"",h=l.get(Ta.FRAGMENT_MAIN_IMAGE)||"",d=l.get(Ta.VERTEX_HEAD)||"",f=l.get(Ta.VERTEX_MAIN_SUPPORT)||"";const p=new Set,g=new Set;if(o&&(u+=`\t${e}MainUv(UV);\n`,n.uvTransformation=!0),null!==r&&/mainSupport/.test(r)){const t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);f+=`\t${e}MainSupport(`,f+=t?"vUv);\n":");\n";for(const e of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const t of e[1].split(/\s*,\s*/))n.varyings.add(t),p.add(t),g.add(t);for(const e of r.matchAll(a))g.add(e[1])}for(const e of i.matchAll(a))g.add(e[1]);for(const e of t.defines.keys())g.add(e.replace(/\([\w\s,]*\)/g,""));for(const e of t.uniforms.keys())g.add(e);g.delete("while"),g.delete("for"),g.delete("if"),t.uniforms.forEach(((t,i)=>n.uniforms.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),t.defines.forEach(((t,i)=>n.defines.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)));const m=new Map([["fragment",i],["vertex",r]]);ol(e,g,n.defines),ol(e,g,m),i=m.get("fragment"),r=m.get("vertex");const v=t.blendMode;if(n.blendModes.set(v.blendFunction,v),s){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(h+=t.inputColorSpace===_o?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),t.outputColorSpace!==Ro?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace);const r=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;h+=`${e}MainImage(color0, UV, `,0!=(n.attributes&Sa.DEPTH)&&r.test(i)&&(h+="depth, ",n.readDepth=!0),h+="color1);\n\t";const s=e+"BlendOpacity";n.uniforms.set(s,v.opacity),h+=`color0 = blend${v.blendFunction}(color0, color1, ${s});\n\n\t`,c+=`uniform float ${s};\n\n`}if(c+=i+"\n",null!==r&&(d+=r+"\n"),l.set(Ta.FRAGMENT_HEAD,c),l.set(Ta.FRAGMENT_MAIN_UV,u),l.set(Ta.FRAGMENT_MAIN_IMAGE,h),l.set(Ta.VERTEX_HEAD,d),l.set(Ta.VERTEX_MAIN_SUPPORT,f),null!==t.extensions)for(const e of t.extensions)n.extensions.add(e)}}var ll=class extends Xa{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new Fa(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[],this.setEffects(t),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(e){for(const t of this.effects)t.mainScene=e}set mainCamera(e){this.fullscreenMaterial.copyCameraSettings(e);for(const t of this.effects)t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){const t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=e.sort(((e,t)=>t.attributes-e.attributes));for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const e=new ml;let t=0;for(const n of this.effects)if(n.blendMode.blendFunction===Jo)e.attributes|=n.getAttributes()&Sa.DEPTH;else{if(0!=(e.attributes&n.getAttributes()&Sa.CONVOLUTION))throw new Error(`Convolution effects cannot be merged (${n.name})`);al("e"+t++,n,e)}let n=e.shaderParts.get(Ta.FRAGMENT_HEAD),i=e.shaderParts.get(Ta.FRAGMENT_MAIN_IMAGE),r=e.shaderParts.get(Ta.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const t of e.blendModes.values())n+=t.getShaderCode().replace(s,`blend${t.blendFunction}`)+"\n";0!=(e.attributes&Sa.DEPTH)?(e.readDepth&&(i="float depth = readDepth(UV);\n\n\t"+i),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===_o&&(i+="color0 = sRGBToLinear(color0);\n\t"),e.uvTransformation?(r="vec2 transformedUv = vUv;\n"+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(Ta.FRAGMENT_HEAD,n),e.shaderParts.set(Ta.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(Ta.FRAGMENT_MAIN_UV,r);for(const[t,n]of e.shaderParts)null!==n&&e.shaderParts.set(t,n.trim().replace(/^#/,"\n#"));this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=Y){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const n of this.effects)n.setDepthTexture(e,t)}render(e,t,n,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const r=this.fullscreenMaterial;r.inputBuffer=t.texture,r.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const n of this.effects)n.setSize(e,t)}initialize(e,t,n){this.renderer=e;for(const i of this.effects)i.initialize(e,t,n);this.updateMaterial(),void 0!==n&&n!==Q&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){if("change"===e.type)this.recompile()}},cl=class extends Xa{constructor({kernelSize:e=Da,resolutionScale:t=.5,width:n=el.AUTO_SIZE,height:i=el.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}={}){super("KawaseBlurPass"),this.renderTargetA=new Z(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new el(this,r,s,t);o.addEventListener("change",(e=>this.setSize(o.baseWidth,o.baseHeight))),this._blurMaterial=new _a,this._blurMaterial.kernelSize=e,this.copyMaterial=new ka}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,u=c.kernelSequence;let h=t;this.fullscreenMaterial=c;for(let t=0,n=u.length;t<n;++t){const n=0==(1&t)?a:l;c.kernel=u[t],c.inputBuffer=h.texture,e.setRenderTarget(n),e.render(s,o),h=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=h.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(s,o)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.renderTargetA.setSize(i,r),this.renderTargetB.setSize(i,r),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,n!==Q?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):jo(e)===_o&&(Fo(this.renderTargetA.texture,_o),Fo(this.renderTargetB.texture,_o)))}static get AUTO_SIZE(){return el.AUTO_SIZE}},ul=class extends Xa{constructor({renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("LuminancePass"),this.fullscreenMaterial=new za(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new el(this,o,a,i);l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&n!==Q&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},hl=class extends Xa{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new Ja(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,i,r){const s=e.getContext(),o=e.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?0:1,h=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,n))),this.renderToScreen?(e.setRenderTarget(null),e.render(a,l)):(e.setRenderTarget(t),e.render(a,l),e.setRenderTarget(n),e.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},dl=class extends Xa{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new Ua,this.upsamplingMaterial=new Wa,this.resolution=new h}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){const t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){const e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,i=e-1;n<i;++n){const e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,i,r){const{scene:s,camera:o}=this,{downsamplingMaterial:a,upsamplingMaterial:l}=this,{downsamplingMipmaps:c,upsamplingMipmaps:u}=this;let h=t;this.fullscreenMaterial=a;for(let t=0,n=c.length;t<n;++t){const n=c[t];a.setSize(h.width,h.height),a.inputBuffer=h.texture,e.setRenderTarget(n),e.render(s,o),h=n}this.fullscreenMaterial=l;for(let t=u.length-1;t>=0;--t){const n=u[t];l.setSize(h.width,h.height),l.inputBuffer=h.texture,l.supportBuffer=c[t].texture,e.setRenderTarget(n),e.render(s,o),h=n}}setSize(e,t){const n=this.resolution;n.set(e,t);let i=n.width,r=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)i=Math.round(.5*i),r=Math.round(.5*r),this.downsamplingMipmaps[e].setSize(i,r),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(i,r)}initialize(e,t,n){if(void 0!==n){const t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const e of t)e.texture.type=n;if(n!==Q)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(jo(e)===_o)for(const e of t)Fo(e.texture,_o)}}dispose(){super.dispose();for(const e of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))e.dispose()}},fl=class extends Xa{constructor(e,t,{renderTarget:n,resolutionScale:i=1,width:r=el.AUTO_SIZE,height:s=el.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new il(e,t,new X);const l=this.renderPass;l.ignoreBackground=!0,l.skipShadowMapUpdate=!0;const u=l.getClearPass();u.overrideClearColor=new c(7829503),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new Z(1,1,{minFilter:K,magFilter:K}),this.renderTarget.texture.name="NormalPass.Target");const h=this.resolution=new el(this,o,a,i);h.addEventListener("change",(e=>this.setSize(h.baseWidth,h.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},pl=class extends Xa{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.input=t}setInput(e){this.input=e}render(e,t,n,i,r){const s=this.fullscreenMaterial.uniforms;null!==t&&void 0!==s&&void 0!==s[this.input]&&(s[this.input].value=t.texture),e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}initialize(e,t,n){void 0!==n&&n!==Q&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},gl=.001,ml=class{constructor(){this.shaderParts=new Map([[Ta.FRAGMENT_HEAD,null],[Ta.FRAGMENT_MAIN_UV,null],[Ta.FRAGMENT_MAIN_IMAGE,null],[Ta.VERTEX_HEAD,null],[Ta.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Sa.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ko}},vl=class extends Set{constructor(e,t=10){super(),this.l=t,this.exclusive=!1,void 0!==e&&this.set(e)}get layer(){return this.l}set layer(e){const t=this.l;for(const n of this)n.layers.disable(t),n.layers.enable(e);this.l=e}getLayer(){return this.layer}setLayer(e){this.layer=e}isExclusive(){return this.exclusive}setExclusive(e){this.exclusive=e}clear(){const e=this.layer;for(const t of this)t.layers.disable(e);return super.clear()}set(e){this.clear();for(const t of e)this.add(t);return this}indexOf(e){return this.has(e)?0:-1}add(e){return this.exclusive?e.layers.set(this.layer):e.layers.enable(this.layer),super.add(e)}delete(e){return this.has(e)&&e.layers.disable(this.layer),super.delete(e)}toggle(e){let t;return this.has(e)?(this.delete(e),t=!1):(this.add(e),t=!0),t}setVisible(e){for(const t of this)e?t.layers.enable(0):t.layers.disable(0);return this}},yl=new Map([[Ho,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[Vo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[Wo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[Yo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[Xo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[Zo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[Ko,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[qo,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[Jo,null],[$o,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[ea,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[ta,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[na,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[ia,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[ra,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[sa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[oa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[aa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[la,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[ca,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[ua,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[ha,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[da,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[fa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[pa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[ga,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[ma,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[va,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[ya,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[wa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[ba,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[Aa,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),wl=class extends ce{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new te(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return yl.get(this.blendFunction)}},bl=class extends ce{constructor(e,t,{attributes:n=Sa.NONE,blendFunction:i=da,defines:r=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=a,this.defines=r,this.uniforms=s,this.extensions=o,this.blendMode=new wl(i),this.blendMode.addEventListener("change",(e=>this.setChanged())),this._inputColorSpace=ko,this._outputColorSpace=Ro}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=Y){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof Z||t instanceof be||t instanceof u||t instanceof Xa)&&this[e].dispose()}}},Al=class extends bl{constructor({blendFunction:e=va,luminanceThreshold:t=.9,luminanceSmoothing:n=.025,mipmapBlur:i=!1,intensity:r=1,radius:s=.85,levels:o=8,kernelSize:a=Ca,resolutionScale:l=.5,width:c=el.AUTO_SIZE,height:u=el.AUTO_SIZE,resolutionX:h=c,resolutionY:d=u}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}",{blendFunction:e,uniforms:new Map([["map",new te(null)],["intensity",new te(r)]])}),this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new cl({kernelSize:a}),this.luminancePass=new ul({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new dl,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const f=this.resolution=new el(this,h,d,l);f.addEventListener("change",(e=>this.setSize(f.baseWidth,f.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){const i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,r.renderTarget):this.blurPass.render(e,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,jo(e)===_o&&Fo(this.renderTarget.texture,_o))}};var xl=class extends ge{constructor(e,t,n=me,i=Q){super(function(e,t,n){const i=new Map([[me,1],[Ae,1],[xe,2],[se,4]]);let r;if(i.has(t)||console.error("Invalid noise texture format"),n===Q){r=new Uint8Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=255*Math.random()+.5}else{r=new Float32Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=Math.random()}return r}(e*t,n,i),e,t,n,i),this.needsUpdate=!0}};new t,new d,new c;var Sl=class extends bl{constructor(e,t,{blendFunction:n=va,patternTexture:i=null,patternScale:r=1,edgeStrength:s=1,pulseSpeed:o=0,visibleEdgeColor:a=16777215,hiddenEdgeColor:l=2230538,kernelSize:u=Ea,blur:h=!1,xRay:d=!0,multisampling:f=0,resolutionScale:p=.5,width:g=el.AUTO_SIZE,height:m=el.AUTO_SIZE,resolutionX:v=g,resolutionY:y=m}={}){super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texture2D(patternTexture,vUvPattern);\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new te(null)],["edgeTexture",new te(null)],["edgeStrength",new te(s)],["visibleEdgeColor",new te(new c(a))],["hiddenEdgeColor",new te(new c(l))],["pulse",new te(1)],["patternScale",new te(r)],["patternTexture",new te(null)]])}),this.blendMode.addEventListener("change",(e=>{this.blendMode.blendFunction===Vo?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.blendFunction=n,this.patternTexture=i,this.xRay=d,this.scene=e,this.camera=t,this.renderTargetMask=new Z(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new Z(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new Ja,this.clearPass.overrideClearColor=new c(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new rl(e,t),this.maskPass=new il(e,t,new La(this.depthPass.texture,t));const w=this.maskPass.clearPass;w.overrideClearColor=new c(16777215),w.overrideClearAlpha=1,this.blurPass=new cl({resolutionScale:p,resolutionX:v,resolutionY:y,kernelSize:u}),this.blurPass.enabled=h;const b=this.blurPass.resolution;b.addEventListener("change",(e=>this.setSize(b.baseWidth,b.baseHeight))),this.outlinePass=new pl(new Ga);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.active=!1,this.selection=new vl,this.selection.layer=10,this.pulseSpeed=o}set mainScene(e){this.scene=e,this.depthPass.mainScene=e,this.maskPass.mainScene=e}set mainCamera(e){this.camera=e,this.depthPass.mainCamera=e,this.maskPass.mainCamera=e,this.maskPass.overrideMaterial.copyCameraSettings(e)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(e){this.renderTargetMask.samples=e,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(e){this.uniforms.get("patternScale").value=e}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(e){this.uniforms.get("edgeStrength").value=e}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(e){this.uniforms.get("visibleEdgeColor").value=e}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(e){this.uniforms.get("hiddenEdgeColor").value=e}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(e){this.pulseSpeed=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get selectionLayer(){return this.selection.layer}set selectionLayer(e){this.selection.layer=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get blur(){return this.blurPass.enabled}set blur(e){this.blurPass.enabled=e}get xRay(){return this.defines.has("X_RAY")}set xRay(e){this.xRay!==e&&(e?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(e){this.xRay=e}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(e){null!==e?(e.wrapS=e.wrapT=ne,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),this.uniforms.get("patternTexture").value=e,this.setChanged()}setPatternTexture(e){this.patternTexture=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}setSelection(e){return this.selection.set(e),this}clearSelection(){return this.selection.clear(),this}selectObject(e){return this.selection.add(e),this}deselectObject(e){return this.selection.delete(e),this}update(e,t,n){const i=this.scene,r=this.camera,s=this.selection,o=this.uniforms.get("pulse"),a=i.background,l=r.layers.mask;s.size>0?(i.background=null,o.value=1,this.pulseSpeed>0&&(o.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.active=!0,this.time+=n,s.setVisible(!1),this.depthPass.render(e),s.setVisible(!0),r.layers.set(s.layer),this.maskPass.render(e,this.renderTargetMask),r.layers.mask=l,i.background=a,this.outlinePass.render(e,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(e,this.renderTargetOutline,this.renderTargetOutline)):this.active&&(this.clearPass.render(e,this.renderTargetOutline),this.active=!1)}setSize(e,t){this.blurPass.setSize(e,t),this.renderTargetMask.setSize(e,t);const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.depthPass.setSize(i,r),this.renderTargetOutline.setSize(i,r),this.outlinePass.fullscreenMaterial.setSize(i,r)}initialize(e,t,n){this.blurPass.initialize(e,t,Q),void 0!==n&&(this.depthPass.initialize(e,t,n),this.maskPass.initialize(e,t,n),this.outlinePass.initialize(e,t,n))}};new t,new t;var Tl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",El="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+DfAHzTxcVgWBroqMN8+cYBeM71wH0TwKExYHYUWCIAHYRLTlkCYgcIBcAgU/n3qy8GRu4HRgnAOWBkERhddPAJhGJDBxkvw7cqimr+zFM/ZLnZF64cgL8BYD+AWwB8x/dl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rfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",Dl=class extends bl{constructor({blendFunction:e=wa,preset:t=Ma,edgeDetectionMode:n=xa,predicationMode:i=Ia}={}){let r,s;super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:e,attributes:Sa.CONVOLUTION|Sa.DEPTH,uniforms:new Map([["weightMap",new te(null)]])}),arguments.length>1&&(r=arguments[0],s=arguments[1],arguments.length>2&&(t=arguments[2]),arguments.length>3&&(n=arguments[3])),this.renderTargetEdges=new Z(1,1,{depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new Ja(!0,!1,!1),this.clearPass.overrideClearColor=new c(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new pl(new ja),this.edgeDetectionMaterial.edgeDetectionMode=n,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new pl(new Ha);const o=new ie;o.onLoad=()=>{const e=new u(r);e.name="SMAA.Search",e.magFilter=K,e.minFilter=K,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!0,this.weightsMaterial.searchTexture=e;const t=new u(s);t.name="SMAA.Area",t.magFilter=re,t.minFilter=re,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!1,this.weightsMaterial.areaTexture=t,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==r&&void 0!==s?(o.itemEnd("search"),o.itemEnd("area")):"undefined"!=typeof Image&&(r=new Image,s=new Image,r.addEventListener("load",(()=>o.itemEnd("search"))),s.addEventListener("load",(()=>o.itemEnd("area"))),r.src=Tl,s.src=El),this.applyPreset(t)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){const t=this.edgeDetectionMaterial,n=this.weightsMaterial;switch(e){case Ba:t.edgeDetectionThreshold=.15,n.orthogonalSearchSteps=4,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Ma:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=8,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Pa:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=16,n.diagonalSearchSteps=8,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0;break;case Oa:t.edgeDetectionThreshold=.05,n.orthogonalSearchSteps=32,n.diagonalSearchSteps=16,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0}}setDepthTexture(e,t=Y){this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,n){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){const{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Tl}static get areaImageDataURL(){return El}},Cl=class extends bl{constructor(e,t,{blendFunction:n=ua,samples:i=9,rings:r=7,normalDepthBuffer:s=null,depthAwareUpsampling:o=!0,worldDistanceThreshold:a,worldDistanceFalloff:l,worldProximityThreshold:c,worldProximityFalloff:u,distanceThreshold:h=.97,distanceFalloff:d=.03,rangeThreshold:f=5e-4,rangeFalloff:p=.001,minRadiusScale:g=.1,luminanceInfluence:m=.7,radius:v=.1825,intensity:y=1,bias:w=.025,fade:b=.01,color:A=null,resolutionScale:x=1,width:S=el.AUTO_SIZE,height:T=el.AUTO_SIZE,resolutionX:E=S,resolutionY:D=T}={}){super("SSAOEffect","uniform lowp sampler2D aoBuffer;uniform float luminanceInfluence;uniform float intensity;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH)\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\n#endif\n#ifdef COLORIZE\nuniform vec3 color;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){float aoLinear=texture2D(aoBuffer,uv).r;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH) && __VERSION__ == 300\nvec4 normalDepth[4];normalDepth[0]=textureOffset(normalDepthBuffer,uv,ivec2(0,0));normalDepth[1]=textureOffset(normalDepthBuffer,uv,ivec2(0,1));normalDepth[2]=textureOffset(normalDepthBuffer,uv,ivec2(1,0));normalDepth[3]=textureOffset(normalDepthBuffer,uv,ivec2(1,1));float dot01=dot(normalDepth[0].rgb,normalDepth[1].rgb);float dot02=dot(normalDepth[0].rgb,normalDepth[2].rgb);float dot03=dot(normalDepth[0].rgb,normalDepth[3].rgb);float minDot=min(dot01,min(dot02,dot03));float s=step(THRESHOLD,minDot);float smallestDistance=1.0;int index;for(int i=0;i<4;++i){float distance=abs(depth-normalDepth[i].a);if(distance<smallestDistance){smallestDistance=distance;index=i;}}ivec2 offsets[4];offsets[0]=ivec2(0,0);offsets[1]=ivec2(0,1);offsets[2]=ivec2(1,0);offsets[3]=ivec2(1,1);ivec2 coord=ivec2(uv*vec2(textureSize(aoBuffer,0)))+offsets[index];float aoNearest=texelFetch(aoBuffer,coord,0).r;float ao=mix(aoNearest,aoLinear,s);\n#else\nfloat ao=aoLinear;\n#endif\nfloat l=luminance(inputColor.rgb);ao=mix(ao,0.0,l*luminanceInfluence);ao=clamp(ao*intensity,0.0,1.0);\n#ifdef COLORIZE\noutputColor=vec4(1.0-ao*(1.0-color),inputColor.a);\n#else\noutputColor=vec4(vec3(1.0-ao),inputColor.a);\n#endif\n}",{blendFunction:n,attributes:Sa.DEPTH,defines:new Map([["THRESHOLD","0.997"]]),uniforms:new Map([["aoBuffer",new te(null)],["normalDepthBuffer",new te(s)],["luminanceInfluence",new te(m)],["color",new te(null)],["intensity",new te(y)],["scale",new te(0)]])}),this.renderTarget=new Z(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="AO.Target",this.uniforms.get("aoBuffer").value=this.renderTarget.texture;const C=this.resolution=new el(this,E,D,x);C.addEventListener("change",(e=>this.setSize(C.baseWidth,C.baseHeight))),this.camera=e,this.depthDownsamplingPass=new sl({normalBuffer:t,resolutionScale:x}),this.depthDownsamplingPass.enabled=null===s,this.ssaoPass=new pl(new Va(e));const I=new xl(64,64,se);I.wrapS=I.wrapT=ne;const B=this.ssaoMaterial;B.normalBuffer=t,B.noiseTexture=I,B.minRadiusScale=g,B.samples=i,B.radius=v,B.rings=r,B.fade=b,B.bias=w,B.distanceThreshold=h,B.distanceFalloff=d,B.proximityThreshold=f,B.proximityFalloff=p,void 0!==a&&(B.worldDistanceThreshold=a),void 0!==l&&(B.worldDistanceFalloff=l),void 0!==c&&(B.worldProximityThreshold=c),void 0!==u&&(B.worldProximityFalloff=u),null!==s&&(this.ssaoMaterial.normalDepthBuffer=s,this.defines.set("NORMAL_DEPTH","1")),this.depthAwareUpsampling=o,this.color=A}set mainCamera(e){this.camera=e,this.ssaoMaterial.copyCameraSettings(e)}get normalBuffer(){return this.ssaoMaterial.normalBuffer}set normalBuffer(e){this.ssaoMaterial.normalBuffer=e,this.depthDownsamplingPass.fullscreenMaterial.normalBuffer=e}getResolution(){return this.resolution}get ssaoMaterial(){return this.ssaoPass.fullscreenMaterial}getSSAOMaterial(){return this.ssaoMaterial}get samples(){return this.ssaoMaterial.samples}set samples(e){this.ssaoMaterial.samples=e}get rings(){return this.ssaoMaterial.rings}set rings(e){this.ssaoMaterial.rings=e}get radius(){return this.ssaoMaterial.radius}set radius(e){this.ssaoMaterial.radius=e}get depthAwareUpsampling(){return this.defines.has("DEPTH_AWARE_UPSAMPLING")}set depthAwareUpsampling(e){this.depthAwareUpsampling!==e&&(e?this.defines.set("DEPTH_AWARE_UPSAMPLING","1"):this.defines.delete("DEPTH_AWARE_UPSAMPLING"),this.setChanged())}isDepthAwareUpsamplingEnabled(){return this.depthAwareUpsampling}setDepthAwareUpsamplingEnabled(e){this.depthAwareUpsampling=e}get distanceScaling(){return!0}set distanceScaling(e){}get color(){return this.uniforms.get("color").value}set color(e){const t=this.uniforms,n=this.defines;null!==e?n.has("COLORIZE")?t.get("color").value.set(e):(n.set("COLORIZE","1"),t.get("color").value=new c(e),this.setChanged()):n.has("COLORIZE")&&(n.delete("COLORIZE"),t.get("color").value=null,this.setChanged())}get luminanceInfluence(){return this.uniforms.get("luminanceInfluence").value}set luminanceInfluence(e){this.uniforms.get("luminanceInfluence").value=e}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getColor(){return this.color}setColor(e){this.color=e}setDistanceCutoff(e,t){this.ssaoMaterial.distanceThreshold=e,this.ssaoMaterial.distanceFalloff=t}setProximityCutoff(e,t){this.ssaoMaterial.proximityThreshold=e,this.ssaoMaterial.proximityFalloff=t}setDepthTexture(e,t=Y){this.depthDownsamplingPass.setDepthTexture(e,t),this.ssaoMaterial.depthBuffer=e,this.ssaoMaterial.depthPacking=t}update(e,t,n){const i=this.renderTarget;this.depthDownsamplingPass.enabled&&this.depthDownsamplingPass.render(e),this.ssaoPass.render(e,null,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.ssaoMaterial.copyCameraSettings(this.camera),this.ssaoMaterial.setSize(i,r),this.renderTarget.setSize(i,r),this.depthDownsamplingPass.resolution.scale=n.scale,this.depthDownsamplingPass.setSize(e,t)}initialize(e,t,n){try{let i=this.uniforms.get("normalDepthBuffer").value;null===i&&(this.depthDownsamplingPass.initialize(e,t,n),i=this.depthDownsamplingPass.texture,this.uniforms.get("normalDepthBuffer").value=i,this.ssaoMaterial.normalDepthBuffer=i,this.defines.set("NORMAL_DEPTH","1"))}catch(e){this.depthDownsamplingPass.enabled=!1}}};function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Il.apply(this,arguments)}var Bl="#define GLSLIFY 1\nvec3 getViewPosition(const float depth){float clipW=_projectionMatrix[2][3]*depth+_projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(_inverseProjectionMatrix*clipPosition).xyz;}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 screenSpaceToWorldSpace(const vec2 uv,const float depth){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=_inverseProjectionMatrix*ndc;vec4 view=cameraMatrixWorld*(clip/clip.w);return view.xyz;}\n#define Scale (vec3(0.8, 0.8, 0.8))\n#define K (19.19)\nvec3 hash(vec3 a){a=fract(a*Scale);a+=dot(a,a.yxz+K);return fract((a.xxy+a.yxx)*a.zyx);}float fresnel_dielectric_cos(float cosi,float eta){float c=abs(cosi);float g=eta*eta-1.0+c*c;float result;if(g>0.0){g=sqrt(g);float A=(g-c)/(g+c);float B=(c*(g+c)-1.0)/(c*(g-c)+1.0);result=0.5*A*A*(1.0+B*B);}else{result=1.0;}return result;}float fresnel_dielectric(vec3 Incoming,vec3 Normal,float eta){float cosine=dot(Incoming,Normal);return min(1.0,5.0*fresnel_dielectric_cos(cosine,eta));}";class Ml extends oe{constructor(){super({type:"MRTMaterial",defines:{USE_UV:"",TEMPORAL_RESOLVE:""},uniforms:{opacity:new te(1),normalMap:new te(null),normalScale:new te(new h(1,1)),uvTransform:new te(new Be),roughness:new te(1),roughnessMap:new te(null)},vertexShader:"\n #ifdef USE_MRT\n varying vec2 vHighPrecisionZW;\n #endif\n #define NORMAL\n varying vec3 vViewPosition;\n #include <common>\n #include <uv_pars_vertex>\n #include <displacementmap_pars_vertex>\n #include <normal_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n uniform mat3 uvTransform;\n void main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #ifdef USE_MRT\n vHighPrecisionZW = gl_Position.zw;\n #endif \n #ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n }\n ",fragmentShader:"\n #define NORMAL\n varying vec3 vViewPosition;\n #include <packing>\n #include <uv_pars_fragment>\n #include <normal_pars_fragment>\n #include <bumpmap_pars_fragment>\n #include <normalmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n #include <roughnessmap_pars_fragment>\n \n #ifdef USE_MRT\n layout(location = 0) out vec4 gNormal;\n layout(location = 1) out vec4 gDepth;\n \n varying vec2 vHighPrecisionZW;\n #endif\n uniform float roughness;\n void main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n float roughnessFactor = roughness;\n \n if(roughness > 10.0e9){\n roughnessFactor = 1.;\n }else{\n #ifdef useRoughnessMap\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n }\n\n vec3 normalColor = packNormalToRGB( normal );\n #ifdef USE_MRT\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n vec4 depthColor = packDepthToRGBA( fragCoordZ );\n gNormal = vec4( normalColor, roughnessFactor );\n gDepth = depthColor;\n #else\n gl_FragColor = vec4(normalColor, roughnessFactor);\n #endif\n }\n ",toneMapped:!1}),this.normalMapType=Me,this.normalScale=new h(1,1),Object.defineProperty(this,"glslVersion",{get(){return"USE_MRT"in this.defines?Pe:null},set(e){}})}}class Pl extends oe{constructor(){super({type:"ReflectionsMaterial",uniforms:{inputTexture:new te(null),accumulatedTexture:new te(null),normalTexture:new te(null),depthTexture:new te(null),_projectionMatrix:new te(new d),_inverseProjectionMatrix:new te(new d),cameraMatrixWorld:new te(new d),cameraNear:new te(0),cameraFar:new te(0),rayDistance:new te(0),intensity:new te(0),roughnessFade:new te(0),fade:new te(0),thickness:new te(0),ior:new te(0),maxDepthDifference:new te(0),jitter:new te(0),jitterRoughness:new te(0),maxRoughness:new te(0),samples:new te(0),envMap:new te(null),envMapPosition:new te(new t),envMapSize:new te(new t),viewMatrix:new te(new d)},defines:{steps:20,refineSteps:5,CUBEUV_TEXEL_WIDTH:0,CUBEUV_TEXEL_HEIGHT:0,CUBEUV_MAX_MIP:0,vWorldPosition:"worldPos"},fragmentShader:"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D normalTexture;uniform sampler2D depthTexture;uniform sampler2D envMap;uniform mat4 _projectionMatrix;uniform mat4 _inverseProjectionMatrix;uniform mat4 cameraMatrixWorld;uniform float cameraNear;uniform float cameraFar;uniform float rayDistance;uniform float intensity;uniform float maxDepthDifference;uniform float roughnessFade;uniform float maxRoughness;uniform float fade;uniform float thickness;uniform float ior;uniform float samples;uniform float jitter;uniform float jitterRoughness;\n#define INVALID_RAY_COORDS vec2(-1.0);\n#define EARLY_OUT_COLOR vec4(0.0, 0.0, 0.0, 1.0)\n#define FLOAT_EPSILON 0.00001\nfloat nearMinusFar;float nearMulFar;float farMinusNear;\n#include <packing>\n#include <helperFunctions>\nvec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);float fastGetViewZ(const in float depth);vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness);void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.0);if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON){gl_FragColor=EARLY_OUT_COLOR;return;}float unpackedDepth=unpackRGBAToDepth(depthTexel);vec4 normalTexel=textureLod(normalTexture,vUv,0.0);float roughness=normalTexel.a;float specular=1.0-roughness;nearMinusFar=cameraNear-cameraFar;nearMulFar=cameraNear*cameraFar;farMinusNear=cameraFar-cameraNear;normalTexel.rgb=unpackRGBToNormal(normalTexel.rgb);float depth=fastGetViewZ(unpackedDepth);vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 viewNormal=normalTexel.xyz;vec3 worldPos=screenSpaceToWorldSpace(vUv,unpackedDepth);vec3 jitt=vec3(0.0);if(jitterRoughness!=0.0||jitter!=0.0){vec3 randomJitter=hash(50.0*samples*worldPos)-0.5;float spread=((2.0-specular)+roughness*jitterRoughness);float jitterMix=jitter*0.25+jitterRoughness*roughness;if(jitterMix>1.0)jitterMix=1.0;jitt=mix(vec3(0.0),randomJitter*spread,jitterMix);}viewNormal+=jitt;float fresnelFactor=fresnel_dielectric(viewDir,viewNormal,ior);vec3 iblRadiance=getIBLRadiance(-viewDir,viewNormal,0.)*fresnelFactor;float lastFrameAlpha=textureLod(accumulatedTexture,vUv,0.0).a;if(roughness>maxRoughness||(roughness>1.0-FLOAT_EPSILON&&roughnessFade>1.0-FLOAT_EPSILON)){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec3 reflected=reflect(viewDir,viewNormal);vec3 rayDir=reflected*-viewPos.z;vec3 hitPos=viewPos;float rayHitDepthDifference;vec2 coords=RayMarch(rayDir,hitPos,rayHitDepthDifference);if(coords.x==-1.0){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec4 SSRTexel=textureLod(inputTexture,coords.xy,0.0);vec4 SSRTexelReflected=textureLod(accumulatedTexture,coords.xy,0.0);vec3 SSR=SSRTexel.rgb+SSRTexelReflected.rgb;float roughnessFactor=mix(specular,1.0,max(0.0,1.0-roughnessFade));vec2 coordsNDC=(coords.xy*2.0-1.0);float screenFade=0.1;float maxDimension=min(1.0,max(abs(coordsNDC.x),abs(coordsNDC.y)));float reflectionIntensity=1.0-(max(0.0,maxDimension-screenFade)/(1.0-screenFade));reflectionIntensity=max(0.,reflectionIntensity);vec3 finalSSR=mix(iblRadiance,SSR,reflectionIntensity)*roughnessFactor;if(fade!=0.0){vec3 hitWorldPos=screenSpaceToWorldSpace(coords,rayHitDepthDifference);float reflectionDistance=distance(hitWorldPos,worldPos)+1.0;float opacity=1.0/(reflectionDistance*fade*0.1);if(opacity>1.0)opacity=1.0;finalSSR*=opacity;}finalSSR*=fresnelFactor*intensity;finalSSR=min(vec3(1.0),finalSSR);float alpha=hitPos.z==1.0 ? 1.0 : SSRTexelReflected.a;alpha=min(lastFrameAlpha,alpha);gl_FragColor=vec4(finalSSR,alpha);}vec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){dir=normalize(dir);dir*=rayDistance/float(steps);float depth;vec4 projectedCoord;vec4 lastProjectedCoord;float unpackedDepth;vec4 depthTexel;for(int i=0;i<steps;i++){hitPos+=dir;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;\n#ifndef missedRays\nif(projectedCoord.x<0.0||projectedCoord.x>1.0||projectedCoord.y<0.0||projectedCoord.y>1.0){return INVALID_RAY_COORDS;}\n#endif\ndepthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;if(rayHitDepthDifference>=0.0&&rayHitDepthDifference<thickness){\n#if refineSteps == 0\nif(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;\n#else\nreturn BinarySearch(dir,hitPos,rayHitDepthDifference);\n#endif\n}\n#ifndef missedRays\nif(hitPos.z>0.0){return INVALID_RAY_COORDS;}\n#endif\nlastProjectedCoord=projectedCoord;}hitPos.z=1.0;\n#ifndef missedRays\nreturn INVALID_RAY_COORDS;\n#endif\nrayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){float depth;vec4 projectedCoord;vec2 lastMinProjectedCoordXY;float unpackedDepth;vec4 depthTexel;for(int i=0;i<refineSteps;i++){projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;depthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;dir*=0.5;if(rayHitDepthDifference>0.0){hitPos-=dir;}else{hitPos+=dir;}}if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;if(abs(rayHitDepthDifference)>maxDepthDifference)return INVALID_RAY_COORDS;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;rayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}float fastGetViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn nearMulFar/(farMinusNear*depth-cameraFar);\n#else\nreturn depth*nearMinusFar-cameraNear;\n#endif\n}\n#include <common>\n#include <cube_uv_reflection_fragment>\nvec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){\n#if defined(ENVMAP_TYPE_CUBE_UV)\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*intensity;\n#else\nreturn vec3(0.0);\n#endif\n}".replace("#include <helperFunctions>",Bl),vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",toneMapped:!1,depthWrite:!1,depthTest:!1})}}const Ol=e=>{const t=[e],n=[];for(;0!==t.length;){const e=t.shift();e.material&&n.push(e);for(const n of e.children)n.visible&&t.push(n)}return n},Rl=(e,t,n)=>{e.uniforms.envMap.value=t;const i=(e=>{const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}})({envMapCubeUVHeight:n});e.defines.ENVMAP_TYPE_CUBE_UV="",e.defines.CUBEUV_TEXEL_WIDTH=i.texelWidth,e.defines.CUBEUV_TEXEL_HEIGHT=i.texelHeight,e.defines.CUBEUV_MAX_MIP=i.maxMip+".0",e.needsUpdate=!0};class _l extends Xa{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super("ReflectionsPass"),this.ssrEffect=void 0,this.cachedMaterials=new WeakMap,this.USE_MRT=!1,this.webgl1DepthPass=null,this.visibleMeshes=[],this.ssrEffect=e,this._scene=e._scene,this._camera=e._camera,this.fullscreenMaterial=new Pl,e._camera.isPerspectiveCamera&&(this.fullscreenMaterial.defines.PERSPECTIVE_CAMERA="");const n=t.width||"undefined"!=typeof window?window.innerWidth:2e3,i=t.height||"undefined"!=typeof window?window.innerHeight:1e3;this.renderTarget=new Z(n,i,{minFilter:re,magFilter:re,type:o,depthBuffer:!1}),this.renderPass=new il(this._scene,this._camera),this.USE_MRT=(()=>{try{const e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}})(),this.USE_MRT?(this.gBuffersRenderTarget=new Ce(n,i,2,{minFilter:re,magFilter:re}),this.normalTexture=this.gBuffersRenderTarget.texture[0],this.depthTexture=this.gBuffersRenderTarget.texture[1]):(this.webgl1DepthPass=new rl(this._scene,this._camera),this.webgl1DepthPass.renderTarget.minFilter=re,this.webgl1DepthPass.renderTarget.magFilter=re,this.webgl1DepthPass.renderTarget.texture.minFilter=re,this.webgl1DepthPass.renderTarget.texture.magFilter=re,this.webgl1DepthPass.setSize("undefined"!=typeof window?window.innerWidth:2e3,"undefined"!=typeof window?window.innerHeight:1e3),this.gBuffersRenderTarget=new Z(n,i,{minFilter:re,magFilter:re}),this.normalTexture=this.gBuffersRenderTarget.texture,this.depthTexture=this.webgl1DepthPass.texture),this.fullscreenMaterial.uniforms.normalTexture.value=this.normalTexture,this.fullscreenMaterial.uniforms.depthTexture.value=this.depthTexture,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.uniforms.cameraMatrixWorld.value=this._camera.matrixWorld,this.fullscreenMaterial.uniforms._projectionMatrix.value=this._camera.projectionMatrix,this.fullscreenMaterial.uniforms._inverseProjectionMatrix.value=this._camera.projectionMatrixInverse}setSize(e,t){this.renderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.gBuffersRenderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.gBuffersRenderTarget.dispose(),this.renderPass.dispose(),this.USE_MRT||this.webgl1DepthPass.dispose(),this.fullscreenMaterial.dispose(),this.normalTexture=null,this.depthTexture=null,this.velocityTexture=null}keepMaterialMapUpdated(e,t,n,i){this.ssrEffect[i]?t[n]!==e[n]&&(e[n]=t[n],e.uniforms[n].value=t[n],t[n]?e.defines[i]="":delete e.defines[i],e.needsUpdate=!0):void 0!==e[n]&&(e[n]=void 0,e.uniforms[n].value=void 0,delete e.defines[i],e.needsUpdate=!0)}setMRTMaterialInScene(){this.visibleMeshes=Ol(this._scene);for(const e of this.visibleMeshes)if(e.material){const t=e.material;let[n,i]=this.cachedMaterials.get(e)||[];if(t!==n){i&&i.dispose(),i=new Ml,this.USE_MRT&&(i.defines.USE_MRT=""),i.normalScale=t.normalScale,i.uniforms.normalScale.value=t.normalScale;const n=t.map||t.normalMap||t.roughnessMap||t.metalnessMap;n&&(i.uniforms.uvTransform.value=n.matrix),this.cachedMaterials.set(e,[t,i])}this.keepMaterialMapUpdated(i,t,"normalMap","useNormalMap"),this.keepMaterialMapUpdated(i,t,"roughnessMap","useRoughnessMap"),i.uniforms.roughness.value=0===this.ssrEffect.selection.size||this.ssrEffect.selection.has(e)?t.roughness||0:1e11,e.material=i}}unsetMRTMaterialInScene(){for(const t of this.visibleMeshes){var e;if("MRTMaterial"===(null==(e=t.material)?void 0:e.type)){t.visible=!0;const[e]=this.cachedMaterials.get(t);t.material=e}}}render(e,t){this.setMRTMaterialInScene(),e.setRenderTarget(this.gBuffersRenderTarget),this.renderPass.render(e,this.gBuffersRenderTarget),this.unsetMRTMaterialInScene(),this.USE_MRT||this.webgl1DepthPass.renderPass.render(e,this.webgl1DepthPass.renderTarget),this.fullscreenMaterial.uniforms.inputTexture.value=t.texture,this.fullscreenMaterial.uniforms.samples.value=this.ssrEffect.temporalResolvePass.samples,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.viewMatrix.value.copy(this._camera.matrixWorldInverse),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}const kl={intensity:1,exponent:1,distance:10,fade:0,roughnessFade:1,thickness:10,ior:1.45,maxRoughness:1,maxDepthDifference:10,blend:.9,correction:1,correctionRadius:1,blur:.5,blurKernel:1,blurSharpness:10,jitter:0,jitterRoughness:0,steps:20,refineSteps:5,missedRays:!0,useNormalMap:!0,useRoughnessMap:!0,resolutionScale:1,velocityResolutionScale:1};class Ll extends oe{constructor(e){const t="#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D velocityTexture;uniform sampler2D lastVelocityTexture;uniform float blend;uniform float correction;uniform float exponent;uniform float samples;uniform vec2 invTexSize;uniform mat4 curInverseProjectionMatrix;uniform mat4 curCameraMatrixWorld;uniform mat4 prevInverseProjectionMatrix;uniform mat4 prevCameraMatrixWorld;varying vec2 vUv;\n#define MAX_NEIGHBOR_DEPTH_DIFFERENCE 0.001\n#define FLOAT_EPSILON 0.00001\n#define FLOAT_ONE_MINUS_EPSILON 0.99999\nvec3 transformexponent;vec3 undoColorTransformExponent;vec3 transformColor(vec3 color){if(exponent==1.0)return color;return pow(abs(color),transformexponent);}vec3 undoColorTransform(vec3 color){if(exponent==1.0)return color;return max(pow(abs(color),undoColorTransformExponent),vec3(0.0));}void main(){if(exponent!=1.0){transformexponent=vec3(1.0/exponent);undoColorTransformExponent=vec3(exponent);}vec4 inputTexel=textureLod(inputTexture,vUv,0.0);vec4 accumulatedTexel;vec3 inputColor=transformColor(inputTexel.rgb);vec3 accumulatedColor;float alpha=inputTexel.a;float velocityDisocclusion;bool didReproject=false;\n#ifdef boxBlur\nvec3 boxBlurredColor=inputTexel.rgb;\n#endif\nvec4 velocity=textureLod(velocityTexture,vUv,0.0);bool isMoving=alpha<1.0||dot(velocity.xy,velocity.xy)>0.0;if(isMoving){vec3 minNeighborColor=inputColor;vec3 maxNeighborColor=inputColor;vec3 col;vec2 neighborUv;vec2 reprojectedUv=vUv-velocity.xy;vec4 lastVelocity=textureLod(lastVelocityTexture,reprojectedUv,0.0);float depth=velocity.b;float closestDepth=depth;float lastClosestDepth=lastVelocity.b;float neighborDepth;float lastNeighborDepth;for(int x=-correctionRadius;x<=correctionRadius;x++){for(int y=-correctionRadius;y<=correctionRadius;y++){if(x!=0||y!=0){neighborUv=vUv+vec2(x,y)*invTexSize;vec4 neigborVelocity=textureLod(velocityTexture,neighborUv,0.0);neighborDepth=neigborVelocity.b;col=textureLod(inputTexture,neighborUv,0.0).xyz;int absX=abs(x);int absY=abs(y);\n#ifdef dilation\nif(absX==1&&absY==1){if(neighborDepth>closestDepth){velocity=neigborVelocity;closestDepth=neighborDepth;}vec4 lastNeighborVelocity=textureLod(velocityTexture,vUv+vec2(x,y)*invTexSize,0.0);lastNeighborDepth=lastNeighborVelocity.b;if(neighborDepth>closestDepth){lastVelocity=lastNeighborVelocity;lastClosestDepth=lastNeighborDepth;}}\n#endif\nif(abs(depth-neighborDepth)<MAX_NEIGHBOR_DEPTH_DIFFERENCE){\n#ifdef boxBlur\nif(absX<=2&&absY<=2)boxBlurredColor+=col;\n#endif\ncol=transformColor(col);minNeighborColor=min(col,minNeighborColor);maxNeighborColor=max(col,maxNeighborColor);}}}}float velocityLength=length(lastVelocity.xy-velocity.xy);velocityDisocclusion=(velocityLength-0.000005)*10.0;velocityDisocclusion*=velocityDisocclusion;reprojectedUv=vUv-velocity.xy;\n#ifdef boxBlur\nfloat pxRadius=correctionRadius>5 ? 121.0 : pow(float(correctionRadius*2+1),2.0);boxBlurredColor/=pxRadius;boxBlurredColor=transformColor(boxBlurredColor);\n#endif\nif(reprojectedUv.x>=0.0&&reprojectedUv.x<=1.0&&reprojectedUv.y>=0.0&&reprojectedUv.y<=1.0){accumulatedTexel=textureLod(accumulatedTexture,reprojectedUv,0.0);accumulatedColor=transformColor(accumulatedTexel.rgb);vec3 clampedColor=clamp(accumulatedColor,minNeighborColor,maxNeighborColor);accumulatedColor=mix(accumulatedColor,clampedColor,correction);didReproject=true;}else{\n#ifdef boxBlur\naccumulatedColor=boxBlurredColor;\n#else\naccumulatedColor=inputColor;\n#endif\n}if(velocity.r>FLOAT_ONE_MINUS_EPSILON&&velocity.g>FLOAT_ONE_MINUS_EPSILON){alpha=0.0;velocityDisocclusion=1.0;}}else{accumulatedColor=transformColor(textureLod(accumulatedTexture,vUv,0.0).rgb);}vec3 outputColor=inputColor;\n#include <custom_compose_shader>\ngl_FragColor=vec4(undoColorTransform(outputColor),alpha);}".replace("#include <custom_compose_shader>",e);super({type:"TemporalResolveMaterial",uniforms:{inputTexture:new te(null),accumulatedTexture:new te(null),velocityTexture:new te(null),lastVelocityTexture:new te(null),samples:new te(1),blend:new te(.5),correction:new te(1),exponent:new te(1),invTexSize:new te(new h)},defines:{correctionRadius:1},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:t})}}const Nl=`\n\t\tvec3 transformed;\n\n\t\t// Get the normal\n\t\t${Se.skinbase_vertex}\n\t\t${Se.beginnormal_vertex}\n\t\t${Se.skinnormal_vertex}\n\t\t${Se.defaultnormal_vertex}\n\n\t\t// Get the current vertex position\n\t\ttransformed = vec3( position );\n\t\t${Se.skinning_vertex}\n\t\tnewPosition = velocityMatrix * vec4( transformed, 1.0 );\n\n\t\t// Get the previous vertex position\n\t\ttransformed = vec3( position );\n\t\t${Se.skinbase_vertex.replace(/mat4 /g,"").replace(/getBoneMatrix/g,"getPrevBoneMatrix")}\n\t\t${Se.skinning_vertex.replace(/vec4 /g,"")}\n\t\tprevPosition = prevVelocityMatrix * vec4( transformed, 1.0 );\n\n\t\tgl_Position = newPosition;\n`;class Ul extends oe{constructor(){super({uniforms:{prevVelocityMatrix:{value:new d},velocityMatrix:{value:new d},prevBoneTexture:{value:null},interpolateGeometry:{value:0},intensity:{value:1},boneTexture:{value:null},alphaTest:{value:0},map:{value:null},alphaMap:{value:null},opacity:{value:1}},vertexShader:`\n #define MAX_BONES 1024\n \n ${Se.skinning_pars_vertex}\n \n\t\t#ifdef USE_SKINNING\n\t\t#ifdef BONE_TEXTURE\n\t\t\tuniform sampler2D prevBoneTexture;\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tfloat j = i * 4.0;\n\t\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\t\ty = dy * ( y + 0.5 );\n\t\t\t\tvec4 v1 = texture2D( prevBoneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\t\tvec4 v2 = texture2D( prevBoneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\t\tvec4 v3 = texture2D( prevBoneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\t\tvec4 v4 = texture2D( prevBoneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#else\n\t\t\tuniform mat4 prevBoneMatrices[ MAX_BONES ];\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tmat4 bone = prevBoneMatrices[ int(i) ];\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#endif\n\t\t#endif\n\n \n uniform mat4 velocityMatrix;\n uniform mat4 prevVelocityMatrix;\n uniform float interpolateGeometry;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n \n ${Nl}\n\n\t\t\t\t\t\tvHighPrecisionZW = gl_Position.zw;\n \n }`,fragmentShader:"\n uniform float intensity;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n\t\t\t\t\t\t#ifdef FULL_MOVEMENT\n\t\t\t\t\t\tgl_FragColor = vec4( 1., 1., 1. - gl_FragCoord.z, 0. );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t#endif\n\n vec2 pos0 = (prevPosition.xy / prevPosition.w) * 0.5 + 0.5;\n vec2 pos1 = (newPosition.xy / newPosition.w) * 0.5 + 0.5;\n \n vec2 vel = pos1 - pos0;\n\n\t\t\t\t\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n \n gl_FragColor = vec4( vel, 1. - fragCoordZ, 0. );\n \n }"}),this.isVelocityMaterial=!0}}const jl=new c(0),Fl=["visible","wireframe","side"];class zl extends Xa{constructor(e,n){var i,s;super("VelocityPass"),this.cachedMaterials=new WeakMap,this.lastCameraTransform={position:new t,quaternion:new r},this.visibleMeshes=[],this.renderedMeshesThisFrame=0,this.renderedMeshesLastFrame=0,this._scene=e,this._camera=n,this.renderTarget=new Z((null==(i=window)?void 0:i.innerWidth)||1e3,(null==(s=window)?void 0:s.innerHeight)||1e3,{type:o})}setVelocityMaterialInScene(){this.renderedMeshesThisFrame=0,this.visibleMeshes=Ol(this._scene);for(const n of this.visibleMeshes){var e;const i=n.material;let[r,s]=this.cachedMaterials.get(n)||[];var t;if(i!==r)s=new Ul,s.lastMatrixWorld=new d,n.material=s,null!=(t=n.skeleton)&&t.boneTexture&&this.saveBoneTexture(n),this.cachedMaterials.set(n,[i,s]);if(s.uniforms.velocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,n.modelViewMatrix),n.userData.needsUpdatedReflections||i.map instanceof Oe?("FULL_MOVEMENT"in s.defines||(s.needsUpdate=!0),s.defines.FULL_MOVEMENT=""):"FULL_MOVEMENT"in s.defines&&(delete s.defines.FULL_MOVEMENT,s.needsUpdate=!0),n.visible=this.cameraMovedThisFrame||!n.matrixWorld.equals(s.lastMatrixWorld)||n.skeleton||"FULL_MOVEMENT"in s.defines,n.material=s,n.visible){this.renderedMeshesThisFrame++;for(const e of Fl)s[e]=i[e];null!=(e=n.skeleton)&&e.boneTexture&&(s.defines.USE_SKINNING="",s.defines.BONE_TEXTURE="",s.uniforms.boneTexture.value=n.skeleton.boneTexture)}}}saveBoneTexture(e){let t=e.material.uniforms.prevBoneTexture.value;if(t&&t.image.width===e.skeleton.boneTexture.width)t=e.material.uniforms.prevBoneTexture.value,t.image.data.set(e.skeleton.boneTexture.image.data);else{var n;null==(n=t)||n.dispose();const i=e.skeleton.boneTexture.image.data.slice(),r=e.skeleton.boneTexture.image.width;t=new ge(i,r,r,se,pe),e.material.uniforms.prevBoneTexture.value=t,t.needsUpdate=!0}}unsetVelocityMaterialInScene(){for(const t of this.visibleMeshes){var e;if(t.material.isVelocityMaterial)t.visible=!0,t.material.lastMatrixWorld.copy(t.matrixWorld),t.material.uniforms.prevVelocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,t.modelViewMatrix),null!=(e=t.skeleton)&&e.boneTexture&&this.saveBoneTexture(t),t.material=this.cachedMaterials.get(t)[0]}}setSize(e,t){this.renderTarget.setSize(e,t)}renderVelocity(e){if(e.setRenderTarget(this.renderTarget),this.renderedMeshesThisFrame>0){const{background:t}=this._scene;this._scene.background=jl,e.render(this._scene,this._camera),this._scene.background=t}else e.clearColor()}checkCameraMoved(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));return(e>1e-6||t>1e-6)&&(this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion),!0)}render(e){this.cameraMovedThisFrame=this.checkCameraMoved(),this.setVelocityMaterialInScene(),(this.renderedMeshesThisFrame>0||this.renderedMeshesLastFrame>0)&&this.renderVelocity(e),this.unsetVelocityMaterialInScene(),this.renderedMeshesLastFrame=this.renderedMeshesThisFrame}}const Gl=new h;class Hl extends Xa{constructor(e,n,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super("TemporalResolvePass"),this.velocityPass=null,this.velocityResolutionScale=1,this.samples=1,this.lastCameraTransform={position:new t,quaternion:new r},this._scene=e,this._camera=n,this.renderTarget=new Z(1,1,{minFilter:re,magFilter:re,type:o,depthBuffer:!1}),this.velocityPass=new zl(e,n),this.fullscreenMaterial=new Ll(i),this.fullscreenMaterial.defines.correctionRadius=s.correctionRadius||1,s.dilation&&(this.fullscreenMaterial.defines.dilation=""),s.boxBlur&&(this.fullscreenMaterial.defines.boxBlur=""),this.setupFramebuffers(1,1),this.checkCanUseSharedVelocityTexture()}dispose(){this._scene.userData.velocityTexture===this.velocityPass.renderTarget.texture&&(delete this._scene.userData.velocityTexture,delete this._scene.userData.lastVelocityTexture),this.renderTarget.dispose(),this.accumulatedTexture.dispose(),this.fullscreenMaterial.dispose(),this.velocityPass.dispose()}setSize(e,t){this.renderTarget.setSize(e,t),this.velocityPass.setSize(e*this.velocityResolutionScale,t*this.velocityResolutionScale),this.velocityPass.renderTarget.texture.minFilter=1===this.velocityResolutionScale?K:re,this.velocityPass.renderTarget.texture.magFilter=1===this.velocityResolutionScale?K:re,this.velocityPass.renderTarget.texture.needsUpdate=!0,this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t),this.setupFramebuffers(e,t)}setupFramebuffers(e,t){this.accumulatedTexture&&this.accumulatedTexture.dispose(),this.lastVelocityTexture&&this.lastVelocityTexture.dispose(),this.accumulatedTexture=new Ie(e,t,se),this.accumulatedTexture.minFilter=re,this.accumulatedTexture.magFilter=re,this.accumulatedTexture.type=o,this.lastVelocityTexture=new Ie(e*this.velocityResolutionScale,t*this.velocityResolutionScale,se),this.lastVelocityTexture.minFilter=1===this.velocityResolutionScale?K:re,this.lastVelocityTexture.magFilter=1===this.velocityResolutionScale?K:re,this.lastVelocityTexture.type=o,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.accumulatedTexture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0}checkCanUseSharedVelocityTexture(){return this._scene.userData.velocityTexture&&this.velocityPass.renderTarget.texture!==this._scene.userData.velocityTexture?this.velocityPass.renderTarget.texture===this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this._scene.userData.lastVelocityTexture,this.fullscreenMaterial.uniforms.velocityTexture.value=this._scene.userData.velocityTexture,this.fullscreenMaterial.needsUpdate=!0):this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.velocityTexture.value=this.velocityPass.renderTarget.texture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0,this._scene.userData.velocityTexture||(this._scene.userData.velocityTexture=this.velocityPass.renderTarget.texture,this._scene.userData.lastVelocityTexture=this.lastVelocityTexture)),this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value}checkNeedsResample(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));(e>1e-6||t>1e-6)&&(this.samples=1,this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion))}render(e){this.samples++,this.checkNeedsResample(),this.fullscreenMaterial.uniforms.samples.value=this.samples,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),e.copyFramebufferToTexture(Gl,this.accumulatedTexture),e.setRenderTarget(this.velocityPass.renderTarget),e.copyFramebufferToTexture(Gl,this.lastVelocityTexture)}}const Vl=function(e,t){let n=1,i=0;for(;e>0;)n/=t,i+=n*(e%t),e=~~(e/t);return i};function Wl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Yl="\n#if defined( USE_ENVMAP ) || defined( ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #ifdef BOX_PROJECTED_ENV_MAP\n vWorldPosition = worldPosition.xyz;\n #endif\n#endif\n",Ql="\n#ifdef BOX_PROJECTED_ENV_MAP\n uniform vec3 envMapSize;\n uniform vec3 envMapPosition;\n varying vec3 vWorldPosition;\n \n vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {\n vec3 nDir = normalize( v );\n\n vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n\n vec3 rbminmax;\n\n rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;\n rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;\n rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;\n\n float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );\n vec3 boxIntersection = vWorldPosition + nDir * correction;\n \n return boxIntersection - cubePos;\n }\n#endif\n",Xl="\n#ifdef BOX_PROJECTED_ENV_MAP\n worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );\n#endif\n",Zl="\n#ifdef BOX_PROJECTED_ENV_MAP\n reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );\n#endif\n";const Kl="#define GLSLIFY 1\n#define MODE_DEFAULT 0\n#define MODE_REFLECTIONS 1\n#define MODE_RAW_REFLECTION 2\n#define MODE_BLURRED_REFLECTIONS 3\n#define MODE_INPUT 4\n#define MODE_BLUR_MIX 5\n#define FLOAT_EPSILON 0.00001\nuniform sampler2D inputTexture;uniform sampler2D reflectionsTexture;uniform float samples;\n#include <boxBlur>\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 reflectionsTexel=texture2D(reflectionsTexture,vUv);ivec2 size=textureSize(reflectionsTexture,0);vec2 invTexSize=1./vec2(size.x,size.y);vec3 reflectionClr=reflectionsTexel.xyz;if(blur>FLOAT_EPSILON){vec3 blurredReflectionsColor=denoise(reflectionsTexel.rgb,reflectionsTexture,vUv,invTexSize,blur,blurSharpness,blurKernel);reflectionClr=mix(reflectionClr,blurredReflectionsColor.rgb,blur);}\n#if RENDER_MODE == MODE_DEFAULT\noutputColor=vec4(inputColor.rgb+reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_REFLECTIONS\noutputColor=vec4(reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_RAW_REFLECTION\noutputColor=vec4(reflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLURRED_REFLECTIONS\noutputColor=vec4(blurredReflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_INPUT\noutputColor=vec4(inputColor.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLUR_MIX\noutputColor=vec4(vec3(blur),1.0);\n#endif\n}".replace("#include <helperFunctions>",Bl).replace("#include <boxBlur>","#define GLSLIFY 1\nuniform float blur;uniform float blurSharpness;uniform int blurKernel;vec3 denoise(vec3 center,sampler2D tex,vec2 uv,vec2 invTexSize,float blur,float blurSharpness,int blurKernel){vec3 color;float total;vec3 col;float weight;for(int x=-blurKernel;x<=blurKernel;x++){for(int y=-blurKernel;y<=blurKernel;y++){col=textureLod(tex,uv+vec2(x,y)*invTexSize,0.).rgb;weight=1.0-abs(dot(col-center,vec3(0.25)));weight=pow(weight,blurSharpness);color+=col*weight;total+=weight;}}return color/total;}"),ql=["blur","blurSharpness","blurKernel"],Jl=new Te(1);let $l;class ec extends bl{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:kl;super("SSREffect",Kl,{type:"FinalSSRMaterial",uniforms:new Map([["reflectionsTexture",new te(null)],["blur",new te(0)],["blurSharpness",new te(0)],["blurKernel",new te(0)]]),defines:new Map([["RENDER_MODE","0"]])}),this.haltonSequence=(e=>{const t=[];let n=1;const i=n+e;for(;n<i;n++)t.push([Vl(n,2)-.5,Vl(n,3)-.5]);return t})(1024),this.haltonIndex=0,this.selection=new vl,this.lastSize=void 0,this.cubeCamera=new Ee(.001,1e3,Jl),this.usingBoxProjectedEnvMap=!1,this._scene=e,this._camera=t;n=Il({},kl,n,{boxBlur:!0,dilation:!0}),this.temporalResolvePass=new Hl(e,t,"#define GLSLIFY 1\n#define INV_EULER 0.36787944117144233\nalpha=velocityDisocclusion<FLOAT_EPSILON ?(alpha+0.0075): 0.0;alpha=clamp(alpha,0.0,1.0);bool needsBlur=!didReproject||velocityDisocclusion>0.5;\n#ifdef boxBlur\nif(needsBlur)inputColor=boxBlurredColor;\n#endif\nif(alpha==1.0){outputColor=accumulatedColor;}else{float m=mix(alpha,1.0,blend);if(needsBlur)m=0.0;outputColor=accumulatedColor*m+inputColor*(1.0-m);}",n),this.uniforms.get("reflectionsTexture").value=this.temporalResolvePass.renderTarget.texture,this.reflectionsPass=new _l(this,n),this.temporalResolvePass.fullscreenMaterial.uniforms.inputTexture.value=this.reflectionsPass.renderTarget.texture,this.lastSize={width:n.width,height:n.height,resolutionScale:n.resolutionScale,velocityResolutionScale:n.velocityResolutionScale},this.setSize(n.width,n.height),this.makeOptionsReactive(n)}makeOptionsReactive(e){let t=!1;const n=this.reflectionsPass.fullscreenMaterial.uniforms,i=Object.keys(n);for(const r of Object.keys(e))Object.defineProperty(this,r,{get:()=>e[r],set(s){if(e[r]!==s||!t)switch(e[r]=s,ql.includes(r)||this.setSize(this.lastSize.width,this.lastSize.height,!0),r){case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height);break;case"velocityResolutionScale":this.temporalResolvePass.velocityResolutionScale=s,this.setSize(this.lastSize.width,this.lastSize.height,!0);break;case"blur":this.uniforms.get("blur").value=s;break;case"blurSharpness":this.uniforms.get("blurSharpness").value=s;break;case"blurKernel":this.uniforms.get("blurKernel").value=s;break;case"steps":this.reflectionsPass.fullscreenMaterial.defines.steps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"refineSteps":this.reflectionsPass.fullscreenMaterial.defines.refineSteps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"missedRays":s?this.reflectionsPass.fullscreenMaterial.defines.missedRays="":delete this.reflectionsPass.fullscreenMaterial.defines.missedRays,this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"correctionRadius":this.temporalResolvePass.fullscreenMaterial.defines.correctionRadius=Math.round(s),this.temporalResolvePass.fullscreenMaterial.needsUpdate=t;break;case"blend":this.temporalResolvePass.fullscreenMaterial.uniforms.blend.value=s;break;case"correction":this.temporalResolvePass.fullscreenMaterial.uniforms.correction.value=s;break;case"exponent":this.temporalResolvePass.fullscreenMaterial.uniforms.exponent.value=s;break;case"distance":n.rayDistance.value=s;default:i.includes(r)&&(n[r].value=s)}}}),this[r]=e[r];t=!0}setSize(e,t){(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||e!==this.lastSize.width||t!==this.lastSize.height||this.resolutionScale!==this.lastSize.resolutionScale||this.velocityResolutionScale!==this.lastSize.velocityResolutionScale)&&(this.temporalResolvePass.setSize(e,t),this.reflectionsPass.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale,velocityResolutionScale:this.velocityResolutionScale})}generateBoxProjectedEnvMapFallback(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:512;this.cubeCamera.renderTarget.dispose(),this.cubeCamera.renderTarget=new Te(r),this.cubeCamera.position.copy(n),this.cubeCamera.updateMatrixWorld(),this.cubeCamera.update(e,this._scene),$l||($l=new De(e),$l.compileCubemapShader());const s=$l.fromCubemap(this.cubeCamera.renderTarget.texture).texture;s.minFilter=re,s.magFilter=re;const o=this.reflectionsPass.fullscreenMaterial;return function(e,t,n){e.defines.BOX_PROJECTED_ENV_MAP="",e.uniforms.envMapPosition={value:t},e.uniforms.envMapSize={value:n};const i=new RegExp(Wl("vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;").replaceAll(" ","\\s*"),"g"),r=new RegExp(Wl("reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;").replaceAll(" ","\\s*"),"g");e.vertexShader="varying vec3 vWorldPosition;\n"+e.vertexShader.replace("#include <worldpos_vertex>",Yl),e.fragmentShader=Ql+"\n"+e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",Se.envmap_physical_pars_fragment).replace(i,`vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n ${Xl}`).replace(r,`reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n ${Zl}`)}(o,n,i),o.fragmentShader=o.fragmentShader.replace("vec3 worldPos","worldPos").replace("varying vec3 vWorldPosition;","vec3 worldPos;"),o.uniforms.envMapPosition.value.copy(n),o.uniforms.envMapSize.value.copy(i),Rl(o,s,r),this.usingBoxProjectedEnvMap=!0,s}setIBLRadiance(e,t){this._scene.traverse((n=>{if(n.material){var i;const r=null==(i=t.properties.get(n.material))?void 0:i.uniforms;r&&"disableIBLRadiance"in r&&(r.disableIBLRadiance.value=e)}}))}deleteBoxProjectedEnvMapFallback(){const e=this.reflectionsPass.fullscreenMaterial;e.uniforms.envMap.value=null,e.fragmentShader=e.fragmentShader.replace("worldPos = ","vec3 worldPos = "),delete e.defines.BOX_PROJECTED_ENV_MAP,e.needsUpdate=!0,this.usingBoxProjectedEnvMap=!1}dispose(){super.dispose(),this.reflectionsPass.dispose(),this.temporalResolvePass.dispose()}update(e,t){if(!this.usingBoxProjectedEnvMap&&this._scene.environment){const t=this.reflectionsPass.fullscreenMaterial;let n=null;if(this._scene.traverse((t=>{if(!n&&t.material&&!t.material.envMap){const i=e.properties.get(t.material);"envMap"in i&&i.envMap instanceof u&&(n=i.envMap)}})),n){const e=this._scene.environment.image.height;Rl(t,n,e)}}this.haltonIndex=(this.haltonIndex+1)%this.haltonSequence.length;const[n,i]=this.haltonSequence[this.haltonIndex],{width:r,height:s}=this.lastSize;this.temporalResolvePass.velocityPass.render(e),this._camera.setViewOffset&&this._camera.setViewOffset(r,s,n,i,r,s),this.reflectionsPass.render(e,t),this.temporalResolvePass.render(e),this._camera.clearViewOffset()}static patchDirectEnvIntensity(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;Se.envmap_physical_pars_fragment=0===e?Se.envmap_physical_pars_fragment.replace("vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {","vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { return vec3(0.0);"):Se.envmap_physical_pars_fragment.replace("vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );","vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ) * "+e.toFixed(5)+";")}}const tc="EffectPass";class nc{constructor(e,t,n){this.renderer=e,this.scene=t,this.camera=n,this.passesMap=new Map,this.effectsMap=new Map,this.effectsNeedsUpddate=!0,this.effectComposer=this._initEffectComposer(),this._initPasses(),this._initEffects()}updateEffectPass(){if(!this.effectsNeedsUpddate)return;this.effectsNeedsUpddate=!1;const{effectComposer:e}=this;e.passes.forEach((t=>{t.name===tc&&(e.removePass(t),t.dispose())}));const t=Array.from(this.effectsMap).filter((e=>{let[,{enabled:t}]=e;return t})).map((e=>{let[,{effect:t}]=e;return t})),n=new ll(this.camera,...t);n.enabled=!!t.length,this.passesMap.set(nc.CONSTANTS.effectPass,n),e.addPass(n)}updateCamera(e){const{passesMap:t,effectsMap:n}=this,{CONSTANTS:i}=nc,r=t.get(i.renderPass),s=t.get(i.normalPass),o=t.get(i.effectPass);r.mainCamera=e,s.mainCamera=e,o.mainCamera=e;n.get(i.outlineEffect).effect.mainCamera=e}_initEffectComposer(){const e=new class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:r}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Za,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"undefined"!=typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return this._delta*gl}get fixedDelta(){return this._fixedDelta*gl}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return this._elapsed*gl}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==e?e:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}handleEvent(e){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){const t=e.getSize(new h),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===Q&&jo(e)===_o&&(Fo(this.inputBuffer.texture,_o),Fo(this.outputBuffer.texture,_o),this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const t of this.passes)t.initialize(e,n,i)}}replaceRenderer(e,t=!0){const n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){const e=this.depthTexture=new q;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=J,e.type=$):e.type=ee,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,n,i){const r=this.renderer,s=null===r?new h:r.getDrawingBufferSize(new h),o={minFilter:re,magFilter:re,stencilBuffer:t,depthBuffer:e,type:n},a=new Z(s.width,s.height,o);return i>0&&(a.ignoreDepthForMultisampleCopy=!1,a.samples=i),n===Q&&jo(r)===_o&&Fo(a.texture,_o),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new h),s=i.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.setRenderer(i),e.setSize(r.width,r.height),e.initialize(i,s,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const t=this.createDepthTexture();for(e of n)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture){const n=(e,t)=>e||t.needsDepthTexture;t.reduce(n,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let i,r,s,o=this.inputBuffer,a=this.outputBuffer,l=!1;void 0===e&&(this.timer.update(),e=this.timer.delta);for(const c of this.passes)c.enabled&&(c.render(t,o,a,e,l),c.needsSwap&&(l&&(n.renderToScreen=c.renderToScreen,i=t.getContext(),r=t.state.buffers.stencil,r.setFunc(i.NOTEQUAL,1,4294967295),n.render(t,o,a,e,l),r.setFunc(i.EQUAL,1,4294967295)),s=o,o=a,a=s),c instanceof hl?l=!0:c instanceof Ka&&(l=!1))}setSize(e,t,n){const i=this.renderer,r=i.getSize(new h);void 0!==e&&void 0!==t||(e=r.width,t=r.height),r.width===e&&r.height===t||i.setSize(e,t,n);const s=i.getDrawingBufferSize(new h);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const e of this.passes)e.setSize(s.width,s.height)}reset(){const e=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=e}dispose(){for(const e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(this.renderer,{multisampling:8,frameBufferType:o});return e}_initPasses(){const{effectComposer:e}=this,t=this._initRenderPass(),n=this._initNormalPass(),i=this._initEffectPass();this.passesMap.set(nc.CONSTANTS.renderPass,t),this.passesMap.set(nc.CONSTANTS.normalPass,n),this.passesMap.set(nc.CONSTANTS.effectPass,i),e.addPass(t),e.addPass(n),e.addPass(i)}_initRenderPass(){return new il(this.scene,this.camera)}_initNormalPass(){const e=new fl(this.scene,this.camera,{resolutionScale:1});return e.enabled=!1,e}_initEffectPass(){const e=new ll(this.camera);return e.name=tc,e}_initEffects(){const{CONSTANTS:e}=nc,t=this._initSMAAEffect(),n=this._initOutlineEffect(),i=this._initSSREffect(),r=this._initBloomEffect(),s=this._initSSAOEffect();this.effectsMap.set(e.smaaEffect,{enabled:!0,effect:t}),this.effectsMap.set(e.outlineEffect,{enabled:!1,effect:n}),this.effectsMap.set(e.ssrEffect,{enabled:!1,effect:i}),this.effectsMap.set(e.bloomEffect,{enabled:!1,effect:r}),this.effectsMap.set(e.ssaoEffect,{enabled:!1,effect:s})}_initSMAAEffect(){return new Dl({preset:Pa,edgeDetectionMode:xa})}_initSSREffect(){return new ec(this.scene,this.camera)}_initBloomEffect(){return new Al({blendFunction:Ho})}_initOutlineEffect(){return new Sl(this.scene,this.camera,{blendFunction:va})}_initSSAOEffect(){const{CONSTANTS:e}=nc,t=this.passesMap.get(e.normalPass);return new Cl(this.camera,t.texture,{blendFunction:ua})}}nc.CONSTANTS={renderPass:"renderPass",normalPass:"normalPass",velocityDepthNormalPass:"velocityDepthNormalPass",effectPass:"effectPass",smaaEffect:"smaaEffect",ssgiEffect:"ssgiEffect",ssaoEffect:"ssaoEffect",outlineEffect:"outlineEffect",ssrEffect:"ssrEffect",bloomEffect:"bloomEffect"};const ic=new class{constructor(){this.workerPool=new kt(4)}generate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{workerPool:n}=this;return new Promise(((r,s)=>{if(e.attributes.position instanceof Re)throw new Error("GenerateMeshBVHWorker: GLBufferAttribute are not supported for the geometry attributes.");_t(e);const o=e.index?e.index.array:null,a=e.attributes.position.array;n.postMessage({index:o,position:a,options:Object.assign(Object.assign({},t),{onProgress:null,includedProgressCallback:Boolean(t.onProgress),groups:[...e.groups]})}).then((n=>{const{data:o}=n;if(o)if(o.error)s(new Error(o.error));else if(o.serialized){const{serialized:n,position:s}=o,a=Lt.deserialize(n,e,{setIndex:!1}),l=Object.assign({setBoundingBox:!1},t);if(e.attributes.position instanceof _e?e.attributes.position.data.array=s:e.attributes.position instanceof f&&(e.attributes.position.array=s),e.index)e.index.array=n.index;else{const t=new f(n.index,1,!1);e.setIndex(t)}l.setBoundingBox&&(e.boundingBox=a.getBoundingBox(new i)),r(a)}else t.onProgress&&t.onProgress(o.progress)}))}))}dispose(){this.workerPool.dispose()}};class rc{constructor(e){this.viewport=e,this.cameraChanging=!1,this.timer=null,this.computedGeometriesUuid=new Map,this.generateMeshBVHWorker=ic,this.viewport.signals.cameraChange.add((()=>{this.cameraChanging=!0,this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=window.setTimeout((()=>{this.cameraChanging=!1}),1e3)}))}computeModelsBoundsTree(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:n="slice",force:i=!1,frameSliceCount:r=500,workerCreator:s}=t,{meshOfModelList:o}=this.viewport.scener.intersectsList,a=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:async e=>e.geometry.computeBoundsTree({setBoundingBox:!1});!i&&e.computedGeometriesUuid.has(t.geometry.uuid)||n(t).then((()=>{e.computedGeometriesUuid.set(t.geometry.uuid,t.geometry.uuid)}))};return new Promise(((e,t)=>{if("block"===n)o.forEach((e=>a(e))),e();else if("slice"===n){let t=0,n=0;const i=()=>{if(t=requestAnimationFrame(i),!this.cameraChanging){for(const e of o.slice(n,n+r))a(e),n+=1;n>=o.length&&(cancelAnimationFrame(t),e())}};i()}else if("worker"===n)if(s){this.generateMeshBVHWorker.workerPool.setWorkerCreator(s);const t=e=>this.generateMeshBVHWorker.generate(e.geometry).then((t=>t&&(e.geometry.boundsTree=t)));Promise.allSettled(o.map((e=>a(e,t)))).then((()=>e()))}else t("请设置 workerCreator")}))}dispose(){this.generateMeshBVHWorker.dispose()}}const sc=navigator.userAgent.toLowerCase().includes("mac");var oc;!function(e){e[e.NONE=-1]="NONE",e[e.ROTATE=0]="ROTATE",e[e.ZOOM=1]="ZOOM",e[e.PAN=2]="PAN"}(oc||(oc={}));const ac=new t,lc=[new t,new t,new t],cc=[new t,new t,new t];let uc=new DOMRect;class hc{constructor(e){this.viewport=e,this.camera=this.viewport.cameraManager.mainCamera,this.domElement=this.viewport.interactiveContainer,this.interactivePosition=null,this.fallbackInteractivePosition=null,this.enabled=!0,this.enabledMousePointInteractive=!0,this.enableZoom=!0,this.zoomSpeed=1,this.zoomMinDistance=1,this.zoomMaxDistance=1e5,this.zoomMinStepDistance=.1,this.zoomMaxStepDistance=2e4,this.enableRotate=!0,this.enableRotateX=!0,this.enableRotateY=!0,this.rotateSpeed=1,this.rotateTiltRange={max:Math.PI,min:0},this.enableAutoRotate=!1,this.autoRotateSpeed=1,this.autoRotateClockwise=!0,this.enableOutOfScene=!0,this.unOffsetOfScene=0,this.enablePan=!0,this.enablePanX=!0,this.enablePanY=!0,this.enablePanAxisX=!0,this.enablePanAxisY=!0,this.enablePanAxisZ=!0,this.panSpeed=2,this.state=oc.NONE,this.sceneBoxCenter=new t,this.dispose=()=>{},this.domElement=e.interactiveContainer,this.init()}init(){const e=e=>{e.preventDefault(),!1!==this.enabled&&(0===e.button?this.state=oc.ROTATE:1===e.button?this.state=oc.ZOOM:2===e.button&&(this.state=oc.PAN),uc=this.domElement.getBoundingClientRect(),this.state!==oc.ROTATE&&this.state!==oc.PAN||(this.interactivePosition=this.getInteractivePosition(e),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("mousemove",n,!1),window.addEventListener("mouseup",i,!0)))},n=e=>{if(e.preventDefault(),!1===this.enabled)return;const{movementX:n,movementY:i}=e;this.state===oc.ROTATE?this.rotate(new t(.00375*-n,.00375*-i,0)):this.state===oc.PAN&&this.pan(new t(-n,i,0))},i=e=>{e.preventDefault(),this.domElement.removeEventListener("mousemove",n,!1),window.removeEventListener("mouseup",i,!0),this.state=oc.NONE},r=e=>{if(e.preventDefault(),!this.enabled)return;let n=0;n=sc&&e.shiftKey?120*-e.deltaX:120*-e.deltaY,this.zoom_on_point(new t(0,0,n),e)},s=e=>{if(e.preventDefault(),!1===this.enabled)return;uc=this.domElement.getBoundingClientRect();const n=e.touches;switch(n.length){case 1:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[0].clientX,n[0].clientY,0);break;case 2:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[1].clientX,n[1].clientY,0);break;case 3:case 4:case 5:lc[0].set(n[0].clientX,n[0].clientY,0),lc[1].set(n[2].clientX,n[2].clientY,0)}const i=new t(uc.x,uc.y,0);lc[0].sub(i),lc[1].sub(i),cc[0].copy(lc[0]),cc[1].copy(lc[1]),this.interactivePosition=this.getInteractivePosition({offsetX:(lc[0].x+lc[1].x)/2,offsetY:(lc[0].y+lc[1].y)/2}),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("touchmove",o,{passive:!1}),this.domElement.addEventListener("touchend",a,!1)},o=e=>{if(e.preventDefault(),!1===this.enabled)return;function n(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y";const r=new h(e[1].x-e[0].x,e[1].y-e[0].y),s=new h(n[1].x-n[0].x,n[1].y-n[0].y),o=r.angle(),a=s.angle();r.normalize(),s.normalize();const l=n[0].y-e[0].y;return"y"===i?new t(0,.005*l,0):"x"===i?new t(o-a,0,0):new t}switch(e.touches.length){case 1:{lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0);const t=lc[0].clone().sub(((e,t)=>{let n=t[0];for(const i in t)n.distanceTo(e)>t[i].distanceTo(e)&&(n=t[i]);return n})(lc[0],cc));t.x=-t.x;const n=t.multiplyScalar(.9);this.pan(n);break}case 2:{lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[1].clientX-uc.x,e.touches[1].clientY-uc.y,0);const i=cc[0].distanceTo(cc[1])-lc[0].distanceTo(lc[1]);this.zoom_touch(new t(0,0,i*this.zoomSpeed/25)),this.rotate(n(lc,cc,"x"));break}case 3:case 4:case 5:lc[0].set(e.touches[0].clientX-uc.x,e.touches[0].clientY-uc.y,0),lc[1].set(e.touches[2].clientX-uc.x,e.touches[2].clientY-uc.y,0),this.rotate(n(lc,cc,"y"))}cc[0].copy(lc[0]),cc[1].copy(lc[1])},a=e=>{e.preventDefault(),this.state=oc.NONE,this.domElement.removeEventListener("touchmove",o,!1),this.domElement.removeEventListener("touchend",a,!1)};this.domElement.addEventListener("mousedown",e,!1),this.domElement.addEventListener("wheel",r,{passive:!1}),this.domElement.addEventListener("touchstart",s,{passive:!1}),this.dispose=()=>{this.domElement.removeEventListener("mousedown",e),this.domElement.removeEventListener("wheel",r),this.domElement.removeEventListener("touchstart",s)}}getInteractivePosition(e){if(this.enabledMousePointInteractive){const t=this.viewport.getIntersects(e,void 0,{isFilterHideObject:!0});if(t.length){const[{point:e}]=t;return e.clone()}return this.fallbackInteractivePosition}return this.fallbackInteractivePosition}intersectsBox(e){const n=this.getSceneBbox(),i=new t;n.getSize(i);let r=Math.max(i.x,i.y,i.z);0!=this.unOffsetOfScene&&(r=this.unOffsetOfScene);const s=n.clone();s.min.addScalar(r/2),s.max.addScalar(-r/2);const o=(new j).copy(this.camera);o.position.add(e),o.updateMatrixWorld(),o.updateProjectionMatrix();return(new ke).setFromProjectionMatrix((new d).multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse)).intersectsBox(n)}caculateContainPoint(e,n){const i=(new t).copy(e).applyMatrix4(n.matrixWorldInverse).applyMatrix4(n.projectionMatrix);return!(Math.abs(i.x)>1||Math.abs(i.y)>1||Math.abs(i.z)>1)}panLeft(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[0]),this.enablePanAxisY&&n.setY(i[1]),this.enablePanAxisZ&&n.setZ(i[2]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}panUp(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[4]),this.enablePanAxisY&&n.setY(i[5]),this.enablePanAxisZ&&n.setZ(i[6]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}pan(e){var t;if(!this.enablePan)return;this.enablePanX||e.setX(0),this.enablePanY||e.setY(0);const n=null!==(t=this.interactivePosition)&&void 0!==t?t:this.sceneBoxCenter;let i=this.camera.position.clone().sub(n).length();i*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(this.panSpeed*e.x*i/uc.height),this.panUp(this.panSpeed*e.y*i/uc.height),this.viewport.signals.cameraChange.dispatch()}zoom_on_point(e,n){if(!this.enableZoom)return;this.interactivePosition=this.getInteractivePosition(n);let i=e.z>0?6:-6;const r=new t(0,0,0);let s;if(this.interactivePosition){s=this.interactivePosition.distanceTo(this.camera.position);const e=this.domElement.getBoundingClientRect();r.set(n.offsetX/e.width*2-1,-n.offsetY/e.height*2+1,.1)}else s=this.camera.position.length(),r.set(0,0,.1);let o=!1;s>this.zoomMaxDistance&&i<0?(o=!0,s=this.zoomMaxDistance,i*=2):s<this.zoomMinDistance&&i>0&&(o=!0,s=this.zoomMinDistance,i*=2),r.unproject(this.camera),r.sub(this.camera.position);let a=s/i*this.zoomSpeed;if(a>0?a>this.zoomMaxStepDistance?a=this.zoomMaxStepDistance:a<this.zoomMinStepDistance&&(a=this.zoomMinStepDistance):a<0&&(a<-this.zoomMaxStepDistance?a=-this.zoomMaxStepDistance:a>-this.zoomMinStepDistance&&(a=-this.zoomMinStepDistance)),o&&!n.shiftKey)return;const l=this.camera.position.clone().addVectors(this.camera.position,r.setLength(a));this.camera.position.copy(l),this.viewport.signals.cameraChange.dispatch()}zoom_touch(e){if(!this.enableZoom)return;let n=e.z;const i=new t(0,0,0);let r;if(this.interactivePosition){const e={offsetX:(cc[0].x+cc[1].x)/2,offsetY:(cc[0].y+cc[1].y)/2};r=this.interactivePosition.distanceTo(this.camera.position),i.set(e.offsetX/uc.width*2-1,-e.offsetY/uc.height*2+1,.1)}else r=this.camera.position.length(),i.set(0,0,.1);if(r>this.zoomMaxDistance&&n>0?(r=this.zoomMaxDistance,n=0):r<this.zoomMinDistance&&n<0&&(r=this.zoomMinDistance),0===n)return;i.unproject(this.camera),i.sub(this.camera.position);let s=r*-n*this.zoomSpeed*.1;s>0?s>this.zoomMaxStepDistance?s=this.zoomMaxStepDistance:s<this.zoomMinStepDistance&&(s=this.zoomMinStepDistance):s<0&&(s<-this.zoomMaxStepDistance?s=-this.zoomMaxStepDistance:s>-this.zoomMinStepDistance&&(s=-this.zoomMinStepDistance));const o=this.camera.position.clone().addVectors(this.camera.position,i.setLength(s));this.camera.position.copy(o),this.viewport.signals.cameraChange.dispatch()}rotate(e){var n;if(!this.enableRotate)return;e.x*=this.rotateSpeed,e.y*=this.rotateSpeed;const i=new t(0,0,-1);i.applyQuaternion(this.camera.quaternion);const r=i.angleTo(new t(0,1,0));(r-e.y>this.rotateTiltRange.max&&e.y<0||r-e.y<this.rotateTiltRange.min&&e.y>0)&&(e.y=0);const s=null!==(n=this.interactivePosition)&&void 0!==n?n:this.sceneBoxCenter;ac.copy(this.camera.position).sub(s);const o=new d,a=new t(1,0,0);this.enableRotateX&&o.makeRotationAxis(new t(0,1,0),e.x);const l=new d;this.enableRotateY&&(a.applyEuler(this.camera.rotation),l.makeRotationAxis(a,e.y),o.multiply(l)),ac.applyMatrix4(o),i.applyMatrix4(o),this.camera.position.copy(s).add(ac),this.camera.lookAt(i.add(this.camera.position)),this.viewport.signals.cameraChange.dispatch()}autoRotate(){const e=this.autoRotateClockwise?.01:-.01;this.rotate(new t(e*this.autoRotateSpeed,0,0))}update(){this.enableAutoRotate&&this.autoRotate()}getSceneBbox(){const e=this.viewport.scene,t=new i;return t.setFromObject(e),t}}const dc={type:"change"},fc={type:"start"},pc={type:"end"};class gc extends ce{constructor(e,n){super(),this.object=e,this.domElement=n,this.enabled=!0,this.target=new t,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.enableAutoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Le.ROTATE,MIDDLE:Le.DOLLY,RIGHT:Le.PAN},this.touches={ONE:Ne.ROTATE,TWO:Ne.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.userData.zoom,this._domElementKeyEvents=null,this.domElement.style.touchAction="none",this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",Q),this._domElementKeyEvents=e},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.userData.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.userData.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(dc),i.update(),o=s.NONE},this.update=function(){const n=new t,h=(new r).setFromUnitVectors(e.up,new t(0,1,0)),p=h.clone().invert(),g=new t,m=new r,v=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(h),l.setFromVector3(n),i.enableAutoRotate&&o===s.NONE&&D(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(l.theta+=c.theta*i.dampingFactor,l.phi+=c.phi*i.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let t=i.minAzimuthAngle,r=i.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=v:t>Math.PI&&(t-=v),r<-Math.PI?r+=v:r>Math.PI&&(r-=v),l.theta=t<=r?Math.max(t,Math.min(r,l.theta)):l.theta>(t+r)/2?Math.max(t,l.theta):Math.min(r,l.theta)),l.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=u,l.radius=Math.max(i.minDistance,Math.min(i.maxDistance,l.radius)),!0===i.enableDamping?i.target.addScaledVector(d,i.dampingFactor):i.target.add(d),n.setFromSpherical(l),n.applyQuaternion(p),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,d.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),d.set(0,0,0)),u=1,!!(f||g.distanceToSquared(i.object.position)>a||8*(1-m.dot(i.object.quaternion))>a)&&(i.dispatchEvent(dc),g.copy(i.object.position),m.copy(i.object.quaternion),f=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",X),i.domElement.removeEventListener("pointerdown",G),i.domElement.removeEventListener("pointercancel",W),i.domElement.removeEventListener("wheel",Y),i.domElement.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",Q)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=s.NONE;const a=1e-6,l=new Ue,c=new Ue;let u=1;const d=new t;let f=!1;const p=new h,g=new h,m=new h,v=new h,y=new h,w=new h,b=new h,A=new h,x=new h,S=[],T={};function E(){return Math.pow(.95,i.zoomSpeed)}function D(e){c.theta-=e}function C(e){c.phi-=e}const I=function(){const e=new t;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),d.add(e)}}(),B=function(){const e=new t;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),d.add(e)}}(),M=function(){const e=new t;return function(t,n){const r=i.domElement;if(i.object instanceof j){const s=i.object.position;e.copy(s).sub(i.target);let o=e.length();o*=Math.tan(i.object.fov/2*Math.PI/180),I(2*t*o/r.clientHeight,i.object.matrix),B(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(t*(i.object.right-i.object.left)/i.object.userData.zoom/r.clientWidth,i.object.matrix),B(n*(i.object.top-i.object.bottom)/i.object.userData.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function P(e){i.object instanceof j?u/=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom*e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function O(e){i.object instanceof j?u*=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom/e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function R(e){p.set(e.clientX,e.clientY)}function _(e){v.set(e.clientX,e.clientY)}function k(){if(1===S.length)p.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);p.set(e,t)}}function L(){if(1===S.length)v.set(S[0].pageX,S[0].pageY);else{const e=.5*(S[0].pageX+S[1].pageX),t=.5*(S[0].pageY+S[1].pageY);v.set(e,t)}}function N(){const e=S[0].pageX-S[1].pageX,t=S[0].pageY-S[1].pageY,n=Math.sqrt(e*e+t*t);b.set(0,n)}function U(e){if(1==S.length)g.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);g.set(n,i)}m.subVectors(g,p).multiplyScalar(i.rotateSpeed);const t=i.domElement;D(2*Math.PI*m.x/t.clientHeight),C(2*Math.PI*m.y/t.clientHeight),p.copy(g)}function F(e){if(1===S.length)y.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);y.set(n,i)}w.subVectors(y,v).multiplyScalar(i.panSpeed),M(w.x,w.y),v.copy(y)}function z(e){const t=q(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);A.set(0,s),x.set(0,Math.pow(A.y/b.y,i.zoomSpeed)),P(x.y),b.copy(A)}function G(e){!1!==i.enabled&&(0===S.length&&(i.domElement.addEventListener("pointermove",H),window.addEventListener("pointerup",V)),function(e){S.push(e)}(e),"touch"===e.pointerType?function(e){switch(K(e),S.length){case 1:switch(i.touches.ONE){case Ne.ROTATE:if(!1===i.enableRotate)return;k(),o=s.TOUCH_ROTATE;break;case Ne.PAN:if(!1===i.enablePan)return;L(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case Ne.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&N(),i.enablePan&&L(),o=s.TOUCH_DOLLY_PAN;break;case Ne.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&N(),i.enableRotate&&k(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(fc)}(e):function(e){let t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case Le.DOLLY:if(!1===i.enableZoom)return;!function(e){b.set(e.clientX,e.clientY)}(e),o=s.DOLLY;break;case Le.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;_(e),o=s.PAN}else{if(!1===i.enableRotate)return;R(e),o=s.ROTATE}break;case Le.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;R(e),o=s.ROTATE}else{if(!1===i.enablePan)return;_(e),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(fc)}(e))}function H(e){e.preventDefault(),!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(K(e),o){case s.TOUCH_ROTATE:if(!1===i.enableRotate)return;U(e),i.update();break;case s.TOUCH_PAN:if(!1===i.enablePan)return;F(e),i.update();break;case s.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&z(e),i.enablePan&&F(e)}(e),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&z(e),i.enableRotate&&U(e)}(e),i.update();break;default:o=s.NONE}}(e):function(e){switch(o){case s.ROTATE:if(!1===i.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),m.subVectors(g,p).multiplyScalar(i.rotateSpeed);const t=i.domElement;D(2*Math.PI*m.x/t.clientHeight),C(2*Math.PI*m.y/t.clientHeight),p.copy(g),i.update()}(e);break;case s.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),x.subVectors(A,b),x.y>0?P(E()):x.y<0&&O(E()),b.copy(A),i.update()}(e);break;case s.PAN:if(!1===i.enablePan)return;!function(e){y.set(e.clientX,e.clientY),w.subVectors(y,v).multiplyScalar(i.panSpeed),M(w.x,w.y),v.copy(y),i.update()}(e)}}(e))}function V(e){Z(e),0===S.length&&(i.domElement.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V)),i.dispatchEvent(pc),o=s.NONE}function W(e){Z(e)}function Y(e){!1!==i.enabled&&!1!==i.enableZoom&&o===s.NONE&&(e.preventDefault(),i.dispatchEvent(fc),function(e){e.deltaY<0?O(E()):e.deltaY>0&&P(E()),i.update()}(e),i.dispatchEvent(pc))}function Q(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:M(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:M(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:M(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:M(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function X(e){!1!==i.enabled&&e.preventDefault()}function Z(e){delete T[e.pointerId];for(let t=0;t<S.length;t++)if(S[t].pointerId==e.pointerId)return void S.splice(t,1)}function K(e){let t=T[e.pointerId];void 0===t&&(t=new h,T[e.pointerId]=t),t.set(e.pageX,e.pageY)}function q(e){const t=e.pointerId===S[0].pointerId?S[1]:S[0];return T[t.pointerId]}i.domElement.addEventListener("contextmenu",X),i.domElement.addEventListener("pointerdown",G),i.domElement.addEventListener("pointercancel",W),i.domElement.addEventListener("wheel",Y,{passive:!1})}}class mc{get options(){return this._options}set options(e){this._options=e,e.type||(this._options.type="free"),this._onChangeCallback()}constructor(e){this.viewport=e,this._options={type:"free"},this._disposeList=new Set,this.currentControls=new hc(this.viewport)}handleFreeControls(){const e=es(this.options,["type"]),{postRender:t}=this.viewport,n=this.currentControls=new hc(this.viewport);Object.assign(n,e),t.set("FreeControlsUpdate",(()=>{n.update()})),this._disposeList.add((()=>{t.delete("FreeControlsUpdate")}))}handleOrbitControls(){const e=es(Object.assign({},this.options),["type"]),{cameraManager:{mainCamera:t},interactiveContainer:n,postRender:i}=this.viewport,r=this.currentControls=new gc(t,n);Object.assign(r,e),r.update();const s=()=>{this.viewport.signals.cameraChange.dispatch()};if(r.addEventListener("change",s),this._disposeList.add((()=>{r.removeEventListener("change",s)})),e.enableDamping||e.enableAutoRotate)i.set("OrbitControlsUpdate",(()=>{this.viewport.render((()=>{r.update()}))})),this._disposeList.add((()=>{i.delete("OrbitControlsUpdate")}));else{const e=e=>{e&&r.update()};this.viewport.signals.cameraChange.add(e),this._disposeList.add((()=>{this.viewport.signals.cameraChange.remove(e)}))}}_onChangeCallback(){switch(this.dispose(),this.options.type){case"free":default:this.handleFreeControls();break;case"orbit":this.handleOrbitControls()}this.viewport.triggerRender()}setOptions(e){this.options=e}dispose(){this.currentControls.dispose(),this._disposeList.forEach((e=>e())),this._disposeList.clear()}}var vc="0123456789abcdefghijklmnopqrstuvwxyz";function yc(e){return vc.charAt(e)}function wc(e,t){return e&t}function bc(e,t){return e|t}function Ac(e,t){return e^t}function xc(e,t){return e&~t}function Sc(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Tc(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Ec,Dc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cc="=";function Ic(e){var t,n,i="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),i+=Dc.charAt(n>>6)+Dc.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),i+=Dc.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),i+=Dc.charAt(n>>2)+Dc.charAt((3&n)<<4));(3&i.length)>0;)i+=Cc;return i}function Bc(e){var t,n="",i=0,r=0;for(t=0;t<e.length&&e.charAt(t)!=Cc;++t){var s=Dc.indexOf(e.charAt(t));s<0||(0==i?(n+=yc(s>>2),r=3&s,i=1):1==i?(n+=yc(r<<2|s>>4),r=15&s,i=2):2==i?(n+=yc(r),n+=yc(s>>2),r=3&s,i=3):(n+=yc(r<<2|s>>4),n+=yc(15&s),i=0))}return 1==i&&(n+=yc(r<<2)),n}var Mc,Pc=function(e){var t;if(void 0===Ec){var n="0123456789ABCDEF",i=" \f\n\r\t \u2028\u2029";for(Ec={},t=0;t<16;++t)Ec[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Ec[n.charAt(t)]=t;for(t=0;t<i.length;++t)Ec[i.charAt(t)]=-1}var r=[],s=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=Ec[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);s|=a,++o>=2?(r[r.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return r},Oc={decode:function(e){var t;if(void 0===Mc){var n="= \f\n\r\t \u2028\u2029";for(Mc=Object.create(null),t=0;t<64;++t)Mc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(Mc["-"]=62,Mc._=63,t=0;t<n.length;++t)Mc[n.charAt(t)]=-1}var i=[],r=0,s=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=Mc[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);r|=o,++s>=4?(i[i.length]=r>>16,i[i.length]=r>>8&255,i[i.length]=255&r,r=0,s=0):r<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:i[i.length]=r>>10;break;case 3:i[i.length]=r>>16,i[i.length]=r>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=Oc.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return Oc.decode(e)}},Rc=1e13,_c=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,i,r=this.buf,s=r.length;for(n=0;n<s;++n)(i=r[n]*e+t)<Rc?t=0:i-=(t=0|i/Rc)*Rc,r[n]=i;t>0&&(r[n]=t)},e.prototype.sub=function(e){var t,n,i=this.buf,r=i.length;for(t=0;t<r;++t)(n=i[t]-e)<0?(n+=Rc,e=1):e=0,i[t]=n;for(;0===i[i.length-1];)i.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),i=t.length-2;i>=0;--i)n+=(Rc+t[i]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*Rc+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),kc="…",Lc=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Nc=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Uc(e,t){return e.length>t&&(e=e.substring(0,t)+kc),e}var jc,Fc=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var i="",r=e;r<t;++r)if(i+=this.hexByte(this.get(r)),!0!==n)switch(15&r){case 7:i+=" ";break;case 15:i+="\n";break;default:i+=" "}return i},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var i=this.get(n);if(i<32||i>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",i=e;i<t;++i)n+=String.fromCharCode(this.get(i));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",i=e;i<t;){var r=this.get(i++);n+=r<128?String.fromCharCode(r):r>191&&r<224?String.fromCharCode((31&r)<<6|63&this.get(i++)):String.fromCharCode((15&r)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,i,r="",s=e;s<t;)n=this.get(s++),i=this.get(s++),r+=String.fromCharCode(n<<8|i);return r},e.prototype.parseTime=function(e,t,n){var i=this.parseStringISO(e,t),r=(n?Lc:Nc).exec(i);return r?(n&&(r[1]=+r[1],r[1]+=+r[1]<70?2e3:1900),i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(e,t){for(var n,i=this.get(e),r=i>127,s=r?255:0,o="";i==s&&++e<t;)i=this.get(e);if(0===(n=t-e))return r?-1:0;if(n>4){for(o=i,n<<=3;0==(128&(+o^s));)o=+o<<1,--n;o="("+n+" bit)\n"}r&&(i-=256);for(var a=new _c(i),l=e+1;l<t;++l)a.mulAdd(256,this.get(l));return o+a.toString()},e.prototype.parseBitString=function(e,t,n){for(var i=this.get(e),r="("+((t-e-1<<3)-i)+" bit)\n",s="",o=e+1;o<t;++o){for(var a=this.get(o),l=o==t-1?i:0,c=7;c>=l;--c)s+=a>>c&1?"1":"0";if(s.length>n)return r+Uc(s,n)}return r+s},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return Uc(this.parseStringISO(e,t),n);var i=t-e,r="("+i+" byte)\n";i>(n/=2)&&(t=e+n);for(var s=e;s<t;++s)r+=this.hexByte(this.get(s));return i>n&&(r+=kc),r},e.prototype.parseOID=function(e,t,n){for(var i="",r=new _c,s=0,o=e;o<t;++o){var a=this.get(o);if(r.mulAdd(128,127&a),s+=7,!(128&a)){if(""===i)if((r=r.simplify())instanceof _c)r.sub(80),i="2."+r.toString();else{var l=r<80?r<40?0:1:2;i=l+"."+(r-40*l)}else i+="."+r.toString();if(i.length>n)return Uc(i,n);r=new _c,s=0}}return s>0&&(i+=".incomplete"),i},e}(),zc=function(){function e(e,t,n,i,r){if(!(i instanceof Gc))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=i,this.sub=r}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Uc(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return Uc(this.stream.parseStringISO(t,t+n),e);case 30:return Uc(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,i=this.sub.length;n<i;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var i=0;i<n;++i)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof Fc?t:new Fc(t,0);var i=new Fc(n),r=new Gc(n),s=e.decodeLength(n),o=n.pos,a=o-i.pos,l=null,c=function(){var t=[];if(null!==s){for(var i=o+s;n.pos<i;)t[t.length]=e.decode(n);if(n.pos!=i)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var r=e.decode(n);if(r.tag.isEOC())break;t[t.length]=r}s=o-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(r.tagConstructed)l=c();else if(r.isUniversal()&&(3==r.tagNumber||4==r.tagNumber))try{if(3==r.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");l=c();for(var u=0;u<l.length;++u)if(l[u].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){l=null}if(null===l){if(null===s)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(s)}return new e(i,a,s,r,l)},e}(),Gc=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=0!=(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new _c;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),Hc=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Vc=(1<<26)/Hc[Hc.length-1],Wc=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this[o]>>a)>0&&(r=!0,s=yc(n));o>=0;)a<t?(n=(this[o]&(1<<a)-1)<<t-a,n|=this[--o]>>(a+=this.DB-t)):(n=this[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),n>0&&(r=!0),r&&(s+=yc(n));return r?s:"0"},e.prototype.negate=function(){var t=Kc();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ru(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=Kc();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new Qc(t):new Xc(t),this.exp(e,n)},e.prototype.clone=function(){var e=Kc();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,i=this.DB-e*this.DB%8,r=0;if(e-- >0)for(i<this.DB&&(n=this[e]>>i)!=(this.s&this.DM)>>i&&(t[r++]=n|this.s<<this.DB-i);e>=0;)i<8?(n=(this[e]&(1<<i)-1)<<8-i,n|=this[--e]>>(i+=this.DB-8)):(n=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(t[r++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=Kc();return this.bitwiseTo(e,wc,t),t},e.prototype.or=function(e){var t=Kc();return this.bitwiseTo(e,bc,t),t},e.prototype.xor=function(e){var t=Kc();return this.bitwiseTo(e,Ac,t),t},e.prototype.andNot=function(e){var t=Kc();return this.bitwiseTo(e,xc,t),t},e.prototype.not=function(){for(var e=Kc(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=Kc();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=Kc();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Sc(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=Tc(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,bc)},e.prototype.clearBit=function(e){return this.changeBit(e,xc)},e.prototype.flipBit=function(e){return this.changeBit(e,Ac)},e.prototype.add=function(e){var t=Kc();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=Kc();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=Kc();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=Kc();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=Kc();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=Kc(),n=Kc();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,i,r=e.bitLength(),s=iu(1);if(r<=0)return s;n=r<18?1:r<48?3:r<144?4:r<768?5:6,i=r<8?new Qc(t):t.isEven()?new Zc(t):new Xc(t);var o=[],a=3,l=n-1,c=(1<<n)-1;if(o[1]=i.convert(this),n>1){var u=Kc();for(i.sqrTo(o[1],u);a<=c;)o[a]=Kc(),i.mulTo(u,o[a-2],o[a]),a+=2}var h,d,f=e.t-1,p=!0,g=Kc();for(r=ru(e[f])-1;f>=0;){for(r>=l?h=e[f]>>r-l&c:(h=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(h|=e[f-1]>>this.DB+r-l)),a=n;0==(1&h);)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[h].copyTo(s),p=!1;else{for(;a>1;)i.sqrTo(s,g),i.sqrTo(g,s),a-=2;a>0?i.sqrTo(s,g):(d=s,s=g,g=d),i.mulTo(g,o[h],s)}for(;f>=0&&0==(e[f]&1<<r);)i.sqrTo(s,g),d=s,s=g,g=d,--r<0&&(r=this.DB-1,--f)}return i.revert(s)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var i=t.clone(),r=this.clone(),s=iu(1),o=iu(0),a=iu(0),l=iu(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),n?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(t,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);i.compareTo(r)>=0?(i.subTo(r,i),n&&s.subTo(a,s),o.subTo(l,o)):(r.subTo(i,r),n&&a.subTo(s,a),l.subTo(o,l))}return 0!=r.compareTo(e.ONE)?e.ZERO:l.compareTo(t)>=0?l.subtract(t):l.signum()<0?(l.addTo(t,l),l.signum()<0?l.add(t):l):l},e.prototype.pow=function(e){return this.exp(e,new Yc)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var i=t;t=n,n=i}var r=t.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)return t;for(r<s&&(s=r),s>0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return s>0&&n.lShiftTo(s,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=Hc[Hc.length-1]){for(t=0;t<Hc.length;++t)if(n[0]==Hc[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Hc.length;){for(var i=Hc[t],r=t+1;r<Hc.length&&i<Vc;)i*=Hc[r++];for(i=n.modInt(i);t<r;)if(i%Hc[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var i;if(16==n)i=4;else if(8==n)i=3;else if(256==n)i=8;else if(2==n)i=1;else if(32==n)i=5;else{if(4!=n)return void this.fromRadix(t,n);i=2}this.t=0,this.s=0;for(var r=t.length,s=!1,o=0;--r>=0;){var a=8==i?255&+t[r]:nu(t,r);a<0?"-"==t.charAt(r)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,i=this.DB-n,r=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM,a=this.t-1;a>=0;--a)t[a+s+1]=this[a]>>i|o,o=(this[a]&r)<<n;for(a=s-1;a>=0;--a)t[a]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var i=e%this.DB,r=this.DB-i,s=(1<<i)-1;t[0]=this[n]>>i;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&s)<<r,t[o-n]=this[o]>>i;i>0&&(t[this.t-n-1]|=(this.s&s)<<r),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var i=this.abs(),r=t.abs(),s=i.t;for(n.t=s+r.t;--s>=0;)n[s]=0;for(s=0;s<r.t;++s)n[s+i.t]=i.am(0,r[s],n,s,0,i.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,i){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=n&&n.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=Kc());var o=Kc(),a=this.s,l=t.s,c=this.DB-ru(r[r.t-1]);c>0?(r.lShiftTo(c,o),s.lShiftTo(c,i)):(r.copyTo(o),s.copyTo(i));var u=o.t,h=o[u-1];if(0!=h){var d=h*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,g=1<<this.F2,m=i.t,v=m-u,y=null==n?Kc():n;for(o.dlShiftTo(v,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),e.ONE.dlShiftTo(u,y),y.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--v>=0;){var w=i[--m]==h?this.DM:Math.floor(i[m]*f+(i[m-1]+g)*p);if((i[m]+=o.am(0,w,i,v,0,u))<w)for(o.dlShiftTo(v,y),i.subTo(y,i);i[m]<--w;)i.subTo(y,i)}null!=n&&(i.drShiftTo(u,n),a!=l&&e.ZERO.subTo(n,n)),i.t=u,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&e.ZERO.subTo(i,i)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var i=Kc(),r=Kc(),s=n.convert(this),o=ru(t)-1;for(s.copyTo(i);--o>=0;)if(n.sqrTo(i,r),(t&1<<o)>0)n.mulTo(r,s,i);else{var a=i;i=r,r=a}return n.revert(i)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),i=iu(n),r=Kc(),s=Kc(),o="";for(this.divRemTo(i,r,s);r.signum()>0;)o=(n+s.intValue()).toString(e).substr(1)+o,r.divRemTo(i,r,s);return s.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var i=this.chunkSize(n),r=Math.pow(n,i),s=!1,o=0,a=0,l=0;l<t.length;++l){var c=nu(t,l);c<0?"-"==t.charAt(l)&&0==this.signum()&&(s=!0):(a=n*a+c,++o>=i&&(this.dMultiply(r),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(a,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,i){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),bc,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var r=[],s=7&t;r.length=1+(t>>3),n.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},e.prototype.bitwiseTo=function(e,t,n){var i,r,s=Math.min(e.t,this.t);for(i=0;i<s;++i)n[i]=t(this[i],e[i]);if(e.t<this.t){for(r=e.s&this.DM,i=s;i<this.t;++i)n[i]=t(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=s;i<e.t;++i)n[i]=t(r,e[i]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var i=e.ONE.shiftLeft(t);return this.bitwiseTo(i,n,i),i},e.prototype.addTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(var r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,e[i],n,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e[i],n,i,0,t-i);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var i=n.t=this.t+e.t-t;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)n[this.t+i-t]=this.am(t-i,e[i],n,0,0,this.t+i-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var i=this.t-1;i>=0;--i)n=(t*n+this[i])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),i=n.getLowestSetBit();if(i<=0)return!1;var r=n.shiftRight(i);(t=t+1>>1)>Hc.length&&(t=Hc.length);for(var s=Kc(),o=0;o<t;++o){s.fromInt(Hc[Math.floor(Math.random()*Hc.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(n)){for(var l=1;l++<i&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=Kc();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(n.compareTo(i)<0){var r=n;n=i,i=r}var s=n.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)t(n);else{s<o&&(o=s),o>0&&(n.rShiftTo(o,n),i.rShiftTo(o,i));var a=function(){(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),n.compareTo(i)>=0?(n.subTo(i,n),n.rShiftTo(1,n)):(i.subTo(n,i),i.rShiftTo(1,i)),n.signum()>0?setTimeout(a,0):(o>0&&i.lShiftTo(o,i),setTimeout((function(){t(i)}),0))};setTimeout(a,10)}},e.prototype.fromNumberAsync=function(t,n,i,r){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),bc,this),this.isEven()&&this.dAddOffset(1,0);var s=this,o=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(e.ONE.shiftLeft(t-1),s),s.isProbablePrime(n)?setTimeout((function(){r()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var a=[],l=7&t;a.length=1+(t>>3),n.nextBytes(a),l>0?a[0]&=(1<<l)-1:a[0]=0,this.fromString(a,256)}},e}(),Yc=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Qc=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Xc=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=Kc();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Wc.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Kc();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Zc=function(){function e(e){this.m=e,this.r2=Kc(),this.q3=Kc(),Wc.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Kc();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function Kc(){return new Wc(null)}function qc(e,t){return new Wc(e,t)}var Jc="undefined"!=typeof navigator;Jc&&"Microsoft Internet Explorer"==navigator.appName?(Wc.prototype.am=function(e,t,n,i,r,s){for(var o=32767&t,a=t>>15;--s>=0;){var l=32767&this[e],c=this[e++]>>15,u=a*l+c*o;r=((l=o*l+((32767&u)<<15)+n[i]+(1073741823&r))>>>30)+(u>>>15)+a*c+(r>>>30),n[i++]=1073741823&l}return r},jc=30):Jc&&"Netscape"!=navigator.appName?(Wc.prototype.am=function(e,t,n,i,r,s){for(;--s>=0;){var o=t*this[e++]+n[i]+r;r=Math.floor(o/67108864),n[i++]=67108863&o}return r},jc=26):(Wc.prototype.am=function(e,t,n,i,r,s){for(var o=16383&t,a=t>>14;--s>=0;){var l=16383&this[e],c=this[e++]>>14,u=a*l+c*o;r=((l=o*l+((16383&u)<<14)+n[i]+r)>>28)+(u>>14)+a*c,n[i++]=268435455&l}return r},jc=28),Wc.prototype.DB=jc,Wc.prototype.DM=(1<<jc)-1,Wc.prototype.DV=1<<jc;Wc.prototype.FV=Math.pow(2,52),Wc.prototype.F1=52-jc,Wc.prototype.F2=2*jc-52;var $c,eu,tu=[];for($c="0".charCodeAt(0),eu=0;eu<=9;++eu)tu[$c++]=eu;for($c="a".charCodeAt(0),eu=10;eu<36;++eu)tu[$c++]=eu;for($c="A".charCodeAt(0),eu=10;eu<36;++eu)tu[$c++]=eu;function nu(e,t){var n=tu[e.charCodeAt(t)];return null==n?-1:n}function iu(e){var t=Kc();return t.fromInt(e),t}function ru(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}Wc.ZERO=iu(0),Wc.ONE=iu(1);var su=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,i;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,i=this.S[t],this.S[t]=this.S[n],this.S[n]=i;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var ou,au,lu=256,cu=null;if(null==cu){cu=[],au=0;var uu=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var hu=new Uint32Array(256);for(window.crypto.getRandomValues(hu),uu=0;uu<hu.length;++uu)cu[au++]=255&hu[uu]}var du=0,fu=function(e){if((du=du||0)>=256||au>=lu)window.removeEventListener?window.removeEventListener("mousemove",fu,!1):window.detachEvent&&window.detachEvent("onmousemove",fu);else try{var t=e.x+e.y;cu[au++]=255&t,du+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",fu,!1):window.attachEvent&&window.attachEvent("onmousemove",fu))}function pu(){if(null==ou){for(ou=new su;au<lu;){var e=Math.floor(65536*Math.random());cu[au++]=255&e}for(ou.init(cu),au=0;au<cu.length;++au)cu[au]=0;au=0}return ou.next()}var gu=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=pu()},e}();var mu=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],i=e.length-1;i>=0&&t>0;){var r=e.charCodeAt(i--);r<128?n[--t]=r:r>127&&r<2048?(n[--t]=63&r|128,n[--t]=r>>6|192):(n[--t]=63&r|128,n[--t]=r>>6&63|128,n[--t]=r>>12|224)}n[--t]=0;for(var s=new gu,o=[];t>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new Wc(n)}(e,t);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;for(var r=i.toString(16),s=r.length,o=0;o<2*t-s;o++)r="0"+r;return r},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16),this.d=qc(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,i,r,s,o,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=qc(e,16),this.e=parseInt(t,16),this.d=qc(n,16),this.p=qc(i,16),this.q=qc(r,16),this.dmp1=qc(s,16),this.dmq1=qc(o,16),this.coeff=qc(a,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new gu,i=e>>1;this.e=parseInt(t,16);for(var r=new Wc(t,16);;){for(;this.p=new Wc(e-i,1,n),0!=this.p.subtract(Wc.ONE).gcd(r).compareTo(Wc.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Wc(i,1,n),0!=this.q.subtract(Wc.ONE).gcd(r).compareTo(Wc.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(Wc.ONE),a=this.q.subtract(Wc.ONE),l=o.multiply(a);if(0==l.gcd(r).compareTo(Wc.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(l),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=qc(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),i=0;for(;i<n.length&&0==n[i];)++i;if(n.length-i!=t-1||2!=n[i])return null;++i;for(;0!=n[i];)if(++i>=n.length)return null;var r="";for(;++i<n.length;){var s=255&n[i];s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((31&s)<<6|63&n[i+1]),++i):(r+=String.fromCharCode((15&s)<<12|(63&n[i+1])<<6|63&n[i+2]),i+=2)}return r}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var i=new gu,r=e>>1;this.e=parseInt(t,16);var s=new Wc(t,16),o=this,a=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(Wc.ONE),i=o.q.subtract(Wc.ONE),r=t.multiply(i);0==r.gcd(s).compareTo(Wc.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(r),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(i),o.coeff=o.q.modInverse(o.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},l=function(){o.q=Kc(),o.q.fromNumberAsync(r,1,i,(function(){o.q.subtract(Wc.ONE).gcda(s,(function(e){0==e.compareTo(Wc.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(l,0)}))}))},c=function(){o.p=Kc(),o.p.fromNumberAsync(e-r,1,i,(function(){o.p.subtract(Wc.ONE).gcda(s,(function(e){0==e.compareTo(Wc.ONE)&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},e.prototype.sign=function(e,t,n){var i=function(e){return vu[e]||""}(n),r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,i="",r=0;r<n;r+=2)i+="ff";return qc("0001"+i+"00"+e,16)}(i+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var s=this.doPrivate(r);if(null==s)return null;var o=s.toString(16);return 0==(1&o.length)?o:"0"+o},e.prototype.verify=function(e,t,n){var i=qc(t,16),r=this.doPublic(i);return null==r?null:function(e){for(var t in vu)if(vu.hasOwnProperty(t)){var n=vu[t],i=n.length;if(e.substr(0,i)==n)return e.substr(i)}return e}
8
8
  /*!
9
9
  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
10
10
  Code licensed under the BSD License:
@@ -19,4 +19,4 @@ version: 2.9.0
19
19
  * @since jsrsasign 2.1
20
20
  * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
21
21
  */
22
- var wu={};void 0!==wu.asn1&&wu.asn1||(wu.asn1={}),wu.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",r=0;r<n;r++)i+="f";t=new Wc(i,16).xor(e).add(Wc.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=wu.asn1,n=t.DERBoolean,i=t.DERInteger,r=t.DERBitString,s=t.DEROctetString,o=t.DERNull,a=t.DERObjectIdentifier,l=t.DEREnumerated,c=t.DERUTF8String,u=t.DERNumericString,h=t.DERPrintableString,d=t.DERTeletexString,f=t.DERIA5String,p=t.DERUTCTime,g=t.DERGeneralizedTime,m=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,w=t.ASN1Util.newObject,b=Object.keys(e);if(1!=b.length)throw"key of param shall be only one.";var A=b[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+A+":"))throw"undefined key: "+A;if("bool"==A)return new n(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new r(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new a(e[A]);if("enum"==A)return new l(e[A]);if("utf8str"==A)return new c(e[A]);if("numstr"==A)return new u(e[A]);if("prnstr"==A)return new h(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new f(e[A]);if("utctime"==A)return new p(e[A]);if("gentime"==A)return new g(e[A]);if("seq"==A){for(var x=e[A],S=[],T=0;T<x.length;T++){var E=w(x[T]);S.push(E)}return new m({array:S})}if("set"==A){for(x=e[A],S=[],T=0;T<x.length;T++){E=w(x[T]);S.push(E)}return new v({array:S})}if("tag"==A){var D=e[A];if("[object Array]"===Object.prototype.toString.call(D)&&3==D.length){var C=w(D[2]);return new y({tag:D[0],explicit:D[1],obj:C})}var I={};if(void 0!==D.explicit&&(I.explicit=D.explicit),void 0!==D.tag&&(I.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return I.obj=w(D.obj),new y(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},wu.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),i=(t=Math.floor(n/40)+"."+n%40,""),r=2;r<e.length;r+=2){var s=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(i+=s.substr(1,7),"0"==s.substr(0,1))t=t+"."+new Wc(i,2).toString(10),i=""}return t},wu.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Wc(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);return i},wu.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},wu.asn1.DERAbstractString=function(e){wu.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},yu.lang.extend(wu.asn1.DERAbstractString,wu.asn1.ASN1Object),wu.asn1.DERAbstractTime=function(e){wu.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,n){var i=this.zeroPadding,r=this.localDateToUTC(e),s=String(r.getFullYear());"utc"==t&&(s=s.substr(2,2));var o=s+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2);if(!0===n){var a=r.getMilliseconds();if(0!=a){var l=i(String(a),3);o=o+"."+(l=l.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,i,r,s){var o=new Date(Date.UTC(e,t-1,n,i,r,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},yu.lang.extend(wu.asn1.DERAbstractTime,wu.asn1.ASN1Object),wu.asn1.DERAbstractStructured=function(e){wu.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},yu.lang.extend(wu.asn1.DERAbstractStructured,wu.asn1.ASN1Object),wu.asn1.DERBoolean=function(){wu.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},yu.lang.extend(wu.asn1.DERBoolean,wu.asn1.ASN1Object),wu.asn1.DERInteger=function(e){wu.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=wu.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Wc(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},yu.lang.extend(wu.asn1.DERInteger,wu.asn1.ASN1Object),wu.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=wu.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}wu.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var i="";for(n=0;n<e.length-1;n+=8){var r=e.substr(n,8),s=parseInt(r,2).toString(16);1==s.length&&(s="0"+s),i+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},yu.lang.extend(wu.asn1.DERBitString,wu.asn1.ASN1Object),wu.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=wu.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}wu.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},yu.lang.extend(wu.asn1.DEROctetString,wu.asn1.DERAbstractString),wu.asn1.DERNull=function(){wu.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},yu.lang.extend(wu.asn1.DERNull,wu.asn1.ASN1Object),wu.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Wc(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};wu.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(e){var t=wu.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},yu.lang.extend(wu.asn1.DERObjectIdentifier,wu.asn1.ASN1Object),wu.asn1.DEREnumerated=function(e){wu.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=wu.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Wc(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},yu.lang.extend(wu.asn1.DEREnumerated,wu.asn1.ASN1Object),wu.asn1.DERUTF8String=function(e){wu.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},yu.lang.extend(wu.asn1.DERUTF8String,wu.asn1.DERAbstractString),wu.asn1.DERNumericString=function(e){wu.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},yu.lang.extend(wu.asn1.DERNumericString,wu.asn1.DERAbstractString),wu.asn1.DERPrintableString=function(e){wu.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},yu.lang.extend(wu.asn1.DERPrintableString,wu.asn1.DERAbstractString),wu.asn1.DERTeletexString=function(e){wu.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},yu.lang.extend(wu.asn1.DERTeletexString,wu.asn1.DERAbstractString),wu.asn1.DERIA5String=function(e){wu.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},yu.lang.extend(wu.asn1.DERIA5String,wu.asn1.DERAbstractString),wu.asn1.DERUTCTime=function(e){wu.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},yu.lang.extend(wu.asn1.DERUTCTime,wu.asn1.DERAbstractTime),wu.asn1.DERGeneralizedTime=function(e){wu.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},yu.lang.extend(wu.asn1.DERGeneralizedTime,wu.asn1.DERAbstractTime),wu.asn1.DERSequence=function(e){wu.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},yu.lang.extend(wu.asn1.DERSequence,wu.asn1.DERAbstractStructured),wu.asn1.DERSet=function(e){wu.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},yu.lang.extend(wu.asn1.DERSet,wu.asn1.DERAbstractStructured),wu.asn1.DERTaggedObject=function(e){wu.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},yu.lang.extend(wu.asn1.DERTaggedObject,wu.asn1.ASN1Object);var bu,Au,xu,Su=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Tu=function(e){function t(n){var i=e.call(this)||this;return n&&("string"==typeof n?i.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&i.parsePropertiesFrom(n)),i}return Su(t,e),t.prototype.parseKey=function(e){try{var t=0,n=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?Pc(e):Oc.unarmor(e),r=zc.decode(i);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length){t=r.sub[1].getHexStringValue(),this.n=qc(t,16),n=r.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=r.sub[3].getHexStringValue();this.d=qc(s,16);var o=r.sub[4].getHexStringValue();this.p=qc(o,16);var a=r.sub[5].getHexStringValue();this.q=qc(a,16);var l=r.sub[6].getHexStringValue();this.dmp1=qc(l,16);var c=r.sub[7].getHexStringValue();this.dmq1=qc(c,16);var u=r.sub[8].getHexStringValue();this.coeff=qc(u,16)}else{if(2!==r.sub.length)return!1;if(r.sub[0].sub){var h=r.sub[1].sub[0];t=h.sub[0].getHexStringValue(),this.n=qc(t,16),n=h.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=r.sub[0].getHexStringValue(),this.n=qc(t,16),n=r.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new wu.asn1.DERInteger({int:0}),new wu.asn1.DERInteger({bigint:this.n}),new wu.asn1.DERInteger({int:this.e}),new wu.asn1.DERInteger({bigint:this.d}),new wu.asn1.DERInteger({bigint:this.p}),new wu.asn1.DERInteger({bigint:this.q}),new wu.asn1.DERInteger({bigint:this.dmp1}),new wu.asn1.DERInteger({bigint:this.dmq1}),new wu.asn1.DERInteger({bigint:this.coeff})]};return new wu.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Ic(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new wu.asn1.DERSequence({array:[new wu.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new wu.asn1.DERNull]}),t=new wu.asn1.DERSequence({array:[new wu.asn1.DERInteger({bigint:this.n}),new wu.asn1.DERInteger({int:this.e})]}),n=new wu.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new wu.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Ic(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var n="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(n,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n",e+="-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n",e+="-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(mu),Eu=void 0!==An?null===(bu=An.env)||void 0===bu?void 0:bu.npm_package_version:void 0,Du=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Tu(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(Bc(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return Ic(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,n){try{return Ic(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,Bc(t),n)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Tu,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Eu,e}(),Cu={},Iu={get exports(){return Cu},set exports(e){Cu=e}},Bu={};Au="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xu={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&xu.rotl(e,8)|4278255360&xu.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=xu.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,i=0;n<e.length;n++,i+=8)t[i>>>5]|=e[n]<<24-i%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var i=e[n]<<16|e[n+1]<<8|e[n+2],r=0;r<4;r++)8*n+6*r<=8*e.length?t.push(Au.charAt(i>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,i=0;n<e.length;i=++n%4)0!=i&&t.push((Au.indexOf(e.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|Au.indexOf(e.charAt(n))>>>6-2*i);return t}},{get exports(){return Bu},set exports(e){Bu=e}}.exports=xu;var Mu={utf8:{stringToBytes:function(e){return Mu.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(Mu.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},Pu=Mu,Ou=function(e){return null!=e&&(Ru(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Ru(e.slice(0,0))}(e)||!!e._isBuffer)};function Ru(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=Bu,t=Pu.utf8,n=Ou,i=Pu.bin,r=function(s,o){s.constructor==String?s=o&&"binary"===o.encoding?i.stringToBytes(s):t.stringToBytes(s):n(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),l=8*s.length,c=1732584193,u=-271733879,h=-1732584194,d=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[l>>>5]|=128<<l%32,a[14+(l+64>>>9<<4)]=l;var p=r._ff,g=r._gg,m=r._hh,v=r._ii;for(f=0;f<a.length;f+=16){var y=c,w=u,b=h,A=d;c=p(c,u,h,d,a[f+0],7,-680876936),d=p(d,c,u,h,a[f+1],12,-389564586),h=p(h,d,c,u,a[f+2],17,606105819),u=p(u,h,d,c,a[f+3],22,-1044525330),c=p(c,u,h,d,a[f+4],7,-176418897),d=p(d,c,u,h,a[f+5],12,1200080426),h=p(h,d,c,u,a[f+6],17,-1473231341),u=p(u,h,d,c,a[f+7],22,-45705983),c=p(c,u,h,d,a[f+8],7,1770035416),d=p(d,c,u,h,a[f+9],12,-1958414417),h=p(h,d,c,u,a[f+10],17,-42063),u=p(u,h,d,c,a[f+11],22,-1990404162),c=p(c,u,h,d,a[f+12],7,1804603682),d=p(d,c,u,h,a[f+13],12,-40341101),h=p(h,d,c,u,a[f+14],17,-1502002290),c=g(c,u=p(u,h,d,c,a[f+15],22,1236535329),h,d,a[f+1],5,-165796510),d=g(d,c,u,h,a[f+6],9,-1069501632),h=g(h,d,c,u,a[f+11],14,643717713),u=g(u,h,d,c,a[f+0],20,-373897302),c=g(c,u,h,d,a[f+5],5,-701558691),d=g(d,c,u,h,a[f+10],9,38016083),h=g(h,d,c,u,a[f+15],14,-660478335),u=g(u,h,d,c,a[f+4],20,-405537848),c=g(c,u,h,d,a[f+9],5,568446438),d=g(d,c,u,h,a[f+14],9,-1019803690),h=g(h,d,c,u,a[f+3],14,-187363961),u=g(u,h,d,c,a[f+8],20,1163531501),c=g(c,u,h,d,a[f+13],5,-1444681467),d=g(d,c,u,h,a[f+2],9,-51403784),h=g(h,d,c,u,a[f+7],14,1735328473),c=m(c,u=g(u,h,d,c,a[f+12],20,-1926607734),h,d,a[f+5],4,-378558),d=m(d,c,u,h,a[f+8],11,-2022574463),h=m(h,d,c,u,a[f+11],16,1839030562),u=m(u,h,d,c,a[f+14],23,-35309556),c=m(c,u,h,d,a[f+1],4,-1530992060),d=m(d,c,u,h,a[f+4],11,1272893353),h=m(h,d,c,u,a[f+7],16,-155497632),u=m(u,h,d,c,a[f+10],23,-1094730640),c=m(c,u,h,d,a[f+13],4,681279174),d=m(d,c,u,h,a[f+0],11,-358537222),h=m(h,d,c,u,a[f+3],16,-722521979),u=m(u,h,d,c,a[f+6],23,76029189),c=m(c,u,h,d,a[f+9],4,-640364487),d=m(d,c,u,h,a[f+12],11,-421815835),h=m(h,d,c,u,a[f+15],16,530742520),c=v(c,u=m(u,h,d,c,a[f+2],23,-995338651),h,d,a[f+0],6,-198630844),d=v(d,c,u,h,a[f+7],10,1126891415),h=v(h,d,c,u,a[f+14],15,-1416354905),u=v(u,h,d,c,a[f+5],21,-57434055),c=v(c,u,h,d,a[f+12],6,1700485571),d=v(d,c,u,h,a[f+3],10,-1894986606),h=v(h,d,c,u,a[f+10],15,-1051523),u=v(u,h,d,c,a[f+1],21,-2054922799),c=v(c,u,h,d,a[f+8],6,1873313359),d=v(d,c,u,h,a[f+15],10,-30611744),h=v(h,d,c,u,a[f+6],15,-1560198380),u=v(u,h,d,c,a[f+13],21,1309151649),c=v(c,u,h,d,a[f+4],6,-145523070),d=v(d,c,u,h,a[f+11],10,-1120210379),h=v(h,d,c,u,a[f+2],15,718787259),u=v(u,h,d,c,a[f+9],21,-343485551),c=c+y>>>0,u=u+w>>>0,h=h+b>>>0,d=d+A>>>0}return e.endian([c,u,h,d])};r._ff=function(e,t,n,i,r,s,o){var a=e+(t&n|~t&i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._gg=function(e,t,n,i,r,s,o){var a=e+(t&i|n&~i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._hh=function(e,t,n,i,r,s,o){var a=e+(t^n^i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._ii=function(e,t,n,i,r,s,o){var a=e+(n^(t|~i))+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._blocksize=16,r._digestsize=16,Iu.exports=function(t,n){if(null==t)throw new Error("Illegal argument "+t);var s=e.wordsToBytes(r(t,n));return n&&n.asBytes?s:n&&n.asString?i.bytesToString(s):e.bytesToHex(s)}}();var _u,ku,Lu={serialNums:[],key:"",verified:!0};class Nu{constructor(e){this.viewport=e,this.encryptInfo=Lu,_u.set(this,!0),ku.set(this,setTimeout((()=>{as(this,_u,!1,"f"),this.viewport.triggerRender()}),5e3))}verify(e,t){var n;clearTimeout(os(this,ku,"f"));const i=new Du;i.setPublicKey(null===(n=this.encryptInfo)||void 0===n?void 0:n.key);const r=i.verify(e,t,Cu);return as(this,_u,r,"f"),this.viewport.triggerRender(),r}getVerified(){return!!Lu.verified||os(this,_u,"f")}}_u=new WeakMap,ku=new WeakMap;class Uu{constructor(e,t){this.scene=e,this.signals=t;const n=document.createElement("div");n.style.position="absolute",n.style.left="12px",n.style.bottom="12px",n.style.fontSize="12px",n.style.color="#fff",n.style.pointerEvents="none",this.container=n,this.state={objects:0,vertices:0,triangles:0,frametime:0,lodFrametime:0}}addListeners(){const{scene:e,signals:t}=this;function n(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=document.createElement("span");return t&&(n.style.marginLeft="6px"),n.innerText=e,n}function i(){return document.createElement("br")}const r=n("0"),s=n("0"),o=n("0"),a=n("0"),l=n("0");this.container.appendChild(n("objects",!1)),this.container.appendChild(r),this.container.appendChild(i()),this.container.appendChild(n("triangles",!1)),this.container.appendChild(s),this.container.appendChild(i()),this.container.appendChild(n("vertices",!1)),this.container.appendChild(o),this.container.appendChild(i()),this.container.appendChild(n("frametime",!1)),this.container.appendChild(a),this.container.appendChild(i()),this.container.appendChild(n("lodFrametime",!1)),this.container.appendChild(l);const c=()=>{this.state.objects=0,this.state.vertices=0,this.state.triangles=0;for(let t=0;t<e.children.length;t++){e.children[t].traverse((e=>{var t,n,i,r;if("SceneManager"!==e.stype&&this.state.objects++,e.isMesh){const s=e.geometry;s.isGeometry?(this.state.vertices+=(null===(t=s.vertices)||void 0===t?void 0:t.length)||0,this.state.triangles+=(null===(n=s.faces)||void 0===n?void 0:n.length)||0):s.isBufferGeometry&&(this.state.vertices+=(null===(i=s.attributes.position)||void 0===i?void 0:i.count)||0,null!==s.index?this.state.triangles+=s.index.count/3:this.state.triangles+=(null===(r=s.attributes.position)||void 0===r?void 0:r.count)/3||0)}}))}r.innerText=String(this.state.objects),o.innerText=String(this.state.vertices),s.innerText=String(this.state.triangles)};t.objectAdded.add(c),t.objectRemoved.add(c),t.geometryChanged.add(c);t.sceneRendered.add((e=>{this.state.frametime=e,a.innerText=Number(e).toFixed(2)+" ms"}));t.loadRendered.add((e=>{this.state.lodFrametime=e,l.innerText=Number(e).toFixed(2)+" ms"}))}}const ju=new e.Vector4;class Fu extends e.Object3D{constructor(t,n){super();const i=new e.Color("#ff3653"),r=new e.Color("#8adb00"),s=new e.Color("#2c8fff"),o=new e.OrthographicCamera(-2,2,2,-2,0,4);o.position.set(0,0,2);const a=new e.BoxGeometry(.8,.05,.05).translate(.4,0,0),l=new e.Mesh(a,y(i)),c=new e.Mesh(a,y(r)),u=new e.Mesh(a,y(s));c.rotation.z=Math.PI/2,u.rotation.y=-Math.PI/2,this.add(l),this.add(u),this.add(c);const h=new e.Sprite(w(i,"X"));h.userData.type="posX";const d=new e.Sprite(w(r,"Y"));d.userData.type="posY";const f=new e.Sprite(w(s,"Z"));f.userData.type="posZ";const p=new e.Sprite(w(i));p.userData.type="negX";const g=new e.Sprite(w(r));g.userData.type="negY";const m=new e.Sprite(w(s));m.userData.type="negZ",h.position.x=1,d.position.y=1,f.position.z=1,p.position.x=-1,p.scale.setScalar(.8),g.position.y=-1,g.scale.setScalar(.8),m.position.z=-1,m.scale.setScalar(.8),this.add(h),this.add(d),this.add(f),this.add(p),this.add(g),this.add(m);const v=new e.Vector3;function y(t){return new e.MeshBasicMaterial({color:t,toneMapped:!1})}function w(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=document.createElement("canvas");i.width=64,i.height=64;const r=i.getContext("2d");if(!r)return;r.beginPath(),r.arc(32,32,16,0,2*Math.PI),r.closePath(),r.fillStyle=t.getStyle(),r.fill(),null!==n&&(r.font="24px Arial",r.textAlign="center",r.fillStyle="#000000",r.fillText(n,32,41));const s=new e.CanvasTexture(i);return new e.SpriteMaterial({map:s,toneMapped:!1})}this.render=function(e){this.quaternion.copy(t.quaternion).invert(),this.updateMatrixWorld(),v.set(0,0,1),v.applyQuaternion(t.quaternion),v.x>=0?(h.material.opacity=1,p.material.opacity=.5):(h.material.opacity=.5,p.material.opacity=1),v.y>=0?(d.material.opacity=1,g.material.opacity=.5):(d.material.opacity=.5,g.material.opacity=1),v.z>=0?(f.material.opacity=1,m.material.opacity=.5):(f.material.opacity=.5,m.material.opacity=1);const i=n.offsetWidth-128;e.clearDepth(),e.getViewport(ju),e.setViewport(i,0,128,128),e.render(this,o),e.setViewport(ju.x,ju.y,ju.z,ju.w)}}}const zu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAASwAAAABAAABLAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAZKADAAQAAAABAAAAKQAAAAAaAV+RAAAACXBIWXMAAC4jAAAuIwF4pT92AAACy2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbW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mrQve2gYMji0BQZ6VK2zfkpj9xDEqc7cTDRCq2c7H+ztUP/+UvdwBJkLqeTOTddLJ9jU1I6bMoq+MdKkxfpAr2iUe4EH3j/awrwO3IkRUntHFE4dWYP9VzWKbddp/D/Sg4TJ8O04InPO/HXIcpXV7+DwFGTMCxrsL7WV7CtcFn9VccDXPu1BZ0DHk7uHsF3pxhJ09+08H+DO59BRXh4GmjnQ/uhhFykoCUYMDO8E7R2tzxhKs8gztkbqr3BOOmBBnbMxzltlK8cLa+OriKV4cg8EkstwOnl8Q5yN6gXRjapIL6nsjx3tKDRXL1o9N/tI1IOuhGx9i6h379WeN/AG/pVWSijcXFfJ10owXn8eSD34qvOVuYwzX0EfiX8Uz8q/aOVdhxemkHsujVam/jmV7mXwv77/3zH/aPdtZ7c8mFSLevpuvkP4GzF2K83JGqPF5b3hpMAcG7JFPOXNS75E9nuM5j9x+P8Y+y27V7OPYnpJuSzlT63teSGPvjiSghZwi2ITxHH5yxOWXoKHMyE23Uj4/ubI1E5dA7H+8IXtnc1tmgodwgg7y2PUuw+V3YPvr/4Hc7NJHgsKd30iW88S3cae+fjCBju8GrMd0jm4FMKhVrpEWashiPfVvox/+/8IDGtvuZvf4f1azOqNpo8RwAAAAASUVORK5CYII=",Gu=100,Hu=41,Vu=new we,Wu=new l;class Yu extends M{get size(){var e;return null!==(e=this._size)&&void 0!==e?e:this.size=new h(100,100)}set size(e){this._size=e;const{x:t,y:n}=e,{camera:i,currViewport:r}=this;r.set(t*Math.random(),n*Math.random(),t,n),i.left=i.right=t/2,i.left=-i.left,i.top=i.bottom=n/2,i.bottom=-i.bottom,i.updateProjectionMatrix()}get velocity(){var e;return null!==(e=this._velocity)&&void 0!==e?e:this._velocity=this.direction.clone().multiplyScalar(this.speed)}set velocity(e){this._velocity=e}constructor(e){super(),this.viewport=e,this.fontSize=50,this.imageWidth=200,this.camera=new F(-1.6,1.6,.8,-.8,0,4),this.direction=(new h).random().normalize(),this.speed=2,this.currViewport=new we,this.lastRenderTime=0,this.autoRender=e=>{e-this.lastRenderTime>30&&this.render(),requestAnimationFrame(this.autoRender)},this.camera.position.z=2,this._generateMarkForImage()}_generateMark(){}_generateMarkForString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496];const t=Array.isArray(e)?String.fromCodePoint(...e):e,n=t.length,{fontSize:i}=this,r=i/4,s=2*r,{x:o,y:a}=this.size=new h(i*n+s,i+s),l=document.createElement("canvas");l.width=o,l.height=a;const c=l.getContext("2d");if(!c)return;const u=c.createLinearGradient(0,0,o,a);u.addColorStop(0,"#ff3653"),u.addColorStop(.5,"#8adb00"),u.addColorStop(1,"#2c8fff"),c.fillStyle=u,c.font=`bold ${i}px/1 serif`,c.fillText(t,r,a-1.5*r);const d=Wu.load(l.toDataURL()),f=new je({map:d,toneMapped:!1,transparent:!0}),p=new k(new Fe(o,a),f);this.add(p)}_generateMarkForImage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gu,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hu;const i=this.imageWidth,r=i*(n/t);this.size=new h(i,r);const s=Wu.load(e),o=new je({map:s,toneMapped:!1,transparent:!0}),a=new k(new Fe(i,r),o);this.add(a)}render(){const{renderer:e}=this.viewport;e.getViewport(Vu);const{width:t,height:n}=e.domElement,i=new h(t,n),{position:r,velocity:s}=function(e,t,n,i){i=null!=i?i:n.length();let{x:r,y:s}=e,{x:o,y:a}=n;r+=o,s+=a,(r+e.width>=t.x&&o>0||r<=0&&o<0)&&(o=-o*Math.random());(s+e.height>=t.y&&a>0||s<=0&&a<0)&&(a=-a*Math.random());const l=new h(o,a);l.normalize().multiplyScalar(i);const c=new h(e.x,e.y).add(l);return{position:c,velocity:l}}(this.currViewport,i,this.velocity,this.speed),o=this.currViewport;o.x=r.x,o.y=r.y,this.velocity=s,e.clearDepth(),e.setViewport(o.x,o.y,o.z,o.w),e.render(this,this.camera),e.setViewport(Vu.x,Vu.y,Vu.z,Vu.w)}}const Qu={needsUpdate:!1};let Xu=0,Zu=0;const Ku=e=>{e instanceof u&&e.dispose()};class qu{constructor(e){this.clock=new ze,this.raycaster=new Ge,this.sky=null,this.options=e,this.state={useFreq:1,enabledPostprocessing:!0,isPausedRender:!1,isDisposed:!1},this.signals={windowResize:new Ks,cameraObjectChange:new Ks,sceneChanged:new Ks,backgroundChanged:new Ks,beforeRender:new Ks,sceneRendered:new Ks,loadRendered:new Ks,tweenUpdate:new Ks,hover:new Ks,click:new Ks,dblClick:new Ks,rightClick:new Ks,mouseDown:new Ks,mouseMove:new Ks,mouseUp:new Ks,mouseWheel:new Ks,keyDown:new Ks,keyUp:new Ks,modelHover:new Ks,modelUnHover:new Ks,modelClick:new Ks,modelDblClick:new Ks,modelRightClick:new Ks,poiHover:new Ks,poiUnHover:new Ks,poiClick:new Ks,poiDblClick:new Ks,poiRightClick:new Ks,selectPosition:new Ks,sceneClick:new Ks,objectAdded:new Ks,objectRemoved:new Ks,objectChanged:new Ks,geometryChanged:new Ks,materialAdded:new Ks,materialChanged:new Ks,materialRemoved:new Ks,cameraChange:new Ks,outlineChange:new Ks,modelAnimation:new Ks,getSceneInfo:new Ks},this.scener=new eo(this.signals,this.state),this.scene=this.scener.scene,this.cameraManager=new Po(this),this.camera=this.cameraManager.currentCamera,this.rendererManager=new vo(this),this.container=this.rendererManager.container,this.interactiveContainer=this.rendererManager.interactiveContainer,this.renderer=this.rendererManager.renderer,this.rendererCSS3D=this.rendererManager.rendererCSS3D,this.rendererCSS2D=this.rendererManager.rendererCSS2D,this.pmremGenerator=new De(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.effectManager=new nc(this.renderer,this.scene,this.camera),this.effectComposer=this.effectManager.effectComposer,this.bvh=new rc(this),this.controls=new mc(this),this.info=new Uu(this.scene,this.signals),this.stats=new Ot,this.mixer=new He(this.scene),this.clipsSet=new Set,this.postUpdate=new Map,this.postRender=new Map,this.selectModel=null,this.selectPoi=null,this._loop=0,this.viewHelper=new Fu(this.camera,this.container),this.license=new Nu(this),this.waterMark=new Yu(this),this._initInfo(),this._initStats(),this._signalsEventListenr(),this._containerAddEventListener(this.container),this.animate(0)}_initInfo(){if(this.options.showInfo){this.info.addListeners();const{container:e}=this.info;e.style.zIndex="1",this.container.appendChild(e)}}_initStats(){if(this.options.showStats){const{dom:e}=this.stats;e.style.zIndex="1",this.container.appendChild(e),this.signals.sceneRendered.add((()=>{this.stats.update()}))}}setSSR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,intensity:n=1,exponent:i=1.75,distance:r=20,fade:s=0,roughnessFade:o=1,thickness:a=3.5,ior:l=1.75,maxRoughness:c=.1,maxDepthDifference:u=20,blend:h=.95,correction:d=1,correctionRadius:f=1,blur:p=1,blurKernel:g=1,blurSharpness:m=10,jitter:v=0,jitterRoughness:y=2,steps:w=20,refineSteps:b=10,missedRays:A=!1,useNormalMap:x=!0,useRoughnessMap:S=!0,resolutionScale:T=1,velocityResolutionScale:E=1}=e,{effectManager:D}=this,C=D.effectsMap.get(nc.CONSTANTS.ssrEffect);C.enabled!==t&&(C.enabled=t,D.effectsNeedsUpddate=!0);const{effect:I}=C;I.usingBoxProjectedEnvMap=!0,I.intensity=n,I.exponent=i,I.distance=r,I.fade=s,I.roughnessFade=o,I.thickness=a,I.ior=l,I.maxRoughness=c,I.maxDepthDifference=u,I.blend=h,I.correction=d,I.correctionRadius=f,I.blur=p,I.blurKernel=g,I.blurSharpness=m,I.jitter=v,I.jitterRoughness=y,I.steps=w,I.refineSteps=b,I.missedRays=A,I.useNormalMap=x,I.useRoughnessMap=S,I.resolutionScale=T,I.velocityResolutionScale=E,this.triggerRender()}setBloom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{enabled:n=!0,mipmapBlur:i=!0,radius:r=.85,intensity:s=3,threshold:o=1,smoothing:a=0,scalar:l=2,opacity:c=1,selection:u=[]}=e,{effectManager:h}=this,d=h.effectsMap.get(nc.CONSTANTS.bloomEffect);d.enabled!==n&&(d.enabled=n,h.effectsNeedsUpddate=!0);const{effect:f}=d;f.intensity=s;const{mipmapBlurPass:p,renderTarget:g}=f;p.enabled=i,p.radius=r;const m=f.uniforms.get("map");m&&(m.value=i?p.texture:g.texture),f.luminanceMaterial.threshold=o,f.luminanceMaterial.smoothing=a,f.blendMode.opacity.value=c,null===(t=f.luminanceMaterial.userData.bloomSelection)||void 0===t||t.forEach((e=>{e instanceof k&&e.material.color&&(e.material.toneMapped=!0,e.material.color.multiplyScalar(1/l))})),f.luminanceMaterial.userData.bloomSelection=[],n&&u.forEach((e=>{e.traverse((e=>{e instanceof k&&e.material.color&&(e.material.toneMapped=!1,e.material.color.multiplyScalar(l),f.luminanceMaterial.userData.bloomSelection.push(e))}))})),this.triggerRender()}setSSAO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,depthAwareUpsampling:n=!0,samples:i=32,rings:r=7,distanceThreshold:s=.02,distanceFalloff:o=.0025,rangeThreshold:a=3e-4,rangeFalloff:l=1e-4,luminanceInfluence:u=.7,minRadiusScale:h=.33,radius:d=.1,intensity:f=3,bias:p=.004,fade:g=.01,color:m=null,resolutionScale:v=1}=e,{effectManager:y}=this,w=y.passesMap.get(nc.CONSTANTS.normalPass),b=y.effectsMap.get(nc.CONSTANTS.ssaoEffect);b.enabled!==t&&(w.enabled=t,b.enabled=t,y.effectsNeedsUpddate=!0);const{effect:A}=b,{ssaoMaterial:x}=A;A.depthAwareUpsampling=n,A.luminanceInfluence=u,A.resolution.scale=v,A.intensity=f,x.samples=i,x.rings=r,x.distanceThreshold=s,x.distanceFalloff=o,x.proximityThreshold=a,x.proximityFalloff=l,x.minRadiusScale=h,x.fade=g,x.bias=p,x.radius=d,m&&(A.color=new c(m)),this.triggerRender()}setColorSpace(e){this.renderer.outputEncoding="sRGB"===e?ye:ve,this.signals.sceneChanged.dispatch()}setToneMapping(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:t="ACESFilmic",exposure:n=.8}=e,i={None:Ye,Linear:Qe,Reinhard:Xe,Cineon:Ze,ACESFilmic:We};this.renderer.toneMapping=i[t],this.renderer.toneMappingExposure=n,this.signals.sceneChanged.dispatch()}async setSphereSkyBackground(e){const t=await oi({file:e});Ku(this.scene.background),this.scene.background=t,this.signals.backgroundChanged.dispatch()}async setSkyBackground(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"];const n=await oi({path:e,file:t});Ku(this.scene.background),this.scene.background=n,this.signals.backgroundChanged.dispatch()}setBackgroundColor(e){Ku(this.scene.background),this.scene.background=new c(e),this.signals.backgroundChanged.dispatch()}setBackgroundColorAlpha(e,t){Ku(this.scene.background),this.scene.background=null,this.renderer.setClearColor(new c(e),t),this.signals.backgroundChanged.dispatch()}async setBackgroundImage(e){const t=await oi({file:e});t.mapping=Ve,this.scene.background=t,this.signals.backgroundChanged.dispatch()}setSky(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:n=!0,position:i={x:0,y:0,z:0},scalar:r=45e4,turbidity:s=10,rayleigh:o=3,elevation:a=2,azimuth:l=180,exposure:c=.6}=e;if(!n)return void this.closeSky();this.sky||(this.sky=new Rt,this.scene.add(this.sky)),this.sky.name="sky",this.sky.position.set(i.x,i.y,i.z),this.sky.scale.setScalar(r);const u=this.sky.material.uniforms;u.turbidity.value=s,u.rayleigh.value=o,u.mieCoefficient.value=.005,u.mieDirectionalG.value=.7;const h=new t,d=ti(90-a),f=ti(l);return h.setFromSphericalCoords(1,d,f),u.sunPosition.value.copy(h),this.sky.userData.toneMapping=this.renderer.toneMapping,this.sky.userData.toneMappingExposure=this.renderer.toneMappingExposure,this.renderer.toneMapping=We,this.renderer.toneMappingExposure=c,this.signals.objectAdded.dispatch(),this.sky}closeSky(){if(!this.sky)return!1;const{toneMapping:e,toneMappingExposure:t}=this.sky.userData;return this.renderer.toneMapping=e,this.renderer.toneMappingExposure=t,this.sky.removeFromParent(),this.sky=null,this.signals.objectRemoved.dispatch(),!0}screenshot(){return new Promise((e=>{this.renderer.domElement.toBlob((t=>{e(t)}))}))}async setEnvironment(e){if(e){const{path:t,file:n,background:i}=e,r=await oi({path:t,file:n});this.scene.environment=r,i&&(Ku(this.scene.background),this.scene.background=r)}else this.scene.environment=this.pmremGenerator.fromScene(new Pt,.04).texture;return this.signals.sceneChanged.dispatch(),this.scene.environment}playModelAnimation(e,t){let n;if(t instanceof C?n=t:Di(t)?n=e.animations[t]:Bi(t)&&(n=e.animations.find(t)),!n)return;const i=zr(this.mixer.clipAction(n,e));return i.play(),this.clipsSet.add(n),i}stopModelAnimation(e,t){var n;let i;t instanceof C?i=t:Di(t)?i=e.animations[t]:Bi(t)&&(i=e.animations.find(t)),i&&(null===(n=this.mixer.existingAction(i,e))||void 0===n||n.stop(),this.mixer.uncacheAction(i,e),this.clipsSet.delete(i))}async render(e){return await(null==e?void 0:e()),new Promise((e=>{this.signals.sceneRendered.addOnce(e),this.triggerRender()}))}triggerRender(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.state.useFreq=e}async setPauseRender(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.state.isPausedRender=e,!1===e)return this.render()}_passesObserver(){this.effectManager.updateEffectPass()}autoRender(e){if(this.state.useFreq<=0&&!Qu.needsUpdate)return;if(this.state.useFreq>0&&this.state.useFreq--,Qu.needsUpdate&&(Qu.needsUpdate=!1),this.state.isPausedRender)return;Xu=performance.now(),this.signals.beforeRender.dispatch(),this._passesObserver(),this.state.enabledPostprocessing?this.effectComposer.render():(this.renderer.clear(),this.renderer.render(this.scene,this.camera));const t=this.scene.matrixWorldAutoUpdate;this.scene.matrixWorldAutoUpdate=!1,this.rendererCSS2D&&this.rendererManager.internalOptions.enableRenderCss2D&&this.rendererCSS2D.render(this.scene,this.camera),this.rendererCSS3D&&this.rendererManager.internalOptions.enableRenderCss3D&&this.rendererCSS3D.render(this.scene,this.camera),this.scene.matrixWorldAutoUpdate=t,this.options.showViewHelper&&this.camera===this.cameraManager.mainCamera&&this.viewHelper.render(this.renderer),this.license.getVerified()||this.waterMark.render(),this.postRender.forEach((t=>t(e))),Zu=performance.now(),this.signals.sceneRendered.dispatch(Zu-Xu)}animate(e){this._loop=requestAnimationFrame((e=>{this.animate(e)}));const t=this.clock.getDelta();this.clipsSet.size>0&&(this.mixer.update(t),this.signals.modelAnimation.dispatch()),Ln.update()&&this.signals.tweenUpdate.dispatch(),this.postUpdate.forEach((t=>t(e))),this.autoRender(e),this.signals.getSceneInfo.dispatch(this.info.state)}getOffsetByPosition(e){const n=new t(e.x,e.y,e.z).project(this.camera),i=this.renderer.domElement.getBoundingClientRect();return{left:Math.round(i.left+i.width/2*(n.x+1)),top:Math.round(i.top+i.height/2*(1-n.y))}}getPositionByOffset(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;const i=new t(0,0,0),r=new t(0,0,0),s=this.renderer.domElement.getBoundingClientRect();r.set(e.offsetX/s.width*2-1,-e.offsetY/s.height*2+1,n),r.unproject(this.camera),r.sub(this.camera.position).normalize();const o=r.distanceTo(this.camera.position);return i.copy(this.camera.position).add(r.multiplyScalar(o)),i}getIntersects(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scener.intersectsList.getAll(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{isFilterHideObject:i=!0}=n,r=this.container.getBoundingClientRect();let s={offsetX:0,offsetY:0};if(e instanceof MouseEvent)s={offsetX:e.clientX-r.left,offsetY:e.clientY-r.top};else if(e instanceof TouchEvent){const t=e.changedTouches[0];s={offsetX:t.clientX-r.left,offsetY:t.clientY-r.top}}else s=e;const o=new h;o.set(s.offsetX/r.width*2-1,-s.offsetY/r.height*2+1),this.raycaster.setFromCamera(o,this.camera);let a=[];return a=Ci(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0),i?a.filter((e=>{let{object:t}=e;return ri(t)})):a}rayClash(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.camera.position,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t(0,-1,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.scener.intersectsList.meshOfModelList;const r=new Ge;return r.set(e,n),Ci(i)?r.intersectObjects(i,!0):r.intersectObject(i,!0)}setHoverEnabled(e){this.options.hoverEnabled=e}clearSignals(){for(const e in this.signals)this.signals[e].removeAll()}dispose(){cancelAnimationFrame(this._loop),this.bvh.dispose(),this.mixer.stopAllAction(),this.clipsSet.forEach((e=>{this.mixer.uncacheAction(e),this.mixer.uncacheClip(e)})),this.mixer.uncacheRoot(this.scene),this.clipsSet.clear(),this.controls.dispose(),Ln.removeAll(),this.clearSignals(),this.scene.clear(),this.pmremGenerator.dispose(),this.effectComposer.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.container.remove(),this.state.isDisposed=!0}_signalsEventListenr(){const e=()=>{const{offsetWidth:e,offsetHeight:t}=this.container;this.effectManager.updateCamera(this.camera),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.effectComposer.setSize(e,t),this.rendererCSS3D&&this.rendererCSS3D.setSize(e,t),this.rendererCSS2D&&this.rendererCSS2D.setSize(e,t),this.triggerRender()};setTimeout((()=>e())),this.signals.windowResize.add(e),this.signals.cameraObjectChange.add(e),this.signals.sceneChanged.add((()=>this.triggerRender())),this.signals.backgroundChanged.add((()=>this.triggerRender())),this.signals.objectAdded.add((()=>this.triggerRender())),this.signals.objectRemoved.add((()=>this.triggerRender())),this.signals.objectChanged.add((()=>this.triggerRender())),this.signals.materialAdded.add((()=>this.triggerRender())),this.signals.materialRemoved.add((()=>this.triggerRender())),this.signals.materialChanged.add((()=>this.triggerRender())),this.signals.geometryChanged.add((()=>this.triggerRender())),this.signals.cameraChange.add((()=>this.triggerRender())),this.signals.tweenUpdate.add((()=>this.triggerRender())),this.signals.modelAnimation.add((()=>this.triggerRender()));this.signals.outlineChange.add((e=>{const{objects:t,options:n}=e,{color:i,hideColor:r,edgeThickness:s,edgeStrength:o}=Object.assign(Object.assign({},{color:16777215,hideColor:10066329,edgeThickness:3,edgeStrength:10}),n),{effectManager:a}=this,l=a.effectsMap.get(nc.CONSTANTS.outlineEffect),c=t.length>0;l.enabled!==c&&(l.enabled=c,a.effectsNeedsUpddate=!0);const{effect:u}=l,{uniforms:h}=u,d=[];t.forEach((e=>{e.traverse((e=>{e instanceof k&&d.push(e)}))})),u.selection.set(d),u.blur=s>0,u.blurPass.kernelSize=s;const f=h.get("visibleEdgeColor"),p=h.get("hiddenEdgeColor"),g=h.get("edgeStrength");f&&f.value.set(i),p&&p.value.set(r),g&&(g.value=o),this.triggerRender()}))}_containerAddEventListener(e){const t=[0,0];let n=null;const i=r=>{var s,o;this.signals.mouseUp.dispatch(r);const a=r.offsetX-(null!==(s=null==n?void 0:n.offsetX)&&void 0!==s?s:0),l=r.offsetY-(null!==(o=null==n?void 0:n.offsetY)&&void 0!==o?o:0);if(Math.abs(a)>2||Math.abs(l)>2)return t[0]=0,void(t[1]=0);setTimeout((()=>{0!==t[0]&&0===t[1]&&(0===r.button?(this.signals.click.dispatch(r),this._triggerSceneEventInAllObject("click",r)):2===r.button&&(this.signals.rightClick.dispatch(r),this._triggerSceneEventInAllObject("rightClick",r))),t[0]=0,t[1]=0}),300),e.removeEventListener("mouseup",i,!1)};let r=!1,s=null,o=null;const a=[0,0],l=e=>{var t,n;s&&clearTimeout(s);const i=()=>{r=!1,a[0]=0,a[1]=0},l=e.changedTouches[0].clientX-(null!==(t=null==o?void 0:o.changedTouches[0].clientX)&&void 0!==t?t:0),c=e.changedTouches[0].clientY-(null!==(n=null==o?void 0:o.changedTouches[0].clientY)&&void 0!==n?n:0);Math.abs(l)>2||Math.abs(c)>2?i():r?(i(),this.signals.rightClick.dispatch(e),this._triggerSceneEventInAllObject("rightClick",e)):setTimeout((()=>{0!==a[0]&&0===a[1]?(this.signals.click.dispatch(e),this._triggerSceneEventInAllObject("click",e)):0!==a[0]&&0!==a[1]&&a[1]-a[0]<=300&&(this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)),i()}),300)};e.addEventListener("mousedown",(r=>{n=r,this.signals.mouseDown.dispatch(r),0===t[0]?t[0]=performance.now():0===t[1]&&(t[1]=performance.now()),e.addEventListener("mouseup",i,!1)}),!1),e.addEventListener("mousemove",(e=>{this.signals.mouseMove.dispatch(e),this.options.hoverEnabled&&this._triggerSceneEventInAllObject("hover",e)}),!1),e.addEventListener("dblclick",(e=>{this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)}),!1),e.addEventListener("wheel",(e=>{this.signals.mouseWheel.dispatch(e)}),{passive:!0}),e.addEventListener("touchstart",(t=>{0===a[0]?a[0]=performance.now():0===a[1]&&(a[1]=performance.now()),o=t,s&&clearTimeout(s),s=window.setTimeout((()=>{r=!0}),800),e.addEventListener("touchend",l,{once:!0})}),{passive:!0}),e.addEventListener("contextmenu",(e=>e.preventDefault()),!1),document.addEventListener("keydown",(e=>{this.signals.keyDown.dispatch(e)}),!1),document.addEventListener("keyup",(e=>{this.signals.keyUp.dispatch(e)}),!1)}_triggerSceneEventInAllObject(e,t){const n=this.getIntersects(t,this.scener.intersectsList.getAll());if(0===n.length)return this.selectModel&&this.signals.modelHover.numListeners>0&&this.signals.modelUnHover.dispatch(this.selectModel),this.selectPoi&&this.signals.poiHover.numListeners>0&&this.signals.poiUnHover.dispatch(this.selectPoi),this.selectModel=null,this.selectPoi=null,void this.signals.sceneClick.dispatch({type:e,event:t});const i={object:null,type:null,point:null},r=[],s=[];function o(e){return e.parent?"Model"===e.parent.stype?e.parent:o(e.parent):void 0}n.forEach((e=>{if(e.object.parent instanceof ah){const t=e.object.parent;i.object||(i.type="Poi",i.object=e.object,i.point=e.point);-1===r.findIndex((e=>e.poi.uuid===t.uuid))&&r.push({poi:t,sourceData:e})}else if(e.object instanceof M){const t=o(e.object);t&&(i.object||(i.type="Model",i.object=e.object,i.point=e.point),s.push({model:t,sourceData:e}))}})),"click"===e&&i.point&&this.signals.selectPosition.dispatch(i.point);const a=e.slice(0,1).toUpperCase()+e.slice(1),l=e=>{var n;const{model:r}=e[0];if(r)if("Hover"===a)(null===(n=this.selectModel)||void 0===n?void 0:n.uuid)!==r.uuid&&(this.signals.modelHover.dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),this.selectModel=r);else{let n=null;"Click"===a?(n=r.onClick,r.dispatchEvent({type:"click"})):"RightClick"===a?(n=r.onRightClick,r.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(n=r.onDblClick,r.dispatchEvent({type:"dblClick"})),n?n(r):r.isEventPropagation=!0,r.isEventPropagation&&(this.signals[`model${a}`].dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),r.isEventPropagation=!1)}},c=e=>{var n;const{poi:i}=e[0];if(i)if("Hover"===a)(null===(n=this.selectPoi)||void 0===n?void 0:n.uuid)!==i.uuid&&(this.signals.poiHover.dispatch({target:i,event:t}),this.selectPoi=i);else{let e=null;"Click"===a?(e=i.onClick,i.dispatchEvent({type:"click"})):"RightClick"===a?(e=i.onRightClick,i.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(e=i.onDblClick,i.dispatchEvent({type:"dblClick"})),e?e(i):i.isEventPropagation=!0,i.isEventPropagation&&(this.signals[`poi${a}`].dispatch({target:i,event:t}),i.isEventPropagation=!1)}};if("Hover"===a){if(s.length>0){const[{model:e}]=s;this.selectModel&&this.selectModel.uuid!==e.uuid&&(this.signals.modelUnHover.dispatch(this.selectModel),this.selectModel=null)}if(r.length>0){const[{poi:e}]=r;this.selectPoi&&this.selectPoi.uuid!==e.uuid&&(this.signals.poiUnHover.dispatch(this.selectPoi),this.selectPoi=null)}}"Model"===i.type?l(s):"Poi"===i.type&&c(r)}}class Ju extends k{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"BaseMesh";super(t,n);const{id:r,name:s="",level:o={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:u={x:1,y:1,z:1},userData:h={}}=e;if(void 0===r)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=r,this.name=s,this.stype=i,this.level=o,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(u.x,u.y,u.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=h,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,Qu.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,Qu.needsUpdate=!0}setMove(e,t,n,i){return Li(this.position,Kn(e),t,n,i)}setRotate(e,t,n,i){const s=qn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Li({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Li(this.scale,Kn(e),t,n,i)}getBoundingBox(){return Jn(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new Ju({id:`clone_${Oi()}`},this.geometry,this.material).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry,this.material=e.material,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof eh||e.children[t]instanceof Ju?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}const $u={onLoad:null,onClick:null,onDblClick:null,onRightClick:null};class eh extends M{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BaseObject3D";super();const{id:n,name:i="",level:r={max:null,min:null},visible:s=!0,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={},onLoad:u,onClick:h,onDblClick:d,onRightClick:f}=Object.assign(Object.assign({},$u),e);if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=i,this.stype=t,this.level=r,this.visible=null==s||s,this.handleHide=!s,this.isEventPropagation=!1,this.position.set(o.x,o.y,o.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=c,this.autoUpdate=!1,this.onLoad=(null==u?void 0:u.bind(this))||null,this.onClick=(null==h?void 0:h.bind(this))||null,this.onDblClick=(null==d?void 0:d.bind(this))||null,this.onRightClick=(null==f?void 0:f.bind(this))||null}eventPropagation(){this.isEventPropagation=!0}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,Qu.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,Qu.needsUpdate=!0}setMove(e,t,n,i){return Li(this.position,Kn(e),t,n,i)}setRotate(e,t,n,i){const s=qn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Li({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Li(this.scale,Kn(e),t,n,i)}sClone(e){return new eh({id:`clone_${Oi()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),this.animations=e.animations,!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof eh||n instanceof Ju?this.add(n.sClone()):this.add(n.clone())}return this}getBoundingBox(){return Jn(this)}getSpaceAttribute(){return ni(this,!(arguments.length>0&&void 0!==arguments[0])||arguments[0])}syncSpaceAttribute(e){e instanceof eh?ii(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]):Zn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!")}}class th extends eh{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof eh&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof eh&&e.hide()}))}}class nh extends eh{constructor(e){super(e,"PluginObject")}}class ih extends eh{constructor(e){super(e,"PoiNode");const{type:t,element:n,elementAutoDisplay:i=!0,occlude:r=!1,onChange:s}=e;this.elementType=t,this.element=n,this.elementAutoDisplay=i,this.occlude=r,this.onChange=s,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}_create2D(){this.add(new to(this.element))}_create2DHalf(){this.add(new fo(this.element))}_create3D(){this.add(new ho(this.element))}}class rh extends eh{constructor(e){super(e,"Model");const{format:t}=e;this.formatType=t}setEnvMap(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};oi({path:e,file:arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]}).then((e=>{this.traverse((n=>{if(n instanceof k&&n.material instanceof U){const{reflectivity:i=.5}=t;n.material.envMap=e,n.material.envMapIntensity=i,Qu.needsUpdate=!0}}))}))}sClone(e){return new rh({id:`${this.sid}_clone`,url:"",format:this.formatType}).sCopy(this,e)}}const sh={position:{x:0,y:0,z:0},scale:{x:16,y:16,z:1},stype:"Icon"};class oh extends Ke{constructor(e,t){super(e);const{position:n,scale:i,stype:r}=Object.assign(Object.assign({},sh),t);this.stype=r,this.position.set(n.x,n.y,n.z),this.scale.set(i.x,i.y,i.z),this.renderOrder=1}}class ah extends eh{constructor(e,t){super(t,"Poi");const{name:n,type:i="2.5d",nameScale:r={x:16,y:16,z:1}}=t;this.iconType=i,this.icon=this._createIcon(e);const s={position:{x:0,y:10,z:0},name:n,scale:r};this.text=this.name?this._createText(s):null,this.renderOrder=11}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}sClone(e,t){return new ah(this.icon.material,{id:`${this.sid}_clone`,url:"",type:null!=t?t:this.iconType,name:this.name}).sCopy(this,e)}_createIcon(e){const t=new oh(this._computeMaterialSizeAttenuation(e));return this.add(t),t}_createText(e){const t=this._createTextMaterial(e),n=new oh(this._computeMaterialSizeAttenuation(t),e);return this.add(n),n}_createTextMaterial(e){const t=this._createTextCanvas(e.name||""),n=new u(t);n.flipY=!0,n.version+=1;return new qe({map:n,depthTest:!0})}_createTextCanvas(e,t){const n=256,i=document.createElement("canvas");i.width=n,i.height=n;const r=i.getContext("2d"),{fontFamily:s,fontSize:o,color:a,textAlign:l,textBaseline:c}=Object.assign(Object.assign({},{fontFamily:"Microsoft YaHei",fontSize:32,color:"#fff",textAlign:"center",textBaseline:"bottom"}),t);return r&&(r.save(),r.font=o+"px "+s,r.textAlign=l,r.textBaseline=c,r.shadowColor="black",r.strokeStyle="black",r.lineWidth=3,r.fillStyle=a,r.strokeText(e,128,128),r.fillText(e,128,128),r.restore()),i}_computeMaterialSizeAttenuation(e){return"2D"===this.iconType||"2d"===this.iconType?e.sizeAttenuation=!1:"2.5D"!==this.iconType&&"2.5d"!==this.iconType||(e.sizeAttenuation=!0),e}}class lh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Point";const{radius:n=10,color:i=16777215,opacity:r=1,gradient:s}=e;super(e,function(e){return new Je(e,32,32)}(n),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,map:ai(n)})}(i,r,s),t)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&(this.geometry=new Je(i,32,32)),r&&this.position.copy(Kn(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}class ch extends lh{constructor(e){super(e,"Node"),this.graphs=e.graphs}}class uh extends Ju{constructor(e){const{radius:t=50,color:n=16777215,opacity:i=1,gradient:r}=e;super(e,function(e){return new $e(e,64)}(t),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,side:he,map:ai(n)})}(n,i,r),"Circle"),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&(this.geometry=new $e(i,64)),r&&this.position.copy(Kn(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}const hh=new Map,dh=new g([0,0,1,0,1,1,1,1,0,1,0,0],2);class fh extends Ju{constructor(e){const{start:t,end:n,imgUrl:i,color:r,transparent:s=!1,passable:o=0,restrict:a=0}=e;super(e,void 0,void 0,"Link"),this.params=e,this.geometry=new p,this.material=new U({side:he}),this.passable=0,this.restrict=0,this.geometry.setAttribute("uv",dh),this.material.color.set(r),this.material.transparent=s,this.material.depthWrite=!s,this.material.flatShading=!0;const l=this.createTexture(i);l&&(this.material.map=l),this.updateGeometry({start:t,end:n}),this.passable=o,this.restrict=a,this.addEventListener("removed",(()=>{this.geometry.dispose(),this.material.dispose(),null==l||l.dispose()}))}updateGeometry(e){Object.assign(this.params,e),this.computeVertex();const t=this.material.map;t&&this.computeTextureRepeat(t)}computeVertex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new t(0,1,0);const{start:n,end:i,width:r}=this.params,s=Kn(n),o=Kn(i),a=r/2,l=new t,c=new t;l.subVectors(o,s),l.normalize(),c.crossVectors(l,e),0===c.length()&&c.crossVectors(l,new t(0,0,-1));const u=new t(c.x*a,c.y*a,c.z*a),h=new t(-c.x*a,-c.y*a,-c.z*a),d=new t;d.addVectors(s,u);const f=new t;f.addVectors(s,h);const p=new t;p.addVectors(o,h);const m=new t;m.addVectors(o,u),this.geometry.setAttribute("position",new g([d.x,d.y,d.z,f.x,f.y,f.z,p.x,p.y,p.z,p.x,p.y,p.z,m.x,m.y,m.z,d.x,d.y,d.z],3))}computeTextureRepeat(e){if(e.image){const{start:t,end:n,width:i}=this.params,r=Kn(t),s=Kn(n),o=r.distanceTo(s)/(i*(e.image.height/e.image.width));e.repeat.set(1,o)}}createTexture(e){if(e){const t=hh.get(e);if(t){return t.clone()}const n=(new l).load(e,(()=>{n.wrapS=ne,n.wrapT=ne,this.computeTextureRepeat(n),hh.set(e,n),Qu.needsUpdate=!0}));return n}}}class ph extends eh{constructor(e){super(e,"Topology"),this.nodes=[],this.links=[],this.linksImgAnimation=null;const{type:t="line"}=e;this.topologyType=t,this.info=e,this.create(),this.addEventListener("removed",(()=>{var e;null===(e=this.linksImgAnimation)||void 0===e||e.stop(),this.linksImgAnimation=null}))}create(){var e,t;const{nodes:n,renderLink:i=!0,linkWidth:r=20,linkColor:s=65280,renderNode:o=!0,nodeColor:a=255,nodeRadius:l=r/2,imgUrl:c,animation:u=!1}=this.info,h=[];for(const u of n){const n=this.createNode(Object.assign(Object.assign({},u),{radius:l,color:a}));if(!1===o&&n.hide(),this.nodes.push(n),!c&&i){const n=Ci(s)?s[null===(e=u.graphs[0])||void 0===e?void 0:e.passable]?s[null===(t=u.graphs[0])||void 0===t?void 0:t.passable]:s[0]:s;!o&&this.createCircle({id:`${u.id}_circle`,name:`${u.name||u.id}_circle`,position:u.position,radius:r/2,color:n})}if(i)for(let e=0;e<u.graphs.length;e++){const{linkInfo:t,targetNodeId:n,passable:i,restrict:o}=u.graphs[e],{id:a,name:l}=t,d=this.info.nodes.find((e=>e.id===n));if(!h.includes(a)&&d){h.push(a);const e=Ci(s)?s[i]?s[i]:s[0]:s,t=this.createLink({id:a,name:l,start:u.position,end:d.position,width:r,color:e,imgUrl:c,transparent:!!c,passable:i,restrict:o,userData:{startNodeId:u.id,endNodeId:d.id}});this.links.push(t)}}}this.updateLinksImgAnimation({imgUrl:c,animation:u})}createNode(e){const t=new ch(Object.assign({},e));return this.add(t),t}createCircle(e){const t=new uh(Object.assign(Object.assign({},e),{rotation:{x:Math.PI/2,y:0,z:0}}));return this.add(t),t}createLink(e){const t=new fh(Object.assign({},e));return this.add(t),t}updateLinksImgAnimation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{imgUrl:n,animation:i}=e;if(n&&!this.linksImgAnimation){let e=null;Ei(i)&&i?e={repeat:!0,duration:500}:Ii(i)&&Di(i.duration)&&i.duration>0&&(e=Object.assign({repeat:!0},i)),e&&Li(new h(0,0),new h(0,-1),e,(e=>{this.links.forEach((t=>{var n;null===(n=t.material.map)||void 0===n||n.offset.copy(e)}))}),(e=>{var t;null===(t=this.linksImgAnimation)||void 0===t||t.stop(),this.linksImgAnimation=e})).catch((()=>{}))}n||(null===(t=this.linksImgAnimation)||void 0===t||t.stop(),this.linksImgAnimation=null)}resetNodes(e){const{renderLink:t=!0,linkWidth:n=20,linkColor:i=65280,nodeColor:r=255,nodeRadius:s=n/2,imgUrl:o,animation:a=!1}=this.info,l=[...this.info.nodes];this.info.nodes=[...e];const c=[];for(let t=0;t<l.length;t++){const n=e.find((e=>e.id===l[t].id));n&&Kn(n.position).equals(Kn(l[t].position))||c.push(l[t])}for(let e=0;e<c.length;e++){const t=this.nodes.findIndex((t=>c[e].id===t.sid));this.remove(this.nodes[t]),this.nodes.splice(t,1)}const u=[];for(let t=0;t<e.length;t++){const n=l.find((n=>n.id===e[t].id));n&&Kn(n.position).equals(Kn(e[t].position))||u.push(e[t])}for(let e=0;e<u.length;e++){const t=this.createNode(Object.assign(Object.assign({},u[e]),{radius:s,color:r}));this.nodes.push(t)}const h=new Map,d=new Map;this.info.nodes.forEach((e=>{d.set(e.id,e)}));const f=[...this.links];for(const r of e)if(t)for(let e=0;e<r.graphs.length;e++){const{linkInfo:t,targetNodeId:s,passable:a,restrict:l}=r.graphs[e],{id:c,name:u}=t,p=d.get(s);if(!h.has(c)&&p){h.set(c,c);const e=Ci(i)?i[a]?i[a]:i[0]:i,t={id:c,name:u,start:r.position,end:p.position,width:n,color:e,imgUrl:o,transparent:!!o,passable:a,restrict:l},s=f.find((e=>e.sid===c));if(s)s.updateGeometry({start:t.start,end:t.end});else{const e=this.createLink(t);this.links.push(e)}}}f.forEach((e=>{if(!1===h.has(e.sid)){const t=this.links.findIndex((t=>t===e));t>-1&&(e.removeFromParent(),this.links.splice(t,1))}})),this.updateLinksImgAnimation({imgUrl:o,animation:a})}getLength(){let e=0;for(let t=1;t<this.nodes.length;t++)e+=this.nodes[t].position.distanceTo(this.nodes[t-1].position);return e}}function gh(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t(0,1,0);const r=n/2,s=new p;let o=[],a=[];if(e.length<2)return s;for(let n=0;n<e.length-1;n++){const s=Kn(e[n]),l=Kn(e[n+1]),c=new t,u=new t;c.subVectors(l,s),c.normalize(),u.crossVectors(c,i);const h=new t(u.x*r,u.y*r,u.z*r),d=new t(-u.x*r,-u.y*r,-u.z*r),f=new t;f.addVectors(s,h);const p=new t;p.addVectors(s,d);const g=new t;g.addVectors(l,d);const m=new t;m.addVectors(l,h),o=[...o,f.x,f.y,f.z,p.x,p.y,p.z,g.x,g.y,g.z,g.x,g.y,g.z,m.x,m.y,m.z,f.x,f.y,f.z],a=[...a,0,0,1,0,1,1,1,1,0,1,0,0]}return s.setAttribute("position",new g(o,3)),s.setAttribute("uv",new g(a,2)),s}class mh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Line";const{points:n,width:i=20,color:r=16777215,opacity:s=1,gradient:o}=e;super(e,gh(n,i),function(e,t,n){return new U({color:e,side:he,transparent:t<1,opacity:t,map:ai(n),flatShading:!0})}(r,s,o),t),this.params=e,this.points=n,this.frustumCulled=!1}setOptions(e){var t;const{color:n,opacity:i,points:r,width:s,gradient:o}=e;this.points=r;const a=this.material;n&&(a.color=new c(n)),i&&(a.opacity=i),o&&(a.map=ai(o)),r&&s?this.geometry=gh(r,s):r?this.geometry=gh(r,null!==(t=this.params.width)&&void 0!==t?t:20):s&&(this.geometry=gh(this.points,s)),a.needsUpdate=!0,Qu.needsUpdate=!0}}function vh(e){const t=[];for(let n=0;n<e.length;n++)t.push(new h(e[n].x,e[n].z));return t.length>2?new et(new tt(t)):new p}class yh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Polygon";const{yHeight:n,points:i,color:r=16777215,opacity:s=1,gradient:o}=e;super(e,vh(i),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,side:he,map:ai(n)})}(r,s,o),t),this.points=i,this.position.set(0,n,0),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,yHeight:i,points:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&this.position.set(0,i,0),r&&(this.geometry=vh(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}class wh extends eh{constructor(e){super(e,"Canvas3D"),this.create(e)}create(e){const{points:t=[],lines:n=[],polygons:i=[],circles:r=[]}=e;for(let e=0;e<t.length;e++)this.createPoint(t[e]);for(let e=0;e<n.length;e++)this.createLine(n[e]);for(let e=0;e<i.length;e++)this.createPolygon(i[e]);for(let e=0;e<r.length;e++)this.createCircle(r[e])}createPoint(e){const t=new lh(e);return this.add(t),Qu.needsUpdate=!0,t}getPoint(e){return this.getChildForType("Point",e)}removePoint(e){const t=this.getPoint(e);t&&this.remove(t),Qu.needsUpdate=!0}createLine(e){const t=new mh(e);return this.add(t),Qu.needsUpdate=!0,t}getLine(e){return this.getChildForType("Line",e)}removeLine(e){const t=this.getLine(e);t&&this.remove(t),Qu.needsUpdate=!0}createPolygon(e){const t=new yh(e);return this.add(t),Qu.needsUpdate=!0,t}getPolygon(e){return this.getChildForType("Polygon",e)}removePolygon(e){const t=this.getPolygon(e);t&&this.remove(t),Qu.needsUpdate=!0}createCircle(e){const t=new uh(e);return this.add(t),Qu.needsUpdate=!0,t}getCircle(e){return this.getChildForType("Circle",e)}removeCircle(e){const t=this.getCircle(e);t&&this.remove(t),Qu.needsUpdate=!0}getChildForType(e,t){for(let n=0;n<this.children.length;n++)if(this.children[n].stype===e&&this.children[n].sid===t)return this.children[n];return null}}class bh extends Ju{constructor(e,t,n){super(e,t,n,"Ground")}}var Ah=Object.freeze({__proto__:null,BaseMesh:Ju,BaseObject3D:eh,Canvas3D:wh,Circle:uh,Ground:bh,Group:th,Icon:oh,Line:mh,Link:fh,Model:rh,Node:ch,PluginObject:nh,Poi:ah,PoiNode:ih,Point:lh,Polygon:yh,Topology:ph});var xh=Object.defineProperty,Sh=(e,t,n)=>(((e,t,n)=>{t in e?xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Th=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e))(Th||{});function Eh(e,n,i){const r=(i=i??0)+1;if(function(e){var t=typeof e;return null==e||"object"!==t&&"function"!==t}(e))return e;if(null!=e.x&&null!=e.y)return function(e){return null!=e.w?(new we).copy(e):null!=e.z?(new t).copy(e):(new h).copy(e)}(e);if(Array.isArray(e))return e.map((e=>Eh(e,n,r)));if(e instanceof Map){const t=new Map;for(const i of e.keys()){const s=Eh(e.get(i),n,r);t.set(i,s)}return t}if(function(e){return e&&"function"==typeof e[Symbol.iterator]}(e)){const t=[];for(const i of e){const e=Eh(i,n,r);t.push(e)}return t}if((n||0===i)&&"object"==typeof e){const t={};for(const i of Object.keys(e))t[i]=Eh(e[i],n,r);return t}return e}function Dh(e,t,n){let i=function(e,t){const n=Math.sqrt(e.lengthSq()*t.lengthSq());if(0===n)return 0;let i=e.dot(t)/n;return i=Math.max(-1,Math.min(1,i)),Math.acos(i)}(e,t);return 0===i?i:e.clone().cross(t).dot(n)<0?-i:i}(e=>{e.toKey=function(t){return e[t]},e.toIndex=function(t){return e[t]}})(Th||(Th={}));const Ch=180/Math.PI,Ih={yaw:[{name:"前",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],pitch:[{name:"前",range:[-15,15]},{name:"上",range:[15,165]},{name:"下",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],roll:[{name:"上",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"下",range:[-180.1,-165]},{name:"下",range:[165,180.1]}]};const Bh={degrees:!0,map:Ih,front:{x:0,y:0,z:1},up:{x:0,y:1,z:0}};class Mh{constructor(e){Sh(this,"_options"),Sh(this,"_listMap"),Sh(this,"_front"),Sh(this,"_up"),e&&(this.options=e)}static get options(){return this._options??(this.options=Bh)}static set options(e){this._options=Object.assign({},structuredClone(Ih),e)}get defaultOptions(){return this.constructor.options}get options(){return this._options??(this.options=this.defaultOptions)}set options(e){this._options=Object.assign({},structuredClone(this.defaultOptions),e),this._listMap=null,this._front=null,this._up=null}get degrees(){return this.options.degrees??(this.options.degrees=this.defaultOptions.degrees??!0)}set degrees(e){this.options.degrees=e}get map(){return this.options.map||(this.map=this.defaultOptions.map),this.options.map}set map(e){const t=structuredClone(this.defaultOptions.map),n=structuredClone(Ih);e=e?{yaw:e.yaw??t.yaw??n.yaw,pitch:e.pitch??t.pitch??n.pitch,roll:e.roll??t.roll??n.roll}:t,this.options.map=e,this._listMap=null}get listMap(){return this._listMap??(this._listMap=function(e){const t={};for(const[n,i]of Object.entries(e))t[n]=Array.isArray(i)?i:Object.entries(i).map((([e,t])=>({name:e,range:t})));return t}(this.map??{}))}get front(){return this._front||(this.front=this.options.front??this.defaultOptions.front??Bh.front),this._front}set front(e){this._front=(new t).copy(e)}get up(){return this._up||(this.up=this.options.up??this.defaultOptions.up??Bh.up),this._up}set up(e){this._up=(new t).copy(e)}computeAzimuth(e,n,i){const r=(new t).copy(e),s=(new t).copy(n??this.front),o=(new t).copy(i??this.up);let{yaw:a,pitch:l,roll:c}=function(e,t,n){const i=t.clone().negate(),r=n.clone().projectOnPlane(t),s=Dh(t,e.clone().projectOnPlane(r),r),o=t.clone().cross(r);return{yaw:s,pitch:Dh(t,e.clone().projectOnPlane(o),o),roll:Dh(r,e.clone().projectOnPlane(i),i)}}(r,s,o);return this.degrees&&(a*=Ch,l*=Ch,c*=Ch),{yaw:{angle:a,name:this.findAzimuthNames("yaw",a)},pitch:{angle:l,name:this.findAzimuthNames("pitch",l)},roll:{angle:c,name:this.findAzimuthNames("roll",c)}}}findAzimuthNames(e,t){const n=[],i=this.listMap[e];if(!i)return n;for(const{name:e,range:[r,s]}of i)(t>=r&&t<s||t<=r&&t>s)&&n.push(e);return n}}function Ph(e){const n={};if(Array.isArray(e)){const i=e.map((e=>(new t).copy(e)));n.points=i}else if(e instanceof ph){const i=e.nodes.map((e=>e.getWorldPosition(new t)));n.points=i}else n.curve=e;return n}function Oh(e,t,n,i){const r=i?Eh(i,!1):null,s=Ph(t),o=br(Object.assign(Object.assign(Object.assign({},r),s),{target:e}));return n.playModelAnimation(e,o)}Sh(Mh,"_options"),new Mh;class Rh{constructor(e,t,n){this.type=e,this.scene=n,this.viewport=t}createGroup(e,t){const n=new th(e);return null!==t&&this.viewport.scener.addObject(n,null!=t?t:this.scene),n}clear(){this.getAll().forEach((e=>{this.viewport.scener.removeObject(e)}))}getAll(){const e=[];return this.scene.traverse((t=>{((t instanceof eh||t instanceof Ju)&&Ii(t)&&t.stype===this.type||Ii(t)&&t.userData.stype===this.type)&&e.push(t)})),e}hideAll(){this.getAll().forEach((e=>{e.hide?e.hide():e.visible=!1})),this.viewport.signals.objectChanged.dispatch()}showAll(){this.getAll().forEach((e=>{e.show?e.show():e.visible=!0})),this.viewport.signals.objectChanged.dispatch()}}class _h extends Rh{constructor(e,t){super(jn,e,t),Ft.init()}createAmbientLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1}=e,s=new nt(i,r);return s.name=n,s.userData.sid=t,s.userData.stype="Light",this.viewport.scener.addObject(s,this.scene),s}setAmbientLight(e,t){const{name:n="",color:i=10132122,intensity:r=1}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,this.viewport.signals.objectChanged.dispatch(),!0)}createDirectionalLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,u=new it(i,r);if(u.name=n,u.userData.sid=t,u.userData.stype="Light",u.position.set(s.x,s.y,s.z),u.target.name=`${n}-target`,u.target.position.set(o.x,o.y,o.z),u.castShadow=a,a){const e=u.position.distanceTo(u.target.position);u.shadow.bias=-.005,u.shadow.camera.left=-e,u.shadow.camera.right=e,u.shadow.camera.top=e,u.shadow.camera.bottom=-e,u.shadow.camera.far=e,u.shadow.autoUpdate=l,u.shadow.needsUpdate=!l,u.shadow.mapSize.width=c,u.shadow.mapSize.height=c,u.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(u,this.scene),this.viewport.scener.addObject(u.target,this.scene),u}setDirectionalLight(e,t){const{name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:u=4096}=t;if(!e)return!1;if(e.name=n,e.color=new c(i),e.intensity=r,e.position.set(s.x,s.y,s.z),e.target.position.set(o.x,o.y,o.z),e.castShadow=a,a){const t=e.position.distanceTo(e.target.position);e.shadow.bias=-.005,e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,e.shadow.camera.far=t,e.shadow.autoUpdate=l,e.shadow.needsUpdate=!l,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createHemisphereLight(e){const{id:t,name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=e,a=new rt(i,r,s);return a.name=n,a.position.set(o.x,o.y,o.z),a.userData.sid=t,a.userData.stype="Light",this.viewport.scener.addObject(a,this.scene),a}setHemisphereLight(e,t){const{name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new c(i),e.groundColor=new c(r),e.intensity=s,e.position.set(o.x,o.y,o.z),this.viewport.signals.objectChanged.dispatch(),!0)}createSpotLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:u=4096}=e,h=Kn(o).distanceTo(Kn(a)),d=new st(i,r,h,Math.PI/360*s,0,0);if(d.name=n,d.position.set(o.x,o.y,o.z),d.userData.sid=t,d.userData.stype="Light",d.castShadow=l,d.target.position.set(a.x,a.y,a.z),d.target.castShadow=l,d.target.receiveShadow=!0,d.target.updateMatrixWorld(),l){const e=d.position.distanceTo(d.target.position);d.shadow.autoUpdate=c,d.shadow.needsUpdate=!c,d.shadow.mapSize.width=u,d.shadow.mapSize.height=u,d.shadow.bias=-.005,d.shadow.focus=.6,d.shadow.camera.far=e,d.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(d,this.scene),d}setSpotLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:u=!1,mapSize:h=4096}=t;if(!e)return!1;const d=Kn(o).distanceTo(Kn(a));if(e.name=n,e.color=new c(i),e.intensity=r,e.distance=d,e.angle=Math.PI/360*s,e.position.set(o.x,o.y,o.z),e.castShadow=l,e.target.position.set(a.x,a.y,a.z),e.target.castShadow=l,e.target.updateMatrixWorld(),l){const t=e.position.distanceTo(e.target.position);e.shadow.autoUpdate=u,e.shadow.needsUpdate=!u,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.bias=-.005,e.shadow.focus=.6,e.shadow.camera.far=t,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createPointLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,u=new ot(i,r,s);return u.name=n,u.userData.sid=t,u.userData.stype="Light",u.position.set(o.x,o.y,o.z),u.castShadow=a,a&&(u.shadow.bias=-.005,u.shadow.camera.far=s,u.shadow.autoUpdate=l,u.shadow.needsUpdate=!l,u.shadow.mapSize.width=c,u.shadow.mapSize.height=c,u.shadow.camera.updateProjectionMatrix()),this.viewport.scener.addObject(u,this.scene),u}setPointLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:u=4096}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,e.distance=s,e.position.set(o.x,o.y,o.z),e.castShadow=a,a&&(e.shadow.bias=-.005,e.shadow.camera.far=s,e.shadow.autoUpdate=l,e.shadow.needsUpdate=!l,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.camera.updateProjectionMatrix()),this.viewport.signals.objectChanged.dispatch(),!0)}createRectAreaLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=e,l=new at(i,r,s,o);return l.name=n,l.userData.sid=t,l.userData.stype="Light",l.position.set(a.x,a.y,a.z),this.viewport.scener.addObject(l,this.scene),l}setRectAreaLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,e.width=s,e.height=o,e.position.set(a.x,a.y,a.z),this.viewport.signals.objectChanged.dispatch(),!0)}updateAllShadow(){this.getAll().forEach((e=>{var t;!1===(null===(t=e.shadow)||void 0===t?void 0:t.autoUpdate)&&(e.shadow.needsUpdate=!0)})),this.viewport.signals.objectChanged.dispatch()}}function kh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lh={};let Nh,Uh,jh;({get exports(){return Lh},set exports(e){Lh=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&kh)return kh(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=kh,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function h(e){1!==c.push(e)||i||n()}t.exports=h}).call(this,void 0!==Xr?Xr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)u(e[l],l);return c;function u(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?h(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=g,c.reject=m,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==Xr?Xr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},v=Object.prototype.toString,y="readonly",w="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function A(e){return new c((function(t){var n=e.transaction(p,w),i=l([""]);n.objectStore(p).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function x(e){return"boolean"==typeof g?c.resolve(g):A(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function T(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function E(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[e.name]||L(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(p)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),T(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function B(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function M(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function _(e){S(e);for(var t=m[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,B(e)?I(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw E(e,t),t}))}function k(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),I(e)})).then((function(){return _(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function N(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=L(),m[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,B(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function j(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;O(i)&&(i=P(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function F(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?x(s.db).then((function(e){return e?t:M(t)})):t})).then((function(t){k(i._dbInfo,w,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return u(r,n),r}function z(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,w,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function G(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,w,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function V(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function W(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Y(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=m[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=m[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,T(n._dbInfo)}})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)T(i[t]._dbInfo)})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var Q={_driver:"asyncStorage",_initStorage:N,_support:a(),iterate:j,getItem:U,setItem:F,removeItem:z,clear:G,length:H,key:V,keys:W,dropInstance:Y};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",ue="fl64",he=$+ee.length,de=Object.prototype.toString;function fe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[l++]=(3&r)<<6|63&s;return c}function pe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function ge(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=ue:t(new Error("Failed to get type for BinaryArray"))),t(r+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+pe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function me(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(he),i=e.substring($,he);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=fe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function we(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function be(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function Ae(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function xe(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return u(s,n),s}function Te(e,t,n){return Se.apply(this,[e,t,n,1])}function Ee(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ie(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Be(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Me(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Pe(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Me(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:xe,getItem:Ae,setItem:Te,removeItem:Ee,clear:De,length:Ce,key:Ie,keys:Be,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function _e(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Le(){return!ke()||localStorage.length>0}function Ne(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=_e(e,t._defaultConfig),Le()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return u(n,e),n}function je(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return u(i,t),i}function Fe(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return u(i,t),i}function ze(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return u(i,t),i}function Ge(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return u(n,e),n}function He(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Ve(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function We(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return u(r,n),r}function Ye(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(_e(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),u(i,t),i}var Qe={_driver:"localStorageWrapper",_initStorage:Ne,_support:Re(),iterate:Fe,getItem:je,setItem:We,removeItem:Ve,clear:Ue,length:He,key:ze,keys:Ge,dropInstance:Ye},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:Q,WEBSQL:Oe,LOCALSTORAGE:Qe},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};h();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return h(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return h(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return h(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),h(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);class Fh extends lt{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===r.path?ct.extractUrlBase(e):r.path,o=new ut(this.manager);o.setPath(r.path),o.setResponseType("arraybuffer"),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e,t){if(function(e){const t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===id(e,0,t.length)}(e))Nh=(new Wh).parse(e);else{const t=id(e);if(!function(e){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(t){const i=e[t-1];return e=e.slice(n+t),n++,i}for(let e=0;e<t.length;++e){if(i(1)===t[e])return!1}return!0}(t))throw new Error("THREE.FBXLoader: Unknown format.");if(Xh(t)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Xh(t));Nh=(new Vh).parse(t)}const n=new l(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new zh(n,this.manager).parse(Nh)}}class zh{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Uh=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),r=(new Gh).parse(i);return this.parseScene(i,r,n),jh}parseConnections(){const e=new Map;if("Connections"in Nh){Nh.Connections.connections.forEach((function(t){const n=t[0],i=t[1],r=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const s={ID:i,relationship:r};e.get(n).parents.push(s),e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:n,relationship:r};e.get(i).children.push(o)}))}return e}parseImages(){const e={},t={};if("Video"in Nh.Objects){const n=Nh.Objects.Video;for(const i in n){const r=n[i];if(e[parseInt(i)]=r.RelativeFilename||r.Filename,"Content"in r){const e=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,s="string"==typeof r.Content&&""!==r.Content;if(e||s){const e=this.parseImage(n[i]);t[r.RelativeFilename||r.Filename]=e}}}}for(const n in e){const i=e[n];void 0!==t[i]?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof t)return"data:"+r+";base64,"+t;{const e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in Nh.Objects){const n=Nh.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],e);t.set(parseInt(i),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,r=e.WrapModeV,s=void 0!==i?i.value:0,o=void 0!==r?r.value:0;if(n.wrapS=0===s?ne:ht,n.wrapT=0===o?ne:ht,"Scaling"in e){const t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){const t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n;const i=this.textureLoader.path,r=Uh.get(e.id).children;let s;void 0!==r&&r.length>0&&void 0!==t[r[0].ID]&&(n=t[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const o=e.FileName.slice(-3).toLowerCase();if("tga"===o){const t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),s=new u):(t.setPath(this.textureLoader.path),s=t.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),s=new u):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(e){const t=new Map;if("Material"in Nh.Objects){const n=Nh.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],e);null!==r&&t.set(parseInt(i),r)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let r=e.ShadingModel;if("object"==typeof r&&(r=r.value),!Uh.has(n))return null;const s=this.parseParameters(e,t,n);let o;return r.toLowerCase(),o=new U,o.setValues(s),o.name=i,o}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new c).fromArray(e.Diffuse.value).convertSRGBToLinear():!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new c).fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new c).fromArray(e.Emissive.value).convertSRGBToLinear():!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new c).fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0,i.depthWrite=!1);const r=this;return Uh.get(n).children.forEach((function(e){const n=e.relationship;switch(n){case"Bump":i.bumpMap=r.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=ye);break;case"DisplacementColor":i.displacementMap=r.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=ye);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=r.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=a,i.envMap.encoding=ye);break;case"SpecularColor":i.specularMap=r.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=ye);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}getTexture(e,t){return"LayeredTexture"in Nh.Objects&&t in Nh.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Uh.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Nh.Objects){const n=Nh.Objects.Deformer;for(const i in n){const r=n[i],s=Uh.get(parseInt(i));if("Skin"===r.attrType){const t=this.parseSkeleton(s,n);t.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=s.parents[0].ID,e[i]=t}else if("BlendShape"===r.attrType){const e={id:i};e.rawTargets=this.parseMorphTargets(s,n),e.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach((function(e){const i=t[e.ID];if("Cluster"!==i.attrType)return;const r={ID:e.ID,indices:[],weights:[],transformLink:(new d).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i<e.children.length;i++){const r=e.children[i],s=t[r.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;o.geoID=Uh.get(parseInt(r.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}parseScene(e,t,n){jh=new dt;const i=this.parseModels(e.skeletons,t,n),r=Nh.Objects.Model,s=this;i.forEach((function(e){const t=r[e.ID];s.setLookAtProperties(e,t);Uh.get(e.ID).parents.forEach((function(t){const n=i.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&jh.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),jh.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);const t=ed(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));const o=(new Hh).parse();1===jh.children.length&&jh.children[0].isGroup&&(jh.children[0].animations=o,jh=jh.children[0]),jh.animations=o}parseModels(e,t,n){const i=new Map,r=Nh.Objects.Model;for(const s in r){const o=parseInt(s),a=r[s],l=Uh.get(o);let c=this.buildSkeleton(l,e,o,a.attrName);if(!c){switch(a.attrType){case"Camera":case"Light":break;case"Mesh":c=this.createMesh(l,t,n);break;case"NurbsCurve":c=this.createCurve(l,t);break;case"LimbNode":case"Root":c=new S;break;default:c=new dt}c.name=a.attrName?ft.sanitizeNodeName(a.attrName):"",c.ID=o}this.getTransformData(c,a),i.set(o,c)}return i}buildSkeleton(e,t,n,i){let r=null;return e.parents.forEach((function(e){for(const s in t){const o=t[s];o.rawBones.forEach((function(t,s){if(t.ID===e.ID){const e=r;r=new S,r.matrixWorld.copy(t.transformLink),r.name=i?ft.sanitizeNodeName(i):"",r.ID=n,o.bones[s]=r,null!==e&&r.add(e)}}))}})),r}createCamera(e){let t,n;if(e.children.forEach((function(e){const t=Nh.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new M;else{let e=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(e=1);let i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);let r=1e3;void 0!==n.FarPlane&&(r=n.FarPlane.value/1e3);let s=window.innerWidth,o=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,o=n.AspectHeight.value);const a=s/o;let l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);const c=n.FocalLength?n.FocalLength.value:null;switch(e){case 0:t=new j(l,a,i,r),null!==c&&t.setFocalLength(c);break;case 1:t=new F(-s/2,s/2,o/2,-o/2,i,r);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+e+"."),t=new M}}return t}createLight(e){let t,n;if(e.children.forEach((function(e){const t=Nh.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new M;else{let e;e=void 0===n.LightType?0:n.LightType.value;let i=16777215;void 0!==n.Color&&(i=(new c).fromArray(n.Color.value).convertSRGBToLinear());let r=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(r=0);let s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);const o=1;switch(e){case 0:t=new ot(i,r,s,o);break;case 1:t=new it(i,r);break;case 2:let e=Math.PI/3;void 0!==n.InnerAngle&&(e=w.degToRad(n.InnerAngle.value));let a=0;void 0!==n.OuterAngle&&(a=w.degToRad(n.OuterAngle.value),a=Math.max(a,1)),t=new st(i,r,s,e,a,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new ot(i,r)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,r=null,s=null;const o=[];return e.children.forEach((function(e){t.has(e.ID)&&(r=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?s=o:o.length>0?s=o[0]:(s=new U({color:13421772}),o.push(s)),"color"in r.attributes&&o.forEach((function(e){e.vertexColors=!0})),void 0===r.getAttribute("normal")&&o.forEach((function(e){e.flatShading=!0})),r.FBX_Deformer?(i=new E(r,s),i.normalizeSkinWeights()):i=new k(r,s),i.castShadow=!0,i.receiveShadow=!0,i}createCurve(e,t){const n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),i=new m({color:3342591,linewidth:1});return new v(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?td(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,n){if("LookAtProperty"in n){Uh.get(e.ID).children.forEach((function(n){if("LookAtProperty"===n.relationship){const i=Nh.Objects.Model[n.ID];if("Lcl_Translation"in i){const n=i.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(n),jh.add(e.target)):e.lookAt((new t).fromArray(n))}}}))}}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const r in e){const s=e[r];Uh.get(parseInt(s.ID)).parents.forEach((function(e){if(t.has(e.ID)){const t=e.ID;Uh.get(t).parents.forEach((function(e){if(n.has(e.ID)){n.get(e.ID).bind(new D(s.bones),i[e.ID])}}))}}))}}parsePoseNodes(){const e={};if("Pose"in Nh.Objects){const t=Nh.Objects.Pose;for(const n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach((function(t){e[t.Node]=(new d).fromArray(t.Matrix.a)})):e[i.Node]=(new d).fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Nh&&"AmbientColor"in Nh.GlobalSettings){const e=Nh.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(0!==t||0!==n||0!==i){const e=new c(t,n,i).convertSRGBToLinear();jh.add(new nt(e,1))}}}}class Gh{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Nh.Objects){const n=Nh.Objects.Geometry;for(const i in n){const r=Uh.get(parseInt(i)),s=this.parseGeometry(r,n[i],e);t.set(parseInt(i),s)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,r=[],s=e.parents.map((function(e){return Nh.Objects.Model[e.ID]}));if(0===s.length)return;const o=e.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&r.push(n.morphTargets[e.ID])}));const a=s[0],l={};"RotationOrder"in a&&(l.eulerOrder=td(a.RotationOrder.value)),"InheritType"in a&&(l.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(l.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(l.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(l.scale=a.GeometricScaling.value);const c=ed(l);return this.genGeometry(t,o,r,c)}genGeometry(e,t,n,i){const r=new p;e.attrName&&(r.name=e.attrName);const s=this.parseGeoNode(e,t),o=this.genBuffers(s),a=new g(o.vertex,3);if(a.applyMatrix4(i),r.setAttribute("position",a),o.colors.length>0&&r.setAttribute("color",new g(o.colors,3)),t&&(r.setAttribute("skinIndex",new T(o.weightsIndices,4)),r.setAttribute("skinWeight",new g(o.vertexWeights,4)),r.FBX_Deformer=t),o.normal.length>0){const e=(new Be).getNormalMatrix(i),t=new g(o.normal,3);t.applyNormalMatrix(e),r.setAttribute("normal",t)}if(o.uvs.forEach((function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),r.setAttribute(n,new g(o.uvs[t],2))})),s.material&&"AllSame"!==s.material.mappingType){let e=o.materialIndex[0],t=0;if(o.materialIndex.forEach((function(n,i){n!==e&&(r.addGroup(t,i-t,e),e=n,t=i)})),r.groups.length>0){const t=r.groups[r.groups.length-1],n=t.start+t.count;n!==o.materialIndex.length&&r.addGroup(n,o.materialIndex.length-n,e)}0===r.groups.length&&r.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(r,e,n,i),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:t,weight:e.weights[r]})}))}))),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],o=[],a=[],l=[],c=[],u=[];const h=this;return e.vertexIndices.forEach((function(d,f){let p,g=!1;d<0&&(d^=-1,g=!0);let m=[],v=[];if(s.push(3*d,3*d+1,3*d+2),e.color){const t=qh(f,n,d,e.color);a.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){v.push(e.weight),m.push(e.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const e=[0,0,0,0],t=[0,0,0,0];v.forEach((function(n,i){let r=n,s=m[i];t.forEach((function(t,n,i){if(r>t){i[n]=r,r=t;const o=e[n];e[n]=s,s=o}}))})),m=e,v=t}for(;v.length<4;)v.push(0),m.push(0);for(let e=0;e<4;++e)c.push(v[e]),u.push(m[e])}if(e.normal){const t=qh(f,n,d,e.normal);o.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(p=qh(f,n,d,e.material)[0],p<0&&(h.negativeMaterialIndices=!0,p=0)),e.uv&&e.uv.forEach((function(e,t){const i=qh(f,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,s,p,o,a,l,c,u,i),n++,i=0,s=[],o=[],a=[],l=[],c=[],u=[])})),t}genFace(e,t,n,i,r,s,o,a,l,c){for(let u=2;u<c;u++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(u-1)]),e.vertexWeights.push(a[4*(u-1)+1]),e.vertexWeights.push(a[4*(u-1)+2]),e.vertexWeights.push(a[4*(u-1)+3]),e.vertexWeights.push(a[4*u]),e.vertexWeights.push(a[4*u+1]),e.vertexWeights.push(a[4*u+2]),e.vertexWeights.push(a[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(s[0]),e.colors.push(s[1]),e.colors.push(s[2]),e.colors.push(s[3*(u-1)]),e.colors.push(s[3*(u-1)+1]),e.colors.push(s[3*(u-1)+2]),e.colors.push(s[3*u]),e.colors.push(s[3*u+1]),e.colors.push(s[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[3*(u-1)]),e.normal.push(r[3*(u-1)+1]),e.normal.push(r[3*(u-1)+2]),e.normal.push(r[3*u]),e.normal.push(r[3*u+1]),e.normal.push(r[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(u-1)]),e.uvs[n].push(o[n][2*(u-1)+1]),e.uvs[n].push(o[n][2*u]),e.uvs[n].push(o[n][2*u+1])}))}addMorphTargets(e,t,n,i){if(0===n.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach((function(n){n.rawTargets.forEach((function(n){const s=Nh.Objects.Geometry[n.geoID];void 0!==s&&r.genMorphGeometry(e,t,s,i,n.name)}))}))}genMorphGeometry(e,t,n,i,r){const s=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l);for(let e=0;e<a.length;e++){const t=3*a[e];c[t]=o[3*e],c[t+1]=o[3*e+1],c[t+2]=o[3*e+2]}const u={vertexIndices:s,vertexPositions:c},h=this.genBuffers(u),d=new g(h.vertex,3);d.name=r||n.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a;let r=[];return"IndexToDirect"===n&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a;let r=[];return"IndexToDirect"===n&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a;let r=[];"IndexToDirect"===n&&(r=e.ColorIndex.a);for(let e=0,t=new c;e<i.length;e+=4)t.fromArray(i,e).convertSRGBToLinear().toArray(i,e);return{dataSize:4,buffer:i,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=e.Materials.a,r=[];for(let e=0;e<i.length;++e)r.push(e);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new p;const n=t-1,i=e.KnotVector.a,r=[],s=e.Points.a;for(let e=0,t=s.length;e<t;e+=4)r.push((new we).fromArray(s,e));let o,a;if("Closed"===e.Form)r.push(r[0]);else if("Periodic"===e.Form){o=n,a=i.length-1-o;for(let e=0;e<n;++e)r.push(r[e])}const l=new Wt(n,i,r,o,a).getPoints(12*r.length);return(new p).setFromPoints(l)}}class Hh{parse(){const e=[],t=this.parseClips();if(void 0!==t)for(const n in t){const i=t[n],r=this.addClip(i);e.push(r)}return e}parseClips(){if(void 0===Nh.Objects.AnimationCurve)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=Nh.Objects.AnimationCurveNode,t=new Map;for(const n in e){const i=e[n];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){const e={id:i.id,attr:i.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){const t=Nh.Objects.AnimationCurve;for(const n in t){const i={id:t[n].id,times:t[n].KeyTime.a.map(Zh),values:t[n].KeyValueFloat.a},r=Uh.get(i.id);if(void 0!==r){const t=r.parents[0].ID,n=r.parents[0].relationship;n.match(/X/)?e.get(t).curves.x=i:n.match(/Y/)?e.get(t).curves.y=i:n.match(/Z/)?e.get(t).curves.z=i:n.match(/d|DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=i)}}}parseAnimationLayers(e){const t=Nh.Objects.AnimationLayer,n=new Map;for(const i in t){const t=[],r=Uh.get(parseInt(i));if(void 0!==r){r.children.forEach((function(n,i){if(e.has(n.ID)){const r=e.get(n.ID);if(void 0!==r.curves.x||void 0!==r.curves.y||void 0!==r.curves.z){if(void 0===t[i]){const e=Uh.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==e){const r=Nh.Objects.Model[e.toString()];if(void 0===r)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);const s={modelName:r.attrName?ft.sanitizeNodeName(r.attrName):"",ID:r.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};jh.traverse((function(e){e.ID===r.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new d),"PreRotation"in r&&(s.preRotation=r.PreRotation.value),"PostRotation"in r&&(s.postRotation=r.PostRotation.value),t[i]=s}}t[i]&&(t[i][r.attr]=r)}else if(void 0!==r.curves.morph){if(void 0===t[i]){const e=Uh.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,r=Uh.get(e).parents[0].ID,s=Uh.get(r).parents[0].ID,o=Uh.get(s).parents[0].ID,a=Nh.Objects.Model[o],l={modelName:a.attrName?ft.sanitizeNodeName(a.attrName):"",morphName:Nh.Objects.Deformer[e].attrName};t[i]=l}t[i][r.attr]=r}}})),n.set(parseInt(i),t)}}return n}parseAnimStacks(e){const t=Nh.Objects.AnimationStack,n={};for(const i in t){const r=Uh.get(parseInt(i)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(r[0].ID);n[i]={name:t[i].attrName,layer:s}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new C(e.name,-1,t)}generateTracks(e){const i=[];let s=new t,o=new r,a=new t;if(e.transform&&e.transform.decompose(s,o,a),s=s.toArray(),o=(new n).setFromQuaternion(o,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");void 0!==t&&i.push(t)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){const t=this.generateRotationTrack(e.modelName,e.R.curves,o,e.preRotation,e.postRotation,e.eulerOrder);void 0!==t&&i.push(t)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale");void 0!==t&&i.push(t)}if(void 0!==e.DeformPercent){const t=this.generateMorphTrack(e);void 0!==t&&i.push(t)}return i}generateVectorTrack(e,t,n,i){const r=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(r,t,n);return new I(e+"."+i,r,s)}generateRotationTrack(e,t,i,s,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(w.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(w.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(w.degToRad));const l=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(l,t,i);void 0!==s&&((s=s.map(w.degToRad)).push(a),s=(new n).fromArray(s),s=(new r).setFromEuler(s)),void 0!==o&&((o=o.map(w.degToRad)).push(a),o=(new n).fromArray(o),o=(new r).setFromEuler(o).invert());const u=new r,h=new n,d=[];for(let e=0;e<c.length;e+=3)h.set(c[e],c[e+1],c[e+2],a),u.setFromEuler(h),void 0!==s&&u.premultiply(s),void 0!==o&&u.multiply(o),u.toArray(d,e/3*4);return new B(e+".quaternion",l,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),i=jh.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new pt(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){let e=1,n=t[0];for(let i=1;i<t.length;i++){const r=t[i];r!==n&&(t[e]=r,n=r,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){const i=n,r=[];let s=-1,o=-1,a=-1;return e.forEach((function(e){if(t.x&&(s=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==s){const e=t.x.values[s];r.push(e),i[0]=e}else r.push(i[0]);if(-1!==o){const e=t.y.values[o];r.push(e),i[1]=e}else r.push(i[1]);if(-1!==a){const e=t.z.values[a];r.push(e),i[2]=e}else r.push(i[2])})),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){const s=r/180,o=i/s;let a=n+o;const l=e.times[t-1],c=(e.times[t]-l)/s;let u=l+c;const h=[],d=[];for(;u<e.times[t];)h.push(u),u+=c,d.push(a),a+=o;e.times=rd(e.times,t,h),e.values=rd(e.values,t,d)}}}}class Vh{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Qh,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,i){const r=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);if(r||s)return;const o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,n[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)})),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},s=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in o?("PoseNode"===n?o.PoseNode.push(r):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==s.id&&(o[n][s.id]=r)):"number"==typeof s.id?(o[n]={},o[n][s.id]=r):"Properties70"!==n&&(o[n]="PoseNode"===n?[r]:r),"number"==typeof s.id&&(r.id=s.id),""!==s.name&&(r.attrName=s.name),""!==s.type&&(r.attrType=s.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const e=r.split(",").slice(1),t=parseInt(e[0]),n=parseInt(e[1]);let o=r.split(",").slice(3);o=o.map((function(e){return e.trim().replace(/^"/,"")})),i="connections",r=[t,n],function(e,t){for(let n=0,i=e.length,r=t.length;n<r;n++,i++)e[i]=t[n]}(r,o),void 0===s[i]&&(s[i]=[])}"Node"===i&&(s.id=r),i in s&&Array.isArray(s[i])?s[i].push(r):"a"!==i?s[i]=r:s.a=r,this.setCurrentProp(s,i),"a"===i&&","!==r.slice(-1)&&(s.a=nd(r))}else this.parseNodeSpecialProperty(e,i,r)}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=nd(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map((function(e){return e.trim().replace(/^"/,"").replace(/\s/,"_")})),r=i[0],s=i[1],o=i[2],a=i[3];let l=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=nd(l)}this.getPrevNode()[r]={type:s,type2:o,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class Wh{parse(e){const t=new Yh(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new Qh;for(;!this.endOfContent(t);){const e=this.parseNode(t,n);null!==e&&i.add(e.name,e)}return i}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),o=e.getString(s);if(0===i)return null;const a=[];for(let t=0;t<r;t++)a.push(this.parseProperty(e));const l=a.length>0?a[0]:"",c=a.length>1?a[1]:"",u=a.length>2?a[2]:"";for(n.singleProperty=1===r&&e.getOffset()===i;i>e.getOffset();){const i=this.parseNode(e,t);null!==i&&this.parseSubNode(o,n,i)}return n.propertyList=a,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==u&&(n.attrType=u),""!==o&&(n.name=o),n}parseSubNode(e,t,n){if(!0===n.singleProperty){const e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if("Connections"===e&&"C"===n.name){const e=[];n.propertyList.forEach((function(t,n){0!==n&&e.push(t)})),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){let e=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],s=n.propertyList[3];let o;0===e.indexOf("Lcl ")&&(e=e.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:i,type2:r,flag:s,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),r=e.getUint32(),s=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=Vt.unzlibSync(new Uint8Array(e.getArrayBuffer(s))),a=new Yh(o.buffer);switch(t){case"b":case"c":return a.getBooleanArray(i);case"d":return a.getFloat64Array(i);case"f":return a.getFloat32Array(i);case"i":return a.getInt32Array(i);case"l":return a.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Yh{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return 1==(1&this.getUint8())}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,e=4294967295&~e,4294967295===e&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const i=n.indexOf(0);return i>=0&&(n=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(n)}}class Qh{add(e,t){this[e]=t}}function Xh(e){const t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Zh(e){return e/46186158e3}const Kh=[];function qh(e,t,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=e;break;case"ByPolygon":r=t;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const s=r*i.dataSize,o=s+i.dataSize;return function(e,t,n,i){for(let r=n,s=0;r<i;r++,s++)e[s]=t[r];return e}(Kh,i.buffer,s,o)}const Jh=new n,$h=new t;function ed(e){const i=new d,r=new d,s=new d,o=new d,a=new d,l=new d,c=new d,u=new d,h=new d,f=new d,p=new d,g=new d,m=e.inheritType?e.inheritType:0;if(e.translation&&i.setPosition($h.fromArray(e.translation)),e.preRotation){const t=e.preRotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),r.makeRotationFromEuler(Jh.fromArray(t))}if(e.rotation){const t=e.rotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),s.makeRotationFromEuler(Jh.fromArray(t))}if(e.postRotation){const t=e.postRotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),o.makeRotationFromEuler(Jh.fromArray(t)),o.invert()}e.scale&&a.scale($h.fromArray(e.scale)),e.scalingOffset&&c.setPosition($h.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition($h.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition($h.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition($h.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),f.copy(e.parentMatrixWorld));const v=r.clone().multiply(s).multiply(o),y=new d;y.extractRotation(f);const b=new d;b.copyPosition(f);const A=b.clone().invert().multiply(f),x=y.clone().invert().multiply(A),S=a,T=new d;if(0===m)T.copy(y).multiply(v).multiply(x).multiply(S);else if(1===m)T.copy(y).multiply(x).multiply(v).multiply(S);else{const e=(new d).scale((new t).setFromMatrixScale(p)).clone().invert(),n=x.clone().multiply(e);T.copy(y).multiply(v).multiply(n).multiply(S)}const E=h.clone().invert(),D=l.clone().invert();let C=i.clone().multiply(u).multiply(h).multiply(r).multiply(s).multiply(o).multiply(E).multiply(c).multiply(l).multiply(a).multiply(D);const I=(new d).copyPosition(C),B=f.clone().multiply(I);return g.copyPosition(B),C=g.clone().multiply(T),C.premultiply(f.invert()),C}function td(e){const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function nd(e){return e.split(",").map((function(e){return parseFloat(e)}))}function id(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function rd(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}const sd=()=>{self.noCompressWorker=function(e,t){const[n]=new Uint32Array(e,t,1),i={byteOffset:t+=4,length:3*n},r={byteOffset:t+=3*n*4,length:2*n},s={byteOffset:t+=2*n*4,length:4*n},o={byteOffset:t+=4*n*1,length:3*n};t+=3*n*1;let a=(s.length+o.length)%4;a>0&&(a=4-a,t+=a);const l=new Uint32Array(e,t,1);t+=4;const[c]=l,u={byteOffset:t,length:c};t+=4*c;const h=new Uint32Array(e,t,1);t+=4;const[d]=h,f=[];if(d>0)for(let n=0;n<d;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);f.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:i,normal:o,color:s,texcoord:r,indice:u,sub_mesh:f}}},od=()=>{self.gzipCompressWorker=function(e){const t=new Uint8Array(e,4,e.byteLength-4),n=new pako.Inflate;n.push(t,!0);const{result:i}=n;if(i instanceof Uint8Array){const{buffer:e}=i;let t=0;const[n]=new Uint32Array(e,t,1);t+=4;const r={byteOffset:t,length:3*n};t+=3*n*4;const s={byteOffset:t,length:2*n};t+=2*n*4;const o={byteOffset:t,length:4*n};t+=4*n*1;const a={byteOffset:t,length:3*n};t+=3*n*1;let l=(o.length+a.length)%4;l>0&&(l=4-l,t+=l);const c=new Uint32Array(e,t,1);t+=4;const[u]=c,h={byteOffset:t,length:u};t+=4*u;const d=new Uint32Array(e,t,1);t+=4;const[f]=d,p=[];if(f>0)for(let n=0;n<f;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);p.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:r,normal:a,color:o,texcoord:s,indice:h,sub_mesh:p}}}},ad=()=>{self.parseChunkWorker=function(e){let t=0;const n=new Int8Array(e,t,128);t+=128,(new TextDecoder).decode(n.slice(0,4));const[i]=n.slice(4,8);if(0===i)return self.noCompressWorker(e,t);if(1===i){const t=e.slice(128);return self.gzipCompressWorker(t)}throw new Error("unknown compress mode [ .sbmx model ]")}},ld="\n onmessage = function ( e ) {\n \n const message = e.data\n\n switch ( message.type ) {\n\n case 'decode': {\n\n const chunkInfo = self.parseChunkWorker( message.data )\n\n if ( chunkInfo ) { \n\n self.postMessage( \n { type: 'decode', data: chunkInfo, }, \n [ chunkInfo.buffer ]\n )\n\n } else {\n\n self.postMessage( { type: 'decode', data: {}, } )\n\n }\n\n break\n \n }\n \n }\n\n }\n\n",cd="textureIndex.json";class ud extends lt{constructor(e){super(),this.store=e,this.loadedTextures=new Map,this.loadedMaterialsMap=new Map,this.defaultMaterial=new U({name:"defaultDatMaterial",color:0}),this.loadedMaterials=[this.defaultMaterial],this.dracoDecoderPath=null,this.workerPool=new kt(4),this.workerSourceURL="";const t=this._initWorkerCreator();this.workerPool.setWorkerCreator(t)}async parseAsync(e,t){const[n]=await Promise.allSettled([this._decodeBuffer(e,t),this._createMaterial(t)]);if("fulfilled"===n.status&&n.value){const e=li(t),i=this._createMesh(n.value,e),r=new dt;return r.add(i),r}}async _decodeBuffer(e,t){await this.store.ready();const n=await this.store.getItem(`${t}_object`);if(n)return n;const[{data:i}]=await Promise.all([this.workerPool.postMessage({type:"decode",data:e},[e])]);if(i){const{type:e,data:n}=null!=i?i:{};if("decode"===e&&n){const{buffer:{byteLength:e}}=n;return Di(e)&&e/1024/1024<=500&&(await this.store.ready(),wi((()=>{this.store.setItem(`${t}_object`,n)}))),n}}}_initWorkerCreator(){if(!this.workerSourceURL){const e=sd.toString(),t=od.toString(),n=ad.toString(),i=["/* dat decoder */",["/* pako */","\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pako = {}));\n}(this, (function (exports) { 'use strict';\n\n // Note: adler32 takes 12% for level 0 and 2% for level 6.\n // It isn't worth it to make additional optimizations as in original.\n // Small size is preferable.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express ofr implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n };\n\n\n var adler32_1 = adler32;\n\n // Note: we can't get significant speed boost here.\n // So write code to minimize size - no pregenerated tables\n // and array tools dependencies.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // Use ordinary array, since untyped makes no boost here\n const makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n };\n\n // Create table on load. Just 255 signed longs. Not a problem.\n const crcTable = new Uint32Array(makeTable());\n\n\n const crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n };\n\n\n var crc32_1 = crc32;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // See state defs from inflate.js\n const BAD$1 = 30; /* got a data error -- remain here until reset */\n const TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\n\n /*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\n var inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n //#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n //#ifdef INFLATE_STRICT\n dmax = state.dmax;\n //#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n //#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const MAXBITS = 15;\n const ENOUGH_LENS$1 = 852;\n const ENOUGH_DISTS$1 = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const CODES$1 = 0;\n const LENS$1 = 1;\n const DISTS$1 = 2;\n\n const lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n ]);\n\n const lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n ]);\n\n const dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n ]);\n\n const dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n ]);\n\n const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n {\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n // let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS$1) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n };\n\n\n var inftrees = inflate_table;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var constants$1 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\n const CODES = 0;\n const LENS = 1;\n const DISTS = 2;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n } = constants$1;\n\n\n /* STATES ====================================================================*/\n /* ===========================================================================*/\n\n\n const HEAD = 1; /* i: waiting for magic header */\n const FLAGS = 2; /* i: waiting for method and flags (gzip) */\n const TIME = 3; /* i: waiting for modification time (gzip) */\n const OS = 4; /* i: waiting for extra flags and operating system (gzip) */\n const EXLEN = 5; /* i: waiting for extra length (gzip) */\n const EXTRA = 6; /* i: waiting for extra bytes (gzip) */\n const NAME = 7; /* i: waiting for end of file name (gzip) */\n const COMMENT = 8; /* i: waiting for end of comment (gzip) */\n const HCRC = 9; /* i: waiting for header crc (gzip) */\n const DICTID = 10; /* i: waiting for dictionary check value */\n const DICT = 11; /* waiting for inflateSetDictionary() call */\n const TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n const TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\n const STORED = 14; /* i: waiting for stored size (length and complement) */\n const COPY_ = 15; /* i/o: same as COPY below, but only first time in */\n const COPY = 16; /* i/o: waiting for input or output to copy stored block */\n const TABLE = 17; /* i: waiting for dynamic block table lengths */\n const LENLENS = 18; /* i: waiting for code length code lengths */\n const CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\n const LEN_ = 20; /* i: same as LEN below, but only first time in */\n const LEN = 21; /* i: waiting for length/lit/eob code */\n const LENEXT = 22; /* i: waiting for length extra bits */\n const DIST = 23; /* i: waiting for distance code */\n const DISTEXT = 24; /* i: waiting for distance extra bits */\n const MATCH = 25; /* o: waiting for output space to copy string */\n const LIT = 26; /* o: waiting for output space to write literal */\n const CHECK = 27; /* i: waiting for 32-bit check value */\n const LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\n const DONE = 29; /* finished check, done -- remain here until reset */\n const BAD = 30; /* got a data error -- remain here until reset */\n const MEM = 31; /* got an inflate() memory error -- remain here until reset */\n const SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n /* ===========================================================================*/\n\n\n\n const ENOUGH_LENS = 852;\n const ENOUGH_DISTS = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const MAX_WBITS = 15;\n /* 32K LZ77 window */\n const DEF_WBITS = MAX_WBITS;\n\n\n const zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n };\n\n\n function InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n }\n\n\n const inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\"));\n return Z_OK$1;\n };\n\n\n const inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n };\n\n\n const inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n };\n\n\n const inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n };\n\n\n const inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n };\n\n\n /*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\n let virgin = true;\n\n let lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\n const fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n };\n\n\n /*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\n const updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n };\n\n\n const inflate$1 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n };\n\n\n const inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n };\n\n\n const inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n };\n\n\n const inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\"));\n return Z_OK$1;\n };\n\n\n var inflateReset_1 = inflateReset;\n var inflateReset2_1 = inflateReset2;\n var inflateResetKeep_1 = inflateResetKeep;\n var inflateInit_1 = inflateInit;\n var inflateInit2_1 = inflateInit2;\n var inflate_2$1 = inflate$1;\n var inflateEnd_1 = inflateEnd;\n var inflateGetHeader_1 = inflateGetHeader;\n var inflateSetDictionary_1 = inflateSetDictionary;\n var inflateInfo = 'pako inflate (from Nodeca project)';\n\n /* Not implemented\n module.exports.inflateCopy = inflateCopy;\n module.exports.inflateGetDictionary = inflateGetDictionary;\n module.exports.inflateMark = inflateMark;\n module.exports.inflatePrime = inflatePrime;\n module.exports.inflateSync = inflateSync;\n module.exports.inflateSyncPoint = inflateSyncPoint;\n module.exports.inflateUndermine = inflateUndermine;\n */\n\n var inflate_1$1 = {\n \tinflateReset: inflateReset_1,\n \tinflateReset2: inflateReset2_1,\n \tinflateResetKeep: inflateResetKeep_1,\n \tinflateInit: inflateInit_1,\n \tinflateInit2: inflateInit2_1,\n \tinflate: inflate_2$1,\n \tinflateEnd: inflateEnd_1,\n \tinflateGetHeader: inflateGetHeader_1,\n \tinflateSetDictionary: inflateSetDictionary_1,\n \tinflateInfo: inflateInfo\n };\n\n const _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n };\n\n var assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n };\n\n\n // Join array of chunks to single array.\n var flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n };\n\n var common = {\n \tassign: assign,\n \tflattenChunks: flattenChunks\n };\n\n // String encode/decode helpers\n\n\n // Quick check if we can use fast array to bin string conversion\n //\n // - apply(Array) can fail on Android 2.2\n // - apply(Uint8Array) can fail on iOS 5.1 Safari\n //\n let STR_APPLY_UIA_OK = true;\n\n try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n const _utf8len = new Uint8Array(256);\n for (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n }\n _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n // convert string to array (typed, when possible)\n var string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n };\n\n // Helper\n const buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n };\n\n\n // convert array to string\n var buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n };\n\n\n // Calculate max possible position in utf8 buffer,\n // that will not break sequence. If that's not possible\n // - (very small limits) return max size as is.\n //\n // buf[] - utf8 bytes array\n // max - length limit (mandatory);\n var utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n };\n\n var strings = {\n \tstring2buf: string2buf,\n \tbuf2string: buf2string,\n \tutf8border: utf8border\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n }\n\n var zstream = ZStream;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n }\n\n var gzheader = GZheader;\n\n const toString = Object.prototype.toString;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n } = constants$1;\n\n /* ===========================================================================*/\n\n\n /**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n /* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n /**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n /**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n /**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n /**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\n function Inflate(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$1.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$1.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$1.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n Inflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$1.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$1.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$1.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$1.inflateReset(strm);\n status = inflate_1$1.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$1.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n };\n\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n Inflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n };\n\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n Inflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n };\n\n\n /**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\n function inflate(input, options) {\n const inflator = new Inflate(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n }\n\n\n /**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\n function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n }\n\n\n /**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\n var Inflate_1 = Inflate;\n var inflate_2 = inflate;\n var inflateRaw_1 = inflateRaw;\n var ungzip = inflate;\n var constants = constants$1;\n\n var inflate_1 = {\n \tInflate: Inflate_1,\n \tinflate: inflate_2,\n \tinflateRaw: inflateRaw_1,\n \tungzip: ungzip,\n \tconstants: constants\n };\n\n exports.Inflate = Inflate_1;\n exports.constants = constants;\n exports['default'] = inflate_1;\n exports.inflate = inflate_2;\n exports.inflateRaw = inflateRaw_1;\n exports.ungzip = ungzip;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n","/* noCompress */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}")),"/* gzipCompress */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}")),"/* parseChunk */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),"","/* worker */",ld].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}return()=>new Worker(this.workerSourceURL)}_createMesh(e,t){const{buffer:n,position:i,normal:r,texcoord:s,indice:o,sub_mesh:a}=e,l=new Uint32Array(n,o.byteOffset,o.length),c=new Float32Array(n,i.byteOffset,i.length),u=new Int8Array(n,r.byteOffset,r.length),h=new Float32Array(n,s.byteOffset,s.length),d=new p;d.setIndex(new f(l,1)),d.setAttribute("position",new f(c,3)),d.setAttribute("normal",new f(u,3,!0)),d.setAttribute("uv",new f(h,2));for(let e=0;e<a.length;e++){const{uuid:n,start:i,count:r}=a[e],s=this.loadedMaterialsMap.get(n);if(s){const{materialIndex:e}=s;d.addGroup(i,r,e)}else d.addGroup(i,r,0),Zn(`sbmx material: not found uuid: ${n} in file: ${t+cd}`)}const g=new k(d,this.loadedMaterials);return g.castShadow=!0,g.receiveShadow=!0,g}async _createMaterial(e){const t=li(e),n=t+cd,i=this.loadedTextures.get(n);if(i)return i;await this.store.ready();const r=await this.store.getItem(`${e}_texture`);let s;if(r)s=r,this.loadedTextures.set(n,Promise.resolve(s));else{const t=this.loadedTextures.get(n);if(t)return t;const i=fi(n).then((e=>e.json()));this.loadedTextures.set(n,i),s=await i,await this.store.ready(),wi((()=>{this.store.setItem(`${e}_texture`,s)}))}Object.entries(s).forEach((e=>{let[n,i]=e;if(this.loadedMaterialsMap.has(n))return;const{name:r,base_map:s,nor_map:o,alphamode:a,color:u={r:1,g:1,b:1,a:1},metallic:h=.5,roughness:d=.5}=i,{r:f,g:p,b:g,a:m}=u,v=0!==a,y=new U({name:r,color:new c(f,p,g),side:de,metalness:h,roughness:d,opacity:m,transparent:v,depthWrite:!v});if(s){const e=t+s;(new l).load(e,(e=>{e.flipY=!0,e.encoding=ye,e.wrapS=ne,e.wrapT=ne,e.minFilter=gt,e.magFilter=re,e.needsUpdate=!0,y.map=e,y.needsUpdate=!0,Qu.needsUpdate=!0}))}if(o){const e=t+o;(new l).load(e,(e=>{e.flipY=!0,e.encoding=ye,e.wrapS=ne,e.wrapT=ne,e.needsUpdate=!0,y.normalMap=e,y.needsUpdate=!0,Qu.needsUpdate=!0}))}const w=this.loadedMaterials.push(y)-1;this.loadedMaterialsMap.set(n,{material:y,materialIndex:w})}))}dispose(){this.workerPool.dispose(),URL.revokeObjectURL(this.workerSourceURL)}}const hd=new Map,dd=e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase().endsWith(".png"))&&void 0!==t&&t},fd=(e,t)=>{if(hd.has(t)){const n=hd.get(t);e.map=n,e.needsUpdate=!0,Qu.needsUpdate=!0}const n=new u;n.encoding=ye,n.wrapS=ne,n.wrapT=ne,n.flipY=!1,n.anisotropy=16,n.mipmaps=[],n.generateMipmaps=!0,(new mt).load(t,(i=>{n.image=i,n.needsUpdate=!0,hd.set(t,n),e.map=n,e.needsUpdate=!0,Qu.needsUpdate=!0}))},pd=(e,t,n)=>{const[i,r,s,o,a]=t,l=n||o<1;return new U({name:e,color:new c(i,r,s),opacity:o,transparent:l,depthWrite:!l,alphaTest:.01,side:a})};class gd extends DataView{constructor(e,t){super(e),this.isLE=!0,this.appKeys=t}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=new DataView(new Uint8Array(2).buffer);for(let n=0;n<2;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint16(0,this.isLE)}getSoonUint32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint32(0,this.isLE)}getSoonFloat32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getFloat32(0,this.isLE)}}const md=new TextDecoder;class vd{constructor(){this.materials=new Map,this.sbmInfo=null}parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;r+=8;const s=[],o=[],a=[];for(let e=0;e<32;e++)s.push(i.getUint8(r)),r+=1;const l=i.getUint8(r);r+=1;const c=i.getUint8(r);r+=1;for(let e=0;e<32;e++)o.push(i.getUint8(r)),r+=1;for(let e=0;e<64;e++)a.push(i.getUint8(r)),r+=1;const u=[...o,...a,...s],h=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&h.push(u[e]);if(64!==h.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===l){const e=i.buffer.slice(r,i.buffer.byteLength),t=new gd(e,h);return 1===c||2===c?this._parseV2(t,n):3===c?this._parseV3(t,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})key 错误!`)}_parseV2(e,n){let i=0;const r=performance.now();i+=66;const s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,u[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){let t="";for(let n=0;n<l;n++){const n=e.getSoonUint8(i);n>127?t=t+"%"+n.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(n),t=""):c+=String.fromCharCode(n),i+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=pd(t,e,dd(c));if(this.materials.set(t,i),u[t].materialInfo=e,c){const{url:e,isPlatform:n}=this.sbmInfo,r=this.getTextureUrl(e,c,n);u[t].textureUrl=r,fd(i,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i);i+=2;const l=e.getSoonUint16(i).toString();i+=2,d[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],u=[],g=[],m=[],v=e.getSoonUint16(i);if(i+=2,v>0)for(let n=0;n<v;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,c.push(n)}const y=e.getSoonUint16(i);if(i+=2,y>0)for(let n=0;n<y;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const w=e.getSoonUint16(i);if(i+=2,w>0)for(let t=0;t<w;t++){const t=new h;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,u.push(t)}const b=e.getSoonUint16(i);if(i+=2,b>0)for(let t=0;t<b;t++){const t=e.getSoonUint16(i);i+=2;const n=e.getSoonUint16(i);i+=2;const r=e.getSoonUint16(i);i+=2;const s=[t,n,r];g.push(s),u.length>0&&m.push([u[s[0]],u[s[1]],u[s[2]]])}const A=[],x=[];for(let e=0;e<g.length;e++){const t=g[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=m[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),T=new Float32Array(x);d[o].position=S.buffer,d[o].uv=T.buffer;const E=new p;S.length>0&&E.setAttribute("position",new f(S,3)),T.length>0&&E.setAttribute("uv",new f(T,2)),E.computeVertexNormals();const D=E.getAttribute("normal").array.buffer;if(d[o].normal=D,this.materials.has(l)){const e=new Ju({id:`${o}_${Oi()}`,name:o.toString()},E,this.materials.get(l));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}_parseV3(e,n){let i=0;i+=66;const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,u[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){let t="";for(let n=0;n<l;n++){const n=e.getSoonUint8(i);n>127?t=t+"%"+n.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(n),t=""):c+=String.fromCharCode(n),i+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=pd(t,e,dd(c));if(this.materials.set(t,i),u[t].materialInfo=e,c){const{url:e,isPlatform:n}=this.sbmInfo,r=this.getTextureUrl(e,c,n);u[t].textureUrl=r,fd(i,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i).toString();i+=2;const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){const t=[];for(let n=0;n<l;n++){const n=e.getSoonUint8(i);t.push(n),i+=1}const n=new Uint8Array(t);c=md.decode(n)}const u=e.getSoonUint16(i).toString();i+=2,d[o]={meshName:c,materialId:u,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const g=[],m=[],v=[],y=[],w=e.getSoonUint32(i);if(i+=4,w>0)for(let n=0;n<w;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,g.push(n)}const b=e.getSoonUint32(i);if(i+=4,b>0)for(let n=0;n<b;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const A=e.getSoonUint32(i);if(i+=4,A>0)for(let t=0;t<A;t++){const t=new h;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,m.push(t)}const x=e.getSoonUint32(i);if(i+=4,x>0)for(let t=0;t<x;t++){const t=e.getSoonUint32(i);i+=4;const n=e.getSoonUint32(i);i+=4;const r=e.getSoonUint32(i);i+=4;const s=[t,n,r];v.push(s),m.length>0&&y.push([m[s[0]],m[s[1]],m[s[2]]])}const S=[],T=[];for(let e=0;e<v.length;e++){const t=v[e],n=g[t[0]],i=g[t[1]],r=g[t[2]];S.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=y[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),T.push(...s.toArray(),...o.toArray(),...a.toArray())}const E=new Float32Array(S),D=new Float32Array(T);d[o].position=E.buffer,d[o].uv=D.buffer;const C=new p;E.length>0&&C.setAttribute("position",new f(E,3)),D.length>0&&C.setAttribute("uv",new f(D,2)),C.computeVertexNormals();const I=C.getAttribute("normal").array.buffer;if(d[o].normal=I,this.materials.has(u)){const e=new Ju({id:`${o}_${Oi()}`,name:c},C,this.materials.get(u));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}}const yd=new TextDecoder;class wd{constructor(){this.materials=new Map,this.sbmInfo=null,this.isLE=!0}parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;r+=8;const s=i.getUint8(r);return r+=1,1===s||2===s?this._parseV2(i,r,n):3===s?this._parseV3(i,r,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}_parseV2(e,n,i){const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getUint16(n,this.isLE);n+=2;const c=e.getUint16(n,this.isLE);n+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getUint16(n,this.isLE).toString();n+=2,u[t]={materialInfo:[]},e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;const i=e.getFloat32(n,this.isLE);n+=4;const r=e.getFloat32(n,this.isLE);n+=4;const s=e.getFloat32(n,this.isLE);n+=4;const o=e.getFloat32(n,this.isLE);n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;let a=e.getUint8(n);n+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){let t="";for(let i=0;i<l;i++){const i=e.getUint8(n);i>127?t=t+"%"+i.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(i),t=""):c+=String.fromCharCode(i),n+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[i,r,s,o,a],n=pd(t,e,dd(c));if(this.materials.set(t,n),u[t].materialInfo=e,c){const{url:e,isPlatform:i}=this.sbmInfo,r=this.getTextureUrl(e,c,i);u[t].textureUrl=r,fd(n,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getUint16(n,this.isLE).toString();n+=2;const l=e.getUint16(n,this.isLE).toString();n+=2,d[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],u=[],g=[],m=[],v=e.getUint16(n,this.isLE);if(n+=2,v>0)for(let i=0;i<v;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4,c.push(i)}const y=e.getUint16(n,this.isLE);if(n+=2,y>0)for(let e=0;e<y;e++)n+=4,n+=4,n+=4;const w=e.getUint16(n,this.isLE);if(n+=2,w>0)for(let t=0;t<w;t++){const t=new h;t.setX(e.getFloat32(n,this.isLE)),n+=4,t.setY(e.getFloat32(n,this.isLE)),n+=4,u.push(t)}const b=e.getUint16(n,this.isLE);if(n+=2,b>0)for(let t=0;t<b;t++){const t=e.getUint16(n,this.isLE);n+=2;const i=e.getUint16(n,this.isLE);n+=2;const r=e.getUint16(n,this.isLE);n+=2;const s=[t,i,r];g.push(s),u.length>0&&m.push([u[s[0]],u[s[1]],u[s[2]]])}const A=[],x=[];for(let e=0;e<g.length;e++){const t=g[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=m[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),T=new Float32Array(x);d[o].position=S.buffer,d[o].uv=T.buffer;const E=new p;S.length>0&&E.setAttribute("position",new f(S,3)),T.length>0&&E.setAttribute("uv",new f(T,2)),E.computeVertexNormals();const D=E.getAttribute("normal").array.buffer;if(d[o].normal=D,this.materials.has(l)){const e=new Ju({id:`${o}_${Oi()}`,name:o},E,this.materials.get(l));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==i||i(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}_parseV3(e,n,i){const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getUint16(n,this.isLE);n+=2;const c=e.getUint16(n,this.isLE);n+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getUint16(n,this.isLE).toString();n+=2,u[t]={materialInfo:[]},e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;const i=e.getFloat32(n,this.isLE);n+=4;const r=e.getFloat32(n,this.isLE);n+=4;const s=e.getFloat32(n,this.isLE);n+=4;const o=e.getFloat32(n,this.isLE);n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;let a=e.getUint8(n);n+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){let t="";for(let i=0;i<l;i++){const i=e.getUint8(n);i>127?t=t+"%"+i.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(i),t=""):c+=String.fromCharCode(i),n+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[i,r,s,o,a],n=pd(t,e,dd(c));if(this.materials.set(t,n),u[t].materialInfo=e,c){const{url:e,isPlatform:i}=this.sbmInfo,r=this.getTextureUrl(e,c,i);u[t].textureUrl=r,fd(n,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getUint16(n,this.isLE).toString();n+=2;const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){const t=new Uint8Array(e.buffer,n,l);c=yd.decode(t),n+=l}const u=e.getUint16(n,this.isLE).toString();n+=2,d[o]={meshName:c,materialId:u,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const g=[],m=[],v=[],y=[],w=e.getUint32(n,this.isLE);if(n+=4,w>0)for(let i=0;i<w;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4,g.push(i)}const b=e.getUint32(n,this.isLE);if(n+=4,b>0)for(let i=0;i<b;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4}const A=e.getUint32(n,this.isLE);if(n+=4,A>0)for(let t=0;t<A;t++){const t=new h;t.setX(e.getFloat32(n,this.isLE)),n+=4,t.setY(e.getFloat32(n,this.isLE)),n+=4,m.push(t)}const x=e.getUint32(n,this.isLE);if(n+=4,x>0)for(let t=0;t<x;t++){const t=e.getUint32(n,this.isLE);n+=4;const i=e.getUint32(n,this.isLE);n+=4;const r=e.getUint32(n,this.isLE);n+=4;const s=[t,i,r];v.push(s),m.length>0&&y.push([m[s[0]],m[s[1]],m[s[2]]])}const S=[],T=[];for(let e=0;e<v.length;e++){const t=v[e],n=g[t[0]],i=g[t[1]],r=g[t[2]];S.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=y[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),T.push(...s.toArray(),...o.toArray(),...a.toArray())}const E=new Float32Array(S),D=new Float32Array(T);d[o].position=E.buffer,d[o].uv=D.buffer;const C=new p;E.length>0&&C.setAttribute("position",new f(E,3)),D.length>0&&C.setAttribute("uv",new f(D,2)),C.computeVertexNormals();const I=C.getAttribute("normal").array.buffer;if(d[o].normal=I,this.materials.has(u)){const e=new Ju({id:`${o}_${Oi()}`,name:c},C,this.materials.get(u));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==i||i(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}}const bd=new TextDecoder;class Ad{parseBuffer(e,t){switch(bd.decode(e.slice(0,8))){case"SBK-----":return(new vd).parseBuffer(e,t);case"SBM-----":return(new wd).parseBuffer(e,t);default:return Promise.reject(`In soonspacejs: sbm 资源模型(${t.url})格式或数据错误!`)}}}class xd{constructor(){this.materials=new Map}parseObject(e,t){const n=new rh(Object.assign(Object.assign({},t),{format:"sbm"})),i=new th({id:Oi()});n.add(i);const{materialsCache:r,meshsCache:s}=e;for(const[e,t]of Object.entries(r)){if(this.materials.has(e))continue;const{textureUrl:n,materialInfo:i}=t,r=pd(e,i,dd(n));this.materials.set(e,r),n&&fd(r,n)}for(const[e,t]of Object.entries(s)){const{meshName:n,materialId:r,position:s,uv:o,normal:a}=t,l=this.materials.get(r.toString());if(l){const t=new p,r=new Float32Array(s),c=new Float32Array(o),u=a&&new Float32Array(a);r.length>0&&t.setAttribute("position",new f(r,3)),c.length>0&&t.setAttribute("uv",new f(c,2)),u&&u.length>0?t.setAttribute("normal",new f(u,3)):t.computeVertexNormals();const h=new Ju({id:`${e}_${Oi()}`,name:n||e},t,l);i.add(h)}}return n}}class Sd extends Rh{constructor(e,t){super(Fn,e,t),this.viewport=e,this.isDisposed=!1,this.modelsPromiseMap=new Map,this.modelsMap=new Map,this._dbReady=!1,this.store=Lh.createInstance({name:"soonspace",storeName:"modelData"}),this.cacheStore=Lh.createInstance({name:"soonspace",storeName:"modelCache"}),this.loadingManager=new ie,this.datLoader=new ud(this.cacheStore),this.gltfLoader=new Gt(this.loadingManager),this.fbxLoader=new Fh(this.loadingManager),this.dracoDecoderPath=null,this._initLoadingManager(this.loadingManager)}setDracoDecoderPath(e){this.dracoDecoderPath=e;const t=new Ht;t.setDecoderPath(e),this.gltfLoader.setDRACOLoader(t),this.datLoader.dracoDecoderPath=e}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;const{url:n}=e,i=this.modelsPromiseMap.get(n);if(i){if(await i,this.isDisposed)return this.dispose(),null;const r=this.modelsMap.get(n);return r?this.clone(r,e,t):null}const r=this._innerLoad(e,t);return this.modelsPromiseMap.set(n,r),r}async parse(e){var t;const{url:n,id:i}=e;if(!n)return Zn(`id: ${i} url: ${n} is empty`),null;switch(null===(t=Ri(n))||void 0===t?void 0:t.toLocaleUpperCase()){case"SBM":return this._parseSbm(e);case"SBMX":return this._parseSbmx(e);case"DAT":return this._parseDat(e);case"GLB":case"GLTF":return this._parseGltf(e);case"FBX":return this._parseFbx(e);default:return Zn(`模型资源( id: ${i}, url: ${n} )格式错误,当前格式支持 sbm、sbmx、fbx、gltf、glb !`),null}}clone(e,t,n){return new Promise(((i,r)=>{var s;"Model"!==e.stype&&r("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:a,level:l,visible:c,position:u,rotation:h,scale:d,onClick:f,onDblClick:p,onRightClick:g,onLoad:m,userData:v}=t;function y(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)y(e.children[i],t.children[i],n)}const w=function(e){const t=new Map,n=new Map,i=e.sClone();return y(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e instanceof E){const i=e,r=t.get(e),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i}(e);w.animations=w.animations.map((e=>e.clone())),o&&(w.sid=o),a&&(w.name=a),l&&(w.level=l),!1===c?w.hide():!0===c&&w.show(),u&&w.position.set(u.x,u.y,u.z),h&&w.rotation.set(h.x,h.y,h.z),d&&w.scale.set(d.x,d.y,d.z),w.onClick=f?f.bind(w):null,w.onDblClick=p?p.bind(w):null,w.onRightClick=g?g.bind(w):null,w.onLoad=m?m.bind(w):null,null===(s=w.onLoad)||void 0===s||s.call(w,w),v&&(w.userData=v),null!==n&&this.viewport.scener.addObject(w,n||this.scene||e.parent),i(w)}))}async loadToGroup(e,t){const n=this.createGroup(e,null);return await Promise.allSettled(t.map((e=>this.load(e,null).then((e=>e&&n.add(e))).catch(console.error)))),this.viewport.scener.addObject(n,this.scene),n}async addForGroup(e,t){return e&&await Promise.allSettled(t.map((async t=>this.load(t,null).then((t=>t&&this.viewport.scener.addObject(t,e))).catch(console.error)))),e}async clearIdb(){await this._checkDbReady(),await this.store.clear(),await this.cacheStore.clear()}dispose(){var e;this.isDisposed=!0,this.modelsPromiseMap.clear(),this.modelsMap.clear(),null===(e=this.gltfLoader.dracoLoader)||void 0===e||e.dispose(),this.datLoader.dispose()}async _checkDbReady(){this._dbReady||(await Promise.all([this.store.ready(),this.cacheStore.ready()]),this._dbReady=!0)}_initLoadingManager(e){e.addHandler(/\.tga$/i,new zt)}_setModelsMap(e,t){this.modelsMap.has(e)||this.modelsMap.set(e,t)}async _parseSbm(e){const{useIndexedDB:t}=this.viewport.options,{url:n}=e,i=async t=>{const i=await(new Ad).parseBuffer(t,e),{model:r,caches:s}=i;return await this._checkDbReady(),s&&wi((()=>{this.cacheStore.setItem(n,s)})),r},r=e=>{var t;null===(t=e.onLoad)||void 0===t||t.call(e,e)};if(t){await this._checkDbReady();const t=await this.cacheStore.getItem(n);if(t){const n=(new xd).parseObject(t,e);return r(n),n}{const e=await this.store.getItem(n)||await this._fetchBuffer(n),t=await i(e);return r(t),t}}{const e=await this._fetchBuffer(n),t=await i(e);return r(t),t}}async _parseSbmx(e){const{url:t}=e,n=await this._getBuffer(t),i=Pi(n,0,8),r=new DataView(n.slice(8));switch(i){case"SBMG----":for(let e=0;e<r.byteLength;e++){const t=r.getUint8(e),n=(t>>4&15)+(t<<4&240);r.setUint8(e,n)}return this._parseGltf(e,r.buffer);case"SBMD----":return this._parseDat(e,r.buffer);default:return this._parseGltf(e,n)}}async _parseDat(e,t){const{url:n}=e,i=t||await this._getBuffer(n),r=new rh(Object.assign(Object.assign({},e),{format:"dat"})),s=await this.datLoader.parseAsync(i,n);return s&&r.add(s),r}async _parseGltf(e,t){const{url:n}=e,i=li(n),r=t||await this._getBuffer(n),s=new rh(Object.assign(Object.assign({},e),{format:"gltf"})),o=await this.gltfLoader.parseAsync(r,i),{animations:a}=o;return a&&a.length>0&&(s.animations=a),o.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e instanceof vt&&(e.frustumCulled=!0),e.castShadow=!0,e.receiveShadow=!0})),s.add(o.scene),s}async _parseFbx(e){const{url:t}=e,n=li(t),i=await this._getBuffer(t),r=new rh(Object.assign(Object.assign({},e),{format:"gltf"})),s=this.fbxLoader.parse(i,n),{animations:o}=s;return o&&o.length>0&&(r.animations=o),r.add(s),r}async _innerLoad(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;var n;const{url:i}=e,r=await this.parse(e);return r?(null===(n=r.onLoad)||void 0===n||n.call(r,r),this._setModelsMap(i,r.sClone()),null!==t&&this.viewport.scener.addObject(r,t),r):null}async _fetchBuffer(e){const{useIndexedDB:t}=this.viewport.options,n=await fi(e),i=await n.arrayBuffer();return t&&(await this._checkDbReady(),this.store.setItem(e,i)),i}async _getBuffer(e){const{useIndexedDB:t}=this.viewport.options;if(t){const t=await this.store.getItem(e);return t||this._fetchBuffer(e)}return this._fetchBuffer(e)}}class Td extends Rh{constructor(e,t){super(zn,e,t),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new ah(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:i,type:r,name:s,level:o,visible:a,position:l,rotation:c,scale:u,onClick:h,onDblClick:d,onRightClick:f,userData:p}=t,g=e.sClone(!1,r);return this._copyMaterial(g),i&&(g.sid=i),s&&(g.name=s),o&&(g.level=o),Ei(a)&&(g.visible=a),l&&g.position.set(l.x,l.y,l.z),c&&g.rotation.set(c.x,c.y,c.z),u&&g.scale.set(u.x,u.y,u.z),g.onClick=h?h.bind(g):null,g.onDblClick=d?d.bind(g):null,g.onRightClick=f?f.bind(g):null,p&&(g.userData=p),null!==n&&this.viewport.scener.addObject(g,n||this.scene||e.parent),g}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this._createMaterial(e.url),i=new ah(t,e);n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=this._createMaterial(t.url),i=new ah(n,t);e.add(i)})),this.viewport.scener.addObject(e,this.scene)),e}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new l).load(e);t.flipY=!0;const n=new qe({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof k||e instanceof Ke)&&(Ci(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof be&&(e.material=e.material.clone()))}))}}class Ed extends Rh{constructor(e,t){super(Gn,e,t)}create(e){this._openEnableRenderCss(e);const t=new ih(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new ih(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{this._openEnableRenderCss(t);const n=new ih(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Dd extends Rh{constructor(e,t){super(Hn,e,t)}create(e){const t=new wh(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=new wh(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=new wh(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}}class Cd{constructor(){this.graph=new Map,this.queue=null,this.previous=new Map}setGraph(e){if(!(e.length<1))for(const t of e){const[e,n]=t;this.graph.set(e,new Map);for(const t of n){const[n,i]=t,r=this.graph.get(e);null==r||r.set(n,i)}}}getPath(e,t){var n;if(e===t)return[];const i=this.queue=new si;i.add(e,0),this.previous.set(e,null);let r=null;for(;r=i.shift();){if(r===t){const e=[];for(;null!==r&&null!==this.previous.get(r);)e.unshift(r),r=null!==(n=this.previous.get(r))&&void 0!==n?n:null;return e}const e=i.getDistance(r);if(e===1/0)return[];const s=this.graph.get(r);s&&s.forEach(((t,n)=>{const s=i.getDistance(n),o=e+t;o<s&&(i.update(n,o),this.previous.set(n,r))}))}return[]}}class Id extends Rh{constructor(e,t){super(Vn,e,t),this.dijkstra=new Cd}async createFromGml(e){const{url:t,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255}=e;return Ai(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const o=[],a=new Map;let l=[],c=[];const u=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Ci(u)?u.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...u.state],c=[...c,...u.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],i=e.State.topoNode["gml:Node"].node_name;o.push({id:Ti(n)?n:"",name:Ti(i)?i:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],r=e.Transition.topoEdge["gml:Edge"].passable["#text"],s=a.get(t),l=a.get(n),c=e.Transition._attributes["gml:id"],u=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==s&&void 0!==l&&("2"!==r&&"3"!==r&&o[s].graphs.push({targetNodeId:n,linkInfo:{id:c,name:u},enable:!0,restrict:parseInt(i),passable:parseInt(r)}),"1"!==r&&"3"!==r&&o[l].graphs.push({targetNodeId:t,linkInfo:{id:c,name:u},enable:!0,restrict:parseInt(i),passable:parseInt(r)}))}));const h=new ph(Object.assign(Object.assign({},e),{type:"network",nodes:o,linkWidth:n,renderLink:!0,linkColor:i,renderNode:r,nodeColor:s}));return this.setDijkstraGraph(h.nodes),this.viewport.scener.addObject(h,this.scene),Promise.resolve(h)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e),n=new ph(t);return this.setDijkstraGraph(n.nodes),this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e),i=new ph(t);this.setDijkstraGraph(i.nodes),n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&t.forEach((t=>{const n=this.generateLineTopologyInfoNodeGraphs(t),i=new ph(n);this.setDijkstraGraph(i.nodes),e.add(i)})),e}getShortestPath(e,n){const i=ci(e.info.nodes),r=Kn(n.start),s=Kn(n.end);let o=null,a=1/0,l=null,c=1/0;for(let n=0;n<i.length;n++){const u=i[n];if(0===u.graphs.length)continue;const h=e.nodes.find((e=>e.sid===u.id));if(!h)continue;const d=h.getWorldPosition(new t),f=d.distanceTo(r),p=d.distanceTo(s);f<a&&(a=f,o=u),p<c&&(c=p,l=u)}if(!o||!l||o.id===l.id)return null;const u=o.id,h=l.id,d=this.dijkstra.getPath(u,h);if(0===d.length)return null;d.unshift(o.id);const f=[];for(let e=0;e<d.length;e++){const t=i.find((t=>t.id==d[e]));t&&(t.id+=Oi(),t.position.y+=.01,f.push(t))}const p=Object.assign(Object.assign(Object.assign({},n),{type:"line",nodes:f}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(p);const g=new ph(p);return this.viewport.scener.addObject(g,this.scene),g}getShortestPathByMultipleStartPoints(e,i){const{nodes:s}=e.info,o=[];i.start.forEach((e=>{const t=Kn(e),n=Kn(i.end);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=Kn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?Kn(o.position).distanceTo(t):Kn(o.position).distanceTo(Kn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(Kn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new ph(s);return this.viewport.scener.addObject(o,this.scene),o}return null}getShortestPathByMultipleEndPoints(e,i){const{nodes:s}=e.info,o=[];i.end.forEach((e=>{const t=Kn(i.start),n=Kn(e);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=Kn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?Kn(o.position).distanceTo(t):Kn(o.position).distanceTo(Kn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(Kn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new ph(s);return this.viewport.scener.addObject(o,this.scene),o}return null}setDijkstraGraph(e){const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(0===r.graphs.length)continue;const s=[];for(let n=0;n<r.graphs.length;n++){const i=r.graphs[n],o=e.find((e=>e.sid===i.targetNodeId));if(!o)continue;const a=r.getWorldPosition(new t),l=o.getWorldPosition(new t);s.push([i.targetNodeId,a.distanceTo(l)])}n.push([r.sid,s])}n.length>0&&this.dijkstra.setGraph(n)}generateLineTopologyInfoNodeGraphs(e){const{type:t,nodes:n}=e;if("line"===t)for(let t=0;t<n.length;t++)if(t===n.length-1)n[t].graphs=[];else{const i=e.nodes[t],r=e.nodes[t+1];n[t].graphs=[{targetNodeId:r.id,linkInfo:{id:`${i.id}_to_${r.id}`,name:`${i.name||i.id}_to_${r.name||r.id}`},enable:!0,restrict:0,passable:0}]}return Object.assign(Object.assign({},e),{nodes:n})}}class Bd extends Rh{constructor(e,t){super(Wn,e,t)}addGridHelper(e){const{id:t,size:n=1e3,divisions:i=20,color:r="#fff",position:s={x:0,y:0,z:0},rotation:o={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new yt(n,i,r,r);return l.position.set(s.x,s.y,s.z),l.rotation.set(o.x,o.y,o.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,i=new wt(n);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addBoxHelper(e){const{id:t,box:n,color:i="#00ff00"}=e,r=new bt(n,new c(i));return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPlaneHelper(e){const{id:t,width:n=500,height:i=500,color:r="#00ff00",opacity:s=.2,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new Ju({id:t,position:o,rotation:a,scale:l},new Fe(n,i),new je({color:r,opacity:s,transparent:s<1,side:he}));return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:i=500,height:r=500,opacity:s=1,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:c={x:1,y:1,z:1},repeat:u={x:10,y:10}}=e,h=(new l).load(t),d=new Fe(i,r);d.computeBoundingBox();const f=new U({side:he,map:h,transparent:s<1,opacity:s,roughness:.8});f.map&&(f.map.repeat.set(u.x,u.x),f.map.wrapS=ne,f.map.wrapT=ne,f.map.version++),a.x-=Math.PI/2,f.version++;const p=new bh({id:n,position:o,rotation:a,scale:c},d,f);return p.userData.sid=n,p.userData.stype="Helper",this.viewport.scener.addObject(p,this.scene),p}addDirectionalLightHelper(e){const{id:t,light:n,color:i,size:r=50}=e,s=new At(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addHemisphereLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new xt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addSpotLightHelper(e){const{id:t,light:n,color:i}=e,r=new St(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPointLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new Tt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addRectAreaLightHelper(e){const{id:t,light:n,color:i}=e,r=new Yt(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}}class Md extends Rh{constructor(e,t){super(Yn,e,t)}createObject(e,t){const n=new nh(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){return e?(this.viewport.scener.addObject(t,e),e):null}}class Pd extends Rh{constructor(e,t){super(Un,e,t)}}class Od{constructor(e){this.viewport=e,this.cache={objects:new Map,classified:{Group:new Set,Light:new Set,Model:new Set,Poi:new Set,PoiNode:new Set,Canvas3D:new Set,Topology:new Set,Helper:new Set,PluginObject:new Set}},this.scene=e.scene,this.store={groupManager:new Pd(e,this.scene),lightManager:new _h(e,this.scene),modelManager:new Sd(e,this.scene),poiManager:new Td(e,this.scene),poiNodeManager:new Ed(e,this.scene),canvas3DManager:new Dd(e,this.scene),topologyManager:new Id(e,this.scene),helperManager:new Bd(e,this.scene),pluginObjectManager:new Md(e,this.scene)},e.postUpdate.set("ManagerRender",this.update.bind(this)),e.signals.objectAdded.add(this.setObjectCache.bind(this)),e.signals.objectRemoved.add(this.deleteObjectCache.bind(this))}levelUpdate(){const e=(e,t)=>{e.visible!==t&&(e.visible=t,e.matrixAutoUpdate=t,e.autoUpdate=!0)},t=t=>{const{level:n,handleHide:i,autoUpdate:r}=t,{max:s=null,min:o=null}=n;if(r)t.autoUpdate=!1,this.viewport.signals.objectChanged.dispatch();else if(!i&&(Di(s)||Di(o))){const n=this.viewport.camera.position.distanceTo(t.position);Di(s)&&n>s||Di(o)&&n<o?e(t,!1):e(t,!0)}};this.scene.traverse((e=>{(e instanceof eh||e instanceof Ju)&&t(e)}))}update(){if(0===this.scene.children.length)return;const e=performance.now();this.viewport.options.levelEnabled&&this.levelUpdate(),this.viewport.signals.loadRendered.dispatch(performance.now()-e)}isObjectInScene(e){let t=!1;return e.traverseAncestors((e=>{e===this.scene&&(t=!0)})),t}getObjectById(e){const t=this.getObjectCache(e);if(t){if(this.isObjectInScene(t))return t}return null}getObjectByName(e){return this._getObjectByProps("name",e)}getObjectByUserDataProperty(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&Ii(i)&&(i instanceof eh||i instanceof Ju||i.userData.stype)&&(Bi(e)&&e(i.userData)||Ti(e)&&i.userData[e]===t)&&n.push(i)})),n}removeObjectById(e){const t=this.getObjectById(e);return!!t&&(this.viewport.scener.removeObject(t),!0)}_getObjectByProps(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&((i instanceof eh||i instanceof Ju)&&Ii(i)&&i[e]===t||Ii(i)&&i.userData.stype&&("name"===e&&i.name===t||"sid"===e&&i.userData.sid===t))&&n.push(i)})),n}getObjectCache(e){return this.cache.objects.get(e)}setObjectCache(e){const t=(e,t)=>{const n=this.cache.objects.get(t);n&&n!==e&&Zn(`object id ${t} already exists in scene`)};null==e||e.traverse((n=>{if(n instanceof eh||n instanceof Ju){if("string"==typeof n.sid&&n.sid.startsWith(Nn))return;t(n,n.sid),this.cache.objects.set(n.sid,n);const e=n.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}else if(n.userData.sid&&e.userData.stype){t(n,n.userData.sid),this.cache.objects.set(n.userData.sid,n);const e=n.userData.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}}))}deleteObjectCache(e){null==e||e.traverse((t=>{if(t instanceof eh||t instanceof Ju){this.cache.objects.delete(t.sid);const e=t.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}else if(t.userData.sid&&e.userData.stype){this.cache.objects.delete(t.userData.sid);const e=t.userData.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}}))}clearObject(){this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.lightManager.clear()}dispose(){this.store.modelManager.dispose(),this.cache.objects.clear(),this.clear()}}function Rd(e){const t=_d(e),n=new d;n.setFromMatrix3(t);const i=e[0],r=n.clone();r.setPosition(i);const s=r.clone().invert(),o=e.map((e=>{const t=e.clone().applyMatrix4(s);return new h(t.x,t.y)})),a=new tt(o),l=new et(a),c=new Et;c.setFromPoints(o);const u=kd(c);return l.getAttribute("uv").applyMatrix3(u),l.applyMatrix4(n),{geometry:l,polygonBox:c,modelMatrix:n,planeMatrix:r,projectionMatrix:s,position:i}}function _d(e){const[n,i,r]=e,s=new Dt;s.setFromCoplanarPoints(i,n,r);const o=s.normal,a=o.clone().cross(new t(0,0,1));a.equals(new t)&&a.set(1,0,0);const l=o.clone().cross(a);a.normalize(),l.normalize(),o.normalize();const c=new Be;return c.elements=[a.x,a.y,a.z,l.x,l.y,l.z,o.x,o.y,o.z],c}function kd(e){const t=e.min,n=e.getSize(new h),i=new Be;return i.elements=[n.x,0,0,0,n.y,0,t.x,t.y,1],i.invert()}function Ld(e,t){const n=Jn(t);return e.intersectsBox(n)}function Nd(e,t,n){if("string"==typeof e){let i=t?null==n?void 0:n.get(e):null;if(!i){i=(new l).load(e),null==n||n.set(e,i)}return i}return e instanceof HTMLImageElement?new u(e):e instanceof HTMLCanvasElement?new Ct(e):new Oe(e)}function Ud(e,t,n,i){const r=e.map,s=Nd(t,n,i);if(!r)return e.map=s,s;const o=s.source;return s.copy(r),s.source=o,e.map=s,s}function jd(e,n){const{top:r,left:s,bottom:o,right:a,front:l,back:c}=e,u=new t(a,r,l),h=new t(s,o,c),d=new i;return function(e){return d.max.addVectors(e,u),d.min.subVectors(e,h),n.filter((e=>Ld(d,e)))}}function Fd(e,n){const i=new H(new t,e);return function(e){return i.center.copy(e),n.filter((e=>Ld(i,e)))}}function zd(e,n){const i=e.length-1,r=[];for(let t=0;t<i;t++){const n=e[t],i=e[t+1],s=new y(n,i);r.push(s)}const s=new H(new t,n);return function(e){return e.filter((e=>{const n=Jn(e),i=new t;n.getCenter(i);const o=r.filter((e=>{const t=e.closestPointToPointParameter(i);return 0<=t||t>=1}));if(0===o.length)return!1;let a=1/0,l=i;for(const e of o){const n=e.closestPointToPoint(i,!0,new t),r=i.distanceToSquared(n);r<a&&(a=r,l=n)}return s.center.copy(l),s.intersectsBox(n)}))}}function Gd(e,t){const{image:n,color:i,width:r,height:s,position:o,rotation:a,needLight:l,id:c,name:u,userData:h,level:d,visible:f,cache:p}=e,g=es(e,["image","color","width","height","position","rotation","needLight","id","name","userData","level","visible","cache"]),m=new Fe(r,s),v=n?Object.assign(Object.assign({transparent:!0},g),{map:Nd(n,null==p||p,t)}):g,y=l?new It(v):new je(v),w=new Ju({id:c,name:u,userData:h,level:d,visible:f},m,y);return o&&w.position.set(o.x,o.y,o.z),a&&w.rotation.set(a.x,a.y,a.z),w}function Hd(e,n){const{points:i,image:r,color:s,needLight:o,id:a,name:l,userData:c,level:u,visible:h,cache:d}=e,f=es(e,["points","image","color","needLight","id","name","userData","level","visible","cache"]),p=i.map((e=>new t(e.x,e.y,e.z))),g=r?Object.assign(Object.assign({transparent:!0},f),{map:Nd(r,null==d||d,n)}):f,m=o?new It(g):new je(g),{geometry:v,position:y}=Rd(p),w=new Ju({id:a,name:l,userData:c,level:u,visible:h},v,m);return w.position.copy(y),w}p.prototype.computeBoundsTree=Nt,p.prototype.disposeBoundsTree=Ut,k.prototype.raycast=jt,Ge.prototype.firstHitOnly=!0,e.ColorManagement.enabled=!0;class Vd{constructor(t){this.THREE=e,this.TWEEN=Ln,this.utils=_i,this.version=Xt,this.animation=Li,this.library=Ah,this.plugins={},this.azimuth=new Mh,this.textureCache=new Map;const{el:n,options:i={},events:r={}}=t;if(this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showStats:!1,showViewHelper:!1,showGrid:!1,background:{color:11459572,alpha:!1},fog:!1,controls:{type:"free"},hoverEnabled:!1,levelEnabled:!1,closeInfoLog:!1,closeWarnLog:!1,useIndexedDB:!0,logarithmicDepthBuffer:!0}),i),this.viewport=new qu(this.options),this.signals=this.viewport.signals,this.manager=new Od(this.viewport),!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(r),this._initDefaultSettings()}_init(){const{showGrid:e,background:t,fog:n,controls:i,closeInfoLog:r,closeWarnLog:s,useIndexedDB:o}=this.options;if(!r){Xn(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),Xn(Qt,{color:"#3eaf7c","font-size":"24px"}),Xn(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),Xn("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),Xn("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),Xn("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}e&&this.addGridHelper(!0===e?{id:"defaultGridHelper"}:e),(null==t?void 0:t.skyBox)?Ti(null==t?void 0:t.skyBox)?this.setSphereSkyBackground(null==t?void 0:t.skyBox):Ii(null==t?void 0:t.skyBox)&&this.setSkyBackground(t.skyBox.dirPath,t.skyBox.fileNames):(null==t?void 0:t.img)?this.setBackgroundImage(t.img):(null==t?void 0:t.color)&&this.setBackgroundColor(t.color),n&&this.openSceneFog(!0===n?void 0:n),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),o&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:i,modelRightClick:r,modelDblClick:s,poiHover:o,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:u,selectPosition:h,sceneClick:d,resize:f}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),i&&this.signals.modelClick.add(i),r&&this.signals.modelRightClick.add(r),s&&this.signals.modelDblClick.add(s),o&&this.signals.poiHover.add(o),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),u&&this.signals.poiDblClick.add(u),h&&this.signals.selectPosition.add(h),d&&this.signals.sceneClick.add(d),f&&this.signals.windowResize.add(f),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultSettings(){this.setEnvironment(),this.setColorSpace("sRGB"),this.setToneMapping({type:"ACESFilmic",exposure:.8})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){const n=this.getObjectById(e);return this.manager.store.pluginObjectManager.addToObject(n,t)}getPluginObjectById(e){return Zn("getPluginObjectById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPluginObjectByName(e){return Zn("getPluginObjectByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}removePluginObjectById(e){return Zn("removePluginObjectById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}setSSR(e){this.viewport.setSSR(e)}setBloom(e){this.viewport.setBloom(e)}setSSAO(e){this.viewport.setSSAO(e)}setColorSpace(e){this.viewport.setColorSpace(e)}setToneMapping(e){this.viewport.setToneMapping(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundColorAlpha(e,t){this.viewport.setBackgroundColorAlpha(e,t)}setBackgroundImage(e){return this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){return this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){return this.viewport.setSkyBackground(e,t)}setEnvironment(e){return this.viewport.setEnvironment(e)}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){this.manager.dispose(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}getCameraTargetView(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraTargetView(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return"orbit"===this.viewport.controls.options.type&&this.utils.warn("flyTo 方法不适用于 orbit 控制器"),this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frontTop",t=arguments.length>1?arguments[1]:void 0;return this.flyToObj(this.manager.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}setSky(e){return this.viewport.setSky(e)}getScreenshot(){return this.screenshot()}screenshot(){return this.viewport.screenshot()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.lightManager.createAmbientLight(e)}setAmbientLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setAmbientLight(t,e)}createDirectionalLight(e){return this.manager.store.lightManager.createDirectionalLight(e)}setDirectionalLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setDirectionalLight(t,e)}createHemisphereLight(e){return this.manager.store.lightManager.createHemisphereLight(e)}setHemisphereLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setHemisphereLight(t,e)}createSpotLight(e){return this.manager.store.lightManager.createSpotLight(e)}setSpotLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setSpotLight(t,e)}createPointLight(e){return this.manager.store.lightManager.createPointLight(e)}setPointLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setPointLight(t,e)}createRectAreaLight(e){return this.manager.store.lightManager.createRectAreaLight(e)}setRectAreaLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setRectAreaLight(t,e)}getLightById(e){return Zn("getLightById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeLightById(e){return Zn("removeLightById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}getAllLight(){return this.manager.store.lightManager.getAll()}clearLight(){return this.manager.store.lightManager.clear()}showAllLight(){return this.manager.store.lightManager.showAll()}hideAllLight(){return this.manager.store.lightManager.hideAll()}updateAllShadow(){return this.manager.store.lightManager.updateAllShadow()}getObjectById(e){return this.manager.getObjectById(e)}getObjectByName(e){return this.manager.getObjectByName(e)}getObjectByUserDataProperty(e,t){return this.manager.getObjectByUserDataProperty(e,t)}removeObjectById(e){return this.manager.removeObjectById(e)}createGroup(e){return this.manager.store.groupManager.createGroup(e)}getGroupById(e){return Zn("getGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getGroupByName(e){return Zn("getGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllGroup(){return this.manager.store.groupManager.getAll()}showAllGroup(){return this.manager.store.groupManager.showAll()}hideAllGroup(){return this.manager.store.groupManager.hideAll()}removeGroupById(e){return Zn("removeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}loadSbm(e){return Zn("loadSbm is deprecated, use loadModel instead"),this.loadModel(e)}parseSbm(){Zn("parseSbm is deprecated!")}cloneSbm(e,t,n){return Zn("cloneSbm is deprecated, use cloneModel instead"),this.cloneModel(e,t,n)}getSbmById(e){return Zn("getSbmById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmByName(e){return Zn("getSbmByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getSbmByUserDataProperty(e,t){return Zn("getSbmByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeSbmById(e){return Zn("removeSbmById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForSbm(e){return Zn("createGroupForSbm is deprecated, use createGroup instead"),this.createGroup(e)}loadSbmToGroup(e,t){return Zn("loadSbmToGroup is deprecated, use loadModelToGroup instead"),this.loadModelToGroup(e,t)}addSbmForGroup(e,t){return Zn("addSbmForGroup is deprecated, use addModelForGroup instead"),this.addModelForGroup(e,t)}createSbmGroupFromXml(){Zn("createGroupForSbm is deprecated!")}getSbmGroupById(e){return Zn("getSbmGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmGroupByName(e){return Zn("getSbmGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllSbmGroup(){return Zn("getAllSbmGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeSbmGroupById(e){return Zn("removeSbmGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearSbm(){return Zn("clearSbm is deprecated, use clearModel instead"),this.clearModel()}getAllSbm(){return Zn("getAllSbm is deprecated, use getAllModel instead"),this.getAllModel()}showAllSbm(){return Zn("showAllSbm is deprecated, use showAllModel instead"),this.showAllModel()}hideAllSbm(){return Zn("hideAllSbm is deprecated, use hideAllModel instead"),this.hideAllModel()}getSbmModelMaps(){return Zn("getSbmModelMaps is deprecated, use getModelsMap instead"),this.getModelsMap()}setSbmModelMaps(e){return Zn("setSbmModelMaps is deprecated, use setModelsMap instead"),this.setModelsMap(e)}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return Zn("getModelById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelByName(e){return Zn("getModelByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getModelByUserDataProperty(e,t){return Zn("getModelByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeModelById(e){return Zn("removeModelById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForModel(e){return Zn("createGroupForModel is deprecated, use createGroup instead"),this.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.modelManager.addForGroup(n,t)}getModelGroupById(e){return Zn("getModelGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelGroupByName(e){return Zn("getModelGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllModelGroup(){return Zn("getAllModelGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeModelGroupById(e){return Zn("removeModelGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}computeModelsBoundsTree(e){return this.viewport.bvh.computeModelsBoundsTree(e)}clearIdb(){return this.manager.store.modelManager.clearIdb()}getModelsMap(){return this.manager.store.modelManager.modelsMap}setModelsMap(e){this.manager.store.modelManager.modelsMap=e}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return Zn("getPoiById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiByName(e){return Zn("getPoiByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiByUserDataProperty(e,t){return Zn("getPoiByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiById(e){return Zn("removePoiById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoi(e){return Zn("createGroupForPoi is deprecated, use createGroup instead"),this.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiManager.addForGroup(n,t)}getPoiGroupById(e){return Zn("getPoiGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiGroupByName(e){return Zn("getPoiGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiGroup(){return Zn("getAllPoiGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiGroupById(e){return Zn("removePoiGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return Zn("getPoiNodeById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeByName(e){return Zn("getPoiNodeByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiNodeByUserDataProperty(e,t){return Zn("getPoiNodeByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiNodeById(e){return Zn("removePoiNodeById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoiNode(e){return Zn("createGroupForPoiNode is deprecated, use createGroup instead"),this.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiNodeManager.addForGroup(n,t)}getPoiNodeGroupById(e){return Zn("getPoiNodeGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeGroupByName(e){return Zn("getPoiNodeGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiNodeGroup(){return Zn("getAllPoiNodeGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiNodeGroupById(e){return Zn("removePoiNodeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createPoiMesh(e){const t=Gd(e,this.textureCache);return this.addObject(t),t}createPolygonPoiMesh(e){const t=Hd(e,this.textureCache);return this.addObject(t),t}setTexture(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{cache:i=!0,independ:r=!0}=n||{};let s=e.material;if(r&&(s=s.clone(),e.material=s),null===t)return s.map=null,this.render(),null;const o=Ud(s,t,i,this.textureCache);return this.render(),o}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return Zn("getCanvas3DById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DByName(e){return Zn("getCanvas3DByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getCanvas3DByUserDataProperty(e,t){return Zn("getCanvas3DByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeCanvas3DById(e){return Zn("removeCanvas3DById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForCanvas3D(e){return Zn("createGroupForCanvas3D is deprecated, use createGroup instead"),this.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.canvas3DManager.addForGroup(n,t)}getCanvas3DGroupById(e){return Zn("getCanvas3DGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DGroupByName(e){return Zn("getCanvas3DGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllCanvas3DGroup(){return Zn("getAllCanvas3DGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeCanvas3DGroupById(e){return Zn("removeCanvas3DGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return Zn("getTopologyById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyByName(e){return Zn("getTopologyByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getTopologyByUserDataProperty(e,t){return Zn("getTopologyByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeTopologyById(e){return Zn("removeTopologyById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForTopology(e){return Zn("createGroupForTopology is deprecated, use createGroup instead"),this.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.topologyManager.addForGroup(n,t)}getTopologyGroupById(e){return Zn("getTopologyGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyGroupByName(e){return Zn("getTopologyGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllTopologyGroup(){return Zn("getAllTopologyGroup is deprecated, use getAllGroups instead"),this.getAllGroup()}removeTopologyGroupById(e){return Zn("removeTopologyGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return Zn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}addRectAreaLightHelper(e){return this.manager.store.helperManager.addRectAreaLightHelper(e)}getHelperById(e){return Zn("getHelperById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeHelperById(e){return Zn("removeHelperById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}createFindObjectsInBoxNearPosition(e,t){return jd(e,t)}createFindObjectsInSphereNearPosition(e,t){return Fd(e,t)}createFindObjectsNearPath(e,t){return zd(e,t)}createPathAnimation(e,t,n){return new Ni(e,t,n)}createTopologyAnimation(e,n,i){const r=n.nodes.map((e=>e.getWorldPosition(new t)));return new Ni(e,r,i)}createPathAnimationAction(e,t,n){return Oh(e,t,this,n)}createPathAnimationActionForCamera(e,n){var i;return function(e,n,i,r){let{eyeHeight:s,anchor:o,front:a,enableUp:l}=null!=r?r:{};return s=null!=s?s:100,l=null!=l&&l,o=null!=o?o:new t(0,-s,0),a=null!=a?a:new t(0,0,l?1:-1),Oh(e,n,i,Object.assign(Object.assign({},r),{anchor:o,front:a,enableUp:l}))}(null!==(i=null==n?void 0:n.camera)&&void 0!==i?i:this.viewport.camera,e,this,n)}createBonePathAnimation(e,t,n){return function(e,t,n,i){const r=i?Eh(i,!1):null,s=Ph(t),o=Mr(Object.assign(Object.assign(Object.assign({},r),s),{target:e})),{model:a,clip:l}=o,c=n.playModelAnimation(a,l);return Object.assign(Object.assign({},o),{action:c})}(e,t,this,n)}createChainSkeletalModel(e,t){return function(e,t){const n=gr(Object.assign(Object.assign({},t),{target:e})),{model:i,skeleton:r}=n;return{skeletalModel:i,skeleton:r}}(e,t)}createPathAnimationForBones(e,t,n){const i=function(e,t,n){return Pr(Object.assign(Object.assign({},n),{target:e,skeleton:t}))}(e,t,n);return this.playModelAnimation(e,i)}}Vd.THREE=e,Vd.TWEEN=Ln,Vd.utils=_i;export{Gr as AnimationActionController,jr as AnimationActionKeyframe,Fr as AnimationActionOperate,Ur as AnimationClipKeyframe,$i as DirectionSide,Vr as GuiAnimationActionController,Vd as SoonSpace,Ld as boundingIsIntersected,cr as configVertexWeightByEquallyDivided,hr as configVertexWeightForChainBones,ur as configVertexWeightForEqualChainBones,zr as createAnimationOperate,Mr as createBonePathAnimation,sr as createChainBones,or as createChainBonesByAxials,ar as createChainBonesByJoints,gr as createChainSkeletalModel,dr as createChainSkinnedMesh,fr as createChainSkinnedMeshForMesh,br as createCurveAnimationClip,Ar as createCurveAnimationClipByCurve,Cr as createCurveAnimationClipByPolyline,Pr as createCurveAnimationClipForBones,_r as createCurveAnimationClipForBonesTarget,Vi as createCurveBufferGeometry,lr as createEqualChainBones,jd as createFindObjectsInBoxNearPosition,Fd as createFindObjectsInSphereNearPosition,zd as createFindObjectsNearPath,Wr as createGuiAnimationController,Or as createKeyframeTracksForBones,kr as createKeyframeTracksForBonesTarget,xr as createKeyframeTracksOfCurveAnimation,Ir as createKeyframeTracksOfCurveAnimationByPolyline,Yi as createLineSegmentsByCurve,Xi as createLines,_d as createPlaneMatrix,Gd as createPoiMesh,Hd as createPolygonPoiMesh,Wi as createPolylineBufferGeometry,Ji as createPolylineCurve,Nd as createTexture,kd as createUVMatrix,Vd as default,vr as getAllRootBones,Qr as getClosestContinuousIndexes,Ki as getClosestDistanceInfoOfPointToLines,Yr as getContinuousNumsList,Hi as getCurveDivisionLength,er as getCurvePointAwayFrom,tr as getCurvePointAwayFromOrigin,Fi as getCurveULengths,qi as getDistanceInfoOfPointToLines,Sr as getDurationOfPathAnimationOptions,yr as getFirstRootBone,Tr as getKeyframeTransformDatas,Br as getKeyframeTransformDatasByPolyline,zi as getLengthsOfTs,Qi as getLinesInfo,Rd as getPolygonGeometryInfo,Zi as getProjectionLines,wr as getRootBone,Rr as getSampleDataForBones,Lr as getSampleDataForBonesTarget,Gi as getSampleNum,Er as getTS,Dr as getTimes,Nr as getTrackKeyframeTimeRatios,Ud as setTexture};
22
+ var wu={};void 0!==wu.asn1&&wu.asn1||(wu.asn1={}),wu.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",r=0;r<n;r++)i+="f";t=new Wc(i,16).xor(e).add(Wc.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=wu.asn1,n=t.DERBoolean,i=t.DERInteger,r=t.DERBitString,s=t.DEROctetString,o=t.DERNull,a=t.DERObjectIdentifier,l=t.DEREnumerated,c=t.DERUTF8String,u=t.DERNumericString,h=t.DERPrintableString,d=t.DERTeletexString,f=t.DERIA5String,p=t.DERUTCTime,g=t.DERGeneralizedTime,m=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,w=t.ASN1Util.newObject,b=Object.keys(e);if(1!=b.length)throw"key of param shall be only one.";var A=b[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+A+":"))throw"undefined key: "+A;if("bool"==A)return new n(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new r(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new a(e[A]);if("enum"==A)return new l(e[A]);if("utf8str"==A)return new c(e[A]);if("numstr"==A)return new u(e[A]);if("prnstr"==A)return new h(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new f(e[A]);if("utctime"==A)return new p(e[A]);if("gentime"==A)return new g(e[A]);if("seq"==A){for(var x=e[A],S=[],T=0;T<x.length;T++){var E=w(x[T]);S.push(E)}return new m({array:S})}if("set"==A){for(x=e[A],S=[],T=0;T<x.length;T++){E=w(x[T]);S.push(E)}return new v({array:S})}if("tag"==A){var D=e[A];if("[object Array]"===Object.prototype.toString.call(D)&&3==D.length){var C=w(D[2]);return new y({tag:D[0],explicit:D[1],obj:C})}var I={};if(void 0!==D.explicit&&(I.explicit=D.explicit),void 0!==D.tag&&(I.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return I.obj=w(D.obj),new y(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},wu.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),i=(t=Math.floor(n/40)+"."+n%40,""),r=2;r<e.length;r+=2){var s=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(i+=s.substr(1,7),"0"==s.substr(0,1))t=t+"."+new Wc(i,2).toString(10),i=""}return t},wu.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Wc(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);return i},wu.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},wu.asn1.DERAbstractString=function(e){wu.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},yu.lang.extend(wu.asn1.DERAbstractString,wu.asn1.ASN1Object),wu.asn1.DERAbstractTime=function(e){wu.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,n){var i=this.zeroPadding,r=this.localDateToUTC(e),s=String(r.getFullYear());"utc"==t&&(s=s.substr(2,2));var o=s+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2);if(!0===n){var a=r.getMilliseconds();if(0!=a){var l=i(String(a),3);o=o+"."+(l=l.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,i,r,s){var o=new Date(Date.UTC(e,t-1,n,i,r,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},yu.lang.extend(wu.asn1.DERAbstractTime,wu.asn1.ASN1Object),wu.asn1.DERAbstractStructured=function(e){wu.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},yu.lang.extend(wu.asn1.DERAbstractStructured,wu.asn1.ASN1Object),wu.asn1.DERBoolean=function(){wu.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},yu.lang.extend(wu.asn1.DERBoolean,wu.asn1.ASN1Object),wu.asn1.DERInteger=function(e){wu.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=wu.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Wc(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},yu.lang.extend(wu.asn1.DERInteger,wu.asn1.ASN1Object),wu.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=wu.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}wu.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var i="";for(n=0;n<e.length-1;n+=8){var r=e.substr(n,8),s=parseInt(r,2).toString(16);1==s.length&&(s="0"+s),i+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},yu.lang.extend(wu.asn1.DERBitString,wu.asn1.ASN1Object),wu.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=wu.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}wu.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},yu.lang.extend(wu.asn1.DEROctetString,wu.asn1.DERAbstractString),wu.asn1.DERNull=function(){wu.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},yu.lang.extend(wu.asn1.DERNull,wu.asn1.ASN1Object),wu.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Wc(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};wu.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(e){var t=wu.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},yu.lang.extend(wu.asn1.DERObjectIdentifier,wu.asn1.ASN1Object),wu.asn1.DEREnumerated=function(e){wu.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=wu.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Wc(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},yu.lang.extend(wu.asn1.DEREnumerated,wu.asn1.ASN1Object),wu.asn1.DERUTF8String=function(e){wu.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},yu.lang.extend(wu.asn1.DERUTF8String,wu.asn1.DERAbstractString),wu.asn1.DERNumericString=function(e){wu.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},yu.lang.extend(wu.asn1.DERNumericString,wu.asn1.DERAbstractString),wu.asn1.DERPrintableString=function(e){wu.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},yu.lang.extend(wu.asn1.DERPrintableString,wu.asn1.DERAbstractString),wu.asn1.DERTeletexString=function(e){wu.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},yu.lang.extend(wu.asn1.DERTeletexString,wu.asn1.DERAbstractString),wu.asn1.DERIA5String=function(e){wu.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},yu.lang.extend(wu.asn1.DERIA5String,wu.asn1.DERAbstractString),wu.asn1.DERUTCTime=function(e){wu.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},yu.lang.extend(wu.asn1.DERUTCTime,wu.asn1.DERAbstractTime),wu.asn1.DERGeneralizedTime=function(e){wu.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},yu.lang.extend(wu.asn1.DERGeneralizedTime,wu.asn1.DERAbstractTime),wu.asn1.DERSequence=function(e){wu.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},yu.lang.extend(wu.asn1.DERSequence,wu.asn1.DERAbstractStructured),wu.asn1.DERSet=function(e){wu.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},yu.lang.extend(wu.asn1.DERSet,wu.asn1.DERAbstractStructured),wu.asn1.DERTaggedObject=function(e){wu.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},yu.lang.extend(wu.asn1.DERTaggedObject,wu.asn1.ASN1Object);var bu,Au,xu,Su=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Tu=function(e){function t(n){var i=e.call(this)||this;return n&&("string"==typeof n?i.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&i.parsePropertiesFrom(n)),i}return Su(t,e),t.prototype.parseKey=function(e){try{var t=0,n=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?Pc(e):Oc.unarmor(e),r=zc.decode(i);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length){t=r.sub[1].getHexStringValue(),this.n=qc(t,16),n=r.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=r.sub[3].getHexStringValue();this.d=qc(s,16);var o=r.sub[4].getHexStringValue();this.p=qc(o,16);var a=r.sub[5].getHexStringValue();this.q=qc(a,16);var l=r.sub[6].getHexStringValue();this.dmp1=qc(l,16);var c=r.sub[7].getHexStringValue();this.dmq1=qc(c,16);var u=r.sub[8].getHexStringValue();this.coeff=qc(u,16)}else{if(2!==r.sub.length)return!1;if(r.sub[0].sub){var h=r.sub[1].sub[0];t=h.sub[0].getHexStringValue(),this.n=qc(t,16),n=h.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=r.sub[0].getHexStringValue(),this.n=qc(t,16),n=r.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new wu.asn1.DERInteger({int:0}),new wu.asn1.DERInteger({bigint:this.n}),new wu.asn1.DERInteger({int:this.e}),new wu.asn1.DERInteger({bigint:this.d}),new wu.asn1.DERInteger({bigint:this.p}),new wu.asn1.DERInteger({bigint:this.q}),new wu.asn1.DERInteger({bigint:this.dmp1}),new wu.asn1.DERInteger({bigint:this.dmq1}),new wu.asn1.DERInteger({bigint:this.coeff})]};return new wu.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Ic(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new wu.asn1.DERSequence({array:[new wu.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new wu.asn1.DERNull]}),t=new wu.asn1.DERSequence({array:[new wu.asn1.DERInteger({bigint:this.n}),new wu.asn1.DERInteger({int:this.e})]}),n=new wu.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new wu.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Ic(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var n="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(n,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n",e+="-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n",e+="-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(mu),Eu=void 0!==An?null===(bu=An.env)||void 0===bu?void 0:bu.npm_package_version:void 0,Du=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Tu(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(Bc(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return Ic(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,n){try{return Ic(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,Bc(t),n)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Tu,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Eu,e}(),Cu={},Iu={get exports(){return Cu},set exports(e){Cu=e}},Bu={};Au="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xu={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&xu.rotl(e,8)|4278255360&xu.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=xu.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,i=0;n<e.length;n++,i+=8)t[i>>>5]|=e[n]<<24-i%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var i=e[n]<<16|e[n+1]<<8|e[n+2],r=0;r<4;r++)8*n+6*r<=8*e.length?t.push(Au.charAt(i>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,i=0;n<e.length;i=++n%4)0!=i&&t.push((Au.indexOf(e.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|Au.indexOf(e.charAt(n))>>>6-2*i);return t}},{get exports(){return Bu},set exports(e){Bu=e}}.exports=xu;var Mu={utf8:{stringToBytes:function(e){return Mu.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(Mu.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},Pu=Mu,Ou=function(e){return null!=e&&(Ru(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Ru(e.slice(0,0))}(e)||!!e._isBuffer)};function Ru(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=Bu,t=Pu.utf8,n=Ou,i=Pu.bin,r=function(s,o){s.constructor==String?s=o&&"binary"===o.encoding?i.stringToBytes(s):t.stringToBytes(s):n(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),l=8*s.length,c=1732584193,u=-271733879,h=-1732584194,d=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[l>>>5]|=128<<l%32,a[14+(l+64>>>9<<4)]=l;var p=r._ff,g=r._gg,m=r._hh,v=r._ii;for(f=0;f<a.length;f+=16){var y=c,w=u,b=h,A=d;c=p(c,u,h,d,a[f+0],7,-680876936),d=p(d,c,u,h,a[f+1],12,-389564586),h=p(h,d,c,u,a[f+2],17,606105819),u=p(u,h,d,c,a[f+3],22,-1044525330),c=p(c,u,h,d,a[f+4],7,-176418897),d=p(d,c,u,h,a[f+5],12,1200080426),h=p(h,d,c,u,a[f+6],17,-1473231341),u=p(u,h,d,c,a[f+7],22,-45705983),c=p(c,u,h,d,a[f+8],7,1770035416),d=p(d,c,u,h,a[f+9],12,-1958414417),h=p(h,d,c,u,a[f+10],17,-42063),u=p(u,h,d,c,a[f+11],22,-1990404162),c=p(c,u,h,d,a[f+12],7,1804603682),d=p(d,c,u,h,a[f+13],12,-40341101),h=p(h,d,c,u,a[f+14],17,-1502002290),c=g(c,u=p(u,h,d,c,a[f+15],22,1236535329),h,d,a[f+1],5,-165796510),d=g(d,c,u,h,a[f+6],9,-1069501632),h=g(h,d,c,u,a[f+11],14,643717713),u=g(u,h,d,c,a[f+0],20,-373897302),c=g(c,u,h,d,a[f+5],5,-701558691),d=g(d,c,u,h,a[f+10],9,38016083),h=g(h,d,c,u,a[f+15],14,-660478335),u=g(u,h,d,c,a[f+4],20,-405537848),c=g(c,u,h,d,a[f+9],5,568446438),d=g(d,c,u,h,a[f+14],9,-1019803690),h=g(h,d,c,u,a[f+3],14,-187363961),u=g(u,h,d,c,a[f+8],20,1163531501),c=g(c,u,h,d,a[f+13],5,-1444681467),d=g(d,c,u,h,a[f+2],9,-51403784),h=g(h,d,c,u,a[f+7],14,1735328473),c=m(c,u=g(u,h,d,c,a[f+12],20,-1926607734),h,d,a[f+5],4,-378558),d=m(d,c,u,h,a[f+8],11,-2022574463),h=m(h,d,c,u,a[f+11],16,1839030562),u=m(u,h,d,c,a[f+14],23,-35309556),c=m(c,u,h,d,a[f+1],4,-1530992060),d=m(d,c,u,h,a[f+4],11,1272893353),h=m(h,d,c,u,a[f+7],16,-155497632),u=m(u,h,d,c,a[f+10],23,-1094730640),c=m(c,u,h,d,a[f+13],4,681279174),d=m(d,c,u,h,a[f+0],11,-358537222),h=m(h,d,c,u,a[f+3],16,-722521979),u=m(u,h,d,c,a[f+6],23,76029189),c=m(c,u,h,d,a[f+9],4,-640364487),d=m(d,c,u,h,a[f+12],11,-421815835),h=m(h,d,c,u,a[f+15],16,530742520),c=v(c,u=m(u,h,d,c,a[f+2],23,-995338651),h,d,a[f+0],6,-198630844),d=v(d,c,u,h,a[f+7],10,1126891415),h=v(h,d,c,u,a[f+14],15,-1416354905),u=v(u,h,d,c,a[f+5],21,-57434055),c=v(c,u,h,d,a[f+12],6,1700485571),d=v(d,c,u,h,a[f+3],10,-1894986606),h=v(h,d,c,u,a[f+10],15,-1051523),u=v(u,h,d,c,a[f+1],21,-2054922799),c=v(c,u,h,d,a[f+8],6,1873313359),d=v(d,c,u,h,a[f+15],10,-30611744),h=v(h,d,c,u,a[f+6],15,-1560198380),u=v(u,h,d,c,a[f+13],21,1309151649),c=v(c,u,h,d,a[f+4],6,-145523070),d=v(d,c,u,h,a[f+11],10,-1120210379),h=v(h,d,c,u,a[f+2],15,718787259),u=v(u,h,d,c,a[f+9],21,-343485551),c=c+y>>>0,u=u+w>>>0,h=h+b>>>0,d=d+A>>>0}return e.endian([c,u,h,d])};r._ff=function(e,t,n,i,r,s,o){var a=e+(t&n|~t&i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._gg=function(e,t,n,i,r,s,o){var a=e+(t&i|n&~i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._hh=function(e,t,n,i,r,s,o){var a=e+(t^n^i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._ii=function(e,t,n,i,r,s,o){var a=e+(n^(t|~i))+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._blocksize=16,r._digestsize=16,Iu.exports=function(t,n){if(null==t)throw new Error("Illegal argument "+t);var s=e.wordsToBytes(r(t,n));return n&&n.asBytes?s:n&&n.asString?i.bytesToString(s):e.bytesToHex(s)}}();var _u,ku,Lu={serialNums:[],key:"",verified:!0};class Nu{constructor(e){this.viewport=e,this.encryptInfo=Lu,_u.set(this,!0),ku.set(this,setTimeout((()=>{as(this,_u,!1,"f"),this.viewport.triggerRender()}),5e3))}verify(e,t){var n;clearTimeout(os(this,ku,"f"));const i=new Du;i.setPublicKey(null===(n=this.encryptInfo)||void 0===n?void 0:n.key);const r=i.verify(e,t,Cu);return as(this,_u,r,"f"),this.viewport.triggerRender(),r}getVerified(){return!!Lu.verified||os(this,_u,"f")}}_u=new WeakMap,ku=new WeakMap;class Uu{constructor(e,t){this.scene=e,this.signals=t;const n=document.createElement("div");n.style.position="absolute",n.style.left="12px",n.style.bottom="12px",n.style.fontSize="12px",n.style.color="#fff",n.style.pointerEvents="none",this.container=n,this.state={objects:0,vertices:0,triangles:0,frametime:0,lodFrametime:0}}addListeners(){const{scene:e,signals:t}=this;function n(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=document.createElement("span");return t&&(n.style.marginLeft="6px"),n.innerText=e,n}function i(){return document.createElement("br")}const r=n("0"),s=n("0"),o=n("0"),a=n("0"),l=n("0");this.container.appendChild(n("objects",!1)),this.container.appendChild(r),this.container.appendChild(i()),this.container.appendChild(n("triangles",!1)),this.container.appendChild(s),this.container.appendChild(i()),this.container.appendChild(n("vertices",!1)),this.container.appendChild(o),this.container.appendChild(i()),this.container.appendChild(n("frametime",!1)),this.container.appendChild(a),this.container.appendChild(i()),this.container.appendChild(n("lodFrametime",!1)),this.container.appendChild(l);const c=()=>{this.state.objects=0,this.state.vertices=0,this.state.triangles=0;for(let t=0;t<e.children.length;t++){e.children[t].traverse((e=>{var t,n,i,r;if("SceneManager"!==e.stype&&this.state.objects++,e.isMesh){const s=e.geometry;s.isGeometry?(this.state.vertices+=(null===(t=s.vertices)||void 0===t?void 0:t.length)||0,this.state.triangles+=(null===(n=s.faces)||void 0===n?void 0:n.length)||0):s.isBufferGeometry&&(this.state.vertices+=(null===(i=s.attributes.position)||void 0===i?void 0:i.count)||0,null!==s.index?this.state.triangles+=s.index.count/3:this.state.triangles+=(null===(r=s.attributes.position)||void 0===r?void 0:r.count)/3||0)}}))}r.innerText=String(this.state.objects),o.innerText=String(this.state.vertices),s.innerText=String(this.state.triangles)};t.objectAdded.add(c),t.objectRemoved.add(c),t.geometryChanged.add(c);t.sceneRendered.add((e=>{this.state.frametime=e,a.innerText=Number(e).toFixed(2)+" ms"}));t.loadRendered.add((e=>{this.state.lodFrametime=e,l.innerText=Number(e).toFixed(2)+" ms"}))}}const ju=new e.Vector4;class Fu extends e.Object3D{constructor(t,n){super();const i=new e.Color("#ff3653"),r=new e.Color("#8adb00"),s=new e.Color("#2c8fff"),o=new e.OrthographicCamera(-2,2,2,-2,0,4);o.position.set(0,0,2);const a=new e.BoxGeometry(.8,.05,.05).translate(.4,0,0),l=new e.Mesh(a,y(i)),c=new e.Mesh(a,y(r)),u=new e.Mesh(a,y(s));c.rotation.z=Math.PI/2,u.rotation.y=-Math.PI/2,this.add(l),this.add(u),this.add(c);const h=new e.Sprite(w(i,"X"));h.userData.type="posX";const d=new e.Sprite(w(r,"Y"));d.userData.type="posY";const f=new e.Sprite(w(s,"Z"));f.userData.type="posZ";const p=new e.Sprite(w(i));p.userData.type="negX";const g=new e.Sprite(w(r));g.userData.type="negY";const m=new e.Sprite(w(s));m.userData.type="negZ",h.position.x=1,d.position.y=1,f.position.z=1,p.position.x=-1,p.scale.setScalar(.8),g.position.y=-1,g.scale.setScalar(.8),m.position.z=-1,m.scale.setScalar(.8),this.add(h),this.add(d),this.add(f),this.add(p),this.add(g),this.add(m);const v=new e.Vector3;function y(t){return new e.MeshBasicMaterial({color:t,toneMapped:!1})}function w(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=document.createElement("canvas");i.width=64,i.height=64;const r=i.getContext("2d");if(!r)return;r.beginPath(),r.arc(32,32,16,0,2*Math.PI),r.closePath(),r.fillStyle=t.getStyle(),r.fill(),null!==n&&(r.font="24px Arial",r.textAlign="center",r.fillStyle="#000000",r.fillText(n,32,41));const s=new e.CanvasTexture(i);return new e.SpriteMaterial({map:s,toneMapped:!1})}this.render=function(e){this.quaternion.copy(t.quaternion).invert(),this.updateMatrixWorld(),v.set(0,0,1),v.applyQuaternion(t.quaternion),v.x>=0?(h.material.opacity=1,p.material.opacity=.5):(h.material.opacity=.5,p.material.opacity=1),v.y>=0?(d.material.opacity=1,g.material.opacity=.5):(d.material.opacity=.5,g.material.opacity=1),v.z>=0?(f.material.opacity=1,m.material.opacity=.5):(f.material.opacity=.5,m.material.opacity=1);const i=n.offsetWidth-128;e.clearDepth(),e.getViewport(ju),e.setViewport(i,0,128,128),e.render(this,o),e.setViewport(ju.x,ju.y,ju.z,ju.w)}}}const zu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAASwAAAABAAABLAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAZKADAAQAAAABAAAAKQAAAAAaAV+RAAAACXBIWXMAAC4jAAAuIwF4pT92AAACy2lUWHRYTUw6Y29tLmFkb2J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DuU+51UWWXt7hOvBIH/37tw+vmrQve2gYMji0BQZ6VK2zfkpj9xDEqc7cTDRCq2c7H+ztUP/+UvdwBJkLqeTOTddLJ9jU1I6bMoq+MdKkxfpAr2iUe4EH3j/awrwO3IkRUntHFE4dWYP9VzWKbddp/D/Sg4TJ8O04InPO/HXIcpXV7+DwFGTMCxrsL7WV7CtcFn9VccDXPu1BZ0DHk7uHsF3pxhJ09+08H+DO59BRXh4GmjnQ/uhhFykoCUYMDO8E7R2tzxhKs8gztkbqr3BOOmBBnbMxzltlK8cLa+OriKV4cg8EkstwOnl8Q5yN6gXRjapIL6nsjx3tKDRXL1o9N/tI1IOuhGx9i6h379WeN/AG/pVWSijcXFfJ10owXn8eSD34qvOVuYwzX0EfiX8Uz8q/aOVdhxemkHsujVam/jmV7mXwv77/3zH/aPdtZ7c8mFSLevpuvkP4GzF2K83JGqPF5b3hpMAcG7JFPOXNS75E9nuM5j9x+P8Y+y27V7OPYnpJuSzlT63teSGPvjiSghZwi2ITxHH5yxOWXoKHMyE23Uj4/ubI1E5dA7H+8IXtnc1tmgodwgg7y2PUuw+V3YPvr/4Hc7NJHgsKd30iW88S3cae+fjCBju8GrMd0jm4FMKhVrpEWashiPfVvox/+/8IDGtvuZvf4f1azOqNpo8RwAAAAASUVORK5CYII=",Gu=100,Hu=41,Vu=new we,Wu=new l;class Yu extends M{get size(){var e;return null!==(e=this._size)&&void 0!==e?e:this.size=new h(100,100)}set size(e){this._size=e;const{x:t,y:n}=e,{camera:i,currViewport:r}=this;r.set(t*Math.random(),n*Math.random(),t,n),i.left=i.right=t/2,i.left=-i.left,i.top=i.bottom=n/2,i.bottom=-i.bottom,i.updateProjectionMatrix()}get velocity(){var e;return null!==(e=this._velocity)&&void 0!==e?e:this._velocity=this.direction.clone().multiplyScalar(this.speed)}set velocity(e){this._velocity=e}constructor(e){super(),this.viewport=e,this.fontSize=50,this.imageWidth=200,this.camera=new F(-1.6,1.6,.8,-.8,0,4),this.direction=(new h).random().normalize(),this.speed=2,this.currViewport=new we,this.lastRenderTime=0,this.autoRender=e=>{e-this.lastRenderTime>30&&this.render(),requestAnimationFrame(this.autoRender)},this.camera.position.z=2,this._generateMarkForImage()}_generateMark(){}_generateMarkForString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496];const t=Array.isArray(e)?String.fromCodePoint(...e):e,n=t.length,{fontSize:i}=this,r=i/4,s=2*r,{x:o,y:a}=this.size=new h(i*n+s,i+s),l=document.createElement("canvas");l.width=o,l.height=a;const c=l.getContext("2d");if(!c)return;const u=c.createLinearGradient(0,0,o,a);u.addColorStop(0,"#ff3653"),u.addColorStop(.5,"#8adb00"),u.addColorStop(1,"#2c8fff"),c.fillStyle=u,c.font=`bold ${i}px/1 serif`,c.fillText(t,r,a-1.5*r);const d=Wu.load(l.toDataURL()),f=new je({map:d,toneMapped:!1,transparent:!0}),p=new k(new Fe(o,a),f);this.add(p)}_generateMarkForImage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gu,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hu;const i=this.imageWidth,r=i*(n/t);this.size=new h(i,r);const s=Wu.load(e),o=new je({map:s,toneMapped:!1,transparent:!0}),a=new k(new Fe(i,r),o);this.add(a)}render(){const{renderer:e}=this.viewport;e.getViewport(Vu);const{width:t,height:n}=e.domElement,i=new h(t,n),{position:r,velocity:s}=function(e,t,n,i){i=null!=i?i:n.length();let{x:r,y:s}=e,{x:o,y:a}=n;r+=o,s+=a,(r+e.width>=t.x&&o>0||r<=0&&o<0)&&(o=-o*Math.random());(s+e.height>=t.y&&a>0||s<=0&&a<0)&&(a=-a*Math.random());const l=new h(o,a);l.normalize().multiplyScalar(i);const c=new h(e.x,e.y).add(l);return{position:c,velocity:l}}(this.currViewport,i,this.velocity,this.speed),o=this.currViewport;o.x=r.x,o.y=r.y,this.velocity=s,e.clearDepth(),e.setViewport(o.x,o.y,o.z,o.w),e.render(this,this.camera),e.setViewport(Vu.x,Vu.y,Vu.z,Vu.w)}}const Qu={needsUpdate:!1};let Xu=0,Zu=0;const Ku=e=>{e instanceof u&&e.dispose()};class qu{constructor(e){this.clock=new ze,this.raycaster=new Ge,this.sky=null,this.options=e,this.state={useFreq:1,enabledPostprocessing:!0,isPausedRender:!1,isDisposed:!1},this.signals={windowResize:new Ks,cameraObjectChange:new Ks,sceneChanged:new Ks,backgroundChanged:new Ks,beforeRender:new Ks,sceneRendered:new Ks,loadRendered:new Ks,tweenUpdate:new Ks,hover:new Ks,click:new Ks,dblClick:new Ks,rightClick:new Ks,mouseDown:new Ks,mouseMove:new Ks,mouseUp:new Ks,mouseWheel:new Ks,keyDown:new Ks,keyUp:new Ks,modelHover:new Ks,modelUnHover:new Ks,modelClick:new Ks,modelDblClick:new Ks,modelRightClick:new Ks,poiHover:new Ks,poiUnHover:new Ks,poiClick:new Ks,poiDblClick:new Ks,poiRightClick:new Ks,selectPosition:new Ks,sceneClick:new Ks,objectAdded:new Ks,objectRemoved:new Ks,objectChanged:new Ks,geometryChanged:new Ks,materialAdded:new Ks,materialChanged:new Ks,materialRemoved:new Ks,cameraChange:new Ks,outlineChange:new Ks,modelAnimation:new Ks,getSceneInfo:new Ks},this.scener=new eo(this.signals,this.state),this.scene=this.scener.scene,this.cameraManager=new Po(this),this.camera=this.cameraManager.currentCamera,this.rendererManager=new vo(this),this.container=this.rendererManager.container,this.interactiveContainer=this.rendererManager.interactiveContainer,this.renderer=this.rendererManager.renderer,this.rendererCSS3D=this.rendererManager.rendererCSS3D,this.rendererCSS2D=this.rendererManager.rendererCSS2D,this.pmremGenerator=new De(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.effectManager=new nc(this.renderer,this.scene,this.camera),this.effectComposer=this.effectManager.effectComposer,this.bvh=new rc(this),this.controls=new mc(this),this.info=new Uu(this.scene,this.signals),this.stats=new Ot,this.mixer=new He(this.scene),this.clipsSet=new Set,this.postUpdate=new Map,this.postRender=new Map,this.selectModel=null,this.selectPoi=null,this._loop=0,this.viewHelper=new Fu(this.camera,this.container),this.license=new Nu(this),this.waterMark=new Yu(this),this._initInfo(),this._initStats(),this._signalsEventListenr(),this._containerAddEventListener(this.container),this.animate(0)}_initInfo(){if(this.options.showInfo){this.info.addListeners();const{container:e}=this.info;e.style.zIndex="1",this.container.appendChild(e)}}_initStats(){if(this.options.showStats){const{dom:e}=this.stats;e.style.zIndex="1",this.container.appendChild(e),this.signals.sceneRendered.add((()=>{this.stats.update()}))}}setSSR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,intensity:n=1,exponent:i=1.75,distance:r=20,fade:s=0,roughnessFade:o=1,thickness:a=3.5,ior:l=1.75,maxRoughness:c=.1,maxDepthDifference:u=20,blend:h=.95,correction:d=1,correctionRadius:f=1,blur:p=1,blurKernel:g=1,blurSharpness:m=10,jitter:v=0,jitterRoughness:y=2,steps:w=20,refineSteps:b=10,missedRays:A=!1,useNormalMap:x=!0,useRoughnessMap:S=!0,resolutionScale:T=1,velocityResolutionScale:E=1}=e,{effectManager:D}=this,C=D.effectsMap.get(nc.CONSTANTS.ssrEffect);C.enabled!==t&&(C.enabled=t,D.effectsNeedsUpddate=!0);const{effect:I}=C;I.usingBoxProjectedEnvMap=!0,I.intensity=n,I.exponent=i,I.distance=r,I.fade=s,I.roughnessFade=o,I.thickness=a,I.ior=l,I.maxRoughness=c,I.maxDepthDifference=u,I.blend=h,I.correction=d,I.correctionRadius=f,I.blur=p,I.blurKernel=g,I.blurSharpness=m,I.jitter=v,I.jitterRoughness=y,I.steps=w,I.refineSteps=b,I.missedRays=A,I.useNormalMap=x,I.useRoughnessMap=S,I.resolutionScale=T,I.velocityResolutionScale=E,this.triggerRender()}setBloom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{enabled:n=!0,mipmapBlur:i=!0,radius:r=.85,intensity:s=3,threshold:o=1,smoothing:a=0,scalar:l=2,opacity:c=1,selection:u=[]}=e,{effectManager:h}=this,d=h.effectsMap.get(nc.CONSTANTS.bloomEffect);d.enabled!==n&&(d.enabled=n,h.effectsNeedsUpddate=!0);const{effect:f}=d;f.intensity=s;const{mipmapBlurPass:p,renderTarget:g}=f;p.enabled=i,p.radius=r;const m=f.uniforms.get("map");m&&(m.value=i?p.texture:g.texture),f.luminanceMaterial.threshold=o,f.luminanceMaterial.smoothing=a,f.blendMode.opacity.value=c,null===(t=f.luminanceMaterial.userData.bloomSelection)||void 0===t||t.forEach((e=>{e.material.toneMapped=!0,e.material.color.multiplyScalar(1/e.material.userData.prevScalar),Reflect.deleteProperty(e.material.userData,"prevScalar")})),f.luminanceMaterial.userData.bloomSelection=[],n&&u.forEach((e=>{e.traverse((e=>{e instanceof k&&e.material.color&&(e.material.toneMapped=!1,e.material.color.multiplyScalar(l),e.material.userData.prevScalar=l,f.luminanceMaterial.userData.bloomSelection.push(e))}))})),this.triggerRender()}setSSAO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,depthAwareUpsampling:n=!0,samples:i=32,rings:r=7,distanceThreshold:s=.02,distanceFalloff:o=.0025,rangeThreshold:a=3e-4,rangeFalloff:l=1e-4,luminanceInfluence:u=.7,minRadiusScale:h=.33,radius:d=.1,intensity:f=3,bias:p=.004,fade:g=.01,color:m=null,resolutionScale:v=1}=e,{effectManager:y}=this,w=y.passesMap.get(nc.CONSTANTS.normalPass),b=y.effectsMap.get(nc.CONSTANTS.ssaoEffect);b.enabled!==t&&(w.enabled=t,b.enabled=t,y.effectsNeedsUpddate=!0);const{effect:A}=b,{ssaoMaterial:x}=A;A.depthAwareUpsampling=n,A.luminanceInfluence=u,A.resolution.scale=v,A.intensity=f,x.samples=i,x.rings=r,x.distanceThreshold=s,x.distanceFalloff=o,x.proximityThreshold=a,x.proximityFalloff=l,x.minRadiusScale=h,x.fade=g,x.bias=p,x.radius=d,m&&(A.color=new c(m)),this.triggerRender()}setColorSpace(e){this.renderer.outputEncoding="sRGB"===e?ye:ve,this.signals.sceneChanged.dispatch()}setToneMapping(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:t="ACESFilmic",exposure:n=.8}=e,i={None:Ye,Linear:Qe,Reinhard:Xe,Cineon:Ze,ACESFilmic:We};this.renderer.toneMapping=i[t],this.renderer.toneMappingExposure=n,this.signals.sceneChanged.dispatch()}async setSphereSkyBackground(e){const t=await oi({file:e});Ku(this.scene.background),this.scene.background=t,this.signals.backgroundChanged.dispatch()}async setSkyBackground(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"];const n=await oi({path:e,file:t});Ku(this.scene.background),this.scene.background=n,this.signals.backgroundChanged.dispatch()}setBackgroundColor(e){Ku(this.scene.background),this.scene.background=new c(e),this.signals.backgroundChanged.dispatch()}setBackgroundColorAlpha(e,t){Ku(this.scene.background),this.scene.background=null,this.renderer.setClearColor(new c(e),t),this.signals.backgroundChanged.dispatch()}async setBackgroundImage(e){const t=await oi({file:e});t.mapping=Ve,this.scene.background=t,this.signals.backgroundChanged.dispatch()}setSky(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:n=!0,position:i={x:0,y:0,z:0},scalar:r=45e4,turbidity:s=10,rayleigh:o=3,elevation:a=2,azimuth:l=180,exposure:c=.6}=e;if(!n)return void this.closeSky();this.sky||(this.sky=new Rt,this.scene.add(this.sky)),this.sky.name="sky",this.sky.position.set(i.x,i.y,i.z),this.sky.scale.setScalar(r);const u=this.sky.material.uniforms;u.turbidity.value=s,u.rayleigh.value=o,u.mieCoefficient.value=.005,u.mieDirectionalG.value=.7;const h=new t,d=ti(90-a),f=ti(l);return h.setFromSphericalCoords(1,d,f),u.sunPosition.value.copy(h),this.sky.userData.toneMapping=this.renderer.toneMapping,this.sky.userData.toneMappingExposure=this.renderer.toneMappingExposure,this.renderer.toneMapping=We,this.renderer.toneMappingExposure=c,this.signals.objectAdded.dispatch(),this.sky}closeSky(){if(!this.sky)return!1;const{toneMapping:e,toneMappingExposure:t}=this.sky.userData;return this.renderer.toneMapping=e,this.renderer.toneMappingExposure=t,this.sky.removeFromParent(),this.sky=null,this.signals.objectRemoved.dispatch(),!0}screenshot(){return new Promise((e=>{this.renderer.domElement.toBlob((t=>{e(t)}))}))}async setEnvironment(e){if(e){const{path:t,file:n,background:i}=e,r=await oi({path:t,file:n});this.scene.environment=r,i&&(Ku(this.scene.background),this.scene.background=r)}else this.scene.environment=this.pmremGenerator.fromScene(new Pt,.04).texture;return this.signals.sceneChanged.dispatch(),this.scene.environment}playModelAnimation(e,t){let n;if(t instanceof C?n=t:Di(t)?n=e.animations[t]:Bi(t)&&(n=e.animations.find(t)),!n)return;const i=zr(this.mixer.clipAction(n,e));return i.play(),this.clipsSet.add(n),i}stopModelAnimation(e,t){var n;let i;t instanceof C?i=t:Di(t)?i=e.animations[t]:Bi(t)&&(i=e.animations.find(t)),i&&(null===(n=this.mixer.existingAction(i,e))||void 0===n||n.stop(),this.mixer.uncacheAction(i,e),this.clipsSet.delete(i))}async render(e){return await(null==e?void 0:e()),new Promise((e=>{this.signals.sceneRendered.addOnce(e),this.triggerRender()}))}triggerRender(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.state.useFreq=e}async setPauseRender(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.state.isPausedRender=e,!1===e)return this.render()}_passesObserver(){this.effectManager.updateEffectPass()}autoRender(e){if(this.state.useFreq<=0&&!Qu.needsUpdate)return;if(this.state.useFreq>0&&this.state.useFreq--,Qu.needsUpdate&&(Qu.needsUpdate=!1),this.state.isPausedRender)return;Xu=performance.now(),this.signals.beforeRender.dispatch(),this._passesObserver(),this.state.enabledPostprocessing?this.effectComposer.render():(this.renderer.clear(),this.renderer.render(this.scene,this.camera));const t=this.scene.matrixWorldAutoUpdate;this.scene.matrixWorldAutoUpdate=!1,this.rendererCSS2D&&this.rendererManager.internalOptions.enableRenderCss2D&&this.rendererCSS2D.render(this.scene,this.camera),this.rendererCSS3D&&this.rendererManager.internalOptions.enableRenderCss3D&&this.rendererCSS3D.render(this.scene,this.camera),this.scene.matrixWorldAutoUpdate=t,this.options.showViewHelper&&this.camera===this.cameraManager.mainCamera&&this.viewHelper.render(this.renderer),this.license.getVerified()||this.waterMark.render(),this.postRender.forEach((t=>t(e))),Zu=performance.now(),this.signals.sceneRendered.dispatch(Zu-Xu)}animate(e){this._loop=requestAnimationFrame((e=>{this.animate(e)}));const t=this.clock.getDelta();this.clipsSet.size>0&&(this.mixer.update(t),this.signals.modelAnimation.dispatch()),Ln.update()&&this.signals.tweenUpdate.dispatch(),this.postUpdate.forEach((t=>t(e))),this.autoRender(e),this.signals.getSceneInfo.dispatch(this.info.state)}getOffsetByPosition(e){const n=new t(e.x,e.y,e.z).project(this.camera),i=this.renderer.domElement.getBoundingClientRect();return{left:Math.round(i.left+i.width/2*(n.x+1)),top:Math.round(i.top+i.height/2*(1-n.y))}}getPositionByOffset(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;const i=new t(0,0,0),r=new t(0,0,0),s=this.renderer.domElement.getBoundingClientRect();r.set(e.offsetX/s.width*2-1,-e.offsetY/s.height*2+1,n),r.unproject(this.camera),r.sub(this.camera.position).normalize();const o=r.distanceTo(this.camera.position);return i.copy(this.camera.position).add(r.multiplyScalar(o)),i}getIntersects(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scener.intersectsList.getAll(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{isFilterHideObject:i=!0}=n,r=this.container.getBoundingClientRect();let s={offsetX:0,offsetY:0};if(e instanceof MouseEvent)s={offsetX:e.clientX-r.left,offsetY:e.clientY-r.top};else if(e instanceof TouchEvent){const t=e.changedTouches[0];s={offsetX:t.clientX-r.left,offsetY:t.clientY-r.top}}else s=e;const o=new h;o.set(s.offsetX/r.width*2-1,-s.offsetY/r.height*2+1),this.raycaster.setFromCamera(o,this.camera);let a=[];return a=Ci(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0),i?a.filter((e=>{let{object:t}=e;return ri(t)})):a}rayClash(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.camera.position,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t(0,-1,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.scener.intersectsList.meshOfModelList;const r=new Ge;return r.set(e,n),Ci(i)?r.intersectObjects(i,!0):r.intersectObject(i,!0)}setHoverEnabled(e){this.options.hoverEnabled=e}clearSignals(){for(const e in this.signals)this.signals[e].removeAll()}dispose(){cancelAnimationFrame(this._loop),this.bvh.dispose(),this.mixer.stopAllAction(),this.clipsSet.forEach((e=>{this.mixer.uncacheAction(e),this.mixer.uncacheClip(e)})),this.mixer.uncacheRoot(this.scene),this.clipsSet.clear(),this.controls.dispose(),Ln.removeAll(),this.clearSignals(),this.scene.clear(),this.pmremGenerator.dispose(),this.effectComposer.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.container.remove(),this.state.isDisposed=!0}_signalsEventListenr(){const e=()=>{const{offsetWidth:e,offsetHeight:t}=this.container;this.effectManager.updateCamera(this.camera),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.effectComposer.setSize(e,t),this.rendererCSS3D&&this.rendererCSS3D.setSize(e,t),this.rendererCSS2D&&this.rendererCSS2D.setSize(e,t),this.triggerRender()};setTimeout((()=>e())),this.signals.windowResize.add(e),this.signals.cameraObjectChange.add(e),this.signals.sceneChanged.add((()=>this.triggerRender())),this.signals.backgroundChanged.add((()=>this.triggerRender())),this.signals.objectAdded.add((()=>this.triggerRender())),this.signals.objectRemoved.add((()=>this.triggerRender())),this.signals.objectChanged.add((()=>this.triggerRender())),this.signals.materialAdded.add((()=>this.triggerRender())),this.signals.materialRemoved.add((()=>this.triggerRender())),this.signals.materialChanged.add((()=>this.triggerRender())),this.signals.geometryChanged.add((()=>this.triggerRender())),this.signals.cameraChange.add((()=>this.triggerRender())),this.signals.tweenUpdate.add((()=>this.triggerRender())),this.signals.modelAnimation.add((()=>this.triggerRender()));this.signals.outlineChange.add((e=>{const{objects:t,options:n}=e,{color:i,hideColor:r,edgeThickness:s,edgeStrength:o}=Object.assign(Object.assign({},{color:16777215,hideColor:10066329,edgeThickness:3,edgeStrength:10}),n),{effectManager:a}=this,l=a.effectsMap.get(nc.CONSTANTS.outlineEffect),c=t.length>0;l.enabled!==c&&(l.enabled=c,a.effectsNeedsUpddate=!0);const{effect:u}=l,{uniforms:h}=u,d=[];t.forEach((e=>{e.traverse((e=>{e instanceof k&&d.push(e)}))})),u.selection.set(d),u.blur=s>0,u.blurPass.kernelSize=s;const f=h.get("visibleEdgeColor"),p=h.get("hiddenEdgeColor"),g=h.get("edgeStrength");f&&f.value.set(i),p&&p.value.set(r),g&&(g.value=o),this.triggerRender()}))}_containerAddEventListener(e){const t=[0,0];let n=null;const i=r=>{var s,o;this.signals.mouseUp.dispatch(r);const a=r.offsetX-(null!==(s=null==n?void 0:n.offsetX)&&void 0!==s?s:0),l=r.offsetY-(null!==(o=null==n?void 0:n.offsetY)&&void 0!==o?o:0);if(Math.abs(a)>2||Math.abs(l)>2)return t[0]=0,void(t[1]=0);setTimeout((()=>{0!==t[0]&&0===t[1]&&(0===r.button?(this.signals.click.dispatch(r),this._triggerSceneEventInAllObject("click",r)):2===r.button&&(this.signals.rightClick.dispatch(r),this._triggerSceneEventInAllObject("rightClick",r))),t[0]=0,t[1]=0}),300),e.removeEventListener("mouseup",i,!1)};let r=!1,s=null,o=null;const a=[0,0],l=e=>{var t,n;s&&clearTimeout(s);const i=()=>{r=!1,a[0]=0,a[1]=0},l=e.changedTouches[0].clientX-(null!==(t=null==o?void 0:o.changedTouches[0].clientX)&&void 0!==t?t:0),c=e.changedTouches[0].clientY-(null!==(n=null==o?void 0:o.changedTouches[0].clientY)&&void 0!==n?n:0);Math.abs(l)>2||Math.abs(c)>2?i():r?(i(),this.signals.rightClick.dispatch(e),this._triggerSceneEventInAllObject("rightClick",e)):setTimeout((()=>{0!==a[0]&&0===a[1]?(this.signals.click.dispatch(e),this._triggerSceneEventInAllObject("click",e)):0!==a[0]&&0!==a[1]&&a[1]-a[0]<=300&&(this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)),i()}),300)};e.addEventListener("mousedown",(r=>{n=r,this.signals.mouseDown.dispatch(r),0===t[0]?t[0]=performance.now():0===t[1]&&(t[1]=performance.now()),e.addEventListener("mouseup",i,!1)}),!1),e.addEventListener("mousemove",(e=>{this.signals.mouseMove.dispatch(e),this.options.hoverEnabled&&this._triggerSceneEventInAllObject("hover",e)}),!1),e.addEventListener("dblclick",(e=>{this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)}),!1),e.addEventListener("wheel",(e=>{this.signals.mouseWheel.dispatch(e)}),{passive:!0}),e.addEventListener("touchstart",(t=>{0===a[0]?a[0]=performance.now():0===a[1]&&(a[1]=performance.now()),o=t,s&&clearTimeout(s),s=window.setTimeout((()=>{r=!0}),800),e.addEventListener("touchend",l,{once:!0})}),{passive:!0}),e.addEventListener("contextmenu",(e=>e.preventDefault()),!1),document.addEventListener("keydown",(e=>{this.signals.keyDown.dispatch(e)}),!1),document.addEventListener("keyup",(e=>{this.signals.keyUp.dispatch(e)}),!1)}_triggerSceneEventInAllObject(e,t){const n=this.getIntersects(t,this.scener.intersectsList.getAll());if(0===n.length)return this.selectModel&&this.signals.modelHover.numListeners>0&&this.signals.modelUnHover.dispatch(this.selectModel),this.selectPoi&&this.signals.poiHover.numListeners>0&&this.signals.poiUnHover.dispatch(this.selectPoi),this.selectModel=null,this.selectPoi=null,void this.signals.sceneClick.dispatch({type:e,event:t});const i={object:null,type:null,point:null},r=[],s=[];function o(e){return e.parent?"Model"===e.parent.stype?e.parent:o(e.parent):void 0}n.forEach((e=>{if(e.object.parent instanceof ah){const t=e.object.parent;i.object||(i.type="Poi",i.object=e.object,i.point=e.point);-1===r.findIndex((e=>e.poi.uuid===t.uuid))&&r.push({poi:t,sourceData:e})}else if(e.object instanceof M){const t=o(e.object);t&&(i.object||(i.type="Model",i.object=e.object,i.point=e.point),s.push({model:t,sourceData:e}))}})),"click"===e&&i.point&&this.signals.selectPosition.dispatch(i.point);const a=e.slice(0,1).toUpperCase()+e.slice(1),l=e=>{var n;const{model:r}=e[0];if(r)if("Hover"===a)(null===(n=this.selectModel)||void 0===n?void 0:n.uuid)!==r.uuid&&(this.signals.modelHover.dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),this.selectModel=r);else{let n=null;"Click"===a?(n=r.onClick,r.dispatchEvent({type:"click"})):"RightClick"===a?(n=r.onRightClick,r.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(n=r.onDblClick,r.dispatchEvent({type:"dblClick"})),n?n(r):r.isEventPropagation=!0,r.isEventPropagation&&(this.signals[`model${a}`].dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),r.isEventPropagation=!1)}},c=e=>{var n;const{poi:i}=e[0];if(i)if("Hover"===a)(null===(n=this.selectPoi)||void 0===n?void 0:n.uuid)!==i.uuid&&(this.signals.poiHover.dispatch({target:i,event:t}),this.selectPoi=i);else{let e=null;"Click"===a?(e=i.onClick,i.dispatchEvent({type:"click"})):"RightClick"===a?(e=i.onRightClick,i.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(e=i.onDblClick,i.dispatchEvent({type:"dblClick"})),e?e(i):i.isEventPropagation=!0,i.isEventPropagation&&(this.signals[`poi${a}`].dispatch({target:i,event:t}),i.isEventPropagation=!1)}};if("Hover"===a){if(s.length>0){const[{model:e}]=s;this.selectModel&&this.selectModel.uuid!==e.uuid&&(this.signals.modelUnHover.dispatch(this.selectModel),this.selectModel=null)}if(r.length>0){const[{poi:e}]=r;this.selectPoi&&this.selectPoi.uuid!==e.uuid&&(this.signals.poiUnHover.dispatch(this.selectPoi),this.selectPoi=null)}}"Model"===i.type?l(s):"Poi"===i.type&&c(r)}}class Ju extends k{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"BaseMesh";super(t,n);const{id:r,name:s="",level:o={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:u={x:1,y:1,z:1},userData:h={}}=e;if(void 0===r)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=r,this.name=s,this.stype=i,this.level=o,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(u.x,u.y,u.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=h,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,Qu.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,Qu.needsUpdate=!0}setMove(e,t,n,i){return Li(this.position,Kn(e),t,n,i)}setRotate(e,t,n,i){const s=qn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Li({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Li(this.scale,Kn(e),t,n,i)}getBoundingBox(){return Jn(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new Ju({id:`clone_${Oi()}`},this.geometry,this.material).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry,this.material=e.material,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof eh||e.children[t]instanceof Ju?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}const $u={onLoad:null,onClick:null,onDblClick:null,onRightClick:null};class eh extends M{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BaseObject3D";super();const{id:n,name:i="",level:r={max:null,min:null},visible:s=!0,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={},onLoad:u,onClick:h,onDblClick:d,onRightClick:f}=Object.assign(Object.assign({},$u),e);if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=i,this.stype=t,this.level=r,this.visible=null==s||s,this.handleHide=!s,this.isEventPropagation=!1,this.position.set(o.x,o.y,o.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=c,this.autoUpdate=!1,this.onLoad=(null==u?void 0:u.bind(this))||null,this.onClick=(null==h?void 0:h.bind(this))||null,this.onDblClick=(null==d?void 0:d.bind(this))||null,this.onRightClick=(null==f?void 0:f.bind(this))||null}eventPropagation(){this.isEventPropagation=!0}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,Qu.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,Qu.needsUpdate=!0}setMove(e,t,n,i){return Li(this.position,Kn(e),t,n,i)}setRotate(e,t,n,i){const s=qn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Li({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Li(this.scale,Kn(e),t,n,i)}sClone(e){return new eh({id:`clone_${Oi()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),this.animations=e.animations,!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof eh||n instanceof Ju?this.add(n.sClone()):this.add(n.clone())}return this}getBoundingBox(){return Jn(this)}getSpaceAttribute(){return ni(this,!(arguments.length>0&&void 0!==arguments[0])||arguments[0])}syncSpaceAttribute(e){e instanceof eh?ii(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]):Zn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!")}}class th extends eh{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof eh&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof eh&&e.hide()}))}}class nh extends eh{constructor(e){super(e,"PluginObject")}}class ih extends eh{constructor(e){super(e,"PoiNode");const{type:t,element:n,elementAutoDisplay:i=!0,occlude:r=!1,onChange:s}=e;this.elementType=t,this.element=n,this.elementAutoDisplay=i,this.occlude=r,this.onChange=s,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}_create2D(){this.add(new to(this.element))}_create2DHalf(){this.add(new fo(this.element))}_create3D(){this.add(new ho(this.element))}}class rh extends eh{constructor(e){super(e,"Model");const{format:t}=e;this.formatType=t}setEnvMap(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};oi({path:e,file:arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]}).then((e=>{this.traverse((n=>{if(n instanceof k&&n.material instanceof U){const{reflectivity:i=.5}=t;n.material.envMap=e,n.material.envMapIntensity=i,Qu.needsUpdate=!0}}))}))}sClone(e){return new rh({id:`${this.sid}_clone`,url:"",format:this.formatType}).sCopy(this,e)}}const sh={position:{x:0,y:0,z:0},scale:{x:16,y:16,z:1},stype:"Icon"};class oh extends Ke{constructor(e,t){super(e);const{position:n,scale:i,stype:r}=Object.assign(Object.assign({},sh),t);this.stype=r,this.position.set(n.x,n.y,n.z),this.scale.set(i.x,i.y,i.z),this.renderOrder=1}}class ah extends eh{constructor(e,t){super(t,"Poi");const{name:n,type:i="2.5d",nameScale:r={x:16,y:16,z:1}}=t;this.iconType=i,this.icon=this._createIcon(e);const s={position:{x:0,y:10,z:0},name:n,scale:r};this.text=this.name?this._createText(s):null,this.renderOrder=11}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}sClone(e,t){return new ah(this.icon.material,{id:`${this.sid}_clone`,url:"",type:null!=t?t:this.iconType,name:this.name}).sCopy(this,e)}_createIcon(e){const t=new oh(this._computeMaterialSizeAttenuation(e));return this.add(t),t}_createText(e){const t=this._createTextMaterial(e),n=new oh(this._computeMaterialSizeAttenuation(t),e);return this.add(n),n}_createTextMaterial(e){const t=this._createTextCanvas(e.name||""),n=new u(t);n.flipY=!0,n.version+=1;return new qe({map:n,depthTest:!0})}_createTextCanvas(e,t){const n=256,i=document.createElement("canvas");i.width=n,i.height=n;const r=i.getContext("2d"),{fontFamily:s,fontSize:o,color:a,textAlign:l,textBaseline:c}=Object.assign(Object.assign({},{fontFamily:"Microsoft YaHei",fontSize:32,color:"#fff",textAlign:"center",textBaseline:"bottom"}),t);return r&&(r.save(),r.font=o+"px "+s,r.textAlign=l,r.textBaseline=c,r.shadowColor="black",r.strokeStyle="black",r.lineWidth=3,r.fillStyle=a,r.strokeText(e,128,128),r.fillText(e,128,128),r.restore()),i}_computeMaterialSizeAttenuation(e){return"2D"===this.iconType||"2d"===this.iconType?e.sizeAttenuation=!1:"2.5D"!==this.iconType&&"2.5d"!==this.iconType||(e.sizeAttenuation=!0),e}}class lh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Point";const{radius:n=10,color:i=16777215,opacity:r=1,gradient:s}=e;super(e,function(e){return new Je(e,32,32)}(n),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,map:ai(n)})}(i,r,s),t)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&(this.geometry=new Je(i,32,32)),r&&this.position.copy(Kn(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}class ch extends lh{constructor(e){super(e,"Node"),this.graphs=e.graphs}}class uh extends Ju{constructor(e){const{radius:t=50,color:n=16777215,opacity:i=1,gradient:r}=e;super(e,function(e){return new $e(e,64)}(t),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,side:he,map:ai(n)})}(n,i,r),"Circle"),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&(this.geometry=new $e(i,64)),r&&this.position.copy(Kn(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}const hh=new Map,dh=new g([0,0,1,0,1,1,1,1,0,1,0,0],2);class fh extends Ju{constructor(e){const{start:t,end:n,imgUrl:i,color:r,transparent:s=!1,passable:o=0,restrict:a=0}=e;super(e,void 0,void 0,"Link"),this.params=e,this.geometry=new p,this.material=new U({side:he}),this.passable=0,this.restrict=0,this.geometry.setAttribute("uv",dh),this.material.color.set(r),this.material.transparent=s,this.material.depthWrite=!s,this.material.flatShading=!0;const l=this.createTexture(i);l&&(this.material.map=l),this.updateGeometry({start:t,end:n}),this.passable=o,this.restrict=a,this.addEventListener("removed",(()=>{this.geometry.dispose(),this.material.dispose(),null==l||l.dispose()}))}updateGeometry(e){Object.assign(this.params,e),this.computeVertex();const t=this.material.map;t&&this.computeTextureRepeat(t)}computeVertex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new t(0,1,0);const{start:n,end:i,width:r}=this.params,s=Kn(n),o=Kn(i),a=r/2,l=new t,c=new t;l.subVectors(o,s),l.normalize(),c.crossVectors(l,e),0===c.length()&&c.crossVectors(l,new t(0,0,-1));const u=new t(c.x*a,c.y*a,c.z*a),h=new t(-c.x*a,-c.y*a,-c.z*a),d=new t;d.addVectors(s,u);const f=new t;f.addVectors(s,h);const p=new t;p.addVectors(o,h);const m=new t;m.addVectors(o,u),this.geometry.setAttribute("position",new g([d.x,d.y,d.z,f.x,f.y,f.z,p.x,p.y,p.z,p.x,p.y,p.z,m.x,m.y,m.z,d.x,d.y,d.z],3))}computeTextureRepeat(e){if(e.image){const{start:t,end:n,width:i}=this.params,r=Kn(t),s=Kn(n),o=r.distanceTo(s)/(i*(e.image.height/e.image.width));e.repeat.set(1,o)}}createTexture(e){if(e){const t=hh.get(e);if(t){return t.clone()}const n=(new l).load(e,(()=>{n.wrapS=ne,n.wrapT=ne,this.computeTextureRepeat(n),hh.set(e,n),Qu.needsUpdate=!0}));return n}}}class ph extends eh{constructor(e){super(e,"Topology"),this.nodes=[],this.links=[],this.linksImgAnimation=null;const{type:t="line"}=e;this.topologyType=t,this.info=e,this.create(),this.addEventListener("removed",(()=>{var e;null===(e=this.linksImgAnimation)||void 0===e||e.stop(),this.linksImgAnimation=null}))}create(){var e,t;const{nodes:n,renderLink:i=!0,linkWidth:r=20,linkColor:s=65280,renderNode:o=!0,nodeColor:a=255,nodeRadius:l=r/2,imgUrl:c,animation:u=!1}=this.info,h=[];for(const u of n){const n=this.createNode(Object.assign(Object.assign({},u),{radius:l,color:a}));if(!1===o&&n.hide(),this.nodes.push(n),!c&&i){const n=Ci(s)?s[null===(e=u.graphs[0])||void 0===e?void 0:e.passable]?s[null===(t=u.graphs[0])||void 0===t?void 0:t.passable]:s[0]:s;!o&&this.createCircle({id:`${u.id}_circle`,name:`${u.name||u.id}_circle`,position:u.position,radius:r/2,color:n})}if(i)for(let e=0;e<u.graphs.length;e++){const{linkInfo:t,targetNodeId:n,passable:i,restrict:o}=u.graphs[e],{id:a,name:l}=t,d=this.info.nodes.find((e=>e.id===n));if(!h.includes(a)&&d){h.push(a);const e=Ci(s)?s[i]?s[i]:s[0]:s,t=this.createLink({id:a,name:l,start:u.position,end:d.position,width:r,color:e,imgUrl:c,transparent:!!c,passable:i,restrict:o,userData:{startNodeId:u.id,endNodeId:d.id}});this.links.push(t)}}}this.updateLinksImgAnimation({imgUrl:c,animation:u})}createNode(e){const t=new ch(Object.assign({},e));return this.add(t),t}createCircle(e){const t=new uh(Object.assign(Object.assign({},e),{rotation:{x:Math.PI/2,y:0,z:0}}));return this.add(t),t}createLink(e){const t=new fh(Object.assign({},e));return this.add(t),t}updateLinksImgAnimation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{imgUrl:n,animation:i}=e;if(n&&!this.linksImgAnimation){let e=null;Ei(i)&&i?e={repeat:!0,duration:500}:Ii(i)&&Di(i.duration)&&i.duration>0&&(e=Object.assign({repeat:!0},i)),e&&Li(new h(0,0),new h(0,-1),e,(e=>{this.links.forEach((t=>{var n;null===(n=t.material.map)||void 0===n||n.offset.copy(e)}))}),(e=>{var t;null===(t=this.linksImgAnimation)||void 0===t||t.stop(),this.linksImgAnimation=e})).catch((()=>{}))}n||(null===(t=this.linksImgAnimation)||void 0===t||t.stop(),this.linksImgAnimation=null)}resetNodes(e){const{renderLink:t=!0,linkWidth:n=20,linkColor:i=65280,nodeColor:r=255,nodeRadius:s=n/2,imgUrl:o,animation:a=!1}=this.info,l=[...this.info.nodes];this.info.nodes=[...e];const c=[];for(let t=0;t<l.length;t++){const n=e.find((e=>e.id===l[t].id));n&&Kn(n.position).equals(Kn(l[t].position))||c.push(l[t])}for(let e=0;e<c.length;e++){const t=this.nodes.findIndex((t=>c[e].id===t.sid));this.remove(this.nodes[t]),this.nodes.splice(t,1)}const u=[];for(let t=0;t<e.length;t++){const n=l.find((n=>n.id===e[t].id));n&&Kn(n.position).equals(Kn(e[t].position))||u.push(e[t])}for(let e=0;e<u.length;e++){const t=this.createNode(Object.assign(Object.assign({},u[e]),{radius:s,color:r}));this.nodes.push(t)}const h=new Map,d=new Map;this.info.nodes.forEach((e=>{d.set(e.id,e)}));const f=[...this.links];for(const r of e)if(t)for(let e=0;e<r.graphs.length;e++){const{linkInfo:t,targetNodeId:s,passable:a,restrict:l}=r.graphs[e],{id:c,name:u}=t,p=d.get(s);if(!h.has(c)&&p){h.set(c,c);const e=Ci(i)?i[a]?i[a]:i[0]:i,t={id:c,name:u,start:r.position,end:p.position,width:n,color:e,imgUrl:o,transparent:!!o,passable:a,restrict:l},s=f.find((e=>e.sid===c));if(s)s.updateGeometry({start:t.start,end:t.end});else{const e=this.createLink(t);this.links.push(e)}}}f.forEach((e=>{if(!1===h.has(e.sid)){const t=this.links.findIndex((t=>t===e));t>-1&&(e.removeFromParent(),this.links.splice(t,1))}})),this.updateLinksImgAnimation({imgUrl:o,animation:a})}getLength(){let e=0;for(let t=1;t<this.nodes.length;t++)e+=this.nodes[t].position.distanceTo(this.nodes[t-1].position);return e}}function gh(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t(0,1,0);const r=n/2,s=new p;let o=[],a=[];if(e.length<2)return s;for(let n=0;n<e.length-1;n++){const s=Kn(e[n]),l=Kn(e[n+1]),c=new t,u=new t;c.subVectors(l,s),c.normalize(),u.crossVectors(c,i);const h=new t(u.x*r,u.y*r,u.z*r),d=new t(-u.x*r,-u.y*r,-u.z*r),f=new t;f.addVectors(s,h);const p=new t;p.addVectors(s,d);const g=new t;g.addVectors(l,d);const m=new t;m.addVectors(l,h),o=[...o,f.x,f.y,f.z,p.x,p.y,p.z,g.x,g.y,g.z,g.x,g.y,g.z,m.x,m.y,m.z,f.x,f.y,f.z],a=[...a,0,0,1,0,1,1,1,1,0,1,0,0]}return s.setAttribute("position",new g(o,3)),s.setAttribute("uv",new g(a,2)),s}class mh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Line";const{points:n,width:i=20,color:r=16777215,opacity:s=1,gradient:o}=e;super(e,gh(n,i),function(e,t,n){return new U({color:e,side:he,transparent:t<1,opacity:t,map:ai(n),flatShading:!0})}(r,s,o),t),this.params=e,this.points=n,this.frustumCulled=!1}setOptions(e){var t;const{color:n,opacity:i,points:r,width:s,gradient:o}=e;this.points=r;const a=this.material;n&&(a.color=new c(n)),i&&(a.opacity=i),o&&(a.map=ai(o)),r&&s?this.geometry=gh(r,s):r?this.geometry=gh(r,null!==(t=this.params.width)&&void 0!==t?t:20):s&&(this.geometry=gh(this.points,s)),a.needsUpdate=!0,Qu.needsUpdate=!0}}function vh(e){const t=[];for(let n=0;n<e.length;n++)t.push(new h(e[n].x,e[n].z));return t.length>2?new et(new tt(t)):new p}class yh extends Ju{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Polygon";const{yHeight:n,points:i,color:r=16777215,opacity:s=1,gradient:o}=e;super(e,vh(i),function(e,t,n){return new U({color:e,opacity:t,transparent:t<1,side:he,map:ai(n)})}(r,s,o),t),this.points=i,this.position.set(0,n,0),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,yHeight:i,points:r,gradient:s}=e,o=this.material;t&&(o.color=new c(t)),n&&(o.opacity=n),i&&this.position.set(0,i,0),r&&(this.geometry=vh(r)),s&&(o.map=ai(s)),o.needsUpdate=!0,Qu.needsUpdate=!0}}class wh extends eh{constructor(e){super(e,"Canvas3D"),this.create(e)}create(e){const{points:t=[],lines:n=[],polygons:i=[],circles:r=[]}=e;for(let e=0;e<t.length;e++)this.createPoint(t[e]);for(let e=0;e<n.length;e++)this.createLine(n[e]);for(let e=0;e<i.length;e++)this.createPolygon(i[e]);for(let e=0;e<r.length;e++)this.createCircle(r[e])}createPoint(e){const t=new lh(e);return this.add(t),Qu.needsUpdate=!0,t}getPoint(e){return this.getChildForType("Point",e)}removePoint(e){const t=this.getPoint(e);t&&this.remove(t),Qu.needsUpdate=!0}createLine(e){const t=new mh(e);return this.add(t),Qu.needsUpdate=!0,t}getLine(e){return this.getChildForType("Line",e)}removeLine(e){const t=this.getLine(e);t&&this.remove(t),Qu.needsUpdate=!0}createPolygon(e){const t=new yh(e);return this.add(t),Qu.needsUpdate=!0,t}getPolygon(e){return this.getChildForType("Polygon",e)}removePolygon(e){const t=this.getPolygon(e);t&&this.remove(t),Qu.needsUpdate=!0}createCircle(e){const t=new uh(e);return this.add(t),Qu.needsUpdate=!0,t}getCircle(e){return this.getChildForType("Circle",e)}removeCircle(e){const t=this.getCircle(e);t&&this.remove(t),Qu.needsUpdate=!0}getChildForType(e,t){for(let n=0;n<this.children.length;n++)if(this.children[n].stype===e&&this.children[n].sid===t)return this.children[n];return null}}class bh extends Ju{constructor(e,t,n){super(e,t,n,"Ground")}}var Ah=Object.freeze({__proto__:null,BaseMesh:Ju,BaseObject3D:eh,Canvas3D:wh,Circle:uh,Ground:bh,Group:th,Icon:oh,Line:mh,Link:fh,Model:rh,Node:ch,PluginObject:nh,Poi:ah,PoiNode:ih,Point:lh,Polygon:yh,Topology:ph});var xh=Object.defineProperty,Sh=(e,t,n)=>(((e,t,n)=>{t in e?xh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),Th=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e))(Th||{});function Eh(e,n,i){const r=(i=i??0)+1;if(function(e){var t=typeof e;return null==e||"object"!==t&&"function"!==t}(e))return e;if(null!=e.x&&null!=e.y)return function(e){return null!=e.w?(new we).copy(e):null!=e.z?(new t).copy(e):(new h).copy(e)}(e);if(Array.isArray(e))return e.map((e=>Eh(e,n,r)));if(e instanceof Map){const t=new Map;for(const i of e.keys()){const s=Eh(e.get(i),n,r);t.set(i,s)}return t}if(function(e){return e&&"function"==typeof e[Symbol.iterator]}(e)){const t=[];for(const i of e){const e=Eh(i,n,r);t.push(e)}return t}if((n||0===i)&&"object"==typeof e){const t={};for(const i of Object.keys(e))t[i]=Eh(e[i],n,r);return t}return e}function Dh(e,t,n){let i=function(e,t){const n=Math.sqrt(e.lengthSq()*t.lengthSq());if(0===n)return 0;let i=e.dot(t)/n;return i=Math.max(-1,Math.min(1,i)),Math.acos(i)}(e,t);return 0===i?i:e.clone().cross(t).dot(n)<0?-i:i}(e=>{e.toKey=function(t){return e[t]},e.toIndex=function(t){return e[t]}})(Th||(Th={}));const Ch=180/Math.PI,Ih={yaw:[{name:"前",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],pitch:[{name:"前",range:[-15,15]},{name:"上",range:[15,165]},{name:"下",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],roll:[{name:"上",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"下",range:[-180.1,-165]},{name:"下",range:[165,180.1]}]};const Bh={degrees:!0,map:Ih,front:{x:0,y:0,z:1},up:{x:0,y:1,z:0}};class Mh{constructor(e){Sh(this,"_options"),Sh(this,"_listMap"),Sh(this,"_front"),Sh(this,"_up"),e&&(this.options=e)}static get options(){return this._options??(this.options=Bh)}static set options(e){this._options=Object.assign({},structuredClone(Ih),e)}get defaultOptions(){return this.constructor.options}get options(){return this._options??(this.options=this.defaultOptions)}set options(e){this._options=Object.assign({},structuredClone(this.defaultOptions),e),this._listMap=null,this._front=null,this._up=null}get degrees(){return this.options.degrees??(this.options.degrees=this.defaultOptions.degrees??!0)}set degrees(e){this.options.degrees=e}get map(){return this.options.map||(this.map=this.defaultOptions.map),this.options.map}set map(e){const t=structuredClone(this.defaultOptions.map),n=structuredClone(Ih);e=e?{yaw:e.yaw??t.yaw??n.yaw,pitch:e.pitch??t.pitch??n.pitch,roll:e.roll??t.roll??n.roll}:t,this.options.map=e,this._listMap=null}get listMap(){return this._listMap??(this._listMap=function(e){const t={};for(const[n,i]of Object.entries(e))t[n]=Array.isArray(i)?i:Object.entries(i).map((([e,t])=>({name:e,range:t})));return t}(this.map??{}))}get front(){return this._front||(this.front=this.options.front??this.defaultOptions.front??Bh.front),this._front}set front(e){this._front=(new t).copy(e)}get up(){return this._up||(this.up=this.options.up??this.defaultOptions.up??Bh.up),this._up}set up(e){this._up=(new t).copy(e)}computeAzimuth(e,n,i){const r=(new t).copy(e),s=(new t).copy(n??this.front),o=(new t).copy(i??this.up);let{yaw:a,pitch:l,roll:c}=function(e,t,n){const i=t.clone().negate(),r=n.clone().projectOnPlane(t),s=Dh(t,e.clone().projectOnPlane(r),r),o=t.clone().cross(r);return{yaw:s,pitch:Dh(t,e.clone().projectOnPlane(o),o),roll:Dh(r,e.clone().projectOnPlane(i),i)}}(r,s,o);return this.degrees&&(a*=Ch,l*=Ch,c*=Ch),{yaw:{angle:a,name:this.findAzimuthNames("yaw",a)},pitch:{angle:l,name:this.findAzimuthNames("pitch",l)},roll:{angle:c,name:this.findAzimuthNames("roll",c)}}}findAzimuthNames(e,t){const n=[],i=this.listMap[e];if(!i)return n;for(const{name:e,range:[r,s]}of i)(t>=r&&t<s||t<=r&&t>s)&&n.push(e);return n}}function Ph(e){const n={};if(Array.isArray(e)){const i=e.map((e=>(new t).copy(e)));n.points=i}else if(e instanceof ph){const i=e.nodes.map((e=>e.getWorldPosition(new t)));n.points=i}else n.curve=e;return n}function Oh(e,t,n,i){const r=i?Eh(i,!1):null,s=Ph(t),o=br(Object.assign(Object.assign(Object.assign({},r),s),{target:e}));return n.playModelAnimation(e,o)}Sh(Mh,"_options"),new Mh;class Rh{constructor(e,t,n){this.type=e,this.scene=n,this.viewport=t}createGroup(e,t){const n=new th(e);return null!==t&&this.viewport.scener.addObject(n,null!=t?t:this.scene),n}clear(){this.getAll().forEach((e=>{this.viewport.scener.removeObject(e)}))}getAll(){const e=[];return this.scene.traverse((t=>{((t instanceof eh||t instanceof Ju)&&Ii(t)&&t.stype===this.type||Ii(t)&&t.userData.stype===this.type)&&e.push(t)})),e}hideAll(){this.getAll().forEach((e=>{e.hide?e.hide():e.visible=!1})),this.viewport.signals.objectChanged.dispatch()}showAll(){this.getAll().forEach((e=>{e.show?e.show():e.visible=!0})),this.viewport.signals.objectChanged.dispatch()}}class _h extends Rh{constructor(e,t){super(jn,e,t),Ft.init()}createAmbientLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1}=e,s=new nt(i,r);return s.name=n,s.userData.sid=t,s.userData.stype="Light",this.viewport.scener.addObject(s,this.scene),s}setAmbientLight(e,t){const{name:n="",color:i=10132122,intensity:r=1}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,this.viewport.signals.objectChanged.dispatch(),!0)}createDirectionalLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,u=new it(i,r);if(u.name=n,u.userData.sid=t,u.userData.stype="Light",u.position.set(s.x,s.y,s.z),u.target.name=`${n}-target`,u.target.position.set(o.x,o.y,o.z),u.castShadow=a,a){const e=u.position.distanceTo(u.target.position);u.shadow.bias=-.005,u.shadow.camera.left=-e,u.shadow.camera.right=e,u.shadow.camera.top=e,u.shadow.camera.bottom=-e,u.shadow.camera.far=e,u.shadow.autoUpdate=l,u.shadow.needsUpdate=!l,u.shadow.mapSize.width=c,u.shadow.mapSize.height=c,u.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(u,this.scene),this.viewport.scener.addObject(u.target,this.scene),u}setDirectionalLight(e,t){const{name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:u=4096}=t;if(!e)return!1;if(e.name=n,e.color=new c(i),e.intensity=r,e.position.set(s.x,s.y,s.z),e.target.position.set(o.x,o.y,o.z),e.castShadow=a,a){const t=e.position.distanceTo(e.target.position);e.shadow.bias=-.005,e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,e.shadow.camera.far=t,e.shadow.autoUpdate=l,e.shadow.needsUpdate=!l,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createHemisphereLight(e){const{id:t,name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=e,a=new rt(i,r,s);return a.name=n,a.position.set(o.x,o.y,o.z),a.userData.sid=t,a.userData.stype="Light",this.viewport.scener.addObject(a,this.scene),a}setHemisphereLight(e,t){const{name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new c(i),e.groundColor=new c(r),e.intensity=s,e.position.set(o.x,o.y,o.z),this.viewport.signals.objectChanged.dispatch(),!0)}createSpotLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:u=4096}=e,h=Kn(o).distanceTo(Kn(a)),d=new st(i,r,h,Math.PI/360*s,0,0);if(d.name=n,d.position.set(o.x,o.y,o.z),d.userData.sid=t,d.userData.stype="Light",d.castShadow=l,d.target.position.set(a.x,a.y,a.z),d.target.castShadow=l,d.target.receiveShadow=!0,d.target.updateMatrixWorld(),l){const e=d.position.distanceTo(d.target.position);d.shadow.autoUpdate=c,d.shadow.needsUpdate=!c,d.shadow.mapSize.width=u,d.shadow.mapSize.height=u,d.shadow.bias=-.005,d.shadow.focus=.6,d.shadow.camera.far=e,d.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(d,this.scene),d}setSpotLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:u=!1,mapSize:h=4096}=t;if(!e)return!1;const d=Kn(o).distanceTo(Kn(a));if(e.name=n,e.color=new c(i),e.intensity=r,e.distance=d,e.angle=Math.PI/360*s,e.position.set(o.x,o.y,o.z),e.castShadow=l,e.target.position.set(a.x,a.y,a.z),e.target.castShadow=l,e.target.updateMatrixWorld(),l){const t=e.position.distanceTo(e.target.position);e.shadow.autoUpdate=u,e.shadow.needsUpdate=!u,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.bias=-.005,e.shadow.focus=.6,e.shadow.camera.far=t,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createPointLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,u=new ot(i,r,s);return u.name=n,u.userData.sid=t,u.userData.stype="Light",u.position.set(o.x,o.y,o.z),u.castShadow=a,a&&(u.shadow.bias=-.005,u.shadow.camera.far=s,u.shadow.autoUpdate=l,u.shadow.needsUpdate=!l,u.shadow.mapSize.width=c,u.shadow.mapSize.height=c,u.shadow.camera.updateProjectionMatrix()),this.viewport.scener.addObject(u,this.scene),u}setPointLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:u=4096}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,e.distance=s,e.position.set(o.x,o.y,o.z),e.castShadow=a,a&&(e.shadow.bias=-.005,e.shadow.camera.far=s,e.shadow.autoUpdate=l,e.shadow.needsUpdate=!l,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.camera.updateProjectionMatrix()),this.viewport.signals.objectChanged.dispatch(),!0)}createRectAreaLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=e,l=new at(i,r,s,o);return l.name=n,l.userData.sid=t,l.userData.stype="Light",l.position.set(a.x,a.y,a.z),this.viewport.scener.addObject(l,this.scene),l}setRectAreaLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new c(i),e.intensity=r,e.width=s,e.height=o,e.position.set(a.x,a.y,a.z),this.viewport.signals.objectChanged.dispatch(),!0)}updateAllShadow(){this.getAll().forEach((e=>{var t;!1===(null===(t=e.shadow)||void 0===t?void 0:t.autoUpdate)&&(e.shadow.needsUpdate=!0)})),this.viewport.signals.objectChanged.dispatch()}}function kh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lh={};let Nh,Uh,jh;({get exports(){return Lh},set exports(e){Lh=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&kh)return kh(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=kh,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function h(e){1!==c.push(e)||i||n()}t.exports=h}).call(this,void 0!==Xr?Xr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)u(e[l],l);return c;function u(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?h(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=g,c.reject=m,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==Xr?Xr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},v=Object.prototype.toString,y="readonly",w="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function A(e){return new c((function(t){var n=e.transaction(p,w),i=l([""]);n.objectStore(p).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function x(e){return"boolean"==typeof g?c.resolve(g):A(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function T(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function E(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[e.name]||L(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(p)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),T(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function B(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function M(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function _(e){S(e);for(var t=m[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,B(e)?I(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw E(e,t),t}))}function k(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),I(e)})).then((function(){return _(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function L(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function N(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=L(),m[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,B(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function j(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;O(i)&&(i=P(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function F(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?x(s.db).then((function(e){return e?t:M(t)})):t})).then((function(t){k(i._dbInfo,w,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return u(r,n),r}function z(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,w,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function G(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,w,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function V(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function W(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Y(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=m[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=m[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,T(n._dbInfo)}})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)T(i[t]._dbInfo)})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var Q={_driver:"asyncStorage",_initStorage:N,_support:a(),iterate:j,getItem:U,setItem:F,removeItem:z,clear:G,length:H,key:V,keys:W,dropInstance:Y};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",ue="fl64",he=$+ee.length,de=Object.prototype.toString;function fe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[l++]=(3&r)<<6|63&s;return c}function pe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function ge(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=ue:t(new Error("Failed to get type for BinaryArray"))),t(r+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+pe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function me(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(he),i=e.substring($,he);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=fe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function we(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function be(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function Ae(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function xe(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return u(s,n),s}function Te(e,t,n){return Se.apply(this,[e,t,n,1])}function Ee(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ie(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Be(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Me(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Pe(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Me(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:xe,getItem:Ae,setItem:Te,removeItem:Ee,clear:De,length:Ce,key:Ie,keys:Be,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function _e(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Le(){return!ke()||localStorage.length>0}function Ne(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=_e(e,t._defaultConfig),Le()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return u(n,e),n}function je(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return u(i,t),i}function Fe(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return u(i,t),i}function ze(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return u(i,t),i}function Ge(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return u(n,e),n}function He(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Ve(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function We(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return u(r,n),r}function Ye(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(_e(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),u(i,t),i}var Qe={_driver:"localStorageWrapper",_initStorage:Ne,_support:Re(),iterate:Fe,getItem:je,setItem:We,removeItem:Ve,clear:Ue,length:He,key:ze,keys:Ge,dropInstance:Ye},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:Q,WEBSQL:Oe,LOCALSTORAGE:Qe},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};h();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return h(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return h(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return h(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),h(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);class Fh extends lt{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===r.path?ct.extractUrlBase(e):r.path,o=new ut(this.manager);o.setPath(r.path),o.setResponseType("arraybuffer"),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e,t){if(function(e){const t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===id(e,0,t.length)}(e))Nh=(new Wh).parse(e);else{const t=id(e);if(!function(e){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(t){const i=e[t-1];return e=e.slice(n+t),n++,i}for(let e=0;e<t.length;++e){if(i(1)===t[e])return!1}return!0}(t))throw new Error("THREE.FBXLoader: Unknown format.");if(Xh(t)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Xh(t));Nh=(new Vh).parse(t)}const n=new l(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new zh(n,this.manager).parse(Nh)}}class zh{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Uh=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),r=(new Gh).parse(i);return this.parseScene(i,r,n),jh}parseConnections(){const e=new Map;if("Connections"in Nh){Nh.Connections.connections.forEach((function(t){const n=t[0],i=t[1],r=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const s={ID:i,relationship:r};e.get(n).parents.push(s),e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:n,relationship:r};e.get(i).children.push(o)}))}return e}parseImages(){const e={},t={};if("Video"in Nh.Objects){const n=Nh.Objects.Video;for(const i in n){const r=n[i];if(e[parseInt(i)]=r.RelativeFilename||r.Filename,"Content"in r){const e=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,s="string"==typeof r.Content&&""!==r.Content;if(e||s){const e=this.parseImage(n[i]);t[r.RelativeFilename||r.Filename]=e}}}}for(const n in e){const i=e[n];void 0!==t[i]?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof t)return"data:"+r+";base64,"+t;{const e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in Nh.Objects){const n=Nh.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],e);t.set(parseInt(i),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,r=e.WrapModeV,s=void 0!==i?i.value:0,o=void 0!==r?r.value:0;if(n.wrapS=0===s?ne:ht,n.wrapT=0===o?ne:ht,"Scaling"in e){const t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){const t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n;const i=this.textureLoader.path,r=Uh.get(e.id).children;let s;void 0!==r&&r.length>0&&void 0!==t[r[0].ID]&&(n=t[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const o=e.FileName.slice(-3).toLowerCase();if("tga"===o){const t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),s=new u):(t.setPath(this.textureLoader.path),s=t.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),s=new u):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(e){const t=new Map;if("Material"in Nh.Objects){const n=Nh.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],e);null!==r&&t.set(parseInt(i),r)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let r=e.ShadingModel;if("object"==typeof r&&(r=r.value),!Uh.has(n))return null;const s=this.parseParameters(e,t,n);let o;return r.toLowerCase(),o=new U,o.setValues(s),o.name=i,o}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new c).fromArray(e.Diffuse.value).convertSRGBToLinear():!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new c).fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new c).fromArray(e.Emissive.value).convertSRGBToLinear():!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new c).fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0,i.depthWrite=!1);const r=this;return Uh.get(n).children.forEach((function(e){const n=e.relationship;switch(n){case"Bump":i.bumpMap=r.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=ye);break;case"DisplacementColor":i.displacementMap=r.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=ye);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=r.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=a,i.envMap.encoding=ye);break;case"SpecularColor":i.specularMap=r.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=ye);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}getTexture(e,t){return"LayeredTexture"in Nh.Objects&&t in Nh.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Uh.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Nh.Objects){const n=Nh.Objects.Deformer;for(const i in n){const r=n[i],s=Uh.get(parseInt(i));if("Skin"===r.attrType){const t=this.parseSkeleton(s,n);t.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=s.parents[0].ID,e[i]=t}else if("BlendShape"===r.attrType){const e={id:i};e.rawTargets=this.parseMorphTargets(s,n),e.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach((function(e){const i=t[e.ID];if("Cluster"!==i.attrType)return;const r={ID:e.ID,indices:[],weights:[],transformLink:(new d).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i<e.children.length;i++){const r=e.children[i],s=t[r.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;o.geoID=Uh.get(parseInt(r.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}parseScene(e,t,n){jh=new dt;const i=this.parseModels(e.skeletons,t,n),r=Nh.Objects.Model,s=this;i.forEach((function(e){const t=r[e.ID];s.setLookAtProperties(e,t);Uh.get(e.ID).parents.forEach((function(t){const n=i.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&jh.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),jh.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);const t=ed(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));const o=(new Hh).parse();1===jh.children.length&&jh.children[0].isGroup&&(jh.children[0].animations=o,jh=jh.children[0]),jh.animations=o}parseModels(e,t,n){const i=new Map,r=Nh.Objects.Model;for(const s in r){const o=parseInt(s),a=r[s],l=Uh.get(o);let c=this.buildSkeleton(l,e,o,a.attrName);if(!c){switch(a.attrType){case"Camera":case"Light":break;case"Mesh":c=this.createMesh(l,t,n);break;case"NurbsCurve":c=this.createCurve(l,t);break;case"LimbNode":case"Root":c=new S;break;default:c=new dt}c.name=a.attrName?ft.sanitizeNodeName(a.attrName):"",c.ID=o}this.getTransformData(c,a),i.set(o,c)}return i}buildSkeleton(e,t,n,i){let r=null;return e.parents.forEach((function(e){for(const s in t){const o=t[s];o.rawBones.forEach((function(t,s){if(t.ID===e.ID){const e=r;r=new S,r.matrixWorld.copy(t.transformLink),r.name=i?ft.sanitizeNodeName(i):"",r.ID=n,o.bones[s]=r,null!==e&&r.add(e)}}))}})),r}createCamera(e){let t,n;if(e.children.forEach((function(e){const t=Nh.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new M;else{let e=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(e=1);let i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);let r=1e3;void 0!==n.FarPlane&&(r=n.FarPlane.value/1e3);let s=window.innerWidth,o=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,o=n.AspectHeight.value);const a=s/o;let l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);const c=n.FocalLength?n.FocalLength.value:null;switch(e){case 0:t=new j(l,a,i,r),null!==c&&t.setFocalLength(c);break;case 1:t=new F(-s/2,s/2,o/2,-o/2,i,r);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+e+"."),t=new M}}return t}createLight(e){let t,n;if(e.children.forEach((function(e){const t=Nh.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new M;else{let e;e=void 0===n.LightType?0:n.LightType.value;let i=16777215;void 0!==n.Color&&(i=(new c).fromArray(n.Color.value).convertSRGBToLinear());let r=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(r=0);let s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);const o=1;switch(e){case 0:t=new ot(i,r,s,o);break;case 1:t=new it(i,r);break;case 2:let e=Math.PI/3;void 0!==n.InnerAngle&&(e=w.degToRad(n.InnerAngle.value));let a=0;void 0!==n.OuterAngle&&(a=w.degToRad(n.OuterAngle.value),a=Math.max(a,1)),t=new st(i,r,s,e,a,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new ot(i,r)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,r=null,s=null;const o=[];return e.children.forEach((function(e){t.has(e.ID)&&(r=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?s=o:o.length>0?s=o[0]:(s=new U({color:13421772}),o.push(s)),"color"in r.attributes&&o.forEach((function(e){e.vertexColors=!0})),void 0===r.getAttribute("normal")&&o.forEach((function(e){e.flatShading=!0})),r.FBX_Deformer?(i=new E(r,s),i.normalizeSkinWeights()):i=new k(r,s),i.castShadow=!0,i.receiveShadow=!0,i}createCurve(e,t){const n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),i=new m({color:3342591,linewidth:1});return new v(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?td(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,n){if("LookAtProperty"in n){Uh.get(e.ID).children.forEach((function(n){if("LookAtProperty"===n.relationship){const i=Nh.Objects.Model[n.ID];if("Lcl_Translation"in i){const n=i.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(n),jh.add(e.target)):e.lookAt((new t).fromArray(n))}}}))}}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const r in e){const s=e[r];Uh.get(parseInt(s.ID)).parents.forEach((function(e){if(t.has(e.ID)){const t=e.ID;Uh.get(t).parents.forEach((function(e){if(n.has(e.ID)){n.get(e.ID).bind(new D(s.bones),i[e.ID])}}))}}))}}parsePoseNodes(){const e={};if("Pose"in Nh.Objects){const t=Nh.Objects.Pose;for(const n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach((function(t){e[t.Node]=(new d).fromArray(t.Matrix.a)})):e[i.Node]=(new d).fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Nh&&"AmbientColor"in Nh.GlobalSettings){const e=Nh.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(0!==t||0!==n||0!==i){const e=new c(t,n,i).convertSRGBToLinear();jh.add(new nt(e,1))}}}}class Gh{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Nh.Objects){const n=Nh.Objects.Geometry;for(const i in n){const r=Uh.get(parseInt(i)),s=this.parseGeometry(r,n[i],e);t.set(parseInt(i),s)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,r=[],s=e.parents.map((function(e){return Nh.Objects.Model[e.ID]}));if(0===s.length)return;const o=e.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&r.push(n.morphTargets[e.ID])}));const a=s[0],l={};"RotationOrder"in a&&(l.eulerOrder=td(a.RotationOrder.value)),"InheritType"in a&&(l.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(l.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(l.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(l.scale=a.GeometricScaling.value);const c=ed(l);return this.genGeometry(t,o,r,c)}genGeometry(e,t,n,i){const r=new p;e.attrName&&(r.name=e.attrName);const s=this.parseGeoNode(e,t),o=this.genBuffers(s),a=new g(o.vertex,3);if(a.applyMatrix4(i),r.setAttribute("position",a),o.colors.length>0&&r.setAttribute("color",new g(o.colors,3)),t&&(r.setAttribute("skinIndex",new T(o.weightsIndices,4)),r.setAttribute("skinWeight",new g(o.vertexWeights,4)),r.FBX_Deformer=t),o.normal.length>0){const e=(new Be).getNormalMatrix(i),t=new g(o.normal,3);t.applyNormalMatrix(e),r.setAttribute("normal",t)}if(o.uvs.forEach((function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),r.setAttribute(n,new g(o.uvs[t],2))})),s.material&&"AllSame"!==s.material.mappingType){let e=o.materialIndex[0],t=0;if(o.materialIndex.forEach((function(n,i){n!==e&&(r.addGroup(t,i-t,e),e=n,t=i)})),r.groups.length>0){const t=r.groups[r.groups.length-1],n=t.start+t.count;n!==o.materialIndex.length&&r.addGroup(n,o.materialIndex.length-n,e)}0===r.groups.length&&r.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(r,e,n,i),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:t,weight:e.weights[r]})}))}))),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],o=[],a=[],l=[],c=[],u=[];const h=this;return e.vertexIndices.forEach((function(d,f){let p,g=!1;d<0&&(d^=-1,g=!0);let m=[],v=[];if(s.push(3*d,3*d+1,3*d+2),e.color){const t=qh(f,n,d,e.color);a.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){v.push(e.weight),m.push(e.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const e=[0,0,0,0],t=[0,0,0,0];v.forEach((function(n,i){let r=n,s=m[i];t.forEach((function(t,n,i){if(r>t){i[n]=r,r=t;const o=e[n];e[n]=s,s=o}}))})),m=e,v=t}for(;v.length<4;)v.push(0),m.push(0);for(let e=0;e<4;++e)c.push(v[e]),u.push(m[e])}if(e.normal){const t=qh(f,n,d,e.normal);o.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(p=qh(f,n,d,e.material)[0],p<0&&(h.negativeMaterialIndices=!0,p=0)),e.uv&&e.uv.forEach((function(e,t){const i=qh(f,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,s,p,o,a,l,c,u,i),n++,i=0,s=[],o=[],a=[],l=[],c=[],u=[])})),t}genFace(e,t,n,i,r,s,o,a,l,c){for(let u=2;u<c;u++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(u-1)]),e.vertexWeights.push(a[4*(u-1)+1]),e.vertexWeights.push(a[4*(u-1)+2]),e.vertexWeights.push(a[4*(u-1)+3]),e.vertexWeights.push(a[4*u]),e.vertexWeights.push(a[4*u+1]),e.vertexWeights.push(a[4*u+2]),e.vertexWeights.push(a[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(s[0]),e.colors.push(s[1]),e.colors.push(s[2]),e.colors.push(s[3*(u-1)]),e.colors.push(s[3*(u-1)+1]),e.colors.push(s[3*(u-1)+2]),e.colors.push(s[3*u]),e.colors.push(s[3*u+1]),e.colors.push(s[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[3*(u-1)]),e.normal.push(r[3*(u-1)+1]),e.normal.push(r[3*(u-1)+2]),e.normal.push(r[3*u]),e.normal.push(r[3*u+1]),e.normal.push(r[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(u-1)]),e.uvs[n].push(o[n][2*(u-1)+1]),e.uvs[n].push(o[n][2*u]),e.uvs[n].push(o[n][2*u+1])}))}addMorphTargets(e,t,n,i){if(0===n.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach((function(n){n.rawTargets.forEach((function(n){const s=Nh.Objects.Geometry[n.geoID];void 0!==s&&r.genMorphGeometry(e,t,s,i,n.name)}))}))}genMorphGeometry(e,t,n,i,r){const s=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l);for(let e=0;e<a.length;e++){const t=3*a[e];c[t]=o[3*e],c[t+1]=o[3*e+1],c[t+2]=o[3*e+2]}const u={vertexIndices:s,vertexPositions:c},h=this.genBuffers(u),d=new g(h.vertex,3);d.name=r||n.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a;let r=[];return"IndexToDirect"===n&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a;let r=[];return"IndexToDirect"===n&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a;let r=[];"IndexToDirect"===n&&(r=e.ColorIndex.a);for(let e=0,t=new c;e<i.length;e+=4)t.fromArray(i,e).convertSRGBToLinear().toArray(i,e);return{dataSize:4,buffer:i,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=e.Materials.a,r=[];for(let e=0;e<i.length;++e)r.push(e);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new p;const n=t-1,i=e.KnotVector.a,r=[],s=e.Points.a;for(let e=0,t=s.length;e<t;e+=4)r.push((new we).fromArray(s,e));let o,a;if("Closed"===e.Form)r.push(r[0]);else if("Periodic"===e.Form){o=n,a=i.length-1-o;for(let e=0;e<n;++e)r.push(r[e])}const l=new Wt(n,i,r,o,a).getPoints(12*r.length);return(new p).setFromPoints(l)}}class Hh{parse(){const e=[],t=this.parseClips();if(void 0!==t)for(const n in t){const i=t[n],r=this.addClip(i);e.push(r)}return e}parseClips(){if(void 0===Nh.Objects.AnimationCurve)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=Nh.Objects.AnimationCurveNode,t=new Map;for(const n in e){const i=e[n];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){const e={id:i.id,attr:i.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){const t=Nh.Objects.AnimationCurve;for(const n in t){const i={id:t[n].id,times:t[n].KeyTime.a.map(Zh),values:t[n].KeyValueFloat.a},r=Uh.get(i.id);if(void 0!==r){const t=r.parents[0].ID,n=r.parents[0].relationship;n.match(/X/)?e.get(t).curves.x=i:n.match(/Y/)?e.get(t).curves.y=i:n.match(/Z/)?e.get(t).curves.z=i:n.match(/d|DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=i)}}}parseAnimationLayers(e){const t=Nh.Objects.AnimationLayer,n=new Map;for(const i in t){const t=[],r=Uh.get(parseInt(i));if(void 0!==r){r.children.forEach((function(n,i){if(e.has(n.ID)){const r=e.get(n.ID);if(void 0!==r.curves.x||void 0!==r.curves.y||void 0!==r.curves.z){if(void 0===t[i]){const e=Uh.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==e){const r=Nh.Objects.Model[e.toString()];if(void 0===r)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);const s={modelName:r.attrName?ft.sanitizeNodeName(r.attrName):"",ID:r.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};jh.traverse((function(e){e.ID===r.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new d),"PreRotation"in r&&(s.preRotation=r.PreRotation.value),"PostRotation"in r&&(s.postRotation=r.PostRotation.value),t[i]=s}}t[i]&&(t[i][r.attr]=r)}else if(void 0!==r.curves.morph){if(void 0===t[i]){const e=Uh.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,r=Uh.get(e).parents[0].ID,s=Uh.get(r).parents[0].ID,o=Uh.get(s).parents[0].ID,a=Nh.Objects.Model[o],l={modelName:a.attrName?ft.sanitizeNodeName(a.attrName):"",morphName:Nh.Objects.Deformer[e].attrName};t[i]=l}t[i][r.attr]=r}}})),n.set(parseInt(i),t)}}return n}parseAnimStacks(e){const t=Nh.Objects.AnimationStack,n={};for(const i in t){const r=Uh.get(parseInt(i)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(r[0].ID);n[i]={name:t[i].attrName,layer:s}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new C(e.name,-1,t)}generateTracks(e){const i=[];let s=new t,o=new r,a=new t;if(e.transform&&e.transform.decompose(s,o,a),s=s.toArray(),o=(new n).setFromQuaternion(o,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");void 0!==t&&i.push(t)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){const t=this.generateRotationTrack(e.modelName,e.R.curves,o,e.preRotation,e.postRotation,e.eulerOrder);void 0!==t&&i.push(t)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale");void 0!==t&&i.push(t)}if(void 0!==e.DeformPercent){const t=this.generateMorphTrack(e);void 0!==t&&i.push(t)}return i}generateVectorTrack(e,t,n,i){const r=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(r,t,n);return new I(e+"."+i,r,s)}generateRotationTrack(e,t,i,s,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(w.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(w.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(w.degToRad));const l=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(l,t,i);void 0!==s&&((s=s.map(w.degToRad)).push(a),s=(new n).fromArray(s),s=(new r).setFromEuler(s)),void 0!==o&&((o=o.map(w.degToRad)).push(a),o=(new n).fromArray(o),o=(new r).setFromEuler(o).invert());const u=new r,h=new n,d=[];for(let e=0;e<c.length;e+=3)h.set(c[e],c[e+1],c[e+2],a),u.setFromEuler(h),void 0!==s&&u.premultiply(s),void 0!==o&&u.multiply(o),u.toArray(d,e/3*4);return new B(e+".quaternion",l,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),i=jh.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new pt(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){let e=1,n=t[0];for(let i=1;i<t.length;i++){const r=t[i];r!==n&&(t[e]=r,n=r,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){const i=n,r=[];let s=-1,o=-1,a=-1;return e.forEach((function(e){if(t.x&&(s=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==s){const e=t.x.values[s];r.push(e),i[0]=e}else r.push(i[0]);if(-1!==o){const e=t.y.values[o];r.push(e),i[1]=e}else r.push(i[1]);if(-1!==a){const e=t.z.values[a];r.push(e),i[2]=e}else r.push(i[2])})),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){const s=r/180,o=i/s;let a=n+o;const l=e.times[t-1],c=(e.times[t]-l)/s;let u=l+c;const h=[],d=[];for(;u<e.times[t];)h.push(u),u+=c,d.push(a),a+=o;e.times=rd(e.times,t,h),e.values=rd(e.values,t,d)}}}}class Vh{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Qh,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,i){const r=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);if(r||s)return;const o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,n[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)})),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},s=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in o?("PoseNode"===n?o.PoseNode.push(r):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==s.id&&(o[n][s.id]=r)):"number"==typeof s.id?(o[n]={},o[n][s.id]=r):"Properties70"!==n&&(o[n]="PoseNode"===n?[r]:r),"number"==typeof s.id&&(r.id=s.id),""!==s.name&&(r.attrName=s.name),""!==s.type&&(r.attrType=s.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const e=r.split(",").slice(1),t=parseInt(e[0]),n=parseInt(e[1]);let o=r.split(",").slice(3);o=o.map((function(e){return e.trim().replace(/^"/,"")})),i="connections",r=[t,n],function(e,t){for(let n=0,i=e.length,r=t.length;n<r;n++,i++)e[i]=t[n]}(r,o),void 0===s[i]&&(s[i]=[])}"Node"===i&&(s.id=r),i in s&&Array.isArray(s[i])?s[i].push(r):"a"!==i?s[i]=r:s.a=r,this.setCurrentProp(s,i),"a"===i&&","!==r.slice(-1)&&(s.a=nd(r))}else this.parseNodeSpecialProperty(e,i,r)}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=nd(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map((function(e){return e.trim().replace(/^"/,"").replace(/\s/,"_")})),r=i[0],s=i[1],o=i[2],a=i[3];let l=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=nd(l)}this.getPrevNode()[r]={type:s,type2:o,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class Wh{parse(e){const t=new Yh(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new Qh;for(;!this.endOfContent(t);){const e=this.parseNode(t,n);null!==e&&i.add(e.name,e)}return i}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),o=e.getString(s);if(0===i)return null;const a=[];for(let t=0;t<r;t++)a.push(this.parseProperty(e));const l=a.length>0?a[0]:"",c=a.length>1?a[1]:"",u=a.length>2?a[2]:"";for(n.singleProperty=1===r&&e.getOffset()===i;i>e.getOffset();){const i=this.parseNode(e,t);null!==i&&this.parseSubNode(o,n,i)}return n.propertyList=a,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==u&&(n.attrType=u),""!==o&&(n.name=o),n}parseSubNode(e,t,n){if(!0===n.singleProperty){const e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if("Connections"===e&&"C"===n.name){const e=[];n.propertyList.forEach((function(t,n){0!==n&&e.push(t)})),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){let e=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],s=n.propertyList[3];let o;0===e.indexOf("Lcl ")&&(e=e.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:i,type2:r,flag:s,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),r=e.getUint32(),s=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=Vt.unzlibSync(new Uint8Array(e.getArrayBuffer(s))),a=new Yh(o.buffer);switch(t){case"b":case"c":return a.getBooleanArray(i);case"d":return a.getFloat64Array(i);case"f":return a.getFloat32Array(i);case"i":return a.getInt32Array(i);case"l":return a.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Yh{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return 1==(1&this.getUint8())}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,e=4294967295&~e,4294967295===e&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const i=n.indexOf(0);return i>=0&&(n=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(n)}}class Qh{add(e,t){this[e]=t}}function Xh(e){const t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Zh(e){return e/46186158e3}const Kh=[];function qh(e,t,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=e;break;case"ByPolygon":r=t;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const s=r*i.dataSize,o=s+i.dataSize;return function(e,t,n,i){for(let r=n,s=0;r<i;r++,s++)e[s]=t[r];return e}(Kh,i.buffer,s,o)}const Jh=new n,$h=new t;function ed(e){const i=new d,r=new d,s=new d,o=new d,a=new d,l=new d,c=new d,u=new d,h=new d,f=new d,p=new d,g=new d,m=e.inheritType?e.inheritType:0;if(e.translation&&i.setPosition($h.fromArray(e.translation)),e.preRotation){const t=e.preRotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),r.makeRotationFromEuler(Jh.fromArray(t))}if(e.rotation){const t=e.rotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),s.makeRotationFromEuler(Jh.fromArray(t))}if(e.postRotation){const t=e.postRotation.map(w.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),o.makeRotationFromEuler(Jh.fromArray(t)),o.invert()}e.scale&&a.scale($h.fromArray(e.scale)),e.scalingOffset&&c.setPosition($h.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition($h.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition($h.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition($h.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p.copy(e.parentMatrix),f.copy(e.parentMatrixWorld));const v=r.clone().multiply(s).multiply(o),y=new d;y.extractRotation(f);const b=new d;b.copyPosition(f);const A=b.clone().invert().multiply(f),x=y.clone().invert().multiply(A),S=a,T=new d;if(0===m)T.copy(y).multiply(v).multiply(x).multiply(S);else if(1===m)T.copy(y).multiply(x).multiply(v).multiply(S);else{const e=(new d).scale((new t).setFromMatrixScale(p)).clone().invert(),n=x.clone().multiply(e);T.copy(y).multiply(v).multiply(n).multiply(S)}const E=h.clone().invert(),D=l.clone().invert();let C=i.clone().multiply(u).multiply(h).multiply(r).multiply(s).multiply(o).multiply(E).multiply(c).multiply(l).multiply(a).multiply(D);const I=(new d).copyPosition(C),B=f.clone().multiply(I);return g.copyPosition(B),C=g.clone().multiply(T),C.premultiply(f.invert()),C}function td(e){const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function nd(e){return e.split(",").map((function(e){return parseFloat(e)}))}function id(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function rd(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}const sd=()=>{self.noCompressWorker=function(e,t){const[n]=new Uint32Array(e,t,1),i={byteOffset:t+=4,length:3*n},r={byteOffset:t+=3*n*4,length:2*n},s={byteOffset:t+=2*n*4,length:4*n},o={byteOffset:t+=4*n*1,length:3*n};t+=3*n*1;let a=(s.length+o.length)%4;a>0&&(a=4-a,t+=a);const l=new Uint32Array(e,t,1);t+=4;const[c]=l,u={byteOffset:t,length:c};t+=4*c;const h=new Uint32Array(e,t,1);t+=4;const[d]=h,f=[];if(d>0)for(let n=0;n<d;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);f.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:i,normal:o,color:s,texcoord:r,indice:u,sub_mesh:f}}},od=()=>{self.gzipCompressWorker=function(e){const t=new Uint8Array(e,4,e.byteLength-4),n=new pako.Inflate;n.push(t,!0);const{result:i}=n;if(i instanceof Uint8Array){const{buffer:e}=i;let t=0;const[n]=new Uint32Array(e,t,1);t+=4;const r={byteOffset:t,length:3*n};t+=3*n*4;const s={byteOffset:t,length:2*n};t+=2*n*4;const o={byteOffset:t,length:4*n};t+=4*n*1;const a={byteOffset:t,length:3*n};t+=3*n*1;let l=(o.length+a.length)%4;l>0&&(l=4-l,t+=l);const c=new Uint32Array(e,t,1);t+=4;const[u]=c,h={byteOffset:t,length:u};t+=4*u;const d=new Uint32Array(e,t,1);t+=4;const[f]=d,p=[];if(f>0)for(let n=0;n<f;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);p.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:r,normal:a,color:o,texcoord:s,indice:h,sub_mesh:p}}}},ad=()=>{self.parseChunkWorker=function(e){let t=0;const n=new Int8Array(e,t,128);t+=128,(new TextDecoder).decode(n.slice(0,4));const[i]=n.slice(4,8);if(0===i)return self.noCompressWorker(e,t);if(1===i){const t=e.slice(128);return self.gzipCompressWorker(t)}throw new Error("unknown compress mode [ .sbmx model ]")}},ld="\n onmessage = function ( e ) {\n \n const message = e.data\n\n switch ( message.type ) {\n\n case 'decode': {\n\n const chunkInfo = self.parseChunkWorker( message.data )\n\n if ( chunkInfo ) { \n\n self.postMessage( \n { type: 'decode', data: chunkInfo, }, \n [ chunkInfo.buffer ]\n )\n\n } else {\n\n self.postMessage( { type: 'decode', data: {}, } )\n\n }\n\n break\n \n }\n \n }\n\n }\n\n",cd="textureIndex.json";class ud extends lt{constructor(e){super(),this.store=e,this.loadedTextures=new Map,this.loadedMaterialsMap=new Map,this.defaultMaterial=new U({name:"defaultDatMaterial",color:0}),this.loadedMaterials=[this.defaultMaterial],this.dracoDecoderPath=null,this.workerPool=new kt(4),this.workerSourceURL="";const t=this._initWorkerCreator();this.workerPool.setWorkerCreator(t)}async parseAsync(e,t){const[n]=await Promise.allSettled([this._decodeBuffer(e,t),this._createMaterial(t)]);if("fulfilled"===n.status&&n.value){const e=li(t),i=this._createMesh(n.value,e),r=new dt;return r.add(i),r}}async _decodeBuffer(e,t){await this.store.ready();const n=await this.store.getItem(`${t}_object`);if(n)return n;const[{data:i}]=await Promise.all([this.workerPool.postMessage({type:"decode",data:e},[e])]);if(i){const{type:e,data:n}=null!=i?i:{};if("decode"===e&&n){const{buffer:{byteLength:e}}=n;return Di(e)&&e/1024/1024<=500&&(await this.store.ready(),wi((()=>{this.store.setItem(`${t}_object`,n)}))),n}}}_initWorkerCreator(){if(!this.workerSourceURL){const e=sd.toString(),t=od.toString(),n=ad.toString(),i=["/* dat decoder */",["/* pako */","\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pako = {}));\n}(this, (function (exports) { 'use strict';\n\n // Note: adler32 takes 12% for level 0 and 2% for level 6.\n // It isn't worth it to make additional optimizations as in original.\n // Small size is preferable.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express ofr implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n };\n\n\n var adler32_1 = adler32;\n\n // Note: we can't get significant speed boost here.\n // So write code to minimize size - no pregenerated tables\n // and array tools dependencies.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // Use ordinary array, since untyped makes no boost here\n const makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n };\n\n // Create table on load. Just 255 signed longs. Not a problem.\n const crcTable = new Uint32Array(makeTable());\n\n\n const crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n };\n\n\n var crc32_1 = crc32;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // See state defs from inflate.js\n const BAD$1 = 30; /* got a data error -- remain here until reset */\n const TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\n\n /*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\n var inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n //#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n //#ifdef INFLATE_STRICT\n dmax = state.dmax;\n //#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n //#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const MAXBITS = 15;\n const ENOUGH_LENS$1 = 852;\n const ENOUGH_DISTS$1 = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const CODES$1 = 0;\n const LENS$1 = 1;\n const DISTS$1 = 2;\n\n const lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n ]);\n\n const lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n ]);\n\n const dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n ]);\n\n const dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n ]);\n\n const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n {\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n // let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS$1) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n };\n\n\n var inftrees = inflate_table;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var constants$1 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\n const CODES = 0;\n const LENS = 1;\n const DISTS = 2;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n } = constants$1;\n\n\n /* STATES ====================================================================*/\n /* ===========================================================================*/\n\n\n const HEAD = 1; /* i: waiting for magic header */\n const FLAGS = 2; /* i: waiting for method and flags (gzip) */\n const TIME = 3; /* i: waiting for modification time (gzip) */\n const OS = 4; /* i: waiting for extra flags and operating system (gzip) */\n const EXLEN = 5; /* i: waiting for extra length (gzip) */\n const EXTRA = 6; /* i: waiting for extra bytes (gzip) */\n const NAME = 7; /* i: waiting for end of file name (gzip) */\n const COMMENT = 8; /* i: waiting for end of comment (gzip) */\n const HCRC = 9; /* i: waiting for header crc (gzip) */\n const DICTID = 10; /* i: waiting for dictionary check value */\n const DICT = 11; /* waiting for inflateSetDictionary() call */\n const TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n const TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\n const STORED = 14; /* i: waiting for stored size (length and complement) */\n const COPY_ = 15; /* i/o: same as COPY below, but only first time in */\n const COPY = 16; /* i/o: waiting for input or output to copy stored block */\n const TABLE = 17; /* i: waiting for dynamic block table lengths */\n const LENLENS = 18; /* i: waiting for code length code lengths */\n const CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\n const LEN_ = 20; /* i: same as LEN below, but only first time in */\n const LEN = 21; /* i: waiting for length/lit/eob code */\n const LENEXT = 22; /* i: waiting for length extra bits */\n const DIST = 23; /* i: waiting for distance code */\n const DISTEXT = 24; /* i: waiting for distance extra bits */\n const MATCH = 25; /* o: waiting for output space to copy string */\n const LIT = 26; /* o: waiting for output space to write literal */\n const CHECK = 27; /* i: waiting for 32-bit check value */\n const LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\n const DONE = 29; /* finished check, done -- remain here until reset */\n const BAD = 30; /* got a data error -- remain here until reset */\n const MEM = 31; /* got an inflate() memory error -- remain here until reset */\n const SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n /* ===========================================================================*/\n\n\n\n const ENOUGH_LENS = 852;\n const ENOUGH_DISTS = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const MAX_WBITS = 15;\n /* 32K LZ77 window */\n const DEF_WBITS = MAX_WBITS;\n\n\n const zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n };\n\n\n function InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n }\n\n\n const inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\"));\n return Z_OK$1;\n };\n\n\n const inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n };\n\n\n const inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n };\n\n\n const inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n };\n\n\n const inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n };\n\n\n /*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\n let virgin = true;\n\n let lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\n const fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n };\n\n\n /*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\n const updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n };\n\n\n const inflate$1 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n };\n\n\n const inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n };\n\n\n const inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n };\n\n\n const inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\"));\n return Z_OK$1;\n };\n\n\n var inflateReset_1 = inflateReset;\n var inflateReset2_1 = inflateReset2;\n var inflateResetKeep_1 = inflateResetKeep;\n var inflateInit_1 = inflateInit;\n var inflateInit2_1 = inflateInit2;\n var inflate_2$1 = inflate$1;\n var inflateEnd_1 = inflateEnd;\n var inflateGetHeader_1 = inflateGetHeader;\n var inflateSetDictionary_1 = inflateSetDictionary;\n var inflateInfo = 'pako inflate (from Nodeca project)';\n\n /* Not implemented\n module.exports.inflateCopy = inflateCopy;\n module.exports.inflateGetDictionary = inflateGetDictionary;\n module.exports.inflateMark = inflateMark;\n module.exports.inflatePrime = inflatePrime;\n module.exports.inflateSync = inflateSync;\n module.exports.inflateSyncPoint = inflateSyncPoint;\n module.exports.inflateUndermine = inflateUndermine;\n */\n\n var inflate_1$1 = {\n \tinflateReset: inflateReset_1,\n \tinflateReset2: inflateReset2_1,\n \tinflateResetKeep: inflateResetKeep_1,\n \tinflateInit: inflateInit_1,\n \tinflateInit2: inflateInit2_1,\n \tinflate: inflate_2$1,\n \tinflateEnd: inflateEnd_1,\n \tinflateGetHeader: inflateGetHeader_1,\n \tinflateSetDictionary: inflateSetDictionary_1,\n \tinflateInfo: inflateInfo\n };\n\n const _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n };\n\n var assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n };\n\n\n // Join array of chunks to single array.\n var flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n };\n\n var common = {\n \tassign: assign,\n \tflattenChunks: flattenChunks\n };\n\n // String encode/decode helpers\n\n\n // Quick check if we can use fast array to bin string conversion\n //\n // - apply(Array) can fail on Android 2.2\n // - apply(Uint8Array) can fail on iOS 5.1 Safari\n //\n let STR_APPLY_UIA_OK = true;\n\n try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n const _utf8len = new Uint8Array(256);\n for (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n }\n _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n // convert string to array (typed, when possible)\n var string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n };\n\n // Helper\n const buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n };\n\n\n // convert array to string\n var buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n };\n\n\n // Calculate max possible position in utf8 buffer,\n // that will not break sequence. If that's not possible\n // - (very small limits) return max size as is.\n //\n // buf[] - utf8 bytes array\n // max - length limit (mandatory);\n var utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n };\n\n var strings = {\n \tstring2buf: string2buf,\n \tbuf2string: buf2string,\n \tutf8border: utf8border\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n }\n\n var zstream = ZStream;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n }\n\n var gzheader = GZheader;\n\n const toString = Object.prototype.toString;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n } = constants$1;\n\n /* ===========================================================================*/\n\n\n /**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n /* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n /**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n /**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n /**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n /**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\n function Inflate(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$1.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$1.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$1.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n Inflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$1.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$1.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$1.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$1.inflateReset(strm);\n status = inflate_1$1.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$1.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n };\n\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n Inflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n };\n\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n Inflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n };\n\n\n /**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\n function inflate(input, options) {\n const inflator = new Inflate(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n }\n\n\n /**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\n function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n }\n\n\n /**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\n var Inflate_1 = Inflate;\n var inflate_2 = inflate;\n var inflateRaw_1 = inflateRaw;\n var ungzip = inflate;\n var constants = constants$1;\n\n var inflate_1 = {\n \tInflate: Inflate_1,\n \tinflate: inflate_2,\n \tinflateRaw: inflateRaw_1,\n \tungzip: ungzip,\n \tconstants: constants\n };\n\n exports.Inflate = Inflate_1;\n exports.constants = constants;\n exports['default'] = inflate_1;\n exports.inflate = inflate_2;\n exports.inflateRaw = inflateRaw_1;\n exports.ungzip = ungzip;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n","/* noCompress */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}")),"/* gzipCompress */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}")),"/* parseChunk */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),"","/* worker */",ld].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}return()=>new Worker(this.workerSourceURL)}_createMesh(e,t){const{buffer:n,position:i,normal:r,texcoord:s,indice:o,sub_mesh:a}=e,l=new Uint32Array(n,o.byteOffset,o.length),c=new Float32Array(n,i.byteOffset,i.length),u=new Int8Array(n,r.byteOffset,r.length),h=new Float32Array(n,s.byteOffset,s.length),d=new p;d.setIndex(new f(l,1)),d.setAttribute("position",new f(c,3)),d.setAttribute("normal",new f(u,3,!0)),d.setAttribute("uv",new f(h,2));for(let e=0;e<a.length;e++){const{uuid:n,start:i,count:r}=a[e],s=this.loadedMaterialsMap.get(n);if(s){const{materialIndex:e}=s;d.addGroup(i,r,e)}else d.addGroup(i,r,0),Zn(`sbmx material: not found uuid: ${n} in file: ${t+cd}`)}const g=new k(d,this.loadedMaterials);return g.castShadow=!0,g.receiveShadow=!0,g}async _createMaterial(e){const t=li(e),n=t+cd,i=this.loadedTextures.get(n);if(i)return i;await this.store.ready();const r=await this.store.getItem(`${e}_texture`);let s;if(r)s=r,this.loadedTextures.set(n,Promise.resolve(s));else{const t=this.loadedTextures.get(n);if(t)return t;const i=fi(n).then((e=>e.json()));this.loadedTextures.set(n,i),s=await i,await this.store.ready(),wi((()=>{this.store.setItem(`${e}_texture`,s)}))}Object.entries(s).forEach((e=>{let[n,i]=e;if(this.loadedMaterialsMap.has(n))return;const{name:r,base_map:s,nor_map:o,alphamode:a,color:u={r:1,g:1,b:1,a:1},metallic:h=.5,roughness:d=.5}=i,{r:f,g:p,b:g,a:m}=u,v=0!==a,y=new U({name:r,color:new c(f,p,g),side:de,metalness:h,roughness:d,opacity:m,transparent:v,depthWrite:!v});if(s){const e=t+s;(new l).load(e,(e=>{e.flipY=!0,e.encoding=ye,e.wrapS=ne,e.wrapT=ne,e.minFilter=gt,e.magFilter=re,e.needsUpdate=!0,y.map=e,y.needsUpdate=!0,Qu.needsUpdate=!0}))}if(o){const e=t+o;(new l).load(e,(e=>{e.flipY=!0,e.encoding=ye,e.wrapS=ne,e.wrapT=ne,e.needsUpdate=!0,y.normalMap=e,y.needsUpdate=!0,Qu.needsUpdate=!0}))}const w=this.loadedMaterials.push(y)-1;this.loadedMaterialsMap.set(n,{material:y,materialIndex:w})}))}dispose(){this.workerPool.dispose(),URL.revokeObjectURL(this.workerSourceURL)}}const hd=new Map,dd=e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase().endsWith(".png"))&&void 0!==t&&t},fd=(e,t)=>{if(hd.has(t)){const n=hd.get(t);e.map=n,e.needsUpdate=!0,Qu.needsUpdate=!0}const n=new u;n.encoding=ye,n.wrapS=ne,n.wrapT=ne,n.flipY=!1,n.anisotropy=16,n.mipmaps=[],n.generateMipmaps=!0,(new mt).load(t,(i=>{n.image=i,n.needsUpdate=!0,hd.set(t,n),e.map=n,e.needsUpdate=!0,Qu.needsUpdate=!0}))},pd=(e,t,n)=>{const[i,r,s,o,a]=t,l=n||o<1;return new U({name:e,color:new c(i,r,s),opacity:o,transparent:l,depthWrite:!l,alphaTest:.01,side:a})};class gd extends DataView{constructor(e,t){super(e),this.isLE=!0,this.appKeys=t}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=new DataView(new Uint8Array(2).buffer);for(let n=0;n<2;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint16(0,this.isLE)}getSoonUint32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint32(0,this.isLE)}getSoonFloat32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getFloat32(0,this.isLE)}}const md=new TextDecoder;class vd{constructor(){this.materials=new Map,this.sbmInfo=null}parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;r+=8;const s=[],o=[],a=[];for(let e=0;e<32;e++)s.push(i.getUint8(r)),r+=1;const l=i.getUint8(r);r+=1;const c=i.getUint8(r);r+=1;for(let e=0;e<32;e++)o.push(i.getUint8(r)),r+=1;for(let e=0;e<64;e++)a.push(i.getUint8(r)),r+=1;const u=[...o,...a,...s],h=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&h.push(u[e]);if(64!==h.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===l){const e=i.buffer.slice(r,i.buffer.byteLength),t=new gd(e,h);return 1===c||2===c?this._parseV2(t,n):3===c?this._parseV3(t,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})key 错误!`)}_parseV2(e,n){let i=0;const r=performance.now();i+=66;const s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,u[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){let t="";for(let n=0;n<l;n++){const n=e.getSoonUint8(i);n>127?t=t+"%"+n.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(n),t=""):c+=String.fromCharCode(n),i+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=pd(t,e,dd(c));if(this.materials.set(t,i),u[t].materialInfo=e,c){const{url:e,isPlatform:n}=this.sbmInfo,r=this.getTextureUrl(e,c,n);u[t].textureUrl=r,fd(i,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i);i+=2;const l=e.getSoonUint16(i).toString();i+=2,d[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],u=[],g=[],m=[],v=e.getSoonUint16(i);if(i+=2,v>0)for(let n=0;n<v;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,c.push(n)}const y=e.getSoonUint16(i);if(i+=2,y>0)for(let n=0;n<y;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const w=e.getSoonUint16(i);if(i+=2,w>0)for(let t=0;t<w;t++){const t=new h;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,u.push(t)}const b=e.getSoonUint16(i);if(i+=2,b>0)for(let t=0;t<b;t++){const t=e.getSoonUint16(i);i+=2;const n=e.getSoonUint16(i);i+=2;const r=e.getSoonUint16(i);i+=2;const s=[t,n,r];g.push(s),u.length>0&&m.push([u[s[0]],u[s[1]],u[s[2]]])}const A=[],x=[];for(let e=0;e<g.length;e++){const t=g[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=m[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),T=new Float32Array(x);d[o].position=S.buffer,d[o].uv=T.buffer;const E=new p;S.length>0&&E.setAttribute("position",new f(S,3)),T.length>0&&E.setAttribute("uv",new f(T,2)),E.computeVertexNormals();const D=E.getAttribute("normal").array.buffer;if(d[o].normal=D,this.materials.has(l)){const e=new Ju({id:`${o}_${Oi()}`,name:o.toString()},E,this.materials.get(l));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}_parseV3(e,n){let i=0;i+=66;const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,u[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){let t="";for(let n=0;n<l;n++){const n=e.getSoonUint8(i);n>127?t=t+"%"+n.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(n),t=""):c+=String.fromCharCode(n),i+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=pd(t,e,dd(c));if(this.materials.set(t,i),u[t].materialInfo=e,c){const{url:e,isPlatform:n}=this.sbmInfo,r=this.getTextureUrl(e,c,n);u[t].textureUrl=r,fd(i,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i).toString();i+=2;const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){const t=[];for(let n=0;n<l;n++){const n=e.getSoonUint8(i);t.push(n),i+=1}const n=new Uint8Array(t);c=md.decode(n)}const u=e.getSoonUint16(i).toString();i+=2,d[o]={meshName:c,materialId:u,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const g=[],m=[],v=[],y=[],w=e.getSoonUint32(i);if(i+=4,w>0)for(let n=0;n<w;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,g.push(n)}const b=e.getSoonUint32(i);if(i+=4,b>0)for(let n=0;n<b;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const A=e.getSoonUint32(i);if(i+=4,A>0)for(let t=0;t<A;t++){const t=new h;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,m.push(t)}const x=e.getSoonUint32(i);if(i+=4,x>0)for(let t=0;t<x;t++){const t=e.getSoonUint32(i);i+=4;const n=e.getSoonUint32(i);i+=4;const r=e.getSoonUint32(i);i+=4;const s=[t,n,r];v.push(s),m.length>0&&y.push([m[s[0]],m[s[1]],m[s[2]]])}const S=[],T=[];for(let e=0;e<v.length;e++){const t=v[e],n=g[t[0]],i=g[t[1]],r=g[t[2]];S.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=y[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),T.push(...s.toArray(),...o.toArray(),...a.toArray())}const E=new Float32Array(S),D=new Float32Array(T);d[o].position=E.buffer,d[o].uv=D.buffer;const C=new p;E.length>0&&C.setAttribute("position",new f(E,3)),D.length>0&&C.setAttribute("uv",new f(D,2)),C.computeVertexNormals();const I=C.getAttribute("normal").array.buffer;if(d[o].normal=I,this.materials.has(u)){const e=new Ju({id:`${o}_${Oi()}`,name:c},C,this.materials.get(u));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}}const yd=new TextDecoder;class wd{constructor(){this.materials=new Map,this.sbmInfo=null,this.isLE=!0}parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;r+=8;const s=i.getUint8(r);return r+=1,1===s||2===s?this._parseV2(i,r,n):3===s?this._parseV3(i,r,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}_parseV2(e,n,i){const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getUint16(n,this.isLE);n+=2;const c=e.getUint16(n,this.isLE);n+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getUint16(n,this.isLE).toString();n+=2,u[t]={materialInfo:[]},e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;const i=e.getFloat32(n,this.isLE);n+=4;const r=e.getFloat32(n,this.isLE);n+=4;const s=e.getFloat32(n,this.isLE);n+=4;const o=e.getFloat32(n,this.isLE);n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;let a=e.getUint8(n);n+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){let t="";for(let i=0;i<l;i++){const i=e.getUint8(n);i>127?t=t+"%"+i.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(i),t=""):c+=String.fromCharCode(i),n+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[i,r,s,o,a],n=pd(t,e,dd(c));if(this.materials.set(t,n),u[t].materialInfo=e,c){const{url:e,isPlatform:i}=this.sbmInfo,r=this.getTextureUrl(e,c,i);u[t].textureUrl=r,fd(n,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getUint16(n,this.isLE).toString();n+=2;const l=e.getUint16(n,this.isLE).toString();n+=2,d[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],u=[],g=[],m=[],v=e.getUint16(n,this.isLE);if(n+=2,v>0)for(let i=0;i<v;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4,c.push(i)}const y=e.getUint16(n,this.isLE);if(n+=2,y>0)for(let e=0;e<y;e++)n+=4,n+=4,n+=4;const w=e.getUint16(n,this.isLE);if(n+=2,w>0)for(let t=0;t<w;t++){const t=new h;t.setX(e.getFloat32(n,this.isLE)),n+=4,t.setY(e.getFloat32(n,this.isLE)),n+=4,u.push(t)}const b=e.getUint16(n,this.isLE);if(n+=2,b>0)for(let t=0;t<b;t++){const t=e.getUint16(n,this.isLE);n+=2;const i=e.getUint16(n,this.isLE);n+=2;const r=e.getUint16(n,this.isLE);n+=2;const s=[t,i,r];g.push(s),u.length>0&&m.push([u[s[0]],u[s[1]],u[s[2]]])}const A=[],x=[];for(let e=0;e<g.length;e++){const t=g[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=m[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),T=new Float32Array(x);d[o].position=S.buffer,d[o].uv=T.buffer;const E=new p;S.length>0&&E.setAttribute("position",new f(S,3)),T.length>0&&E.setAttribute("uv",new f(T,2)),E.computeVertexNormals();const D=E.getAttribute("normal").array.buffer;if(d[o].normal=D,this.materials.has(l)){const e=new Ju({id:`${o}_${Oi()}`,name:o},E,this.materials.get(l));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==i||i(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}_parseV3(e,n,i){const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new rh(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new th({id:Oi()});o.add(a);const l=e.getUint16(n,this.isLE);n+=2;const c=e.getUint16(n,this.isLE);n+=2,s.total=c;const u={};for(let t=0;t<l;++t){const t=e.getUint16(n,this.isLE).toString();n+=2,u[t]={materialInfo:[]},e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;const i=e.getFloat32(n,this.isLE);n+=4;const r=e.getFloat32(n,this.isLE);n+=4;const s=e.getFloat32(n,this.isLE);n+=4;const o=e.getFloat32(n,this.isLE);n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4,e.getFloat32(n,this.isLE),n+=4;let a=e.getUint8(n);n+=1,0===a?a=de:1===a?a=ue:2===a&&(a=he);const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){let t="";for(let i=0;i<l;i++){const i=e.getUint8(n);i>127?t=t+"%"+i.toString(16).toUpperCase():t.length>0?(c+=decodeURIComponent(t)+String.fromCharCode(i),t=""):c+=String.fromCharCode(i),n+=1}c=c.replace("\\","/")}if(!this.materials.has(t)){const e=[i,r,s,o,a],n=pd(t,e,dd(c));if(this.materials.set(t,n),u[t].materialInfo=e,c){const{url:e,isPlatform:i}=this.sbmInfo,r=this.getTextureUrl(e,c,i);u[t].textureUrl=r,fd(n,r)}}}const d={};for(let o=0;o<c;++o){const o=e.getUint16(n,this.isLE).toString();n+=2;const l=e.getUint16(n,this.isLE);n+=2;let c="";if(l>0){const t=new Uint8Array(e.buffer,n,l);c=yd.decode(t),n+=l}const u=e.getUint16(n,this.isLE).toString();n+=2,d[o]={meshName:c,materialId:u,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const g=[],m=[],v=[],y=[],w=e.getUint32(n,this.isLE);if(n+=4,w>0)for(let i=0;i<w;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4,g.push(i)}const b=e.getUint32(n,this.isLE);if(n+=4,b>0)for(let i=0;i<b;i++){const i=new t;i.setX(e.getFloat32(n,this.isLE)),n+=4,i.setY(e.getFloat32(n,this.isLE)),n+=4,i.setZ(e.getFloat32(n,this.isLE)),n+=4}const A=e.getUint32(n,this.isLE);if(n+=4,A>0)for(let t=0;t<A;t++){const t=new h;t.setX(e.getFloat32(n,this.isLE)),n+=4,t.setY(e.getFloat32(n,this.isLE)),n+=4,m.push(t)}const x=e.getUint32(n,this.isLE);if(n+=4,x>0)for(let t=0;t<x;t++){const t=e.getUint32(n,this.isLE);n+=4;const i=e.getUint32(n,this.isLE);n+=4;const r=e.getUint32(n,this.isLE);n+=4;const s=[t,i,r];v.push(s),m.length>0&&y.push([m[s[0]],m[s[1]],m[s[2]]])}const S=[],T=[];for(let e=0;e<v.length;e++){const t=v[e],n=g[t[0]],i=g[t[1]],r=g[t[2]];S.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new h,o=new h,a=new h;const l=y[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),T.push(...s.toArray(),...o.toArray(),...a.toArray())}const E=new Float32Array(S),D=new Float32Array(T);d[o].position=E.buffer,d[o].uv=D.buffer;const C=new p;E.length>0&&C.setAttribute("position",new f(E,3)),D.length>0&&C.setAttribute("uv",new f(D,2)),C.computeVertexNormals();const I=C.getAttribute("normal").array.buffer;if(d[o].normal=I,this.materials.has(u)){const e=new Ju({id:`${o}_${Oi()}`,name:c},C,this.materials.get(u));a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==i||i(s)}const g={materialsCache:u,meshsCache:d};return Promise.resolve({model:o,caches:g})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}}const bd=new TextDecoder;class Ad{parseBuffer(e,t){switch(bd.decode(e.slice(0,8))){case"SBK-----":return(new vd).parseBuffer(e,t);case"SBM-----":return(new wd).parseBuffer(e,t);default:return Promise.reject(`In soonspacejs: sbm 资源模型(${t.url})格式或数据错误!`)}}}class xd{constructor(){this.materials=new Map}parseObject(e,t){const n=new rh(Object.assign(Object.assign({},t),{format:"sbm"})),i=new th({id:Oi()});n.add(i);const{materialsCache:r,meshsCache:s}=e;for(const[e,t]of Object.entries(r)){if(this.materials.has(e))continue;const{textureUrl:n,materialInfo:i}=t,r=pd(e,i,dd(n));this.materials.set(e,r),n&&fd(r,n)}for(const[e,t]of Object.entries(s)){const{meshName:n,materialId:r,position:s,uv:o,normal:a}=t,l=this.materials.get(r.toString());if(l){const t=new p,r=new Float32Array(s),c=new Float32Array(o),u=a&&new Float32Array(a);r.length>0&&t.setAttribute("position",new f(r,3)),c.length>0&&t.setAttribute("uv",new f(c,2)),u&&u.length>0?t.setAttribute("normal",new f(u,3)):t.computeVertexNormals();const h=new Ju({id:`${e}_${Oi()}`,name:n||e},t,l);i.add(h)}}return n}}class Sd extends Rh{constructor(e,t){super(Fn,e,t),this.viewport=e,this.isDisposed=!1,this.modelsPromiseMap=new Map,this.modelsMap=new Map,this._dbReady=!1,this.store=Lh.createInstance({name:"soonspace",storeName:"modelData"}),this.cacheStore=Lh.createInstance({name:"soonspace",storeName:"modelCache"}),this.loadingManager=new ie,this.datLoader=new ud(this.cacheStore),this.gltfLoader=new Gt(this.loadingManager),this.fbxLoader=new Fh(this.loadingManager),this.dracoDecoderPath=null,this._initLoadingManager(this.loadingManager)}setDracoDecoderPath(e){this.dracoDecoderPath=e;const t=new Ht;t.setDecoderPath(e),this.gltfLoader.setDRACOLoader(t),this.datLoader.dracoDecoderPath=e}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;const{url:n}=e,i=this.modelsPromiseMap.get(n);if(i){if(await i,this.isDisposed)return this.dispose(),null;const r=this.modelsMap.get(n);return r?this.clone(r,e,t):null}const r=this._innerLoad(e,t);return this.modelsPromiseMap.set(n,r),r}async parse(e){var t;const{url:n,id:i}=e;if(!n)return Zn(`id: ${i} url: ${n} is empty`),null;switch(null===(t=Ri(n))||void 0===t?void 0:t.toLocaleUpperCase()){case"SBM":return this._parseSbm(e);case"SBMX":return this._parseSbmx(e);case"DAT":return this._parseDat(e);case"GLB":case"GLTF":return this._parseGltf(e);case"FBX":return this._parseFbx(e);default:return Zn(`模型资源( id: ${i}, url: ${n} )格式错误,当前格式支持 sbm、sbmx、fbx、gltf、glb !`),null}}clone(e,t,n){return new Promise(((i,r)=>{var s;"Model"!==e.stype&&r("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:a,level:l,visible:c,position:u,rotation:h,scale:d,onClick:f,onDblClick:p,onRightClick:g,onLoad:m,userData:v}=t;function y(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)y(e.children[i],t.children[i],n)}const w=function(e){const t=new Map,n=new Map,i=e.sClone();return y(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e instanceof E){const i=e,r=t.get(e),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i}(e);w.animations=w.animations.map((e=>e.clone())),o&&(w.sid=o),a&&(w.name=a),l&&(w.level=l),!1===c?w.hide():!0===c&&w.show(),u&&w.position.set(u.x,u.y,u.z),h&&w.rotation.set(h.x,h.y,h.z),d&&w.scale.set(d.x,d.y,d.z),w.onClick=f?f.bind(w):null,w.onDblClick=p?p.bind(w):null,w.onRightClick=g?g.bind(w):null,w.onLoad=m?m.bind(w):null,null===(s=w.onLoad)||void 0===s||s.call(w,w),v&&(w.userData=v),null!==n&&this.viewport.scener.addObject(w,n||this.scene||e.parent),i(w)}))}async loadToGroup(e,t){const n=this.createGroup(e,null);return await Promise.allSettled(t.map((e=>this.load(e,null).then((e=>e&&n.add(e))).catch(console.error)))),this.viewport.scener.addObject(n,this.scene),n}async addForGroup(e,t){return e&&await Promise.allSettled(t.map((async t=>this.load(t,null).then((t=>t&&this.viewport.scener.addObject(t,e))).catch(console.error)))),e}async clearIdb(){await this._checkDbReady(),await this.store.clear(),await this.cacheStore.clear()}dispose(){var e;this.isDisposed=!0,this.modelsPromiseMap.clear(),this.modelsMap.clear(),null===(e=this.gltfLoader.dracoLoader)||void 0===e||e.dispose(),this.datLoader.dispose()}async _checkDbReady(){this._dbReady||(await Promise.all([this.store.ready(),this.cacheStore.ready()]),this._dbReady=!0)}_initLoadingManager(e){e.addHandler(/\.tga$/i,new zt)}_setModelsMap(e,t){this.modelsMap.has(e)||this.modelsMap.set(e,t)}async _parseSbm(e){const{useIndexedDB:t}=this.viewport.options,{url:n}=e,i=async t=>{const i=await(new Ad).parseBuffer(t,e),{model:r,caches:s}=i;return await this._checkDbReady(),s&&wi((()=>{this.cacheStore.setItem(n,s)})),r},r=e=>{var t;null===(t=e.onLoad)||void 0===t||t.call(e,e)};if(t){await this._checkDbReady();const t=await this.cacheStore.getItem(n);if(t){const n=(new xd).parseObject(t,e);return r(n),n}{const e=await this.store.getItem(n)||await this._fetchBuffer(n),t=await i(e);return r(t),t}}{const e=await this._fetchBuffer(n),t=await i(e);return r(t),t}}async _parseSbmx(e){const{url:t}=e,n=await this._getBuffer(t),i=Pi(n,0,8),r=new DataView(n.slice(8));switch(i){case"SBMG----":for(let e=0;e<r.byteLength;e++){const t=r.getUint8(e),n=(t>>4&15)+(t<<4&240);r.setUint8(e,n)}return this._parseGltf(e,r.buffer);case"SBMD----":return this._parseDat(e,r.buffer);default:return this._parseGltf(e,n)}}async _parseDat(e,t){const{url:n}=e,i=t||await this._getBuffer(n),r=new rh(Object.assign(Object.assign({},e),{format:"dat"})),s=await this.datLoader.parseAsync(i,n);return s&&r.add(s),r}async _parseGltf(e,t){const{url:n}=e,i=li(n),r=t||await this._getBuffer(n),s=new rh(Object.assign(Object.assign({},e),{format:"gltf"})),o=await this.gltfLoader.parseAsync(r,i),{animations:a}=o;return a&&a.length>0&&(s.animations=a),o.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e instanceof vt&&(e.frustumCulled=!0),e.castShadow=!0,e.receiveShadow=!0})),s.add(o.scene),s}async _parseFbx(e){const{url:t}=e,n=li(t),i=await this._getBuffer(t),r=new rh(Object.assign(Object.assign({},e),{format:"fbx"})),s=this.fbxLoader.parse(i,n),{animations:o}=s;return o&&o.length>0&&(r.animations=o),r.add(s),r}async _innerLoad(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;var n;const{url:i}=e,r=await this.parse(e);return r?(null===(n=r.onLoad)||void 0===n||n.call(r,r),this._setModelsMap(i,r.sClone()),null!==t&&this.viewport.scener.addObject(r,t),r):null}async _fetchBuffer(e){const{useIndexedDB:t}=this.viewport.options,n=await fi(e),i=await n.arrayBuffer();return t&&(await this._checkDbReady(),this.store.setItem(e,i)),i}async _getBuffer(e){const{useIndexedDB:t}=this.viewport.options;if(t){const t=await this.store.getItem(e);return t||this._fetchBuffer(e)}return this._fetchBuffer(e)}}class Td extends Rh{constructor(e,t){super(zn,e,t),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new ah(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:i,type:r,name:s,level:o,visible:a,position:l,rotation:c,scale:u,onClick:h,onDblClick:d,onRightClick:f,userData:p}=t,g=e.sClone(!1,r);return this._copyMaterial(g),i&&(g.sid=i),s&&(g.name=s),o&&(g.level=o),Ei(a)&&(g.visible=a),l&&g.position.set(l.x,l.y,l.z),c&&g.rotation.set(c.x,c.y,c.z),u&&g.scale.set(u.x,u.y,u.z),g.onClick=h?h.bind(g):null,g.onDblClick=d?d.bind(g):null,g.onRightClick=f?f.bind(g):null,p&&(g.userData=p),null!==n&&this.viewport.scener.addObject(g,n||this.scene||e.parent),g}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this._createMaterial(e.url),i=new ah(t,e);n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=this._createMaterial(t.url),i=new ah(n,t);e.add(i)})),this.viewport.scener.addObject(e,this.scene)),e}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new l).load(e);t.flipY=!0;const n=new qe({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof k||e instanceof Ke)&&(Ci(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof be&&(e.material=e.material.clone()))}))}}class Ed extends Rh{constructor(e,t){super(Gn,e,t)}create(e){this._openEnableRenderCss(e);const t=new ih(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new ih(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{this._openEnableRenderCss(t);const n=new ih(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Dd extends Rh{constructor(e,t){super(Hn,e,t)}create(e){const t=new wh(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=new wh(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=new wh(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}}class Cd{constructor(){this.graph=new Map,this.queue=null,this.previous=new Map}setGraph(e){if(!(e.length<1))for(const t of e){const[e,n]=t;this.graph.set(e,new Map);for(const t of n){const[n,i]=t,r=this.graph.get(e);null==r||r.set(n,i)}}}getPath(e,t){var n;if(e===t)return[];const i=this.queue=new si;i.add(e,0),this.previous.set(e,null);let r=null;for(;r=i.shift();){if(r===t){const e=[];for(;null!==r&&null!==this.previous.get(r);)e.unshift(r),r=null!==(n=this.previous.get(r))&&void 0!==n?n:null;return e}const e=i.getDistance(r);if(e===1/0)return[];const s=this.graph.get(r);s&&s.forEach(((t,n)=>{const s=i.getDistance(n),o=e+t;o<s&&(i.update(n,o),this.previous.set(n,r))}))}return[]}}class Id extends Rh{constructor(e,t){super(Vn,e,t),this.dijkstra=new Cd}async createFromGml(e){const{url:t,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255}=e;return Ai(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const o=[],a=new Map;let l=[],c=[];const u=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Ci(u)?u.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...u.state],c=[...c,...u.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],i=e.State.topoNode["gml:Node"].node_name;o.push({id:Ti(n)?n:"",name:Ti(i)?i:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],r=e.Transition.topoEdge["gml:Edge"].passable["#text"],s=a.get(t),l=a.get(n),c=e.Transition._attributes["gml:id"],u=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==s&&void 0!==l&&("2"!==r&&"3"!==r&&o[s].graphs.push({targetNodeId:n,linkInfo:{id:c,name:u},enable:!0,restrict:parseInt(i),passable:parseInt(r)}),"1"!==r&&"3"!==r&&o[l].graphs.push({targetNodeId:t,linkInfo:{id:c,name:u},enable:!0,restrict:parseInt(i),passable:parseInt(r)}))}));const h=new ph(Object.assign(Object.assign({},e),{type:"network",nodes:o,linkWidth:n,renderLink:!0,linkColor:i,renderNode:r,nodeColor:s}));return this.setDijkstraGraph(h.nodes),this.viewport.scener.addObject(h,this.scene),Promise.resolve(h)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e),n=new ph(t);return this.setDijkstraGraph(n.nodes),this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e),i=new ph(t);this.setDijkstraGraph(i.nodes),n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&t.forEach((t=>{const n=this.generateLineTopologyInfoNodeGraphs(t),i=new ph(n);this.setDijkstraGraph(i.nodes),e.add(i)})),e}getShortestPath(e,n){const i=ci(e.info.nodes),r=Kn(n.start),s=Kn(n.end);let o=null,a=1/0,l=null,c=1/0;for(let n=0;n<i.length;n++){const u=i[n];if(0===u.graphs.length)continue;const h=e.nodes.find((e=>e.sid===u.id));if(!h)continue;const d=h.getWorldPosition(new t),f=d.distanceTo(r),p=d.distanceTo(s);f<a&&(a=f,o=u),p<c&&(c=p,l=u)}if(!o||!l||o.id===l.id)return null;const u=o.id,h=l.id,d=this.dijkstra.getPath(u,h);if(0===d.length)return null;d.unshift(o.id);const f=[];for(let e=0;e<d.length;e++){const t=i.find((t=>t.id==d[e]));t&&(t.id+=Oi(),t.position.y+=.01,f.push(t))}const p=Object.assign(Object.assign(Object.assign({},n),{type:"line",nodes:f}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(p);const g=new ph(p);return this.viewport.scener.addObject(g,this.scene),g}getShortestPathByMultipleStartPoints(e,i){const{nodes:s}=e.info,o=[];i.start.forEach((e=>{const t=Kn(e),n=Kn(i.end);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=Kn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?Kn(o.position).distanceTo(t):Kn(o.position).distanceTo(Kn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(Kn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new ph(s);return this.viewport.scener.addObject(o,this.scene),o}return null}getShortestPathByMultipleEndPoints(e,i){const{nodes:s}=e.info,o=[];i.end.forEach((e=>{const t=Kn(i.start),n=Kn(e);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=Kn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?Kn(o.position).distanceTo(t):Kn(o.position).distanceTo(Kn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(Kn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new ph(s);return this.viewport.scener.addObject(o,this.scene),o}return null}setDijkstraGraph(e){const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(0===r.graphs.length)continue;const s=[];for(let n=0;n<r.graphs.length;n++){const i=r.graphs[n],o=e.find((e=>e.sid===i.targetNodeId));if(!o)continue;const a=r.getWorldPosition(new t),l=o.getWorldPosition(new t);s.push([i.targetNodeId,a.distanceTo(l)])}n.push([r.sid,s])}n.length>0&&this.dijkstra.setGraph(n)}generateLineTopologyInfoNodeGraphs(e){const{type:t,nodes:n}=e;if("line"===t)for(let t=0;t<n.length;t++)if(t===n.length-1)n[t].graphs=[];else{const i=e.nodes[t],r=e.nodes[t+1];n[t].graphs=[{targetNodeId:r.id,linkInfo:{id:`${i.id}_to_${r.id}`,name:`${i.name||i.id}_to_${r.name||r.id}`},enable:!0,restrict:0,passable:0}]}return Object.assign(Object.assign({},e),{nodes:n})}}class Bd extends Rh{constructor(e,t){super(Wn,e,t)}addGridHelper(e){const{id:t,size:n=1e3,divisions:i=20,color:r="#fff",position:s={x:0,y:0,z:0},rotation:o={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new yt(n,i,r,r);return l.position.set(s.x,s.y,s.z),l.rotation.set(o.x,o.y,o.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,i=new wt(n);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addBoxHelper(e){const{id:t,box:n,color:i="#00ff00"}=e,r=new bt(n,new c(i));return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPlaneHelper(e){const{id:t,width:n=500,height:i=500,color:r="#00ff00",opacity:s=.2,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new Ju({id:t,position:o,rotation:a,scale:l},new Fe(n,i),new je({color:r,opacity:s,transparent:s<1,side:he}));return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:i=500,height:r=500,opacity:s=1,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:c={x:1,y:1,z:1},repeat:u={x:10,y:10}}=e,h=(new l).load(t),d=new Fe(i,r);d.computeBoundingBox();const f=new U({side:he,map:h,transparent:s<1,opacity:s,roughness:.8});f.map&&(f.map.repeat.set(u.x,u.x),f.map.wrapS=ne,f.map.wrapT=ne,f.map.version++),a.x-=Math.PI/2,f.version++;const p=new bh({id:n,position:o,rotation:a,scale:c},d,f);return p.userData.sid=n,p.userData.stype="Helper",this.viewport.scener.addObject(p,this.scene),p}addDirectionalLightHelper(e){const{id:t,light:n,color:i,size:r=50}=e,s=new At(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addHemisphereLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new xt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addSpotLightHelper(e){const{id:t,light:n,color:i}=e,r=new St(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPointLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new Tt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addRectAreaLightHelper(e){const{id:t,light:n,color:i}=e,r=new Yt(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}}class Md extends Rh{constructor(e,t){super(Yn,e,t)}createObject(e,t){const n=new nh(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){return e?(this.viewport.scener.addObject(t,e),e):null}}class Pd extends Rh{constructor(e,t){super(Un,e,t)}}class Od{constructor(e){this.viewport=e,this.cache={objects:new Map,classified:{Group:new Set,Light:new Set,Model:new Set,Poi:new Set,PoiNode:new Set,Canvas3D:new Set,Topology:new Set,Helper:new Set,PluginObject:new Set}},this.scene=e.scene,this.store={groupManager:new Pd(e,this.scene),lightManager:new _h(e,this.scene),modelManager:new Sd(e,this.scene),poiManager:new Td(e,this.scene),poiNodeManager:new Ed(e,this.scene),canvas3DManager:new Dd(e,this.scene),topologyManager:new Id(e,this.scene),helperManager:new Bd(e,this.scene),pluginObjectManager:new Md(e,this.scene)},e.postUpdate.set("ManagerRender",this.update.bind(this)),e.signals.objectAdded.add(this.setObjectCache.bind(this)),e.signals.objectRemoved.add(this.deleteObjectCache.bind(this))}levelUpdate(){const e=(e,t)=>{e.visible!==t&&(e.visible=t,e.matrixAutoUpdate=t,e.autoUpdate=!0)},t=t=>{const{level:n,handleHide:i,autoUpdate:r}=t,{max:s=null,min:o=null}=n;if(r)t.autoUpdate=!1,this.viewport.signals.objectChanged.dispatch();else if(!i&&(Di(s)||Di(o))){const n=this.viewport.camera.position.distanceTo(t.position);Di(s)&&n>s||Di(o)&&n<o?e(t,!1):e(t,!0)}};this.scene.traverse((e=>{(e instanceof eh||e instanceof Ju)&&t(e)}))}update(){if(0===this.scene.children.length)return;const e=performance.now();this.viewport.options.levelEnabled&&this.levelUpdate(),this.viewport.signals.loadRendered.dispatch(performance.now()-e)}isObjectInScene(e){let t=!1;return e.traverseAncestors((e=>{e===this.scene&&(t=!0)})),t}getObjectById(e){const t=this.getObjectCache(e);if(t){if(this.isObjectInScene(t))return t}return null}getObjectByName(e){return this._getObjectByProps("name",e)}getObjectByUserDataProperty(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&Ii(i)&&(i instanceof eh||i instanceof Ju||i.userData.stype)&&(Bi(e)&&e(i.userData)||Ti(e)&&i.userData[e]===t)&&n.push(i)})),n}removeObjectById(e){const t=this.getObjectById(e);return!!t&&(this.viewport.scener.removeObject(t),!0)}_getObjectByProps(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&((i instanceof eh||i instanceof Ju)&&Ii(i)&&i[e]===t||Ii(i)&&i.userData.stype&&("name"===e&&i.name===t||"sid"===e&&i.userData.sid===t))&&n.push(i)})),n}getObjectCache(e){return this.cache.objects.get(e)}setObjectCache(e){const t=(e,t)=>{const n=this.cache.objects.get(t);n&&n!==e&&Zn(`object id ${t} already exists in scene`)};null==e||e.traverse((n=>{if(n instanceof eh||n instanceof Ju){if("string"==typeof n.sid&&n.sid.startsWith(Nn))return;t(n,n.sid),this.cache.objects.set(n.sid,n);const e=n.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}else if(n.userData.sid&&e.userData.stype){t(n,n.userData.sid),this.cache.objects.set(n.userData.sid,n);const e=n.userData.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}}))}deleteObjectCache(e){null==e||e.traverse((t=>{if(t instanceof eh||t instanceof Ju){this.cache.objects.delete(t.sid);const e=t.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}else if(t.userData.sid&&e.userData.stype){this.cache.objects.delete(t.userData.sid);const e=t.userData.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}}))}clearObject(){this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.lightManager.clear()}dispose(){this.store.modelManager.dispose(),this.cache.objects.clear(),this.clear()}}function Rd(e){const t=_d(e),n=new d;n.setFromMatrix3(t);const i=e[0],r=n.clone();r.setPosition(i);const s=r.clone().invert(),o=e.map((e=>{const t=e.clone().applyMatrix4(s);return new h(t.x,t.y)})),a=new tt(o),l=new et(a),c=new Et;c.setFromPoints(o);const u=kd(c);return l.getAttribute("uv").applyMatrix3(u),l.applyMatrix4(n),{geometry:l,polygonBox:c,modelMatrix:n,planeMatrix:r,projectionMatrix:s,position:i}}function _d(e){const[n,i,r]=e,s=new Dt;s.setFromCoplanarPoints(i,n,r);const o=s.normal,a=o.clone().cross(new t(0,0,1));a.equals(new t)&&a.set(1,0,0);const l=o.clone().cross(a);a.normalize(),l.normalize(),o.normalize();const c=new Be;return c.elements=[a.x,a.y,a.z,l.x,l.y,l.z,o.x,o.y,o.z],c}function kd(e){const t=e.min,n=e.getSize(new h),i=new Be;return i.elements=[n.x,0,0,0,n.y,0,t.x,t.y,1],i.invert()}function Ld(e,t){const n=Jn(t);return e.intersectsBox(n)}function Nd(e,t,n){if("string"==typeof e){let i=t?null==n?void 0:n.get(e):null;if(!i){i=(new l).load(e),null==n||n.set(e,i)}return i}return e instanceof HTMLImageElement?new u(e):e instanceof HTMLCanvasElement?new Ct(e):new Oe(e)}function Ud(e,t,n,i){const r=e.map,s=Nd(t,n,i);if(!r)return e.map=s,s;const o=s.source;return s.copy(r),s.source=o,e.map=s,s}function jd(e,n){const{top:r,left:s,bottom:o,right:a,front:l,back:c}=e,u=new t(a,r,l),h=new t(s,o,c),d=new i;return function(e){return d.max.addVectors(e,u),d.min.subVectors(e,h),n.filter((e=>Ld(d,e)))}}function Fd(e,n){const i=new H(new t,e);return function(e){return i.center.copy(e),n.filter((e=>Ld(i,e)))}}function zd(e,n){const i=e.length-1,r=[];for(let t=0;t<i;t++){const n=e[t],i=e[t+1],s=new y(n,i);r.push(s)}const s=new H(new t,n);return function(e){return e.filter((e=>{const n=Jn(e),i=new t;n.getCenter(i);const o=r.filter((e=>{const t=e.closestPointToPointParameter(i);return 0<=t||t>=1}));if(0===o.length)return!1;let a=1/0,l=i;for(const e of o){const n=e.closestPointToPoint(i,!0,new t),r=i.distanceToSquared(n);r<a&&(a=r,l=n)}return s.center.copy(l),s.intersectsBox(n)}))}}function Gd(e,t){const{image:n,color:i,width:r,height:s,position:o,rotation:a,needLight:l,id:c,name:u,userData:h,level:d,visible:f,cache:p}=e,g=es(e,["image","color","width","height","position","rotation","needLight","id","name","userData","level","visible","cache"]),m=new Fe(r,s),v=n?Object.assign(Object.assign({transparent:!0},g),{map:Nd(n,null==p||p,t)}):g,y=l?new It(v):new je(v),w=new Ju({id:c,name:u,userData:h,level:d,visible:f},m,y);return o&&w.position.set(o.x,o.y,o.z),a&&w.rotation.set(a.x,a.y,a.z),w}function Hd(e,n){const{points:i,image:r,color:s,needLight:o,id:a,name:l,userData:c,level:u,visible:h,cache:d}=e,f=es(e,["points","image","color","needLight","id","name","userData","level","visible","cache"]),p=i.map((e=>new t(e.x,e.y,e.z))),g=r?Object.assign(Object.assign({transparent:!0},f),{map:Nd(r,null==d||d,n)}):f,m=o?new It(g):new je(g),{geometry:v,position:y}=Rd(p),w=new Ju({id:a,name:l,userData:c,level:u,visible:h},v,m);return w.position.copy(y),w}p.prototype.computeBoundsTree=Nt,p.prototype.disposeBoundsTree=Ut,k.prototype.raycast=jt,Ge.prototype.firstHitOnly=!0,e.ColorManagement.enabled=!0;class Vd{constructor(t){this.THREE=e,this.TWEEN=Ln,this.utils=_i,this.version=Xt,this.animation=Li,this.library=Ah,this.plugins={},this.azimuth=new Mh,this.textureCache=new Map;const{el:n,options:i={},events:r={}}=t;if(this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showStats:!1,showViewHelper:!1,showGrid:!1,background:{color:11459572,alpha:!1},fog:!1,controls:{type:"free"},hoverEnabled:!1,levelEnabled:!1,closeInfoLog:!1,closeWarnLog:!1,useIndexedDB:!0,logarithmicDepthBuffer:!0}),i),this.viewport=new qu(this.options),this.signals=this.viewport.signals,this.manager=new Od(this.viewport),!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(r),this._initDefaultSettings()}_init(){const{showGrid:e,background:t,fog:n,controls:i,closeInfoLog:r,closeWarnLog:s,useIndexedDB:o}=this.options;if(!r){Xn(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),Xn(Qt,{color:"#3eaf7c","font-size":"24px"}),Xn(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),Xn("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),Xn("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),Xn("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}e&&this.addGridHelper(!0===e?{id:"defaultGridHelper"}:e),(null==t?void 0:t.skyBox)?Ti(null==t?void 0:t.skyBox)?this.setSphereSkyBackground(null==t?void 0:t.skyBox):Ii(null==t?void 0:t.skyBox)&&this.setSkyBackground(t.skyBox.dirPath,t.skyBox.fileNames):(null==t?void 0:t.img)?this.setBackgroundImage(t.img):(null==t?void 0:t.color)&&this.setBackgroundColor(t.color),n&&this.openSceneFog(!0===n?void 0:n),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),o&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:i,modelRightClick:r,modelDblClick:s,poiHover:o,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:u,selectPosition:h,sceneClick:d,resize:f}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),i&&this.signals.modelClick.add(i),r&&this.signals.modelRightClick.add(r),s&&this.signals.modelDblClick.add(s),o&&this.signals.poiHover.add(o),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),u&&this.signals.poiDblClick.add(u),h&&this.signals.selectPosition.add(h),d&&this.signals.sceneClick.add(d),f&&this.signals.windowResize.add(f),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultSettings(){this.setEnvironment(),this.setColorSpace("sRGB"),this.setToneMapping({type:"ACESFilmic",exposure:.8})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){const n=this.getObjectById(e);return this.manager.store.pluginObjectManager.addToObject(n,t)}getPluginObjectById(e){return Zn("getPluginObjectById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPluginObjectByName(e){return Zn("getPluginObjectByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}removePluginObjectById(e){return Zn("removePluginObjectById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}setSSR(e){this.viewport.setSSR(e)}setBloom(e){this.viewport.setBloom(e)}setSSAO(e){this.viewport.setSSAO(e)}setColorSpace(e){this.viewport.setColorSpace(e)}setToneMapping(e){this.viewport.setToneMapping(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundColorAlpha(e,t){this.viewport.setBackgroundColorAlpha(e,t)}setBackgroundImage(e){return this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){return this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){return this.viewport.setSkyBackground(e,t)}setEnvironment(e){return this.viewport.setEnvironment(e)}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){this.manager.dispose(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}getCameraTargetView(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraTargetView(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return"orbit"===this.viewport.controls.options.type&&this.utils.warn("flyTo 方法不适用于 orbit 控制器"),this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frontTop",t=arguments.length>1?arguments[1]:void 0;return this.flyToObj(this.manager.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}setSky(e){return this.viewport.setSky(e)}getScreenshot(){return this.screenshot()}screenshot(){return this.viewport.screenshot()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.lightManager.createAmbientLight(e)}setAmbientLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setAmbientLight(t,e)}createDirectionalLight(e){return this.manager.store.lightManager.createDirectionalLight(e)}setDirectionalLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setDirectionalLight(t,e)}createHemisphereLight(e){return this.manager.store.lightManager.createHemisphereLight(e)}setHemisphereLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setHemisphereLight(t,e)}createSpotLight(e){return this.manager.store.lightManager.createSpotLight(e)}setSpotLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setSpotLight(t,e)}createPointLight(e){return this.manager.store.lightManager.createPointLight(e)}setPointLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setPointLight(t,e)}createRectAreaLight(e){return this.manager.store.lightManager.createRectAreaLight(e)}setRectAreaLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setRectAreaLight(t,e)}getLightById(e){return Zn("getLightById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeLightById(e){return Zn("removeLightById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}getAllLight(){return this.manager.store.lightManager.getAll()}clearLight(){return this.manager.store.lightManager.clear()}showAllLight(){return this.manager.store.lightManager.showAll()}hideAllLight(){return this.manager.store.lightManager.hideAll()}updateAllShadow(){return this.manager.store.lightManager.updateAllShadow()}getObjectById(e){return this.manager.getObjectById(e)}getObjectByName(e){return this.manager.getObjectByName(e)}getObjectByUserDataProperty(e,t){return this.manager.getObjectByUserDataProperty(e,t)}removeObjectById(e){return this.manager.removeObjectById(e)}createGroup(e){return this.manager.store.groupManager.createGroup(e)}getGroupById(e){return Zn("getGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getGroupByName(e){return Zn("getGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllGroup(){return this.manager.store.groupManager.getAll()}showAllGroup(){return this.manager.store.groupManager.showAll()}hideAllGroup(){return this.manager.store.groupManager.hideAll()}removeGroupById(e){return Zn("removeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}loadSbm(e){return Zn("loadSbm is deprecated, use loadModel instead"),this.loadModel(e)}parseSbm(){Zn("parseSbm is deprecated!")}cloneSbm(e,t,n){return Zn("cloneSbm is deprecated, use cloneModel instead"),this.cloneModel(e,t,n)}getSbmById(e){return Zn("getSbmById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmByName(e){return Zn("getSbmByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getSbmByUserDataProperty(e,t){return Zn("getSbmByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeSbmById(e){return Zn("removeSbmById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForSbm(e){return Zn("createGroupForSbm is deprecated, use createGroup instead"),this.createGroup(e)}loadSbmToGroup(e,t){return Zn("loadSbmToGroup is deprecated, use loadModelToGroup instead"),this.loadModelToGroup(e,t)}addSbmForGroup(e,t){return Zn("addSbmForGroup is deprecated, use addModelForGroup instead"),this.addModelForGroup(e,t)}createSbmGroupFromXml(){Zn("createGroupForSbm is deprecated!")}getSbmGroupById(e){return Zn("getSbmGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmGroupByName(e){return Zn("getSbmGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllSbmGroup(){return Zn("getAllSbmGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeSbmGroupById(e){return Zn("removeSbmGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearSbm(){return Zn("clearSbm is deprecated, use clearModel instead"),this.clearModel()}getAllSbm(){return Zn("getAllSbm is deprecated, use getAllModel instead"),this.getAllModel()}showAllSbm(){return Zn("showAllSbm is deprecated, use showAllModel instead"),this.showAllModel()}hideAllSbm(){return Zn("hideAllSbm is deprecated, use hideAllModel instead"),this.hideAllModel()}getSbmModelMaps(){return Zn("getSbmModelMaps is deprecated, use getModelsMap instead"),this.getModelsMap()}setSbmModelMaps(e){return Zn("setSbmModelMaps is deprecated, use setModelsMap instead"),this.setModelsMap(e)}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return Zn("getModelById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelByName(e){return Zn("getModelByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getModelByUserDataProperty(e,t){return Zn("getModelByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeModelById(e){return Zn("removeModelById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForModel(e){return Zn("createGroupForModel is deprecated, use createGroup instead"),this.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.modelManager.addForGroup(n,t)}getModelGroupById(e){return Zn("getModelGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelGroupByName(e){return Zn("getModelGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllModelGroup(){return Zn("getAllModelGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeModelGroupById(e){return Zn("removeModelGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}computeModelsBoundsTree(e){return this.viewport.bvh.computeModelsBoundsTree(e)}clearIdb(){return this.manager.store.modelManager.clearIdb()}getModelsMap(){return this.manager.store.modelManager.modelsMap}setModelsMap(e){this.manager.store.modelManager.modelsMap=e}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return Zn("getPoiById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiByName(e){return Zn("getPoiByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiByUserDataProperty(e,t){return Zn("getPoiByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiById(e){return Zn("removePoiById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoi(e){return Zn("createGroupForPoi is deprecated, use createGroup instead"),this.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiManager.addForGroup(n,t)}getPoiGroupById(e){return Zn("getPoiGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiGroupByName(e){return Zn("getPoiGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiGroup(){return Zn("getAllPoiGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiGroupById(e){return Zn("removePoiGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return Zn("getPoiNodeById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeByName(e){return Zn("getPoiNodeByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiNodeByUserDataProperty(e,t){return Zn("getPoiNodeByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiNodeById(e){return Zn("removePoiNodeById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoiNode(e){return Zn("createGroupForPoiNode is deprecated, use createGroup instead"),this.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiNodeManager.addForGroup(n,t)}getPoiNodeGroupById(e){return Zn("getPoiNodeGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeGroupByName(e){return Zn("getPoiNodeGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiNodeGroup(){return Zn("getAllPoiNodeGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiNodeGroupById(e){return Zn("removePoiNodeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createPoiMesh(e){const t=Gd(e,this.textureCache);return this.addObject(t),t}createPolygonPoiMesh(e){const t=Hd(e,this.textureCache);return this.addObject(t),t}setTexture(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{cache:i=!0,independ:r=!0}=n||{};let s=e.material;if(r&&(s=s.clone(),e.material=s),null===t)return s.map=null,this.render(),null;const o=Ud(s,t,i,this.textureCache);return this.render(),o}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return Zn("getCanvas3DById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DByName(e){return Zn("getCanvas3DByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getCanvas3DByUserDataProperty(e,t){return Zn("getCanvas3DByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeCanvas3DById(e){return Zn("removeCanvas3DById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForCanvas3D(e){return Zn("createGroupForCanvas3D is deprecated, use createGroup instead"),this.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.canvas3DManager.addForGroup(n,t)}getCanvas3DGroupById(e){return Zn("getCanvas3DGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DGroupByName(e){return Zn("getCanvas3DGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllCanvas3DGroup(){return Zn("getAllCanvas3DGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeCanvas3DGroupById(e){return Zn("removeCanvas3DGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return Zn("getTopologyById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyByName(e){return Zn("getTopologyByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getTopologyByUserDataProperty(e,t){return Zn("getTopologyByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeTopologyById(e){return Zn("removeTopologyById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForTopology(e){return Zn("createGroupForTopology is deprecated, use createGroup instead"),this.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.topologyManager.addForGroup(n,t)}getTopologyGroupById(e){return Zn("getTopologyGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyGroupByName(e){return Zn("getTopologyGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllTopologyGroup(){return Zn("getAllTopologyGroup is deprecated, use getAllGroups instead"),this.getAllGroup()}removeTopologyGroupById(e){return Zn("removeTopologyGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return Zn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}addRectAreaLightHelper(e){return this.manager.store.helperManager.addRectAreaLightHelper(e)}getHelperById(e){return Zn("getHelperById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeHelperById(e){return Zn("removeHelperById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}createFindObjectsInBoxNearPosition(e,t){return jd(e,t)}createFindObjectsInSphereNearPosition(e,t){return Fd(e,t)}createFindObjectsNearPath(e,t){return zd(e,t)}createPathAnimation(e,t,n){return new Ni(e,t,n)}createTopologyAnimation(e,n,i){const r=n.nodes.map((e=>e.getWorldPosition(new t)));return new Ni(e,r,i)}createPathAnimationAction(e,t,n){return Oh(e,t,this,n)}createPathAnimationActionForCamera(e,n){var i;return function(e,n,i,r){let{eyeHeight:s,anchor:o,front:a,enableUp:l}=null!=r?r:{};return s=null!=s?s:100,l=null!=l&&l,o=null!=o?o:new t(0,-s,0),a=null!=a?a:new t(0,0,l?1:-1),Oh(e,n,i,Object.assign(Object.assign({},r),{anchor:o,front:a,enableUp:l}))}(null!==(i=null==n?void 0:n.camera)&&void 0!==i?i:this.viewport.camera,e,this,n)}createBonePathAnimation(e,t,n){return function(e,t,n,i){const r=i?Eh(i,!1):null,s=Ph(t),o=Mr(Object.assign(Object.assign(Object.assign({},r),s),{target:e})),{model:a,clip:l}=o,c=n.playModelAnimation(a,l);return Object.assign(Object.assign({},o),{action:c})}(e,t,this,n)}createChainSkeletalModel(e,t){return function(e,t){const n=gr(Object.assign(Object.assign({},t),{target:e})),{model:i,skeleton:r}=n;return{skeletalModel:i,skeleton:r}}(e,t)}createPathAnimationForBones(e,t,n){const i=function(e,t,n,i){const r=Pr(Object.assign(Object.assign({},i),{target:e,skeleton:t}));return n.playModelAnimation(t,r)}(e,t,this,n);return i}}Vd.THREE=e,Vd.TWEEN=Ln,Vd.utils=_i;export{Gr as AnimationActionController,jr as AnimationActionKeyframe,Fr as AnimationActionOperate,Ur as AnimationClipKeyframe,$i as DirectionSide,Vr as GuiAnimationActionController,Vd as SoonSpace,Ld as boundingIsIntersected,cr as configVertexWeightByEquallyDivided,hr as configVertexWeightForChainBones,ur as configVertexWeightForEqualChainBones,zr as createAnimationOperate,Mr as createBonePathAnimation,sr as createChainBones,or as createChainBonesByAxials,ar as createChainBonesByJoints,gr as createChainSkeletalModel,dr as createChainSkinnedMesh,fr as createChainSkinnedMeshForMesh,br as createCurveAnimationClip,Ar as createCurveAnimationClipByCurve,Cr as createCurveAnimationClipByPolyline,Pr as createCurveAnimationClipForBones,_r as createCurveAnimationClipForBonesTarget,Vi as createCurveBufferGeometry,lr as createEqualChainBones,jd as createFindObjectsInBoxNearPosition,Fd as createFindObjectsInSphereNearPosition,zd as createFindObjectsNearPath,Wr as createGuiAnimationController,Or as createKeyframeTracksForBones,kr as createKeyframeTracksForBonesTarget,xr as createKeyframeTracksOfCurveAnimation,Ir as createKeyframeTracksOfCurveAnimationByPolyline,Yi as createLineSegmentsByCurve,Xi as createLines,_d as createPlaneMatrix,Gd as createPoiMesh,Hd as createPolygonPoiMesh,Wi as createPolylineBufferGeometry,Ji as createPolylineCurve,Nd as createTexture,kd as createUVMatrix,Vd as default,vr as getAllRootBones,Qr as getClosestContinuousIndexes,Ki as getClosestDistanceInfoOfPointToLines,Yr as getContinuousNumsList,Hi as getCurveDivisionLength,er as getCurvePointAwayFrom,tr as getCurvePointAwayFromOrigin,Fi as getCurveULengths,qi as getDistanceInfoOfPointToLines,Sr as getDurationOfPathAnimationOptions,yr as getFirstRootBone,Tr as getKeyframeTransformDatas,Br as getKeyframeTransformDatasByPolyline,zi as getLengthsOfTs,Qi as getLinesInfo,Rd as getPolygonGeometryInfo,Zi as getProjectionLines,wr as getRootBone,Rr as getSampleDataForBones,Lr as getSampleDataForBonesTarget,Gi as getSampleNum,Er as getTS,Dr as getTimes,Nr as getTrackKeyframeTimeRatios,Ud as setTexture};