@splinetool/runtime 0.9.23 → 0.9.24
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/build/runtime.js +2 -2
- package/package.json +1 -1
package/build/runtime.js
CHANGED
|
@@ -3888,7 +3888,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3888
3888
|
#ifndef USE_LAYER_DISPLACE
|
|
3889
3889
|
#include <begin_vertex>
|
|
3890
3890
|
#endif
|
|
3891
|
-
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;"," vNormal = transformedNormal;"),n.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=n.join(`
|
|
3891
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=n.join(`
|
|
3892
3892
|
`)}else{this.color===void 0&&(this.color=new Ft(Lr)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=c!==void 0,e.addParsCode(["#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",`
|
|
3893
3893
|
varying vec3 vViewPosition;
|
|
3894
3894
|
struct ToonMaterial {
|
|
@@ -4236,4 +4236,4 @@ float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offse
|
|
|
4236
4236
|
#else
|
|
4237
4237
|
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
|
|
4238
4238
|
#endif
|
|
4239
|
-
outputColor=vec4(color,inputColor.a);}`,Zf={DEFAULT:0,ESKIL:1},VA=class extends Ki{constructor({blendFunction:i=bt.NORMAL,technique:e=Zf.DEFAULT,eskil:t=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect",ZU,{blendFunction:i,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new Te(r)],["darkness",new Te(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(i){this.technique!==i&&(this.defines.set("VIGNETTE_TECHNIQUE",i.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Zf.ESKIL}set eskil(i){this.technique=i?Zf.ESKIL:Zf.DEFAULT}getTechnique(){return this.technique}setTechnique(i){this.technique=i}get offset(){return this.uniforms.get("offset").value}set offset(i){this.uniforms.get("offset").value=i}getOffset(){return this.offset}setOffset(i){this.offset=i}get darkness(){return this.uniforms.get("darkness").value}set darkness(i){this.uniforms.get("darkness").value=i}getDarkness(){return this.darkness}setDarkness(i){this.darkness=i}},Ise=[new Float32Array(3),new Float32Array(3)],Nse=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],Rse=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var Bse=[new Float32Array(2),new Float32Array(2)];var Ose=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),Fse=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],Use=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Gse=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var zse=new Map([[ln(0,0,0,0),new Float32Array([0,0,0,0])],[ln(0,0,0,1),new Float32Array([0,0,0,1])],[ln(0,0,1,0),new Float32Array([0,0,1,0])],[ln(0,0,1,1),new Float32Array([0,0,1,1])],[ln(0,1,0,0),new Float32Array([0,1,0,0])],[ln(0,1,0,1),new Float32Array([0,1,0,1])],[ln(0,1,1,0),new Float32Array([0,1,1,0])],[ln(0,1,1,1),new Float32Array([0,1,1,1])],[ln(1,0,0,0),new Float32Array([1,0,0,0])],[ln(1,0,0,1),new Float32Array([1,0,0,1])],[ln(1,0,1,0),new Float32Array([1,0,1,0])],[ln(1,0,1,1),new Float32Array([1,0,1,1])],[ln(1,1,0,0),new Float32Array([1,1,0,0])],[ln(1,1,0,1),new Float32Array([1,1,0,1])],[ln(1,1,1,0),new Float32Array([1,1,1,0])],[ln(1,1,1,1),new Float32Array([1,1,1,1])]]);function ky(i,e,t){return i+(e-i)*t}function ln(i,e,t,r){let n=ky(i,e,1-.25),s=ky(t,r,1-.25);return ky(n,s,1-.125)}var Tr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=bt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=ne({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var Tu=class extends Tr{constructor(){super(DA);this.blendFunction=bt.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var Eu=class extends Tr{constructor(){super(IA)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var Cu=class extends Tr{constructor(){super(RA);this.effect.offset=new B(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var Lu=class extends Tr{constructor(){super(NA)}};var Pu=class extends Tr{constructor(){super(OA);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var Du=class extends Tr{constructor(){super(FA);this.blendFunction=bt.OVERLAY}};var Iu=class extends Tr{constructor(){super(VA)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var Nu=class extends Tr{constructor(e){super(BA,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var Ru=class extends Tr{constructor(){super(UA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function HA(i,e){return e&&e.enabled&&i.push(e.effect),i}var $f=class extends tr{constructor(){super();this._scene=new Vr;this._camera=new ni;this.effects=new Map;this.loadingManager=new Ha;this.renderPass=new Uy;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new km,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new Tu),this.effects.set("chromaticAberration",new Cu),this.effects.set("vignette",new Iu),this.effects.set("noise",new Du),this.effects.set("colorAverage",new Lu),this.effects.set("hueSaturation",new Pu),this.effects.set("brightnessContrast",new Eu),this.effects.set("depthOfField",new Nu),this.effects.set("pixelation",new Ru)}get scene(){return this._scene}set scene(e){this._scene=e}get camera(){return this._camera}set camera(e){this._camera=e}_initSmaa(){if(!this.effectComposer)return;let e=this.effectComposer.passes.length,t=new kA({preset:Ko.ULTRA,edgeDetectionMode:Qf.COLOR}),r=()=>{t.removeEventListener("load",r),this.dispatchEvent({type:"smaaloaded"})};t.addEventListener("load",r),t.edgeDetectionMaterial.setPredicationMode(Iy.DEPTH),t.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),t.edgeDetectionMaterial.setPredicationThreshold(.002),t.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new Kf(this.camera,t),e),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let e;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Uy(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(HA,[]),r=[this.effects.get("pixelation")].reduce(HA,[]);r.length>0&&this.effectComposer.addPass(new Kf(this.camera,...r)),this.effectComposer.addPass(new Kf(this.camera,...t))}else this.effectComposer.addPass(this.renderPass);if(e)return e}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new PA(this.renderer),this._initPasses()}init({renderer:e,camera:t,scene:r}){this.renderer=e,this.scene=r,this.camera=t,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let e=new B;this.renderer.getDrawingBufferSize(e),this._rt=new yt(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Ls,wrapT:Ls}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Ry(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){var r,n;let t=this.effectComposer;!t||(e===!0?(((r=this.renderer)==null?void 0:r.capabilities.isWebGL2)&&(t.multisampling=0),t.removePass(this._savePass),t.passes[t.passes.length-1].renderToScreen=!0,t.autoRenderToScreen=!0):(((n=this.renderer)==null?void 0:n.capabilities.isWebGL2)&&!this._hasSmaa&&(t.multisampling=4),t.autoRenderToScreen=!1,t.passes[t.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,t.addPass(this._savePass)),this._renderToScreen=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(e){e&&(Object.keys(e).forEach(t=>{let r=e[t],n=this.effects.get(t);Object.keys(r).forEach(s=>{n[s]=r[s]})}),this.enabled=e.enabled)}toJSON(){let e={};return this.effects.forEach((t,r)=>{e[r]=t.toJSON()},e),ne({enabled:this.enabled},e)}render(){var e;(e=this.effectComposer)==null||e.render(this.clock.getDelta())}setScissor(e,t,r,n){if(!this.effectComposer||!this.renderer)return;e instanceof rt?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,r,n),this.effectComposer.outputBuffer.scissor.set(e,t,r,n));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,r,n)}setScissorTest(e){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e))}setViewport(e,t,r,n){!this.effectComposer||(e instanceof rt?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,r,n),this.effectComposer.outputBuffer.viewport.set(e,t,r,n)))}resize(e,t){var r,n;if((r=this.effectComposer)==null||r.setSize(e,t),this._rt){let s=((n=this.renderer)==null?void 0:n.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(e*s,t*s)}}dispose(){var e;this._listeners=void 0,(e=this.effectComposer)==null||e.dispose()}};var Vy=class extends Yf{constructor(e,t){super(e,t);this.postprocessing=new $f;this.initPostprocessing(e.postprocessing)}resetAfterClear(e,t){super.resetAfterClear(e,t),this.initPostprocessing(e.postprocessing)}initPostprocessing(e){let n=e,{enabled:t}=n,r=_x(n,["enabled"]);for(let s of Object.entries(r)){let o=s[1],a=this.postprocessing.effects.get(s[0]);if(a){a.enabled=o.enabled;for(let[l,c]of Object.entries(o))a[l]=c}}this.postprocessing.enabled=t,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(e){super.switchActiveCamera(e),this.postprocessing&&(this.postprocessing.camera=e)}};"use strict";var jA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Hy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},$U=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],ep={CSS:{},springs:{}};function Zi(i,e,t){return Math.min(Math.max(i,e),t)}function Bu(i,e){return i.indexOf(e)>-1}function jy(i,e){return i.apply(null,e)}var Je={arr:function(i){return Array.isArray(i)},obj:function(i){return Bu(Object.prototype.toString.call(i),"Object")},pth:function(i){return Je.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Je.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i=="undefined"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Je.hex(i)||Je.rgb(i)||Je.hsl(i)},key:function(i){return!jA.hasOwnProperty(i)&&!Hy.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function WA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function qA(i,e){var t=WA(i),r=Zi(Je.und(t[0])?1:t[0],.1,100),n=Zi(Je.und(t[1])?100:t[1],.1,100),s=Zi(Je.und(t[2])?10:t[2],.1,100),o=Zi(Je.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,h=l<1?(l*a+-o)/c:-o+a;function d(p){var g=e?e*p/1e3:p;return l<1?g=Math.exp(-g*l*a)*(u*Math.cos(c*g)+h*Math.sin(c*g)):g=(u+h*g)*Math.exp(-g*a),p===0||p===1?p:1-g}function f(){var p=ep.springs[i];if(p)return p;for(var g=1/6,x=0,y=0;;)if(x+=g,d(x)===1){if(y++,y>=16)break}else y=0;var m=x*g*1e3;return ep.springs[i]=m,m}return e?d:f}function eG(i){return i===void 0&&(i=10),function(e){return Math.ceil(Zi(e,1e-6,1)*i)*(1/i)}}var tG=function(){var i=11,e=1/(i-1);function t(u,h){return 1-3*h+3*u}function r(u,h){return 3*h-6*u}function n(u){return 3*u}function s(u,h,d){return((t(h,d)*u+r(h,d))*u+n(h))*u}function o(u,h,d){return 3*t(h,d)*u*u+2*r(h,d)*u+n(h)}function a(u,h,d,f,p){var g,x,y=0;do x=h+(d-h)/2,g=s(x,f,p)-u,g>0?d=x:h=x;while(Math.abs(g)>1e-7&&++y<10);return x}function l(u,h,d,f){for(var p=0;p<4;++p){var g=o(h,d,f);if(g===0)return h;var x=s(h,d,f)-u;h-=x/g}return h}function c(u,h,d,f){if(!(0<=u&&u<=1&&0<=d&&d<=1))return;var p=new Float32Array(i);if(u!==h||d!==f)for(var g=0;g<i;++g)p[g]=s(g*e,u,d);function x(y){for(var m=0,v=1,w=i-1;v!==w&&p[v]<=y;++v)m+=e;--v;var b=(y-p[v])/(p[v+1]-p[v]),T=m+b*e,_=o(T,u,d);return _>=.001?l(y,T,u,d):_===0?T:a(y,m,m+e,u,d)}return function(y){return u===h&&d===f||y===0||y===1?y:s(x(y),h,f)}}return c}(),XA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Zi(r,1,10),o=Zi(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function Wy(i,e){if(Je.fnc(i))return i;var t=i.split("(")[0],r=XA[t],n=WA(i);switch(t){case"spring":return qA(i,e);case"cubicBezier":return jy(tG,n);case"steps":return jy(eG,n);default:return jy(r,n)}}function YA(i){try{var e=document.querySelectorAll(i);return e}catch(t){return}}function tp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function rp(i){return i.reduce(function(e,t){return e.concat(Je.arr(t)?rp(t):t)},[])}function JA(i){return Je.arr(i)?i:(Je.str(i)&&(i=YA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function qy(i,e){return i.some(function(t){return t===e})}function Xy(i){var e={};for(var t in i)e[t]=i[t];return e}function Yy(i,e){var t=Xy(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function np(i,e){var t=Xy(i);for(var r in e)t[r]=Je.und(i[r])?e[r]:i[r];return t}function rG(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function nG(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function iG(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(d,f,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(f-d)*6*p:p<1/2?f:p<2/3?d+(f-d)*(2/3-p)*6:d}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,h=2*n-u;a=o(h,u,t+1/3),l=o(h,u,t),c=o(h,u,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function sG(i){if(Je.rgb(i))return rG(i);if(Je.hex(i))return nG(i);if(Je.hsl(i))return iG(i)}function Ss(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function oG(i){if(Bu(i,"translate")||i==="perspective")return"px";if(Bu(i,"rotate")||Bu(i,"skew"))return"deg"}function Jy(i,e){return Je.fnc(i)?i(e.target,e.id,e.total):i}function $i(i,e){return i.getAttribute(e)}function Qy(i,e,t){var r=Ss(e);if(qy([t,"deg","rad","turn"],r))return e;var n=ep.CSS[e+t];if(!Je.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return ep.CSS[e+t]=c,c}function QA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?Qy(i,n,t):n}}function Ky(i,e){if(Je.dom(i)&&!Je.inp(i)&&($i(i,e)||Je.svg(i)&&i[e]))return"attribute";if(Je.dom(i)&&qy($U,e))return"transform";if(Je.dom(i)&&e!=="transform"&&QA(i,e))return"css";if(i[e]!=null)return"object"}function KA(i){if(!!Je.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function aG(i,e,t,r){var n=Bu(e,"scale")?1:0+oG(e),s=KA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Qy(i,s,r):s}function Zy(i,e,t,r){switch(Ky(i,e)){case"transform":return aG(i,e,r,t);case"css":return QA(i,e,t);case"attribute":return $i(i,e);default:return i[e]||0}}function $y(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=Ss(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function ZA(i,e){if(Je.col(i))return sG(i);if(/\s/g.test(i))return i;var t=Ss(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function ex(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function lG(i){return Math.PI*2*$i(i,"r")}function cG(i){return $i(i,"width")*2+$i(i,"height")*2}function uG(i){return ex({x:$i(i,"x1"),y:$i(i,"y1")},{x:$i(i,"x2"),y:$i(i,"y2")})}function $A(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=ex(r,s)),r=s}return t}function hG(i){var e=i.points;return $A(i)+ex(e.getItem(e.numberOfItems-1),e.getItem(0))}function e_(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return lG(i);case"rect":return cG(i);case"line":return uG(i);case"polyline":return $A(i);case"polygon":return hG(i)}}function dG(i){var e=e_(i);return i.setAttribute("stroke-dasharray",e),e}function fG(i){for(var e=i.parentNode;Je.svg(e)&&Je.svg(e.parentNode);)e=e.parentNode;return e}function t_(i,e){var t=e||{},r=t.el||fG(i),n=r.getBoundingClientRect(),s=$i(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function pG(i,e){var t=Je.str(i)?YA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:t_(t),totalLength:e_(t)*(r/100)}}}function mG(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=t_(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function r_(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ZA(Je.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Je.str(i)||e?r.split(t):[]}}function n_(i){var e=i?rp(Je.arr(i)?i.map(JA):JA(i)):[];return tp(e,function(t,r,n){return n.indexOf(t)===r})}function i_(i){var e=n_(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:KA(t)}}})}function gG(i,e){var t=Xy(e);if(/^spring/.test(t.easing)&&(t.duration=qA(t.easing)),Je.arr(i)){var r=i.length,n=r===2&&!Je.obj(i[0]);n?i={value:i}:Je.fnc(e.duration)||(t.duration=e.duration/r)}var s=Je.arr(i)?i:[i];return s.map(function(o,a){var l=Je.obj(o)&&!Je.pth(o)?o:{value:o};return Je.und(l.delay)&&(l.delay=a?0:e.delay),Je.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return np(o,t)})}function yG(i){for(var e=tp(rp(i.map(function(s){return Object.keys(s)})),function(s){return Je.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Je.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function xG(i,e){var t=[],r=e.keyframes;r&&(e=np(yG(r),e));for(var n in e)Je.key(n)&&t.push({name:n,tweens:gG(e[n],i)});return t}function vG(i,e){var t={};for(var r in i){var n=Jy(i[r],e);Je.arr(n)&&(n=n.map(function(s){return Jy(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function bG(i,e){var t;return i.tweens.map(function(r){var n=vG(r,e),s=n.value,o=Je.arr(s)?s[1]:s,a=Ss(o),l=Zy(e.target,i.name,a,e),c=t?t.to.original:l,u=Je.arr(s)?s[0]:c,h=Ss(u)||Ss(l),d=a||h;return Je.und(o)&&(o=c),n.from=r_(u,d),n.to=r_($y(o,u),d),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Wy(n.easing,n.duration),n.isPath=Je.pth(s),n.isColor=Je.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var s_={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function o_(i,e){var t=i_(i);t.forEach(function(r){for(var n in e){var s=Jy(e[n],r),o=r.target,a=Ss(s),l=Zy(o,n,a,r),c=a||Ss(l),u=$y(ZA(s,c),l),h=Ky(o,n);s_[h](o,n,u,r.transforms,!0)}})}function wG(i,e){var t=Ky(i.target,e.name);if(t){var r=bG(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function SG(i,e){return tp(rp(i.map(function(t){return e.map(function(r){return wG(t,r)})})),function(t){return!Je.und(t)})}function a_(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var l_=0;function MG(i){var e=Yy(jA,i),t=Yy(Hy,i),r=xG(t,i),n=i_(i.targets),s=SG(n,r),o=a_(s,t),a=l_;return l_++,np(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Ln=[],c_=[],ip,AG=function(){function i(){ip=requestAnimationFrame(e)}function e(t){var r=Ln.length;if(r){for(var n=0;n<r;){var s=Ln[n];if(!s.paused)s.tick(t);else{var o=Ln.indexOf(s);o>-1&&(Ln.splice(o,1),r=Ln.length)}n++}i()}else ip=cancelAnimationFrame(ip)}return i}();function _G(){document.hidden?(Ln.forEach(function(i){return i.pause()}),c_=Ln.slice(0),Er.running=Ln=[]):c_.forEach(function(i){return i.play()})}typeof document!="undefined"&&document.addEventListener("visibilitychange",_G);function Er(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(v){var w=window.Promise&&new Promise(function(b){return o=b});return v.finished=w,w}var l=MG(i),c=a(l);function u(){var v=l.direction;v!=="alternate"&&(l.direction=v!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(w){return w.reversed=l.reversed})}function h(v){return l.reversed?l.duration-v:v}function d(){e=0,t=h(l.currentTime)*(1/Er.speed)}function f(v,w){w&&w.seek(v-w.timelineOffset)}function p(v){if(l.reversePlayback)for(var b=s;b--;)f(v,n[b]);else for(var w=0;w<s;w++)f(v,n[w])}function g(v){var w=0,b=l.animations,T=b.length;for(l.reversePlayback===!0&&l.rewind===!1&&(v=l.duration-v);w<T;){var _=b[w],S=_.animatable,N=_.tweens,C=N.length-1,M=N[C];C&&(M=tp(N,function(ce){return v<ce.end})[0]||M);for(var E=Zi(v-M.start-M.delay,0,M.duration)/M.duration,D=isNaN(E)?1:M.easing(E),O=M.to.strings,F=M.round,k=[],W=M.to.numbers.length,j=void 0,Z=0;Z<W;Z++){var U=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var G=M.to.numbers[Z],R=M.from.numbers[Z]||0;else var R=M.to.numbers[Z],G=M.from.numbers[Z]||0;M.isPath?U=mG(M.value,D*R):U=G+D*(R-G),F&&(M.isColor&&Z>2||(U=Math.round(U*F)/F)),k.push(U)}var J=O.length;if(!J)j=k[0];else{j=O[0];for(var re=0;re<J;re++){var se=O[re],V=O[re+1],he=k[re];isNaN(he)||(V?j+=he+V:j+=he+" ")}}s_[_.type](S.target,_.property,j,S.transforms),_.currentValue=j,w++}}function x(v){l[v]&&!l.passThrough&&l[v](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function m(v){var w=l.duration,b=l.delay,T=w-l.endDelay,_=h(v);l.progress=Zi(_/w*100,0,100),l.reversePlayback=_<l.currentTime,n&&p(_),!l.began&&l.currentTime>=0&&(l.began=!0,x("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,x("loopBegin")),_<=b&&l.currentTime!==0&&g(0),(_>=T&&l.currentTime!==w||!w)&&g(w),_>b&&_<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,x("changeBegin")),x("change"),g(_)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,x("changeComplete")),l.currentTime=Zi(_,0,w),l.began&&x("update"),v>=w&&(t=0,y(),l.remaining?(e=r,x("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,x("loopComplete"),x("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var v=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=v==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var w=s;w--;)l.children[w].reset();(l.reversed&&l.loop!==!0||v==="alternate"&&l.loop===1)&&l.remaining++,g(l.reversed?l.duration:0)},l.set=function(v,w){return o_(v,w),l},l.tick=function(v){r=v,e||(e=r),m((r+(t-e))*Er.speed)},l.seek=function(v){m(h(v))},l.pause=function(){l.paused=!0,d()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Ln.push(l),d(),ip||AG())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function u_(i,e){for(var t=e.length;t--;)qy(i,e[t].animatable.target)&&e.splice(t,1)}function TG(i){for(var e=n_(i),t=Ln.length;t--;){var r=Ln[t],n=r.animations,s=r.children;u_(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;u_(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function EG(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Wy(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=Je.arr(i),h=parseFloat(u?i[0]:i),d=u?parseFloat(i[1]):0,f=Ss(u?i[1]:i)||0,p=e.start||0+(u?h:0),g=[],x=0;return function(y,m,v){if(a&&(o=0),l&&(o=(v-1)/2),c&&(o=v-1),!g.length){for(var w=0;w<v;w++){if(!n)g.push(Math.abs(o-w));else{var b=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),_=w%n[0],S=Math.floor(w/n[0]),N=b-_,C=T-S,M=Math.sqrt(N*N+C*C);s==="x"&&(M=-N),s==="y"&&(M=-C),g.push(M)}x=Math.max.apply(Math,g)}r&&(g=g.map(function(D){return r(D/x)*x})),t==="reverse"&&(g=g.map(function(D){return s?D<0?D*-1:-D:Math.abs(x-D)}))}var E=u?(d-h)/x:h;return p+E*(Math.round(g[m]*100)/100)+f}}function CG(i){i===void 0&&(i={});var e=Er(i);return e.duration=0,e.add=function(t,r){var n=Ln.indexOf(e),s=e.children;n>-1&&Ln.splice(n,1);function o(d){d.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=np(t,Yy(Hy,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Je.und(r)?c:$y(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=Er(l);o(u),s.push(u);var h=a_(s,i);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Er.version="3.2.0";Er.speed=1;Er.running=Ln;Er.remove=TG;Er.get=Zy;Er.set=o_;Er.convertPx=Qy;Er.path=pG;Er.setDashoffset=dG;Er.stagger=EG;Er.timeline=CG;Er.easing=Wy;Er.penner=XA;Er.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var Ou=Er;function h_(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Fu(i,e,t){switch(i){case fn.LINEAR:return"cubicBezier( 0, 0, 1, 1 )";case fn.EASE:return"cubicBezier( .25, .1, .25, 1 )";case fn.EASE_IN:return"cubicBezier( .42, 0, 1, 1 )";case fn.EASE_OUT:return"cubicBezier( 0, 0, .58, 1 )";case fn.EASE_IN_OUT:return"cubicBezier( .42, 0, .58, 1 )";case fn.CUBIC:let{control1:r,control2:n}=e;return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case fn.SPRING:let{mass:s,stiffness:o,damping:a,velocity:l}=t;return`spring( ${s}, ${o}, ${a}, ${l} )`}}function d_(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}function f_(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}var tx=new A,rx=new A,p_=new jt,LG=new In,PG=new Ae;function m_(i,e,t){let r=[];if(DG(i,e==null?void 0:e.objectState,t.objectState,r),Sl(i)){if("geometry"in t.objectState&&OG(i,t.objectState.geometry,r),"material"in t.objectState||"materials"in t.objectState){let[n,s]=d_(i,t.objectState,i.selectedMaterial);n&&s&&typeof s!="string"&&UG(n,s,r)}}else w1(i)?BG(i,t.objectState,r):b1(i)&&RG(i,t.objectState,r);return{change:n=>{r.forEach(s=>s.change(n))}}}function DG(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;Br.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(Br.lerp(n,s,o)),i.updateMatrix()}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;Br.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(Br.lerp(n,s,o)),i.updateMatrix()}})}IG(i,e,t,r),NG(i,t,r)}function IG(i,e,t,r){if(t.rotation===void 0)return;let n=tx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(Br.isEqual(n,s))return;if(Br.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new jt().setFromEuler(LG.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{f_(a,l,i.quaternion,c),i.updateMatrix()}})}else r.push({change:a=>{i.rotation.setFromVector3(rx.fromArray(Br.lerp(n,s,a))),i.updateMatrix()}})}function NG(i,e,t){if(e.hiddenMatrix!==void 0&&!Bi.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,n=new jt,s=new A;i.hiddenMatrix.decompose(r,n,s);let o=new A,a=new jt,l=new A;PG.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{p_.slerpQuaternions(n,a,c),tx.lerpVectors(r,o,c),rx.lerpVectors(s,l,c),i.hiddenMatrix.compose(tx,p_,rx)}})}}function RG(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=tt.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=tt.lerp(o,a,l)}})}}function BG(i,e,t){if(e.intensity!==void 0){let r=i.intensity,n=e.intensity;r!==n&&t.push({change:s=>{i.intensity=tt.lerp(r,n,s)}})}if(e.color!==void 0&&typeof e.color!="string"){let r=i.color.clone(),n=e.color;Or.equals(r,n)||t.push({change:s=>{let{r:o,g:a,b:l}=Or.lerp(r,n,s);i.color.setRGB(o,a,l)}})}}function OG(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];Br.isEqual(o,a)||t.push({change:l=>{let[c,u,h]=Br.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:u,depth:h}})}})}}var FG=["mode","gradientType","noiseType","displacementType","crop"];function UG(i,e,t){let r=i.layersList.head;for(;r;){let n=e.layers.data(r.uuid);if(n){let s=r.getNames().filter(o=>!FG.some(a=>o.includes(a)));for(let o of s)try{let a=r.getValue(o);if(o==="steps")HG(r,n,o,t);else if(o==="colors")jG(r,n,o,t);else if(typeof a=="number")GG(r,n,o,t);else{if(typeof a=="boolean")continue;"isVector2"in a?zG(r,n,o,t):"isVector3"in a?kG(r,n,o,t):"isColor"in a?VG(r,n,o,t):"isTexture"in a&&WG(r,n,o,t)}}catch(a){console.error(`animateMaterial: unexpected material layer for ${o}`,a)}}r=r.next}}function GG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,tt.lerp(n,s,o))}})}function zG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];fs.isEqual(s,o)||r.push({change:a=>{n.fromArray(fs.lerp(s,o,a))}})}function kG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];Br.isEqual(s,o)||r.push({change:a=>{n.fromArray(Br.lerp(s,o,a))}})}function VG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.clone(),o=e[t];Or.equals(s,o)||r.push({change:a=>{let{r:l,g:c,b:u}=Or.lerp(s,o,a);n.setRGB(l,c,u)}})}function HG(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=tt.lerp(a,l,c),i.setValue("steps",n)}})}}function jG(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Fc.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Fc.lerp(a,l,c))}})}}function WG(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!fs.isEqual(o,l)||!fs.isEqual(a,c))&&r.push({change:u=>{n.repeat.fromArray(fs.lerp(o,l,u)),n.offset.fromArray(fs.lerp(a,c,u)),n.updateMatrix(),n.needsUpdate=!0}})}var Ms;(function(r){r[r.started=0]="started",r[r.ended=1]="ended",r[r.once=2]="once"})(Ms||(Ms={}));var es=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=tt.generateUUID();this.states=[];this.events=[];this._scrollCounter=null}static get isAllAnimationsEnded(){let e;for(let t in es.isAnimating){if(es.isAnimating[t]===2)return es.isAnimating[t]=1,!1;if(es.isAnimating[t]===0)return!1;e=!0}return e}computeCache(){return this.cache={mouseDown:this.events.find(e=>e.type===$e.MOUSE_DOWN),mouseUp:this.events.find(e=>e.type===$e.MOUSE_UP),mouseHover:this.events.find(e=>e.type===$e.MOUSE_HOVER),start:this.events.find(e=>e.type===$e.START),lookAt:this.events.find(e=>e.type===$e.LOOK_AT),follow:this.events.find(e=>e.type===$e.FOLLOW),keyDown:this.events.filter(e=>e.type===$e.KEY_DOWN),keyUp:this.events.filter(e=>e.type===$e.KEY_UP),scroll:this.events.find(e=>e.type===$e.SCROLL)},this.cache}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._currentState=this.states[0],this._prevState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),this.object.updateMatrix(),(t=this._animation)==null||t.finished.then(()=>{this.lookAt(e),this.object.updateMatrix()})}follow(e){this.object.position.copy(e),this.object.parent!==null&&this.object.position.applyMatrix4(new Ae().copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4(new Ae().copy(this.object.hiddenMatrix).invert()),this.object.updateMatrix()}play(e){this.object.visible&&e.state!==void 0&&this.animate(e.state,e)}seek(e,t,r){var n;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),es.isAnimating[e.state.uuid]=2,(n=this._animation)==null||n.seek(this._scrollCounter/r*e.duration)}reverse(e){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e)}animate(e,t,r=!1){var n,s,o,a,l,c;if(es.isAnimating[e.uuid]=0,this._currentState===e){if((n=this._animation)==null?void 0:n.reversed){let u=(o=(s=this._animation)==null?void 0:s.currentTime)!=null?o:0;(a=this._animation)==null||a.reset(),(l=this._animation)==null||l.seek(u),(c=this._animation)==null||c.play()}}else{this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&(es.isAnimating[this._prevState.uuid]=1,this._animation.pause()),t.cycle===!0&&t.repeat===!0?this._animation=Ou.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!0&&t.repeat===!1?this._animation=Ou.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!1&&t.repeat===!0?this._animation=Ou.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):this._animation=Ou.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}),this._animation.finished.then(()=>{r||(this._animation=void 0,es.isAnimating[e.uuid]=1)});let u=m_(this.object,this._prevState,this._currentState),h={t:0};this._animation.add({targets:h,t:1,change:()=>u.change(h.t)},0)}}},Ol=es;Ol.isAnimating={};var nx=class{constructor(e){this.eventState=e;this.targets=[]}get type(){return this.eventState.type}get key(){return this.eventState.type===$e.KEY_DOWN||this.eventState.type===$e.KEY_UP?this.eventState.key:null}get url(){return this.eventState.type===$e.KEY_DOWN||this.eventState.type===$e.KEY_UP||this.eventState.type===$e.MOUSE_DOWN||this.eventState.type===$e.MOUSE_UP?this.eventState.url:null}get steps(){return this.eventState.type===$e.SCROLL?this.eventState.steps:null}get distance(){return this.eventState.type===$e.LOOK_AT?this.eventState.distance:null}dispatchReverse(){var e;for(let t=0,r=this.targets.length;t<r;++t){let n=this.targets[t];n.state!==void 0&&n.object!==void 0&&((e=n.object.interaction)==null||e.reverse(n))}}dispatch(e){var t,r;this.url!==void 0&&(this.type===$e.MOUSE_DOWN||this.type===$e.MOUSE_UP||this.type===$e.KEY_DOWN||this.type===$e.KEY_UP)&&(h_()?window.location.assign(this.url):window.open(this.url,"_blank"));for(let n=0,s=this.targets.length;n<s;++n){let o=this.targets[n];o.state!==void 0&&o.object!==void 0&&(this.type===$e.SCROLL?(t=o.object.interaction)==null||t.seek(o,e,this.steps):(r=o.object.interaction)==null||r.play(o))}}};var Uu=class{constructor(e){this.targetState=e}static create(e,t){var n;let r=new Uu(e);if(e.object){let s=t.find(e.object);if(r.object=s,s==null?void 0:s.interaction){let o=s.interaction.states;r.state=e.state&&(n=o.find(a=>a.uuid===e.state))!=null?n:o[0]}}return r}get cubicControls(){let e=this.targetState;return e.easing===fn.CUBIC?{control1:e.control1,control2:e.control2}:ne({},Pd.defaultData)}get springParameters(){let e=this.targetState;return e.easing===fn.SPRING?e:ne({},Ld.defaultData)}get easing(){return this.targetState.easing}get duration(){return this.targetState.duration}get delay(){return this.targetState.delay}get repeat(){return this.targetState.repeat}get cycle(){return this.targetState.cycle}get rewind(){return this.targetState.rewind}};var g_=new an,Fl=class extends nn{},ix=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new yt(2048,2048,{generateMipmaps:!0,minFilter:Ei,magFilter:ot,wrapS:Mr,wrapT:Mr}),this.transmissionRenderTarget.depthTexture=new Di(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ay(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===g_}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:g_}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Fl(t.r,t.g,t.b,t.a):this.colors[e]=new Fl(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function qG(i,e){switch(i.type){case ht.NOISE:return e==="noiseType";case ht.TEXTURE:return e==="projection"||e==="axis";case ht.DISPLACE:return e==="noiseType";case ht.DEPTH:return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function sx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||kf(a,t,n))continue;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Ft:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof Fl?c.value=new nn(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case Wi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof Fl?c.value=new nn(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Xr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case Yr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case sn:{let u=l;"image"in u&&(c.value.image=e.getImage(u.image)),"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&c.value.repeat.fromArray(u.repeat),"offset"in u&&c.value.offset.fromArray(u.offset),c.value.needsUpdate=!0;break}case lo:{l.forEach((u,h)=>{c.value[h].setX(u[0]),c.value[h].setY(u[1]),c.value[h].setZ(u[2]),c.value[h].setW(u[3])});break}default:{s=s||qG(t,a),c.value=l;break}}}if(s&&n){let a=zf({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,ne({},a)),r.dispose(),r.needsUpdate=!0}}function y_(i,e,t){let r=[];i.objects.traverse((n,s)=>{if(s.states===void 0)return;let o=e.find(n),a=new Ol(o,t);o.interaction=a,ox(o,s,null,t),a.states.push(Ul.create(n,s));for(let l of s.states){let c=jc.patch(s,l.data);a.states.push(Ul.create(l.id,c))}if(s.events)for(let{data:l}of s.events){let c=new nx(l);a.events.push(c),"targets"in l&&r.push([l,c])}});for(let[n,s]of r)if("targets"in n)for(let{data:o}of n.targets){let a=Uu.create(o,e);s.targets.push(a)}}function ox(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:jc.patch(e,e.states.data(t));if(Zg(i,s),i instanceof ir&&s.type==="Mesh"){if(i instanceof Qo?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);sx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);sx(c.data,r,u,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof ni&&eo.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var Ul=class{constructor(e){this.objectState=e;this.uuid=tt.generateUUID()}static create(e,t){let r=new Ul(t);return r.uuid=e,r}execute(e,t){ox(e,this.objectState,null,t,!0)}};var ax=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._enableEvent={};this._map={};this._prevAncestors=[];this._raycaster=new Ig;this._intersection=new A;this._plane=new vn;this._normal=new A;this._position=new A;this._onMouseDown=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()};this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()};this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()};this._onWheel=e=>{this._handleWheelEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)};this._onTouchMove=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)};this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)};this._domElement=e,this._scene=t,this._camera=r,this._app=n}activate(){this.isEnable=!0,this._scene.traverseEntity(e=>{if(e.interaction!==void 0){e.interaction.start();for(let t of e.interaction.events){let r=t.type;this._addCustomEvent(r,e),this._enableEvent[r]=!0,(r===$e.KEY_DOWN||r===$e.KEY_UP||r===$e.START||r===$e.LOOK_AT||r===$e.FOLLOW||r===$e.SCROLL)&&(this._map[r]===void 0&&(this._map[r]=[]),this._map[r].push(e))}}}),this._enableEvent[$e.START]!==void 0&&this._handleStartEvent(),this._enableEvent[$e.MOUSE_DOWN]!==void 0&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),this._enableEvent[$e.MOUSE_UP]!==void 0&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),(this._enableEvent[$e.MOUSE_HOVER]!==void 0||this._enableEvent[$e.LOOK_AT]!==void 0||this._enableEvent[$e.FOLLOW]!==void 0)&&(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),this._enableEvent[$e.KEY_DOWN]!==void 0&&document.addEventListener("keydown",this._onKeyDown,!1),this._enableEvent[$e.KEY_UP]!==void 0&&document.addEventListener("keyup",this._onKeyUp,!1),this._enableEvent[$e.SCROLL]!==void 0&&this._domElement.addEventListener("wheel",this._onWheel,!1)}deactivate(){this._scene.traverseEntity(e=>{e.interaction!==void 0&&(e.interaction.end(),e.interaction.cache=void 0)}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect();return{x:(e-r.left)/r.width*2-1,y:-((t-r.top)/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map[$e.START])==null||e.forEach(t=>{var r;(r=t.interactionCache.start)==null||r.dispatch()})}_handleWheelEvent(e){var t;(t=this._map[$e.SCROLL])==null||t.forEach(r=>{var n;this._dispatchDOMCustomEvent("scroll",r.uuid),(n=r.interactionCache.scroll)==null||n.dispatch(e.deltaY>0?1:-1)})}_handleMouseDownEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseDown",s.uuid),(t=s.interactionCache.mouseDown)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseDown",o.uuid),(a=o.interactionCache.mouseDown)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseUpEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseUp",s.uuid),(t=s.interactionCache.mouseUp)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseUp",o.uuid),(a=o.interactionCache.mouseUp)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,r;if(this._enableEvent[$e.MOUSE_HOVER]!==void 0){let n;if(!e){let o=this._raycastMesh(this._raycaster).find(a=>!a.object.interactionCache.follow);n=o?o.object:void 0}if(this._prevObject!==n){this._prevObject!==void 0&&((t=this._prevObject.interactionCache.mouseHover)==null||t.dispatchReverse()),n!==void 0&&(this._dispatchDOMCustomEvent("mouseHover",n.uuid),(r=n.interactionCache.mouseHover)==null||r.dispatch());let s=[];n==null||n.traverseAncestors(l=>{l instanceof ii&&l.interactionCache.mouseHover&&s.push(l)}),this._prevAncestors.filter(l=>{var c;return s.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatchReverse(),!0)});let o=s.filter(l=>{var c;return this._prevAncestors.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatch(),!0)}),a=this._prevAncestors.filter(l=>s.includes(l));this._prevAncestors=[...a,...o]}this._prevObject=n}}_handleLookAtEvent(){var e;(e=this._map[$e.LOOK_AT])==null||e.forEach(t=>{var n,s;let r=(n=t.interactionCache.lookAt)==null?void 0:n.distance;this._dispatchDOMCustomEvent("lookAt",t.uuid),r!==void 0&&(this._plane.set(this._normal,-r),this._raycaster.ray.intersectPlane(this._plane,this._intersection),(s=t.interaction)==null||s.lookAt(this._intersection))}),this._app.requestRender()}_handleFollowEvent(){var e;(e=this._map[$e.FOLLOW])==null||e.forEach(t=>{var r;this._dispatchDOMCustomEvent("follow",t.uuid),this._plane.setFromNormalAndCoplanarPoint(this._normal,t.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),(r=t.interaction)==null||r.follow(this._intersection)}),this._app.requestRender()}_handleKeyDownEvent(e){var t;(t=this._map[$e.KEY_DOWN])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyDown)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyDown",r.uuid),n==null||n.dispatch()})}_handleKeyUpEvent(e){var t;(t=this._map[$e.KEY_UP])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyUp)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyUp",r.uuid),n==null||n.dispatch()})}_raycastMesh(e){let t=[],r=n=>{for(let s of n.children)Tn(s)&&!s.raycastLock&&s.visible&&(W1(s)&&e.intersectObject(s,!1,t),r(s))};return r(this._scene),t}_addCustomEvent(e,t){let r=(()=>{switch(e){case 0:return"mouseDown";case 1:return"mouseUp";case 2:return"mouseHover";case 5:return"keyDown";case 6:return"keyUp";case 7:return"start";case 9:return"lookAt";case 10:return"follow";case 11:return"scroll"}})();if(r){let n=new CustomEvent(r,{bubbles:!0});Object.defineProperty(n,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[r]?this.splineEvents[r][t.uuid]=n:this.splineEvents[r]={[t.uuid]:n}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var lx=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=XG(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function XG(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var cx=class{constructor(e){this.sharedAssets=new ix(e.shared),this.scene=new Vy(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var ux=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function YG(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function hx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function JG(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof ir)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof ir&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!ki.isMergable(o))return}else{let u=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(u&&"material"in u&&typeof u.material!="string"){if(!ki.isMergable(u.material))return;s=ki.getHash(u.material)}}t[s]||(t[s]={});let l=t[s][hx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let u of r.cloner.children)l.push(u)}else if(t[s][hx(r.objectType)]=[r],r.cloner)for(let u of r.cloner.children)t[s][hx(r.objectType)].push(u)}),t}function QG(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function x_(i,e){let t=JG(e,i),r=QG(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,u=new Array(r),h=0;for(let d of Object.values(t))for(let f of Object.values(d)){if(a=0,c=0,f.forEach(g=>{g instanceof ir&&(o[a++]=g.geometry.clone(),l[c++]=g)}),c<2)continue;for(let g=0;g<c;g++)l[g].updateWorldMatrix(!0,!1),o[g].applyMatrix4(l[g].matrixWorld),l[g].matrixWorld.determinant()<0&&YG(o[g]);let p=yM(o.slice(0,a),!1);if(p){let g;switch(f[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),g=new Vt(p,l[0].material);break}default:{g=new Vt(p,l[0].material);break}}g.castShadow=l[0].castShadow,g.receiveShadow=l[0].receiveShadow,e.add(g);let x=y=>{h=0;for(let m of y)m.children&&x(m.children),m instanceof ir&&(Array.isArray(m.material)||t[m.material.uuid]&&t[m.material.uuid][m.objectType]&&t[m.material.uuid][m.objectType].length>1||(u[h++]=m));for(let m=0;m<h;m++)e.attach(u[m])};for(let y=0;y<c;y++){let m=l[y];x(m.children),n[s++]=m}}}for(let d=0;d<s;d++)n[d].removeFromParent()}var Gl=".",Gu=Symbol("target"),dx=Symbol("unsubscribe");function zu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function v_(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var jn=Array.isArray;function Zo(i){return typeof i=="symbol"}var KG={after:(i,e)=>jn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>jn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Gl),Zo(e)?i+e.toString():i+e):i,initial:i=>{if(jn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Gl);return e===-1?"":i.slice(0,e)},last:i=>{if(jn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Gl);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(jn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Gl);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Gl,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},yn=KG;function fx(i){return typeof i=="object"&&typeof i.next=="function"}function px(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[Gu].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function sp(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Zo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var op=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,yn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function zl(i){return toString.call(i)==="[object Object]"}function kl(){return!0}function po(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var ap=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var ZG=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),mx={push:kl,pop:kl,shift:kl,unshift:kl,copyWithin:po,reverse:po,sort:po,splice:po,flat:po,fill:po},b_=new Set([...ap,...ZG,...Object.keys(mx)]);function Vl(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var gx=["keys","values","entries"],yx=new Set(["has","toString"]),xx={add:Vl,clear:Vl,delete:Vl,forEach:Vl},w_=new Set([...yx,...Object.keys(xx),...gx]);function Hl(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var $G=new Set([...yx,"get"]),vx={set:Hl,clear:Hl,delete:Hl,forEach:Hl},S_=new Set([...$G,...Object.keys(vx),...gx]);var Qr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return ap.has(e)}_shallowClone(e){let t=e;if(zl(e))t=ne({},e);else if(jn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(jn(n)?this._onIsChanged=mx[t]:n instanceof Set?this._onIsChanged=xx[t]:n instanceof Map&&(this._onIsChanged=vx[t]),n):r}update(e,t,r){let n=yn.after(e,this._path);if(t!=="length"){let s=this.clone;yn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],yn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var ku=class extends Qr{static isHandledMethod(e){return b_.has(e)}};var lp=class extends Qr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var Vu=class extends Qr{static isHandledMethod(e){return w_.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var Hu=class extends Qr{static isHandledMethod(e){return S_.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var cp=class extends Qr{constructor(e,t,r,n){super(void 0,t,r,n);this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var up=class extends Qr{constructor(e,t,r,n){super(void 0,t,r,n);this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ts=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return zl(e)||jn(e)||zu(e)}static isHandledMethod(e,t){return zl(e)?Qr.isHandledMethod(t):jn(e)?ku.isHandledMethod(t):e instanceof Set?Vu.isHandledMethod(t):e instanceof Map?Hu.isHandledMethod(t):zu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Qr;jn(e)?n=ku:e instanceof Date?n=lp:e instanceof Set?n=Vu:e instanceof Map?n=Hu:e instanceof WeakSet?n=cp:e instanceof WeakMap&&(n=up),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ts.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var ez={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},bx=(i,e,t={})=>{t=ne(ne({},ez),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new op(n),c=typeof t.onValidate=="function",u=new ts(c),h=(m,v,w,b,T)=>!c||u.isCloning||t.onValidate(yn.concat(l.getPath(m),v),w,b,T)===!0,d=(m,v,w,b)=>{!sp(l,t,v)&&!(o&&l.isDetached(m,i))&&f(l.getPath(m),v,w,b)},f=(m,v,w,b,T)=>{u.isCloning?u.update(m,v,b):e(yn.concat(m,v),w,b,T)},p=m=>m&&(m[r]||m),g=(m,v,w,b)=>v_(m)||w==="constructor"||s&&!ts.isHandledMethod(v,w)||sp(l,t,w)||l.isGetInvariant(v,w)||o&&l.isDetached(v,i)?m:(b===void 0&&(b=l.getPath(v)),l.getProxy(m,yn.concat(b,w),x,r)),x={get(m,v,w){if(Zo(v)){if(v===r||v===Gu)return m;if(v===dx&&!l.isUnsubscribed&&l.getPath(m).length===0)return l.unsubscribe(),m}let b=zu(m)?Reflect.get(m,v):Reflect.get(m,v,w);return g(b,m,v)},set(m,v,w,b){w=p(w);let T=m[r]||m,_=T[v];if(n(_,w)&&v in m)return!0;let S=h(m,v,w,_);return S&&l.setProperty(T,v,w,b,_)?(d(m,v,m[v],_),!0):!S},defineProperty(m,v,w){if(!l.isSameDescriptor(w,m,v)){let b=m[v];h(m,v,w.value,b)&&l.defineProperty(m,v,w,b)&&d(m,v,w.value,b)}return!0},deleteProperty(m,v){if(!Reflect.has(m,v))return!0;let w=Reflect.get(m,v),b=h(m,v,void 0,w);return b&&l.deleteProperty(m,v,w)?(d(m,v,void 0,w),!0):!b},apply(m,v,w){let b=v[r]||v;if(l.isUnsubscribed)return Reflect.apply(m,b,w);if((a===!1||a!==!0&&!a.includes(m.name))&&ts.isHandledType(b)){let T=yn.initial(l.getPath(m)),_=ts.isHandledMethod(b,m.name);u.start(b,T,w);let S=Reflect.apply(m,u.preferredThisArg(m,v,b),_?w.map(M=>p(M)):w),N=u.isChanged(b,n),C=u.stop();if(ts.isHandledType(S)&&_&&(v instanceof Map&&m.name==="get"&&(T=yn.concat(T,w[0])),S=l.getProxy(S,T,x)),N){let M={name:m.name,args:w,result:S},E=u.isCloning?yn.initial(T):T,D=u.isCloning?yn.last(T):"";h(yn.get(i,E),D,b,C,M)?f(E,D,b,C,M):u.undo(b)}return(v instanceof Map||v instanceof Set)&&fx(S)?px(S,m,v,T,g):S}return Reflect.apply(m,v,w)}},y=l.getProxy(i,t.pathAsArray?[]:"",x);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};bx.target=i=>i&&i[Gu]||i;bx.unsubscribe=i=>i[dx]||i;var wx=bx;var mo;(function(t){t[t.FULLSCREEN=1]="FULLSCREEN",t[t.CUSTOM=2]="CUSTOM"})(mo||(mo={}));var tz=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var t,r,n;if(!this._renderer)return;this._rafId=requestAnimationFrame(this.render),(t=this._perfs)==null||t.start();let e=Ol.isAllAnimationsEnded;!this.autoRender&&this._skipRender&&(e===void 0||e)||(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),((r=this._scene.postprocessing)==null?void 0:r.enabled)?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(n=this._perfs)==null||n.end())};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new B(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),((t=this._scene)==null?void 0:t.postprocessing)&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",Rc(this.resize,200)),window.location.search.includes("perfs")&&(this._perfs=new ux({x:10,y:10}))}async load(e){let r=await(await fetch(e)).arrayBuffer();this.start(r)}start(e){var o;let t=Xd.deserialize(new Uint8Array(e));this._publishData=t.scene.publish;let r=new cx(t);if(window.location.search.includes("merge-geometries")){let a=performance.now();x_(t,r.scene);let l=performance.now();console.log("Merged geometries in ",l-a," ms")}this._scene=r.scene,this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},y_(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0];n&&(n.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1])),((o=this._scene.postprocessing)==null?void 0:o.enabled)?(this._renderer=new Dt({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Dt({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new yt(2048,2048,{generateMipmaps:!0,minFilter:Ei,magFilter:ot,wrapS:Mr,wrapT:Mr}),this._transmissionRenderTarget.depthTexture=new Di(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=pp,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new lx(this._renderer,this._camera,new B(this._viewportWidth,this._viewportHeight),new B(window.innerWidth,window.innerHeight)),!0&&(this._controls=new Lg(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new ax(this._renderer.domElement,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}dispose(){var e,t,r,n,s,o,a;(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{wx.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatch()}):s==null||s.dispatch()},emitEventReverse(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatchReverse()}):s==null||s.dispatchReverse()}},r=wx(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};rn.FONTS_PATH="_assets/_fonts/";export{tz as Application};
|
|
4239
|
+
outputColor=vec4(color,inputColor.a);}`,Zf={DEFAULT:0,ESKIL:1},VA=class extends Ki{constructor({blendFunction:i=bt.NORMAL,technique:e=Zf.DEFAULT,eskil:t=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect",ZU,{blendFunction:i,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new Te(r)],["darkness",new Te(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(i){this.technique!==i&&(this.defines.set("VIGNETTE_TECHNIQUE",i.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Zf.ESKIL}set eskil(i){this.technique=i?Zf.ESKIL:Zf.DEFAULT}getTechnique(){return this.technique}setTechnique(i){this.technique=i}get offset(){return this.uniforms.get("offset").value}set offset(i){this.uniforms.get("offset").value=i}getOffset(){return this.offset}setOffset(i){this.offset=i}get darkness(){return this.uniforms.get("darkness").value}set darkness(i){this.uniforms.get("darkness").value=i}getDarkness(){return this.darkness}setDarkness(i){this.darkness=i}},Ise=[new Float32Array(3),new Float32Array(3)],Nse=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],Rse=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var Bse=[new Float32Array(2),new Float32Array(2)];var Ose=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),Fse=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],Use=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Gse=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var zse=new Map([[ln(0,0,0,0),new Float32Array([0,0,0,0])],[ln(0,0,0,1),new Float32Array([0,0,0,1])],[ln(0,0,1,0),new Float32Array([0,0,1,0])],[ln(0,0,1,1),new Float32Array([0,0,1,1])],[ln(0,1,0,0),new Float32Array([0,1,0,0])],[ln(0,1,0,1),new Float32Array([0,1,0,1])],[ln(0,1,1,0),new Float32Array([0,1,1,0])],[ln(0,1,1,1),new Float32Array([0,1,1,1])],[ln(1,0,0,0),new Float32Array([1,0,0,0])],[ln(1,0,0,1),new Float32Array([1,0,0,1])],[ln(1,0,1,0),new Float32Array([1,0,1,0])],[ln(1,0,1,1),new Float32Array([1,0,1,1])],[ln(1,1,0,0),new Float32Array([1,1,0,0])],[ln(1,1,0,1),new Float32Array([1,1,0,1])],[ln(1,1,1,0),new Float32Array([1,1,1,0])],[ln(1,1,1,1),new Float32Array([1,1,1,1])]]);function ky(i,e,t){return i+(e-i)*t}function ln(i,e,t,r){let n=ky(i,e,1-.25),s=ky(t,r,1-.25);return ky(n,s,1-.125)}var Tr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=bt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=ne({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var Tu=class extends Tr{constructor(){super(DA);this.blendFunction=bt.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var Eu=class extends Tr{constructor(){super(IA)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var Cu=class extends Tr{constructor(){super(RA);this.effect.offset=new B(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var Lu=class extends Tr{constructor(){super(NA)}};var Pu=class extends Tr{constructor(){super(OA);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var Du=class extends Tr{constructor(){super(FA);this.blendFunction=bt.OVERLAY}};var Iu=class extends Tr{constructor(){super(VA)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var Nu=class extends Tr{constructor(e){super(BA,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var Ru=class extends Tr{constructor(){super(UA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function HA(i,e){return e&&e.enabled&&i.push(e.effect),i}var $f=class extends tr{constructor(){super();this._scene=new Vr;this._camera=new ni;this.effects=new Map;this.loadingManager=new Ha;this.renderPass=new Uy;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new km,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new Tu),this.effects.set("chromaticAberration",new Cu),this.effects.set("vignette",new Iu),this.effects.set("noise",new Du),this.effects.set("colorAverage",new Lu),this.effects.set("hueSaturation",new Pu),this.effects.set("brightnessContrast",new Eu),this.effects.set("depthOfField",new Nu),this.effects.set("pixelation",new Ru)}get scene(){return this._scene}set scene(e){this._scene=e}get camera(){return this._camera}set camera(e){this._camera=e}_initSmaa(){if(!this.effectComposer)return;let e=this.effectComposer.passes.length,t=new kA({preset:Ko.ULTRA,edgeDetectionMode:Qf.COLOR}),r=()=>{t.removeEventListener("load",r),this.dispatchEvent({type:"smaaloaded"})};t.addEventListener("load",r),t.edgeDetectionMaterial.setPredicationMode(Iy.DEPTH),t.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),t.edgeDetectionMaterial.setPredicationThreshold(.002),t.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new Kf(this.camera,t),e),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let e;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Uy(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(HA,[]),r=[this.effects.get("pixelation")].reduce(HA,[]);r.length>0&&this.effectComposer.addPass(new Kf(this.camera,...r)),this.effectComposer.addPass(new Kf(this.camera,...t))}else this.effectComposer.addPass(this.renderPass);if(e)return e}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new PA(this.renderer),this._initPasses()}init({renderer:e,camera:t,scene:r}){this.renderer=e,this.scene=r,this.camera=t,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let e=new B;this.renderer.getDrawingBufferSize(e),this._rt=new yt(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Ls,wrapT:Ls}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Ry(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){var r,n;let t=this.effectComposer;!t||(e===!0?(((r=this.renderer)==null?void 0:r.capabilities.isWebGL2)&&(t.multisampling=0),t.removePass(this._savePass),t.passes[t.passes.length-1].renderToScreen=!0,t.autoRenderToScreen=!0):(((n=this.renderer)==null?void 0:n.capabilities.isWebGL2)&&!this._hasSmaa&&(t.multisampling=4),t.autoRenderToScreen=!1,t.passes[t.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,this.enabled||(this._savePass.needsDepthTexture=!0),t.addPass(this._savePass)),this._renderToScreen=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(e){e&&(Object.keys(e).forEach(t=>{let r=e[t],n=this.effects.get(t);Object.keys(r).forEach(s=>{n[s]=r[s]})}),this.enabled=e.enabled)}toJSON(){let e={};return this.effects.forEach((t,r)=>{e[r]=t.toJSON()},e),ne({enabled:this.enabled},e)}render(){var e;(e=this.effectComposer)==null||e.render(this.clock.getDelta())}setScissor(e,t,r,n){if(!this.effectComposer||!this.renderer)return;e instanceof rt?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,r,n),this.effectComposer.outputBuffer.scissor.set(e,t,r,n));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,r,n)}setScissorTest(e){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e))}setViewport(e,t,r,n){!this.effectComposer||(e instanceof rt?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,r,n),this.effectComposer.outputBuffer.viewport.set(e,t,r,n)))}resize(e,t){var r,n;if((r=this.effectComposer)==null||r.setSize(e,t),this._rt){let s=((n=this.renderer)==null?void 0:n.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(e*s,t*s)}}dispose(){var e;this._listeners=void 0,(e=this.effectComposer)==null||e.dispose()}};var Vy=class extends Yf{constructor(e,t){super(e,t);this.postprocessing=new $f;this.initPostprocessing(e.postprocessing)}resetAfterClear(e,t){super.resetAfterClear(e,t),this.initPostprocessing(e.postprocessing)}initPostprocessing(e){let n=e,{enabled:t}=n,r=_x(n,["enabled"]);for(let s of Object.entries(r)){let o=s[1],a=this.postprocessing.effects.get(s[0]);if(a){a.enabled=o.enabled;for(let[l,c]of Object.entries(o))a[l]=c}}this.postprocessing.enabled=t,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(e){super.switchActiveCamera(e),this.postprocessing&&(this.postprocessing.camera=e)}};"use strict";var jA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Hy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},$U=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],ep={CSS:{},springs:{}};function Zi(i,e,t){return Math.min(Math.max(i,e),t)}function Bu(i,e){return i.indexOf(e)>-1}function jy(i,e){return i.apply(null,e)}var Je={arr:function(i){return Array.isArray(i)},obj:function(i){return Bu(Object.prototype.toString.call(i),"Object")},pth:function(i){return Je.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Je.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i=="undefined"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Je.hex(i)||Je.rgb(i)||Je.hsl(i)},key:function(i){return!jA.hasOwnProperty(i)&&!Hy.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function WA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function qA(i,e){var t=WA(i),r=Zi(Je.und(t[0])?1:t[0],.1,100),n=Zi(Je.und(t[1])?100:t[1],.1,100),s=Zi(Je.und(t[2])?10:t[2],.1,100),o=Zi(Je.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,h=l<1?(l*a+-o)/c:-o+a;function d(p){var g=e?e*p/1e3:p;return l<1?g=Math.exp(-g*l*a)*(u*Math.cos(c*g)+h*Math.sin(c*g)):g=(u+h*g)*Math.exp(-g*a),p===0||p===1?p:1-g}function f(){var p=ep.springs[i];if(p)return p;for(var g=1/6,x=0,y=0;;)if(x+=g,d(x)===1){if(y++,y>=16)break}else y=0;var m=x*g*1e3;return ep.springs[i]=m,m}return e?d:f}function eG(i){return i===void 0&&(i=10),function(e){return Math.ceil(Zi(e,1e-6,1)*i)*(1/i)}}var tG=function(){var i=11,e=1/(i-1);function t(u,h){return 1-3*h+3*u}function r(u,h){return 3*h-6*u}function n(u){return 3*u}function s(u,h,d){return((t(h,d)*u+r(h,d))*u+n(h))*u}function o(u,h,d){return 3*t(h,d)*u*u+2*r(h,d)*u+n(h)}function a(u,h,d,f,p){var g,x,y=0;do x=h+(d-h)/2,g=s(x,f,p)-u,g>0?d=x:h=x;while(Math.abs(g)>1e-7&&++y<10);return x}function l(u,h,d,f){for(var p=0;p<4;++p){var g=o(h,d,f);if(g===0)return h;var x=s(h,d,f)-u;h-=x/g}return h}function c(u,h,d,f){if(!(0<=u&&u<=1&&0<=d&&d<=1))return;var p=new Float32Array(i);if(u!==h||d!==f)for(var g=0;g<i;++g)p[g]=s(g*e,u,d);function x(y){for(var m=0,v=1,w=i-1;v!==w&&p[v]<=y;++v)m+=e;--v;var b=(y-p[v])/(p[v+1]-p[v]),T=m+b*e,_=o(T,u,d);return _>=.001?l(y,T,u,d):_===0?T:a(y,m,m+e,u,d)}return function(y){return u===h&&d===f||y===0||y===1?y:s(x(y),h,f)}}return c}(),XA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Zi(r,1,10),o=Zi(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function Wy(i,e){if(Je.fnc(i))return i;var t=i.split("(")[0],r=XA[t],n=WA(i);switch(t){case"spring":return qA(i,e);case"cubicBezier":return jy(tG,n);case"steps":return jy(eG,n);default:return jy(r,n)}}function YA(i){try{var e=document.querySelectorAll(i);return e}catch(t){return}}function tp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function rp(i){return i.reduce(function(e,t){return e.concat(Je.arr(t)?rp(t):t)},[])}function JA(i){return Je.arr(i)?i:(Je.str(i)&&(i=YA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function qy(i,e){return i.some(function(t){return t===e})}function Xy(i){var e={};for(var t in i)e[t]=i[t];return e}function Yy(i,e){var t=Xy(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function np(i,e){var t=Xy(i);for(var r in e)t[r]=Je.und(i[r])?e[r]:i[r];return t}function rG(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function nG(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function iG(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(d,f,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(f-d)*6*p:p<1/2?f:p<2/3?d+(f-d)*(2/3-p)*6:d}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,h=2*n-u;a=o(h,u,t+1/3),l=o(h,u,t),c=o(h,u,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function sG(i){if(Je.rgb(i))return rG(i);if(Je.hex(i))return nG(i);if(Je.hsl(i))return iG(i)}function Ss(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function oG(i){if(Bu(i,"translate")||i==="perspective")return"px";if(Bu(i,"rotate")||Bu(i,"skew"))return"deg"}function Jy(i,e){return Je.fnc(i)?i(e.target,e.id,e.total):i}function $i(i,e){return i.getAttribute(e)}function Qy(i,e,t){var r=Ss(e);if(qy([t,"deg","rad","turn"],r))return e;var n=ep.CSS[e+t];if(!Je.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return ep.CSS[e+t]=c,c}function QA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?Qy(i,n,t):n}}function Ky(i,e){if(Je.dom(i)&&!Je.inp(i)&&($i(i,e)||Je.svg(i)&&i[e]))return"attribute";if(Je.dom(i)&&qy($U,e))return"transform";if(Je.dom(i)&&e!=="transform"&&QA(i,e))return"css";if(i[e]!=null)return"object"}function KA(i){if(!!Je.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function aG(i,e,t,r){var n=Bu(e,"scale")?1:0+oG(e),s=KA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Qy(i,s,r):s}function Zy(i,e,t,r){switch(Ky(i,e)){case"transform":return aG(i,e,r,t);case"css":return QA(i,e,t);case"attribute":return $i(i,e);default:return i[e]||0}}function $y(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=Ss(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function ZA(i,e){if(Je.col(i))return sG(i);if(/\s/g.test(i))return i;var t=Ss(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function ex(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function lG(i){return Math.PI*2*$i(i,"r")}function cG(i){return $i(i,"width")*2+$i(i,"height")*2}function uG(i){return ex({x:$i(i,"x1"),y:$i(i,"y1")},{x:$i(i,"x2"),y:$i(i,"y2")})}function $A(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=ex(r,s)),r=s}return t}function hG(i){var e=i.points;return $A(i)+ex(e.getItem(e.numberOfItems-1),e.getItem(0))}function e_(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return lG(i);case"rect":return cG(i);case"line":return uG(i);case"polyline":return $A(i);case"polygon":return hG(i)}}function dG(i){var e=e_(i);return i.setAttribute("stroke-dasharray",e),e}function fG(i){for(var e=i.parentNode;Je.svg(e)&&Je.svg(e.parentNode);)e=e.parentNode;return e}function t_(i,e){var t=e||{},r=t.el||fG(i),n=r.getBoundingClientRect(),s=$i(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function pG(i,e){var t=Je.str(i)?YA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:t_(t),totalLength:e_(t)*(r/100)}}}function mG(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=t_(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function r_(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ZA(Je.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Je.str(i)||e?r.split(t):[]}}function n_(i){var e=i?rp(Je.arr(i)?i.map(JA):JA(i)):[];return tp(e,function(t,r,n){return n.indexOf(t)===r})}function i_(i){var e=n_(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:KA(t)}}})}function gG(i,e){var t=Xy(e);if(/^spring/.test(t.easing)&&(t.duration=qA(t.easing)),Je.arr(i)){var r=i.length,n=r===2&&!Je.obj(i[0]);n?i={value:i}:Je.fnc(e.duration)||(t.duration=e.duration/r)}var s=Je.arr(i)?i:[i];return s.map(function(o,a){var l=Je.obj(o)&&!Je.pth(o)?o:{value:o};return Je.und(l.delay)&&(l.delay=a?0:e.delay),Je.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return np(o,t)})}function yG(i){for(var e=tp(rp(i.map(function(s){return Object.keys(s)})),function(s){return Je.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Je.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function xG(i,e){var t=[],r=e.keyframes;r&&(e=np(yG(r),e));for(var n in e)Je.key(n)&&t.push({name:n,tweens:gG(e[n],i)});return t}function vG(i,e){var t={};for(var r in i){var n=Jy(i[r],e);Je.arr(n)&&(n=n.map(function(s){return Jy(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function bG(i,e){var t;return i.tweens.map(function(r){var n=vG(r,e),s=n.value,o=Je.arr(s)?s[1]:s,a=Ss(o),l=Zy(e.target,i.name,a,e),c=t?t.to.original:l,u=Je.arr(s)?s[0]:c,h=Ss(u)||Ss(l),d=a||h;return Je.und(o)&&(o=c),n.from=r_(u,d),n.to=r_($y(o,u),d),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Wy(n.easing,n.duration),n.isPath=Je.pth(s),n.isColor=Je.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var s_={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function o_(i,e){var t=i_(i);t.forEach(function(r){for(var n in e){var s=Jy(e[n],r),o=r.target,a=Ss(s),l=Zy(o,n,a,r),c=a||Ss(l),u=$y(ZA(s,c),l),h=Ky(o,n);s_[h](o,n,u,r.transforms,!0)}})}function wG(i,e){var t=Ky(i.target,e.name);if(t){var r=bG(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function SG(i,e){return tp(rp(i.map(function(t){return e.map(function(r){return wG(t,r)})})),function(t){return!Je.und(t)})}function a_(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var l_=0;function MG(i){var e=Yy(jA,i),t=Yy(Hy,i),r=xG(t,i),n=i_(i.targets),s=SG(n,r),o=a_(s,t),a=l_;return l_++,np(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Ln=[],c_=[],ip,AG=function(){function i(){ip=requestAnimationFrame(e)}function e(t){var r=Ln.length;if(r){for(var n=0;n<r;){var s=Ln[n];if(!s.paused)s.tick(t);else{var o=Ln.indexOf(s);o>-1&&(Ln.splice(o,1),r=Ln.length)}n++}i()}else ip=cancelAnimationFrame(ip)}return i}();function _G(){document.hidden?(Ln.forEach(function(i){return i.pause()}),c_=Ln.slice(0),Er.running=Ln=[]):c_.forEach(function(i){return i.play()})}typeof document!="undefined"&&document.addEventListener("visibilitychange",_G);function Er(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(v){var w=window.Promise&&new Promise(function(b){return o=b});return v.finished=w,w}var l=MG(i),c=a(l);function u(){var v=l.direction;v!=="alternate"&&(l.direction=v!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(w){return w.reversed=l.reversed})}function h(v){return l.reversed?l.duration-v:v}function d(){e=0,t=h(l.currentTime)*(1/Er.speed)}function f(v,w){w&&w.seek(v-w.timelineOffset)}function p(v){if(l.reversePlayback)for(var b=s;b--;)f(v,n[b]);else for(var w=0;w<s;w++)f(v,n[w])}function g(v){var w=0,b=l.animations,T=b.length;for(l.reversePlayback===!0&&l.rewind===!1&&(v=l.duration-v);w<T;){var _=b[w],S=_.animatable,N=_.tweens,C=N.length-1,M=N[C];C&&(M=tp(N,function(ce){return v<ce.end})[0]||M);for(var E=Zi(v-M.start-M.delay,0,M.duration)/M.duration,D=isNaN(E)?1:M.easing(E),O=M.to.strings,F=M.round,k=[],W=M.to.numbers.length,j=void 0,Z=0;Z<W;Z++){var U=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var G=M.to.numbers[Z],R=M.from.numbers[Z]||0;else var R=M.to.numbers[Z],G=M.from.numbers[Z]||0;M.isPath?U=mG(M.value,D*R):U=G+D*(R-G),F&&(M.isColor&&Z>2||(U=Math.round(U*F)/F)),k.push(U)}var J=O.length;if(!J)j=k[0];else{j=O[0];for(var re=0;re<J;re++){var se=O[re],V=O[re+1],he=k[re];isNaN(he)||(V?j+=he+V:j+=he+" ")}}s_[_.type](S.target,_.property,j,S.transforms),_.currentValue=j,w++}}function x(v){l[v]&&!l.passThrough&&l[v](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function m(v){var w=l.duration,b=l.delay,T=w-l.endDelay,_=h(v);l.progress=Zi(_/w*100,0,100),l.reversePlayback=_<l.currentTime,n&&p(_),!l.began&&l.currentTime>=0&&(l.began=!0,x("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,x("loopBegin")),_<=b&&l.currentTime!==0&&g(0),(_>=T&&l.currentTime!==w||!w)&&g(w),_>b&&_<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,x("changeBegin")),x("change"),g(_)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,x("changeComplete")),l.currentTime=Zi(_,0,w),l.began&&x("update"),v>=w&&(t=0,y(),l.remaining?(e=r,x("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,x("loopComplete"),x("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var v=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=v==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var w=s;w--;)l.children[w].reset();(l.reversed&&l.loop!==!0||v==="alternate"&&l.loop===1)&&l.remaining++,g(l.reversed?l.duration:0)},l.set=function(v,w){return o_(v,w),l},l.tick=function(v){r=v,e||(e=r),m((r+(t-e))*Er.speed)},l.seek=function(v){m(h(v))},l.pause=function(){l.paused=!0,d()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Ln.push(l),d(),ip||AG())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function u_(i,e){for(var t=e.length;t--;)qy(i,e[t].animatable.target)&&e.splice(t,1)}function TG(i){for(var e=n_(i),t=Ln.length;t--;){var r=Ln[t],n=r.animations,s=r.children;u_(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;u_(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function EG(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Wy(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=Je.arr(i),h=parseFloat(u?i[0]:i),d=u?parseFloat(i[1]):0,f=Ss(u?i[1]:i)||0,p=e.start||0+(u?h:0),g=[],x=0;return function(y,m,v){if(a&&(o=0),l&&(o=(v-1)/2),c&&(o=v-1),!g.length){for(var w=0;w<v;w++){if(!n)g.push(Math.abs(o-w));else{var b=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),_=w%n[0],S=Math.floor(w/n[0]),N=b-_,C=T-S,M=Math.sqrt(N*N+C*C);s==="x"&&(M=-N),s==="y"&&(M=-C),g.push(M)}x=Math.max.apply(Math,g)}r&&(g=g.map(function(D){return r(D/x)*x})),t==="reverse"&&(g=g.map(function(D){return s?D<0?D*-1:-D:Math.abs(x-D)}))}var E=u?(d-h)/x:h;return p+E*(Math.round(g[m]*100)/100)+f}}function CG(i){i===void 0&&(i={});var e=Er(i);return e.duration=0,e.add=function(t,r){var n=Ln.indexOf(e),s=e.children;n>-1&&Ln.splice(n,1);function o(d){d.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=np(t,Yy(Hy,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Je.und(r)?c:$y(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=Er(l);o(u),s.push(u);var h=a_(s,i);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Er.version="3.2.0";Er.speed=1;Er.running=Ln;Er.remove=TG;Er.get=Zy;Er.set=o_;Er.convertPx=Qy;Er.path=pG;Er.setDashoffset=dG;Er.stagger=EG;Er.timeline=CG;Er.easing=Wy;Er.penner=XA;Er.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var Ou=Er;function h_(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Fu(i,e,t){switch(i){case fn.LINEAR:return"cubicBezier( 0, 0, 1, 1 )";case fn.EASE:return"cubicBezier( .25, .1, .25, 1 )";case fn.EASE_IN:return"cubicBezier( .42, 0, 1, 1 )";case fn.EASE_OUT:return"cubicBezier( 0, 0, .58, 1 )";case fn.EASE_IN_OUT:return"cubicBezier( .42, 0, .58, 1 )";case fn.CUBIC:let{control1:r,control2:n}=e;return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case fn.SPRING:let{mass:s,stiffness:o,damping:a,velocity:l}=t;return`spring( ${s}, ${o}, ${a}, ${l} )`}}function d_(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}function f_(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}var tx=new A,rx=new A,p_=new jt,LG=new In,PG=new Ae;function m_(i,e,t){let r=[];if(DG(i,e==null?void 0:e.objectState,t.objectState,r),Sl(i)){if("geometry"in t.objectState&&OG(i,t.objectState.geometry,r),"material"in t.objectState||"materials"in t.objectState){let[n,s]=d_(i,t.objectState,i.selectedMaterial);n&&s&&typeof s!="string"&&UG(n,s,r)}}else w1(i)?BG(i,t.objectState,r):b1(i)&&RG(i,t.objectState,r);return{change:n=>{r.forEach(s=>s.change(n))}}}function DG(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;Br.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(Br.lerp(n,s,o)),i.updateMatrix()}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;Br.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(Br.lerp(n,s,o)),i.updateMatrix()}})}IG(i,e,t,r),NG(i,t,r)}function IG(i,e,t,r){if(t.rotation===void 0)return;let n=tx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(Br.isEqual(n,s))return;if(Br.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new jt().setFromEuler(LG.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{f_(a,l,i.quaternion,c),i.updateMatrix()}})}else r.push({change:a=>{i.rotation.setFromVector3(rx.fromArray(Br.lerp(n,s,a))),i.updateMatrix()}})}function NG(i,e,t){if(e.hiddenMatrix!==void 0&&!Bi.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,n=new jt,s=new A;i.hiddenMatrix.decompose(r,n,s);let o=new A,a=new jt,l=new A;PG.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{p_.slerpQuaternions(n,a,c),tx.lerpVectors(r,o,c),rx.lerpVectors(s,l,c),i.hiddenMatrix.compose(tx,p_,rx)}})}}function RG(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=tt.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=tt.lerp(o,a,l)}})}}function BG(i,e,t){if(e.intensity!==void 0){let r=i.intensity,n=e.intensity;r!==n&&t.push({change:s=>{i.intensity=tt.lerp(r,n,s)}})}if(e.color!==void 0&&typeof e.color!="string"){let r=i.color.clone(),n=e.color;Or.equals(r,n)||t.push({change:s=>{let{r:o,g:a,b:l}=Or.lerp(r,n,s);i.color.setRGB(o,a,l)}})}}function OG(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];Br.isEqual(o,a)||t.push({change:l=>{let[c,u,h]=Br.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:u,depth:h}})}})}}var FG=["mode","gradientType","noiseType","displacementType","crop"];function UG(i,e,t){let r=i.layersList.head;for(;r;){let n=e.layers.data(r.uuid);if(n){let s=r.getNames().filter(o=>!FG.some(a=>o.includes(a)));for(let o of s)try{let a=r.getValue(o);if(o==="steps")HG(r,n,o,t);else if(o==="colors")jG(r,n,o,t);else if(typeof a=="number")GG(r,n,o,t);else{if(typeof a=="boolean")continue;"isVector2"in a?zG(r,n,o,t):"isVector3"in a?kG(r,n,o,t):"isColor"in a?VG(r,n,o,t):"isTexture"in a&&WG(r,n,o,t)}}catch(a){console.error(`animateMaterial: unexpected material layer for ${o}`,a)}}r=r.next}}function GG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,tt.lerp(n,s,o))}})}function zG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];fs.isEqual(s,o)||r.push({change:a=>{n.fromArray(fs.lerp(s,o,a))}})}function kG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];Br.isEqual(s,o)||r.push({change:a=>{n.fromArray(Br.lerp(s,o,a))}})}function VG(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.clone(),o=e[t];Or.equals(s,o)||r.push({change:a=>{let{r:l,g:c,b:u}=Or.lerp(s,o,a);n.setRGB(l,c,u)}})}function HG(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=tt.lerp(a,l,c),i.setValue("steps",n)}})}}function jG(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Fc.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Fc.lerp(a,l,c))}})}}function WG(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!fs.isEqual(o,l)||!fs.isEqual(a,c))&&r.push({change:u=>{n.repeat.fromArray(fs.lerp(o,l,u)),n.offset.fromArray(fs.lerp(a,c,u)),n.updateMatrix(),n.needsUpdate=!0}})}var Ms;(function(r){r[r.started=0]="started",r[r.ended=1]="ended",r[r.once=2]="once"})(Ms||(Ms={}));var es=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=tt.generateUUID();this.states=[];this.events=[];this._scrollCounter=null}static get isAllAnimationsEnded(){let e;for(let t in es.isAnimating){if(es.isAnimating[t]===2)return es.isAnimating[t]=1,!1;if(es.isAnimating[t]===0)return!1;e=!0}return e}computeCache(){return this.cache={mouseDown:this.events.find(e=>e.type===$e.MOUSE_DOWN),mouseUp:this.events.find(e=>e.type===$e.MOUSE_UP),mouseHover:this.events.find(e=>e.type===$e.MOUSE_HOVER),start:this.events.find(e=>e.type===$e.START),lookAt:this.events.find(e=>e.type===$e.LOOK_AT),follow:this.events.find(e=>e.type===$e.FOLLOW),keyDown:this.events.filter(e=>e.type===$e.KEY_DOWN),keyUp:this.events.filter(e=>e.type===$e.KEY_UP),scroll:this.events.find(e=>e.type===$e.SCROLL)},this.cache}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._currentState=this.states[0],this._prevState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),this.object.updateMatrix(),(t=this._animation)==null||t.finished.then(()=>{this.lookAt(e),this.object.updateMatrix()})}follow(e){this.object.position.copy(e),this.object.parent!==null&&this.object.position.applyMatrix4(new Ae().copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4(new Ae().copy(this.object.hiddenMatrix).invert()),this.object.updateMatrix()}play(e){this.object.visible&&e.state!==void 0&&this.animate(e.state,e)}seek(e,t,r){var n;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),es.isAnimating[e.state.uuid]=2,(n=this._animation)==null||n.seek(this._scrollCounter/r*e.duration)}reverse(e){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e)}animate(e,t,r=!1){var n,s,o,a,l,c;if(es.isAnimating[e.uuid]=0,this._currentState===e){if((n=this._animation)==null?void 0:n.reversed){let u=(o=(s=this._animation)==null?void 0:s.currentTime)!=null?o:0;(a=this._animation)==null||a.reset(),(l=this._animation)==null||l.seek(u),(c=this._animation)==null||c.play()}}else{this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&(es.isAnimating[this._prevState.uuid]=1,this._animation.pause()),t.cycle===!0&&t.repeat===!0?this._animation=Ou.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!0&&t.repeat===!1?this._animation=Ou.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!1&&t.repeat===!0?this._animation=Ou.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):this._animation=Ou.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:Fu(t.easing,t.cubicControls,t.springParameters),autoplay:!r}),this._animation.finished.then(()=>{r||(this._animation=void 0,es.isAnimating[e.uuid]=1)});let u=m_(this.object,this._prevState,this._currentState),h={t:0};this._animation.add({targets:h,t:1,change:()=>u.change(h.t)},0)}}},Ol=es;Ol.isAnimating={};var nx=class{constructor(e){this.eventState=e;this.targets=[]}get type(){return this.eventState.type}get key(){return this.eventState.type===$e.KEY_DOWN||this.eventState.type===$e.KEY_UP?this.eventState.key:null}get url(){return this.eventState.type===$e.KEY_DOWN||this.eventState.type===$e.KEY_UP||this.eventState.type===$e.MOUSE_DOWN||this.eventState.type===$e.MOUSE_UP?this.eventState.url:null}get steps(){return this.eventState.type===$e.SCROLL?this.eventState.steps:null}get distance(){return this.eventState.type===$e.LOOK_AT?this.eventState.distance:null}dispatchReverse(){var e;for(let t=0,r=this.targets.length;t<r;++t){let n=this.targets[t];n.state!==void 0&&n.object!==void 0&&((e=n.object.interaction)==null||e.reverse(n))}}dispatch(e){var t,r;this.url!==void 0&&(this.type===$e.MOUSE_DOWN||this.type===$e.MOUSE_UP||this.type===$e.KEY_DOWN||this.type===$e.KEY_UP)&&(h_()?window.location.assign(this.url):window.open(this.url,"_blank"));for(let n=0,s=this.targets.length;n<s;++n){let o=this.targets[n];o.state!==void 0&&o.object!==void 0&&(this.type===$e.SCROLL?(t=o.object.interaction)==null||t.seek(o,e,this.steps):(r=o.object.interaction)==null||r.play(o))}}};var Uu=class{constructor(e){this.targetState=e}static create(e,t){var n;let r=new Uu(e);if(e.object){let s=t.find(e.object);if(r.object=s,s==null?void 0:s.interaction){let o=s.interaction.states;r.state=e.state&&(n=o.find(a=>a.uuid===e.state))!=null?n:o[0]}}return r}get cubicControls(){let e=this.targetState;return e.easing===fn.CUBIC?{control1:e.control1,control2:e.control2}:ne({},Pd.defaultData)}get springParameters(){let e=this.targetState;return e.easing===fn.SPRING?e:ne({},Ld.defaultData)}get easing(){return this.targetState.easing}get duration(){return this.targetState.duration}get delay(){return this.targetState.delay}get repeat(){return this.targetState.repeat}get cycle(){return this.targetState.cycle}get rewind(){return this.targetState.rewind}};var g_=new an,Fl=class extends nn{},ix=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new yt(2048,2048,{generateMipmaps:!0,minFilter:Ei,magFilter:ot,wrapS:Mr,wrapT:Mr}),this.transmissionRenderTarget.depthTexture=new Di(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ay(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===g_}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:g_}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Fl(t.r,t.g,t.b,t.a):this.colors[e]=new Fl(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function qG(i,e){switch(i.type){case ht.NOISE:return e==="noiseType";case ht.TEXTURE:return e==="projection"||e==="axis";case ht.DISPLACE:return e==="noiseType";case ht.DEPTH:return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function sx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||kf(a,t,n))continue;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Ft:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof Fl?c.value=new nn(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case Wi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof Fl?c.value=new nn(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Xr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case Yr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case sn:{let u=l;"image"in u&&(c.value.image=e.getImage(u.image)),"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&c.value.repeat.fromArray(u.repeat),"offset"in u&&c.value.offset.fromArray(u.offset),c.value.needsUpdate=!0;break}case lo:{l.forEach((u,h)=>{c.value[h].setX(u[0]),c.value[h].setY(u[1]),c.value[h].setZ(u[2]),c.value[h].setW(u[3])});break}default:{s=s||qG(t,a),c.value=l;break}}}if(s&&n){let a=zf({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,ne({},a)),r.dispose(),r.needsUpdate=!0}}function y_(i,e,t){let r=[];i.objects.traverse((n,s)=>{if(s.states===void 0)return;let o=e.find(n),a=new Ol(o,t);o.interaction=a,ox(o,s,null,t),a.states.push(Ul.create(n,s));for(let l of s.states){let c=jc.patch(s,l.data);a.states.push(Ul.create(l.id,c))}if(s.events)for(let{data:l}of s.events){let c=new nx(l);a.events.push(c),"targets"in l&&r.push([l,c])}});for(let[n,s]of r)if("targets"in n)for(let{data:o}of n.targets){let a=Uu.create(o,e);s.targets.push(a)}}function ox(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:jc.patch(e,e.states.data(t));if(Zg(i,s),i instanceof ir&&s.type==="Mesh"){if(i instanceof Qo?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);sx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);sx(c.data,r,u,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof ni&&eo.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var Ul=class{constructor(e){this.objectState=e;this.uuid=tt.generateUUID()}static create(e,t){let r=new Ul(t);return r.uuid=e,r}execute(e,t){ox(e,this.objectState,null,t,!0)}};var ax=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._enableEvent={};this._map={};this._prevAncestors=[];this._raycaster=new Ig;this._intersection=new A;this._plane=new vn;this._normal=new A;this._position=new A;this._onMouseDown=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()};this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()};this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()};this._onWheel=e=>{this._handleWheelEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)};this._onTouchMove=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)};this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)};this._domElement=e,this._scene=t,this._camera=r,this._app=n}activate(){this.isEnable=!0,this._scene.traverseEntity(e=>{if(e.interaction!==void 0){e.interaction.start();for(let t of e.interaction.events){let r=t.type;this._addCustomEvent(r,e),this._enableEvent[r]=!0,(r===$e.KEY_DOWN||r===$e.KEY_UP||r===$e.START||r===$e.LOOK_AT||r===$e.FOLLOW||r===$e.SCROLL)&&(this._map[r]===void 0&&(this._map[r]=[]),this._map[r].push(e))}}}),this._enableEvent[$e.START]!==void 0&&this._handleStartEvent(),this._enableEvent[$e.MOUSE_DOWN]!==void 0&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),this._enableEvent[$e.MOUSE_UP]!==void 0&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),(this._enableEvent[$e.MOUSE_HOVER]!==void 0||this._enableEvent[$e.LOOK_AT]!==void 0||this._enableEvent[$e.FOLLOW]!==void 0)&&(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),this._enableEvent[$e.KEY_DOWN]!==void 0&&document.addEventListener("keydown",this._onKeyDown,!1),this._enableEvent[$e.KEY_UP]!==void 0&&document.addEventListener("keyup",this._onKeyUp,!1),this._enableEvent[$e.SCROLL]!==void 0&&this._domElement.addEventListener("wheel",this._onWheel,!1)}deactivate(){this._scene.traverseEntity(e=>{e.interaction!==void 0&&(e.interaction.end(),e.interaction.cache=void 0)}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect();return{x:(e-r.left)/r.width*2-1,y:-((t-r.top)/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map[$e.START])==null||e.forEach(t=>{var r;(r=t.interactionCache.start)==null||r.dispatch()})}_handleWheelEvent(e){var t;(t=this._map[$e.SCROLL])==null||t.forEach(r=>{var n;this._dispatchDOMCustomEvent("scroll",r.uuid),(n=r.interactionCache.scroll)==null||n.dispatch(e.deltaY>0?1:-1)})}_handleMouseDownEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseDown",s.uuid),(t=s.interactionCache.mouseDown)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseDown",o.uuid),(a=o.interactionCache.mouseDown)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseUpEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseUp",s.uuid),(t=s.interactionCache.mouseUp)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseUp",o.uuid),(a=o.interactionCache.mouseUp)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,r;if(this._enableEvent[$e.MOUSE_HOVER]!==void 0){let n;if(!e){let o=this._raycastMesh(this._raycaster).find(a=>!a.object.interactionCache.follow);n=o?o.object:void 0}if(this._prevObject!==n){this._prevObject!==void 0&&((t=this._prevObject.interactionCache.mouseHover)==null||t.dispatchReverse()),n!==void 0&&(this._dispatchDOMCustomEvent("mouseHover",n.uuid),(r=n.interactionCache.mouseHover)==null||r.dispatch());let s=[];n==null||n.traverseAncestors(l=>{l instanceof ii&&l.interactionCache.mouseHover&&s.push(l)}),this._prevAncestors.filter(l=>{var c;return s.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatchReverse(),!0)});let o=s.filter(l=>{var c;return this._prevAncestors.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatch(),!0)}),a=this._prevAncestors.filter(l=>s.includes(l));this._prevAncestors=[...a,...o]}this._prevObject=n}}_handleLookAtEvent(){var e;(e=this._map[$e.LOOK_AT])==null||e.forEach(t=>{var n,s;let r=(n=t.interactionCache.lookAt)==null?void 0:n.distance;this._dispatchDOMCustomEvent("lookAt",t.uuid),r!==void 0&&(this._plane.set(this._normal,-r),this._raycaster.ray.intersectPlane(this._plane,this._intersection),(s=t.interaction)==null||s.lookAt(this._intersection))}),this._app.requestRender()}_handleFollowEvent(){var e;(e=this._map[$e.FOLLOW])==null||e.forEach(t=>{var r;this._dispatchDOMCustomEvent("follow",t.uuid),this._plane.setFromNormalAndCoplanarPoint(this._normal,t.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),(r=t.interaction)==null||r.follow(this._intersection)}),this._app.requestRender()}_handleKeyDownEvent(e){var t;(t=this._map[$e.KEY_DOWN])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyDown)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyDown",r.uuid),n==null||n.dispatch()})}_handleKeyUpEvent(e){var t;(t=this._map[$e.KEY_UP])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyUp)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyUp",r.uuid),n==null||n.dispatch()})}_raycastMesh(e){let t=[],r=n=>{for(let s of n.children)Tn(s)&&!s.raycastLock&&s.visible&&(W1(s)&&e.intersectObject(s,!1,t),r(s))};return r(this._scene),t}_addCustomEvent(e,t){let r=(()=>{switch(e){case 0:return"mouseDown";case 1:return"mouseUp";case 2:return"mouseHover";case 5:return"keyDown";case 6:return"keyUp";case 7:return"start";case 9:return"lookAt";case 10:return"follow";case 11:return"scroll"}})();if(r){let n=new CustomEvent(r,{bubbles:!0});Object.defineProperty(n,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[r]?this.splineEvents[r][t.uuid]=n:this.splineEvents[r]={[t.uuid]:n}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var lx=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=XG(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function XG(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var cx=class{constructor(e){this.sharedAssets=new ix(e.shared),this.scene=new Vy(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var ux=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function YG(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function hx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function JG(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof ir)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof ir&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!ki.isMergable(o))return}else{let u=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(u&&"material"in u&&typeof u.material!="string"){if(!ki.isMergable(u.material))return;s=ki.getHash(u.material)}}t[s]||(t[s]={});let l=t[s][hx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let u of r.cloner.children)l.push(u)}else if(t[s][hx(r.objectType)]=[r],r.cloner)for(let u of r.cloner.children)t[s][hx(r.objectType)].push(u)}),t}function QG(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function x_(i,e){let t=JG(e,i),r=QG(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,u=new Array(r),h=0;for(let d of Object.values(t))for(let f of Object.values(d)){if(a=0,c=0,f.forEach(g=>{g instanceof ir&&(o[a++]=g.geometry.clone(),l[c++]=g)}),c<2)continue;for(let g=0;g<c;g++)l[g].updateWorldMatrix(!0,!1),o[g].applyMatrix4(l[g].matrixWorld),l[g].matrixWorld.determinant()<0&&YG(o[g]);let p=yM(o.slice(0,a),!1);if(p){let g;switch(f[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),g=new Vt(p,l[0].material);break}default:{g=new Vt(p,l[0].material);break}}g.castShadow=l[0].castShadow,g.receiveShadow=l[0].receiveShadow,e.add(g);let x=y=>{h=0;for(let m of y)m.children&&x(m.children),m instanceof ir&&(Array.isArray(m.material)||t[m.material.uuid]&&t[m.material.uuid][m.objectType]&&t[m.material.uuid][m.objectType].length>1||(u[h++]=m));for(let m=0;m<h;m++)e.attach(u[m])};for(let y=0;y<c;y++){let m=l[y];x(m.children),n[s++]=m}}}for(let d=0;d<s;d++)n[d].removeFromParent()}var Gl=".",Gu=Symbol("target"),dx=Symbol("unsubscribe");function zu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function v_(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var jn=Array.isArray;function Zo(i){return typeof i=="symbol"}var KG={after:(i,e)=>jn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>jn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Gl),Zo(e)?i+e.toString():i+e):i,initial:i=>{if(jn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Gl);return e===-1?"":i.slice(0,e)},last:i=>{if(jn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Gl);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(jn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Gl);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Gl,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},yn=KG;function fx(i){return typeof i=="object"&&typeof i.next=="function"}function px(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[Gu].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function sp(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Zo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var op=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,yn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function zl(i){return toString.call(i)==="[object Object]"}function kl(){return!0}function po(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var ap=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var ZG=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),mx={push:kl,pop:kl,shift:kl,unshift:kl,copyWithin:po,reverse:po,sort:po,splice:po,flat:po,fill:po},b_=new Set([...ap,...ZG,...Object.keys(mx)]);function Vl(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var gx=["keys","values","entries"],yx=new Set(["has","toString"]),xx={add:Vl,clear:Vl,delete:Vl,forEach:Vl},w_=new Set([...yx,...Object.keys(xx),...gx]);function Hl(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var $G=new Set([...yx,"get"]),vx={set:Hl,clear:Hl,delete:Hl,forEach:Hl},S_=new Set([...$G,...Object.keys(vx),...gx]);var Qr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return ap.has(e)}_shallowClone(e){let t=e;if(zl(e))t=ne({},e);else if(jn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(jn(n)?this._onIsChanged=mx[t]:n instanceof Set?this._onIsChanged=xx[t]:n instanceof Map&&(this._onIsChanged=vx[t]),n):r}update(e,t,r){let n=yn.after(e,this._path);if(t!=="length"){let s=this.clone;yn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],yn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var ku=class extends Qr{static isHandledMethod(e){return b_.has(e)}};var lp=class extends Qr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var Vu=class extends Qr{static isHandledMethod(e){return w_.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var Hu=class extends Qr{static isHandledMethod(e){return S_.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var cp=class extends Qr{constructor(e,t,r,n){super(void 0,t,r,n);this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var up=class extends Qr{constructor(e,t,r,n){super(void 0,t,r,n);this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ts=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return zl(e)||jn(e)||zu(e)}static isHandledMethod(e,t){return zl(e)?Qr.isHandledMethod(t):jn(e)?ku.isHandledMethod(t):e instanceof Set?Vu.isHandledMethod(t):e instanceof Map?Hu.isHandledMethod(t):zu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Qr;jn(e)?n=ku:e instanceof Date?n=lp:e instanceof Set?n=Vu:e instanceof Map?n=Hu:e instanceof WeakSet?n=cp:e instanceof WeakMap&&(n=up),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ts.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var ez={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},bx=(i,e,t={})=>{t=ne(ne({},ez),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new op(n),c=typeof t.onValidate=="function",u=new ts(c),h=(m,v,w,b,T)=>!c||u.isCloning||t.onValidate(yn.concat(l.getPath(m),v),w,b,T)===!0,d=(m,v,w,b)=>{!sp(l,t,v)&&!(o&&l.isDetached(m,i))&&f(l.getPath(m),v,w,b)},f=(m,v,w,b,T)=>{u.isCloning?u.update(m,v,b):e(yn.concat(m,v),w,b,T)},p=m=>m&&(m[r]||m),g=(m,v,w,b)=>v_(m)||w==="constructor"||s&&!ts.isHandledMethod(v,w)||sp(l,t,w)||l.isGetInvariant(v,w)||o&&l.isDetached(v,i)?m:(b===void 0&&(b=l.getPath(v)),l.getProxy(m,yn.concat(b,w),x,r)),x={get(m,v,w){if(Zo(v)){if(v===r||v===Gu)return m;if(v===dx&&!l.isUnsubscribed&&l.getPath(m).length===0)return l.unsubscribe(),m}let b=zu(m)?Reflect.get(m,v):Reflect.get(m,v,w);return g(b,m,v)},set(m,v,w,b){w=p(w);let T=m[r]||m,_=T[v];if(n(_,w)&&v in m)return!0;let S=h(m,v,w,_);return S&&l.setProperty(T,v,w,b,_)?(d(m,v,m[v],_),!0):!S},defineProperty(m,v,w){if(!l.isSameDescriptor(w,m,v)){let b=m[v];h(m,v,w.value,b)&&l.defineProperty(m,v,w,b)&&d(m,v,w.value,b)}return!0},deleteProperty(m,v){if(!Reflect.has(m,v))return!0;let w=Reflect.get(m,v),b=h(m,v,void 0,w);return b&&l.deleteProperty(m,v,w)?(d(m,v,void 0,w),!0):!b},apply(m,v,w){let b=v[r]||v;if(l.isUnsubscribed)return Reflect.apply(m,b,w);if((a===!1||a!==!0&&!a.includes(m.name))&&ts.isHandledType(b)){let T=yn.initial(l.getPath(m)),_=ts.isHandledMethod(b,m.name);u.start(b,T,w);let S=Reflect.apply(m,u.preferredThisArg(m,v,b),_?w.map(M=>p(M)):w),N=u.isChanged(b,n),C=u.stop();if(ts.isHandledType(S)&&_&&(v instanceof Map&&m.name==="get"&&(T=yn.concat(T,w[0])),S=l.getProxy(S,T,x)),N){let M={name:m.name,args:w,result:S},E=u.isCloning?yn.initial(T):T,D=u.isCloning?yn.last(T):"";h(yn.get(i,E),D,b,C,M)?f(E,D,b,C,M):u.undo(b)}return(v instanceof Map||v instanceof Set)&&fx(S)?px(S,m,v,T,g):S}return Reflect.apply(m,v,w)}},y=l.getProxy(i,t.pathAsArray?[]:"",x);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};bx.target=i=>i&&i[Gu]||i;bx.unsubscribe=i=>i[dx]||i;var wx=bx;var mo;(function(t){t[t.FULLSCREEN=1]="FULLSCREEN",t[t.CUSTOM=2]="CUSTOM"})(mo||(mo={}));var tz=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var t,r,n;if(!this._renderer)return;this._rafId=requestAnimationFrame(this.render),(t=this._perfs)==null||t.start();let e=Ol.isAllAnimationsEnded;!this.autoRender&&this._skipRender&&(e===void 0||e)||(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),((r=this._scene.postprocessing)==null?void 0:r.enabled)?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(n=this._perfs)==null||n.end())};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new B(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),((t=this._scene)==null?void 0:t.postprocessing)&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",Rc(this.resize,200)),window.location.search.includes("perfs")&&(this._perfs=new ux({x:10,y:10}))}async load(e){let r=await(await fetch(e)).arrayBuffer();this.start(r)}start(e){var o;let t=Xd.deserialize(new Uint8Array(e));this._publishData=t.scene.publish;let r=new cx(t);if(window.location.search.includes("merge-geometries")){let a=performance.now();x_(t,r.scene);let l=performance.now();console.log("Merged geometries in ",l-a," ms")}this._scene=r.scene,this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},y_(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0];n&&(n.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1])),((o=this._scene.postprocessing)==null?void 0:o.enabled)?(this._renderer=new Dt({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Dt({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new yt(2048,2048,{generateMipmaps:!0,minFilter:Ei,magFilter:ot,wrapS:Mr,wrapT:Mr}),this._transmissionRenderTarget.depthTexture=new Di(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=pp,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new lx(this._renderer,this._camera,new B(this._viewportWidth,this._viewportHeight),new B(window.innerWidth,window.innerHeight)),!0&&(this._controls=new Lg(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new ax(this._renderer.domElement,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}dispose(){var e,t,r,n,s,o,a;(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{wx.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatch()}):s==null||s.dispatch()},emitEventReverse(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatchReverse()}):s==null||s.dispatchReverse()}},r=wx(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};rn.FONTS_PATH="_assets/_fonts/";export{tz as Application};
|