shop-components 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shop-components.cjs +140 -140
- package/dist/shop-components.mjs +1580 -1573
- package/package.json +1 -1
package/dist/shop-components.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Fm=Object.create;var sa=Object.defineProperty;var Lm=Object.getOwnPropertyDescriptor;var Om=Object.getOwnPropertyNames;var km=Object.getPrototypeOf,Nm=Object.prototype.hasOwnProperty;var Um=(r,e,t)=>e in r?sa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Gm=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Om(e))!Nm.call(r,s)&&s!==t&&sa(r,s,{get:()=>e[s],enumerable:!(i=Lm(e,s))||i.enumerable});return r};var zm=(r,e,t)=>(t=r!=null?Fm(km(r)):{},Gm(e||!r||!r.__esModule?sa(t,"default",{value:r,enumerable:!0}):t,r));var N=(r,e,t)=>(Um(r,typeof e!="symbol"?e+"":e,t),t),uc=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var le=(r,e,t)=>(uc(r,e,"read from private field"),t?t.call(r):e.get(r)),si=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},wt=(r,e,t,i)=>(uc(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("three"),Hm=require("three/examples/jsm/loaders/HDRLoader"),dc=require("three/examples/jsm/postprocessing/RenderPass"),fc=require("three/examples/jsm/postprocessing/OutlinePass"),Vm=require("three/examples/jsm/postprocessing/ShaderPass"),Wm=require("three/examples/jsm/shaders/FXAAShader"),$m=require("three/examples/jsm/postprocessing/UnrealBloomPass"),Xm=require("three/examples/jsm/controls/OrbitControls"),jm=require("three/examples/jsm/postprocessing/OutputPass"),Ym=require("three/examples/jsm/postprocessing/EffectComposer"),Lt=require("three/examples/jsm/renderers/CSS2DRenderer"),qm=require("three/examples/jsm/loaders/FontLoader"),Ph=require("three/examples/jsm/loaders/GLTFLoader.js"),Zm=require("three/examples/jsm/libs/meshopt_decoder.module.js"),Km=require("three/examples/jsm/loaders/DRACOLoader.js"),Qm=require("three/examples/jsm/loaders/KTX2Loader.js"),Jm=require("three/examples/jsm/loaders/GLTFLoader"),eg=require("three/examples/jsm/loaders/DRACOLoader"),tg=require("three/examples/jsm/exporters/DRACOExporter"),ig=require("three/examples/jsm/exporters/GLTFExporter"),rg=require("three/examples/jsm/lines/LineSegments2.js"),sg=require("three/examples/jsm/lines/LineSegmentsGeometry.js"),tf=require("three/examples/jsm/lines/LineMaterial.js"),ng=require("three/examples/jsm/lines/Line2.js"),pc=require("three/examples/jsm/lines/LineGeometry.js"),og=require("three/examples/jsm/renderers/CSS3DRenderer"),ag=require("three/examples/jsm/utils/BufferGeometryUtils"),pi=require("three-mesh-bvh"),Kr=require("three/examples/jsm/postprocessing/Pass.js");var go=typeof document<"u"?document.currentScript:null;function rf(r,e,t=0){if(r.isInterleavedBufferAttribute){const i=r.itemSize;for(let s=0,n=r.count;s<n;s++){const o=s+t;e.setX(o,r.getX(s)),i>=2&&e.setY(o,r.getY(s)),i>=3&&e.setZ(o,r.getZ(s)),i>=4&&e.setW(o,r.getW(s))}}else{const i=e.array,s=i.constructor,n=i.BYTES_PER_ELEMENT*r.itemSize*t;new s(i.buffer,n,r.array.length).set(r.array)}}function Cs(r,e=null){const t=r.array.constructor,i=r.normalized,s=r.itemSize,n=e===null?r.count:e;return new y.BufferAttribute(new t(s*n),s,i)}function Er(r,e){if(!r&&!e)return!0;if(!!r!=!!e)return!1;const t=r.count===e.count,i=r.normalized===e.normalized,s=r.array.constructor===e.array.constructor,n=r.itemSize===e.itemSize;return!(!t||!i||!s||!n)}function lg(r){const e=r[0].index!==null,t=new Set(Object.keys(r[0].attributes));if(!r[0].getAttribute("position"))throw new Error("StaticGeometryGenerator: position attribute is required.");for(let i=0;i<r.length;++i){const s=r[i];let n=0;if(e!==(s.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(const o in s.attributes){if(!t.has(o))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+o+'" attribute exists among all geometries, or in none of them.');n++}if(n!==t.size)throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.")}}function hg(r){let e=0;for(let t=0,i=r.length;t<i;t++)e+=r[t].getIndex().count;return e}function cg(r){let e=0;for(let t=0,i=r.length;t<i;t++)e+=r[t].getAttribute("position").count;return e}function ug(r,e,t){r.index&&r.index.count!==e&&r.setIndex(null);const i=r.attributes;for(const s in i)i[s].count!==t&&r.deleteAttribute(s)}function dg(r,e={},t=new y.BufferGeometry){const{useGroups:i=!1,forceUpdate:s=!1,skipAssigningAttributes:n=[],overwriteIndex:o=!0}=e;lg(r);const a=r[0].index!==null,h=a?hg(r):-1,u=cg(r);if(ug(t,h,u),i){let l=0;for(let c=0,f=r.length;c<f;c++){const p=r[c];let g;a?g=p.getIndex().count:g=p.getAttribute("position").count,t.addGroup(l,g,c),l+=g}}if(a){let l=!1;if(t.index||(t.setIndex(new y.BufferAttribute(new Uint32Array(h),1,!1)),l=!0),l||o){let c=0,f=0;const p=t.getIndex();for(let g=0,m=r.length;g<m;g++){const _=r[g],v=_.getIndex();if(!(!s&&!l&&n[g]))for(let b=0;b<v.count;++b)p.setX(c+b,v.getX(b)+f);c+=v.count,f+=_.getAttribute("position").count}}}const d=Object.keys(r[0].attributes);for(let l=0,c=d.length;l<c;l++){let f=!1;const p=d[l];if(!t.getAttribute(p)){const _=r[0].getAttribute(p);t.setAttribute(p,Cs(_,u)),f=!0}let g=0;const m=t.getAttribute(p);for(let _=0,v=r.length;_<v;_++){const x=r[_],b=!s&&!f&&n[_],w=x.getAttribute(p);b||rf(w,m,g),g+=w.count}}}function fg(r,e,t){const i=r.index,n=r.attributes.position.count,o=i?i.count:n;let a=r.groups;a.length===0&&(a=[{count:o,start:0,materialIndex:0}]);let h=r.getAttribute("materialIndex");if(!h||h.count!==n){let d;t.length<=255?d=new Uint8Array(n):d=new Uint16Array(n),h=new y.BufferAttribute(d,1,!1),r.deleteAttribute("materialIndex"),r.setAttribute("materialIndex",h)}const u=h.array;for(let d=0;d<a.length;d++){const l=a[d],c=l.start,f=l.count,p=Math.min(f,o-c),g=Array.isArray(e)?e[l.materialIndex]:e,m=t.indexOf(g);for(let _=0;_<p;_++){let v=c+_;i&&(v=i.getX(v)),u[v]=m}}}function pg(r,e){if(!r.index){const t=r.attributes.position.count,i=new Array(t);for(let s=0;s<t;s++)i[s]=s;r.setIndex(i)}if(!r.attributes.normal&&e&&e.includes("normal")&&r.computeVertexNormals(),!r.attributes.uv&&e&&e.includes("uv")){const t=r.attributes.position.count;r.setAttribute("uv",new y.BufferAttribute(new Float32Array(t*2),2,!1))}if(!r.attributes.uv2&&e&&e.includes("uv2")){const t=r.attributes.position.count;r.setAttribute("uv2",new y.BufferAttribute(new Float32Array(t*2),2,!1))}if(!r.attributes.tangent&&e&&e.includes("tangent"))if(r.attributes.uv&&r.attributes.normal)r.computeTangents();else{const t=r.attributes.position.count;r.setAttribute("tangent",new y.BufferAttribute(new Float32Array(t*4),4,!1))}if(!r.attributes.color&&e&&e.includes("color")){const t=r.attributes.position.count,i=new Float32Array(t*4);i.fill(1),r.setAttribute("color",new y.BufferAttribute(i,4))}}function Rh(r){let e=0;if(r.byteLength!==0){const t=new Uint8Array(r);for(let i=0;i<r.byteLength;i++){const s=t[i];e=(e<<5)-e+s,e|=0}}return e}function mc(r){let e=r.uuid;const t=Object.values(r.attributes);r.index&&(t.push(r.index),e+=`index|${r.index.version}`);const i=Object.keys(t).sort();for(const s of i){const n=t[s];e+=`${s}_${n.version}|`}return e}function gc(r){const e=r.skeleton;return e?(e.boneTexture||e.computeBoneTexture(),`${Rh(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`):null}class mg{constructor(e=null){this.matrixWorld=new y.Matrix4,this.geometryHash=null,this.skeletonHash=null,this.primitiveCount=-1,e!==null&&this.updateFrom(e)}updateFrom(e){const t=e.geometry,i=(t.index?t.index.count:t.attributes.position.count)/3;this.matrixWorld.copy(e.matrixWorld),this.geometryHash=mc(t),this.primitiveCount=i,this.skeletonHash=gc(e)}didChange(e){const t=e.geometry,i=(t.index?t.index.count:t.attributes.position.count)/3;return!(this.matrixWorld.equals(e.matrixWorld)&&this.geometryHash===mc(t)&&this.skeletonHash===gc(e)&&this.primitiveCount===i)}}const Ri=new y.Vector3,Di=new y.Vector3,Bi=new y.Vector3,_c=new y.Vector4,ln=new y.Vector3,na=new y.Vector3,yc=new y.Vector4,vc=new y.Vector4,hn=new y.Matrix4,xc=new y.Matrix4;function bc(r,e,t){const i=r.skeleton,s=r.geometry,n=i.bones,o=i.boneInverses;yc.fromBufferAttribute(s.attributes.skinIndex,e),vc.fromBufferAttribute(s.attributes.skinWeight,e),hn.elements.fill(0);for(let a=0;a<4;a++){const h=vc.getComponent(a);if(h!==0){const u=yc.getComponent(a);xc.multiplyMatrices(n[u].matrixWorld,o[u]),gg(hn,xc,h)}}return hn.multiply(r.bindMatrix).premultiply(r.bindMatrixInverse),t.transformDirection(hn),t}function oa(r,e,t,i,s){ln.set(0,0,0);for(let n=0,o=r.length;n<o;n++){const a=e[n],h=r[n];a!==0&&(na.fromBufferAttribute(h,i),t?ln.addScaledVector(na,a):ln.addScaledVector(na.sub(s),a))}s.add(ln)}function gg(r,e,t){const i=r.elements,s=e.elements;for(let n=0,o=s.length;n<o;n++)i[n]+=s[n]*t}function _g(r){const{index:e,attributes:t}=r;if(e)for(let i=0,s=e.count;i<s;i+=3){const n=e.getX(i),o=e.getX(i+2);e.setX(i,o),e.setX(i+2,n)}else for(const i in t){const s=t[i],n=s.itemSize;for(let o=0,a=s.count;o<a;o+=3)for(let h=0;h<n;h++){const u=s.getComponent(o,h),d=s.getComponent(o+2,h);s.setComponent(o,h,d),s.setComponent(o+2,h,u)}}return r}function yg(r,e={},t=new y.BufferGeometry){e={applyWorldTransforms:!0,attributes:[],...e};const i=r.geometry,s=e.applyWorldTransforms,n=e.attributes.includes("normal"),o=e.attributes.includes("tangent"),a=i.attributes,h=t.attributes;for(const v in t.attributes)(!e.attributes.includes(v)||!(v in i.attributes))&&t.deleteAttribute(v);!t.index&&i.index&&(t.index=i.index.clone()),h.position||t.setAttribute("position",Cs(a.position)),n&&!h.normal&&a.normal&&t.setAttribute("normal",Cs(a.normal)),o&&!h.tangent&&a.tangent&&t.setAttribute("tangent",Cs(a.tangent)),Er(i.index,t.index),Er(a.position,h.position),n&&Er(a.normal,h.normal),o&&Er(a.tangent,h.tangent);const u=a.position,d=n?a.normal:null,l=o?a.tangent:null,c=i.morphAttributes.position,f=i.morphAttributes.normal,p=i.morphAttributes.tangent,g=i.morphTargetsRelative,m=r.morphTargetInfluences,_=new y.Matrix3;_.getNormalMatrix(r.matrixWorld),i.index&&t.index.array.set(i.index.array);for(let v=0,x=a.position.count;v<x;v++)Ri.fromBufferAttribute(u,v),d&&Di.fromBufferAttribute(d,v),l&&(_c.fromBufferAttribute(l,v),Bi.fromBufferAttribute(l,v)),m&&(c&&oa(c,m,g,v,Ri),f&&oa(f,m,g,v,Di),p&&oa(p,m,g,v,Bi)),r.isSkinnedMesh&&(r.applyBoneTransform(v,Ri),d&&bc(r,v,Di),l&&bc(r,v,Bi)),s&&Ri.applyMatrix4(r.matrixWorld),h.position.setXYZ(v,Ri.x,Ri.y,Ri.z),d&&(s&&Di.applyNormalMatrix(_),h.normal.setXYZ(v,Di.x,Di.y,Di.z)),l&&(s&&Bi.transformDirection(r.matrixWorld),h.tangent.setXYZW(v,Bi.x,Bi.y,Bi.z,_c.w));for(const v in e.attributes){const x=e.attributes[v];x==="position"||x==="tangent"||x==="normal"||!(x in a)||(h[x]||t.setAttribute(x,Cs(a[x])),Er(a[x],h[x]),rf(a[x],h[x]))}return r.matrixWorld.determinant()<0&&_g(t),t}class vg extends y.BufferGeometry{constructor(){super(),this.version=0,this.hash=null,this._diff=new mg}isCompatible(e,t){const i=e.geometry;for(let s=0;s<t.length;s++){const n=t[s],o=i.attributes[n],a=this.attributes[n];if(o&&!Er(o,a))return!1}return!0}updateFrom(e,t){const i=this._diff;return i.didChange(e)?(yg(e,t,this),i.updateFrom(e),this.version++,this.hash=`${this.uuid}_${this.version}`,!0):!1}}const dl=0,sf=1,nf=2;function xg(r,e){for(let t=0,i=r.length;t<i;t++)r[t].traverseVisible(n=>{n.isMesh&&e(n)})}function bg(r){const e=[];for(let t=0,i=r.length;t<i;t++){const s=r[t];Array.isArray(s.material)?e.push(...s.material):e.push(s.material)}return e}function wg(r,e,t){if(r.length===0){e.setIndex(null);const i=e.attributes;for(const s in i)e.deleteAttribute(s);for(const s in t.attributes)e.setAttribute(t.attributes[s],new y.BufferAttribute(new Float32Array(0),4,!1))}else dg(r,t,e);for(const i in e.attributes)e.attributes[i].needsUpdate=!0}class Ag{constructor(e){this.objects=null,this.useGroups=!0,this.applyWorldTransforms=!0,this.generateMissingAttributes=!0,this.overwriteIndex=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Map,this._geometryMergeSets=new WeakMap,this._mergeOrder=[],this._dummyMesh=null,this.setObjects(e||[])}_getDummyMesh(){if(!this._dummyMesh){const e=new y.MeshBasicMaterial,t=new y.BufferGeometry;t.setAttribute("position",new y.BufferAttribute(new Float32Array(9),3)),this._dummyMesh=new y.Mesh(t,e)}return this._dummyMesh}_getMeshes(){const e=[];return xg(this.objects,t=>{e.push(t)}),e.sort((t,i)=>t.uuid>i.uuid?1:t.uuid<i.uuid?-1:0),e.length===0&&e.push(this._getDummyMesh()),e}_updateIntermediateGeometries(){const{_intermediateGeometry:e}=this,t=this._getMeshes(),i=new Set(e.keys()),s={attributes:this.attributes,applyWorldTransforms:this.applyWorldTransforms};for(let n=0,o=t.length;n<o;n++){const a=t[n],h=a.uuid;i.delete(h);let u=e.get(h);(!u||!u.isCompatible(a,this.attributes))&&(u&&u.dispose(),u=new vg,e.set(h,u)),u.updateFrom(a,s)&&this.generateMissingAttributes&&pg(u,this.attributes)}i.forEach(n=>{e.delete(n)})}setObjects(e){Array.isArray(e)?this.objects=[...e]:this.objects=[e]}generate(e=new y.BufferGeometry){const{useGroups:t,overwriteIndex:i,_intermediateGeometry:s,_geometryMergeSets:n}=this,o=this._getMeshes(),a=[],h=[],u=n.get(e)||[];this._updateIntermediateGeometries();let d=!1;o.length!==u.length&&(d=!0);for(let c=0,f=o.length;c<f;c++){const p=o[c],g=s.get(p.uuid);h.push(g);const m=u[c];!m||m.uuid!==g.uuid?(a.push(!1),d=!0):m.version!==g.version?a.push(!1):a.push(!0)}wg(h,e,{useGroups:t,forceUpdate:d,skipAssigningAttributes:a,overwriteIndex:i}),d&&e.dispose(),n.set(e,h.map(c=>({version:c.version,uuid:c.uuid})));let l=dl;return d?l=nf:a.includes(!1)&&(l=sf),{changeType:l,materials:bg(o),geometry:e}}}function Tg(r){const e=new Set;for(let t=0,i=r.length;t<i;t++){const s=r[t];for(const n in s){const o=s[n];o&&o.isTexture&&e.add(o)}}return Array.from(e)}function Sg(r){const e=[],t=new Set;for(let s=0,n=r.length;s<n;s++)r[s].traverse(o=>{o.visible&&(o.isRectAreaLight||o.isSpotLight||o.isPointLight||o.isDirectionalLight)&&(e.push(o),o.iesMap&&t.add(o.iesMap))});const i=Array.from(t).sort((s,n)=>s.uuid<n.uuid?1:s.uuid>n.uuid?-1:0);return{lights:e,iesTextures:i}}class Eg{get initialized(){return!!this.bvh}constructor(e){this.bvhOptions={},this.attributes=["position","normal","tangent","color","uv","uv2"],this.generateBVH=!0,this.bvh=null,this.geometry=new y.BufferGeometry,this.staticGeometryGenerator=new Ag(e),this._bvhWorker=null,this._pendingGenerate=null,this._buildAsync=!1}setObjects(e){this.staticGeometryGenerator.setObjects(e)}setBVHWorker(e){this._bvhWorker=e}async generateAsync(e=null){if(!this._bvhWorker)throw new Error('PathTracingSceneGenerator: "setBVHWorker" must be called before "generateAsync" can be called.');if(this.bvh instanceof Promise)return this._pendingGenerate||(this._pendingGenerate=new Promise(async()=>(await this.bvh,this._pendingGenerate=null,this.generateAsync(e)))),this._pendingGenerate;{this._buildAsync=!0;const t=this.generate(e);return this._buildAsync=!1,t.bvh=this.bvh=await t.bvh,t}}generate(e=null){const{staticGeometryGenerator:t,geometry:i,attributes:s}=this,n=t.objects;t.attributes=s,n.forEach(l=>{l.traverse(c=>{c.isSkinnedMesh&&c.skeleton&&c.skeleton.update()})});const o=t.generate(i),a=o.materials,h=Tg(a),{lights:u,iesTextures:d}=Sg(n);if(o.changeType!==dl&&fg(i,a,a),this.generateBVH){if(this.bvh instanceof Promise)throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");if(o.changeType===nf){const l={strategy:pi.SAH,maxLeafTris:1,indirect:!0,onProgress:e,...this.bvhOptions};this._buildAsync?this.bvh=this._bvhWorker.generate(i,l):this.bvh=new pi.MeshBVH(i,l)}else o.changeType===sf&&this.bvh.refit()}return{bvhChanged:o.changeType!==dl,bvh:this.bvh,lights:u,iesTextures:d,geometry:i,materials:a,textures:h,objects:n}}}class Dh extends y.ShaderMaterial{set needsUpdate(e){super.needsUpdate=!0,this.dispatchEvent({type:"recompilation"})}constructor(e){super(e);for(const t in this.uniforms)Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(i){this.uniforms[t].value=i}})}setDefine(e,t=void 0){if(t==null){if(e in this.defines)return delete this.defines[e],this.needsUpdate=!0,!0}else if(this.defines[e]!==t)return this.defines[e]=t,this.needsUpdate=!0,!0;return!1}}class Cg extends Dh{constructor(e){super({blending:y.NoBlending,uniforms:{target1:{value:null},target2:{value:null},opacity:{value:1}},vertexShader:`
|
|
1
|
+
"use strict";var Lm=Object.create;var ra=Object.defineProperty;var Om=Object.getOwnPropertyDescriptor;var km=Object.getOwnPropertyNames;var Nm=Object.getPrototypeOf,Um=Object.prototype.hasOwnProperty;var Gm=(r,e,t)=>e in r?ra(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var zm=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of km(e))!Um.call(r,s)&&s!==t&&ra(r,s,{get:()=>e[s],enumerable:!(i=Om(e,s))||i.enumerable});return r};var Hm=(r,e,t)=>(t=r!=null?Lm(Nm(r)):{},zm(e||!r||!r.__esModule?ra(t,"default",{value:r,enumerable:!0}):t,r));var N=(r,e,t)=>(Gm(r,typeof e!="symbol"?e+"":e,t),t),uc=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var le=(r,e,t)=>(uc(r,e,"read from private field"),t?t.call(r):e.get(r)),si=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},wt=(r,e,t,i)=>(uc(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("three"),Vm=require("three/examples/jsm/loaders/HDRLoader"),dc=require("three/examples/jsm/postprocessing/RenderPass"),fc=require("three/examples/jsm/postprocessing/OutlinePass"),Wm=require("three/examples/jsm/postprocessing/ShaderPass"),$m=require("three/examples/jsm/shaders/FXAAShader"),Xm=require("three/examples/jsm/postprocessing/UnrealBloomPass"),jm=require("three/examples/jsm/controls/OrbitControls"),Ym=require("three/examples/jsm/postprocessing/OutputPass"),qm=require("three/examples/jsm/postprocessing/EffectComposer"),Lt=require("three/examples/jsm/renderers/CSS2DRenderer"),Zm=require("three/examples/jsm/loaders/FontLoader"),Ph=require("three/examples/jsm/loaders/GLTFLoader.js"),Km=require("three/examples/jsm/libs/meshopt_decoder.module.js"),Qm=require("three/examples/jsm/loaders/DRACOLoader.js"),Jm=require("three/examples/jsm/loaders/KTX2Loader.js"),eg=require("three/examples/jsm/loaders/GLTFLoader"),tg=require("three/examples/jsm/loaders/DRACOLoader"),ig=require("three/examples/jsm/exporters/DRACOExporter"),rg=require("three/examples/jsm/exporters/GLTFExporter"),sg=require("three/examples/jsm/lines/LineSegments2.js"),ng=require("three/examples/jsm/lines/LineSegmentsGeometry.js"),tf=require("three/examples/jsm/lines/LineMaterial.js"),og=require("three/examples/jsm/lines/Line2.js"),pc=require("three/examples/jsm/lines/LineGeometry.js"),ag=require("three/examples/jsm/renderers/CSS3DRenderer"),lg=require("three/examples/jsm/utils/BufferGeometryUtils"),pi=require("three-mesh-bvh"),Kr=require("three/examples/jsm/postprocessing/Pass.js");var Qr=typeof document<"u"?document.currentScript:null;function rf(r,e,t=0){if(r.isInterleavedBufferAttribute){const i=r.itemSize;for(let s=0,n=r.count;s<n;s++){const o=s+t;e.setX(o,r.getX(s)),i>=2&&e.setY(o,r.getY(s)),i>=3&&e.setZ(o,r.getZ(s)),i>=4&&e.setW(o,r.getW(s))}}else{const i=e.array,s=i.constructor,n=i.BYTES_PER_ELEMENT*r.itemSize*t;new s(i.buffer,n,r.array.length).set(r.array)}}function Ms(r,e=null){const t=r.array.constructor,i=r.normalized,s=r.itemSize,n=e===null?r.count:e;return new y.BufferAttribute(new t(s*n),s,i)}function Er(r,e){if(!r&&!e)return!0;if(!!r!=!!e)return!1;const t=r.count===e.count,i=r.normalized===e.normalized,s=r.array.constructor===e.array.constructor,n=r.itemSize===e.itemSize;return!(!t||!i||!s||!n)}function hg(r){const e=r[0].index!==null,t=new Set(Object.keys(r[0].attributes));if(!r[0].getAttribute("position"))throw new Error("StaticGeometryGenerator: position attribute is required.");for(let i=0;i<r.length;++i){const s=r[i];let n=0;if(e!==(s.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(const o in s.attributes){if(!t.has(o))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+o+'" attribute exists among all geometries, or in none of them.');n++}if(n!==t.size)throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.")}}function cg(r){let e=0;for(let t=0,i=r.length;t<i;t++)e+=r[t].getIndex().count;return e}function ug(r){let e=0;for(let t=0,i=r.length;t<i;t++)e+=r[t].getAttribute("position").count;return e}function dg(r,e,t){r.index&&r.index.count!==e&&r.setIndex(null);const i=r.attributes;for(const s in i)i[s].count!==t&&r.deleteAttribute(s)}function fg(r,e={},t=new y.BufferGeometry){const{useGroups:i=!1,forceUpdate:s=!1,skipAssigningAttributes:n=[],overwriteIndex:o=!0}=e;hg(r);const a=r[0].index!==null,h=a?cg(r):-1,u=ug(r);if(dg(t,h,u),i){let l=0;for(let c=0,f=r.length;c<f;c++){const p=r[c];let g;a?g=p.getIndex().count:g=p.getAttribute("position").count,t.addGroup(l,g,c),l+=g}}if(a){let l=!1;if(t.index||(t.setIndex(new y.BufferAttribute(new Uint32Array(h),1,!1)),l=!0),l||o){let c=0,f=0;const p=t.getIndex();for(let g=0,m=r.length;g<m;g++){const _=r[g],v=_.getIndex();if(!(!s&&!l&&n[g]))for(let b=0;b<v.count;++b)p.setX(c+b,v.getX(b)+f);c+=v.count,f+=_.getAttribute("position").count}}}const d=Object.keys(r[0].attributes);for(let l=0,c=d.length;l<c;l++){let f=!1;const p=d[l];if(!t.getAttribute(p)){const _=r[0].getAttribute(p);t.setAttribute(p,Ms(_,u)),f=!0}let g=0;const m=t.getAttribute(p);for(let _=0,v=r.length;_<v;_++){const x=r[_],b=!s&&!f&&n[_],w=x.getAttribute(p);b||rf(w,m,g),g+=w.count}}}function pg(r,e,t){const i=r.index,n=r.attributes.position.count,o=i?i.count:n;let a=r.groups;a.length===0&&(a=[{count:o,start:0,materialIndex:0}]);let h=r.getAttribute("materialIndex");if(!h||h.count!==n){let d;t.length<=255?d=new Uint8Array(n):d=new Uint16Array(n),h=new y.BufferAttribute(d,1,!1),r.deleteAttribute("materialIndex"),r.setAttribute("materialIndex",h)}const u=h.array;for(let d=0;d<a.length;d++){const l=a[d],c=l.start,f=l.count,p=Math.min(f,o-c),g=Array.isArray(e)?e[l.materialIndex]:e,m=t.indexOf(g);for(let _=0;_<p;_++){let v=c+_;i&&(v=i.getX(v)),u[v]=m}}}function mg(r,e){if(!r.index){const t=r.attributes.position.count,i=new Array(t);for(let s=0;s<t;s++)i[s]=s;r.setIndex(i)}if(!r.attributes.normal&&e&&e.includes("normal")&&r.computeVertexNormals(),!r.attributes.uv&&e&&e.includes("uv")){const t=r.attributes.position.count;r.setAttribute("uv",new y.BufferAttribute(new Float32Array(t*2),2,!1))}if(!r.attributes.uv2&&e&&e.includes("uv2")){const t=r.attributes.position.count;r.setAttribute("uv2",new y.BufferAttribute(new Float32Array(t*2),2,!1))}if(!r.attributes.tangent&&e&&e.includes("tangent"))if(r.attributes.uv&&r.attributes.normal)r.computeTangents();else{const t=r.attributes.position.count;r.setAttribute("tangent",new y.BufferAttribute(new Float32Array(t*4),4,!1))}if(!r.attributes.color&&e&&e.includes("color")){const t=r.attributes.position.count,i=new Float32Array(t*4);i.fill(1),r.setAttribute("color",new y.BufferAttribute(i,4))}}function Rh(r){let e=0;if(r.byteLength!==0){const t=new Uint8Array(r);for(let i=0;i<r.byteLength;i++){const s=t[i];e=(e<<5)-e+s,e|=0}}return e}function mc(r){let e=r.uuid;const t=Object.values(r.attributes);r.index&&(t.push(r.index),e+=`index|${r.index.version}`);const i=Object.keys(t).sort();for(const s of i){const n=t[s];e+=`${s}_${n.version}|`}return e}function gc(r){const e=r.skeleton;return e?(e.boneTexture||e.computeBoneTexture(),`${Rh(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`):null}class gg{constructor(e=null){this.matrixWorld=new y.Matrix4,this.geometryHash=null,this.skeletonHash=null,this.primitiveCount=-1,e!==null&&this.updateFrom(e)}updateFrom(e){const t=e.geometry,i=(t.index?t.index.count:t.attributes.position.count)/3;this.matrixWorld.copy(e.matrixWorld),this.geometryHash=mc(t),this.primitiveCount=i,this.skeletonHash=gc(e)}didChange(e){const t=e.geometry,i=(t.index?t.index.count:t.attributes.position.count)/3;return!(this.matrixWorld.equals(e.matrixWorld)&&this.geometryHash===mc(t)&&this.skeletonHash===gc(e)&&this.primitiveCount===i)}}const Ri=new y.Vector3,Di=new y.Vector3,Bi=new y.Vector3,_c=new y.Vector4,hn=new y.Vector3,sa=new y.Vector3,yc=new y.Vector4,vc=new y.Vector4,cn=new y.Matrix4,xc=new y.Matrix4;function bc(r,e,t){const i=r.skeleton,s=r.geometry,n=i.bones,o=i.boneInverses;yc.fromBufferAttribute(s.attributes.skinIndex,e),vc.fromBufferAttribute(s.attributes.skinWeight,e),cn.elements.fill(0);for(let a=0;a<4;a++){const h=vc.getComponent(a);if(h!==0){const u=yc.getComponent(a);xc.multiplyMatrices(n[u].matrixWorld,o[u]),_g(cn,xc,h)}}return cn.multiply(r.bindMatrix).premultiply(r.bindMatrixInverse),t.transformDirection(cn),t}function na(r,e,t,i,s){hn.set(0,0,0);for(let n=0,o=r.length;n<o;n++){const a=e[n],h=r[n];a!==0&&(sa.fromBufferAttribute(h,i),t?hn.addScaledVector(sa,a):hn.addScaledVector(sa.sub(s),a))}s.add(hn)}function _g(r,e,t){const i=r.elements,s=e.elements;for(let n=0,o=s.length;n<o;n++)i[n]+=s[n]*t}function yg(r){const{index:e,attributes:t}=r;if(e)for(let i=0,s=e.count;i<s;i+=3){const n=e.getX(i),o=e.getX(i+2);e.setX(i,o),e.setX(i+2,n)}else for(const i in t){const s=t[i],n=s.itemSize;for(let o=0,a=s.count;o<a;o+=3)for(let h=0;h<n;h++){const u=s.getComponent(o,h),d=s.getComponent(o+2,h);s.setComponent(o,h,d),s.setComponent(o+2,h,u)}}return r}function vg(r,e={},t=new y.BufferGeometry){e={applyWorldTransforms:!0,attributes:[],...e};const i=r.geometry,s=e.applyWorldTransforms,n=e.attributes.includes("normal"),o=e.attributes.includes("tangent"),a=i.attributes,h=t.attributes;for(const v in t.attributes)(!e.attributes.includes(v)||!(v in i.attributes))&&t.deleteAttribute(v);!t.index&&i.index&&(t.index=i.index.clone()),h.position||t.setAttribute("position",Ms(a.position)),n&&!h.normal&&a.normal&&t.setAttribute("normal",Ms(a.normal)),o&&!h.tangent&&a.tangent&&t.setAttribute("tangent",Ms(a.tangent)),Er(i.index,t.index),Er(a.position,h.position),n&&Er(a.normal,h.normal),o&&Er(a.tangent,h.tangent);const u=a.position,d=n?a.normal:null,l=o?a.tangent:null,c=i.morphAttributes.position,f=i.morphAttributes.normal,p=i.morphAttributes.tangent,g=i.morphTargetsRelative,m=r.morphTargetInfluences,_=new y.Matrix3;_.getNormalMatrix(r.matrixWorld),i.index&&t.index.array.set(i.index.array);for(let v=0,x=a.position.count;v<x;v++)Ri.fromBufferAttribute(u,v),d&&Di.fromBufferAttribute(d,v),l&&(_c.fromBufferAttribute(l,v),Bi.fromBufferAttribute(l,v)),m&&(c&&na(c,m,g,v,Ri),f&&na(f,m,g,v,Di),p&&na(p,m,g,v,Bi)),r.isSkinnedMesh&&(r.applyBoneTransform(v,Ri),d&&bc(r,v,Di),l&&bc(r,v,Bi)),s&&Ri.applyMatrix4(r.matrixWorld),h.position.setXYZ(v,Ri.x,Ri.y,Ri.z),d&&(s&&Di.applyNormalMatrix(_),h.normal.setXYZ(v,Di.x,Di.y,Di.z)),l&&(s&&Bi.transformDirection(r.matrixWorld),h.tangent.setXYZW(v,Bi.x,Bi.y,Bi.z,_c.w));for(const v in e.attributes){const x=e.attributes[v];x==="position"||x==="tangent"||x==="normal"||!(x in a)||(h[x]||t.setAttribute(x,Ms(a[x])),Er(a[x],h[x]),rf(a[x],h[x]))}return r.matrixWorld.determinant()<0&&yg(t),t}class xg extends y.BufferGeometry{constructor(){super(),this.version=0,this.hash=null,this._diff=new gg}isCompatible(e,t){const i=e.geometry;for(let s=0;s<t.length;s++){const n=t[s],o=i.attributes[n],a=this.attributes[n];if(o&&!Er(o,a))return!1}return!0}updateFrom(e,t){const i=this._diff;return i.didChange(e)?(vg(e,t,this),i.updateFrom(e),this.version++,this.hash=`${this.uuid}_${this.version}`,!0):!1}}const ul=0,sf=1,nf=2;function bg(r,e){for(let t=0,i=r.length;t<i;t++)r[t].traverseVisible(n=>{n.isMesh&&e(n)})}function wg(r){const e=[];for(let t=0,i=r.length;t<i;t++){const s=r[t];Array.isArray(s.material)?e.push(...s.material):e.push(s.material)}return e}function Ag(r,e,t){if(r.length===0){e.setIndex(null);const i=e.attributes;for(const s in i)e.deleteAttribute(s);for(const s in t.attributes)e.setAttribute(t.attributes[s],new y.BufferAttribute(new Float32Array(0),4,!1))}else fg(r,t,e);for(const i in e.attributes)e.attributes[i].needsUpdate=!0}class Tg{constructor(e){this.objects=null,this.useGroups=!0,this.applyWorldTransforms=!0,this.generateMissingAttributes=!0,this.overwriteIndex=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Map,this._geometryMergeSets=new WeakMap,this._mergeOrder=[],this._dummyMesh=null,this.setObjects(e||[])}_getDummyMesh(){if(!this._dummyMesh){const e=new y.MeshBasicMaterial,t=new y.BufferGeometry;t.setAttribute("position",new y.BufferAttribute(new Float32Array(9),3)),this._dummyMesh=new y.Mesh(t,e)}return this._dummyMesh}_getMeshes(){const e=[];return bg(this.objects,t=>{e.push(t)}),e.sort((t,i)=>t.uuid>i.uuid?1:t.uuid<i.uuid?-1:0),e.length===0&&e.push(this._getDummyMesh()),e}_updateIntermediateGeometries(){const{_intermediateGeometry:e}=this,t=this._getMeshes(),i=new Set(e.keys()),s={attributes:this.attributes,applyWorldTransforms:this.applyWorldTransforms};for(let n=0,o=t.length;n<o;n++){const a=t[n],h=a.uuid;i.delete(h);let u=e.get(h);(!u||!u.isCompatible(a,this.attributes))&&(u&&u.dispose(),u=new xg,e.set(h,u)),u.updateFrom(a,s)&&this.generateMissingAttributes&&mg(u,this.attributes)}i.forEach(n=>{e.delete(n)})}setObjects(e){Array.isArray(e)?this.objects=[...e]:this.objects=[e]}generate(e=new y.BufferGeometry){const{useGroups:t,overwriteIndex:i,_intermediateGeometry:s,_geometryMergeSets:n}=this,o=this._getMeshes(),a=[],h=[],u=n.get(e)||[];this._updateIntermediateGeometries();let d=!1;o.length!==u.length&&(d=!0);for(let c=0,f=o.length;c<f;c++){const p=o[c],g=s.get(p.uuid);h.push(g);const m=u[c];!m||m.uuid!==g.uuid?(a.push(!1),d=!0):m.version!==g.version?a.push(!1):a.push(!0)}Ag(h,e,{useGroups:t,forceUpdate:d,skipAssigningAttributes:a,overwriteIndex:i}),d&&e.dispose(),n.set(e,h.map(c=>({version:c.version,uuid:c.uuid})));let l=ul;return d?l=nf:a.includes(!1)&&(l=sf),{changeType:l,materials:wg(o),geometry:e}}}function Sg(r){const e=new Set;for(let t=0,i=r.length;t<i;t++){const s=r[t];for(const n in s){const o=s[n];o&&o.isTexture&&e.add(o)}}return Array.from(e)}function Eg(r){const e=[],t=new Set;for(let s=0,n=r.length;s<n;s++)r[s].traverse(o=>{o.visible&&(o.isRectAreaLight||o.isSpotLight||o.isPointLight||o.isDirectionalLight)&&(e.push(o),o.iesMap&&t.add(o.iesMap))});const i=Array.from(t).sort((s,n)=>s.uuid<n.uuid?1:s.uuid>n.uuid?-1:0);return{lights:e,iesTextures:i}}class Cg{get initialized(){return!!this.bvh}constructor(e){this.bvhOptions={},this.attributes=["position","normal","tangent","color","uv","uv2"],this.generateBVH=!0,this.bvh=null,this.geometry=new y.BufferGeometry,this.staticGeometryGenerator=new Tg(e),this._bvhWorker=null,this._pendingGenerate=null,this._buildAsync=!1}setObjects(e){this.staticGeometryGenerator.setObjects(e)}setBVHWorker(e){this._bvhWorker=e}async generateAsync(e=null){if(!this._bvhWorker)throw new Error('PathTracingSceneGenerator: "setBVHWorker" must be called before "generateAsync" can be called.');if(this.bvh instanceof Promise)return this._pendingGenerate||(this._pendingGenerate=new Promise(async()=>(await this.bvh,this._pendingGenerate=null,this.generateAsync(e)))),this._pendingGenerate;{this._buildAsync=!0;const t=this.generate(e);return this._buildAsync=!1,t.bvh=this.bvh=await t.bvh,t}}generate(e=null){const{staticGeometryGenerator:t,geometry:i,attributes:s}=this,n=t.objects;t.attributes=s,n.forEach(l=>{l.traverse(c=>{c.isSkinnedMesh&&c.skeleton&&c.skeleton.update()})});const o=t.generate(i),a=o.materials,h=Sg(a),{lights:u,iesTextures:d}=Eg(n);if(o.changeType!==ul&&pg(i,a,a),this.generateBVH){if(this.bvh instanceof Promise)throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");if(o.changeType===nf){const l={strategy:pi.SAH,maxLeafTris:1,indirect:!0,onProgress:e,...this.bvhOptions};this._buildAsync?this.bvh=this._bvhWorker.generate(i,l):this.bvh=new pi.MeshBVH(i,l)}else o.changeType===sf&&this.bvh.refit()}return{bvhChanged:o.changeType!==ul,bvh:this.bvh,lights:u,iesTextures:d,geometry:i,materials:a,textures:h,objects:n}}}class Dh extends y.ShaderMaterial{set needsUpdate(e){super.needsUpdate=!0,this.dispatchEvent({type:"recompilation"})}constructor(e){super(e);for(const t in this.uniforms)Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(i){this.uniforms[t].value=i}})}setDefine(e,t=void 0){if(t==null){if(e in this.defines)return delete this.defines[e],this.needsUpdate=!0,!0}else if(this.defines[e]!==t)return this.defines[e]=t,this.needsUpdate=!0,!0;return!1}}class Mg extends Dh{constructor(e){super({blending:y.NoBlending,uniforms:{target1:{value:null},target2:{value:null},opacity:{value:1}},vertexShader:`
|
|
2
2
|
|
|
3
3
|
varying vec2 vUv;
|
|
4
4
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
}`}),this.setValues(e)}}function
|
|
38
|
+
}`}),this.setValues(e)}}function un(r=1){let e="uint";return r>1&&(e="uvec"+r),`
|
|
39
39
|
${e} sobolReverseBits( ${e} x ) {
|
|
40
40
|
|
|
41
41
|
x = ( ( ( x & 0xaaaaaaaau ) >> 1 ) | ( ( x & 0x55555555u ) << 1 ) );
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
return x;
|
|
71
71
|
|
|
72
72
|
}
|
|
73
|
-
`}function
|
|
73
|
+
`}function dn(r=1){let e="uint",t="float",i="",s=".r",n="1u";return r>1&&(e="uvec"+r,t="vec"+r,i=r+"",r===2?(s=".rg",n="uvec2( 1u, 2u )"):r===3?(s=".rgb",n="uvec3( 1u, 2u, 3u )"):(s="",n="uvec4( 1u, 2u, 3u, 4u )")),`
|
|
74
74
|
|
|
75
75
|
${t} sobol${i}( int effect ) {
|
|
76
76
|
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
const float SOBOL_FACTOR = 1.0 / 16777216.0;
|
|
95
95
|
const uint SOBOL_MAX_POINTS = 256u * 256u;
|
|
96
96
|
|
|
97
|
-
${
|
|
98
|
-
${
|
|
99
|
-
${
|
|
100
|
-
${
|
|
97
|
+
${un(1)}
|
|
98
|
+
${un(2)}
|
|
99
|
+
${un(3)}
|
|
100
|
+
${un(4)}
|
|
101
101
|
|
|
102
102
|
uint sobolHash( uint x ) {
|
|
103
103
|
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
`,
|
|
114
|
+
`,Ig=`
|
|
115
115
|
|
|
116
116
|
const uint SOBOL_DIRECTIONS_1[ 32 ] = uint[ 32 ](
|
|
117
117
|
0x80000000u, 0xc0000000u, 0xa0000000u, 0xf0000000u,
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
`,
|
|
192
|
+
`,Pg=`
|
|
193
193
|
|
|
194
194
|
// Seeds
|
|
195
195
|
uniform sampler2D sobolTexture;
|
|
@@ -227,12 +227,12 @@
|
|
|
227
227
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
${
|
|
231
|
-
${
|
|
232
|
-
${
|
|
233
|
-
${
|
|
230
|
+
${dn(1)}
|
|
231
|
+
${dn(2)}
|
|
232
|
+
${dn(3)}
|
|
233
|
+
${dn(4)}
|
|
234
234
|
|
|
235
|
-
`;class
|
|
235
|
+
`;class Rg extends Dh{constructor(){super({blending:y.NoBlending,uniforms:{resolution:{value:new y.Vector2}},vertexShader:`
|
|
236
236
|
|
|
237
237
|
varying vec2 vUv;
|
|
238
238
|
void main() {
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
`,fragmentShader:`
|
|
245
245
|
|
|
246
246
|
${of}
|
|
247
|
-
${
|
|
247
|
+
${Ig}
|
|
248
248
|
|
|
249
249
|
varying vec2 vUv;
|
|
250
250
|
uniform vec2 resolution;
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
gl_FragColor = generateSobolPoint( index );
|
|
255
255
|
|
|
256
256
|
}
|
|
257
|
-
`})}}class Rg{generate(e,t=256){const i=new y.WebGLRenderTarget(t,t,{type:y.FloatType,format:y.RGBAFormat,minFilter:y.NearestFilter,magFilter:y.NearestFilter,generateMipmaps:!1}),s=e.getRenderTarget();e.setRenderTarget(i);const n=new Kr.FullScreenQuad(new Pg);return n.material.resolution.set(t,t),n.render(e),e.setRenderTarget(s),n.dispose(),i}}class Dg extends y.PerspectiveCamera{set bokehSize(e){this.fStop=this.getFocalLength()/e}get bokehSize(){return this.getFocalLength()/this.fStop}constructor(...e){super(...e),this.fStop=1.4,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=25,this.anamorphicRatio=1}copy(e,t){return super.copy(e,t),this.fStop=e.fStop,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio,this}}class Bg{constructor(){this.bokehSize=0,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=10,this.anamorphicRatio=1}updateFrom(e){e instanceof Dg?(this.bokehSize=e.bokehSize,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio):(this.bokehSize=0,this.apertureRotation=0,this.apertureBlades=0,this.focusDistance=10,this.anamorphicRatio=1)}}function aa(r){const e=new Uint16Array(r.length);for(let t=0,i=r.length;t<i;++t)e[t]=y.DataUtils.toHalfFloat(r[t]);return e}function wc(r,e,t=0,i=r.length){let s=t,n=t+i-1;for(;s<n;){const o=s+n>>1;r[o]<e?s=o+1:n=o}return s-t}function Fg(r,e,t){return .2126*r+.7152*e+.0722*t}function Lg(r,e=y.HalfFloatType){const t=r.clone();t.source=new y.Source({...t.image});const{width:i,height:s,data:n}=t.image;let o=n;if(t.type!==e){e===y.HalfFloatType?o=new Uint16Array(n.length):o=new Float32Array(n.length);let a;n instanceof Int8Array||n instanceof Int16Array||n instanceof Int32Array?a=2**(8*n.BYTES_PER_ELEMENT-1)-1:a=2**(8*n.BYTES_PER_ELEMENT)-1;for(let h=0,u=n.length;h<u;h++){let d=n[h];t.type===y.HalfFloatType&&(d=y.DataUtils.fromHalfFloat(n[h])),t.type!==y.FloatType&&t.type!==y.HalfFloatType&&(d/=a),e===y.HalfFloatType&&(o[h]=y.DataUtils.toHalfFloat(d))}t.image.data=o,t.type=e}if(t.flipY){const a=o;o=o.slice();for(let h=0;h<s;h++)for(let u=0;u<i;u++){const d=s-h-1,l=4*(h*i+u),c=4*(d*i+u);o[c+0]=a[l+0],o[c+1]=a[l+1],o[c+2]=a[l+2],o[c+3]=a[l+3]}t.flipY=!1,t.image.data=o}return t}class Og{constructor(){const e=new y.DataTexture(aa(new Float32Array([0,0,0,0])),1,1);e.type=y.HalfFloatType,e.format=y.RGBAFormat,e.minFilter=y.LinearFilter,e.magFilter=y.LinearFilter,e.wrapS=y.RepeatWrapping,e.wrapT=y.RepeatWrapping,e.generateMipmaps=!1,e.needsUpdate=!0;const t=new y.DataTexture(aa(new Float32Array([0,1])),1,2);t.type=y.HalfFloatType,t.format=y.RedFormat,t.minFilter=y.LinearFilter,t.magFilter=y.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0;const i=new y.DataTexture(aa(new Float32Array([0,0,1,1])),2,2);i.type=y.HalfFloatType,i.format=y.RedFormat,i.minFilter=y.LinearFilter,i.magFilter=y.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,this.map=e,this.marginalWeights=t,this.conditionalWeights=i,this.totalSum=0}dispose(){this.marginalWeights.dispose(),this.conditionalWeights.dispose(),this.map.dispose()}updateFrom(e){const t=Lg(e);t.wrapS=y.RepeatWrapping,t.wrapT=y.ClampToEdgeWrapping;const{width:i,height:s,data:n}=t.image,o=new Float32Array(i*s),a=new Float32Array(i*s),h=new Float32Array(s),u=new Float32Array(s);let d=0,l=0;for(let m=0;m<s;m++){let _=0;for(let v=0;v<i;v++){const x=m*i+v,b=y.DataUtils.fromHalfFloat(n[4*x+0]),w=y.DataUtils.fromHalfFloat(n[4*x+1]),C=y.DataUtils.fromHalfFloat(n[4*x+2]),S=Fg(b,w,C);_+=S,d+=S,o[x]=S,a[x]=_}if(_!==0)for(let v=m*i,x=m*i+i;v<x;v++)o[v]/=_,a[v]/=_;l+=_,h[m]=_,u[m]=l}if(l!==0)for(let m=0,_=h.length;m<_;m++)h[m]/=l,u[m]/=l;const c=new Uint16Array(s),f=new Uint16Array(i*s);for(let m=0;m<s;m++){const _=(m+1)/s,v=wc(u,_);c[m]=y.DataUtils.toHalfFloat((v+.5)/s)}for(let m=0;m<s;m++)for(let _=0;_<i;_++){const v=m*i+_,x=(_+1)/i,b=wc(a,x,m*i,i);f[v]=y.DataUtils.toHalfFloat((b+.5)/i)}this.dispose();const{marginalWeights:p,conditionalWeights:g}=this;p.image={width:s,height:1,data:c},p.needsUpdate=!0,g.image={width:i,height:s,data:f},g.needsUpdate=!0,this.totalSum=d,this.map=t}}const la=6,kg=0,Ng=1,Ug=2,Gg=3,zg=4,at=new y.Vector3,We=new y.Vector3,Ac=new y.Matrix4,lr=new y.Quaternion,Tc=new y.Vector3,hr=new y.Vector3,Hg=new y.Vector3(0,1,0);class Vg{constructor(){const e=new y.DataTexture(new Float32Array(4),1,1);e.format=y.RGBAFormat,e.type=y.FloatType,e.wrapS=y.ClampToEdgeWrapping,e.wrapT=y.ClampToEdgeWrapping,e.generateMipmaps=!1,e.minFilter=y.NearestFilter,e.magFilter=y.NearestFilter,this.tex=e,this.count=0}updateFrom(e,t=[]){const i=this.tex,s=Math.max(e.length*la,1),n=Math.ceil(Math.sqrt(s));i.image.width!==n&&(i.dispose(),i.image.data=new Float32Array(n*n*4),i.image.width=n,i.image.height=n);const o=i.image.data;for(let h=0,u=e.length;h<u;h++){const d=e[h],l=h*la*4;let c=0;for(let p=0;p<la*4;p++)o[l+p]=0;d.getWorldPosition(We),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z;let f=kg;if(d.isRectAreaLight&&d.isCircular?f=Ng:d.isSpotLight?f=Ug:d.isDirectionalLight?f=Gg:d.isPointLight&&(f=zg),o[l+c++]=f,o[l+c++]=d.color.r,o[l+c++]=d.color.g,o[l+c++]=d.color.b,o[l+c++]=d.intensity,d.getWorldQuaternion(lr),d.isRectAreaLight)at.set(d.width,0,0).applyQuaternion(lr),o[l+c++]=at.x,o[l+c++]=at.y,o[l+c++]=at.z,c++,We.set(0,d.height,0).applyQuaternion(lr),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z,o[l+c++]=at.cross(We).length()*(d.isCircular?Math.PI/4:1);else if(d.isSpotLight){const p=d.radius||0;Tc.setFromMatrixPosition(d.matrixWorld),hr.setFromMatrixPosition(d.target.matrixWorld),Ac.lookAt(Tc,hr,Hg),lr.setFromRotationMatrix(Ac),at.set(1,0,0).applyQuaternion(lr),o[l+c++]=at.x,o[l+c++]=at.y,o[l+c++]=at.z,c++,We.set(0,1,0).applyQuaternion(lr),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z,o[l+c++]=Math.PI*p*p,o[l+c++]=p,o[l+c++]=d.decay,o[l+c++]=d.distance,o[l+c++]=Math.cos(d.angle),o[l+c++]=Math.cos(d.angle*(1-d.penumbra)),o[l+c++]=d.iesMap?t.indexOf(d.iesMap):-1}else if(d.isPointLight){const p=at.setFromMatrixPosition(d.matrixWorld);o[l+c++]=p.x,o[l+c++]=p.y,o[l+c++]=p.z,c++,c+=4,c+=1,o[l+c++]=d.decay,o[l+c++]=d.distance}else if(d.isDirectionalLight){const p=at.setFromMatrixPosition(d.matrixWorld),g=We.setFromMatrixPosition(d.target.matrixWorld);hr.subVectors(p,g).normalize(),o[l+c++]=hr.x,o[l+c++]=hr.y,o[l+c++]=hr.z}}this.count=e.length;const a=Rh(o.buffer);return this.hash!==a?(this.hash=a,i.needsUpdate=!0,!0):!1}}function Sc(r,e,t,i,s){if(e>i)throw new Error;const n=r.length/e,o=r.constructor.BYTES_PER_ELEMENT*8;let a=1;switch(r.constructor){case Uint8Array:case Uint16Array:case Uint32Array:a=2**o-1;break;case Int8Array:case Int16Array:case Int32Array:a=2**(o-1)-1;break}for(let h=0;h<n;h++){const u=4*h,d=e*h;for(let l=0;l<i;l++)t[s+u+l]=e>=l+1?r[d+l]/a:0}}class Wg extends y.DataArrayTexture{constructor(){super(),this._textures=[],this.type=y.FloatType,this.format=y.RGBAFormat,this.internalFormat="RGBA32F"}updateAttribute(e,t){const i=this._textures[e];i.updateFrom(t);const s=i.image,n=this.image;if(s.width!==n.width||s.height!==n.height)throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");const{width:o,height:a,data:h}=n,d=o*a*4*e;let l=t.itemSize;l===3&&(l=4),Sc(i.image.data,l,h,4,d),this.dispose(),this.needsUpdate=!0}setAttributes(e){const t=e[0].count,i=e.length;for(let l=0,c=i;l<c;l++)if(e[l].count!==t)throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");const s=this._textures;for(;s.length<i;){const l=new pi.FloatVertexAttributeTexture;s.push(l)}for(;s.length>i;)s.pop();for(let l=0,c=i;l<c;l++)s[l].updateFrom(e[l]);const o=s[0].image,a=this.image;(o.width!==a.width||o.height!==a.height||o.depth!==i)&&(a.width=o.width,a.height=o.height,a.depth=i,a.data=new Float32Array(a.width*a.height*a.depth*4));const{data:h,width:u,height:d}=a;for(let l=0,c=i;l<c;l++){const f=s[l],g=u*d*4*l;let m=e[l].itemSize;m===3&&(m=4),Sc(f.image.data,m,h,4,g)}this.dispose(),this.needsUpdate=!0}}class $g extends Wg{updateNormalAttribute(e){this.updateAttribute(0,e)}updateTangentAttribute(e){this.updateAttribute(1,e)}updateUvAttribute(e){this.updateAttribute(2,e)}updateColorAttribute(e){this.updateAttribute(3,e)}updateFrom(e,t,i,s){this.setAttributes([e,t,i,s])}}function Bh(r,e){return r.uuid<e.uuid?1:r.uuid>e.uuid?-1:0}function fl(r){return`${r.source.uuid}:${r.colorSpace}`}function Xg(r){const e=new Set,t=[];for(let i=0,s=r.length;i<s;i++){const n=r[i],o=fl(n);e.has(o)||(e.add(o),t.push(n))}return t}function jg(r){const e=r.map(i=>i.iesMap||null).filter(i=>i),t=new Set(e);return Array.from(t).sort(Bh)}function Yg(r){const e=new Set;for(let i=0,s=r.length;i<s;i++){const n=r[i];for(const o in n){const a=n[o];a&&a.isTexture&&e.add(a)}}const t=Array.from(e);return Xg(t).sort(Bh)}function qg(r){const e=[];return r.traverse(t=>{t.visible&&(t.isRectAreaLight||t.isSpotLight||t.isPointLight||t.isDirectionalLight)&&e.push(t)}),e.sort(Bh)}const af=45,Ec=af*4;class Zg{constructor(){this._features={}}isUsed(e){return e in this._features}setUsed(e,t=!0){t===!1?delete this._features[e]:this._features[e]=!0}reset(){this._features={}}}class Kg extends y.DataTexture{constructor(){super(new Float32Array(4),1,1),this.format=y.RGBAFormat,this.type=y.FloatType,this.wrapS=y.ClampToEdgeWrapping,this.wrapT=y.ClampToEdgeWrapping,this.minFilter=y.NearestFilter,this.magFilter=y.NearestFilter,this.generateMipmaps=!1,this.features=new Zg}updateFrom(e,t){function i(p,g,m=-1){if(g in p&&p[g]){const _=fl(p[g]);return l[_]}else return m}function s(p,g,m){return g in p?p[g]:m}function n(p,g,m,_){const v=p[g]&&p[g].isTexture?p[g]:null;if(v){v.matrixAutoUpdate&&v.updateMatrix();const x=v.matrix.elements;let b=0;m[_+b++]=x[0],m[_+b++]=x[3],m[_+b++]=x[6],b++,m[_+b++]=x[1],m[_+b++]=x[4],m[_+b++]=x[7],b++}return 8}let o=0;const a=e.length*af,h=Math.ceil(Math.sqrt(a))||1,{image:u,features:d}=this,l={};for(let p=0,g=t.length;p<g;p++)l[fl(t[p])]=p;u.width!==h&&(this.dispose(),u.data=new Float32Array(h*h*4),u.width=h,u.height=h);const c=u.data;d.reset();for(let p=0,g=e.length;p<g;p++){const m=e[p];if(m.isFogVolumeMaterial){d.setUsed("FOG");for(let x=0;x<Ec;x++)c[o+x]=0;c[o+0*4+0]=m.color.r,c[o+0*4+1]=m.color.g,c[o+0*4+2]=m.color.b,c[o+2*4+3]=s(m,"emissiveIntensity",0),c[o+3*4+0]=m.emissive.r,c[o+3*4+1]=m.emissive.g,c[o+3*4+2]=m.emissive.b,c[o+13*4+1]=m.density,c[o+13*4+3]=0,c[o+14*4+2]=4,o+=Ec;continue}c[o++]=m.color.r,c[o++]=m.color.g,c[o++]=m.color.b,c[o++]=i(m,"map"),c[o++]=s(m,"metalness",0),c[o++]=i(m,"metalnessMap"),c[o++]=s(m,"roughness",0),c[o++]=i(m,"roughnessMap"),c[o++]=s(m,"ior",1.5),c[o++]=s(m,"transmission",0),c[o++]=i(m,"transmissionMap"),c[o++]=s(m,"emissiveIntensity",0),"emissive"in m?(c[o++]=m.emissive.r,c[o++]=m.emissive.g,c[o++]=m.emissive.b):(c[o++]=0,c[o++]=0,c[o++]=0),c[o++]=i(m,"emissiveMap"),c[o++]=i(m,"normalMap"),"normalScale"in m?(c[o++]=m.normalScale.x,c[o++]=m.normalScale.y):(c[o++]=1,c[o++]=1),c[o++]=s(m,"clearcoat",0),c[o++]=i(m,"clearcoatMap"),c[o++]=s(m,"clearcoatRoughness",0),c[o++]=i(m,"clearcoatRoughnessMap"),c[o++]=i(m,"clearcoatNormalMap"),"clearcoatNormalScale"in m?(c[o++]=m.clearcoatNormalScale.x,c[o++]=m.clearcoatNormalScale.y):(c[o++]=1,c[o++]=1),o++,c[o++]=s(m,"sheen",0),"sheenColor"in m?(c[o++]=m.sheenColor.r,c[o++]=m.sheenColor.g,c[o++]=m.sheenColor.b):(c[o++]=0,c[o++]=0,c[o++]=0),c[o++]=i(m,"sheenColorMap"),c[o++]=s(m,"sheenRoughness",0),c[o++]=i(m,"sheenRoughnessMap"),c[o++]=i(m,"iridescenceMap"),c[o++]=i(m,"iridescenceThicknessMap"),c[o++]=s(m,"iridescence",0),c[o++]=s(m,"iridescenceIOR",1.3);const _=s(m,"iridescenceThicknessRange",[100,400]);c[o++]=_[0],c[o++]=_[1],"specularColor"in m?(c[o++]=m.specularColor.r,c[o++]=m.specularColor.g,c[o++]=m.specularColor.b):(c[o++]=1,c[o++]=1,c[o++]=1),c[o++]=i(m,"specularColorMap"),c[o++]=s(m,"specularIntensity",1),c[o++]=i(m,"specularIntensityMap");const v=s(m,"thickness",0)===0&&s(m,"attenuationDistance",1/0)===1/0;if(c[o++]=Number(v),o++,"attenuationColor"in m?(c[o++]=m.attenuationColor.r,c[o++]=m.attenuationColor.g,c[o++]=m.attenuationColor.b):(c[o++]=1,c[o++]=1,c[o++]=1),c[o++]=s(m,"attenuationDistance",1/0),c[o++]=i(m,"alphaMap"),c[o++]=m.opacity,c[o++]=m.alphaTest,!v&&m.transmission>0)c[o++]=0;else switch(m.side){case y.FrontSide:c[o++]=1;break;case y.BackSide:c[o++]=-1;break;case y.DoubleSide:c[o++]=0;break}c[o++]=Number(s(m,"matte",!1)),c[o++]=Number(s(m,"castShadow",!0)),c[o++]=Number(m.vertexColors)|Number(m.flatShading)<<1,c[o++]=Number(m.transparent),o+=n(m,"map",c,o),o+=n(m,"metalnessMap",c,o),o+=n(m,"roughnessMap",c,o),o+=n(m,"transmissionMap",c,o),o+=n(m,"emissiveMap",c,o),o+=n(m,"normalMap",c,o),o+=n(m,"clearcoatMap",c,o),o+=n(m,"clearcoatNormalMap",c,o),o+=n(m,"clearcoatRoughnessMap",c,o),o+=n(m,"sheenColorMap",c,o),o+=n(m,"sheenRoughnessMap",c,o),o+=n(m,"iridescenceMap",c,o),o+=n(m,"iridescenceThicknessMap",c,o),o+=n(m,"specularColorMap",c,o),o+=n(m,"specularIntensityMap",c,o)}const f=Rh(c.buffer);return this.hash!==f?(this.hash=f,this.needsUpdate=!0,!0):!1}}const Cc=new y.Color;function Qg(r){return r?`${r.uuid}:${r.version}`:null}function Jg(r,e){for(const t in e)t in r&&(r[t]=e[t])}class Mc extends y.WebGLArrayRenderTarget{constructor(e,t,i){const s={format:y.RGBAFormat,type:y.UnsignedByteType,minFilter:y.LinearFilter,magFilter:y.LinearFilter,wrapS:y.RepeatWrapping,wrapT:y.RepeatWrapping,generateMipmaps:!1,...i};super(e,t,1,s),Jg(this.texture,s),this.texture.setTextures=(...o)=>{this.setTextures(...o)},this.hashes=[null];const n=new Kr.FullScreenQuad(new e0);this.fsQuad=n}setTextures(e,t,i=this.width,s=this.height){const n=e.getRenderTarget(),o=e.toneMapping,a=e.getClearAlpha();e.getClearColor(Cc);const h=t.length||1;(i!==this.width||s!==this.height||this.depth!==h)&&(this.setSize(i,s,h),this.hashes=new Array(h).fill(null)),e.setClearColor(0,0),e.toneMapping=y.NoToneMapping;const u=this.fsQuad,d=this.hashes;let l=!1;for(let c=0,f=h;c<f;c++){const p=t[c],g=Qg(p);p&&(d[c]!==g||p.isWebGLRenderTarget)&&(p.matrixAutoUpdate=!1,p.matrix.identity(),u.material.map=p,e.setRenderTarget(this,c),u.render(e),p.updateMatrix(),p.matrixAutoUpdate=!0,d[c]=g,l=!0)}return u.material.map=null,e.setClearColor(Cc,a),e.setRenderTarget(n),e.toneMapping=o,l}dispose(){super.dispose(),this.fsQuad.dispose()}}class e0 extends y.ShaderMaterial{get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}constructor(){super({uniforms:{map:{value:null}},vertexShader:`
|
|
257
|
+
`})}}class Dg{generate(e,t=256){const i=new y.WebGLRenderTarget(t,t,{type:y.FloatType,format:y.RGBAFormat,minFilter:y.NearestFilter,magFilter:y.NearestFilter,generateMipmaps:!1}),s=e.getRenderTarget();e.setRenderTarget(i);const n=new Kr.FullScreenQuad(new Rg);return n.material.resolution.set(t,t),n.render(e),e.setRenderTarget(s),n.dispose(),i}}class Bg extends y.PerspectiveCamera{set bokehSize(e){this.fStop=this.getFocalLength()/e}get bokehSize(){return this.getFocalLength()/this.fStop}constructor(...e){super(...e),this.fStop=1.4,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=25,this.anamorphicRatio=1}copy(e,t){return super.copy(e,t),this.fStop=e.fStop,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio,this}}class Fg{constructor(){this.bokehSize=0,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=10,this.anamorphicRatio=1}updateFrom(e){e instanceof Bg?(this.bokehSize=e.bokehSize,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio):(this.bokehSize=0,this.apertureRotation=0,this.apertureBlades=0,this.focusDistance=10,this.anamorphicRatio=1)}}function oa(r){const e=new Uint16Array(r.length);for(let t=0,i=r.length;t<i;++t)e[t]=y.DataUtils.toHalfFloat(r[t]);return e}function wc(r,e,t=0,i=r.length){let s=t,n=t+i-1;for(;s<n;){const o=s+n>>1;r[o]<e?s=o+1:n=o}return s-t}function Lg(r,e,t){return .2126*r+.7152*e+.0722*t}function Og(r,e=y.HalfFloatType){const t=r.clone();t.source=new y.Source({...t.image});const{width:i,height:s,data:n}=t.image;let o=n;if(t.type!==e){e===y.HalfFloatType?o=new Uint16Array(n.length):o=new Float32Array(n.length);let a;n instanceof Int8Array||n instanceof Int16Array||n instanceof Int32Array?a=2**(8*n.BYTES_PER_ELEMENT-1)-1:a=2**(8*n.BYTES_PER_ELEMENT)-1;for(let h=0,u=n.length;h<u;h++){let d=n[h];t.type===y.HalfFloatType&&(d=y.DataUtils.fromHalfFloat(n[h])),t.type!==y.FloatType&&t.type!==y.HalfFloatType&&(d/=a),e===y.HalfFloatType&&(o[h]=y.DataUtils.toHalfFloat(d))}t.image.data=o,t.type=e}if(t.flipY){const a=o;o=o.slice();for(let h=0;h<s;h++)for(let u=0;u<i;u++){const d=s-h-1,l=4*(h*i+u),c=4*(d*i+u);o[c+0]=a[l+0],o[c+1]=a[l+1],o[c+2]=a[l+2],o[c+3]=a[l+3]}t.flipY=!1,t.image.data=o}return t}class kg{constructor(){const e=new y.DataTexture(oa(new Float32Array([0,0,0,0])),1,1);e.type=y.HalfFloatType,e.format=y.RGBAFormat,e.minFilter=y.LinearFilter,e.magFilter=y.LinearFilter,e.wrapS=y.RepeatWrapping,e.wrapT=y.RepeatWrapping,e.generateMipmaps=!1,e.needsUpdate=!0;const t=new y.DataTexture(oa(new Float32Array([0,1])),1,2);t.type=y.HalfFloatType,t.format=y.RedFormat,t.minFilter=y.LinearFilter,t.magFilter=y.LinearFilter,t.generateMipmaps=!1,t.needsUpdate=!0;const i=new y.DataTexture(oa(new Float32Array([0,0,1,1])),2,2);i.type=y.HalfFloatType,i.format=y.RedFormat,i.minFilter=y.LinearFilter,i.magFilter=y.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,this.map=e,this.marginalWeights=t,this.conditionalWeights=i,this.totalSum=0}dispose(){this.marginalWeights.dispose(),this.conditionalWeights.dispose(),this.map.dispose()}updateFrom(e){const t=Og(e);t.wrapS=y.RepeatWrapping,t.wrapT=y.ClampToEdgeWrapping;const{width:i,height:s,data:n}=t.image,o=new Float32Array(i*s),a=new Float32Array(i*s),h=new Float32Array(s),u=new Float32Array(s);let d=0,l=0;for(let m=0;m<s;m++){let _=0;for(let v=0;v<i;v++){const x=m*i+v,b=y.DataUtils.fromHalfFloat(n[4*x+0]),w=y.DataUtils.fromHalfFloat(n[4*x+1]),C=y.DataUtils.fromHalfFloat(n[4*x+2]),S=Lg(b,w,C);_+=S,d+=S,o[x]=S,a[x]=_}if(_!==0)for(let v=m*i,x=m*i+i;v<x;v++)o[v]/=_,a[v]/=_;l+=_,h[m]=_,u[m]=l}if(l!==0)for(let m=0,_=h.length;m<_;m++)h[m]/=l,u[m]/=l;const c=new Uint16Array(s),f=new Uint16Array(i*s);for(let m=0;m<s;m++){const _=(m+1)/s,v=wc(u,_);c[m]=y.DataUtils.toHalfFloat((v+.5)/s)}for(let m=0;m<s;m++)for(let _=0;_<i;_++){const v=m*i+_,x=(_+1)/i,b=wc(a,x,m*i,i);f[v]=y.DataUtils.toHalfFloat((b+.5)/i)}this.dispose();const{marginalWeights:p,conditionalWeights:g}=this;p.image={width:s,height:1,data:c},p.needsUpdate=!0,g.image={width:i,height:s,data:f},g.needsUpdate=!0,this.totalSum=d,this.map=t}}const aa=6,Ng=0,Ug=1,Gg=2,zg=3,Hg=4,at=new y.Vector3,We=new y.Vector3,Ac=new y.Matrix4,lr=new y.Quaternion,Tc=new y.Vector3,hr=new y.Vector3,Vg=new y.Vector3(0,1,0);class Wg{constructor(){const e=new y.DataTexture(new Float32Array(4),1,1);e.format=y.RGBAFormat,e.type=y.FloatType,e.wrapS=y.ClampToEdgeWrapping,e.wrapT=y.ClampToEdgeWrapping,e.generateMipmaps=!1,e.minFilter=y.NearestFilter,e.magFilter=y.NearestFilter,this.tex=e,this.count=0}updateFrom(e,t=[]){const i=this.tex,s=Math.max(e.length*aa,1),n=Math.ceil(Math.sqrt(s));i.image.width!==n&&(i.dispose(),i.image.data=new Float32Array(n*n*4),i.image.width=n,i.image.height=n);const o=i.image.data;for(let h=0,u=e.length;h<u;h++){const d=e[h],l=h*aa*4;let c=0;for(let p=0;p<aa*4;p++)o[l+p]=0;d.getWorldPosition(We),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z;let f=Ng;if(d.isRectAreaLight&&d.isCircular?f=Ug:d.isSpotLight?f=Gg:d.isDirectionalLight?f=zg:d.isPointLight&&(f=Hg),o[l+c++]=f,o[l+c++]=d.color.r,o[l+c++]=d.color.g,o[l+c++]=d.color.b,o[l+c++]=d.intensity,d.getWorldQuaternion(lr),d.isRectAreaLight)at.set(d.width,0,0).applyQuaternion(lr),o[l+c++]=at.x,o[l+c++]=at.y,o[l+c++]=at.z,c++,We.set(0,d.height,0).applyQuaternion(lr),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z,o[l+c++]=at.cross(We).length()*(d.isCircular?Math.PI/4:1);else if(d.isSpotLight){const p=d.radius||0;Tc.setFromMatrixPosition(d.matrixWorld),hr.setFromMatrixPosition(d.target.matrixWorld),Ac.lookAt(Tc,hr,Vg),lr.setFromRotationMatrix(Ac),at.set(1,0,0).applyQuaternion(lr),o[l+c++]=at.x,o[l+c++]=at.y,o[l+c++]=at.z,c++,We.set(0,1,0).applyQuaternion(lr),o[l+c++]=We.x,o[l+c++]=We.y,o[l+c++]=We.z,o[l+c++]=Math.PI*p*p,o[l+c++]=p,o[l+c++]=d.decay,o[l+c++]=d.distance,o[l+c++]=Math.cos(d.angle),o[l+c++]=Math.cos(d.angle*(1-d.penumbra)),o[l+c++]=d.iesMap?t.indexOf(d.iesMap):-1}else if(d.isPointLight){const p=at.setFromMatrixPosition(d.matrixWorld);o[l+c++]=p.x,o[l+c++]=p.y,o[l+c++]=p.z,c++,c+=4,c+=1,o[l+c++]=d.decay,o[l+c++]=d.distance}else if(d.isDirectionalLight){const p=at.setFromMatrixPosition(d.matrixWorld),g=We.setFromMatrixPosition(d.target.matrixWorld);hr.subVectors(p,g).normalize(),o[l+c++]=hr.x,o[l+c++]=hr.y,o[l+c++]=hr.z}}this.count=e.length;const a=Rh(o.buffer);return this.hash!==a?(this.hash=a,i.needsUpdate=!0,!0):!1}}function Sc(r,e,t,i,s){if(e>i)throw new Error;const n=r.length/e,o=r.constructor.BYTES_PER_ELEMENT*8;let a=1;switch(r.constructor){case Uint8Array:case Uint16Array:case Uint32Array:a=2**o-1;break;case Int8Array:case Int16Array:case Int32Array:a=2**(o-1)-1;break}for(let h=0;h<n;h++){const u=4*h,d=e*h;for(let l=0;l<i;l++)t[s+u+l]=e>=l+1?r[d+l]/a:0}}class $g extends y.DataArrayTexture{constructor(){super(),this._textures=[],this.type=y.FloatType,this.format=y.RGBAFormat,this.internalFormat="RGBA32F"}updateAttribute(e,t){const i=this._textures[e];i.updateFrom(t);const s=i.image,n=this.image;if(s.width!==n.width||s.height!==n.height)throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");const{width:o,height:a,data:h}=n,d=o*a*4*e;let l=t.itemSize;l===3&&(l=4),Sc(i.image.data,l,h,4,d),this.dispose(),this.needsUpdate=!0}setAttributes(e){const t=e[0].count,i=e.length;for(let l=0,c=i;l<c;l++)if(e[l].count!==t)throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");const s=this._textures;for(;s.length<i;){const l=new pi.FloatVertexAttributeTexture;s.push(l)}for(;s.length>i;)s.pop();for(let l=0,c=i;l<c;l++)s[l].updateFrom(e[l]);const o=s[0].image,a=this.image;(o.width!==a.width||o.height!==a.height||o.depth!==i)&&(a.width=o.width,a.height=o.height,a.depth=i,a.data=new Float32Array(a.width*a.height*a.depth*4));const{data:h,width:u,height:d}=a;for(let l=0,c=i;l<c;l++){const f=s[l],g=u*d*4*l;let m=e[l].itemSize;m===3&&(m=4),Sc(f.image.data,m,h,4,g)}this.dispose(),this.needsUpdate=!0}}class Xg extends $g{updateNormalAttribute(e){this.updateAttribute(0,e)}updateTangentAttribute(e){this.updateAttribute(1,e)}updateUvAttribute(e){this.updateAttribute(2,e)}updateColorAttribute(e){this.updateAttribute(3,e)}updateFrom(e,t,i,s){this.setAttributes([e,t,i,s])}}function Bh(r,e){return r.uuid<e.uuid?1:r.uuid>e.uuid?-1:0}function dl(r){return`${r.source.uuid}:${r.colorSpace}`}function jg(r){const e=new Set,t=[];for(let i=0,s=r.length;i<s;i++){const n=r[i],o=dl(n);e.has(o)||(e.add(o),t.push(n))}return t}function Yg(r){const e=r.map(i=>i.iesMap||null).filter(i=>i),t=new Set(e);return Array.from(t).sort(Bh)}function qg(r){const e=new Set;for(let i=0,s=r.length;i<s;i++){const n=r[i];for(const o in n){const a=n[o];a&&a.isTexture&&e.add(a)}}const t=Array.from(e);return jg(t).sort(Bh)}function Zg(r){const e=[];return r.traverse(t=>{t.visible&&(t.isRectAreaLight||t.isSpotLight||t.isPointLight||t.isDirectionalLight)&&e.push(t)}),e.sort(Bh)}const af=45,Ec=af*4;class Kg{constructor(){this._features={}}isUsed(e){return e in this._features}setUsed(e,t=!0){t===!1?delete this._features[e]:this._features[e]=!0}reset(){this._features={}}}class Qg extends y.DataTexture{constructor(){super(new Float32Array(4),1,1),this.format=y.RGBAFormat,this.type=y.FloatType,this.wrapS=y.ClampToEdgeWrapping,this.wrapT=y.ClampToEdgeWrapping,this.minFilter=y.NearestFilter,this.magFilter=y.NearestFilter,this.generateMipmaps=!1,this.features=new Kg}updateFrom(e,t){function i(p,g,m=-1){if(g in p&&p[g]){const _=dl(p[g]);return l[_]}else return m}function s(p,g,m){return g in p?p[g]:m}function n(p,g,m,_){const v=p[g]&&p[g].isTexture?p[g]:null;if(v){v.matrixAutoUpdate&&v.updateMatrix();const x=v.matrix.elements;let b=0;m[_+b++]=x[0],m[_+b++]=x[3],m[_+b++]=x[6],b++,m[_+b++]=x[1],m[_+b++]=x[4],m[_+b++]=x[7],b++}return 8}let o=0;const a=e.length*af,h=Math.ceil(Math.sqrt(a))||1,{image:u,features:d}=this,l={};for(let p=0,g=t.length;p<g;p++)l[dl(t[p])]=p;u.width!==h&&(this.dispose(),u.data=new Float32Array(h*h*4),u.width=h,u.height=h);const c=u.data;d.reset();for(let p=0,g=e.length;p<g;p++){const m=e[p];if(m.isFogVolumeMaterial){d.setUsed("FOG");for(let x=0;x<Ec;x++)c[o+x]=0;c[o+0*4+0]=m.color.r,c[o+0*4+1]=m.color.g,c[o+0*4+2]=m.color.b,c[o+2*4+3]=s(m,"emissiveIntensity",0),c[o+3*4+0]=m.emissive.r,c[o+3*4+1]=m.emissive.g,c[o+3*4+2]=m.emissive.b,c[o+13*4+1]=m.density,c[o+13*4+3]=0,c[o+14*4+2]=4,o+=Ec;continue}c[o++]=m.color.r,c[o++]=m.color.g,c[o++]=m.color.b,c[o++]=i(m,"map"),c[o++]=s(m,"metalness",0),c[o++]=i(m,"metalnessMap"),c[o++]=s(m,"roughness",0),c[o++]=i(m,"roughnessMap"),c[o++]=s(m,"ior",1.5),c[o++]=s(m,"transmission",0),c[o++]=i(m,"transmissionMap"),c[o++]=s(m,"emissiveIntensity",0),"emissive"in m?(c[o++]=m.emissive.r,c[o++]=m.emissive.g,c[o++]=m.emissive.b):(c[o++]=0,c[o++]=0,c[o++]=0),c[o++]=i(m,"emissiveMap"),c[o++]=i(m,"normalMap"),"normalScale"in m?(c[o++]=m.normalScale.x,c[o++]=m.normalScale.y):(c[o++]=1,c[o++]=1),c[o++]=s(m,"clearcoat",0),c[o++]=i(m,"clearcoatMap"),c[o++]=s(m,"clearcoatRoughness",0),c[o++]=i(m,"clearcoatRoughnessMap"),c[o++]=i(m,"clearcoatNormalMap"),"clearcoatNormalScale"in m?(c[o++]=m.clearcoatNormalScale.x,c[o++]=m.clearcoatNormalScale.y):(c[o++]=1,c[o++]=1),o++,c[o++]=s(m,"sheen",0),"sheenColor"in m?(c[o++]=m.sheenColor.r,c[o++]=m.sheenColor.g,c[o++]=m.sheenColor.b):(c[o++]=0,c[o++]=0,c[o++]=0),c[o++]=i(m,"sheenColorMap"),c[o++]=s(m,"sheenRoughness",0),c[o++]=i(m,"sheenRoughnessMap"),c[o++]=i(m,"iridescenceMap"),c[o++]=i(m,"iridescenceThicknessMap"),c[o++]=s(m,"iridescence",0),c[o++]=s(m,"iridescenceIOR",1.3);const _=s(m,"iridescenceThicknessRange",[100,400]);c[o++]=_[0],c[o++]=_[1],"specularColor"in m?(c[o++]=m.specularColor.r,c[o++]=m.specularColor.g,c[o++]=m.specularColor.b):(c[o++]=1,c[o++]=1,c[o++]=1),c[o++]=i(m,"specularColorMap"),c[o++]=s(m,"specularIntensity",1),c[o++]=i(m,"specularIntensityMap");const v=s(m,"thickness",0)===0&&s(m,"attenuationDistance",1/0)===1/0;if(c[o++]=Number(v),o++,"attenuationColor"in m?(c[o++]=m.attenuationColor.r,c[o++]=m.attenuationColor.g,c[o++]=m.attenuationColor.b):(c[o++]=1,c[o++]=1,c[o++]=1),c[o++]=s(m,"attenuationDistance",1/0),c[o++]=i(m,"alphaMap"),c[o++]=m.opacity,c[o++]=m.alphaTest,!v&&m.transmission>0)c[o++]=0;else switch(m.side){case y.FrontSide:c[o++]=1;break;case y.BackSide:c[o++]=-1;break;case y.DoubleSide:c[o++]=0;break}c[o++]=Number(s(m,"matte",!1)),c[o++]=Number(s(m,"castShadow",!0)),c[o++]=Number(m.vertexColors)|Number(m.flatShading)<<1,c[o++]=Number(m.transparent),o+=n(m,"map",c,o),o+=n(m,"metalnessMap",c,o),o+=n(m,"roughnessMap",c,o),o+=n(m,"transmissionMap",c,o),o+=n(m,"emissiveMap",c,o),o+=n(m,"normalMap",c,o),o+=n(m,"clearcoatMap",c,o),o+=n(m,"clearcoatNormalMap",c,o),o+=n(m,"clearcoatRoughnessMap",c,o),o+=n(m,"sheenColorMap",c,o),o+=n(m,"sheenRoughnessMap",c,o),o+=n(m,"iridescenceMap",c,o),o+=n(m,"iridescenceThicknessMap",c,o),o+=n(m,"specularColorMap",c,o),o+=n(m,"specularIntensityMap",c,o)}const f=Rh(c.buffer);return this.hash!==f?(this.hash=f,this.needsUpdate=!0,!0):!1}}const Cc=new y.Color;function Jg(r){return r?`${r.uuid}:${r.version}`:null}function e0(r,e){for(const t in e)t in r&&(r[t]=e[t])}class Mc extends y.WebGLArrayRenderTarget{constructor(e,t,i){const s={format:y.RGBAFormat,type:y.UnsignedByteType,minFilter:y.LinearFilter,magFilter:y.LinearFilter,wrapS:y.RepeatWrapping,wrapT:y.RepeatWrapping,generateMipmaps:!1,...i};super(e,t,1,s),e0(this.texture,s),this.texture.setTextures=(...o)=>{this.setTextures(...o)},this.hashes=[null];const n=new Kr.FullScreenQuad(new t0);this.fsQuad=n}setTextures(e,t,i=this.width,s=this.height){const n=e.getRenderTarget(),o=e.toneMapping,a=e.getClearAlpha();e.getClearColor(Cc);const h=t.length||1;(i!==this.width||s!==this.height||this.depth!==h)&&(this.setSize(i,s,h),this.hashes=new Array(h).fill(null)),e.setClearColor(0,0),e.toneMapping=y.NoToneMapping;const u=this.fsQuad,d=this.hashes;let l=!1;for(let c=0,f=h;c<f;c++){const p=t[c],g=Jg(p);p&&(d[c]!==g||p.isWebGLRenderTarget)&&(p.matrixAutoUpdate=!1,p.matrix.identity(),u.material.map=p,e.setRenderTarget(this,c),u.render(e),p.updateMatrix(),p.matrixAutoUpdate=!0,d[c]=g,l=!0)}return u.material.map=null,e.setClearColor(Cc,a),e.setRenderTarget(n),e.toneMapping=o,l}dispose(){super.dispose(),this.fsQuad.dispose()}}class t0 extends y.ShaderMaterial{get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}constructor(){super({uniforms:{map:{value:null}},vertexShader:`
|
|
258
258
|
varying vec2 vUv;
|
|
259
259
|
void main() {
|
|
260
260
|
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
gl_FragColor = texture2D( map, vUv );
|
|
271
271
|
|
|
272
272
|
}
|
|
273
|
-
`})}}function
|
|
273
|
+
`})}}function i0(r,e=Math.random()){for(let t=r.length-1;t>0;t--){const i=Math.floor(e()*(t+1)),s=r[t];r[t]=r[i],r[i]=s}return r}class r0{constructor(e,t,i=Math.random){const s=e**t,n=new Uint16Array(s);let o=s;for(let a=0;a<s;a++)n[a]=a;this.samples=new Float32Array(t),this.strataCount=e,this.reset=function(){for(let a=0;a<s;a++)n[a]=a;o=0},this.reshuffle=function(){o=0},this.next=function(){const{samples:a}=this;o>=n.length&&(i0(n,i),this.reshuffle());let h=n[o++];for(let u=0;u<t;u++)a[u]=(h%e+i())/e,h=Math.floor(h/e);return a}}}class s0{constructor(e,t,i=Math.random){let s=0;for(const h of t)s+=h;const n=new Float32Array(s),o=[];let a=0;for(const h of t){const u=new r0(e,h,i);u.samples=new Float32Array(n.buffer,a,u.samples.length),a+=u.samples.length*4,o.push(u)}this.samples=n,this.strataCount=e,this.next=function(){for(const h of o)h.next();return n},this.reshuffle=function(){for(const h of o)h.reshuffle()},this.reset=function(){for(const h of o)h.reset()}}}class n0{constructor(e=0){this.m=2147483648,this.a=1103515245,this.c=12345,this.seed=e}nextInt(){return this.seed=(this.a*this.seed+this.c)%this.m,this.seed}nextFloat(){return this.nextInt()/(this.m-1)}}class o0 extends y.DataTexture{constructor(e=1,t=1,i=8){super(new Float32Array(1),1,1,y.RGBAFormat,y.FloatType),this.minFilter=y.NearestFilter,this.magFilter=y.NearestFilter,this.strata=i,this.sampler=null,this.generator=new n0,this.stableNoise=!1,this.random=()=>this.stableNoise?this.generator.nextFloat():Math.random(),this.init(e,t,i)}init(e=this.image.height,t=this.image.width,i=this.strata){const{image:s}=this;if(s.width===t&&s.height===e&&this.sampler!==null)return;const n=new Array(e*t).fill(4),o=new s0(i,n,this.random);s.width=t,s.height=e,s.data=o.samples,this.sampler=o,this.dispose(),this.next()}next(){this.sampler.next(),this.needsUpdate=!0}reset(){this.sampler.reset(),this.generator.seed=0}}function a0(r,e=Math.random){for(let t=r.length-1;t>0;t--){const i=~~((e()-1e-6)*t),s=r[t];r[t]=r[i],r[i]=s}}function l0(r,e){r.fill(0);for(let t=0;t<e;t++)r[t]=1}class Ic{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){const{score:e,binaryPattern:t}=this;let i=1/0,s=-1;for(let n=0,o=t.length;n<o;n++){if(t[n]!==0)continue;const a=e[n];a<i&&(i=a,s=n)}return s}findCluster(){const{score:e,binaryPattern:t}=this;let i=-1/0,s=-1;for(let n=0,o=t.length;n<o;n++){if(t[n]!==1)continue;const a=e[n];a>i&&(i=a,s=n)}return s}setSigma(e){if(e===this.sigma)return;const t=~~(Math.sqrt(10*2*e**2)+1),i=2*t+1,s=new Float32Array(i*i),n=e*e;for(let o=-t;o<=t;o++)for(let a=-t;a<=t;a++){const h=(t+a)*i+o+t,u=o*o+a*a;s[h]=Math.E**(-u/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:i}=this;t.fill(0);for(let s=0,n=e.length;s<n;s++)if(e[s]===0){const o=~~(s/i),a=s-o*i;this.updateScore(a,o,1),e[s]=1}else e[s]=0}updateScore(e,t,i){const{size:s,score:n,lookupTable:o}=this,a=this.radius,h=2*a+1;for(let u=-a;u<=a;u++)for(let d=-a;d<=a;d++){const l=(a+d)*h+u+a,c=o[l];let f=e+u;f=f<0?s+f:f%s;let p=t+d;p=p<0?s+p:p%s;const g=p*s+f;n[g]+=i*c}}addPointIndex(e){this.binaryPattern[e]=1;const t=this.size,i=~~(e/t),s=e-i*t;this.updateScore(s,i,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;const t=this.size,i=~~(e/t),s=e-i*t;this.updateScore(s,i,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class h0{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new Ic(1),this.savedSamples=new Ic(1)}generate(){const{samples:e,savedSamples:t,sigma:i,majorityPointsRatio:s,size:n}=this;e.resize(n),e.setSigma(i);const o=Math.floor(n*n*s),a=e.binaryPattern;l0(a,o),a0(a,this.random);for(let l=0,c=a.length;l<c;l++)a[l]===1&&e.addPointIndex(l);for(;;){const l=e.findCluster();e.removePointIndex(l);const c=e.findVoid();if(l===c){e.addPointIndex(l);break}e.addPointIndex(c)}const h=new Uint32Array(n*n);t.copy(e);let u;for(u=e.count-1;u>=0;){const l=e.findCluster();e.removePointIndex(l),h[l]=u,u--}const d=n*n;for(u=t.count;u<d/2;){const l=t.findVoid();t.addPointIndex(l),h[l]=u,u++}for(t.invert();u<d;){const l=t.findCluster();t.removePointIndex(l),h[l]=u,u++}return{data:h,maxValue:d}}}function c0(r){return r>=3?4:r}function u0(r){switch(r){case 1:return y.RedFormat;case 2:return y.RGFormat;default:return y.RGBAFormat}}class d0 extends y.DataTexture{constructor(e=64,t=1){super(new Float32Array(4),1,1,y.RGBAFormat,y.FloatType),this.minFilter=y.NearestFilter,this.magFilter=y.NearestFilter,this.size=e,this.channels=t,this.update()}update(){const e=this.channels,t=this.size,i=new h0;i.channels=e,i.size=t;const s=c0(e),n=u0(s);(this.image.width!==t||n!==this.format)&&(this.image.width=t,this.image.height=t,this.image.data=new Float32Array(t**2*s),this.format=n,this.dispose());const o=this.image.data;for(let a=0,h=e;a<h;a++){const u=i.generate(),d=u.data,l=u.maxValue;for(let c=0,f=d.length;c<f;c++){const p=d[c]/l;o[c*s+a]=p}}this.needsUpdate=!0}}const f0=`
|
|
274
274
|
|
|
275
275
|
struct PhysicalCamera {
|
|
276
276
|
|
|
@@ -282,7 +282,7 @@
|
|
|
282
282
|
|
|
283
283
|
};
|
|
284
284
|
|
|
285
|
-
`,
|
|
285
|
+
`,p0=`
|
|
286
286
|
|
|
287
287
|
struct EquirectHdrInfo {
|
|
288
288
|
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
-
`,
|
|
297
|
+
`,m0=`
|
|
298
298
|
|
|
299
299
|
#define RECT_AREA_LIGHT_TYPE 0
|
|
300
300
|
#define CIRC_AREA_LIGHT_TYPE 1
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
`,
|
|
383
|
+
`,g0=`
|
|
384
384
|
|
|
385
385
|
struct Material {
|
|
386
386
|
|
|
@@ -587,7 +587,7 @@
|
|
|
587
587
|
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
`,
|
|
590
|
+
`,_0=`
|
|
591
591
|
|
|
592
592
|
struct SurfaceRecord {
|
|
593
593
|
|
|
@@ -649,7 +649,7 @@
|
|
|
649
649
|
vec3 color;
|
|
650
650
|
};
|
|
651
651
|
|
|
652
|
-
`,
|
|
652
|
+
`,y0=`
|
|
653
653
|
|
|
654
654
|
// samples the the given environment map in the given direction
|
|
655
655
|
vec3 sampleEquirectColor( sampler2D envMap, vec3 direction ) {
|
|
@@ -716,7 +716,7 @@
|
|
|
716
716
|
return float( resolution.x * resolution.y ) * pdf * equirectDirectionPdf( direction );
|
|
717
717
|
|
|
718
718
|
}
|
|
719
|
-
`,
|
|
719
|
+
`,v0=`
|
|
720
720
|
|
|
721
721
|
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
722
722
|
|
|
@@ -931,7 +931,7 @@
|
|
|
931
931
|
|
|
932
932
|
}
|
|
933
933
|
|
|
934
|
-
`,
|
|
934
|
+
`,x0=`
|
|
935
935
|
|
|
936
936
|
vec3 sampleHemisphere( vec3 n, vec2 uv ) {
|
|
937
937
|
|
|
@@ -1016,7 +1016,7 @@
|
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
1018
|
|
|
1019
|
-
`,
|
|
1019
|
+
`,b0=`
|
|
1020
1020
|
|
|
1021
1021
|
bool totalInternalReflection( float cosTheta, float eta ) {
|
|
1022
1022
|
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
-
`,
|
|
1122
|
+
`,w0=`
|
|
1123
1123
|
|
|
1124
1124
|
// Fast arccos approximation used to remove banding artifacts caused by numerical errors in acos.
|
|
1125
1125
|
// This is a cubic Lagrange interpolating polynomial for x = [-1, -1/2, 0, 1/2, 1].
|
|
@@ -1199,7 +1199,7 @@
|
|
|
1199
1199
|
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
|
-
`,
|
|
1202
|
+
`,A0=`
|
|
1203
1203
|
|
|
1204
1204
|
// Finds the point where the ray intersects the plane defined by u and v and checks if this point
|
|
1205
1205
|
// falls in the bounds of the rectangle on that same plane.
|
|
@@ -1260,7 +1260,7 @@
|
|
|
1260
1260
|
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
1263
|
-
`,
|
|
1263
|
+
`,T0=`
|
|
1264
1264
|
|
|
1265
1265
|
// add texel fetch functions for texture arrays
|
|
1266
1266
|
vec4 texelFetch1D( sampler2DArray tex, int layer, uint index ) {
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
return vec4( WHITE_NOISE_SEED ) / float( 0xffffffffu );
|
|
1455
1455
|
|
|
1456
1456
|
}
|
|
1457
|
-
`,
|
|
1457
|
+
`,S0=`
|
|
1458
1458
|
|
|
1459
1459
|
uniform sampler2D stratifiedTexture;
|
|
1460
1460
|
uniform sampler2D stratifiedOffsetTexture;
|
|
@@ -1503,7 +1503,7 @@
|
|
|
1503
1503
|
|
|
1504
1504
|
}
|
|
1505
1505
|
|
|
1506
|
-
`,
|
|
1506
|
+
`,E0=`
|
|
1507
1507
|
|
|
1508
1508
|
// diffuse
|
|
1509
1509
|
float diffuseEval( vec3 wo, vec3 wi, vec3 wh, SurfaceRecord surf, inout vec3 color ) {
|
|
@@ -1941,7 +1941,7 @@
|
|
|
1941
1941
|
|
|
1942
1942
|
}
|
|
1943
1943
|
|
|
1944
|
-
`,
|
|
1944
|
+
`,C0=`
|
|
1945
1945
|
|
|
1946
1946
|
// returns the hit distance given the material density
|
|
1947
1947
|
float intersectFogVolume( Material material, float u ) {
|
|
@@ -1962,7 +1962,7 @@
|
|
|
1962
1962
|
|
|
1963
1963
|
}
|
|
1964
1964
|
|
|
1965
|
-
`,
|
|
1965
|
+
`,M0=`
|
|
1966
1966
|
|
|
1967
1967
|
// The GGX functions provide sampling and distribution information for normals as output so
|
|
1968
1968
|
// in order to get probability of scatter direction the half vector must be computed and provided.
|
|
@@ -2063,7 +2063,7 @@
|
|
|
2063
2063
|
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
|
-
`,
|
|
2066
|
+
`,I0=`
|
|
2067
2067
|
|
|
2068
2068
|
// XYZ to sRGB color space
|
|
2069
2069
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
@@ -2197,7 +2197,7 @@
|
|
|
2197
2197
|
|
|
2198
2198
|
}
|
|
2199
2199
|
|
|
2200
|
-
`,
|
|
2200
|
+
`,P0=`
|
|
2201
2201
|
|
|
2202
2202
|
// See equation (2) in http://www.aconty.com/pdf/s2017_pbs_imageworks_sheen.pdf
|
|
2203
2203
|
float velvetD( float cosThetaH, float roughness ) {
|
|
@@ -2294,7 +2294,7 @@
|
|
|
2294
2294
|
|
|
2295
2295
|
}
|
|
2296
2296
|
|
|
2297
|
-
`,
|
|
2297
|
+
`,R0=`
|
|
2298
2298
|
|
|
2299
2299
|
#ifndef FOG_CHECK_ITERATIONS
|
|
2300
2300
|
#define FOG_CHECK_ITERATIONS 30
|
|
@@ -2355,7 +2355,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
2355
2355
|
|
|
2356
2356
|
}
|
|
2357
2357
|
|
|
2358
|
-
`,
|
|
2358
|
+
`,D0=`
|
|
2359
2359
|
|
|
2360
2360
|
// step through multiple surface hits and accumulate color attenuation based on transmissive surfaces
|
|
2361
2361
|
// returns true if a solid surface was hit
|
|
@@ -2532,7 +2532,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
2532
2532
|
|
|
2533
2533
|
}
|
|
2534
2534
|
|
|
2535
|
-
`,
|
|
2535
|
+
`,B0=`
|
|
2536
2536
|
|
|
2537
2537
|
vec3 ndcToRayOrigin( vec2 coord ) {
|
|
2538
2538
|
|
|
@@ -2615,7 +2615,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
2615
2615
|
|
|
2616
2616
|
}
|
|
2617
2617
|
|
|
2618
|
-
`,
|
|
2618
|
+
`,F0=`
|
|
2619
2619
|
|
|
2620
2620
|
vec3 directLightContribution( vec3 worldWo, SurfaceRecord surf, RenderState state, vec3 rayOrigin ) {
|
|
2621
2621
|
|
|
@@ -2711,7 +2711,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
2711
2711
|
|
|
2712
2712
|
}
|
|
2713
2713
|
|
|
2714
|
-
`,
|
|
2714
|
+
`,L0=`
|
|
2715
2715
|
|
|
2716
2716
|
#define SKIP_SURFACE 0
|
|
2717
2717
|
#define HIT_SURFACE 1
|
|
@@ -3033,7 +3033,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3033
3033
|
return HIT_SURFACE;
|
|
3034
3034
|
|
|
3035
3035
|
}
|
|
3036
|
-
`,
|
|
3036
|
+
`,O0=`
|
|
3037
3037
|
|
|
3038
3038
|
struct Ray {
|
|
3039
3039
|
|
|
@@ -3082,7 +3082,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3082
3082
|
|
|
3083
3083
|
}
|
|
3084
3084
|
|
|
3085
|
-
`,
|
|
3085
|
+
`,k0=`
|
|
3086
3086
|
|
|
3087
3087
|
#define NO_HIT 0
|
|
3088
3088
|
#define SURFACE_HIT 1
|
|
@@ -3129,7 +3129,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3129
3129
|
|
|
3130
3130
|
}
|
|
3131
3131
|
|
|
3132
|
-
`;class
|
|
3132
|
+
`;class N0 extends Dh{onBeforeRender(){this.setDefine("FEATURE_DOF",this.physicalCamera.bokehSize===0?0:1),this.setDefine("FEATURE_BACKGROUND_MAP",this.backgroundMap?1:0),this.setDefine("FEATURE_FOG",this.materials.features.isUsed("FOG")?1:0)}constructor(e){super({transparent:!0,depthWrite:!1,defines:{FEATURE_MIS:1,FEATURE_RUSSIAN_ROULETTE:1,FEATURE_DOF:1,FEATURE_BACKGROUND_MAP:0,FEATURE_FOG:1,RANDOM_TYPE:2,CAMERA_TYPE:0,DEBUG_MODE:0,ATTR_NORMAL:0,ATTR_TANGENT:1,ATTR_UV:2,ATTR_COLOR:3},uniforms:{resolution:{value:new y.Vector2},opacity:{value:1},bounces:{value:10},transmissiveBounces:{value:10},filterGlossyFactor:{value:0},physicalCamera:{value:new Fg},cameraWorldMatrix:{value:new y.Matrix4},invProjectionMatrix:{value:new y.Matrix4},bvh:{value:new pi.MeshBVHUniformStruct},attributesArray:{value:new Xg},materialIndexAttribute:{value:new pi.UIntVertexAttributeTexture},materials:{value:new Qg},textures:{value:new Mc().texture},lights:{value:new Wg},iesProfiles:{value:new Mc(360,180,{type:y.HalfFloatType,wrapS:y.ClampToEdgeWrapping,wrapT:y.ClampToEdgeWrapping}).texture},environmentIntensity:{value:1},environmentRotation:{value:new y.Matrix4},envMapInfo:{value:new kg},backgroundBlur:{value:0},backgroundMap:{value:null},backgroundAlpha:{value:1},backgroundIntensity:{value:1},backgroundRotation:{value:new y.Matrix4},seed:{value:0},sobolTexture:{value:null},stratifiedTexture:{value:new o0},stratifiedOffsetTexture:{value:new d0(64,1)}},vertexShader:`
|
|
3133
3133
|
|
|
3134
3134
|
varying vec2 vUv;
|
|
3135
3135
|
void main() {
|
|
@@ -3158,22 +3158,22 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3158
3158
|
${pi.BVHShaderGLSL.bvh_ray_functions}
|
|
3159
3159
|
|
|
3160
3160
|
// uniform structs
|
|
3161
|
-
${d0}
|
|
3162
|
-
${p0}
|
|
3163
3161
|
${f0}
|
|
3164
3162
|
${m0}
|
|
3163
|
+
${p0}
|
|
3165
3164
|
${g0}
|
|
3165
|
+
${_0}
|
|
3166
3166
|
|
|
3167
3167
|
// random
|
|
3168
3168
|
#if RANDOM_TYPE == 2 // Stratified List
|
|
3169
3169
|
|
|
3170
|
-
${
|
|
3170
|
+
${S0}
|
|
3171
3171
|
|
|
3172
3172
|
#elif RANDOM_TYPE == 1 // Sobol
|
|
3173
3173
|
|
|
3174
3174
|
${Pc}
|
|
3175
3175
|
${of}
|
|
3176
|
-
${
|
|
3176
|
+
${Pg}
|
|
3177
3177
|
|
|
3178
3178
|
#define rand(v) sobol(v)
|
|
3179
3179
|
#define rand2(v) sobol2(v)
|
|
@@ -3198,11 +3198,11 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3198
3198
|
#endif
|
|
3199
3199
|
|
|
3200
3200
|
// common
|
|
3201
|
-
${
|
|
3202
|
-
${x0}
|
|
3203
|
-
${lf}
|
|
3201
|
+
${T0}
|
|
3204
3202
|
${b0}
|
|
3203
|
+
${lf}
|
|
3205
3204
|
${w0}
|
|
3205
|
+
${A0}
|
|
3206
3206
|
|
|
3207
3207
|
// environment
|
|
3208
3208
|
uniform EquirectHdrInfo envMapInfo;
|
|
@@ -3258,16 +3258,16 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3258
3258
|
float lightsDenom;
|
|
3259
3259
|
|
|
3260
3260
|
// sampling
|
|
3261
|
-
${
|
|
3262
|
-
${_0}
|
|
3261
|
+
${x0}
|
|
3263
3262
|
${y0}
|
|
3263
|
+
${v0}
|
|
3264
3264
|
|
|
3265
|
+
${R0}
|
|
3266
|
+
${M0}
|
|
3265
3267
|
${P0}
|
|
3266
|
-
${C0}
|
|
3267
3268
|
${I0}
|
|
3268
|
-
${
|
|
3269
|
+
${C0}
|
|
3269
3270
|
${E0}
|
|
3270
|
-
${S0}
|
|
3271
3271
|
|
|
3272
3272
|
float applyFilteredGlossy( float roughness, float accumulatedRoughness ) {
|
|
3273
3273
|
|
|
@@ -3299,12 +3299,12 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3299
3299
|
|
|
3300
3300
|
}
|
|
3301
3301
|
|
|
3302
|
-
${L0}
|
|
3303
|
-
${D0}
|
|
3304
3302
|
${O0}
|
|
3305
|
-
${R0}
|
|
3306
3303
|
${B0}
|
|
3304
|
+
${k0}
|
|
3305
|
+
${D0}
|
|
3307
3306
|
${F0}
|
|
3307
|
+
${L0}
|
|
3308
3308
|
|
|
3309
3309
|
void main() {
|
|
3310
3310
|
|
|
@@ -3596,7 +3596,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3596
3596
|
|
|
3597
3597
|
}
|
|
3598
3598
|
|
|
3599
|
-
`}),this.setValues(e)}}function*
|
|
3599
|
+
`}),this.setValues(e)}}function*U0(){const{_renderer:r,_fsQuad:e,_blendQuad:t,_primaryTarget:i,_blendTargets:s,_sobolTarget:n,_subframe:o,alpha:a,material:h}=this,u=new y.Vector4,d=new y.Vector4,l=t.material;let[c,f]=s;for(;;){a?(l.opacity=this._opacityFactor/(this.samples+1),h.blending=y.NoBlending,h.opacity=1):(h.opacity=this._opacityFactor/(this.samples+1),h.blending=y.NormalBlending);const[p,g,m,_]=o,v=i.width,x=i.height;h.resolution.set(v*m,x*_),h.sobolTexture=n.texture,h.stratifiedTexture.init(20,h.bounces+h.transmissiveBounces+5),h.stratifiedTexture.next(),h.seed++;const b=this.tiles.x||1,w=this.tiles.y||1,C=b*w,S=Math.ceil(v*m),T=Math.ceil(x*_),M=Math.floor(p*v),P=Math.floor(g*x),R=Math.ceil(S/b),E=Math.ceil(T/w);for(let A=0;A<w;A++)for(let I=0;I<b;I++){const D=r.getRenderTarget(),B=r.autoClear,k=r.getScissorTest();r.getScissor(u),r.getViewport(d);let z=I,q=A;if(!this.stableTiles){const F=this._currentTile%(b*w);z=F%b,q=~~(F/b),this._currentTile=F+1}const L=w-q-1;i.scissor.set(M+z*R,P+L*E,Math.min(R,S-z*R),Math.min(E,T-L*E)),i.viewport.set(M,P,S,T),r.setRenderTarget(i),r.setScissorTest(!0),r.autoClear=!1,e.render(r),r.setViewport(d),r.setScissor(u),r.setScissorTest(k),r.setRenderTarget(D),r.autoClear=B,a&&(l.target1=c.texture,l.target2=i.texture,r.setRenderTarget(f),t.render(r),r.setRenderTarget(D)),this.samples+=1/C,I===b-1&&A===w-1&&(this.samples=Math.round(this.samples)),yield}[c,f]=[f,c]}}const Rc=new y.Color;class Dc{get material(){return this._fsQuad.material}set material(e){this._fsQuad.material.removeEventListener("recompilation",this._compileFunction),e.addEventListener("recompilation",this._compileFunction),this._fsQuad.material=e}get target(){return this._alpha?this._blendTargets[1]:this._primaryTarget}set alpha(e){this._alpha!==e&&(e||(this._blendTargets[0].dispose(),this._blendTargets[1].dispose()),this._alpha=e,this.reset())}get alpha(){return this._alpha}get isCompiling(){return!!this._compilePromise}constructor(e){this.camera=null,this.tiles=new y.Vector2(3,3),this.stableNoise=!1,this.stableTiles=!0,this.samples=0,this._subframe=new y.Vector4(0,0,1,1),this._opacityFactor=1,this._renderer=e,this._alpha=!1,this._fsQuad=new Kr.FullScreenQuad(new N0),this._blendQuad=new Kr.FullScreenQuad(new Mg),this._task=null,this._currentTile=0,this._compilePromise=null,this._sobolTarget=new Dg().generate(e),this._primaryTarget=new y.WebGLRenderTarget(1,1,{format:y.RGBAFormat,type:y.FloatType,magFilter:y.NearestFilter,minFilter:y.NearestFilter}),this._blendTargets=[new y.WebGLRenderTarget(1,1,{format:y.RGBAFormat,type:y.FloatType,magFilter:y.NearestFilter,minFilter:y.NearestFilter}),new y.WebGLRenderTarget(1,1,{format:y.RGBAFormat,type:y.FloatType,magFilter:y.NearestFilter,minFilter:y.NearestFilter})],this._compileFunction=()=>{const t=this.compileMaterial(this._fsQuad._mesh);t.then(()=>{this._compilePromise===t&&(this._compilePromise=null)}),this._compilePromise=t},this.material.addEventListener("recompilation",this._compileFunction)}compileMaterial(){return this._renderer.compileAsync(this._fsQuad._mesh)}setCamera(e){const{material:t}=this;t.cameraWorldMatrix.copy(e.matrixWorld),t.invProjectionMatrix.copy(e.projectionMatrixInverse),t.physicalCamera.updateFrom(e);let i=0;e.projectionMatrix.elements[15]>0&&(i=1),e.isEquirectCamera&&(i=2),t.setDefine("CAMERA_TYPE",i),this.camera=e}setSize(e,t){e=Math.ceil(e),t=Math.ceil(t),!(this._primaryTarget.width===e&&this._primaryTarget.height===t)&&(this._primaryTarget.setSize(e,t),this._blendTargets[0].setSize(e,t),this._blendTargets[1].setSize(e,t),this.reset())}getSize(e){e.x=this._primaryTarget.width,e.y=this._primaryTarget.height}dispose(){this._primaryTarget.dispose(),this._blendTargets[0].dispose(),this._blendTargets[1].dispose(),this._sobolTarget.dispose(),this._fsQuad.dispose(),this._blendQuad.dispose(),this._task=null}reset(){const{_renderer:e,_primaryTarget:t,_blendTargets:i}=this,s=e.getRenderTarget(),n=e.getClearAlpha();e.getClearColor(Rc),e.setRenderTarget(t),e.setClearColor(0,0),e.clearColor(),e.setRenderTarget(i[0]),e.setClearColor(0,0),e.clearColor(),e.setRenderTarget(i[1]),e.setClearColor(0,0),e.clearColor(),e.setClearColor(Rc,n),e.setRenderTarget(s),this.samples=0,this._task=null,this.material.stratifiedTexture.stableNoise=this.stableNoise,this.stableNoise&&(this.material.seed=0,this.material.stratifiedTexture.reset())}update(){this.material.onBeforeRender(),!this.isCompiling&&(this._task||(this._task=U0.call(this)),this._task.next())}}const Fi=new y.Vector2,Bc=new y.Vector2,fn=new y.Spherical,pn=new y.Color;class G0 extends y.DataTexture{constructor(e=512,t=512){super(new Float32Array(e*t*4),e,t,y.RGBAFormat,y.FloatType,y.EquirectangularReflectionMapping,y.RepeatWrapping,y.ClampToEdgeWrapping,y.LinearFilter,y.LinearFilter),this.generationCallback=null}update(){this.dispose(),this.needsUpdate=!0;const{data:e,width:t,height:i}=this.image;for(let s=0;s<t;s++)for(let n=0;n<i;n++){Bc.set(t,i),Fi.set(s/t,n/i),Fi.x-=.5,Fi.y=1-Fi.y,fn.theta=Fi.x*2*Math.PI,fn.phi=Fi.y*Math.PI,fn.radius=1,this.generationCallback(fn,Fi,Bc,pn);const a=4*(n*t+s);e[a+0]=pn.r,e[a+1]=pn.g,e[a+2]=pn.b,e[a+3]=1}}copy(e){return super.copy(e),this.generationCallback=e.generationCallback,this}}const Fc=new y.Vector3;class z0 extends G0{constructor(e=512){super(e,e),this.topColor=new y.Color().set(16777215),this.bottomColor=new y.Color().set(0),this.exponent=2,this.generationCallback=(t,i,s,n)=>{Fc.setFromSpherical(t);const o=Fc.y*.5+.5;n.lerpColors(this.bottomColor,this.topColor,o**this.exponent)}}copy(e){return super.copy(e),this.topColor.copy(e.topColor),this.bottomColor.copy(e.bottomColor),this}}class H0 extends y.ShaderMaterial{get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}constructor(e){super({uniforms:{map:{value:null},opacity:{value:1}},vertexShader:`
|
|
3600
3600
|
varying vec2 vUv;
|
|
3601
3601
|
void main() {
|
|
3602
3602
|
|
|
@@ -3653,7 +3653,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3653
3653
|
#include <premultiplied_alpha_fragment>
|
|
3654
3654
|
|
|
3655
3655
|
}
|
|
3656
|
-
`}),this.setValues(e)}}class
|
|
3656
|
+
`}),this.setValues(e)}}class V0 extends y.ShaderMaterial{constructor(){super({uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:`
|
|
3657
3657
|
varying vec2 vUv;
|
|
3658
3658
|
void main() {
|
|
3659
3659
|
|
|
@@ -3678,31 +3678,31 @@ bool bvhIntersectFogVolumeHit(
|
|
|
3678
3678
|
rayDirection.x *= flipEnvMap;
|
|
3679
3679
|
gl_FragColor = textureCube( envMap, rayDirection );
|
|
3680
3680
|
|
|
3681
|
-
}`}),this.depthWrite=!1,this.depthTest=!1}}class Lc{constructor(e){this._renderer=e,this._quad=new Kr.FullScreenQuad(new H0)}generate(e,t=null,i=null){if(!e.isCubeTexture)throw new Error("CubeToEquirectMaterial: Source can only be cube textures.");const s=e.images[0],n=this._renderer,o=this._quad;t===null&&(t=4*s.height),i===null&&(i=2*s.height);const a=new y.WebGLRenderTarget(t,i,{type:y.FloatType,colorSpace:s.colorSpace}),h=s.height,u=Math.log2(h)-2,d=1/h,l=1/(3*Math.max(Math.pow(2,u),7*16));o.material.defines.CUBEUV_MAX_MIP=`${u}.0`,o.material.defines.CUBEUV_TEXEL_WIDTH=l,o.material.defines.CUBEUV_TEXEL_HEIGHT=d,o.material.uniforms.envMap.value=e,o.material.uniforms.flipEnvMap.value=e.isRenderTargetTexture?1:-1,o.material.needsUpdate=!0;const c=n.getRenderTarget(),f=n.autoClear;n.autoClear=!0,n.setRenderTarget(a),o.render(n),n.setRenderTarget(c),n.autoClear=f;const p=new Uint16Array(t*i*4),g=new Float32Array(t*i*4);n.readRenderTargetPixels(a,0,0,t,i,g),a.dispose();for(let _=0,v=g.length;_<v;_++)p[_]=y.DataUtils.toHalfFloat(g[_]);const m=new y.DataTexture(p,t,i,y.RGBAFormat,y.HalfFloatType);return m.minFilter=y.LinearMipMapLinearFilter,m.magFilter=y.LinearFilter,m.wrapS=y.RepeatWrapping,m.wrapT=y.RepeatWrapping,m.mapping=y.EquirectangularReflectionMapping,m.needsUpdate=!0,m}dispose(){this._quad.dispose()}}function V0(r){return r.extensions.get("EXT_float_blend")}const cr=new y.Vector2;class W0{get multipleImportanceSampling(){return!!this._pathTracer.material.defines.FEATURE_MIS}set multipleImportanceSampling(e){this._pathTracer.material.setDefine("FEATURE_MIS",e?1:0)}get transmissiveBounces(){return this._pathTracer.material.transmissiveBounces}set transmissiveBounces(e){this._pathTracer.material.transmissiveBounces=e}get bounces(){return this._pathTracer.material.bounces}set bounces(e){this._pathTracer.material.bounces=e}get filterGlossyFactor(){return this._pathTracer.material.filterGlossyFactor}set filterGlossyFactor(e){this._pathTracer.material.filterGlossyFactor=e}get samples(){return this._pathTracer.samples}get target(){return this._pathTracer.target}get tiles(){return this._pathTracer.tiles}get stableNoise(){return this._pathTracer.stableNoise}set stableNoise(e){this._pathTracer.stableNoise=e}get isCompiling(){return!!this._pathTracer.isCompiling}constructor(e){this._renderer=e,this._generator=new Eg,this._pathTracer=new Dc(e),this._queueReset=!1,this._clock=new y.Clock,this._compilePromise=null,this._lowResPathTracer=new Dc(e),this._lowResPathTracer.tiles.set(1,1),this._quad=new Kr.FullScreenQuad(new z0({map:null,transparent:!0,blending:y.NoBlending,premultipliedAlpha:e.getContextAttributes().premultipliedAlpha})),this._materials=null,this._previousEnvironment=null,this._previousBackground=null,this._internalBackground=null,this.renderDelay=100,this.minSamples=5,this.fadeDuration=500,this.enablePathTracing=!0,this.pausePathTracing=!1,this.dynamicLowRes=!1,this.lowResScale=.25,this.renderScale=1,this.synchronizeRenderSize=!0,this.rasterizeScene=!0,this.renderToCanvas=!0,this.textureSize=new y.Vector2(1024,1024),this.rasterizeSceneCallback=(t,i)=>{this._renderer.render(t,i)},this.renderToCanvasCallback=(t,i,s)=>{const n=i.autoClear;i.autoClear=!1,s.render(i),i.autoClear=n},this.setScene(new y.Scene,new y.PerspectiveCamera)}setBVHWorker(e){this._generator.setBVHWorker(e)}setScene(e,t,i={}){e.updateMatrixWorld(!0),t.updateMatrixWorld();const s=this._generator;if(s.setObjects(e),this._buildAsync)return s.generateAsync(i.onProgress).then(n=>this._updateFromResults(e,t,n));{const n=s.generate();return this._updateFromResults(e,t,n)}}setSceneAsync(...e){this._buildAsync=!0;const t=this.setScene(...e);return this._buildAsync=!1,t}setCamera(e){this.camera=e,this.updateCamera()}updateCamera(){const e=this.camera;e.updateMatrixWorld(),this._pathTracer.setCamera(e),this._lowResPathTracer.setCamera(e),this.reset()}updateMaterials(){const e=this._pathTracer.material,t=this._renderer,i=this._materials,s=this.textureSize,n=Yg(i);e.textures.setTextures(t,n,s.x,s.y),e.materials.updateFrom(i,n),this.reset()}updateLights(){const e=this.scene,t=this._renderer,i=this._pathTracer.material,s=qg(e),n=jg(s);i.lights.updateFrom(s,n),i.iesProfiles.setTextures(t,n),this.reset()}updateEnvironment(){const e=this.scene,t=this._pathTracer.material;if(this._internalBackground&&(this._internalBackground.dispose(),this._internalBackground=null),t.backgroundBlur=e.backgroundBlurriness,t.backgroundIntensity=e.backgroundIntensity??1,t.backgroundRotation.makeRotationFromEuler(e.backgroundRotation).invert(),e.background===null)t.backgroundMap=null,t.backgroundAlpha=0;else if(e.background.isColor){this._colorBackground=this._colorBackground||new G0(16);const i=this._colorBackground;i.topColor.equals(e.background)||(i.topColor.set(e.background),i.bottomColor.set(e.background),i.update()),t.backgroundMap=i,t.backgroundAlpha=1}else if(e.background.isCubeTexture){if(e.background!==this._previousBackground){const i=new Lc(this._renderer).generate(e.background);this._internalBackground=i,t.backgroundMap=i,t.backgroundAlpha=1}}else t.backgroundMap=e.background,t.backgroundAlpha=1;if(t.environmentIntensity=e.environmentIntensity??1,t.environmentRotation.makeRotationFromEuler(e.environmentRotation).invert(),this._previousEnvironment!==e.environment)if(e.environment!==null)if(e.environment.isCubeTexture){const i=new Lc(this._renderer).generate(e.environment);t.envMapInfo.updateFrom(i)}else t.envMapInfo.updateFrom(e.environment);else t.environmentIntensity=0;this._previousEnvironment=e.environment,this._previousBackground=e.background,this.reset()}_updateFromResults(e,t,i){const{materials:s,geometry:n,bvh:o,bvhChanged:a}=i;this._materials=s;const u=this._pathTracer.material;return a&&(u.bvh.updateFrom(o),u.attributesArray.updateFrom(n.attributes.normal,n.attributes.tangent,n.attributes.uv,n.attributes.color),u.materialIndexAttribute.updateFrom(n.attributes.materialIndex)),this._previousScene=e,this.scene=e,this.camera=t,this.updateCamera(),this.updateMaterials(),this.updateEnvironment(),this.updateLights(),i}renderSample(){const e=this._lowResPathTracer,t=this._pathTracer,i=this._renderer,s=this._clock,n=this._quad;this._updateScale(),this._queueReset&&(t.reset(),e.reset(),this._queueReset=!1,n.material.opacity=0,s.start());const o=s.getDelta()*1e3,a=s.getElapsedTime()*1e3;if(!this.pausePathTracing&&this.enablePathTracing&&this.renderDelay<=a&&!this.isCompiling&&t.update(),t.alpha=t.material.backgroundAlpha!==1||!V0(i),e.alpha=t.alpha,this.renderToCanvas){const h=this._renderer,u=this.minSamples;if(a>=this.renderDelay&&this.samples>=this.minSamples&&(this.fadeDuration!==0?n.material.opacity=Math.min(n.material.opacity+o/this.fadeDuration,1):n.material.opacity=1),!this.enablePathTracing||this.samples<u||n.material.opacity<1){if(this.dynamicLowRes&&!this.isCompiling){e.samples<1&&(e.material=t.material,e.update());const d=n.material.opacity;n.material.opacity=1-n.material.opacity,n.material.map=e.target.texture,n.render(h),n.material.opacity=d}(!this.dynamicLowRes&&this.rasterizeScene||this.dynamicLowRes&&this.isCompiling)&&this.rasterizeSceneCallback(this.scene,this.camera)}this.enablePathTracing&&n.material.opacity>0&&(n.material.opacity<1&&(n.material.blending=this.dynamicLowRes?y.AdditiveBlending:y.NormalBlending),n.material.map=t.target.texture,this.renderToCanvasCallback(t.target,h,n),n.material.blending=y.NoBlending)}}reset(){this._queueReset=!0,this._pathTracer.samples=0}dispose(){this._renderQuad.dispose(),this._renderQuad.material.dispose(),this._pathTracer.dispose()}_updateScale(){if(this.synchronizeRenderSize){this._renderer.getDrawingBufferSize(cr);const e=Math.floor(this.renderScale*cr.x),t=Math.floor(this.renderScale*cr.y);if(this._pathTracer.getSize(cr),cr.x!==e||cr.y!==t){const i=this.lowResScale;this._pathTracer.setSize(e,t),this._lowResPathTracer.setSize(Math.floor(e*i),Math.floor(t*i))}}}}const hf="3.3.5";globalThis.GLTF_PROGRESSIVE_VERSION=hf;console.debug(`[gltf-progressive] version ${hf}`);let mt="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",qi="https://cdn.needle.tools/static/three/0.179.1/basis2/";const $0=mt,X0=qi,cf=new URL(mt+"draco_decoder.js");cf.searchParams.append("range","true");fetch(cf,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(r=>{console.debug(`Failed to fetch remote Draco decoder from ${mt} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),mt===$0&&Y0("./include/draco/"),qi===X0&&q0("./include/ktx2/")}).finally(()=>{df()});const j0=()=>({dracoDecoderPath:mt,ktx2TranscoderPath:qi});function Y0(r){mt=r,Ze&&Ze[pl]!=mt?(console.debug("Updating Draco decoder path to "+r),Ze[pl]=mt,Ze.setDecoderPath(mt),Ze.preload()):console.debug("Setting Draco decoder path to "+r)}function q0(r){qi=r,gt&>.transcoderPath!=qi?(console.debug("Updating KTX2 transcoder path to "+r),gt.setTranscoderPath(qi),gt.init()):console.debug("Setting KTX2 transcoder path to "+r)}function Fh(r){return df(),r?gt.detectSupport(r):r!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:Ze,ktx2Loader:gt,meshoptDecoder:_o}}function uf(r){r.dracoLoader||r.setDRACOLoader(Ze),r.ktx2Loader||r.setKTX2Loader(gt),r.meshoptDecoder||r.setMeshoptDecoder(_o)}const pl=Symbol("dracoDecoderPath");let Ze,_o,gt;function df(){Ze||(Ze=new Km.DRACOLoader,Ze[pl]=mt,Ze.setDecoderPath(mt),Ze.setDecoderConfig({type:"js"}),Ze.preload()),gt||(gt=new Qm.KTX2Loader,gt.setTranscoderPath(qi),gt.init()),_o||(_o=Zm.MeshoptDecoder)}const ml=new WeakMap;function ff(r,e){let t=ml.get(r);t?t=Object.assign(t,e):t=e,ml.set(r,t)}const ha=Ph.GLTFLoader.prototype.load;function Z0(...r){const e=ml.get(this);let t=r[0];const i=new URL(t,window.location.href);if(i.hostname.endsWith("needle.tools")){const n=(e==null?void 0:e.progressive)!==void 0?e.progressive:!0,o=e!=null&&e.usecase?e.usecase:"default";n?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${o}`:this.requestHeader.Accept=`*/*;usecase=${o}`,t=i.toString()}return r[0]=t,ha==null?void 0:ha.call(this,...r)}Ph.GLTFLoader.prototype.load=Z0;sr("debugprogressive");function sr(r){if(typeof window>"u")return!1;const t=new URL(window.location.href).searchParams.get(r);return t==null||t==="0"||t==="false"?!1:t===""?!0:t}function K0(r,e){if(e===void 0||r===void 0||e.startsWith("./")||e.startsWith("http")||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=r.lastIndexOf("/");if(t>=0){const i=r.substring(0,t+1);for(;i.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return i+e}return e}function pf(){return us!==void 0||(us=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),sr("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",us)),us}let us;function Oc(){if(typeof window>"u")return!1;const r=new URL(window.location.href),e=r.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r.hostname);return r.hostname==="127.0.0.1"||e}class Q0{constructor(e=100,t={}){N(this,"maxConcurrent");N(this,"_running",new Map);N(this,"_queue",[]);N(this,"debug",!1);N(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)});this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise finished now running: ${this._running.size}, waiting: ${this._queue.length}. (finished ${e})`)}),this.debug&&console.debug(`[PromiseQueue]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${e})`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:i,resolve:s}=this._queue.shift();s({use:n=>this.add(i,n)})}}}const J0=typeof window>"u"&&typeof document>"u",gl=Symbol("needle:raycast-mesh");function en(r){return(r==null?void 0:r[gl])instanceof y.BufferGeometry?r[gl]:null}function e_(r,e){if((r.type==="Mesh"||r.type==="SkinnedMesh")&&!en(r)){const i=i_(e);i.userData={isRaycastMesh:!0},r[gl]=i}}function t_(r=!0){if(r){if(ds)return;const e=ds=y.Mesh.prototype.raycast;y.Mesh.prototype.raycast=function(t,i){const s=this,n=en(s);let o;n&&s.isMesh&&(o=s.geometry,s.geometry=n),e.call(this,t,i),o&&(s.geometry=o)}}else{if(!ds)return;y.Mesh.prototype.raycast=ds,ds=null}}let ds=null;function i_(r){const e=new y.BufferGeometry;for(const t in r.attributes)e.setAttribute(t,r.getAttribute(t));return e.setIndex(r.getIndex()),e}const ci=new Array,se=sr("debugprogressive");let Os,Ni=-1;if(se){let e=function(){Ni+=1,Ni>=r&&(Ni=-1),console.log(`Toggle LOD level [${Ni}]`)},r=6;window.addEventListener("keyup",t=>{t.key==="p"&&e(),t.key==="w"&&(Os=!Os,console.log(`Toggle wireframe [${Os}]`));const i=parseInt(t.key);!isNaN(i)&&i>=0&&(Ni=i,console.log(`Set LOD level to [${Ni}]`))})}function mf(r){if(se&&Os!==void 0)if(Array.isArray(r))for(const e of r)mf(e);else r&&"wireframe"in r&&(r.wireframe=Os===!0)}const fs=new Array;let r_=0;const s_=pf()?2:10;function n_(r){if(fs.length<s_){const i=fs.length;se&&console.warn(`[Worker] Creating new worker #${i}`);const s=Lh.createWorker(r||{});return fs.push(s),s}const e=r_++%fs.length;return fs[e]}class Lh{constructor(e,t){N(this,"worker");N(this,"_running",[]);N(this,"_webglRenderer",null);N(this,"_debug",!1);this.worker=e,this._debug=t.debug??!1,e.onmessage=i=>{const s=i.data;switch(this._debug&&console.log("[Worker] EVENT",s),s.type){case"loaded-gltf":for(const n of this._running)if(n.url===s.result.url){o_(s.result),n.resolve(s.result);const o=n.url;o.startsWith("blob:")&&URL.revokeObjectURL(o)}}},e.onerror=i=>{console.error("[Worker] Error in gltf-progressive worker:",i)},e.postMessage({type:"init"})}static async createWorker(e){const t=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/loader.worker-fysOIq2s.js").href:new URL("assets/loader.worker-fysOIq2s.js",document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});return new Lh(t,e)}async load(e,t){const i=j0();let s=t==null?void 0:t.renderer;s||(this._webglRenderer??(this._webglRenderer=(async()=>{const{WebGLRenderer:u}=await import("three");return new u})()),s=await this._webglRenderer);const a=Fh(s).ktx2Loader.workerConfig;e instanceof URL?e=e.toString():e.startsWith("file:")?e=URL.createObjectURL(new Blob([e])):!e.startsWith("blob:")&&!e.startsWith("http:")&&!e.startsWith("https:")&&(e=new URL(e,window.location.href).toString());const h={type:"load",url:e,dracoDecoderPath:i.dracoDecoderPath,ktx2TranscoderPath:i.ktx2TranscoderPath,ktx2LoaderConfig:a};return this._debug&&console.debug("[Worker] Sending load request",h),this.worker.postMessage(h),new Promise(u=>{this._running.push({url:e.toString(),resolve:u})})}}function o_(r){var e,t,i,s,n,o,a,h,u,d,l,c,f,p,g,m;for(const _ of r.geometries){const v=_.geometry,x=new y.BufferGeometry;if(x.name=v.name||"",v.index){const b=v.index;x.setIndex(ca(b))}for(const b in v.attributes){const w=v.attributes[b],C=ca(w);x.setAttribute(b,C)}if(v.morphAttributes)for(const b in v.morphAttributes){const C=v.morphAttributes[b].map(S=>ca(S));x.morphAttributes[b]=C}if(x.morphTargetsRelative=v.morphTargetsRelative??!1,x.boundingBox=new y.Box3,x.boundingBox.min=new y.Vector3((e=v.boundingBox)==null?void 0:e.min.x,(t=v.boundingBox)==null?void 0:t.min.y,(i=v.boundingBox)==null?void 0:i.min.z),x.boundingBox.max=new y.Vector3((s=v.boundingBox)==null?void 0:s.max.x,(n=v.boundingBox)==null?void 0:n.max.y,(o=v.boundingBox)==null?void 0:o.max.z),x.boundingSphere=new y.Sphere(new y.Vector3((a=v.boundingSphere)==null?void 0:a.center.x,(h=v.boundingSphere)==null?void 0:h.center.y,(u=v.boundingSphere)==null?void 0:u.center.z),(d=v.boundingSphere)==null?void 0:d.radius),v.groups)for(const b of v.groups)x.addGroup(b.start,b.count,b.materialIndex);v.userData&&(x.userData=v.userData),_.geometry=x}for(const _ of r.textures){const v=_.texture;let x=null;if(v.isCompressedTexture){const b=v.mipmaps,w=((l=v.image)==null?void 0:l.width)||((f=(c=v.source)==null?void 0:c.data)==null?void 0:f.width)||-1,C=((p=v.image)==null?void 0:p.height)||((m=(g=v.source)==null?void 0:g.data)==null?void 0:m.height)||-1;x=new y.CompressedTexture(b,w,C,v.format,v.type,v.mapping,v.wrapS,v.wrapT,v.magFilter,v.minFilter,v.anisotropy,v.colorSpace)}else x=new y.Texture(v.image,v.mapping,v.wrapS,v.wrapT,v.magFilter,v.minFilter,v.format,v.type,v.anisotropy,v.colorSpace),x.mipmaps=v.mipmaps,x.channel=v.channel,x.source.data=v.source.data,x.flipY=v.flipY,x.premultiplyAlpha=v.premultiplyAlpha,x.unpackAlignment=v.unpackAlignment,x.matrix=new y.Matrix3(...v.matrix.elements);if(!x){console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");continue}_.texture=x}return r}function ca(r){let e=r;if("isInterleavedBufferAttribute"in r&&r.isInterleavedBufferAttribute){const t=r.data,i=t.array,s=new y.InterleavedBuffer(i,t.stride);e=new y.InterleavedBufferAttribute(s,r.itemSize,i.byteOffset,r.normalized),e.offset=r.offset}else"isBufferAttribute"in r&&r.isBufferAttribute&&(e=new y.BufferAttribute(r.array,r.itemSize,r.normalized),e.usage=r.usage,e.gpuType=r.gpuType,e.updateRanges=r.updateRanges);return e}const a_=sr("gltf-progressive-worker"),l_=sr("gltf-progressive-reduce-mipmaps"),ua=Symbol("needle-progressive-texture"),Wt="NEEDLE_progressive",re=class re{constructor(e){N(this,"parser");N(this,"url");N(this,"_isLoadingMesh");N(this,"loadMesh",e=>{var i,s;if(this._isLoadingMesh)return null;const t=(s=(i=this.parser.json.meshes[e])==null?void 0:i.extensions)==null?void 0:s[Wt];return t?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",e).then(n=>{var o;return this._isLoadingMesh=!1,n&&re.registerMesh(this.url,t.guid,n,(o=t.lods)==null?void 0:o.length,0,t),n})):null});const t=e.options.path;se&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return Wt}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var i;const t=(i=this.getAssignedLODInformation(e))==null?void 0:i.index;return t??-1}static getMaterialMinMaxLODsCount(e,t){const i=this,s="LODS:minmax",n=e[s];if(n!=null)return n;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const a of e)this.getMaterialMinMaxLODsCount(a,t);return e[s]=t,t}if(se==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const a=e;for(const h of Object.keys(a.uniforms)){const u=a.uniforms[h].value;(u==null?void 0:u.isTexture)===!0&&o(u,t)}}else if(e.isMaterial)for(const a of Object.keys(e)){const h=e[a];(h==null?void 0:h.isTexture)===!0&&o(h,t)}else se&&console.warn(`[getMaterialMinMaxLODsCount] Unsupported material type: ${e.type}`);return e[s]=t,t;function o(a,h){const u=i.getAssignedLODInformation(a);if(u){const d=i.lodInfos.get(u.key);if(d&&d.lods){h.min_count=Math.min(h.min_count,d.lods.length),h.max_count=Math.max(h.max_count,d.lods.length);for(let l=0;l<d.lods.length;l++){const c=d.lods[l];c.width&&(h.lods[l]=h.lods[l]||{min_height:1/0,max_height:0},h.lods[l].min_height=Math.min(h.lods[l].min_height,c.height),h.lods[l].max_height=Math.max(h.lods[l].max_height,c.height))}}}}}static hasLODLevelAvailable(e,t){var n;if(Array.isArray(e)){for(const o of e)if(this.hasLODLevelAvailable(o,t))return!0;return!1}if(e.isMaterial===!0){for(const o of Object.keys(e)){const a=e[o];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,t))return!0}return!1}else if(e.isGroup===!0){for(const o of e.children)if(o.isMesh===!0&&this.hasLODLevelAvailable(o,t))return!0}let i,s;if(e.isMesh?i=e.geometry:(e.isBufferGeometry||e.isTexture)&&(i=e),i&&(n=i==null?void 0:i.userData)!=null&&n.LODS){const o=i.userData.LODS;if(s=this.lodInfos.get(o.key),t===void 0)return s!=null;if(s)return Array.isArray(s.lods)?t<s.lods.length:t===0}return!1}static assignMeshLOD(e,t){var i;if(!e)return Promise.resolve(null);if(e instanceof y.Mesh||e.isMesh===!0){const s=e.geometry,n=this.getAssignedLODInformation(s);if(!n)return Promise.resolve(null);for(const o of ci)(i=o.onBeforeGetLODMesh)==null||i.call(o,e,t);return e["LOD:requested level"]=t,re.getOrLoadLOD(s,t).then(o=>{if(Array.isArray(o)){const a=n.index||0;o=o[a]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],o&&s!=o&&((o==null?void 0:o.isBufferGeometry)?e.geometry=o:se&&console.error("Invalid LOD geometry",o))),o}).catch(o=>(console.error("Error loading mesh LOD",e,o),null))}else se&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const i=e;if(Array.isArray(i.material)){const s=new Array;for(const n of i.material){const o=this.assignTextureLOD(n,t);s.push(o)}return Promise.all(s).then(n=>{const o=new Array;for(const a of n)Array.isArray(a)&&o.push(...a);return o})}else return this.assignTextureLOD(i.material,t)}if(e.isMaterial===!0){const i=e,s=[],n=new Array;if(i.uniforms&&(i.isRawShaderMaterial||i.isShaderMaterial===!0)){const o=i;for(const a of Object.keys(o.uniforms)){const h=o.uniforms[a].value;if((h==null?void 0:h.isTexture)===!0){const u=this.assignTextureLODForSlot(h,t,i,a).then(d=>(d&&o.uniforms[a].value!=d&&(o.uniforms[a].value=d,o.uniformsNeedUpdate=!0),d));s.push(u),n.push(a)}}}else for(const o of Object.keys(i)){const a=i[o];if((a==null?void 0:a.isTexture)===!0){const h=this.assignTextureLODForSlot(a,t,i,o);s.push(h),n.push(o)}}return Promise.all(s).then(o=>{const a=new Array;for(let h=0;h<o.length;h++){const u=o[h],d=n[h];u&&u.isTexture===!0?a.push({material:i,slot:d,texture:u,level:t}):a.push({material:i,slot:d,texture:null,level:t})}return a})}if(e instanceof y.Texture||e.isTexture===!0){const i=e;return this.assignTextureLODForSlot(i,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,i,s){return(e==null?void 0:e.isTexture)!==!0?Promise.resolve(null):s==="glyphMap"?Promise.resolve(e):re.getOrLoadLOD(e,t).then(n=>{var o,a;if(Array.isArray(n))return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."),null;if((n==null?void 0:n.isTexture)===!0){if(n!=e&&i&&s){const h=i[s];if(h&&!se){const u=this.getAssignedLODInformation(h);if(u&&(u==null?void 0:u.level)<t)return se==="verbose"&&console.warn("Assigned texture level is already higher: ",u.level,t,i,h,n),null}if(l_&&n.mipmaps){const u=n.mipmaps.length;n.mipmaps.length=Math.min(n.mipmaps.length,3),u!==n.mipmaps.length&&se&&console.debug(`Reduced mipmap count from ${u} to ${n.mipmaps.length} for ${n.uuid}: ${(o=n.image)==null?void 0:o.width}x${(a=n.image)==null?void 0:a.height}.`)}i[s]=n}return n}else se=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(n=>(console.error("Error loading LOD",e,n),null))}afterRoot(e){var t,i;return se&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((s,n)=>{var o;if(s!=null&&s.extensions){const a=s==null?void 0:s.extensions[Wt];if(a){if(!a.lods){se&&console.warn("Texture has no LODs",a);return}let h=!1;for(const u of this.parser.associations.keys())if(u.isTexture===!0){const d=this.parser.associations.get(u);(d==null?void 0:d.textures)===n&&(h=!0,re.registerTexture(this.url,u,(o=a.lods)==null?void 0:o.length,n,a))}h||this.parser.getDependency("texture",n).then(u=>{var d;u&&re.registerTexture(this.url,u,(d=a.lods)==null?void 0:d.length,n,a)})}}}),(i=this.parser.json.meshes)==null||i.forEach((s,n)=>{if(s!=null&&s.extensions){const o=s==null?void 0:s.extensions[Wt];if(o&&o.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const h=this.parser.associations.get(a);(h==null?void 0:h.meshes)===n&&re.registerMesh(this.url,o.guid,a,o.lods.length,h.primitives,o)}}}}),null}static async getOrLoadLOD(e,t){var h,u,d,l;const i=se=="verbose",s=this.getAssignedLODInformation(e);if(!s)return se&&console.warn(`[gltf-progressive] No LOD information found: ${e.name}, uuid: ${e.uuid}, type: ${e.type}`,e),null;const n=s==null?void 0:s.key;let o;if(e.isTexture===!0){const c=e;c.source&&c.source[ua]&&(o=c.source[ua])}if(o||(o=re.lodInfos.get(n)),!o)se&&console.warn(`Can not load LOD ${t}: no LOD info found for "${n}" ${e.name}`,e.type,re.lodInfos);else{if(t>0){let p=!1;const g=Array.isArray(o.lods);if(g&&t>=o.lods.length?p=!0:g||(p=!0),p)return this.lowresCache.get(n)}const c=Array.isArray(o.lods)?(h=o.lods[t])==null?void 0:h.path:o.lods;if(!c)return se&&!o["missing:uri"]&&(o["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,o)),null;const f=K0(s.url,c);if(f.endsWith(".glb")||f.endsWith(".gltf")){if(!o.guid)return console.warn("missing pointer for glb/gltf texture",o),null;const p=f+"_"+o.guid,g=await this.queue.slot(f),m=this.previouslyLoaded.get(p);if(m!==void 0){i&&console.log(`LOD ${t} was already loading/loaded: ${p}`);let b=await m.catch(C=>(console.error(`Error loading LOD ${t} from ${f}
|
|
3682
|
-
`,C),null)),w=!1;if(b==null||(b instanceof y.Texture&&e instanceof y.Texture?(u=b.image)!=null&&u.data||(d=b.source)!=null&&d.data?b=this.copySettings(e,b):(w=!0,this.previouslyLoaded.delete(p)):b instanceof y.BufferGeometry&&e instanceof y.BufferGeometry&&((l=b.attributes.position)!=null&&l.array||(w=!0,this.previouslyLoaded.delete(p)))),!w)return b}if(!g.use)return se&&console.log(`LOD ${t} was aborted: ${f}`),null;const _=o,v=new Promise(async(b,w)=>{if(
|
|
3683
|
-
`,R),b(null)));if(!T)return b(null);const M=T.parser;i&&console.log("Loading finished "+f,_.guid);let P=0;if(T.parser.json.textures){let R=!1;for(const E of T.parser.json.textures){if(E!=null&&E.extensions){const A=E==null?void 0:E.extensions[Wt];if(A!=null&&A.guid&&A.guid===_.guid){R=!0;break}}P++}if(R){let E=await M.getDependency("texture",P);return E&&re.assignLODInformation(s.url,E,n,t,void 0),i&&console.log('change "'+e.name+'" → "'+E.name+'"',f,P,E,p),e instanceof y.Texture&&(E=this.copySettings(e,E)),E&&(E.guid=_.guid),b(E)}else se&&console.warn("Could not find texture with guid",_.guid,T.parser.json)}if(P=0,T.parser.json.meshes){let R=!1;for(const E of T.parser.json.meshes){if(E!=null&&E.extensions){const A=E==null?void 0:E.extensions[Wt];if(A!=null&&A.guid&&A.guid===_.guid){R=!0;break}}P++}if(R){const E=await M.getDependency("mesh",P);if(i&&console.log(`Loaded Mesh "${E.name}"`,f,P,E,p),E.isMesh===!0){const A=E.geometry;return re.assignLODInformation(s.url,A,n,t,0),b(A)}else{const A=new Array;for(let I=0;I<E.children.length;I++){const D=E.children[I];if(D.isMesh===!0){const B=D.geometry;re.assignLODInformation(s.url,B,n,t,I),A.push(B)}}return b(A)}}else se&&console.warn("Could not find mesh with guid",_.guid,T.parser.json)}return b(null)});return this.previouslyLoaded.set(p,v),g.use(v),await v}else if(e instanceof y.Texture){i&&console.log("Load texture from uri: "+f);const g=await new y.TextureLoader().loadAsync(f);return g?(g.guid=o.guid,g.flipY=!1,g.needsUpdate=!0,g.colorSpace=e.colorSpace,i&&console.log(o,g)):se&&console.warn("failed loading",f),g}}return null}static assignLODInformation(e,t,i,s,n){if(!t)return;t.userData||(t.userData={});const o=new
|
|
3681
|
+
}`}),this.depthWrite=!1,this.depthTest=!1}}class Lc{constructor(e){this._renderer=e,this._quad=new Kr.FullScreenQuad(new V0)}generate(e,t=null,i=null){if(!e.isCubeTexture)throw new Error("CubeToEquirectMaterial: Source can only be cube textures.");const s=e.images[0],n=this._renderer,o=this._quad;t===null&&(t=4*s.height),i===null&&(i=2*s.height);const a=new y.WebGLRenderTarget(t,i,{type:y.FloatType,colorSpace:s.colorSpace}),h=s.height,u=Math.log2(h)-2,d=1/h,l=1/(3*Math.max(Math.pow(2,u),7*16));o.material.defines.CUBEUV_MAX_MIP=`${u}.0`,o.material.defines.CUBEUV_TEXEL_WIDTH=l,o.material.defines.CUBEUV_TEXEL_HEIGHT=d,o.material.uniforms.envMap.value=e,o.material.uniforms.flipEnvMap.value=e.isRenderTargetTexture?1:-1,o.material.needsUpdate=!0;const c=n.getRenderTarget(),f=n.autoClear;n.autoClear=!0,n.setRenderTarget(a),o.render(n),n.setRenderTarget(c),n.autoClear=f;const p=new Uint16Array(t*i*4),g=new Float32Array(t*i*4);n.readRenderTargetPixels(a,0,0,t,i,g),a.dispose();for(let _=0,v=g.length;_<v;_++)p[_]=y.DataUtils.toHalfFloat(g[_]);const m=new y.DataTexture(p,t,i,y.RGBAFormat,y.HalfFloatType);return m.minFilter=y.LinearMipMapLinearFilter,m.magFilter=y.LinearFilter,m.wrapS=y.RepeatWrapping,m.wrapT=y.RepeatWrapping,m.mapping=y.EquirectangularReflectionMapping,m.needsUpdate=!0,m}dispose(){this._quad.dispose()}}function W0(r){return r.extensions.get("EXT_float_blend")}const cr=new y.Vector2;class $0{get multipleImportanceSampling(){return!!this._pathTracer.material.defines.FEATURE_MIS}set multipleImportanceSampling(e){this._pathTracer.material.setDefine("FEATURE_MIS",e?1:0)}get transmissiveBounces(){return this._pathTracer.material.transmissiveBounces}set transmissiveBounces(e){this._pathTracer.material.transmissiveBounces=e}get bounces(){return this._pathTracer.material.bounces}set bounces(e){this._pathTracer.material.bounces=e}get filterGlossyFactor(){return this._pathTracer.material.filterGlossyFactor}set filterGlossyFactor(e){this._pathTracer.material.filterGlossyFactor=e}get samples(){return this._pathTracer.samples}get target(){return this._pathTracer.target}get tiles(){return this._pathTracer.tiles}get stableNoise(){return this._pathTracer.stableNoise}set stableNoise(e){this._pathTracer.stableNoise=e}get isCompiling(){return!!this._pathTracer.isCompiling}constructor(e){this._renderer=e,this._generator=new Cg,this._pathTracer=new Dc(e),this._queueReset=!1,this._clock=new y.Clock,this._compilePromise=null,this._lowResPathTracer=new Dc(e),this._lowResPathTracer.tiles.set(1,1),this._quad=new Kr.FullScreenQuad(new H0({map:null,transparent:!0,blending:y.NoBlending,premultipliedAlpha:e.getContextAttributes().premultipliedAlpha})),this._materials=null,this._previousEnvironment=null,this._previousBackground=null,this._internalBackground=null,this.renderDelay=100,this.minSamples=5,this.fadeDuration=500,this.enablePathTracing=!0,this.pausePathTracing=!1,this.dynamicLowRes=!1,this.lowResScale=.25,this.renderScale=1,this.synchronizeRenderSize=!0,this.rasterizeScene=!0,this.renderToCanvas=!0,this.textureSize=new y.Vector2(1024,1024),this.rasterizeSceneCallback=(t,i)=>{this._renderer.render(t,i)},this.renderToCanvasCallback=(t,i,s)=>{const n=i.autoClear;i.autoClear=!1,s.render(i),i.autoClear=n},this.setScene(new y.Scene,new y.PerspectiveCamera)}setBVHWorker(e){this._generator.setBVHWorker(e)}setScene(e,t,i={}){e.updateMatrixWorld(!0),t.updateMatrixWorld();const s=this._generator;if(s.setObjects(e),this._buildAsync)return s.generateAsync(i.onProgress).then(n=>this._updateFromResults(e,t,n));{const n=s.generate();return this._updateFromResults(e,t,n)}}setSceneAsync(...e){this._buildAsync=!0;const t=this.setScene(...e);return this._buildAsync=!1,t}setCamera(e){this.camera=e,this.updateCamera()}updateCamera(){const e=this.camera;e.updateMatrixWorld(),this._pathTracer.setCamera(e),this._lowResPathTracer.setCamera(e),this.reset()}updateMaterials(){const e=this._pathTracer.material,t=this._renderer,i=this._materials,s=this.textureSize,n=qg(i);e.textures.setTextures(t,n,s.x,s.y),e.materials.updateFrom(i,n),this.reset()}updateLights(){const e=this.scene,t=this._renderer,i=this._pathTracer.material,s=Zg(e),n=Yg(s);i.lights.updateFrom(s,n),i.iesProfiles.setTextures(t,n),this.reset()}updateEnvironment(){const e=this.scene,t=this._pathTracer.material;if(this._internalBackground&&(this._internalBackground.dispose(),this._internalBackground=null),t.backgroundBlur=e.backgroundBlurriness,t.backgroundIntensity=e.backgroundIntensity??1,t.backgroundRotation.makeRotationFromEuler(e.backgroundRotation).invert(),e.background===null)t.backgroundMap=null,t.backgroundAlpha=0;else if(e.background.isColor){this._colorBackground=this._colorBackground||new z0(16);const i=this._colorBackground;i.topColor.equals(e.background)||(i.topColor.set(e.background),i.bottomColor.set(e.background),i.update()),t.backgroundMap=i,t.backgroundAlpha=1}else if(e.background.isCubeTexture){if(e.background!==this._previousBackground){const i=new Lc(this._renderer).generate(e.background);this._internalBackground=i,t.backgroundMap=i,t.backgroundAlpha=1}}else t.backgroundMap=e.background,t.backgroundAlpha=1;if(t.environmentIntensity=e.environmentIntensity??1,t.environmentRotation.makeRotationFromEuler(e.environmentRotation).invert(),this._previousEnvironment!==e.environment)if(e.environment!==null)if(e.environment.isCubeTexture){const i=new Lc(this._renderer).generate(e.environment);t.envMapInfo.updateFrom(i)}else t.envMapInfo.updateFrom(e.environment);else t.environmentIntensity=0;this._previousEnvironment=e.environment,this._previousBackground=e.background,this.reset()}_updateFromResults(e,t,i){const{materials:s,geometry:n,bvh:o,bvhChanged:a}=i;this._materials=s;const u=this._pathTracer.material;return a&&(u.bvh.updateFrom(o),u.attributesArray.updateFrom(n.attributes.normal,n.attributes.tangent,n.attributes.uv,n.attributes.color),u.materialIndexAttribute.updateFrom(n.attributes.materialIndex)),this._previousScene=e,this.scene=e,this.camera=t,this.updateCamera(),this.updateMaterials(),this.updateEnvironment(),this.updateLights(),i}renderSample(){const e=this._lowResPathTracer,t=this._pathTracer,i=this._renderer,s=this._clock,n=this._quad;this._updateScale(),this._queueReset&&(t.reset(),e.reset(),this._queueReset=!1,n.material.opacity=0,s.start());const o=s.getDelta()*1e3,a=s.getElapsedTime()*1e3;if(!this.pausePathTracing&&this.enablePathTracing&&this.renderDelay<=a&&!this.isCompiling&&t.update(),t.alpha=t.material.backgroundAlpha!==1||!W0(i),e.alpha=t.alpha,this.renderToCanvas){const h=this._renderer,u=this.minSamples;if(a>=this.renderDelay&&this.samples>=this.minSamples&&(this.fadeDuration!==0?n.material.opacity=Math.min(n.material.opacity+o/this.fadeDuration,1):n.material.opacity=1),!this.enablePathTracing||this.samples<u||n.material.opacity<1){if(this.dynamicLowRes&&!this.isCompiling){e.samples<1&&(e.material=t.material,e.update());const d=n.material.opacity;n.material.opacity=1-n.material.opacity,n.material.map=e.target.texture,n.render(h),n.material.opacity=d}(!this.dynamicLowRes&&this.rasterizeScene||this.dynamicLowRes&&this.isCompiling)&&this.rasterizeSceneCallback(this.scene,this.camera)}this.enablePathTracing&&n.material.opacity>0&&(n.material.opacity<1&&(n.material.blending=this.dynamicLowRes?y.AdditiveBlending:y.NormalBlending),n.material.map=t.target.texture,this.renderToCanvasCallback(t.target,h,n),n.material.blending=y.NoBlending)}}reset(){this._queueReset=!0,this._pathTracer.samples=0}dispose(){this._renderQuad.dispose(),this._renderQuad.material.dispose(),this._pathTracer.dispose()}_updateScale(){if(this.synchronizeRenderSize){this._renderer.getDrawingBufferSize(cr);const e=Math.floor(this.renderScale*cr.x),t=Math.floor(this.renderScale*cr.y);if(this._pathTracer.getSize(cr),cr.x!==e||cr.y!==t){const i=this.lowResScale;this._pathTracer.setSize(e,t),this._lowResPathTracer.setSize(Math.floor(e*i),Math.floor(t*i))}}}}const hf="3.3.5";globalThis.GLTF_PROGRESSIVE_VERSION=hf;console.debug(`[gltf-progressive] version ${hf}`);let mt="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",qi="https://cdn.needle.tools/static/three/0.179.1/basis2/";const X0=mt,j0=qi,cf=new URL(mt+"draco_decoder.js");cf.searchParams.append("range","true");fetch(cf,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(r=>{console.debug(`Failed to fetch remote Draco decoder from ${mt} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),mt===X0&&q0("./include/draco/"),qi===j0&&Z0("./include/ktx2/")}).finally(()=>{df()});const Y0=()=>({dracoDecoderPath:mt,ktx2TranscoderPath:qi});function q0(r){mt=r,Ze&&Ze[fl]!=mt?(console.debug("Updating Draco decoder path to "+r),Ze[fl]=mt,Ze.setDecoderPath(mt),Ze.preload()):console.debug("Setting Draco decoder path to "+r)}function Z0(r){qi=r,gt&>.transcoderPath!=qi?(console.debug("Updating KTX2 transcoder path to "+r),gt.setTranscoderPath(qi),gt.init()):console.debug("Setting KTX2 transcoder path to "+r)}function Fh(r){return df(),r?gt.detectSupport(r):r!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:Ze,ktx2Loader:gt,meshoptDecoder:_o}}function uf(r){r.dracoLoader||r.setDRACOLoader(Ze),r.ktx2Loader||r.setKTX2Loader(gt),r.meshoptDecoder||r.setMeshoptDecoder(_o)}const fl=Symbol("dracoDecoderPath");let Ze,_o,gt;function df(){Ze||(Ze=new Qm.DRACOLoader,Ze[fl]=mt,Ze.setDecoderPath(mt),Ze.setDecoderConfig({type:"js"}),Ze.preload()),gt||(gt=new Jm.KTX2Loader,gt.setTranscoderPath(qi),gt.init()),_o||(_o=Km.MeshoptDecoder)}const pl=new WeakMap;function ff(r,e){let t=pl.get(r);t?t=Object.assign(t,e):t=e,pl.set(r,t)}const la=Ph.GLTFLoader.prototype.load;function K0(...r){const e=pl.get(this);let t=r[0];const i=new URL(t,window.location.href);if(i.hostname.endsWith("needle.tools")){const n=(e==null?void 0:e.progressive)!==void 0?e.progressive:!0,o=e!=null&&e.usecase?e.usecase:"default";n?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${o}`:this.requestHeader.Accept=`*/*;usecase=${o}`,t=i.toString()}return r[0]=t,la==null?void 0:la.call(this,...r)}Ph.GLTFLoader.prototype.load=K0;sr("debugprogressive");function sr(r){if(typeof window>"u")return!1;const t=new URL(window.location.href).searchParams.get(r);return t==null||t==="0"||t==="false"?!1:t===""?!0:t}function Q0(r,e){if(e===void 0||r===void 0||e.startsWith("./")||e.startsWith("http")||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=r.lastIndexOf("/");if(t>=0){const i=r.substring(0,t+1);for(;i.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return i+e}return e}function pf(){return ds!==void 0||(ds=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),sr("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",ds)),ds}let ds;function Oc(){if(typeof window>"u")return!1;const r=new URL(window.location.href),e=r.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r.hostname);return r.hostname==="127.0.0.1"||e}class J0{constructor(e=100,t={}){N(this,"maxConcurrent");N(this,"_running",new Map);N(this,"_queue",[]);N(this,"debug",!1);N(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)});this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise finished now running: ${this._running.size}, waiting: ${this._queue.length}. (finished ${e})`)}),this.debug&&console.debug(`[PromiseQueue]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${e})`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:i,resolve:s}=this._queue.shift();s({use:n=>this.add(i,n)})}}}const e_=typeof window>"u"&&typeof document>"u",ml=Symbol("needle:raycast-mesh");function tn(r){return(r==null?void 0:r[ml])instanceof y.BufferGeometry?r[ml]:null}function t_(r,e){if((r.type==="Mesh"||r.type==="SkinnedMesh")&&!tn(r)){const i=r_(e);i.userData={isRaycastMesh:!0},r[ml]=i}}function i_(r=!0){if(r){if(fs)return;const e=fs=y.Mesh.prototype.raycast;y.Mesh.prototype.raycast=function(t,i){const s=this,n=tn(s);let o;n&&s.isMesh&&(o=s.geometry,s.geometry=n),e.call(this,t,i),o&&(s.geometry=o)}}else{if(!fs)return;y.Mesh.prototype.raycast=fs,fs=null}}let fs=null;function r_(r){const e=new y.BufferGeometry;for(const t in r.attributes)e.setAttribute(t,r.getAttribute(t));return e.setIndex(r.getIndex()),e}const ci=new Array,se=sr("debugprogressive");let ks,Ni=-1;if(se){let e=function(){Ni+=1,Ni>=r&&(Ni=-1),console.log(`Toggle LOD level [${Ni}]`)},r=6;window.addEventListener("keyup",t=>{t.key==="p"&&e(),t.key==="w"&&(ks=!ks,console.log(`Toggle wireframe [${ks}]`));const i=parseInt(t.key);!isNaN(i)&&i>=0&&(Ni=i,console.log(`Set LOD level to [${Ni}]`))})}function mf(r){if(se&&ks!==void 0)if(Array.isArray(r))for(const e of r)mf(e);else r&&"wireframe"in r&&(r.wireframe=ks===!0)}const ps=new Array;let s_=0;const n_=pf()?2:10;function o_(r){if(ps.length<n_){const i=ps.length;se&&console.warn(`[Worker] Creating new worker #${i}`);const s=Lh.createWorker(r||{});return ps.push(s),s}const e=s_++%ps.length;return ps[e]}class Lh{constructor(e,t){N(this,"worker");N(this,"_running",[]);N(this,"_webglRenderer",null);N(this,"_debug",!1);this.worker=e,this._debug=t.debug??!1,e.onmessage=i=>{const s=i.data;switch(this._debug&&console.log("[Worker] EVENT",s),s.type){case"loaded-gltf":for(const n of this._running)if(n.url===s.result.url){a_(s.result),n.resolve(s.result);const o=n.url;o.startsWith("blob:")&&URL.revokeObjectURL(o)}}},e.onerror=i=>{console.error("[Worker] Error in gltf-progressive worker:",i)},e.postMessage({type:"init"})}static async createWorker(e){const t=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/loader.worker-fysOIq2s.js").href:new URL("assets/loader.worker-fysOIq2s.js",document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:Qr&&Qr.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});return new Lh(t,e)}async load(e,t){const i=Y0();let s=t==null?void 0:t.renderer;s||(this._webglRenderer??(this._webglRenderer=(async()=>{const{WebGLRenderer:u}=await import("three");return new u})()),s=await this._webglRenderer);const a=Fh(s).ktx2Loader.workerConfig;e instanceof URL?e=e.toString():e.startsWith("file:")?e=URL.createObjectURL(new Blob([e])):!e.startsWith("blob:")&&!e.startsWith("http:")&&!e.startsWith("https:")&&(e=new URL(e,window.location.href).toString());const h={type:"load",url:e,dracoDecoderPath:i.dracoDecoderPath,ktx2TranscoderPath:i.ktx2TranscoderPath,ktx2LoaderConfig:a};return this._debug&&console.debug("[Worker] Sending load request",h),this.worker.postMessage(h),new Promise(u=>{this._running.push({url:e.toString(),resolve:u})})}}function a_(r){var e,t,i,s,n,o,a,h,u,d,l,c,f,p,g,m;for(const _ of r.geometries){const v=_.geometry,x=new y.BufferGeometry;if(x.name=v.name||"",v.index){const b=v.index;x.setIndex(ha(b))}for(const b in v.attributes){const w=v.attributes[b],C=ha(w);x.setAttribute(b,C)}if(v.morphAttributes)for(const b in v.morphAttributes){const C=v.morphAttributes[b].map(S=>ha(S));x.morphAttributes[b]=C}if(x.morphTargetsRelative=v.morphTargetsRelative??!1,x.boundingBox=new y.Box3,x.boundingBox.min=new y.Vector3((e=v.boundingBox)==null?void 0:e.min.x,(t=v.boundingBox)==null?void 0:t.min.y,(i=v.boundingBox)==null?void 0:i.min.z),x.boundingBox.max=new y.Vector3((s=v.boundingBox)==null?void 0:s.max.x,(n=v.boundingBox)==null?void 0:n.max.y,(o=v.boundingBox)==null?void 0:o.max.z),x.boundingSphere=new y.Sphere(new y.Vector3((a=v.boundingSphere)==null?void 0:a.center.x,(h=v.boundingSphere)==null?void 0:h.center.y,(u=v.boundingSphere)==null?void 0:u.center.z),(d=v.boundingSphere)==null?void 0:d.radius),v.groups)for(const b of v.groups)x.addGroup(b.start,b.count,b.materialIndex);v.userData&&(x.userData=v.userData),_.geometry=x}for(const _ of r.textures){const v=_.texture;let x=null;if(v.isCompressedTexture){const b=v.mipmaps,w=((l=v.image)==null?void 0:l.width)||((f=(c=v.source)==null?void 0:c.data)==null?void 0:f.width)||-1,C=((p=v.image)==null?void 0:p.height)||((m=(g=v.source)==null?void 0:g.data)==null?void 0:m.height)||-1;x=new y.CompressedTexture(b,w,C,v.format,v.type,v.mapping,v.wrapS,v.wrapT,v.magFilter,v.minFilter,v.anisotropy,v.colorSpace)}else x=new y.Texture(v.image,v.mapping,v.wrapS,v.wrapT,v.magFilter,v.minFilter,v.format,v.type,v.anisotropy,v.colorSpace),x.mipmaps=v.mipmaps,x.channel=v.channel,x.source.data=v.source.data,x.flipY=v.flipY,x.premultiplyAlpha=v.premultiplyAlpha,x.unpackAlignment=v.unpackAlignment,x.matrix=new y.Matrix3(...v.matrix.elements);if(!x){console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");continue}_.texture=x}return r}function ha(r){let e=r;if("isInterleavedBufferAttribute"in r&&r.isInterleavedBufferAttribute){const t=r.data,i=t.array,s=new y.InterleavedBuffer(i,t.stride);e=new y.InterleavedBufferAttribute(s,r.itemSize,i.byteOffset,r.normalized),e.offset=r.offset}else"isBufferAttribute"in r&&r.isBufferAttribute&&(e=new y.BufferAttribute(r.array,r.itemSize,r.normalized),e.usage=r.usage,e.gpuType=r.gpuType,e.updateRanges=r.updateRanges);return e}const l_=sr("gltf-progressive-worker"),h_=sr("gltf-progressive-reduce-mipmaps"),ca=Symbol("needle-progressive-texture"),Wt="NEEDLE_progressive",re=class re{constructor(e){N(this,"parser");N(this,"url");N(this,"_isLoadingMesh");N(this,"loadMesh",e=>{var i,s;if(this._isLoadingMesh)return null;const t=(s=(i=this.parser.json.meshes[e])==null?void 0:i.extensions)==null?void 0:s[Wt];return t?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",e).then(n=>{var o;return this._isLoadingMesh=!1,n&&re.registerMesh(this.url,t.guid,n,(o=t.lods)==null?void 0:o.length,0,t),n})):null});const t=e.options.path;se&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return Wt}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var i;const t=(i=this.getAssignedLODInformation(e))==null?void 0:i.index;return t??-1}static getMaterialMinMaxLODsCount(e,t){const i=this,s="LODS:minmax",n=e[s];if(n!=null)return n;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const a of e)this.getMaterialMinMaxLODsCount(a,t);return e[s]=t,t}if(se==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const a=e;for(const h of Object.keys(a.uniforms)){const u=a.uniforms[h].value;(u==null?void 0:u.isTexture)===!0&&o(u,t)}}else if(e.isMaterial)for(const a of Object.keys(e)){const h=e[a];(h==null?void 0:h.isTexture)===!0&&o(h,t)}else se&&console.warn(`[getMaterialMinMaxLODsCount] Unsupported material type: ${e.type}`);return e[s]=t,t;function o(a,h){const u=i.getAssignedLODInformation(a);if(u){const d=i.lodInfos.get(u.key);if(d&&d.lods){h.min_count=Math.min(h.min_count,d.lods.length),h.max_count=Math.max(h.max_count,d.lods.length);for(let l=0;l<d.lods.length;l++){const c=d.lods[l];c.width&&(h.lods[l]=h.lods[l]||{min_height:1/0,max_height:0},h.lods[l].min_height=Math.min(h.lods[l].min_height,c.height),h.lods[l].max_height=Math.max(h.lods[l].max_height,c.height))}}}}}static hasLODLevelAvailable(e,t){var n;if(Array.isArray(e)){for(const o of e)if(this.hasLODLevelAvailable(o,t))return!0;return!1}if(e.isMaterial===!0){for(const o of Object.keys(e)){const a=e[o];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,t))return!0}return!1}else if(e.isGroup===!0){for(const o of e.children)if(o.isMesh===!0&&this.hasLODLevelAvailable(o,t))return!0}let i,s;if(e.isMesh?i=e.geometry:(e.isBufferGeometry||e.isTexture)&&(i=e),i&&(n=i==null?void 0:i.userData)!=null&&n.LODS){const o=i.userData.LODS;if(s=this.lodInfos.get(o.key),t===void 0)return s!=null;if(s)return Array.isArray(s.lods)?t<s.lods.length:t===0}return!1}static assignMeshLOD(e,t){var i;if(!e)return Promise.resolve(null);if(e instanceof y.Mesh||e.isMesh===!0){const s=e.geometry,n=this.getAssignedLODInformation(s);if(!n)return Promise.resolve(null);for(const o of ci)(i=o.onBeforeGetLODMesh)==null||i.call(o,e,t);return e["LOD:requested level"]=t,re.getOrLoadLOD(s,t).then(o=>{if(Array.isArray(o)){const a=n.index||0;o=o[a]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],o&&s!=o&&((o==null?void 0:o.isBufferGeometry)?e.geometry=o:se&&console.error("Invalid LOD geometry",o))),o}).catch(o=>(console.error("Error loading mesh LOD",e,o),null))}else se&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const i=e;if(Array.isArray(i.material)){const s=new Array;for(const n of i.material){const o=this.assignTextureLOD(n,t);s.push(o)}return Promise.all(s).then(n=>{const o=new Array;for(const a of n)Array.isArray(a)&&o.push(...a);return o})}else return this.assignTextureLOD(i.material,t)}if(e.isMaterial===!0){const i=e,s=[],n=new Array;if(i.uniforms&&(i.isRawShaderMaterial||i.isShaderMaterial===!0)){const o=i;for(const a of Object.keys(o.uniforms)){const h=o.uniforms[a].value;if((h==null?void 0:h.isTexture)===!0){const u=this.assignTextureLODForSlot(h,t,i,a).then(d=>(d&&o.uniforms[a].value!=d&&(o.uniforms[a].value=d,o.uniformsNeedUpdate=!0),d));s.push(u),n.push(a)}}}else for(const o of Object.keys(i)){const a=i[o];if((a==null?void 0:a.isTexture)===!0){const h=this.assignTextureLODForSlot(a,t,i,o);s.push(h),n.push(o)}}return Promise.all(s).then(o=>{const a=new Array;for(let h=0;h<o.length;h++){const u=o[h],d=n[h];u&&u.isTexture===!0?a.push({material:i,slot:d,texture:u,level:t}):a.push({material:i,slot:d,texture:null,level:t})}return a})}if(e instanceof y.Texture||e.isTexture===!0){const i=e;return this.assignTextureLODForSlot(i,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,i,s){return(e==null?void 0:e.isTexture)!==!0?Promise.resolve(null):s==="glyphMap"?Promise.resolve(e):re.getOrLoadLOD(e,t).then(n=>{var o,a;if(Array.isArray(n))return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."),null;if((n==null?void 0:n.isTexture)===!0){if(n!=e&&i&&s){const h=i[s];if(h&&!se){const u=this.getAssignedLODInformation(h);if(u&&(u==null?void 0:u.level)<t)return se==="verbose"&&console.warn("Assigned texture level is already higher: ",u.level,t,i,h,n),null}if(h_&&n.mipmaps){const u=n.mipmaps.length;n.mipmaps.length=Math.min(n.mipmaps.length,3),u!==n.mipmaps.length&&se&&console.debug(`Reduced mipmap count from ${u} to ${n.mipmaps.length} for ${n.uuid}: ${(o=n.image)==null?void 0:o.width}x${(a=n.image)==null?void 0:a.height}.`)}i[s]=n}return n}else se=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(n=>(console.error("Error loading LOD",e,n),null))}afterRoot(e){var t,i;return se&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((s,n)=>{var o;if(s!=null&&s.extensions){const a=s==null?void 0:s.extensions[Wt];if(a){if(!a.lods){se&&console.warn("Texture has no LODs",a);return}let h=!1;for(const u of this.parser.associations.keys())if(u.isTexture===!0){const d=this.parser.associations.get(u);(d==null?void 0:d.textures)===n&&(h=!0,re.registerTexture(this.url,u,(o=a.lods)==null?void 0:o.length,n,a))}h||this.parser.getDependency("texture",n).then(u=>{var d;u&&re.registerTexture(this.url,u,(d=a.lods)==null?void 0:d.length,n,a)})}}}),(i=this.parser.json.meshes)==null||i.forEach((s,n)=>{if(s!=null&&s.extensions){const o=s==null?void 0:s.extensions[Wt];if(o&&o.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const h=this.parser.associations.get(a);(h==null?void 0:h.meshes)===n&&re.registerMesh(this.url,o.guid,a,o.lods.length,h.primitives,o)}}}}),null}static async getOrLoadLOD(e,t){var h,u,d,l;const i=se=="verbose",s=this.getAssignedLODInformation(e);if(!s)return se&&console.warn(`[gltf-progressive] No LOD information found: ${e.name}, uuid: ${e.uuid}, type: ${e.type}`,e),null;const n=s==null?void 0:s.key;let o;if(e.isTexture===!0){const c=e;c.source&&c.source[ca]&&(o=c.source[ca])}if(o||(o=re.lodInfos.get(n)),!o)se&&console.warn(`Can not load LOD ${t}: no LOD info found for "${n}" ${e.name}`,e.type,re.lodInfos);else{if(t>0){let p=!1;const g=Array.isArray(o.lods);if(g&&t>=o.lods.length?p=!0:g||(p=!0),p)return this.lowresCache.get(n)}const c=Array.isArray(o.lods)?(h=o.lods[t])==null?void 0:h.path:o.lods;if(!c)return se&&!o["missing:uri"]&&(o["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,o)),null;const f=Q0(s.url,c);if(f.endsWith(".glb")||f.endsWith(".gltf")){if(!o.guid)return console.warn("missing pointer for glb/gltf texture",o),null;const p=f+"_"+o.guid,g=await this.queue.slot(f),m=this.previouslyLoaded.get(p);if(m!==void 0){i&&console.log(`LOD ${t} was already loading/loaded: ${p}`);let b=await m.catch(C=>(console.error(`Error loading LOD ${t} from ${f}
|
|
3682
|
+
`,C),null)),w=!1;if(b==null||(b instanceof y.Texture&&e instanceof y.Texture?(u=b.image)!=null&&u.data||(d=b.source)!=null&&d.data?b=this.copySettings(e,b):(w=!0,this.previouslyLoaded.delete(p)):b instanceof y.BufferGeometry&&e instanceof y.BufferGeometry&&((l=b.attributes.position)!=null&&l.array||(w=!0,this.previouslyLoaded.delete(p)))),!w)return b}if(!g.use)return se&&console.log(`LOD ${t} was aborted: ${f}`),null;const _=o,v=new Promise(async(b,w)=>{if(l_){const E=await(await o_({})).load(f);if(E.textures.length>0)for(const A of E.textures){let I=A.texture;return re.assignLODInformation(s.url,I,n,t,void 0),e instanceof y.Texture&&(I=this.copySettings(e,I)),I&&(I.guid=_.guid),b(I)}if(E.geometries.length>0){const A=new Array;for(const I of E.geometries){const D=I.geometry;re.assignLODInformation(s.url,D,n,t,I.primitiveIndex),A.push(D)}return b(A)}return b(null)}const C=new Ph.GLTFLoader;uf(C),se&&(await new Promise(R=>setTimeout(R,1e3)),i&&console.warn("Start loading (delayed) "+f,_.guid));let S=f;if(_&&Array.isArray(_.lods)){const R=_.lods[t];R.hash&&(S+="?v="+R.hash)}const T=await C.loadAsync(S).catch(R=>(console.error(`Error loading LOD ${t} from ${f}
|
|
3683
|
+
`,R),b(null)));if(!T)return b(null);const M=T.parser;i&&console.log("Loading finished "+f,_.guid);let P=0;if(T.parser.json.textures){let R=!1;for(const E of T.parser.json.textures){if(E!=null&&E.extensions){const A=E==null?void 0:E.extensions[Wt];if(A!=null&&A.guid&&A.guid===_.guid){R=!0;break}}P++}if(R){let E=await M.getDependency("texture",P);return E&&re.assignLODInformation(s.url,E,n,t,void 0),i&&console.log('change "'+e.name+'" → "'+E.name+'"',f,P,E,p),e instanceof y.Texture&&(E=this.copySettings(e,E)),E&&(E.guid=_.guid),b(E)}else se&&console.warn("Could not find texture with guid",_.guid,T.parser.json)}if(P=0,T.parser.json.meshes){let R=!1;for(const E of T.parser.json.meshes){if(E!=null&&E.extensions){const A=E==null?void 0:E.extensions[Wt];if(A!=null&&A.guid&&A.guid===_.guid){R=!0;break}}P++}if(R){const E=await M.getDependency("mesh",P);if(i&&console.log(`Loaded Mesh "${E.name}"`,f,P,E,p),E.isMesh===!0){const A=E.geometry;return re.assignLODInformation(s.url,A,n,t,0),b(A)}else{const A=new Array;for(let I=0;I<E.children.length;I++){const D=E.children[I];if(D.isMesh===!0){const B=D.geometry;re.assignLODInformation(s.url,B,n,t,I),A.push(B)}}return b(A)}}else se&&console.warn("Could not find mesh with guid",_.guid,T.parser.json)}return b(null)});return this.previouslyLoaded.set(p,v),g.use(v),await v}else if(e instanceof y.Texture){i&&console.log("Load texture from uri: "+f);const g=await new y.TextureLoader().loadAsync(f);return g?(g.guid=o.guid,g.flipY=!1,g.needsUpdate=!0,g.colorSpace=e.colorSpace,i&&console.log(o,g)):se&&console.warn("failed loading",f),g}}return null}static assignLODInformation(e,t,i,s,n){if(!t)return;t.userData||(t.userData={});const o=new c_(e,i,s,n);t.userData.LODS=o,"source"in t&&typeof t.source=="object"&&(t.source.LODS=o)}static getAssignedLODInformation(e){var t,i;return e?(t=e.userData)!=null&&t.LODS?e.userData.LODS:"source"in e&&((i=e.source)!=null&&i.LODS)?e.source.LODS:null:null}static copySettings(e,t){return t?(se==="verbose"&&console.debug(`Copy texture settings
|
|
3684
3684
|
`,e.uuid,`
|
|
3685
|
-
`,t.uuid),t=t.clone(),t.offset=e.offset,t.repeat=e.repeat,t.colorSpace=e.colorSpace,t.magFilter=e.magFilter,t.minFilter=e.minFilter,t.wrapS=e.wrapS,t.wrapT=e.wrapT,t.flipY=e.flipY,t.anisotropy=e.anisotropy,t.mipmaps||(t.generateMipmaps=e.generateMipmaps),t):e}};N(re,"registerTexture",(e,t,i,s,n)=>{var a,h,u,d,l,c,f,p;if(!t){se&&console.error("!! gltf-progressive: Called register texture without texture");return}if(se){const g=((a=t.image)==null?void 0:a.width)||((u=(h=t.source)==null?void 0:h.data)==null?void 0:u.width)||0,m=((d=t.image)==null?void 0:d.height)||((c=(l=t.source)==null?void 0:l.data)==null?void 0:c.height)||0;console.log(`> gltf-progressive: register texture[${s}] "${t.name||t.uuid}", Current: ${g}x${m}, Max: ${(f=n.lods[0])==null?void 0:f.width}x${(p=n.lods[0])==null?void 0:p.height}, uuid: ${t.uuid}`,n,t)}t.source&&(t.source[ua]=n);const o=n.guid;re.assignLODInformation(e,t,o,i,s),re.lodInfos.set(o,n),re.lowresCache.set(o,t)}),N(re,"registerMesh",(e,t,i,s,n,o)=>{var u;const a=i.geometry;if(!a){se&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),se&&console.log("> Progressive: register mesh "+i.name,{index:n,uuid:i.uuid},o,i),re.assignLODInformation(e,a,t,s,n),re.lodInfos.set(t,o);let h=re.lowresCache.get(t);h?h.push(i.geometry):h=[i.geometry],re.lowresCache.set(t,h),s>0&&!en(i)&&e_(i,a);for(const d of ci)(u=d.onRegisteredNewMesh)==null||u.call(d,i,o)}),N(re,"lodInfos",new Map),N(re,"previouslyLoaded",new Map),N(re,"lowresCache",new Map),N(re,"workers",[]),N(re,"_workersIndex",0),N(re,"maxConcurrent",50),N(re,"queue",new Q0(re.maxConcurrent,{debug:se!=!1}));let Bt=re;class h_{constructor(e,t,i,s){N(this,"url");N(this,"key");N(this,"level");N(this,"index");this.url=e,this.key=t,this.level=i,s!=null&&(this.index=s)}}class eo{constructor(e,t){N(this,"ready");N(this,"_resolve");N(this,"_signal");N(this,"_frame_start");N(this,"_frames_to_capture");N(this,"_resolved",!1);N(this,"_addedCount",0);N(this,"_resolvedCount",0);N(this,"_awaiting",[]);N(this,"_maxPromisesPerObject",1);N(this,"_currentFrame",0);N(this,"_seen",new WeakMap);var n;const s=Math.max(t.frames??2,2);this._frame_start=t.waitForFirstCapture?void 0:e,this._frames_to_capture=s,this.ready=new Promise(o=>{this._resolve=o}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=t.signal,(n=this._signal)==null||n.addEventListener("abort",()=>{this.resolveNow()}),this._maxPromisesPerObject=Math.max(1,t.maxPromisesPerObject??1)}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(e){var t;this._currentFrame=e,this._frame_start===void 0&&this._addedCount>0&&(this._frame_start=e),((t=this._signal)!=null&&t.aborted||this._awaiting.length===0&&this._frame_start!==void 0&&e>this._frame_start+this._frames_to_capture)&&this.resolveNow()}add(e,t,i){if(this._resolved){se&&console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}if(!(this._frame_start!==void 0&&this._currentFrame>this._frame_start+this._frames_to_capture)){if(this._maxPromisesPerObject>=1)if(this._seen.has(t)){let s=this._seen.get(t);if(s>=this._maxPromisesPerObject){se&&console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");return}this._seen.set(t,s+1)}else this._seen.set(t,1);this._awaiting.push(i),this._addedCount++,i.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(i),1)})}}resolveNow(){var e,t;this._resolved||(t=this._resolve)==null||t.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((e=this._signal)==null?void 0:e.aborted)??!1})}}N(eo,"addPromise",(e,t,i,s)=>{s.forEach(n=>{n.add(e,t,i)})});const lt=sr("debugprogressive"),c_=sr("noprogressive"),da=Symbol("Needle:LODSManager"),fa=Symbol("Needle:LODState"),ni=Symbol("Needle:CurrentLOD"),$e={mesh_lod:-1,texture_lod:-1};var qe,Xt,Vo,_i,Zr,Wo,jt;const ce=class ce{constructor(e,t){N(this,"renderer");N(this,"context");N(this,"projectionScreenMatrix",new y.Matrix4);N(this,"overrideLodLevel");N(this,"targetTriangleDensity",2e5);N(this,"skinnedMeshAutoUpdateBoundsInterval",30);N(this,"updateInterval","auto");si(this,qe,1);N(this,"pause",!1);N(this,"manual",!1);N(this,"_newPromiseGroups",[]);N(this,"_promiseGroupIds",0);N(this,"_lodchangedlisteners",[]);si(this,Xt,void 0);si(this,Vo,new y.Clock);si(this,_i,0);si(this,Zr,0);si(this,Wo,0);si(this,jt,0);N(this,"_fpsBuffer",[60,60,60,60,60]);N(this,"_sphere",new y.Sphere);N(this,"_tempBox",new y.Box3);N(this,"_tempBox2",new y.Box3);N(this,"tempMatrix",new y.Matrix4);N(this,"_tempWorldPosition",new y.Vector3);N(this,"_tempBoxSize",new y.Vector3);N(this,"_tempBox2Size",new y.Vector3);this.renderer=e,this.context={...t}}static getObjectLODState(e){return e[fa]}static addPlugin(e){ci.push(e)}static removePlugin(e){const t=ci.indexOf(e);t>=0&&ci.splice(t,1)}static get(e,t){if(e[da])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),e[da];const i=new ce(e,{engine:"unknown",...t});return e[da]=i,i}get plugins(){return ci}awaitLoading(e){const t=this._promiseGroupIds++,i=new eo(le(this,_i),{...e});this._newPromiseGroups.push(i);const s=performance.now();return i.ready.finally(()=>{const n=this._newPromiseGroups.indexOf(i);n>=0&&(this._newPromiseGroups.splice(n,1),Oc()&&performance.measure("LODsManager:awaitLoading",{start:s,detail:{id:t,name:e==null?void 0:e.name,awaited:i.awaitedCount,resolved:i.resolvedCount}}))}),i.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let e=this._newPromiseGroups.length-1;e>=0;e--)this._newPromiseGroups[e].update(le(this,_i))}addEventListener(e,t){e==="changed"&&this._lodchangedlisteners.push(t)}removeEventListener(e,t){if(e==="changed"){const i=this._lodchangedlisteners.indexOf(t);i>=0&&this._lodchangedlisteners.splice(i,1)}}enable(){if(le(this,Xt))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let e=0;wt(this,Xt,this.renderer.render);const t=this;Fh(this.renderer),this.renderer.render=function(i,s){const n=t.renderer.getRenderTarget();(n==null||"isXRRenderTarget"in n&&n.isXRRenderTarget)&&(e=0,wt(t,_i,le(t,_i)+1),wt(t,Zr,le(t,Vo).getDelta()),wt(t,Wo,le(t,Wo)+le(t,Zr)),t._fpsBuffer.shift(),t._fpsBuffer.push(1/le(t,Zr)),wt(t,jt,t._fpsBuffer.reduce((a,h)=>a+h)/t._fpsBuffer.length),lt&&le(t,_i)%200===0&&console.log("FPS",Math.round(le(t,jt)),"Interval:",le(t,qe)));const o=e++;le(t,Xt).call(this,i,s),t.onAfterRender(i,s,o)}}disable(){le(this,Xt)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=le(this,Xt),wt(this,Xt,void 0))}update(e,t){this.internalUpdate(e,t)}onAfterRender(e,t,i){if(this.pause)return;const n=this.renderer.renderLists.get(e,0).opaque;let o=!0;if(n.length===1){const a=n[0].material;(a.name==="EffectMaterial"||a.name==="CopyShader")&&(o=!1)}if((t.parent&&t.parent.type==="CubeCamera"||i>=1&&t.type==="OrthographicCamera")&&(o=!1),o){if(c_||(this.updateInterval==="auto"?le(this,jt)<40&&le(this,qe)<10?(wt(this,qe,le(this,qe)+1),lt&&console.warn("↓ Reducing LOD updates",le(this,qe),le(this,jt).toFixed(0))):le(this,jt)>=60&&le(this,qe)>1&&(wt(this,qe,le(this,qe)-1),lt&&console.warn("↑ Increasing LOD updates",le(this,qe),le(this,jt).toFixed(0))):wt(this,qe,this.updateInterval),le(this,qe)>0&&le(this,_i)%le(this,qe)!=0))return;this.internalUpdate(e,t),this._postprocessPromiseGroups()}}internalUpdate(e,t){var h,u;const i=this.renderer.renderLists.get(e,0),s=i.opaque;this.projectionScreenMatrix.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);const n=this.targetTriangleDensity;for(const d of s){if(d.material&&(((h=d.geometry)==null?void 0:h.type)==="BoxGeometry"||((u=d.geometry)==null?void 0:u.type)==="BufferGeometry")&&(d.material.name==="SphericalGaussianBlur"||d.material.name=="BackgroundCubeMaterial"||d.material.name==="CubemapFromEquirect"||d.material.name==="EquirectangularToCubeUV")){lt&&(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",d,d.material.name,d.material.type)));continue}switch(d.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if(lt==="color"&&d.material&&!d.object.progressive_debug_color){d.object.progressive_debug_color=!0;const c=Math.random()*16777215,f=new y.MeshStandardMaterial({color:c});d.object.material=f}const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}const o=i.transparent;for(const d of o){const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}const a=i.transmissive;for(const d of a){const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}}updateLODs(e,t,i,s){var a,h;i.userData||(i.userData={});let n=i[fa];if(n||(n=new u_,i[fa]=n),n.frames++<2)return;for(const u of ci)(a=u.onBeforeUpdateLOD)==null||a.call(u,this.renderer,e,t,i);const o=this.overrideLodLevel!==void 0?this.overrideLodLevel:Ni;o>=0?($e.mesh_lod=o,$e.texture_lod=o):(this.calculateLodLevel(t,i,n,s,$e),$e.mesh_lod=Math.round($e.mesh_lod),$e.texture_lod=Math.round($e.texture_lod)),$e.mesh_lod>=0&&this.loadProgressiveMeshes(i,$e.mesh_lod),i.material&&$e.texture_lod>=0&&this.loadProgressiveTextures(i.material,$e.texture_lod,o),se&&i.material&&!i.isGizmo&&mf(i.material);for(const u of ci)(h=u.onAfterUpdatedLOD)==null||h.call(u,this.renderer,e,t,i,$e);n.lastLodLevel_Mesh=$e.mesh_lod,n.lastLodLevel_Texture=$e.texture_lod}loadProgressiveTextures(e,t,i){if(!e)return;if(Array.isArray(e)){for(const n of e)this.loadProgressiveTextures(n,t);return}let s=!1;if((e[ni]===void 0||t<e[ni])&&(s=!0),i!==void 0&&i>=0&&(s=e[ni]!=i,t=i),s){e[ni]=t;const n=Bt.assignTextureLOD(e,t).then(o=>{this._lodchangedlisteners.forEach(a=>a({type:"texture",level:t,object:e}))});eo.addPromise("texture",e,n,this._newPromiseGroups)}}loadProgressiveMeshes(e,t){if(!e)return Promise.resolve(null);let i=e[ni]!==t;const s=e["DEBUG:LOD"];if(s!=null&&(i=e[ni]!=s,t=s),i){e[ni]=t;const n=e.geometry,o=Bt.assignMeshLOD(e,t).then(a=>(a&&e[ni]==t&&n!=e.geometry&&this._lodchangedlisteners.forEach(h=>h({type:"mesh",level:t,object:e})),a));return eo.addPromise("mesh",e,o,this._newPromiseGroups),o}return Promise.resolve(null)}static isInside(e,t){const i=e.min,s=e.max,n=(i.x+s.x)*.5,o=(i.y+s.y)*.5;return this._tempPtInside.set(n,o,i.z).applyMatrix4(t).z<0}calculateLodLevel(e,t,i,s,n){var m,_,v,x;if(!t){n.mesh_lod=-1,n.texture_lod=-1;return}if(!e){n.mesh_lod=-1,n.texture_lod=-1;return}let a=10+1,h=!1;if(lt&&t["DEBUG:LOD"]!=null)return t["DEBUG:LOD"];const u=(m=Bt.getMeshLODExtension(t.geometry))==null?void 0:m.lods,d=Bt.getPrimitiveIndex(t.geometry),l=u&&u.length>0,c=Bt.getMaterialMinMaxLODsCount(t.material),f=c.min_count!==1/0&&c.min_count>=0&&c.max_count>=0;if(!l&&!f){n.mesh_lod=0,n.texture_lod=0;return}l||(h=!0,a=0);const p=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let g=t.geometry.boundingBox;if(t.type==="SkinnedMesh"){const b=t;if(!b.boundingBox)b.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0){if(!b[ce.$skinnedMeshBoundsOffset]){const C=ce.skinnedMeshBoundsFrameOffsetCounter++;b[ce.$skinnedMeshBoundsOffset]=C}const w=b[ce.$skinnedMeshBoundsOffset];if((i.frames+w)%this.skinnedMeshAutoUpdateBoundsInterval===0){const C=en(b),S=b.geometry;C&&(b.geometry=C),b.computeBoundingBox(),b.geometry=S}}g=b.boundingBox}if(g){const b=e;if(t.geometry.attributes.color&&t.geometry.attributes.color.count<100&&t.geometry.boundingSphere){this._sphere.copy(t.geometry.boundingSphere),this._sphere.applyMatrix4(t.matrixWorld);const A=e.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(A)){n.mesh_lod=0,n.texture_lod=0;return}}if(this._tempBox.copy(g),this._tempBox.applyMatrix4(t.matrixWorld),b.isPerspectiveCamera&&ce.isInside(this._tempBox,this.projectionScreenMatrix)){n.mesh_lod=0,n.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&b.isPerspectiveCamera&&b.fov>70){const A=this._tempBox.min,I=this._tempBox.max;let D=A.x,B=A.y,k=I.x,z=I.y;const q=2,L=1.5,F=(A.x+I.x)*.5,G=(A.y+I.y)*.5;D=(D-F)*q+F,B=(B-G)*q+G,k=(k-F)*q+F,z=(z-G)*q+G;const Q=D<0&&k>0?0:Math.min(Math.abs(A.x),Math.abs(I.x)),ee=B<0&&z>0?0:Math.min(Math.abs(A.y),Math.abs(I.y)),oe=Math.max(Q,ee);i.lastCentrality=(L-oe)*(L-oe)*(L-oe)}else i.lastCentrality=1;const w=this._tempBox.getSize(this._tempBoxSize);w.multiplyScalar(.5),screen.availHeight>0&&p>0&&w.multiplyScalar(p/screen.availHeight),e.isPerspectiveCamera?w.x*=e.aspect:e.isOrthographicCamera;const C=e.matrixWorldInverse,S=this._tempBox2;S.copy(g),S.applyMatrix4(t.matrixWorld),S.applyMatrix4(C);const T=S.getSize(this._tempBox2Size),M=Math.max(T.x,T.y);if(Math.max(w.x,w.y)!=0&&M!=0&&(w.z=T.z/Math.max(T.x,T.y)*Math.max(w.x,w.y)),i.lastScreenCoverage=Math.max(w.x,w.y,w.z),i.lastScreenspaceVolume.copy(w),i.lastScreenCoverage*=i.lastCentrality,lt&&ce.debugDrawLine){const A=this.tempMatrix.copy(this.projectionScreenMatrix);A.invert();const I=ce.corner0,D=ce.corner1,B=ce.corner2,k=ce.corner3;I.copy(this._tempBox.min),D.copy(this._tempBox.max),D.x=I.x,B.copy(this._tempBox.max),B.y=I.y,k.copy(this._tempBox.max);const z=(I.z+k.z)*.5;I.z=D.z=B.z=k.z=z,I.applyMatrix4(A),D.applyMatrix4(A),B.applyMatrix4(A),k.applyMatrix4(A),ce.debugDrawLine(I,D,255),ce.debugDrawLine(I,B,255),ce.debugDrawLine(D,k,255),ce.debugDrawLine(B,k,255)}let R=999;if(u&&i.lastScreenCoverage>0)for(let A=0;A<u.length;A++){const I=u[A],B=(((_=I.densities)==null?void 0:_[d])||I.density||1e-5)/i.lastScreenCoverage;if(d>0&&Oc()&&!I.densities&&!globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"]&&(window["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"]=!0,console.warn("[Needle Progressive] Detected usage of mesh without primitive densities. This might cause incorrect LOD level selection: Consider re-optimizing your model by updating your Needle Integration, Needle glTF Pipeline or running optimization again on Needle Cloud.")),B<s){R=A;break}}R<a&&(a=R,h=!0)}if(h?n.mesh_lod=a:n.mesh_lod=i.lastLodLevel_Mesh,lt&&n.mesh_lod!=i.lastLodLevel_Mesh){const w=u==null?void 0:u[n.mesh_lod];w&&console.log(`Mesh LOD changed: ${i.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${(v=w.densities)==null?void 0:v[d].toFixed(0)}) | ${t.name}`)}if(f){const b="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(i.lastLodLevel_Texture<0){if(n.texture_lod=c.max_count-1,lt){const w=c.lods[c.max_count-1];lt&&console.log(`First Texture LOD ${n.texture_lod} (${w.max_height}px) - ${t.name}`)}}else{const w=i.lastScreenspaceVolume.x+i.lastScreenspaceVolume.y+i.lastScreenspaceVolume.z;let C=i.lastScreenCoverage*4;((x=this.context)==null?void 0:x.engine)==="model-viewer"&&(C*=1.5);const T=p/window.devicePixelRatio*C;let M=!1;for(let P=c.lods.length-1;P>=0;P--){const R=c.lods[P];if(!(b&&R.max_height>=2048)&&!(pf()&&R.max_height>4096)&&(R.max_height>T||!M&&P===0)){if(M=!0,n.texture_lod=P,lt&&n.texture_lod<i.lastLodLevel_Texture){const E=R.max_height;console.log(`Texture LOD changed: ${i.lastLodLevel_Texture} → ${n.texture_lod} = ${E}px
|
|
3685
|
+
`,t.uuid),t=t.clone(),t.offset=e.offset,t.repeat=e.repeat,t.colorSpace=e.colorSpace,t.magFilter=e.magFilter,t.minFilter=e.minFilter,t.wrapS=e.wrapS,t.wrapT=e.wrapT,t.flipY=e.flipY,t.anisotropy=e.anisotropy,t.mipmaps||(t.generateMipmaps=e.generateMipmaps),t):e}};N(re,"registerTexture",(e,t,i,s,n)=>{var a,h,u,d,l,c,f,p;if(!t){se&&console.error("!! gltf-progressive: Called register texture without texture");return}if(se){const g=((a=t.image)==null?void 0:a.width)||((u=(h=t.source)==null?void 0:h.data)==null?void 0:u.width)||0,m=((d=t.image)==null?void 0:d.height)||((c=(l=t.source)==null?void 0:l.data)==null?void 0:c.height)||0;console.log(`> gltf-progressive: register texture[${s}] "${t.name||t.uuid}", Current: ${g}x${m}, Max: ${(f=n.lods[0])==null?void 0:f.width}x${(p=n.lods[0])==null?void 0:p.height}, uuid: ${t.uuid}`,n,t)}t.source&&(t.source[ca]=n);const o=n.guid;re.assignLODInformation(e,t,o,i,s),re.lodInfos.set(o,n),re.lowresCache.set(o,t)}),N(re,"registerMesh",(e,t,i,s,n,o)=>{var u;const a=i.geometry;if(!a){se&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),se&&console.log("> Progressive: register mesh "+i.name,{index:n,uuid:i.uuid},o,i),re.assignLODInformation(e,a,t,s,n),re.lodInfos.set(t,o);let h=re.lowresCache.get(t);h?h.push(i.geometry):h=[i.geometry],re.lowresCache.set(t,h),s>0&&!tn(i)&&t_(i,a);for(const d of ci)(u=d.onRegisteredNewMesh)==null||u.call(d,i,o)}),N(re,"lodInfos",new Map),N(re,"previouslyLoaded",new Map),N(re,"lowresCache",new Map),N(re,"workers",[]),N(re,"_workersIndex",0),N(re,"maxConcurrent",50),N(re,"queue",new J0(re.maxConcurrent,{debug:se!=!1}));let Bt=re;class c_{constructor(e,t,i,s){N(this,"url");N(this,"key");N(this,"level");N(this,"index");this.url=e,this.key=t,this.level=i,s!=null&&(this.index=s)}}class to{constructor(e,t){N(this,"ready");N(this,"_resolve");N(this,"_signal");N(this,"_frame_start");N(this,"_frames_to_capture");N(this,"_resolved",!1);N(this,"_addedCount",0);N(this,"_resolvedCount",0);N(this,"_awaiting",[]);N(this,"_maxPromisesPerObject",1);N(this,"_currentFrame",0);N(this,"_seen",new WeakMap);var n;const s=Math.max(t.frames??2,2);this._frame_start=t.waitForFirstCapture?void 0:e,this._frames_to_capture=s,this.ready=new Promise(o=>{this._resolve=o}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=t.signal,(n=this._signal)==null||n.addEventListener("abort",()=>{this.resolveNow()}),this._maxPromisesPerObject=Math.max(1,t.maxPromisesPerObject??1)}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(e){var t;this._currentFrame=e,this._frame_start===void 0&&this._addedCount>0&&(this._frame_start=e),((t=this._signal)!=null&&t.aborted||this._awaiting.length===0&&this._frame_start!==void 0&&e>this._frame_start+this._frames_to_capture)&&this.resolveNow()}add(e,t,i){if(this._resolved){se&&console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}if(!(this._frame_start!==void 0&&this._currentFrame>this._frame_start+this._frames_to_capture)){if(this._maxPromisesPerObject>=1)if(this._seen.has(t)){let s=this._seen.get(t);if(s>=this._maxPromisesPerObject){se&&console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");return}this._seen.set(t,s+1)}else this._seen.set(t,1);this._awaiting.push(i),this._addedCount++,i.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(i),1)})}}resolveNow(){var e,t;this._resolved||(t=this._resolve)==null||t.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((e=this._signal)==null?void 0:e.aborted)??!1})}}N(to,"addPromise",(e,t,i,s)=>{s.forEach(n=>{n.add(e,t,i)})});const lt=sr("debugprogressive"),u_=sr("noprogressive"),ua=Symbol("Needle:LODSManager"),da=Symbol("Needle:LODState"),ni=Symbol("Needle:CurrentLOD"),$e={mesh_lod:-1,texture_lod:-1};var qe,Xt,Ho,_i,Zr,Vo,jt;const ce=class ce{constructor(e,t){N(this,"renderer");N(this,"context");N(this,"projectionScreenMatrix",new y.Matrix4);N(this,"overrideLodLevel");N(this,"targetTriangleDensity",2e5);N(this,"skinnedMeshAutoUpdateBoundsInterval",30);N(this,"updateInterval","auto");si(this,qe,1);N(this,"pause",!1);N(this,"manual",!1);N(this,"_newPromiseGroups",[]);N(this,"_promiseGroupIds",0);N(this,"_lodchangedlisteners",[]);si(this,Xt,void 0);si(this,Ho,new y.Clock);si(this,_i,0);si(this,Zr,0);si(this,Vo,0);si(this,jt,0);N(this,"_fpsBuffer",[60,60,60,60,60]);N(this,"_sphere",new y.Sphere);N(this,"_tempBox",new y.Box3);N(this,"_tempBox2",new y.Box3);N(this,"tempMatrix",new y.Matrix4);N(this,"_tempWorldPosition",new y.Vector3);N(this,"_tempBoxSize",new y.Vector3);N(this,"_tempBox2Size",new y.Vector3);this.renderer=e,this.context={...t}}static getObjectLODState(e){return e[da]}static addPlugin(e){ci.push(e)}static removePlugin(e){const t=ci.indexOf(e);t>=0&&ci.splice(t,1)}static get(e,t){if(e[ua])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),e[ua];const i=new ce(e,{engine:"unknown",...t});return e[ua]=i,i}get plugins(){return ci}awaitLoading(e){const t=this._promiseGroupIds++,i=new to(le(this,_i),{...e});this._newPromiseGroups.push(i);const s=performance.now();return i.ready.finally(()=>{const n=this._newPromiseGroups.indexOf(i);n>=0&&(this._newPromiseGroups.splice(n,1),Oc()&&performance.measure("LODsManager:awaitLoading",{start:s,detail:{id:t,name:e==null?void 0:e.name,awaited:i.awaitedCount,resolved:i.resolvedCount}}))}),i.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let e=this._newPromiseGroups.length-1;e>=0;e--)this._newPromiseGroups[e].update(le(this,_i))}addEventListener(e,t){e==="changed"&&this._lodchangedlisteners.push(t)}removeEventListener(e,t){if(e==="changed"){const i=this._lodchangedlisteners.indexOf(t);i>=0&&this._lodchangedlisteners.splice(i,1)}}enable(){if(le(this,Xt))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let e=0;wt(this,Xt,this.renderer.render);const t=this;Fh(this.renderer),this.renderer.render=function(i,s){const n=t.renderer.getRenderTarget();(n==null||"isXRRenderTarget"in n&&n.isXRRenderTarget)&&(e=0,wt(t,_i,le(t,_i)+1),wt(t,Zr,le(t,Ho).getDelta()),wt(t,Vo,le(t,Vo)+le(t,Zr)),t._fpsBuffer.shift(),t._fpsBuffer.push(1/le(t,Zr)),wt(t,jt,t._fpsBuffer.reduce((a,h)=>a+h)/t._fpsBuffer.length),lt&&le(t,_i)%200===0&&console.log("FPS",Math.round(le(t,jt)),"Interval:",le(t,qe)));const o=e++;le(t,Xt).call(this,i,s),t.onAfterRender(i,s,o)}}disable(){le(this,Xt)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=le(this,Xt),wt(this,Xt,void 0))}update(e,t){this.internalUpdate(e,t)}onAfterRender(e,t,i){if(this.pause)return;const n=this.renderer.renderLists.get(e,0).opaque;let o=!0;if(n.length===1){const a=n[0].material;(a.name==="EffectMaterial"||a.name==="CopyShader")&&(o=!1)}if((t.parent&&t.parent.type==="CubeCamera"||i>=1&&t.type==="OrthographicCamera")&&(o=!1),o){if(u_||(this.updateInterval==="auto"?le(this,jt)<40&&le(this,qe)<10?(wt(this,qe,le(this,qe)+1),lt&&console.warn("↓ Reducing LOD updates",le(this,qe),le(this,jt).toFixed(0))):le(this,jt)>=60&&le(this,qe)>1&&(wt(this,qe,le(this,qe)-1),lt&&console.warn("↑ Increasing LOD updates",le(this,qe),le(this,jt).toFixed(0))):wt(this,qe,this.updateInterval),le(this,qe)>0&&le(this,_i)%le(this,qe)!=0))return;this.internalUpdate(e,t),this._postprocessPromiseGroups()}}internalUpdate(e,t){var h,u;const i=this.renderer.renderLists.get(e,0),s=i.opaque;this.projectionScreenMatrix.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);const n=this.targetTriangleDensity;for(const d of s){if(d.material&&(((h=d.geometry)==null?void 0:h.type)==="BoxGeometry"||((u=d.geometry)==null?void 0:u.type)==="BufferGeometry")&&(d.material.name==="SphericalGaussianBlur"||d.material.name=="BackgroundCubeMaterial"||d.material.name==="CubemapFromEquirect"||d.material.name==="EquirectangularToCubeUV")){lt&&(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",d,d.material.name,d.material.type)));continue}switch(d.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if(lt==="color"&&d.material&&!d.object.progressive_debug_color){d.object.progressive_debug_color=!0;const c=Math.random()*16777215,f=new y.MeshStandardMaterial({color:c});d.object.material=f}const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}const o=i.transparent;for(const d of o){const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}const a=i.transmissive;for(const d of a){const l=d.object;(l instanceof y.Mesh||l.isMesh)&&this.updateLODs(e,t,l,n)}}updateLODs(e,t,i,s){var a,h;i.userData||(i.userData={});let n=i[da];if(n||(n=new d_,i[da]=n),n.frames++<2)return;for(const u of ci)(a=u.onBeforeUpdateLOD)==null||a.call(u,this.renderer,e,t,i);const o=this.overrideLodLevel!==void 0?this.overrideLodLevel:Ni;o>=0?($e.mesh_lod=o,$e.texture_lod=o):(this.calculateLodLevel(t,i,n,s,$e),$e.mesh_lod=Math.round($e.mesh_lod),$e.texture_lod=Math.round($e.texture_lod)),$e.mesh_lod>=0&&this.loadProgressiveMeshes(i,$e.mesh_lod),i.material&&$e.texture_lod>=0&&this.loadProgressiveTextures(i.material,$e.texture_lod,o),se&&i.material&&!i.isGizmo&&mf(i.material);for(const u of ci)(h=u.onAfterUpdatedLOD)==null||h.call(u,this.renderer,e,t,i,$e);n.lastLodLevel_Mesh=$e.mesh_lod,n.lastLodLevel_Texture=$e.texture_lod}loadProgressiveTextures(e,t,i){if(!e)return;if(Array.isArray(e)){for(const n of e)this.loadProgressiveTextures(n,t);return}let s=!1;if((e[ni]===void 0||t<e[ni])&&(s=!0),i!==void 0&&i>=0&&(s=e[ni]!=i,t=i),s){e[ni]=t;const n=Bt.assignTextureLOD(e,t).then(o=>{this._lodchangedlisteners.forEach(a=>a({type:"texture",level:t,object:e}))});to.addPromise("texture",e,n,this._newPromiseGroups)}}loadProgressiveMeshes(e,t){if(!e)return Promise.resolve(null);let i=e[ni]!==t;const s=e["DEBUG:LOD"];if(s!=null&&(i=e[ni]!=s,t=s),i){e[ni]=t;const n=e.geometry,o=Bt.assignMeshLOD(e,t).then(a=>(a&&e[ni]==t&&n!=e.geometry&&this._lodchangedlisteners.forEach(h=>h({type:"mesh",level:t,object:e})),a));return to.addPromise("mesh",e,o,this._newPromiseGroups),o}return Promise.resolve(null)}static isInside(e,t){const i=e.min,s=e.max,n=(i.x+s.x)*.5,o=(i.y+s.y)*.5;return this._tempPtInside.set(n,o,i.z).applyMatrix4(t).z<0}calculateLodLevel(e,t,i,s,n){var m,_,v,x;if(!t){n.mesh_lod=-1,n.texture_lod=-1;return}if(!e){n.mesh_lod=-1,n.texture_lod=-1;return}let a=10+1,h=!1;if(lt&&t["DEBUG:LOD"]!=null)return t["DEBUG:LOD"];const u=(m=Bt.getMeshLODExtension(t.geometry))==null?void 0:m.lods,d=Bt.getPrimitiveIndex(t.geometry),l=u&&u.length>0,c=Bt.getMaterialMinMaxLODsCount(t.material),f=c.min_count!==1/0&&c.min_count>=0&&c.max_count>=0;if(!l&&!f){n.mesh_lod=0,n.texture_lod=0;return}l||(h=!0,a=0);const p=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let g=t.geometry.boundingBox;if(t.type==="SkinnedMesh"){const b=t;if(!b.boundingBox)b.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0){if(!b[ce.$skinnedMeshBoundsOffset]){const C=ce.skinnedMeshBoundsFrameOffsetCounter++;b[ce.$skinnedMeshBoundsOffset]=C}const w=b[ce.$skinnedMeshBoundsOffset];if((i.frames+w)%this.skinnedMeshAutoUpdateBoundsInterval===0){const C=tn(b),S=b.geometry;C&&(b.geometry=C),b.computeBoundingBox(),b.geometry=S}}g=b.boundingBox}if(g){const b=e;if(t.geometry.attributes.color&&t.geometry.attributes.color.count<100&&t.geometry.boundingSphere){this._sphere.copy(t.geometry.boundingSphere),this._sphere.applyMatrix4(t.matrixWorld);const A=e.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(A)){n.mesh_lod=0,n.texture_lod=0;return}}if(this._tempBox.copy(g),this._tempBox.applyMatrix4(t.matrixWorld),b.isPerspectiveCamera&&ce.isInside(this._tempBox,this.projectionScreenMatrix)){n.mesh_lod=0,n.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&b.isPerspectiveCamera&&b.fov>70){const A=this._tempBox.min,I=this._tempBox.max;let D=A.x,B=A.y,k=I.x,z=I.y;const q=2,L=1.5,F=(A.x+I.x)*.5,G=(A.y+I.y)*.5;D=(D-F)*q+F,B=(B-G)*q+G,k=(k-F)*q+F,z=(z-G)*q+G;const Q=D<0&&k>0?0:Math.min(Math.abs(A.x),Math.abs(I.x)),ee=B<0&&z>0?0:Math.min(Math.abs(A.y),Math.abs(I.y)),oe=Math.max(Q,ee);i.lastCentrality=(L-oe)*(L-oe)*(L-oe)}else i.lastCentrality=1;const w=this._tempBox.getSize(this._tempBoxSize);w.multiplyScalar(.5),screen.availHeight>0&&p>0&&w.multiplyScalar(p/screen.availHeight),e.isPerspectiveCamera?w.x*=e.aspect:e.isOrthographicCamera;const C=e.matrixWorldInverse,S=this._tempBox2;S.copy(g),S.applyMatrix4(t.matrixWorld),S.applyMatrix4(C);const T=S.getSize(this._tempBox2Size),M=Math.max(T.x,T.y);if(Math.max(w.x,w.y)!=0&&M!=0&&(w.z=T.z/Math.max(T.x,T.y)*Math.max(w.x,w.y)),i.lastScreenCoverage=Math.max(w.x,w.y,w.z),i.lastScreenspaceVolume.copy(w),i.lastScreenCoverage*=i.lastCentrality,lt&&ce.debugDrawLine){const A=this.tempMatrix.copy(this.projectionScreenMatrix);A.invert();const I=ce.corner0,D=ce.corner1,B=ce.corner2,k=ce.corner3;I.copy(this._tempBox.min),D.copy(this._tempBox.max),D.x=I.x,B.copy(this._tempBox.max),B.y=I.y,k.copy(this._tempBox.max);const z=(I.z+k.z)*.5;I.z=D.z=B.z=k.z=z,I.applyMatrix4(A),D.applyMatrix4(A),B.applyMatrix4(A),k.applyMatrix4(A),ce.debugDrawLine(I,D,255),ce.debugDrawLine(I,B,255),ce.debugDrawLine(D,k,255),ce.debugDrawLine(B,k,255)}let R=999;if(u&&i.lastScreenCoverage>0)for(let A=0;A<u.length;A++){const I=u[A],B=(((_=I.densities)==null?void 0:_[d])||I.density||1e-5)/i.lastScreenCoverage;if(d>0&&Oc()&&!I.densities&&!globalThis["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"]&&(window["NEEDLE:MISSING_LOD_PRIMITIVE_DENSITIES"]=!0,console.warn("[Needle Progressive] Detected usage of mesh without primitive densities. This might cause incorrect LOD level selection: Consider re-optimizing your model by updating your Needle Integration, Needle glTF Pipeline or running optimization again on Needle Cloud.")),B<s){R=A;break}}R<a&&(a=R,h=!0)}if(h?n.mesh_lod=a:n.mesh_lod=i.lastLodLevel_Mesh,lt&&n.mesh_lod!=i.lastLodLevel_Mesh){const w=u==null?void 0:u[n.mesh_lod];w&&console.log(`Mesh LOD changed: ${i.lastLodLevel_Mesh} → ${n.mesh_lod} (density: ${(v=w.densities)==null?void 0:v[d].toFixed(0)}) | ${t.name}`)}if(f){const b="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(i.lastLodLevel_Texture<0){if(n.texture_lod=c.max_count-1,lt){const w=c.lods[c.max_count-1];lt&&console.log(`First Texture LOD ${n.texture_lod} (${w.max_height}px) - ${t.name}`)}}else{const w=i.lastScreenspaceVolume.x+i.lastScreenspaceVolume.y+i.lastScreenspaceVolume.z;let C=i.lastScreenCoverage*4;((x=this.context)==null?void 0:x.engine)==="model-viewer"&&(C*=1.5);const T=p/window.devicePixelRatio*C;let M=!1;for(let P=c.lods.length-1;P>=0;P--){const R=c.lods[P];if(!(b&&R.max_height>=2048)&&!(pf()&&R.max_height>4096)&&(R.max_height>T||!M&&P===0)){if(M=!0,n.texture_lod=P,lt&&n.texture_lod<i.lastLodLevel_Texture){const E=R.max_height;console.log(`Texture LOD changed: ${i.lastLodLevel_Texture} → ${n.texture_lod} = ${E}px
|
|
3686
3686
|
Screensize: ${T.toFixed(0)}px, Coverage: ${(100*i.lastScreenCoverage).toFixed(2)}%, Volume ${w.toFixed(1)}
|
|
3687
|
-
${t.name}`)}break}}}}else n.texture_lod=0}};qe=new WeakMap,Xt=new WeakMap,
|
|
3688
|
-
`,r.getAttribute("src"));let e=null,t=null,i=null;for(let s=r;s!=null;s=Object.getPrototypeOf(s)){const n=Object.getOwnPropertySymbols(s),o=n.find(u=>u.toString()=="Symbol(renderer)"),a=n.find(u=>u.toString()=="Symbol(scene)"),h=n.find(u=>u.toString()=="Symbol(needsRender)");!e&&o!=null&&(e=r[o].threeRenderer),!t&&a!=null&&(t=r[a]),!i&&h!=null&&(i=r[h])}if(e&&t){let n=function(){if(i){let o=0,a=setInterval(()=>{if(o++>5){clearInterval(a);return}i==null||i.call(r)},300)}};console.debug("[gltf-progressive] setup model-viewer");const s=Qr.get(e,{engine:"model-viewer"});return Qr.addPlugin(new p_),s.enable(),s.addEventListener("changed",()=>{i==null||i.call(r)}),r.addEventListener("model-visibility",o=>{o.detail.visible&&(i==null||i.call(r))}),r.addEventListener("load",()=>{n()}),()=>{s.disable()}}return null}class p_{constructor(){N(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(e,t,i,s){this.tryParseMeshLOD(t,s),this.tryParseTextureLOD(t,s)}getUrl(e){if(!e)return null;let t=e.getAttribute("src");return t||(t=e.src),t||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",e),this._didWarnAboutMissingUrl=!0),t}tryGetCurrentGLTF(e){return e._currentGLTF}tryGetCurrentModelViewer(e){return e.element}tryParseTextureLOD(e,t){if(t[pn]==!0)return;t[pn]=!0;const i=this.tryGetCurrentGLTF(e),s=this.tryGetCurrentModelViewer(e),n=this.getUrl(s);if(n&&i&&t.material){let a=function(h){var d,l,c;if(h[pn]==!0)return;h[pn]=!0,h.userData&&(h.userData.LOD=-1);const u=Object.keys(h);for(let f=0;f<u.length;f++){const p=u[f],g=h[p];if((g==null?void 0:g.isTexture)===!0){const m=(l=(d=g.userData)==null?void 0:d.associations)==null?void 0:l.textures;if(m==null)continue;const _=i.parser.json.textures[m];if(!_){console.warn("Texture data not found for texture index "+m);continue}if((c=_==null?void 0:_.extensions)!=null&&c[Wt]){const v=_.extensions[Wt];v&&n&&Bt.registerTexture(n,g,v.lods.length,m,v)}}}};const o=t.material;if(Array.isArray(o))for(const h of o)a(h);else a(o)}}tryParseMeshLOD(e,t){var o,a;if(t[kc]==!0)return;t[kc]=!0;const i=this.tryGetCurrentModelViewer(e),s=this.getUrl(i);if(!s)return;const n=(a=(o=t.userData)==null?void 0:o.gltfExtensions)==null?void 0:a[Wt];if(n&&s){const h=t.uuid;Bt.registerMesh(s,h,t,0,n.lods.length,n)}}}function yf(...r){let e,t,i,s;switch(r.length){case 2:[i,t]=r,s={};break;case 3:[i,t,s]=r;break;case 4:[e,t,i,s]=r;break;default:throw new Error("Invalid arguments")}Fh(t),uf(i),ff(i,{progressive:!0,...s==null?void 0:s.hints}),i.register(o=>new Bt(o));const n=Qr.get(t);return(s==null?void 0:s.enableLODsManager)!==!1&&n.enable(),n}gf();if(!J0){const r={gltfProgressive:{useNeedleProgressive:yf,LODsManager:Qr,configureLoader:ff,getRaycastMesh:en,useRaycastMeshes:t_}};if(!globalThis.Needle)globalThis.Needle=r;else for(const e in r)globalThis.Needle[e]=r[e]}var Gr=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return r},Out:function(r){return r},InOut:function(r){return r}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var e=1.70158;return r===1?1:r*r*((e+1)*r-e)},Out:function(r){var e=1.70158;return r===0?0:--r*r*((e+1)*r+e)+1},InOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)}}),Bounce:Object.freeze({In:function(r){return 1-Gr.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?Gr.Bounce.In(r*2)*.5:Gr.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(e){return Math.pow(e,r)},Out:function(e){return 1-Math.pow(1-e,r)},InOut:function(e){return e<.5?Math.pow(e*2,r)/2:(1-Math.pow(2-e*2,r))/2+.5}}}}),Or=function(){return performance.now()},vf=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},r.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},r.prototype.update=function(e,t){e===void 0&&(e=Or()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var n=this._tweens[i[s]],o=!t;n&&n.update(e,o)===!1&&!t&&delete this._tweens[i[s]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),ji={Linear:function(r,e){var t=r.length-1,i=t*e,s=Math.floor(i),n=ji.Utils.Linear;return e<0?n(r[0],r[1],i):e>1?n(r[t],r[t-1],t-i):n(r[s],r[s+1>t?t:s+1],i-s)},Bezier:function(r,e){for(var t=0,i=r.length-1,s=Math.pow,n=ji.Utils.Bernstein,o=0;o<=i;o++)t+=s(1-e,i-o)*s(e,o)*r[o]*n(i,o);return t},CatmullRom:function(r,e){var t=r.length-1,i=t*e,s=Math.floor(i),n=ji.Utils.CatmullRom;return r[0]===r[t]?(e<0&&(s=Math.floor(i=t*(1+e))),n(r[(s-1+t)%t],r[s],r[(s+1)%t],r[(s+2)%t],i-s)):e<0?r[0]-(n(r[0],r[0],r[1],r[1],-i)-r[0]):e>1?r[t]-(n(r[t],r[t],r[t-1],r[t-1],i-t)-r[t]):n(r[s?s-1:0],r[s],r[t<s+1?t:s+1],r[t<s+2?t:s+2],i-s)},Utils:{Linear:function(r,e,t){return(e-r)*t+r},Bernstein:function(r,e){var t=ji.Utils.Factorial;return t(r)/t(e)/t(r-e)},Factorial:function(){var r=[1];return function(e){var t=1;if(r[e])return r[e];for(var i=e;i>1;i--)t*=i;return r[e]=t,t}}(),CatmullRom:function(r,e,t,i,s){var n=(t-r)*.5,o=(i-e)*.5,a=s*s,h=s*a;return(2*e-2*t+n+o)*h+(-3*e+3*t-2*n-o)*a+n*s+e}}},Oh=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),_l=new vf,yo=function(){function r(e,t){t===void 0&&(t=_l),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Gr.Linear.None,this._interpolationFunction=ji.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Oh.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},r.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},r.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},r.prototype.start=function(e,t){if(e===void 0&&(e=Or()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var n in this._valuesEnd)s[n]=this._valuesEnd[n];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},r.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},r.prototype._setupProperties=function(e,t,i,s,n){for(var o in i){var a=e[o],h=Array.isArray(a),u=h?"array":typeof a,d=!h&&Array.isArray(i[o]);if(!(u==="undefined"||u==="function")){if(d){var l=i[o];if(l.length===0)continue;for(var c=[a],f=0,p=l.length;f<p;f+=1){var g=this._handleRelativeValue(a,l[f]);if(isNaN(g)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}c.push(g)}d&&(i[o]=c)}if((u==="object"||h)&&a&&!d){t[o]=h?[]:{};var m=a;for(var _ in m)t[o][_]=m[_];s[o]=h?[]:{};var l=i[o];if(!this._isDynamic){var v={};for(var _ in l)v[_]=l[_];i[o]=l=v}this._setupProperties(m,t[o],l,s[o],n)}else(typeof t[o]>"u"||n)&&(t[o]=a),h||(t[o]*=1),d?s[o]=i[o].slice().reverse():s[o]=t[o]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(e){return e===void 0&&(e=Or()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},r.prototype.resume=function(e){return e===void 0&&(e=Or()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},r.prototype.group=function(e){return e===void 0&&(e=_l),this._group=e,this},r.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},r.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},r.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},r.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},r.prototype.easing=function(e){return e===void 0&&(e=Gr.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=ji.Linear),this._interpolationFunction=e,this},r.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},r.prototype.onStart=function(e){return this._onStartCallback=e,this},r.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},r.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},r.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},r.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},r.prototype.onStop=function(e){return this._onStopCallback=e,this},r.prototype.update=function(e,t){var i=this,s;if(e===void 0&&(e=Or()),t===void 0&&(t=!0),this._isPaused)return!0;var n,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>o)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,h=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),u=this._duration+this._repeat*h,d=function(){if(i._duration===0||a>u)return 1;var m=Math.trunc(a/h),_=a-m*h,v=Math.min(_/i._duration,1);return v===0&&a===i._duration?1:v},l=d(),c=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(e,t,i,s){for(var n in i)if(t[n]!==void 0){var o=t[n]||0,a=i[n],h=Array.isArray(e[n]),u=Array.isArray(a),d=!h&&u;d?e[n]=this._interpolationFunction(a,s):typeof a=="object"&&a?this._updateProperties(e[n],o,a,s):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[n]=o+(a-o)*s))}},r.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},r.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},r}(),m_="23.1.3",g_=Oh.nextId,Nt=_l,__=Nt.getAll.bind(Nt),y_=Nt.removeAll.bind(Nt),v_=Nt.add.bind(Nt),x_=Nt.remove.bind(Nt),b_=Nt.update.bind(Nt),Pt={Easing:Gr,Group:vf,Interpolation:ji,now:Or,Sequence:Oh,nextId:g_,Tween:yo,VERSION:m_,getAll:__,removeAll:y_,add:v_,remove:x_,update:b_},Yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function w_(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var xf={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function n(h,u,d,l,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,l||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,l;if(this._eventsCount===0)return u;for(l in d=this._events)e.call(d,l)&&u.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=t?t+u:u,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var c=0,f=l.length,p=new Array(f);c<f;c++)p[c]=l[c].fn;return p},a.prototype.listenerCount=function(u){var d=t?t+u:u,l=this._events[d];return l?l.fn?1:l.length:0},a.prototype.emit=function(u,d,l,c,f,p){var g=t?t+u:u;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,v,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,d),!0;case 3:return m.fn.call(m.context,d,l),!0;case 4:return m.fn.call(m.context,d,l,c),!0;case 5:return m.fn.call(m.context,d,l,c,f),!0;case 6:return m.fn.call(m.context,d,l,c,f,p),!0}for(x=1,v=new Array(_-1);x<_;x++)v[x-1]=arguments[x];m.fn.apply(m.context,v)}else{var b=m.length,w;for(x=0;x<b;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,d);break;case 3:m[x].fn.call(m[x].context,d,l);break;case 4:m[x].fn.call(m[x].context,d,l,c);break;default:if(!v)for(w=1,v=new Array(_-1);w<_;w++)v[w-1]=arguments[w];m[x].fn.apply(m[x].context,v)}}return!0},a.prototype.on=function(u,d,l){return n(this,u,d,l,!1)},a.prototype.once=function(u,d,l){return n(this,u,d,l,!0)},a.prototype.removeListener=function(u,d,l,c){var f=t?t+u:u;if(!this._events[f])return this;if(!d)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!l||p.context===l)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==d||c&&!p[g].once||l&&p[g].context!==l)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&o(this,d)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(xf);var A_=xf.exports;const os=kh(A_);var ks=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(l){l.preventDefault(),i(++r%e.children.length)},!1);function t(l){return e.appendChild(l.dom),l}function i(l){for(var c=0;c<e.children.length;c++)e.children[c].style.display=c===l?"block":"none";r=l}var s=(performance||Date).now(),n=s,o=0,a=t(new ks.Panel("FPS","#0ff","#002")),h=t(new ks.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var u=t(new ks.Panel("MB","#f08","#201"));i(0);var d=0;return{REVISION:16,dom:e,fps:function(){return d&&parseInt(d.toFixed(0))},addPanel:t,showPanel:i,begin:function(){s=(performance||Date).now()},end:function(){o++;var l=(performance||Date).now();if(h.update(l-s,200),l>=n+1e3&&(d=o*1e3/(l-n),a.update(d,100),n=l,o=0,u)){var c=performance.memory;u.update(c.usedJSHeapSize/1048576,c.jsHeapSizeLimit/1048576)}return l},update:function(){s=this.end()},domElement:e,setMode:i}};ks.Panel=function(r,e,t){var i=1/0,s=0,n=Math.round,o=n(window.devicePixelRatio||1),a=80*o,h=48*o,u=3*o,d=2*o,l=3*o,c=15*o,f=74*o,p=30*o,g=document.createElement("canvas");g.width=a,g.height=h,g.style.cssText="width:80px;height:48px";var m=g.getContext("2d");return m.font="bold "+9*o+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=t,m.fillRect(0,0,a,h),m.fillStyle=e,m.fillText(r,u,d),m.fillRect(l,c,f,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(l,c,f,p),{dom:g,update:function(_,v){i=Math.min(i,_),s=Math.max(s,_),m.fillStyle=t,m.globalAlpha=1,m.fillRect(0,0,a,c),m.fillStyle=e,m.fillText(n(_)+" "+r+" ("+n(i)+"-"+n(s)+")",u,d),m.drawImage(g,l+o,c,f-o,p,l,c,f-o,p),m.fillRect(l+f-o,c,o,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(l+f-o,c,o,n((1-_/v)*p))}}};var nr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(nr||{}),bf=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(bf||{}),yl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(yl||{}),Y=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Y||{}),Ft=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ft||{}),O=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(O||{}),zr=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(zr||{}),j=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(j||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),qt=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(qt||{}),wi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(wi||{}),Ut=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ut||{}),je=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(je||{}),Rt=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Rt||{}),Nh=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Nh||{}),et=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(et||{}),Ce=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(Ce||{}),Te=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Te||{}),Ot=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ot||{});const T_={createCanvas:(r,e)=>{const t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},V={ADAPTER:T_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var pa=/iPhone/i,Gc=/iPod/i,zc=/iPad/i,Hc=/\biOS-universal(?:.+)Mac\b/i,ma=/\bAndroid(?:.+)Mobile\b/i,Vc=/Android/i,ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,mn=/Silk/i,zt=/Windows Phone/i,Wc=/\bWindows(?:.+)ARM\b/i,$c=/BlackBerry/i,Xc=/BB10/i,jc=/Opera Mini/i,Yc=/\b(CriOS|Chrome)(?:.+)Mobile/i,qc=/Mobile(?:.+)Firefox\b/i,Zc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function S_(r){return function(e){return e.test(r)}}function Kc(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=S_(t),n={apple:{phone:s(pa)&&!s(zt),ipod:s(Gc),tablet:!s(pa)&&(s(zc)||Zc(e))&&!s(zt),universal:s(Hc),device:(s(pa)||s(Gc)||s(zc)||s(Hc)||Zc(e))&&!s(zt)},amazon:{phone:s(ur),tablet:!s(ur)&&s(mn),device:s(ur)||s(mn)},android:{phone:!s(zt)&&s(ur)||!s(zt)&&s(ma),tablet:!s(zt)&&!s(ur)&&!s(ma)&&(s(mn)||s(Vc)),device:!s(zt)&&(s(ur)||s(mn)||s(ma)||s(Vc))||s(/\bokhttp\b/i)},windows:{phone:s(zt),tablet:s(Wc),device:s(zt)||s(Wc)},other:{blackberry:s($c),blackberry10:s(Xc),opera:s(jc),firefox:s(qc),chrome:s(Yc),device:s($c)||s(Xc)||s(jc)||s(qc)||s(Yc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const E_=Kc.default??Kc,Zt=E_(globalThis.navigator);V.RETINA_PREFIX=/@([0-9\.]+)x/;V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var wf={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function n(h,u,d,l,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,l||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,l;if(this._eventsCount===0)return u;for(l in d=this._events)e.call(d,l)&&u.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=t?t+u:u,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var c=0,f=l.length,p=new Array(f);c<f;c++)p[c]=l[c].fn;return p},a.prototype.listenerCount=function(u){var d=t?t+u:u,l=this._events[d];return l?l.fn?1:l.length:0},a.prototype.emit=function(u,d,l,c,f,p){var g=t?t+u:u;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,v,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,d),!0;case 3:return m.fn.call(m.context,d,l),!0;case 4:return m.fn.call(m.context,d,l,c),!0;case 5:return m.fn.call(m.context,d,l,c,f),!0;case 6:return m.fn.call(m.context,d,l,c,f,p),!0}for(x=1,v=new Array(_-1);x<_;x++)v[x-1]=arguments[x];m.fn.apply(m.context,v)}else{var b=m.length,w;for(x=0;x<b;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,d);break;case 3:m[x].fn.call(m[x].context,d,l);break;case 4:m[x].fn.call(m[x].context,d,l,c);break;default:if(!v)for(w=1,v=new Array(_-1);w<_;w++)v[w-1]=arguments[w];m[x].fn.apply(m[x].context,v)}}return!0},a.prototype.on=function(u,d,l){return n(this,u,d,l,!1)},a.prototype.once=function(u,d,l){return n(this,u,d,l,!0)},a.prototype.removeListener=function(u,d,l,c){var f=t?t+u:u;if(!this._events[f])return this;if(!d)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!l||p.context===l)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==d||c&&!p[g].once||l&&p[g].context!==l)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&o(this,d)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(wf);var C_=wf.exports;const tn=kh(C_);var Uh={exports:{}};Uh.exports=$o;Uh.exports.default=$o;function $o(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,n=Af(r,0,s,t,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,u,d,l,c,f;if(i&&(n=D_(r,e,n,t)),r.length>80*t){a=u=r[0],h=d=r[1];for(var p=t;p<s;p+=t)l=r[p],c=r[p+1],l<a&&(a=l),c<h&&(h=c),l>u&&(u=l),c>d&&(d=c);f=Math.max(u-a,d-h),f=f!==0?32767/f:0}return js(n,o,t,a,h,f,0),o}function Af(r,e,t,i,s){var n,o;if(s===bl(r,e,t,i)>0)for(n=e;n<t;n+=i)o=Qc(n,r[n],r[n+1],o);else for(n=t-i;n>=e;n-=i)o=Qc(n,r[n],r[n+1],o);return o&&Xo(o,o.next)&&(qs(o),o=o.next),o}function er(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Xo(t,t.next)||ge(t.prev,t,t.next)===0)){if(qs(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function js(r,e,t,i,s,n,o){if(r){!o&&n&&k_(r,i,s,n);for(var a=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,n?I_(r,i,s,n):M_(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),qs(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=P_(er(r),e,t),js(r,e,t,i,s,n,2)):o===2&&R_(r,e,t,i,s,n):js(er(r),e,t,i,s,n,1);break}}}}function M_(r){var e=r.prev,t=r,i=r.next;if(ge(e,t,i)>=0)return!1;for(var s=e.x,n=t.x,o=i.x,a=e.y,h=t.y,u=i.y,d=s<n?s<o?s:o:n<o?n:o,l=a<h?a<u?a:u:h<u?h:u,c=s>n?s>o?s:o:n>o?n:o,f=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=d&&p.x<=c&&p.y>=l&&p.y<=f&&kr(s,a,n,h,o,u,p.x,p.y)&&ge(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function I_(r,e,t,i){var s=r.prev,n=r,o=r.next;if(ge(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,u=o.x,d=s.y,l=n.y,c=o.y,f=a<h?a<u?a:u:h<u?h:u,p=d<l?d<c?d:c:l<c?l:c,g=a>h?a>u?a:u:h>u?h:u,m=d>l?d>c?d:c:l>c?l:c,_=vl(f,p,e,t,i),v=vl(g,m,e,t,i),x=r.prevZ,b=r.nextZ;x&&x.z>=_&&b&&b.z<=v;){if(x.x>=f&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&kr(a,d,h,l,u,c,x.x,x.y)&&ge(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&kr(a,d,h,l,u,c,b.x,b.y)&&ge(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&kr(a,d,h,l,u,c,x.x,x.y)&&ge(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&kr(a,d,h,l,u,c,b.x,b.y)&&ge(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function P_(r,e,t){var i=r;do{var s=i.prev,n=i.next.next;!Xo(s,n)&&Tf(s,i,i.next,n)&&Ys(s,n)&&Ys(n,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(n.i/t|0),qs(i),qs(i.next),i=r=n),i=i.next}while(i!==r);return er(i)}function R_(r,e,t,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&G_(o,a)){var h=Sf(o,a);o=er(o,o.next),h=er(h,h.next),js(o,e,t,i,s,n,0),js(h,e,t,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function D_(r,e,t,i){var s=[],n,o,a,h,u;for(n=0,o=e.length;n<o;n++)a=e[n]*i,h=n<o-1?e[n+1]*i:r.length,u=Af(r,a,h,i,!1),u===u.next&&(u.steiner=!0),s.push(U_(u));for(s.sort(B_),n=0;n<s.length;n++)t=F_(s[n],t);return t}function B_(r,e){return r.x-e.x}function F_(r,e){var t=L_(r,e);if(!t)return e;var i=Sf(t,r);return er(i,i.next),er(t,t.next)}function L_(r,e){var t=e,i=r.x,s=r.y,n=-1/0,o;do{if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>n&&(n=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var h=o,u=o.x,d=o.y,l=1/0,c;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&kr(s<d?i:n,s,u,d,s<d?n:i,s,t.x,t.y)&&(c=Math.abs(s-t.y)/(i-t.x),Ys(t,r)&&(c<l||c===l&&(t.x>o.x||t.x===o.x&&O_(o,t)))&&(o=t,l=c)),t=t.next;while(t!==h);return o}function O_(r,e){return ge(r.prev,r,e.prev)<0&&ge(e.next,r,r.next)<0}function k_(r,e,t,i){var s=r;do s.z===0&&(s.z=vl(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,N_(s)}function N_(r){var e,t,i,s,n,o,a,h,u=1;do{for(t=r,r=null,n=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(h=u;a>0||h>0&&i;)a!==0&&(h===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;t=i}n.nextZ=null,u*=2}while(o>1);return r}function vl(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function U_(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function kr(r,e,t,i,s,n,o,a){return(s-o)*(e-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(n-a)>=(s-o)*(i-a)}function G_(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!z_(r,e)&&(Ys(r,e)&&Ys(e,r)&&H_(r,e)&&(ge(r.prev,r,e.prev)||ge(r,e.prev,e))||Xo(r,e)&&ge(r.prev,r,r.next)>0&&ge(e.prev,e,e.next)>0)}function ge(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Xo(r,e){return r.x===e.x&&r.y===e.y}function Tf(r,e,t,i){var s=_n(ge(r,e,t)),n=_n(ge(r,e,i)),o=_n(ge(t,i,r)),a=_n(ge(t,i,e));return!!(s!==n&&o!==a||s===0&&gn(r,t,e)||n===0&&gn(r,i,e)||o===0&&gn(t,r,i)||a===0&&gn(t,e,i))}function gn(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function _n(r){return r>0?1:r<0?-1:0}function z_(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Tf(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ys(r,e){return ge(r.prev,r,r.next)<0?ge(r,e,r.next)>=0&&ge(r,r.prev,e)>=0:ge(r,e,r.prev)<0||ge(r,r.next,e)<0}function H_(r,e){var t=r,i=!1,s=(r.x+e.x)/2,n=(r.y+e.y)/2;do t.y>n!=t.next.y>n&&t.next.y!==t.y&&s<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function Sf(r,e){var t=new xl(r.i,r.x,r.y),i=new xl(e.i,e.x,e.y),s=r.next,n=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,n.next=i,i.prev=n,i}function Qc(r,e,t,i){var s=new xl(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function qs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function xl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}$o.deviation=function(r,e,t,i){var s=e&&e.length,n=s?e[0]*t:r.length,o=Math.abs(bl(r,0,n,t));if(s)for(var a=0,h=e.length;a<h;a++){var u=e[a]*t,d=a<h-1?e[a+1]*t:r.length;o-=Math.abs(bl(r,u,d,t))}var l=0;for(a=0;a<i.length;a+=3){var c=i[a]*t,f=i[a+1]*t,p=i[a+2]*t;l+=Math.abs((r[c]-r[p])*(r[f+1]-r[c+1])-(r[c]-r[f])*(r[p+1]-r[c+1]))}return o===0&&l===0?0:Math.abs((l-o)/o)};function bl(r,e,t,i){for(var s=0,n=e,o=t-i;n<t;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}$o.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<e;o++)t.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t};var V_=Uh.exports;const W_=kh(V_);var vo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */vo.exports;(function(r,e){(function(t){var i=e&&!e.nodeType&&e,s=r&&!r.nodeType&&r,n=typeof Yt=="object"&&Yt;(n.global===n||n.window===n||n.self===n)&&(t=n);var o,a=2147483647,h=36,u=1,d=26,l=38,c=700,f=72,p=128,g="-",m=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,w=Math.floor,C=String.fromCharCode,S;function T(L){throw new RangeError(x[L])}function M(L,F){for(var G=L.length,Q=[];G--;)Q[G]=F(L[G]);return Q}function P(L,F){var G=L.split("@"),Q="";G.length>1&&(Q=G[0]+"@",L=G[1]),L=L.replace(v,".");var ee=L.split("."),oe=M(ee,F).join(".");return Q+oe}function R(L){for(var F=[],G=0,Q=L.length,ee,oe;G<Q;)ee=L.charCodeAt(G++),ee>=55296&&ee<=56319&&G<Q?(oe=L.charCodeAt(G++),(oe&64512)==56320?F.push(((ee&1023)<<10)+(oe&1023)+65536):(F.push(ee),G--)):F.push(ee);return F}function E(L){return M(L,function(F){var G="";return F>65535&&(F-=65536,G+=C(F>>>10&1023|55296),F=56320|F&1023),G+=C(F),G}).join("")}function A(L){return L-48<10?L-22:L-65<26?L-65:L-97<26?L-97:h}function I(L,F){return L+22+75*(L<26)-((F!=0)<<5)}function D(L,F,G){var Q=0;for(L=G?w(L/c):L>>1,L+=w(L/F);L>b*d>>1;Q+=h)L=w(L/b);return w(Q+(b+1)*L/(L+l))}function B(L){var F=[],G=L.length,Q,ee=0,oe=p,pe=f,ye,Ae,ae,be,ne,ve,he,Be,Ne;for(ye=L.lastIndexOf(g),ye<0&&(ye=0),Ae=0;Ae<ye;++Ae)L.charCodeAt(Ae)>=128&&T("not-basic"),F.push(L.charCodeAt(Ae));for(ae=ye>0?ye+1:0;ae<G;){for(be=ee,ne=1,ve=h;ae>=G&&T("invalid-input"),he=A(L.charCodeAt(ae++)),(he>=h||he>w((a-ee)/ne))&&T("overflow"),ee+=he*ne,Be=ve<=pe?u:ve>=pe+d?d:ve-pe,!(he<Be);ve+=h)Ne=h-Be,ne>w(a/Ne)&&T("overflow"),ne*=Ne;Q=F.length+1,pe=D(ee-be,Q,be==0),w(ee/Q)>a-oe&&T("overflow"),oe+=w(ee/Q),ee%=Q,F.splice(ee++,0,oe)}return E(F)}function k(L){var F,G,Q,ee,oe,pe,ye,Ae,ae,be,ne,ve=[],he,Be,Ne,Ii;for(L=R(L),he=L.length,F=p,G=0,oe=f,pe=0;pe<he;++pe)ne=L[pe],ne<128&&ve.push(C(ne));for(Q=ee=ve.length,ee&&ve.push(g);Q<he;){for(ye=a,pe=0;pe<he;++pe)ne=L[pe],ne>=F&&ne<ye&&(ye=ne);for(Be=Q+1,ye-F>w((a-G)/Be)&&T("overflow"),G+=(ye-F)*Be,F=ye,pe=0;pe<he;++pe)if(ne=L[pe],ne<F&&++G>a&&T("overflow"),ne==F){for(Ae=G,ae=h;be=ae<=oe?u:ae>=oe+d?d:ae-oe,!(Ae<be);ae+=h)Ii=Ae-be,Ne=h-be,ve.push(C(I(be+Ii%Ne,0))),Ae=w(Ii/Ne);ve.push(C(I(Ae,0))),oe=D(G,Be,Q==ee),G=0,++Q}++G,++F}return ve.join("")}function z(L){return P(L,function(F){return m.test(F)?B(F.slice(4).toLowerCase()):F})}function q(L){return P(L,function(F){return _.test(F)?"xn--"+k(F):F})}if(o={version:"1.4.1",ucs2:{decode:R,encode:E},decode:B,encode:k,toASCII:q,toUnicode:z},i&&s)if(r.exports==i)s.exports=o;else for(S in o)o.hasOwnProperty(S)&&(i[S]=o[S]);else t.punycode=o})(Yt)})(vo,vo.exports);var $_=vo.exports,X_=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Jc=typeof Symbol<"u"&&Symbol,j_=X_,Y_=function(){return typeof Jc!="function"||typeof Symbol!="function"||typeof Jc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:j_()},eu={foo:{}},q_=Object,Z_=function(){return{__proto__:eu}.foo===eu.foo&&!({__proto__:null}instanceof q_)},K_="Function.prototype.bind called on incompatible ",Q_=Object.prototype.toString,J_=Math.max,ey="[object Function]",tu=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var n=0;n<t.length;n+=1)i[n+e.length]=t[n];return i},ty=function(e,t){for(var i=[],s=t||0,n=0;s<e.length;s+=1,n+=1)i[n]=e[s];return i},iy=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},ry=function(e){var t=this;if(typeof t!="function"||Q_.apply(t)!==ey)throw new TypeError(K_+t);for(var i=ty(arguments,1),s,n=function(){if(this instanceof s){var d=t.apply(this,tu(i,arguments));return Object(d)===d?d:this}return t.apply(e,tu(i,arguments))},o=J_(0,t.length-i.length),a=[],h=0;h<o;h++)a[h]="$"+h;if(s=Function("binder","return function ("+iy(a,",")+"){ return binder.apply(this,arguments); }")(n),t.prototype){var u=function(){};u.prototype=t.prototype,s.prototype=new u,u.prototype=null}return s},sy=ry,Gh=Function.prototype.bind||sy,ny=Function.prototype.call,oy=Object.prototype.hasOwnProperty,ay=Gh,ly=ay.call(ny,oy),te,Jr=SyntaxError,Ef=Function,Hr=TypeError,ga=function(r){try{return Ef('"use strict"; return ('+r+").constructor;")()}catch{}},Zi=Object.getOwnPropertyDescriptor;if(Zi)try{Zi({},"")}catch{Zi=null}var _a=function(){throw new Hr},hy=Zi?function(){try{return arguments.callee,_a}catch{try{return Zi(arguments,"callee").get}catch{return _a}}}():_a,dr=Y_(),cy=Z_(),Pe=Object.getPrototypeOf||(cy?function(r){return r.__proto__}:null),Cr={},uy=typeof Uint8Array>"u"||!Pe?te:Pe(Uint8Array),Ki={"%AggregateError%":typeof AggregateError>"u"?te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?te:ArrayBuffer,"%ArrayIteratorPrototype%":dr&&Pe?Pe([][Symbol.iterator]()):te,"%AsyncFromSyncIteratorPrototype%":te,"%AsyncFunction%":Cr,"%AsyncGenerator%":Cr,"%AsyncGeneratorFunction%":Cr,"%AsyncIteratorPrototype%":Cr,"%Atomics%":typeof Atomics>"u"?te:Atomics,"%BigInt%":typeof BigInt>"u"?te:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?te:Float32Array,"%Float64Array%":typeof Float64Array>"u"?te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?te:FinalizationRegistry,"%Function%":Ef,"%GeneratorFunction%":Cr,"%Int8Array%":typeof Int8Array>"u"?te:Int8Array,"%Int16Array%":typeof Int16Array>"u"?te:Int16Array,"%Int32Array%":typeof Int32Array>"u"?te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dr&&Pe?Pe(Pe([][Symbol.iterator]())):te,"%JSON%":typeof JSON=="object"?JSON:te,"%Map%":typeof Map>"u"?te:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dr||!Pe?te:Pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?te:Promise,"%Proxy%":typeof Proxy>"u"?te:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?te:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dr||!Pe?te:Pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dr&&Pe?Pe(""[Symbol.iterator]()):te,"%Symbol%":dr?Symbol:te,"%SyntaxError%":Jr,"%ThrowTypeError%":hy,"%TypedArray%":uy,"%TypeError%":Hr,"%Uint8Array%":typeof Uint8Array>"u"?te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?te:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?te:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?te:WeakMap,"%WeakRef%":typeof WeakRef>"u"?te:WeakRef,"%WeakSet%":typeof WeakSet>"u"?te:WeakSet};if(Pe)try{null.error}catch(r){var dy=Pe(Pe(r));Ki["%Error.prototype%"]=dy}var fy=function r(e){var t;if(e==="%AsyncFunction%")t=ga("async function () {}");else if(e==="%GeneratorFunction%")t=ga("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ga("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&Pe&&(t=Pe(s.prototype))}return Ki[e]=t,t},iu={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},rn=Gh,xo=ly,py=rn.call(Function.call,Array.prototype.concat),gy=rn.call(Function.apply,Array.prototype.splice),ru=rn.call(Function.call,String.prototype.replace),bo=rn.call(Function.call,String.prototype.slice),_y=rn.call(Function.call,RegExp.prototype.exec),yy=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vy=/\\(\\)?/g,xy=function(e){var t=bo(e,0,1),i=bo(e,-1);if(t==="%"&&i!=="%")throw new Jr("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Jr("invalid intrinsic syntax, expected opening `%`");var s=[];return ru(e,yy,function(n,o,a,h){s[s.length]=a?ru(h,vy,"$1"):o||n}),s},by=function(e,t){var i=e,s;if(xo(iu,i)&&(s=iu[i],i="%"+s[0]+"%"),xo(Ki,i)){var n=Ki[i];if(n===Cr&&(n=fy(i)),typeof n>"u"&&!t)throw new Hr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Jr("intrinsic "+e+" does not exist!")},or=function(e,t){if(typeof e!="string"||e.length===0)throw new Hr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Hr('"allowMissing" argument must be a boolean');if(_y(/^%?[^%]*%?$/,e)===null)throw new Jr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=xy(e),s=i.length>0?i[0]:"",n=by("%"+s+"%",t),o=n.name,a=n.value,h=!1,u=n.alias;u&&(s=u[0],gy(i,py([0,1],u)));for(var d=1,l=!0;d<i.length;d+=1){var c=i[d],f=bo(c,0,1),p=bo(c,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Jr("property names with quotes must have matching quotes");if((c==="constructor"||!l)&&(h=!0),s+="."+c,o="%"+s+"%",xo(Ki,o))a=Ki[o];else if(a!=null){if(!(c in a)){if(!t)throw new Hr("base intrinsic for "+e+" exists, but the property is not available.");return}if(Zi&&d+1>=i.length){var g=Zi(a,c);l=!!g,l&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[c]}else l=xo(a,c),a=a[c];l&&!h&&(Ki[o]=a)}}return a},Cf={exports:{}},wy=or,wl=wy("%Object.defineProperty%",!0),Al=function(){if(wl)try{return wl({},"a",{value:1}),!0}catch{return!1}return!1};Al.hasArrayLengthDefineBug=function(){if(!Al())return null;try{return wl([],"length",{value:1}).length!==1}catch{return!0}};var Mf=Al,Ay=or,to=Ay("%Object.getOwnPropertyDescriptor%",!0);if(to)try{to([],"length")}catch{to=null}var If=to,Ty=Mf(),zh=or,Ns=Ty&&zh("%Object.defineProperty%",!0);if(Ns)try{Ns({},"a",{value:1})}catch{Ns=!1}var Sy=zh("%SyntaxError%"),fr=zh("%TypeError%"),su=If,Ey=function(e,t,i){if(!e||typeof e!="object"&&typeof e!="function")throw new fr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new fr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new fr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new fr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new fr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new fr("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,h=!!su&&su(e,t);if(Ns)Ns(e,t,{configurable:o===null&&h?h.configurable:!o,enumerable:s===null&&h?h.enumerable:!s,value:i,writable:n===null&&h?h.writable:!n});else if(a||!s&&!n&&!o)e[t]=i;else throw new Sy("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Pf=or,nu=Ey,Cy=Mf(),ou=If,au=Pf("%TypeError%"),My=Pf("%Math.floor%"),Iy=function(e,t){if(typeof e!="function")throw new au("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||My(t)!==t)throw new au("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,n=!0;if("length"in e&&ou){var o=ou(e,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(n=!1)}return(s||n||!i)&&(Cy?nu(e,"length",t,!0,!0):nu(e,"length",t)),e};(function(r){var e=Gh,t=or,i=Iy,s=t("%TypeError%"),n=t("%Function.prototype.apply%"),o=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(o,n),h=t("%Object.defineProperty%",!0),u=t("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}r.exports=function(c){if(typeof c!="function")throw new s("a function is required");var f=a(e,o,arguments);return i(f,1+u(0,c.length-(arguments.length-1)),!0)};var d=function(){return a(e,n,arguments)};h?h(r.exports,"apply",{value:d}):r.exports.apply=d})(Cf);var Py=Cf.exports,Rf=or,Df=Py,Ry=Df(Rf("String.prototype.indexOf")),Dy=function(e,t){var i=Rf(e,!!t);return typeof i=="function"&&Ry(e,".prototype.")>-1?Df(i):i};const By={},Fy=Object.freeze(Object.defineProperty({__proto__:null,default:By},Symbol.toStringTag,{value:"Module"})),Ly=w_(Fy);var Hh=typeof Map=="function"&&Map.prototype,ya=Object.getOwnPropertyDescriptor&&Hh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,wo=Hh&&ya&&typeof ya.get=="function"?ya.get:null,lu=Hh&&Map.prototype.forEach,Vh=typeof Set=="function"&&Set.prototype,va=Object.getOwnPropertyDescriptor&&Vh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ao=Vh&&va&&typeof va.get=="function"?va.get:null,hu=Vh&&Set.prototype.forEach,Oy=typeof WeakMap=="function"&&WeakMap.prototype,Us=Oy?WeakMap.prototype.has:null,ky=typeof WeakSet=="function"&&WeakSet.prototype,Gs=ky?WeakSet.prototype.has:null,Ny=typeof WeakRef=="function"&&WeakRef.prototype,cu=Ny?WeakRef.prototype.deref:null,Uy=Boolean.prototype.valueOf,Gy=Object.prototype.toString,zy=Function.prototype.toString,Hy=String.prototype.match,Wh=String.prototype.slice,yi=String.prototype.replace,Vy=String.prototype.toUpperCase,uu=String.prototype.toLowerCase,Bf=RegExp.prototype.test,du=Array.prototype.concat,Dt=Array.prototype.join,Wy=Array.prototype.slice,fu=Math.floor,Tl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,xa=Object.getOwnPropertySymbols,Sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,es=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ge=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===es||!0)?Symbol.toStringTag:null,Ff=Object.prototype.propertyIsEnumerable,pu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function mu(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Bf.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-fu(-r):fu(r);if(i!==r){var s=String(i),n=Wh.call(e,s.length+1);return yi.call(s,t,"$&_")+"."+yi.call(yi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return yi.call(e,t,"$&_")}var El=Ly,gu=El.custom,_u=Of(gu)?gu:null,$y=function r(e,t,i,s){var n=t||{};if(ui(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ui(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=ui(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ui(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ui(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Nf(e,n);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var h=String(e);return a?mu(e,h):h}if(typeof e=="bigint"){var u=String(e)+"n";return a?mu(e,u):u}var d=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=d&&d>0&&typeof e=="object")return Cl(e)?"[Array]":"[Object]";var l=hv(n,i);if(typeof s>"u")s=[];else if(kf(s,e)>=0)return"[Circular]";function c(A,I,D){if(I&&(s=Wy.call(s),s.push(I)),D){var B={depth:n.depth};return ui(n,"quoteStyle")&&(B.quoteStyle=n.quoteStyle),r(A,B,i+1,s)}return r(A,n,i+1,s)}if(typeof e=="function"&&!yu(e)){var f=ev(e),p=yn(e,c);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Dt.call(p,", ")+" }":"")}if(Of(e)){var g=es?yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Sl.call(e);return typeof e=="object"&&!es?ms(g):g}if(ov(e)){for(var m="<"+uu.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)m+=" "+_[v].name+"="+Lf(Xy(_[v].value),"double",n);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+uu.call(String(e.nodeName))+">",m}if(Cl(e)){if(e.length===0)return"[]";var x=yn(e,c);return l&&!lv(x)?"["+Ml(x,l)+"]":"[ "+Dt.call(x,", ")+" ]"}if(Yy(e)){var b=yn(e,c);return!("cause"in Error.prototype)&&"cause"in e&&!Ff.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(du.call("[cause]: "+c(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(b,", ")+" }"}if(typeof e=="object"&&o){if(_u&&typeof e[_u]=="function"&&El)return El(e,{depth:d-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(tv(e)){var w=[];return lu&&lu.call(e,function(A,I){w.push(c(I,e,!0)+" => "+c(A,e))}),vu("Map",wo.call(e),w,l)}if(sv(e)){var C=[];return hu&&hu.call(e,function(A){C.push(c(A,e))}),vu("Set",Ao.call(e),C,l)}if(iv(e))return ba("WeakMap");if(nv(e))return ba("WeakSet");if(rv(e))return ba("WeakRef");if(Zy(e))return ms(c(Number(e)));if(Qy(e))return ms(c(Tl.call(e)));if(Ky(e))return ms(Uy.call(e));if(qy(e))return ms(c(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Yt)return"{ [object globalThis] }";if(!jy(e)&&!yu(e)){var S=yn(e,c),T=pu?pu(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",P=!T&&Ge&&Object(e)===e&&Ge in e?Wh.call(Ci(e),8,-1):M?"Object":"",R=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",E=R+(P||M?"["+Dt.call(du.call([],P||[],M||[]),": ")+"] ":"");return S.length===0?E+"{}":l?E+"{"+Ml(S,l)+"}":E+"{ "+Dt.call(S,", ")+" }"}return String(e)};function Lf(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function Xy(r){return yi.call(String(r),/"/g,""")}function Cl(r){return Ci(r)==="[object Array]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function jy(r){return Ci(r)==="[object Date]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function yu(r){return Ci(r)==="[object RegExp]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Yy(r){return Ci(r)==="[object Error]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function qy(r){return Ci(r)==="[object String]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Zy(r){return Ci(r)==="[object Number]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Ky(r){return Ci(r)==="[object Boolean]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Of(r){if(es)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Sl)return!1;try{return Sl.call(r),!0}catch{}return!1}function Qy(r){if(!r||typeof r!="object"||!Tl)return!1;try{return Tl.call(r),!0}catch{}return!1}var Jy=Object.prototype.hasOwnProperty||function(r){return r in this};function ui(r,e){return Jy.call(r,e)}function Ci(r){return Gy.call(r)}function ev(r){if(r.name)return r.name;var e=Hy.call(zy.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function kf(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function tv(r){if(!wo||!r||typeof r!="object")return!1;try{wo.call(r);try{Ao.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function iv(r){if(!Us||!r||typeof r!="object")return!1;try{Us.call(r,Us);try{Gs.call(r,Gs)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function rv(r){if(!cu||!r||typeof r!="object")return!1;try{return cu.call(r),!0}catch{}return!1}function sv(r){if(!Ao||!r||typeof r!="object")return!1;try{Ao.call(r);try{wo.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function nv(r){if(!Gs||!r||typeof r!="object")return!1;try{Gs.call(r,Gs);try{Us.call(r,Us)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function ov(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Nf(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return Nf(Wh.call(r,0,e.maxStringLength),e)+i}var s=yi.call(yi.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,av);return Lf(s,"single",e)}function av(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Vy.call(e.toString(16))}function ms(r){return"Object("+r+")"}function ba(r){return r+" { ? }"}function vu(r,e,t,i){var s=i?Ml(t,i):Dt.call(t,", ");return r+" ("+e+") {"+s+"}"}function lv(r){for(var e=0;e<r.length;e++)if(kf(r[e],`
|
|
3689
|
-
`)>=0)return!1;return!0}function
|
|
3687
|
+
${t.name}`)}break}}}}else n.texture_lod=0}};qe=new WeakMap,Xt=new WeakMap,Ho=new WeakMap,_i=new WeakMap,Zr=new WeakMap,Vo=new WeakMap,jt=new WeakMap,N(ce,"debugDrawLine"),N(ce,"corner0",new y.Vector3),N(ce,"corner1",new y.Vector3),N(ce,"corner2",new y.Vector3),N(ce,"corner3",new y.Vector3),N(ce,"_tempPtInside",new y.Vector3),N(ce,"skinnedMeshBoundsFrameOffsetCounter",0),N(ce,"$skinnedMeshBoundsOffset",Symbol("gltf-progressive-skinnedMeshBoundsOffset"));let Jr=ce;class d_{constructor(){N(this,"frames",0);N(this,"lastLodLevel_Mesh",-1);N(this,"lastLodLevel_Texture",-1);N(this,"lastScreenCoverage",0);N(this,"lastScreenspaceVolume",new y.Vector3);N(this,"lastCentrality",0)}}const kc=Symbol("NEEDLE_mesh_lod"),mn=Symbol("NEEDLE_texture_lod");let ms=null;function gf(){const r=f_();r&&(r.mapURLs(function(e){return Nc(),e}),Nc(),ms==null||ms.disconnect(),ms=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(i=>{i instanceof HTMLElement&&i.tagName.toLowerCase()==="model-viewer"&&_f(i)})})}),ms.observe(document,{childList:!0,subtree:!0}))}function f_(){if(typeof customElements>"u")return null;const r=customElements.get("model-viewer");return r||(customElements.whenDefined("model-viewer").then(()=>{console.debug("[gltf-progressive] model-viewer defined"),gf()}),null)}function Nc(){if(typeof document>"u")return;document.querySelectorAll("model-viewer").forEach(e=>{_f(e)})}const Uc=new WeakSet;let p_=0;function _f(r){if(!r||Uc.has(r))return null;Uc.add(r),console.debug("[gltf-progressive] found new model-viewer..."+ ++p_+`
|
|
3688
|
+
`,r.getAttribute("src"));let e=null,t=null,i=null;for(let s=r;s!=null;s=Object.getPrototypeOf(s)){const n=Object.getOwnPropertySymbols(s),o=n.find(u=>u.toString()=="Symbol(renderer)"),a=n.find(u=>u.toString()=="Symbol(scene)"),h=n.find(u=>u.toString()=="Symbol(needsRender)");!e&&o!=null&&(e=r[o].threeRenderer),!t&&a!=null&&(t=r[a]),!i&&h!=null&&(i=r[h])}if(e&&t){let n=function(){if(i){let o=0,a=setInterval(()=>{if(o++>5){clearInterval(a);return}i==null||i.call(r)},300)}};console.debug("[gltf-progressive] setup model-viewer");const s=Jr.get(e,{engine:"model-viewer"});return Jr.addPlugin(new m_),s.enable(),s.addEventListener("changed",()=>{i==null||i.call(r)}),r.addEventListener("model-visibility",o=>{o.detail.visible&&(i==null||i.call(r))}),r.addEventListener("load",()=>{n()}),()=>{s.disable()}}return null}class m_{constructor(){N(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(e,t,i,s){this.tryParseMeshLOD(t,s),this.tryParseTextureLOD(t,s)}getUrl(e){if(!e)return null;let t=e.getAttribute("src");return t||(t=e.src),t||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",e),this._didWarnAboutMissingUrl=!0),t}tryGetCurrentGLTF(e){return e._currentGLTF}tryGetCurrentModelViewer(e){return e.element}tryParseTextureLOD(e,t){if(t[mn]==!0)return;t[mn]=!0;const i=this.tryGetCurrentGLTF(e),s=this.tryGetCurrentModelViewer(e),n=this.getUrl(s);if(n&&i&&t.material){let a=function(h){var d,l,c;if(h[mn]==!0)return;h[mn]=!0,h.userData&&(h.userData.LOD=-1);const u=Object.keys(h);for(let f=0;f<u.length;f++){const p=u[f],g=h[p];if((g==null?void 0:g.isTexture)===!0){const m=(l=(d=g.userData)==null?void 0:d.associations)==null?void 0:l.textures;if(m==null)continue;const _=i.parser.json.textures[m];if(!_){console.warn("Texture data not found for texture index "+m);continue}if((c=_==null?void 0:_.extensions)!=null&&c[Wt]){const v=_.extensions[Wt];v&&n&&Bt.registerTexture(n,g,v.lods.length,m,v)}}}};const o=t.material;if(Array.isArray(o))for(const h of o)a(h);else a(o)}}tryParseMeshLOD(e,t){var o,a;if(t[kc]==!0)return;t[kc]=!0;const i=this.tryGetCurrentModelViewer(e),s=this.getUrl(i);if(!s)return;const n=(a=(o=t.userData)==null?void 0:o.gltfExtensions)==null?void 0:a[Wt];if(n&&s){const h=t.uuid;Bt.registerMesh(s,h,t,0,n.lods.length,n)}}}function yf(...r){let e,t,i,s;switch(r.length){case 2:[i,t]=r,s={};break;case 3:[i,t,s]=r;break;case 4:[e,t,i,s]=r;break;default:throw new Error("Invalid arguments")}Fh(t),uf(i),ff(i,{progressive:!0,...s==null?void 0:s.hints}),i.register(o=>new Bt(o));const n=Jr.get(t);return(s==null?void 0:s.enableLODsManager)!==!1&&n.enable(),n}gf();if(!e_){const r={gltfProgressive:{useNeedleProgressive:yf,LODsManager:Jr,configureLoader:ff,getRaycastMesh:tn,useRaycastMeshes:i_}};if(!globalThis.Needle)globalThis.Needle=r;else for(const e in r)globalThis.Needle[e]=r[e]}var Gr=Object.freeze({Linear:Object.freeze({None:function(r){return r},In:function(r){return r},Out:function(r){return r},InOut:function(r){return r}}),Quadratic:Object.freeze({In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}}),Cubic:Object.freeze({In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}}),Quartic:Object.freeze({In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}}),Quintic:Object.freeze({In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}}),Sinusoidal:Object.freeze({In:function(r){return 1-Math.sin((1-r)*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.sin(Math.PI*(.5-r)))}}),Exponential:Object.freeze({In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}}),Circular:Object.freeze({In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}}),Elastic:Object.freeze({In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(r){var e=1.70158;return r===1?1:r*r*((e+1)*r-e)},Out:function(r){var e=1.70158;return r===0?0:--r*r*((e+1)*r+e)+1},InOut:function(r){var e=2.5949095;return(r*=2)<1?.5*(r*r*((e+1)*r-e)):.5*((r-=2)*r*((e+1)*r+e)+2)}}),Bounce:Object.freeze({In:function(r){return 1-Gr.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?Gr.Bounce.In(r*2)*.5:Gr.Bounce.Out(r*2-1)*.5+.5}}),generatePow:function(r){return r===void 0&&(r=4),r=r<Number.EPSILON?Number.EPSILON:r,r=r>1e4?1e4:r,{In:function(e){return Math.pow(e,r)},Out:function(e){return 1-Math.pow(1-e,r)},InOut:function(e){return e<.5?Math.pow(e*2,r)/2:(1-Math.pow(2-e*2,r))/2+.5}}}}),Or=function(){return performance.now()},vf=function(){function r(){this._tweens={},this._tweensAddedDuringUpdate={}}return r.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},r.prototype.removeAll=function(){this._tweens={}},r.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},r.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},r.prototype.update=function(e,t){e===void 0&&(e=Or()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var n=this._tweens[i[s]],o=!t;n&&n.update(e,o)===!1&&!t&&delete this._tweens[i[s]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},r}(),ji={Linear:function(r,e){var t=r.length-1,i=t*e,s=Math.floor(i),n=ji.Utils.Linear;return e<0?n(r[0],r[1],i):e>1?n(r[t],r[t-1],t-i):n(r[s],r[s+1>t?t:s+1],i-s)},Bezier:function(r,e){for(var t=0,i=r.length-1,s=Math.pow,n=ji.Utils.Bernstein,o=0;o<=i;o++)t+=s(1-e,i-o)*s(e,o)*r[o]*n(i,o);return t},CatmullRom:function(r,e){var t=r.length-1,i=t*e,s=Math.floor(i),n=ji.Utils.CatmullRom;return r[0]===r[t]?(e<0&&(s=Math.floor(i=t*(1+e))),n(r[(s-1+t)%t],r[s],r[(s+1)%t],r[(s+2)%t],i-s)):e<0?r[0]-(n(r[0],r[0],r[1],r[1],-i)-r[0]):e>1?r[t]-(n(r[t],r[t],r[t-1],r[t-1],i-t)-r[t]):n(r[s?s-1:0],r[s],r[t<s+1?t:s+1],r[t<s+2?t:s+2],i-s)},Utils:{Linear:function(r,e,t){return(e-r)*t+r},Bernstein:function(r,e){var t=ji.Utils.Factorial;return t(r)/t(e)/t(r-e)},Factorial:function(){var r=[1];return function(e){var t=1;if(r[e])return r[e];for(var i=e;i>1;i--)t*=i;return r[e]=t,t}}(),CatmullRom:function(r,e,t,i,s){var n=(t-r)*.5,o=(i-e)*.5,a=s*s,h=s*a;return(2*e-2*t+n+o)*h+(-3*e+3*t-2*n-o)*a+n*s+e}}},Oh=function(){function r(){}return r.nextId=function(){return r._nextId++},r._nextId=0,r}(),gl=new vf,yo=function(){function r(e,t){t===void 0&&(t=gl),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Gr.Linear.None,this._interpolationFunction=ji.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Oh.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return r.prototype.getId=function(){return this._id},r.prototype.isPlaying=function(){return this._isPlaying},r.prototype.isPaused=function(){return this._isPaused},r.prototype.getDuration=function(){return this._duration},r.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},r.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},r.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},r.prototype.start=function(e,t){if(e===void 0&&(e=Or()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var n in this._valuesEnd)s[n]=this._valuesEnd[n];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},r.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},r.prototype._setupProperties=function(e,t,i,s,n){for(var o in i){var a=e[o],h=Array.isArray(a),u=h?"array":typeof a,d=!h&&Array.isArray(i[o]);if(!(u==="undefined"||u==="function")){if(d){var l=i[o];if(l.length===0)continue;for(var c=[a],f=0,p=l.length;f<p;f+=1){var g=this._handleRelativeValue(a,l[f]);if(isNaN(g)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}c.push(g)}d&&(i[o]=c)}if((u==="object"||h)&&a&&!d){t[o]=h?[]:{};var m=a;for(var _ in m)t[o][_]=m[_];s[o]=h?[]:{};var l=i[o];if(!this._isDynamic){var v={};for(var _ in l)v[_]=l[_];i[o]=l=v}this._setupProperties(m,t[o],l,s[o],n)}else(typeof t[o]>"u"||n)&&(t[o]=a),h||(t[o]*=1),d?s[o]=i[o].slice().reverse():s[o]=t[o]||0}}},r.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},r.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},r.prototype.pause=function(e){return e===void 0&&(e=Or()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},r.prototype.resume=function(e){return e===void 0&&(e=Or()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},r.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},r.prototype.group=function(e){return e===void 0&&(e=gl),this._group=e,this},r.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},r.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},r.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},r.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},r.prototype.easing=function(e){return e===void 0&&(e=Gr.Linear.None),this._easingFunction=e,this},r.prototype.interpolation=function(e){return e===void 0&&(e=ji.Linear),this._interpolationFunction=e,this},r.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},r.prototype.onStart=function(e){return this._onStartCallback=e,this},r.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},r.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},r.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},r.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},r.prototype.onStop=function(e){return this._onStopCallback=e,this},r.prototype.update=function(e,t){var i=this,s;if(e===void 0&&(e=Or()),t===void 0&&(t=!0),this._isPaused)return!0;var n,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>o)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,h=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),u=this._duration+this._repeat*h,d=function(){if(i._duration===0||a>u)return 1;var m=Math.trunc(a/h),_=a-m*h,v=Math.min(_/i._duration,1);return v===0&&a===i._duration?1:v},l=d(),c=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/h)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(n in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[n]=="string"&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=h*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},r.prototype._updateProperties=function(e,t,i,s){for(var n in i)if(t[n]!==void 0){var o=t[n]||0,a=i[n],h=Array.isArray(e[n]),u=Array.isArray(a),d=!h&&u;d?e[n]=this._interpolationFunction(a,s):typeof a=="object"&&a?this._updateProperties(e[n],o,a,s):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[n]=o+(a-o)*s))}},r.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},r.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},r}(),g_="23.1.3",__=Oh.nextId,Nt=gl,y_=Nt.getAll.bind(Nt),v_=Nt.removeAll.bind(Nt),x_=Nt.add.bind(Nt),b_=Nt.remove.bind(Nt),w_=Nt.update.bind(Nt),Pt={Easing:Gr,Group:vf,Interpolation:ji,now:Or,Sequence:Oh,nextId:__,Tween:yo,VERSION:g_,getAll:y_,removeAll:v_,add:x_,remove:b_,update:w_},Yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function A_(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),t}var xf={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function n(h,u,d,l,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,l||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,l;if(this._eventsCount===0)return u;for(l in d=this._events)e.call(d,l)&&u.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=t?t+u:u,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var c=0,f=l.length,p=new Array(f);c<f;c++)p[c]=l[c].fn;return p},a.prototype.listenerCount=function(u){var d=t?t+u:u,l=this._events[d];return l?l.fn?1:l.length:0},a.prototype.emit=function(u,d,l,c,f,p){var g=t?t+u:u;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,v,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,d),!0;case 3:return m.fn.call(m.context,d,l),!0;case 4:return m.fn.call(m.context,d,l,c),!0;case 5:return m.fn.call(m.context,d,l,c,f),!0;case 6:return m.fn.call(m.context,d,l,c,f,p),!0}for(x=1,v=new Array(_-1);x<_;x++)v[x-1]=arguments[x];m.fn.apply(m.context,v)}else{var b=m.length,w;for(x=0;x<b;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,d);break;case 3:m[x].fn.call(m[x].context,d,l);break;case 4:m[x].fn.call(m[x].context,d,l,c);break;default:if(!v)for(w=1,v=new Array(_-1);w<_;w++)v[w-1]=arguments[w];m[x].fn.apply(m[x].context,v)}}return!0},a.prototype.on=function(u,d,l){return n(this,u,d,l,!1)},a.prototype.once=function(u,d,l){return n(this,u,d,l,!0)},a.prototype.removeListener=function(u,d,l,c){var f=t?t+u:u;if(!this._events[f])return this;if(!d)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!l||p.context===l)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==d||c&&!p[g].once||l&&p[g].context!==l)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&o(this,d)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(xf);var T_=xf.exports;const as=kh(T_);var Ns=function(){var r=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(l){l.preventDefault(),i(++r%e.children.length)},!1);function t(l){return e.appendChild(l.dom),l}function i(l){for(var c=0;c<e.children.length;c++)e.children[c].style.display=c===l?"block":"none";r=l}var s=(performance||Date).now(),n=s,o=0,a=t(new Ns.Panel("FPS","#0ff","#002")),h=t(new Ns.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var u=t(new Ns.Panel("MB","#f08","#201"));i(0);var d=0;return{REVISION:16,dom:e,fps:function(){return d&&parseInt(d.toFixed(0))},addPanel:t,showPanel:i,begin:function(){s=(performance||Date).now()},end:function(){o++;var l=(performance||Date).now();if(h.update(l-s,200),l>=n+1e3&&(d=o*1e3/(l-n),a.update(d,100),n=l,o=0,u)){var c=performance.memory;u.update(c.usedJSHeapSize/1048576,c.jsHeapSizeLimit/1048576)}return l},update:function(){s=this.end()},domElement:e,setMode:i}};Ns.Panel=function(r,e,t){var i=1/0,s=0,n=Math.round,o=n(window.devicePixelRatio||1),a=80*o,h=48*o,u=3*o,d=2*o,l=3*o,c=15*o,f=74*o,p=30*o,g=document.createElement("canvas");g.width=a,g.height=h,g.style.cssText="width:80px;height:48px";var m=g.getContext("2d");return m.font="bold "+9*o+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=t,m.fillRect(0,0,a,h),m.fillStyle=e,m.fillText(r,u,d),m.fillRect(l,c,f,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(l,c,f,p),{dom:g,update:function(_,v){i=Math.min(i,_),s=Math.max(s,_),m.fillStyle=t,m.globalAlpha=1,m.fillRect(0,0,a,c),m.fillStyle=e,m.fillText(n(_)+" "+r+" ("+n(i)+"-"+n(s)+")",u,d),m.drawImage(g,l+o,c,f-o,p,l,c,f-o,p),m.fillRect(l+f-o,c,o,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(l+f-o,c,o,n((1-_/v)*p))}}};var nr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(nr||{}),bf=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(bf||{}),_l=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(_l||{}),Y=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Y||{}),Ft=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ft||{}),O=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(O||{}),zr=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(zr||{}),j=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(j||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),qt=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(qt||{}),wi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(wi||{}),Ut=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ut||{}),je=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(je||{}),Rt=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Rt||{}),Nh=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Nh||{}),et=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(et||{}),Ce=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(Ce||{}),Te=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Te||{}),Ot=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ot||{});const S_={createCanvas:(r,e)=>{const t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},V={ADAPTER:S_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var fa=/iPhone/i,Gc=/iPod/i,zc=/iPad/i,Hc=/\biOS-universal(?:.+)Mac\b/i,pa=/\bAndroid(?:.+)Mobile\b/i,Vc=/Android/i,ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,gn=/Silk/i,zt=/Windows Phone/i,Wc=/\bWindows(?:.+)ARM\b/i,$c=/BlackBerry/i,Xc=/BB10/i,jc=/Opera Mini/i,Yc=/\b(CriOS|Chrome)(?:.+)Mobile/i,qc=/Mobile(?:.+)Firefox\b/i,Zc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function E_(r){return function(e){return e.test(r)}}function Kc(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=E_(t),n={apple:{phone:s(fa)&&!s(zt),ipod:s(Gc),tablet:!s(fa)&&(s(zc)||Zc(e))&&!s(zt),universal:s(Hc),device:(s(fa)||s(Gc)||s(zc)||s(Hc)||Zc(e))&&!s(zt)},amazon:{phone:s(ur),tablet:!s(ur)&&s(gn),device:s(ur)||s(gn)},android:{phone:!s(zt)&&s(ur)||!s(zt)&&s(pa),tablet:!s(zt)&&!s(ur)&&!s(pa)&&(s(gn)||s(Vc)),device:!s(zt)&&(s(ur)||s(gn)||s(pa)||s(Vc))||s(/\bokhttp\b/i)},windows:{phone:s(zt),tablet:s(Wc),device:s(zt)||s(Wc)},other:{blackberry:s($c),blackberry10:s(Xc),opera:s(jc),firefox:s(qc),chrome:s(Yc),device:s($c)||s(Xc)||s(jc)||s(qc)||s(Yc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const C_=Kc.default??Kc,Zt=C_(globalThis.navigator);V.RETINA_PREFIX=/@([0-9\.]+)x/;V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var wf={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(h,u,d){this.fn=h,this.context=u,this.once=d||!1}function n(h,u,d,l,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,l||h,c),p=t?t+u:u;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new i:delete h._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,l;if(this._eventsCount===0)return u;for(l in d=this._events)e.call(d,l)&&u.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=t?t+u:u,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var c=0,f=l.length,p=new Array(f);c<f;c++)p[c]=l[c].fn;return p},a.prototype.listenerCount=function(u){var d=t?t+u:u,l=this._events[d];return l?l.fn?1:l.length:0},a.prototype.emit=function(u,d,l,c,f,p){var g=t?t+u:u;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,v,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,d),!0;case 3:return m.fn.call(m.context,d,l),!0;case 4:return m.fn.call(m.context,d,l,c),!0;case 5:return m.fn.call(m.context,d,l,c,f),!0;case 6:return m.fn.call(m.context,d,l,c,f,p),!0}for(x=1,v=new Array(_-1);x<_;x++)v[x-1]=arguments[x];m.fn.apply(m.context,v)}else{var b=m.length,w;for(x=0;x<b;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,d);break;case 3:m[x].fn.call(m[x].context,d,l);break;case 4:m[x].fn.call(m[x].context,d,l,c);break;default:if(!v)for(w=1,v=new Array(_-1);w<_;w++)v[w-1]=arguments[w];m[x].fn.apply(m[x].context,v)}}return!0},a.prototype.on=function(u,d,l){return n(this,u,d,l,!1)},a.prototype.once=function(u,d,l){return n(this,u,d,l,!0)},a.prototype.removeListener=function(u,d,l,c){var f=t?t+u:u;if(!this._events[f])return this;if(!d)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===d&&(!c||p.once)&&(!l||p.context===l)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==d||c&&!p[g].once||l&&p[g].context!==l)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=t?t+u:u,this._events[d]&&o(this,d)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(wf);var M_=wf.exports;const rn=kh(M_);var Uh={exports:{}};Uh.exports=Wo;Uh.exports.default=Wo;function Wo(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,n=Af(r,0,s,t,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,u,d,l,c,f;if(i&&(n=B_(r,e,n,t)),r.length>80*t){a=u=r[0],h=d=r[1];for(var p=t;p<s;p+=t)l=r[p],c=r[p+1],l<a&&(a=l),c<h&&(h=c),l>u&&(u=l),c>d&&(d=c);f=Math.max(u-a,d-h),f=f!==0?32767/f:0}return Ys(n,o,t,a,h,f,0),o}function Af(r,e,t,i,s){var n,o;if(s===xl(r,e,t,i)>0)for(n=e;n<t;n+=i)o=Qc(n,r[n],r[n+1],o);else for(n=t-i;n>=e;n-=i)o=Qc(n,r[n],r[n+1],o);return o&&$o(o,o.next)&&(Zs(o),o=o.next),o}function er(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&($o(t,t.next)||ge(t.prev,t,t.next)===0)){if(Zs(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ys(r,e,t,i,s,n,o){if(r){!o&&n&&N_(r,i,s,n);for(var a=r,h,u;r.prev!==r.next;){if(h=r.prev,u=r.next,n?P_(r,i,s,n):I_(r)){e.push(h.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),Zs(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=R_(er(r),e,t),Ys(r,e,t,i,s,n,2)):o===2&&D_(r,e,t,i,s,n):Ys(er(r),e,t,i,s,n,1);break}}}}function I_(r){var e=r.prev,t=r,i=r.next;if(ge(e,t,i)>=0)return!1;for(var s=e.x,n=t.x,o=i.x,a=e.y,h=t.y,u=i.y,d=s<n?s<o?s:o:n<o?n:o,l=a<h?a<u?a:u:h<u?h:u,c=s>n?s>o?s:o:n>o?n:o,f=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=d&&p.x<=c&&p.y>=l&&p.y<=f&&kr(s,a,n,h,o,u,p.x,p.y)&&ge(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function P_(r,e,t,i){var s=r.prev,n=r,o=r.next;if(ge(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,u=o.x,d=s.y,l=n.y,c=o.y,f=a<h?a<u?a:u:h<u?h:u,p=d<l?d<c?d:c:l<c?l:c,g=a>h?a>u?a:u:h>u?h:u,m=d>l?d>c?d:c:l>c?l:c,_=yl(f,p,e,t,i),v=yl(g,m,e,t,i),x=r.prevZ,b=r.nextZ;x&&x.z>=_&&b&&b.z<=v;){if(x.x>=f&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&kr(a,d,h,l,u,c,x.x,x.y)&&ge(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&kr(a,d,h,l,u,c,b.x,b.y)&&ge(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&kr(a,d,h,l,u,c,x.x,x.y)&&ge(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&kr(a,d,h,l,u,c,b.x,b.y)&&ge(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function R_(r,e,t){var i=r;do{var s=i.prev,n=i.next.next;!$o(s,n)&&Tf(s,i,i.next,n)&&qs(s,n)&&qs(n,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(n.i/t|0),Zs(i),Zs(i.next),i=r=n),i=i.next}while(i!==r);return er(i)}function D_(r,e,t,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&z_(o,a)){var h=Sf(o,a);o=er(o,o.next),h=er(h,h.next),Ys(o,e,t,i,s,n,0),Ys(h,e,t,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function B_(r,e,t,i){var s=[],n,o,a,h,u;for(n=0,o=e.length;n<o;n++)a=e[n]*i,h=n<o-1?e[n+1]*i:r.length,u=Af(r,a,h,i,!1),u===u.next&&(u.steiner=!0),s.push(G_(u));for(s.sort(F_),n=0;n<s.length;n++)t=L_(s[n],t);return t}function F_(r,e){return r.x-e.x}function L_(r,e){var t=O_(r,e);if(!t)return e;var i=Sf(t,r);return er(i,i.next),er(t,t.next)}function O_(r,e){var t=e,i=r.x,s=r.y,n=-1/0,o;do{if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>n&&(n=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var h=o,u=o.x,d=o.y,l=1/0,c;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&kr(s<d?i:n,s,u,d,s<d?n:i,s,t.x,t.y)&&(c=Math.abs(s-t.y)/(i-t.x),qs(t,r)&&(c<l||c===l&&(t.x>o.x||t.x===o.x&&k_(o,t)))&&(o=t,l=c)),t=t.next;while(t!==h);return o}function k_(r,e){return ge(r.prev,r,e.prev)<0&&ge(e.next,r,r.next)<0}function N_(r,e,t,i){var s=r;do s.z===0&&(s.z=yl(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,U_(s)}function U_(r){var e,t,i,s,n,o,a,h,u=1;do{for(t=r,r=null,n=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(h=u;a>0||h>0&&i;)a!==0&&(h===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;t=i}n.nextZ=null,u*=2}while(o>1);return r}function yl(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function G_(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function kr(r,e,t,i,s,n,o,a){return(s-o)*(e-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(n-a)>=(s-o)*(i-a)}function z_(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!H_(r,e)&&(qs(r,e)&&qs(e,r)&&V_(r,e)&&(ge(r.prev,r,e.prev)||ge(r,e.prev,e))||$o(r,e)&&ge(r.prev,r,r.next)>0&&ge(e.prev,e,e.next)>0)}function ge(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function $o(r,e){return r.x===e.x&&r.y===e.y}function Tf(r,e,t,i){var s=yn(ge(r,e,t)),n=yn(ge(r,e,i)),o=yn(ge(t,i,r)),a=yn(ge(t,i,e));return!!(s!==n&&o!==a||s===0&&_n(r,t,e)||n===0&&_n(r,i,e)||o===0&&_n(t,r,i)||a===0&&_n(t,e,i))}function _n(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function yn(r){return r>0?1:r<0?-1:0}function H_(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Tf(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function qs(r,e){return ge(r.prev,r,r.next)<0?ge(r,e,r.next)>=0&&ge(r,r.prev,e)>=0:ge(r,e,r.prev)<0||ge(r,r.next,e)<0}function V_(r,e){var t=r,i=!1,s=(r.x+e.x)/2,n=(r.y+e.y)/2;do t.y>n!=t.next.y>n&&t.next.y!==t.y&&s<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function Sf(r,e){var t=new vl(r.i,r.x,r.y),i=new vl(e.i,e.x,e.y),s=r.next,n=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,n.next=i,i.prev=n,i}function Qc(r,e,t,i){var s=new vl(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Zs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function vl(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Wo.deviation=function(r,e,t,i){var s=e&&e.length,n=s?e[0]*t:r.length,o=Math.abs(xl(r,0,n,t));if(s)for(var a=0,h=e.length;a<h;a++){var u=e[a]*t,d=a<h-1?e[a+1]*t:r.length;o-=Math.abs(xl(r,u,d,t))}var l=0;for(a=0;a<i.length;a+=3){var c=i[a]*t,f=i[a+1]*t,p=i[a+2]*t;l+=Math.abs((r[c]-r[p])*(r[f+1]-r[c+1])-(r[c]-r[f])*(r[p+1]-r[c+1]))}return o===0&&l===0?0:Math.abs((l-o)/o)};function xl(r,e,t,i){for(var s=0,n=e,o=t-i;n<t;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}Wo.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<e;o++)t.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,t.holes.push(i))}return t};var W_=Uh.exports;const $_=kh(W_);var vo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */vo.exports;(function(r,e){(function(t){var i=e&&!e.nodeType&&e,s=r&&!r.nodeType&&r,n=typeof Yt=="object"&&Yt;(n.global===n||n.window===n||n.self===n)&&(t=n);var o,a=2147483647,h=36,u=1,d=26,l=38,c=700,f=72,p=128,g="-",m=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-u,w=Math.floor,C=String.fromCharCode,S;function T(L){throw new RangeError(x[L])}function M(L,F){for(var G=L.length,Q=[];G--;)Q[G]=F(L[G]);return Q}function P(L,F){var G=L.split("@"),Q="";G.length>1&&(Q=G[0]+"@",L=G[1]),L=L.replace(v,".");var ee=L.split("."),oe=M(ee,F).join(".");return Q+oe}function R(L){for(var F=[],G=0,Q=L.length,ee,oe;G<Q;)ee=L.charCodeAt(G++),ee>=55296&&ee<=56319&&G<Q?(oe=L.charCodeAt(G++),(oe&64512)==56320?F.push(((ee&1023)<<10)+(oe&1023)+65536):(F.push(ee),G--)):F.push(ee);return F}function E(L){return M(L,function(F){var G="";return F>65535&&(F-=65536,G+=C(F>>>10&1023|55296),F=56320|F&1023),G+=C(F),G}).join("")}function A(L){return L-48<10?L-22:L-65<26?L-65:L-97<26?L-97:h}function I(L,F){return L+22+75*(L<26)-((F!=0)<<5)}function D(L,F,G){var Q=0;for(L=G?w(L/c):L>>1,L+=w(L/F);L>b*d>>1;Q+=h)L=w(L/b);return w(Q+(b+1)*L/(L+l))}function B(L){var F=[],G=L.length,Q,ee=0,oe=p,pe=f,ye,Ae,ae,be,ne,ve,he,Be,Ne;for(ye=L.lastIndexOf(g),ye<0&&(ye=0),Ae=0;Ae<ye;++Ae)L.charCodeAt(Ae)>=128&&T("not-basic"),F.push(L.charCodeAt(Ae));for(ae=ye>0?ye+1:0;ae<G;){for(be=ee,ne=1,ve=h;ae>=G&&T("invalid-input"),he=A(L.charCodeAt(ae++)),(he>=h||he>w((a-ee)/ne))&&T("overflow"),ee+=he*ne,Be=ve<=pe?u:ve>=pe+d?d:ve-pe,!(he<Be);ve+=h)Ne=h-Be,ne>w(a/Ne)&&T("overflow"),ne*=Ne;Q=F.length+1,pe=D(ee-be,Q,be==0),w(ee/Q)>a-oe&&T("overflow"),oe+=w(ee/Q),ee%=Q,F.splice(ee++,0,oe)}return E(F)}function k(L){var F,G,Q,ee,oe,pe,ye,Ae,ae,be,ne,ve=[],he,Be,Ne,Ii;for(L=R(L),he=L.length,F=p,G=0,oe=f,pe=0;pe<he;++pe)ne=L[pe],ne<128&&ve.push(C(ne));for(Q=ee=ve.length,ee&&ve.push(g);Q<he;){for(ye=a,pe=0;pe<he;++pe)ne=L[pe],ne>=F&&ne<ye&&(ye=ne);for(Be=Q+1,ye-F>w((a-G)/Be)&&T("overflow"),G+=(ye-F)*Be,F=ye,pe=0;pe<he;++pe)if(ne=L[pe],ne<F&&++G>a&&T("overflow"),ne==F){for(Ae=G,ae=h;be=ae<=oe?u:ae>=oe+d?d:ae-oe,!(Ae<be);ae+=h)Ii=Ae-be,Ne=h-be,ve.push(C(I(be+Ii%Ne,0))),Ae=w(Ii/Ne);ve.push(C(I(Ae,0))),oe=D(G,Be,Q==ee),G=0,++Q}++G,++F}return ve.join("")}function z(L){return P(L,function(F){return m.test(F)?B(F.slice(4).toLowerCase()):F})}function q(L){return P(L,function(F){return _.test(F)?"xn--"+k(F):F})}if(o={version:"1.4.1",ucs2:{decode:R,encode:E},decode:B,encode:k,toASCII:q,toUnicode:z},i&&s)if(r.exports==i)s.exports=o;else for(S in o)o.hasOwnProperty(S)&&(i[S]=o[S]);else t.punycode=o})(Yt)})(vo,vo.exports);var X_=vo.exports,j_=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Jc=typeof Symbol<"u"&&Symbol,Y_=j_,q_=function(){return typeof Jc!="function"||typeof Symbol!="function"||typeof Jc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Y_()},eu={foo:{}},Z_=Object,K_=function(){return{__proto__:eu}.foo===eu.foo&&!({__proto__:null}instanceof Z_)},Q_="Function.prototype.bind called on incompatible ",J_=Object.prototype.toString,ey=Math.max,ty="[object Function]",tu=function(e,t){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var n=0;n<t.length;n+=1)i[n+e.length]=t[n];return i},iy=function(e,t){for(var i=[],s=t||0,n=0;s<e.length;s+=1,n+=1)i[n]=e[s];return i},ry=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},sy=function(e){var t=this;if(typeof t!="function"||J_.apply(t)!==ty)throw new TypeError(Q_+t);for(var i=iy(arguments,1),s,n=function(){if(this instanceof s){var d=t.apply(this,tu(i,arguments));return Object(d)===d?d:this}return t.apply(e,tu(i,arguments))},o=ey(0,t.length-i.length),a=[],h=0;h<o;h++)a[h]="$"+h;if(s=Function("binder","return function ("+ry(a,",")+"){ return binder.apply(this,arguments); }")(n),t.prototype){var u=function(){};u.prototype=t.prototype,s.prototype=new u,u.prototype=null}return s},ny=sy,Gh=Function.prototype.bind||ny,oy=Function.prototype.call,ay=Object.prototype.hasOwnProperty,ly=Gh,hy=ly.call(oy,ay),te,es=SyntaxError,Ef=Function,Hr=TypeError,ma=function(r){try{return Ef('"use strict"; return ('+r+").constructor;")()}catch{}},Zi=Object.getOwnPropertyDescriptor;if(Zi)try{Zi({},"")}catch{Zi=null}var ga=function(){throw new Hr},cy=Zi?function(){try{return arguments.callee,ga}catch{try{return Zi(arguments,"callee").get}catch{return ga}}}():ga,dr=q_(),uy=K_(),Pe=Object.getPrototypeOf||(uy?function(r){return r.__proto__}:null),Cr={},dy=typeof Uint8Array>"u"||!Pe?te:Pe(Uint8Array),Ki={"%AggregateError%":typeof AggregateError>"u"?te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?te:ArrayBuffer,"%ArrayIteratorPrototype%":dr&&Pe?Pe([][Symbol.iterator]()):te,"%AsyncFromSyncIteratorPrototype%":te,"%AsyncFunction%":Cr,"%AsyncGenerator%":Cr,"%AsyncGeneratorFunction%":Cr,"%AsyncIteratorPrototype%":Cr,"%Atomics%":typeof Atomics>"u"?te:Atomics,"%BigInt%":typeof BigInt>"u"?te:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?te:Float32Array,"%Float64Array%":typeof Float64Array>"u"?te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?te:FinalizationRegistry,"%Function%":Ef,"%GeneratorFunction%":Cr,"%Int8Array%":typeof Int8Array>"u"?te:Int8Array,"%Int16Array%":typeof Int16Array>"u"?te:Int16Array,"%Int32Array%":typeof Int32Array>"u"?te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dr&&Pe?Pe(Pe([][Symbol.iterator]())):te,"%JSON%":typeof JSON=="object"?JSON:te,"%Map%":typeof Map>"u"?te:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dr||!Pe?te:Pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?te:Promise,"%Proxy%":typeof Proxy>"u"?te:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?te:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dr||!Pe?te:Pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dr&&Pe?Pe(""[Symbol.iterator]()):te,"%Symbol%":dr?Symbol:te,"%SyntaxError%":es,"%ThrowTypeError%":cy,"%TypedArray%":dy,"%TypeError%":Hr,"%Uint8Array%":typeof Uint8Array>"u"?te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?te:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?te:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?te:WeakMap,"%WeakRef%":typeof WeakRef>"u"?te:WeakRef,"%WeakSet%":typeof WeakSet>"u"?te:WeakSet};if(Pe)try{null.error}catch(r){var fy=Pe(Pe(r));Ki["%Error.prototype%"]=fy}var py=function r(e){var t;if(e==="%AsyncFunction%")t=ma("async function () {}");else if(e==="%GeneratorFunction%")t=ma("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ma("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&Pe&&(t=Pe(s.prototype))}return Ki[e]=t,t},iu={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},sn=Gh,xo=hy,gy=sn.call(Function.call,Array.prototype.concat),_y=sn.call(Function.apply,Array.prototype.splice),ru=sn.call(Function.call,String.prototype.replace),bo=sn.call(Function.call,String.prototype.slice),yy=sn.call(Function.call,RegExp.prototype.exec),vy=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xy=/\\(\\)?/g,by=function(e){var t=bo(e,0,1),i=bo(e,-1);if(t==="%"&&i!=="%")throw new es("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new es("invalid intrinsic syntax, expected opening `%`");var s=[];return ru(e,vy,function(n,o,a,h){s[s.length]=a?ru(h,xy,"$1"):o||n}),s},wy=function(e,t){var i=e,s;if(xo(iu,i)&&(s=iu[i],i="%"+s[0]+"%"),xo(Ki,i)){var n=Ki[i];if(n===Cr&&(n=py(i)),typeof n>"u"&&!t)throw new Hr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new es("intrinsic "+e+" does not exist!")},or=function(e,t){if(typeof e!="string"||e.length===0)throw new Hr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Hr('"allowMissing" argument must be a boolean');if(yy(/^%?[^%]*%?$/,e)===null)throw new es("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=by(e),s=i.length>0?i[0]:"",n=wy("%"+s+"%",t),o=n.name,a=n.value,h=!1,u=n.alias;u&&(s=u[0],_y(i,gy([0,1],u)));for(var d=1,l=!0;d<i.length;d+=1){var c=i[d],f=bo(c,0,1),p=bo(c,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new es("property names with quotes must have matching quotes");if((c==="constructor"||!l)&&(h=!0),s+="."+c,o="%"+s+"%",xo(Ki,o))a=Ki[o];else if(a!=null){if(!(c in a)){if(!t)throw new Hr("base intrinsic for "+e+" exists, but the property is not available.");return}if(Zi&&d+1>=i.length){var g=Zi(a,c);l=!!g,l&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[c]}else l=xo(a,c),a=a[c];l&&!h&&(Ki[o]=a)}}return a},Cf={exports:{}},Ay=or,bl=Ay("%Object.defineProperty%",!0),wl=function(){if(bl)try{return bl({},"a",{value:1}),!0}catch{return!1}return!1};wl.hasArrayLengthDefineBug=function(){if(!wl())return null;try{return bl([],"length",{value:1}).length!==1}catch{return!0}};var Mf=wl,Ty=or,io=Ty("%Object.getOwnPropertyDescriptor%",!0);if(io)try{io([],"length")}catch{io=null}var If=io,Sy=Mf(),zh=or,Us=Sy&&zh("%Object.defineProperty%",!0);if(Us)try{Us({},"a",{value:1})}catch{Us=!1}var Ey=zh("%SyntaxError%"),fr=zh("%TypeError%"),su=If,Cy=function(e,t,i){if(!e||typeof e!="object"&&typeof e!="function")throw new fr("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new fr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new fr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new fr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new fr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new fr("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,h=!!su&&su(e,t);if(Us)Us(e,t,{configurable:o===null&&h?h.configurable:!o,enumerable:s===null&&h?h.enumerable:!s,value:i,writable:n===null&&h?h.writable:!n});else if(a||!s&&!n&&!o)e[t]=i;else throw new Ey("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Pf=or,nu=Cy,My=Mf(),ou=If,au=Pf("%TypeError%"),Iy=Pf("%Math.floor%"),Py=function(e,t){if(typeof e!="function")throw new au("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Iy(t)!==t)throw new au("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,n=!0;if("length"in e&&ou){var o=ou(e,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(n=!1)}return(s||n||!i)&&(My?nu(e,"length",t,!0,!0):nu(e,"length",t)),e};(function(r){var e=Gh,t=or,i=Py,s=t("%TypeError%"),n=t("%Function.prototype.apply%"),o=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(o,n),h=t("%Object.defineProperty%",!0),u=t("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}r.exports=function(c){if(typeof c!="function")throw new s("a function is required");var f=a(e,o,arguments);return i(f,1+u(0,c.length-(arguments.length-1)),!0)};var d=function(){return a(e,n,arguments)};h?h(r.exports,"apply",{value:d}):r.exports.apply=d})(Cf);var Ry=Cf.exports,Rf=or,Df=Ry,Dy=Df(Rf("String.prototype.indexOf")),By=function(e,t){var i=Rf(e,!!t);return typeof i=="function"&&Dy(e,".prototype.")>-1?Df(i):i};const Fy={},Ly=Object.freeze(Object.defineProperty({__proto__:null,default:Fy},Symbol.toStringTag,{value:"Module"})),Oy=A_(Ly);var Hh=typeof Map=="function"&&Map.prototype,_a=Object.getOwnPropertyDescriptor&&Hh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,wo=Hh&&_a&&typeof _a.get=="function"?_a.get:null,lu=Hh&&Map.prototype.forEach,Vh=typeof Set=="function"&&Set.prototype,ya=Object.getOwnPropertyDescriptor&&Vh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ao=Vh&&ya&&typeof ya.get=="function"?ya.get:null,hu=Vh&&Set.prototype.forEach,ky=typeof WeakMap=="function"&&WeakMap.prototype,Gs=ky?WeakMap.prototype.has:null,Ny=typeof WeakSet=="function"&&WeakSet.prototype,zs=Ny?WeakSet.prototype.has:null,Uy=typeof WeakRef=="function"&&WeakRef.prototype,cu=Uy?WeakRef.prototype.deref:null,Gy=Boolean.prototype.valueOf,zy=Object.prototype.toString,Hy=Function.prototype.toString,Vy=String.prototype.match,Wh=String.prototype.slice,yi=String.prototype.replace,Wy=String.prototype.toUpperCase,uu=String.prototype.toLowerCase,Bf=RegExp.prototype.test,du=Array.prototype.concat,Dt=Array.prototype.join,$y=Array.prototype.slice,fu=Math.floor,Al=typeof BigInt=="function"?BigInt.prototype.valueOf:null,va=Object.getOwnPropertySymbols,Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ts=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ge=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ts||!0)?Symbol.toStringTag:null,Ff=Object.prototype.propertyIsEnumerable,pu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function mu(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Bf.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-fu(-r):fu(r);if(i!==r){var s=String(i),n=Wh.call(e,s.length+1);return yi.call(s,t,"$&_")+"."+yi.call(yi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return yi.call(e,t,"$&_")}var Sl=Oy,gu=Sl.custom,_u=Of(gu)?gu:null,Xy=function r(e,t,i,s){var n=t||{};if(ui(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ui(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=ui(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ui(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ui(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Nf(e,n);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var h=String(e);return a?mu(e,h):h}if(typeof e=="bigint"){var u=String(e)+"n";return a?mu(e,u):u}var d=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=d&&d>0&&typeof e=="object")return El(e)?"[Array]":"[Object]";var l=cv(n,i);if(typeof s>"u")s=[];else if(kf(s,e)>=0)return"[Circular]";function c(A,I,D){if(I&&(s=$y.call(s),s.push(I)),D){var B={depth:n.depth};return ui(n,"quoteStyle")&&(B.quoteStyle=n.quoteStyle),r(A,B,i+1,s)}return r(A,n,i+1,s)}if(typeof e=="function"&&!yu(e)){var f=tv(e),p=vn(e,c);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Dt.call(p,", ")+" }":"")}if(Of(e)){var g=ts?yi.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Tl.call(e);return typeof e=="object"&&!ts?gs(g):g}if(av(e)){for(var m="<"+uu.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)m+=" "+_[v].name+"="+Lf(jy(_[v].value),"double",n);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+uu.call(String(e.nodeName))+">",m}if(El(e)){if(e.length===0)return"[]";var x=vn(e,c);return l&&!hv(x)?"["+Cl(x,l)+"]":"[ "+Dt.call(x,", ")+" ]"}if(qy(e)){var b=vn(e,c);return!("cause"in Error.prototype)&&"cause"in e&&!Ff.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(du.call("[cause]: "+c(e.cause),b),", ")+" }":b.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(b,", ")+" }"}if(typeof e=="object"&&o){if(_u&&typeof e[_u]=="function"&&Sl)return Sl(e,{depth:d-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(iv(e)){var w=[];return lu&&lu.call(e,function(A,I){w.push(c(I,e,!0)+" => "+c(A,e))}),vu("Map",wo.call(e),w,l)}if(nv(e)){var C=[];return hu&&hu.call(e,function(A){C.push(c(A,e))}),vu("Set",Ao.call(e),C,l)}if(rv(e))return xa("WeakMap");if(ov(e))return xa("WeakSet");if(sv(e))return xa("WeakRef");if(Ky(e))return gs(c(Number(e)));if(Jy(e))return gs(c(Al.call(e)));if(Qy(e))return gs(Gy.call(e));if(Zy(e))return gs(c(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Yt)return"{ [object globalThis] }";if(!Yy(e)&&!yu(e)){var S=vn(e,c),T=pu?pu(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",P=!T&&Ge&&Object(e)===e&&Ge in e?Wh.call(Ci(e),8,-1):M?"Object":"",R=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",E=R+(P||M?"["+Dt.call(du.call([],P||[],M||[]),": ")+"] ":"");return S.length===0?E+"{}":l?E+"{"+Cl(S,l)+"}":E+"{ "+Dt.call(S,", ")+" }"}return String(e)};function Lf(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function jy(r){return yi.call(String(r),/"/g,""")}function El(r){return Ci(r)==="[object Array]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Yy(r){return Ci(r)==="[object Date]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function yu(r){return Ci(r)==="[object RegExp]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function qy(r){return Ci(r)==="[object Error]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Zy(r){return Ci(r)==="[object String]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Ky(r){return Ci(r)==="[object Number]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Qy(r){return Ci(r)==="[object Boolean]"&&(!Ge||!(typeof r=="object"&&Ge in r))}function Of(r){if(ts)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Tl)return!1;try{return Tl.call(r),!0}catch{}return!1}function Jy(r){if(!r||typeof r!="object"||!Al)return!1;try{return Al.call(r),!0}catch{}return!1}var ev=Object.prototype.hasOwnProperty||function(r){return r in this};function ui(r,e){return ev.call(r,e)}function Ci(r){return zy.call(r)}function tv(r){if(r.name)return r.name;var e=Vy.call(Hy.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function kf(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(r[t]===e)return t;return-1}function iv(r){if(!wo||!r||typeof r!="object")return!1;try{wo.call(r);try{Ao.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function rv(r){if(!Gs||!r||typeof r!="object")return!1;try{Gs.call(r,Gs);try{zs.call(r,zs)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function sv(r){if(!cu||!r||typeof r!="object")return!1;try{return cu.call(r),!0}catch{}return!1}function nv(r){if(!Ao||!r||typeof r!="object")return!1;try{Ao.call(r);try{wo.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function ov(r){if(!zs||!r||typeof r!="object")return!1;try{zs.call(r,zs);try{Gs.call(r,Gs)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function av(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Nf(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return Nf(Wh.call(r,0,e.maxStringLength),e)+i}var s=yi.call(yi.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lv);return Lf(s,"single",e)}function lv(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Wy.call(e.toString(16))}function gs(r){return"Object("+r+")"}function xa(r){return r+" { ? }"}function vu(r,e,t,i){var s=i?Cl(t,i):Dt.call(t,", ");return r+" ("+e+") {"+s+"}"}function hv(r){for(var e=0;e<r.length;e++)if(kf(r[e],`
|
|
3689
|
+
`)>=0)return!1;return!0}function cv(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Dt.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Dt.call(Array(e+1),t)}}function Cl(r,e){if(r.length===0)return"";var t=`
|
|
3690
3690
|
`+e.prev+e.base;return t+Dt.call(r,","+t)+`
|
|
3691
|
-
`+e.prev}function yn(r,e){var t=Cl(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=ui(r,s)?e(r[s],r):""}var n=typeof xa=="function"?xa(r):[],o;if(es){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)ui(r,h)&&(t&&String(Number(h))===h&&h<r.length||es&&o["$"+h]instanceof Symbol||(Bf.call(/[^\w$]/,h)?i.push(e(h,r)+": "+e(r[h],r)):i.push(h+": "+e(r[h],r))));if(typeof xa=="function")for(var u=0;u<n.length;u++)Ff.call(r,n[u])&&i.push("["+e(n[u])+"]: "+e(r[n[u]],r));return i}var $h=or,as=Dy,cv=$y,uv=$h("%TypeError%"),vn=$h("%WeakMap%",!0),xn=$h("%Map%",!0),dv=as("WeakMap.prototype.get",!0),fv=as("WeakMap.prototype.set",!0),pv=as("WeakMap.prototype.has",!0),mv=as("Map.prototype.get",!0),gv=as("Map.prototype.set",!0),_v=as("Map.prototype.has",!0),Xh=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},yv=function(r,e){var t=Xh(r,e);return t&&t.value},vv=function(r,e,t){var i=Xh(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},xv=function(r,e){return!!Xh(r,e)},bv=function(){var e,t,i,s={assert:function(n){if(!s.has(n))throw new uv("Side channel does not contain "+cv(n))},get:function(n){if(vn&&n&&(typeof n=="object"||typeof n=="function")){if(e)return dv(e,n)}else if(xn){if(t)return mv(t,n)}else if(i)return yv(i,n)},has:function(n){if(vn&&n&&(typeof n=="object"||typeof n=="function")){if(e)return pv(e,n)}else if(xn){if(t)return _v(t,n)}else if(i)return xv(i,n);return!1},set:function(n,o){vn&&n&&(typeof n=="object"||typeof n=="function")?(e||(e=new vn),fv(e,n,o)):xn?(t||(t=new xn),gv(t,n,o)):(i||(i={key:{},next:null}),vv(i,n,o))}};return s},wv=String.prototype.replace,Av=/%20/g,wa={RFC1738:"RFC1738",RFC3986:"RFC3986"},jh={default:wa.RFC3986,formatters:{RFC1738:function(r){return wv.call(r,Av,"+")},RFC3986:function(r){return String(r)}},RFC1738:wa.RFC1738,RFC3986:wa.RFC3986},Tv=jh,Aa=Object.prototype.hasOwnProperty,$i=Array.isArray,At=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Sv=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if($i(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);t.obj[t.prop]=s}}},Uf=function(e,t){for(var i=t&&t.plainObjects?Object.create(null):{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},Ev=function r(e,t,i){if(!t)return e;if(typeof t!="object"){if($i(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Aa.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return $i(e)&&!$i(t)&&(s=Uf(e,i)),$i(e)&&$i(t)?(t.forEach(function(n,o){if(Aa.call(e,o)){var a=e[o];a&&typeof a=="object"&&n&&typeof n=="object"?e[o]=r(a,n,i):e.push(n)}else e[o]=n}),e):Object.keys(t).reduce(function(n,o){var a=t[o];return Aa.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},Cv=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},Mv=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Iv=function(e,t,i,s,n){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var u=o.charCodeAt(h);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===Tv.RFC1738&&(u===40||u===41)){a+=o.charAt(h);continue}if(u<128){a=a+At[u];continue}if(u<2048){a=a+(At[192|u>>6]+At[128|u&63]);continue}if(u<55296||u>=57344){a=a+(At[224|u>>12]+At[128|u>>6&63]+At[128|u&63]);continue}h+=1,u=65536+((u&1023)<<10|o.charCodeAt(h)&1023),a+=At[240|u>>18]+At[128|u>>12&63]+At[128|u>>6&63]+At[128|u&63]}return a},Pv=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var n=t[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var u=a[h],d=o[u];typeof d=="object"&&d!==null&&i.indexOf(d)===-1&&(t.push({obj:o,prop:u}),i.push(d))}return Sv(t),e},Rv=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Dv=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Bv=function(e,t){return[].concat(e,t)},Fv=function(e,t){if($i(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)},Gf={arrayToObject:Uf,assign:Cv,combine:Bv,compact:Pv,decode:Mv,encode:Iv,isBuffer:Dv,isRegExp:Rv,maybeMap:Fv,merge:Ev},zf=bv,io=Gf,zs=jh,Lv=Object.prototype.hasOwnProperty,xu={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},$t=Array.isArray,Ov=Array.prototype.push,Hf=function(r,e){Ov.apply(r,$t(e)?e:[e])},kv=Date.prototype.toISOString,bu=zs.default,Ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:io.encode,encodeValuesOnly:!1,format:bu,formatter:zs.formatters[bu],indices:!1,serializeDate:function(e){return kv.call(e)},skipNulls:!1,strictNullHandling:!1},Nv=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ta={},Uv=function r(e,t,i,s,n,o,a,h,u,d,l,c,f,p,g,m){for(var _=e,v=m,x=0,b=!1;(v=v.get(Ta))!==void 0&&!b;){var w=v.get(e);if(x+=1,typeof w<"u"){if(w===x)throw new RangeError("Cyclic object value");b=!0}typeof v.get(Ta)>"u"&&(x=0)}if(typeof h=="function"?_=h(t,_):_ instanceof Date?_=l(_):i==="comma"&&$t(_)&&(_=io.maybeMap(_,function(B){return B instanceof Date?l(B):B})),_===null){if(n)return a&&!p?a(t,Ue.encoder,g,"key",c):t;_=""}if(Nv(_)||io.isBuffer(_)){if(a){var C=p?t:a(t,Ue.encoder,g,"key",c);return[f(C)+"="+f(a(_,Ue.encoder,g,"value",c))]}return[f(t)+"="+f(String(_))]}var S=[];if(typeof _>"u")return S;var T;if(i==="comma"&&$t(_))p&&a&&(_=io.maybeMap(_,a)),T=[{value:_.length>0?_.join(",")||null:void 0}];else if($t(h))T=h;else{var M=Object.keys(_);T=u?M.sort(u):M}for(var P=s&&$t(_)&&_.length===1?t+"[]":t,R=0;R<T.length;++R){var E=T[R],A=typeof E=="object"&&typeof E.value<"u"?E.value:_[E];if(!(o&&A===null)){var I=$t(_)?typeof i=="function"?i(P,E):P:P+(d?"."+E:"["+E+"]");m.set(e,x);var D=zf();D.set(Ta,m),Hf(S,r(A,I,i,s,n,o,i==="comma"&&p&&$t(_)?null:a,h,u,d,l,c,f,p,g,D))}}return S},Gv=function(e){if(!e)return Ue;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||Ue.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=zs.default;if(typeof e.format<"u"){if(!Lv.call(zs.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=zs.formatters[i],n=Ue.filter;return(typeof e.filter=="function"||$t(e.filter))&&(n=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Ue.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Ue.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ue.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ue.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ue.encode,encoder:typeof e.encoder=="function"?e.encoder:Ue.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ue.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ue.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ue.strictNullHandling}},zv=function(r,e){var t=r,i=Gv(e),s,n;typeof i.filter=="function"?(n=i.filter,t=n("",t)):$t(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in xu?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var h=xu[a];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=h==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var d=zf(),l=0;l<s.length;++l){var c=s[l];i.skipNulls&&t[c]===null||Hf(o,Uv(t[c],c,h,u,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,d))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},ts=Gf,Il=Object.prototype.hasOwnProperty,Hv=Array.isArray,Ie={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ts.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Vv=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Vf=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},Wv="utf8=%26%2310003%3B",$v="utf8=%E2%9C%93",Xv=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,n),a=-1,h,u=t.charset;if(t.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===$v?u="utf-8":o[h]===Wv&&(u="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var d=o[h],l=d.indexOf("]="),c=l===-1?d.indexOf("="):l+1,f,p;c===-1?(f=t.decoder(d,Ie.decoder,u,"key"),p=t.strictNullHandling?null:""):(f=t.decoder(d.slice(0,c),Ie.decoder,u,"key"),p=ts.maybeMap(Vf(d.slice(c+1),t),function(g){return t.decoder(g,Ie.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=Vv(p)),d.indexOf("[]=")>-1&&(p=Hv(p)?[p]:p),Il.call(i,f)?i[f]=ts.combine(i[f],p):i[f]=p}return i},jv=function(r,e,t,i){for(var s=i?e:Vf(e,t),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&t.parseArrays)o=[].concat(s);else{o=t.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,u=parseInt(h,10);!t.parseArrays&&h===""?o={0:s}:!isNaN(u)&&a!==h&&String(u)===h&&u>=0&&t.parseArrays&&u<=t.arrayLimit?(o=[],o[u]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},Yv=function(e,t,i,s){if(e){var n=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),u=h?n.slice(0,h.index):n,d=[];if(u){if(!i.plainObjects&&Il.call(Object.prototype,u)&&!i.allowPrototypes)return;d.push(u)}for(var l=0;i.depth>0&&(h=a.exec(n))!==null&&l<i.depth;){if(l+=1,!i.plainObjects&&Il.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;d.push(h[1])}return h&&d.push("["+n.slice(h.index)+"]"),jv(d,t,i,s)}},qv=function(e){if(!e)return Ie;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?Ie.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ie.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ie.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ie.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ie.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ie.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ie.comma,decoder:typeof e.decoder=="function"?e.decoder:Ie.decoder,delimiter:typeof e.delimiter=="string"||ts.isRegExp(e.delimiter)?e.delimiter:Ie.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ie.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ie.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ie.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ie.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ie.strictNullHandling}},Zv=function(r,e){var t=qv(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?Xv(r,t):r,s=t.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Yv(a,i[a],t,typeof r=="string");s=ts.merge(s,h,t)}return t.allowSparse===!0?s:ts.compact(s)},Kv=zv,Qv=Zv,Jv=jh,ex={formats:Jv,parse:Qv,stringify:Kv},tx=$_;function Jt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var ix=/^([a-z0-9.+-]+:)/i,rx=/:[0-9]*$/,sx=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,nx=["<",">",'"',"`"," ","\r",`
|
|
3692
|
-
`," "],
|
|
3691
|
+
`+e.prev}function vn(r,e){var t=El(r),i=[];if(t){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=ui(r,s)?e(r[s],r):""}var n=typeof va=="function"?va(r):[],o;if(ts){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)ui(r,h)&&(t&&String(Number(h))===h&&h<r.length||ts&&o["$"+h]instanceof Symbol||(Bf.call(/[^\w$]/,h)?i.push(e(h,r)+": "+e(r[h],r)):i.push(h+": "+e(r[h],r))));if(typeof va=="function")for(var u=0;u<n.length;u++)Ff.call(r,n[u])&&i.push("["+e(n[u])+"]: "+e(r[n[u]],r));return i}var $h=or,ls=By,uv=Xy,dv=$h("%TypeError%"),xn=$h("%WeakMap%",!0),bn=$h("%Map%",!0),fv=ls("WeakMap.prototype.get",!0),pv=ls("WeakMap.prototype.set",!0),mv=ls("WeakMap.prototype.has",!0),gv=ls("Map.prototype.get",!0),_v=ls("Map.prototype.set",!0),yv=ls("Map.prototype.has",!0),Xh=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},vv=function(r,e){var t=Xh(r,e);return t&&t.value},xv=function(r,e,t){var i=Xh(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},bv=function(r,e){return!!Xh(r,e)},wv=function(){var e,t,i,s={assert:function(n){if(!s.has(n))throw new dv("Side channel does not contain "+uv(n))},get:function(n){if(xn&&n&&(typeof n=="object"||typeof n=="function")){if(e)return fv(e,n)}else if(bn){if(t)return gv(t,n)}else if(i)return vv(i,n)},has:function(n){if(xn&&n&&(typeof n=="object"||typeof n=="function")){if(e)return mv(e,n)}else if(bn){if(t)return yv(t,n)}else if(i)return bv(i,n);return!1},set:function(n,o){xn&&n&&(typeof n=="object"||typeof n=="function")?(e||(e=new xn),pv(e,n,o)):bn?(t||(t=new bn),_v(t,n,o)):(i||(i={key:{},next:null}),xv(i,n,o))}};return s},Av=String.prototype.replace,Tv=/%20/g,ba={RFC1738:"RFC1738",RFC3986:"RFC3986"},jh={default:ba.RFC3986,formatters:{RFC1738:function(r){return Av.call(r,Tv,"+")},RFC3986:function(r){return String(r)}},RFC1738:ba.RFC1738,RFC3986:ba.RFC3986},Sv=jh,wa=Object.prototype.hasOwnProperty,$i=Array.isArray,At=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Ev=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if($i(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);t.obj[t.prop]=s}}},Uf=function(e,t){for(var i=t&&t.plainObjects?Object.create(null):{},s=0;s<e.length;++s)typeof e[s]<"u"&&(i[s]=e[s]);return i},Cv=function r(e,t,i){if(!t)return e;if(typeof t!="object"){if($i(e))e.push(t);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!wa.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var s=e;return $i(e)&&!$i(t)&&(s=Uf(e,i)),$i(e)&&$i(t)?(t.forEach(function(n,o){if(wa.call(e,o)){var a=e[o];a&&typeof a=="object"&&n&&typeof n=="object"?e[o]=r(a,n,i):e.push(n)}else e[o]=n}),e):Object.keys(t).reduce(function(n,o){var a=t[o];return wa.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},Mv=function(e,t){return Object.keys(t).reduce(function(i,s){return i[s]=t[s],i},e)},Iv=function(r,e,t){var i=r.replace(/\+/g," ");if(t==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},Pv=function(e,t,i,s,n){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var u=o.charCodeAt(h);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===Sv.RFC1738&&(u===40||u===41)){a+=o.charAt(h);continue}if(u<128){a=a+At[u];continue}if(u<2048){a=a+(At[192|u>>6]+At[128|u&63]);continue}if(u<55296||u>=57344){a=a+(At[224|u>>12]+At[128|u>>6&63]+At[128|u&63]);continue}h+=1,u=65536+((u&1023)<<10|o.charCodeAt(h)&1023),a+=At[240|u>>18]+At[128|u>>12&63]+At[128|u>>6&63]+At[128|u&63]}return a},Rv=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s<t.length;++s)for(var n=t[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var u=a[h],d=o[u];typeof d=="object"&&d!==null&&i.indexOf(d)===-1&&(t.push({obj:o,prop:u}),i.push(d))}return Ev(t),e},Dv=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Bv=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Fv=function(e,t){return[].concat(e,t)},Lv=function(e,t){if($i(e)){for(var i=[],s=0;s<e.length;s+=1)i.push(t(e[s]));return i}return t(e)},Gf={arrayToObject:Uf,assign:Mv,combine:Fv,compact:Rv,decode:Iv,encode:Pv,isBuffer:Bv,isRegExp:Dv,maybeMap:Lv,merge:Cv},zf=wv,ro=Gf,Hs=jh,Ov=Object.prototype.hasOwnProperty,xu={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},$t=Array.isArray,kv=Array.prototype.push,Hf=function(r,e){kv.apply(r,$t(e)?e:[e])},Nv=Date.prototype.toISOString,bu=Hs.default,Ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ro.encode,encodeValuesOnly:!1,format:bu,formatter:Hs.formatters[bu],indices:!1,serializeDate:function(e){return Nv.call(e)},skipNulls:!1,strictNullHandling:!1},Uv=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Aa={},Gv=function r(e,t,i,s,n,o,a,h,u,d,l,c,f,p,g,m){for(var _=e,v=m,x=0,b=!1;(v=v.get(Aa))!==void 0&&!b;){var w=v.get(e);if(x+=1,typeof w<"u"){if(w===x)throw new RangeError("Cyclic object value");b=!0}typeof v.get(Aa)>"u"&&(x=0)}if(typeof h=="function"?_=h(t,_):_ instanceof Date?_=l(_):i==="comma"&&$t(_)&&(_=ro.maybeMap(_,function(B){return B instanceof Date?l(B):B})),_===null){if(n)return a&&!p?a(t,Ue.encoder,g,"key",c):t;_=""}if(Uv(_)||ro.isBuffer(_)){if(a){var C=p?t:a(t,Ue.encoder,g,"key",c);return[f(C)+"="+f(a(_,Ue.encoder,g,"value",c))]}return[f(t)+"="+f(String(_))]}var S=[];if(typeof _>"u")return S;var T;if(i==="comma"&&$t(_))p&&a&&(_=ro.maybeMap(_,a)),T=[{value:_.length>0?_.join(",")||null:void 0}];else if($t(h))T=h;else{var M=Object.keys(_);T=u?M.sort(u):M}for(var P=s&&$t(_)&&_.length===1?t+"[]":t,R=0;R<T.length;++R){var E=T[R],A=typeof E=="object"&&typeof E.value<"u"?E.value:_[E];if(!(o&&A===null)){var I=$t(_)?typeof i=="function"?i(P,E):P:P+(d?"."+E:"["+E+"]");m.set(e,x);var D=zf();D.set(Aa,m),Hf(S,r(A,I,i,s,n,o,i==="comma"&&p&&$t(_)?null:a,h,u,d,l,c,f,p,g,D))}}return S},zv=function(e){if(!e)return Ue;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||Ue.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Hs.default;if(typeof e.format<"u"){if(!Ov.call(Hs.formatters,e.format))throw new TypeError("Unknown format option provided.");i=e.format}var s=Hs.formatters[i],n=Ue.filter;return(typeof e.filter=="function"||$t(e.filter))&&(n=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Ue.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Ue.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ue.charsetSentinel,delimiter:typeof e.delimiter>"u"?Ue.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Ue.encode,encoder:typeof e.encoder=="function"?e.encoder:Ue.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Ue.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Ue.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ue.strictNullHandling}},Hv=function(r,e){var t=r,i=zv(e),s,n;typeof i.filter=="function"?(n=i.filter,t=n("",t)):$t(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in xu?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var h=xu[a];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=h==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var d=zf(),l=0;l<s.length;++l){var c=s[l];i.skipNulls&&t[c]===null||Hf(o,Gv(t[c],c,h,u,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,d))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},is=Gf,Ml=Object.prototype.hasOwnProperty,Vv=Array.isArray,Ie={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:is.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Wv=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Vf=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},$v="utf8=%26%2310003%3B",Xv="utf8=%E2%9C%93",jv=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=t.parameterLimit===1/0?void 0:t.parameterLimit,o=s.split(t.delimiter,n),a=-1,h,u=t.charset;if(t.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===Xv?u="utf-8":o[h]===$v&&(u="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var d=o[h],l=d.indexOf("]="),c=l===-1?d.indexOf("="):l+1,f,p;c===-1?(f=t.decoder(d,Ie.decoder,u,"key"),p=t.strictNullHandling?null:""):(f=t.decoder(d.slice(0,c),Ie.decoder,u,"key"),p=is.maybeMap(Vf(d.slice(c+1),t),function(g){return t.decoder(g,Ie.decoder,u,"value")})),p&&t.interpretNumericEntities&&u==="iso-8859-1"&&(p=Wv(p)),d.indexOf("[]=")>-1&&(p=Vv(p)?[p]:p),Ml.call(i,f)?i[f]=is.combine(i[f],p):i[f]=p}return i},Yv=function(r,e,t,i){for(var s=i?e:Vf(e,t),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&t.parseArrays)o=[].concat(s);else{o=t.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,u=parseInt(h,10);!t.parseArrays&&h===""?o={0:s}:!isNaN(u)&&a!==h&&String(u)===h&&u>=0&&t.parseArrays&&u<=t.arrayLimit?(o=[],o[u]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},qv=function(e,t,i,s){if(e){var n=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),u=h?n.slice(0,h.index):n,d=[];if(u){if(!i.plainObjects&&Ml.call(Object.prototype,u)&&!i.allowPrototypes)return;d.push(u)}for(var l=0;i.depth>0&&(h=a.exec(n))!==null&&l<i.depth;){if(l+=1,!i.plainObjects&&Ml.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;d.push(h[1])}return h&&d.push("["+n.slice(h.index)+"]"),Yv(d,t,i,s)}},Zv=function(e){if(!e)return Ie;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?Ie.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ie.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ie.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ie.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ie.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ie.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ie.comma,decoder:typeof e.decoder=="function"?e.decoder:Ie.decoder,delimiter:typeof e.delimiter=="string"||is.isRegExp(e.delimiter)?e.delimiter:Ie.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ie.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ie.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ie.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ie.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ie.strictNullHandling}},Kv=function(r,e){var t=Zv(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?jv(r,t):r,s=t.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=qv(a,i[a],t,typeof r=="string");s=is.merge(s,h,t)}return t.allowSparse===!0?s:is.compact(s)},Qv=Hv,Jv=Kv,ex=jh,tx={formats:ex,parse:Jv,stringify:Qv},ix=X_;function Jt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var rx=/^([a-z0-9.+-]+:)/i,sx=/:[0-9]*$/,nx=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,ox=["<",">",'"',"`"," ","\r",`
|
|
3692
|
+
`," "],ax=["{","}","|","\\","^","`"].concat(ox),Il=["'"].concat(ax),wu=["%","/","?",";","#"].concat(Il),Au=["/","?","#"],lx=255,Tu=/^[+a-z0-9A-Z_-]{0,63}$/,hx=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,cx={javascript:!0,"javascript:":!0},Pl={javascript:!0,"javascript:":!0},Vr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Rl=tx;function ux(r,e,t){if(r&&typeof r=="object"&&r instanceof Jt)return r;var i=new Jt;return i.parse(r,e,t),i}Jt.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!t&&r.split("#").length===1){var h=nx.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],e?this.query=Rl.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=rx.exec(a);if(u){u=u[0];var d=u.toLowerCase();this.protocol=d,a=a.substr(u.length)}if(t||u||a.match(/^\/\/[^@/]+@[^@/]+/)){var l=a.substr(0,2)==="//";l&&!(u&&Pl[u])&&(a=a.substr(2),this.slashes=!0)}if(!Pl[u]&&(l||u&&!Vr[u])){for(var c=-1,f=0;f<Au.length;f++){var p=a.indexOf(Au[f]);p!==-1&&(c===-1||p<c)&&(c=p)}var g,m;c===-1?m=a.lastIndexOf("@"):m=a.lastIndexOf("@",c),m!==-1&&(g=a.slice(0,m),a=a.slice(m+1),this.auth=decodeURIComponent(g)),c=-1;for(var f=0;f<wu.length;f++){var p=a.indexOf(wu[f]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=a.length),this.host=a.slice(0,c),a=a.slice(c),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var v=this.hostname.split(/\./),f=0,x=v.length;f<x;f++){var b=v[f];if(b&&!b.match(Tu)){for(var w="",C=0,S=b.length;C<S;C++)b.charCodeAt(C)>127?w+="x":w+=b[C];if(!w.match(Tu)){var T=v.slice(0,f),M=v.slice(f+1),P=b.match(hx);P&&(T.push(P[1]),M.unshift(P[2])),M.length&&(a="/"+M.join(".")+a),this.hostname=T.join(".");break}}}this.hostname.length>lx?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=ix.toASCII(this.hostname));var R=this.port?":"+this.port:"",E=this.hostname||"";this.host=E+R,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!cx[d])for(var f=0,x=Il.length;f<x;f++){var A=Il[f];if(a.indexOf(A)!==-1){var I=encodeURIComponent(A);I===A&&(I=escape(A)),a=a.split(A).join(I)}}var D=a.indexOf("#");D!==-1&&(this.hash=a.substr(D),a=a.slice(0,D));var B=a.indexOf("?");if(B!==-1?(this.search=a.substr(B),this.query=a.substr(B+1),e&&(this.query=Rl.parse(this.query)),a=a.slice(0,B)):e&&(this.search="",this.query={}),a&&(this.pathname=a),Vr[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var R=this.pathname||"",k=this.search||"";this.path=R+k}return this.href=this.format(),this};Jt.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var e=this.protocol||"",t=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=Rl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Vr[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),t=t.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),e+s+t+o+i};Jt.prototype.resolve=function(r){return this.resolveObject(ux(r,!1,!0)).format()};Jt.prototype.resolveObject=function(r){if(typeof r=="string"){var e=new Jt;e.parse(r,!1,!0),r=e}for(var t=new Jt,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];t[n]=this[n]}if(t.hash=r.hash,r.href==="")return t.href=t.format(),t;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(t[h]=r[h])}return Vr[t.protocol]&&t.hostname&&!t.pathname&&(t.pathname="/",t.path=t.pathname),t.href=t.format(),t}if(r.protocol&&r.protocol!==t.protocol){if(!Vr[r.protocol]){for(var u=Object.keys(r),d=0;d<u.length;d++){var l=u[d];t[l]=r[l]}return t.href=t.format(),t}if(t.protocol=r.protocol,!r.host&&!Pl[r.protocol]){for(var x=(r.pathname||"").split("/");x.length&&!(r.host=x.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),x[0]!==""&&x.unshift(""),x.length<2&&x.unshift(""),t.pathname=x.join("/")}else t.pathname=r.pathname;if(t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,t.pathname||t.search){var c=t.pathname||"",f=t.search||"";t.path=c+f}return t.slashes=t.slashes||r.slashes,t.href=t.format(),t}var p=t.pathname&&t.pathname.charAt(0)==="/",g=r.host||r.pathname&&r.pathname.charAt(0)==="/",m=g||p||t.host&&r.pathname,_=m,v=t.pathname&&t.pathname.split("/")||[],x=r.pathname&&r.pathname.split("/")||[],b=t.protocol&&!Vr[t.protocol];if(b&&(t.hostname="",t.port=null,t.host&&(v[0]===""?v[0]=t.host:v.unshift(t.host)),t.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(x[0]===""?x[0]=r.host:x.unshift(r.host)),r.host=null),m=m&&(x[0]===""||v[0]==="")),g)t.host=r.host||r.host===""?r.host:t.host,t.hostname=r.hostname||r.hostname===""?r.hostname:t.hostname,t.search=r.search,t.query=r.query,v=x;else if(x.length)v||(v=[]),v.pop(),v=v.concat(x),t.search=r.search,t.query=r.query;else if(r.search!=null){if(b){t.host=v.shift(),t.hostname=t.host;var w=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;w&&(t.auth=w.shift(),t.hostname=w.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var C=v.slice(-1)[0],S=(t.host||r.host||v.length>1)&&(C==="."||C==="..")||C==="",T=0,M=v.length;M>=0;M--)C=v[M],C==="."?v.splice(M,1):C===".."?(v.splice(M,1),T++):T&&(v.splice(M,1),T--);if(!m&&!_)for(;T--;T)v.unshift("..");m&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),S&&v.join("/").substr(-1)!=="/"&&v.push("");var P=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(b){t.hostname=P?"":v.length?v.shift():"",t.host=t.hostname;var w=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;w&&(t.auth=w.shift(),t.hostname=w.shift(),t.host=t.hostname)}return m=m||t.host&&v.length,m&&!P&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};Jt.prototype.parseHost=function(){var r=this.host,e=sx.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};const Su={};function J(r,e,t=3){if(Su[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
3693
3693
|
Deprecated since v${r}`):(i=i.split(`
|
|
3694
3694
|
`).splice(t).join(`
|
|
3695
3695
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
|
3696
3696
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
3697
|
-
Deprecated since v${r}`),console.warn(i))),Su[e]=!0}function ht(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function gs(r){return r.split("?")[0].split("#")[0]}function ux(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dx(r,e,t){return r.replace(new RegExp(ux(e),"g"),t)}function fx(r,e){let t="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",i=0):(t=t.slice(0,h),i=t.length-1-t.lastIndexOf("/")),s=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,s=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+=`/${r.slice(s+1,a)}`:t=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}const Me={toPosix(r){return dx(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ht(r),r=this.toPosix(r);const e=/^file:\/\/\//.exec(r);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(r);return t?t[0]:""},toAbsolute(r,e,t){if(ht(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=gs(this.toPosix(e??V.ADAPTER.getBaseUrl())),s=gs(this.toPosix(t??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Me.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ht(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let e="";const t=r.startsWith("/");this.hasProtocol(r)&&(e=this.rootname(r),r=r.slice(e.length));const i=r.endsWith("/");return r=fx(r,!1),r.length>0&&i&&(r+="/"),t?`/${r}`:e+r},isAbsolute(r){return ht(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){const i=r[t];if(ht(i),i.length>0)if(e===void 0)e=i;else{const s=r[t-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(ht(r),r.length===0)return".";r=this.toPosix(r);let e=r.charCodeAt(0);const t=e===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(e=r.charCodeAt(a),e===47){if(!s){i=a;break}}else s=!1;return i===-1?t?"/":this.isUrl(o)?n+r:n:t&&i===1?"//":n+r.slice(0,i)},rootname(r){ht(r),r=this.toPosix(r);let e="";if(r.startsWith("/")?e="/":e=this.getProtocol(r),this.isUrl(r)){const t=r.indexOf("/",e.length);t!==-1?e=r.slice(0,t):e=r,e.endsWith("/")||(e+="/")}return e},basename(r,e){ht(r),e&&ht(e),r=gs(this.toPosix(r));let t=0,i=-1,s=!0,n;if(e!==void 0&&e.length>0&&e.length<=r.length){if(e.length===r.length&&e===r)return"";let o=e.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){t=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===e.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=r.length),r.slice(t,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){t=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(t,i)},extname(r){ht(r),r=gs(this.toPosix(r));let e=-1,t=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){t=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?e===-1?e=o:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||i===-1||n===0||n===1&&e===i-1&&e===t+1?"":r.slice(e,i)},parse(r){ht(r);const e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;r=gs(this.toPosix(r));let t=r.charCodeAt(0);const i=this.isAbsolute(r);let s;e.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,u=r.length-1,d=0;for(;u>=s;--u){if(t=r.charCodeAt(u),t===47){if(!h){o=u+1;break}continue}a===-1&&(h=!1,a=u+1),t===46?n===-1?n=u:d!==1&&(d=1):n!==-1&&(d=-1)}return n===-1||a===-1||d===0||d===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?e.base=e.name=r.slice(1,a):e.base=e.name=r.slice(o,a)):(o===0&&i?(e.name=r.slice(1,n),e.base=r.slice(1,a)):(e.name=r.slice(o,n),e.base=r.slice(o,a)),e.ext=r.slice(n,a)),e.dir=this.dirname(r),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let Sa;async function px(){return Sa??(Sa=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return je.UNPACK;const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return je.UNPACK;const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(t),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?je.PMA:je.UNPACK})()),Sa}let Ea;function mx(){return typeof Ea>"u"&&(Ea=function(){var e;const r={stencil:!0,failIfMajorPerformanceCaveat:V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!V.ADAPTER.getWebGLRenderingContext())return!1;const t=V.ADAPTER.createCanvas();let i=t.getContext("webgl",r)||t.getContext("experimental-webgl",r);const s=!!((e=i==null?void 0:i.getContextAttributes())!=null&&e.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Ea}var gx={grad:.9,turn:360,rad:360/(2*Math.PI)},Ht=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Re=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},it=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},Wf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Eu=function(r){return{r:it(r.r,0,255),g:it(r.g,0,255),b:it(r.b,0,255),a:it(r.a)}},Ca=function(r){return{r:Re(r.r),g:Re(r.g),b:Re(r.b),a:Re(r.a,3)}},_x=/^#([0-9a-f]{3,8})$/i,bn=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},$f=function(r){var e=r.r,t=r.g,i=r.b,s=r.a,n=Math.max(e,t,i),o=n-Math.min(e,t,i),a=o?n===e?(t-i)/o:n===t?2+(i-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Xf=function(r){var e=r.h,t=r.s,i=r.v,s=r.a;e=e/360*6,t/=100,i/=100;var n=Math.floor(e),o=i*(1-t),a=i*(1-(e-n)*t),h=i*(1-(1-e+n)*t),u=n%6;return{r:255*[i,a,o,o,h,i][u],g:255*[h,i,i,a,o,o][u],b:255*[o,o,h,i,i,a][u],a:s}},Cu=function(r){return{h:Wf(r.h),s:it(r.s,0,100),l:it(r.l,0,100),a:it(r.a)}},Mu=function(r){return{h:Re(r.h),s:Re(r.s),l:Re(r.l),a:Re(r.a,3)}},Iu=function(r){return Xf((t=(e=r).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},Hs=function(r){return{h:(e=$f(r)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},yx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bl={string:[[function(r){var e=_x.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?Re(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?Re(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=xx.exec(r)||bx.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Eu({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(r){var e=yx.exec(r)||vx.exec(r);if(!e)return null;var t,i,s=Cu({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(gx[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Iu(s)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ht(e)&&Ht(t)&&Ht(i)?Eu({r:Number(e),g:Number(t),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var e=r.h,t=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ht(e)||!Ht(t)||!Ht(i))return null;var o=Cu({h:Number(e),s:Number(t),l:Number(i),a:Number(n)});return Iu(o)},"hsl"],[function(r){var e=r.h,t=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ht(e)||!Ht(t)||!Ht(i))return null;var o=function(a){return{h:Wf(a.h),s:it(a.s,0,100),v:it(a.v,0,100),a:it(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(n)});return Xf(o)},"hsv"]]},Pu=function(r,e){for(var t=0;t<e.length;t++){var i=e[t][0](r);if(i)return[i,e[t][1]]}return[null,void 0]},Ax=function(r){return typeof r=="string"?Pu(r.trim(),Bl.string):typeof r=="object"&&r!==null?Pu(r,Bl.object):[null,void 0]},Ma=function(r,e){var t=Hs(r);return{h:t.h,s:it(t.s+100*e,0,100),l:t.l,a:t.a}},Ia=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ru=function(r,e){var t=Hs(r);return{h:t.h,s:t.s,l:it(t.l+100*e,0,100),a:t.a}},Fl=function(){function r(e){this.parsed=Ax(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return Re(Ia(this.rgba),2)},r.prototype.isDark=function(){return Ia(this.rgba)<.5},r.prototype.isLight=function(){return Ia(this.rgba)>=.5},r.prototype.toHex=function(){return e=Ca(this.rgba),t=e.r,i=e.g,s=e.b,o=(n=e.a)<1?bn(Re(255*n)):"","#"+bn(t)+bn(i)+bn(s)+o;var e,t,i,s,n,o},r.prototype.toRgb=function(){return Ca(this.rgba)},r.prototype.toRgbString=function(){return e=Ca(this.rgba),t=e.r,i=e.g,s=e.b,(n=e.a)<1?"rgba("+t+", "+i+", "+s+", "+n+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,n},r.prototype.toHsl=function(){return Mu(Hs(this.rgba))},r.prototype.toHslString=function(){return e=Mu(Hs(this.rgba)),t=e.h,i=e.s,s=e.l,(n=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+n+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,n},r.prototype.toHsv=function(){return e=$f(this.rgba),{h:Re(e.h),s:Re(e.s),v:Re(e.v),a:Re(e.a,3)};var e},r.prototype.invert=function(){return St({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),St(Ma(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),St(Ma(this.rgba,-e))},r.prototype.grayscale=function(){return St(Ma(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),St(Ru(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),St(Ru(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?St({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Re(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=Hs(this.rgba);return typeof e=="number"?St({h:e,s:t.s,l:t.l,a:t.a}):Re(t.h)},r.prototype.isEqual=function(e){return this.toHex()===St(e).toHex()},r}(),St=function(r){return r instanceof Fl?r:new Fl(r)},Du=[],Tx=function(r){r.forEach(function(e){Du.indexOf(e)<0&&(e(Fl,Bl),Du.push(e))})};function Sx(r,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in t)i[t[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,u=i[this.toHex()];if(u)return u;if(o!=null&&o.closest){var d=this.toRgb(),l=1/0,c="black";if(!n.length)for(var f in t)n[f]=new r(t[f]).toRgb();for(var p in t){var g=(a=d,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<l&&(l=g,c=p)}return c}},e.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":t[a];return h?new r(h).toRgb():null},"name"])}Tx([Sx]);const Mr=class ro{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof ro)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){const i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,n)=>s===t[n]);if(e!==null&&t!==null){const s=Object.keys(e),n=Object.keys(t);return s.length!==n.length?!1:s.every(o=>e[o]===t[o])}return e===t}toRgba(){const[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){const[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){const[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){const[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];const[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,i,s,n]=ro.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,n=n*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+n}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){const[t,i,s]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,i,s,n]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=n,e}normalize(e){let t,i,s,n;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,s,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,s,n=255]=e,t/=255,i/=255,s/=255,n/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=ro.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=St(e);o.isValid()&&({r:t,g:i,b:s,a:n}=o.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);const[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,n)=>{e[n]=Math.min(Math.max(s,t),i)}),e)}};Mr.shared=new Mr,Mr.temp=new Mr,Mr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ue=Mr;function Ex(r){return J("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),ue.shared.setValue(r).toHex()}function Cx(r){return J("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),ue.shared.setValue(r).toNumber()}function Mx(){const r=[],e=[];for(let i=0;i<32;i++)r[i]=i,e[i]=i;r[Y.NORMAL_NPM]=Y.NORMAL,r[Y.ADD_NPM]=Y.ADD,r[Y.SCREEN_NPM]=Y.SCREEN,e[Y.NORMAL]=Y.NORMAL_NPM,e[Y.ADD]=Y.ADD_NPM,e[Y.SCREEN]=Y.SCREEN_NPM;const t=[];return t.push(e),t.push(r),t}const jf=Mx();function Yf(r,e){return jf[e?1:0][r]}function Ix(r,e=null){const t=r*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i<t;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}function qf(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function To(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Bu(r){return!(r&r-1)&&!!r}function Fu(r){let e=(r>65535?1:0)<<4;r>>>=e;let t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function Wr(r,e,t){const i=r.length;let s;if(e>=i||t===0)return;t=e+t>i?i-e:t;const n=i-t;for(s=e;s<n;++s)r[s]=r[s+t];r.length=n}function vi(r){return r===0?0:r<0?-1:1}let Px=0;function tr(){return++Px}const Ll=class{constructor(r,e,t,i){this.left=r,this.top=e,this.right=t,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Ll.EMPTY=new Ll(0,0,0,0);let Lu=Ll;const Ou={},Et=Object.create(null),oi=Object.create(null);class Rx{constructor(e,t,i){this._canvas=V.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||V.RESOLUTION,this.resize(e,t)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(e,t){this._checkDestroyed(),this._canvas.width=Math.round(e*this.resolution),this._canvas.height=Math.round(t*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(e){this._checkDestroyed(),this._canvas.width=Math.round(e)}get height(){return this._checkDestroyed(),this._canvas.height}set height(e){this._checkDestroyed(),this._canvas.height=Math.round(e)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function ku(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Nu(r,e,t,i,s){const n=4*e;for(let o=i,a=i*n+4*t;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function Dx(r){const{width:e,height:t}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,e,t).data;let n=0,o=0,a=e-1,h=t-1;for(;o<t&&ku(s,e,o);)++o;if(o===t)return Lu.EMPTY;for(;ku(s,e,h);)--h;for(;Nu(s,e,n,o,h);)++n;for(;Nu(s,e,a,o,h);)--a;return++a,++h,new Lu(n,o,a,h)}function Bx(r){const e=Dx(r),{width:t,height:i}=e;let s=null;if(!e.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(e.left,e.top,t,i)}return{width:t,height:i,data:s}}function Fx(r,e=globalThis.location){if(r.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function ei(r,e=1){var i;const t=(i=V.RETINA_PREFIX)==null?void 0:i.exec(r);return t?parseFloat(t[1]):e}var U=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(U||{});const Ol=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Uu=(r,e)=>Ol(r).priority??e,$={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Ol).forEach(e=>{e.type.forEach(t=>{var i,s;return(s=(i=this._removeHandlers)[t])==null?void 0:s.call(i,e)})}),this},add(...r){return r.map(Ol).forEach(e=>{e.type.forEach(t=>{var n,o;const i=this._addHandlers,s=this._queue;i[t]?(n=i[t])==null||n.call(i,e):(s[t]=s[t]||[],(o=s[t])==null||o.push(e))})}),this},handle(r,e,t){var o;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(a=>e(a)),delete n[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,n)=>Uu(n,t)-Uu(s,t)))},i=>{const s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};class kl{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}const Lx=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
3698
|
-
`);function
|
|
3699
|
-
else `),t<r-1&&(e+=`if(test == ${t}.0){}`);return e}function kx(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=Lx.replace(/%forloop%/gi,Ox(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}const Pa=0,Ra=1,Da=2,Ba=3,Fa=4,La=5;class Gt{constructor(){this.data=0,this.blendMode=Y.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Pa)}set blend(e){!!(this.data&1<<Pa)!==e&&(this.data^=1<<Pa)}get offsets(){return!!(this.data&1<<Ra)}set offsets(e){!!(this.data&1<<Ra)!==e&&(this.data^=1<<Ra)}get culling(){return!!(this.data&1<<Da)}set culling(e){!!(this.data&1<<Da)!==e&&(this.data^=1<<Da)}get depthTest(){return!!(this.data&1<<Ba)}set depthTest(e){!!(this.data&1<<Ba)!==e&&(this.data^=1<<Ba)}get depthMask(){return!!(this.data&1<<La)}set depthMask(e){!!(this.data&1<<La)!==e&&(this.data^=1<<La)}get clockwiseFrontFace(){return!!(this.data&1<<Fa)}set clockwiseFrontFace(e){!!(this.data&1<<Fa)!==e&&(this.data^=1<<Fa)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==Y.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new Gt;return e.depthTest=!1,e.blend=!0,e}}Gt.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Nl=[];function Zf(r,e){if(!r)return null;let t="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(let i=Nl.length-1;i>=0;--i){const s=Nl[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class _t{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:u,items:d}=this;this._aliasCount++;for(let l=0,c=d.length;l<c;l++)d[l][u](e,t,i,s,n,o,a,h);return d===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(_t.prototype,{dispatch:{value:_t.prototype.emit},run:{value:_t.prototype.emit}});class Zs{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new _t("setRealSize"),this.onUpdate=new _t("update"),this.onError=new _t("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}}class jo extends Zs{constructor(e,t){const{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){const s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===je.UNPACK);const n=t.realWidth,o=t.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(t.target,0,0,0,n,o,t.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(t.target,0,i.internalFormat,n,o,0,t.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}const Nx={scaleMode:qt.NEAREST,alphaMode:je.NPM},Ul=class Ir extends tn{constructor(e=null,t=null){super(),t=Object.assign({},Ir.defaultOptions,t);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:u,format:d,type:l,target:c,resolution:f,resourceOptions:p}=t;e&&!(e instanceof Zs)&&(e=Zf(e,p),e.internal=!0),this.resolution=f||V.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=u,this._scaleMode=o,this.format=d,this.type=l,this.target=c,this.alphaMode=i,this.uid=tr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Bu(this.realWidth)&&Bu(this.realHeight)}setResolution(e){const t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete oi[this.cacheId],delete Et[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ir.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,i=V.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${tr()}`}n=e._pixiId}let o=oi[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Ir(e,t),o.cacheId=n,Ir.addToCache(o,n)),o}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);const n=new jo(e,{width:t,height:i,...s==null?void 0:s.resourceOptions});let o,a;return e instanceof Float32Array?(o=O.RGBA,a=j.FLOAT):e instanceof Int32Array?(o=O.RGBA_INTEGER,a=j.INT):e instanceof Uint32Array?(o=O.RGBA_INTEGER,a=j.UNSIGNED_INT):e instanceof Int16Array?(o=O.RGBA_INTEGER,a=j.SHORT):e instanceof Uint16Array?(o=O.RGBA_INTEGER,a=j.UNSIGNED_SHORT):e instanceof Int8Array?(o=O.RGBA,a=j.BYTE):(o=O.RGBA,a=j.UNSIGNED_BYTE),n.internal=!0,new Ir(n,Object.assign({},Nx,{type:a,format:o},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),oi[t]&&oi[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),oi[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=oi[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete oi[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete oi[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};Ul.defaultOptions={mipmap:Ut.POW2,anisotropicLevel:0,scaleMode:qt.LINEAR,wrapMode:wi.CLAMP,alphaMode:je.UNPACK,target:zr.TEXTURE_2D,format:O.RGBA,type:j.UNSIGNED_BYTE},Ul._globalBatch=0;let Z=Ul;class Gl{constructor(){this.texArray=null,this.blend=0,this.type=Ft.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Ux=0;class we{constructor(e,t=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=Ux++,this.disposeRunner=new _t("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?Ot.ELEMENT_ARRAY_BUFFER:Ot.ARRAY_BUFFER}get index(){return this.type===Ot.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new we(e)}}class So{constructor(e,t=0,i=!1,s=j.FLOAT,n,o,a,h=1){this.buffer=e,this.size=t,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(e,t,i,s,n){return new So(e,t,i,s,n)}}const Gx={Float32Array,Uint32Array,Int32Array,Uint8Array};function zx(r,e){let t=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=e[h],t+=r[h].length;const n=new ArrayBuffer(t*4);let o=null,a=0;for(let h=0;h<r.length;h++){const u=e[h],d=r[h],l=qf(d);s[l]||(s[l]=new Gx[l](n)),o=s[l];for(let c=0;c<d.length;c++){const f=(c/u|0)*i+a,p=c%u;o[f+p]=d[c]}a+=u}return new Float32Array(n)}const Gu={5126:4,5123:2,5121:1};let Hx=0;const Vx={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Ti{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=Hx++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new _t("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,s=!1,n,o,a,h=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof we||(t instanceof Array&&(t=new Float32Array(t)),t=new we(t));const u=e.split("|");if(u.length>1){for(let l=0;l<u.length;l++)this.addAttribute(u[l],t,i,s,n);return this}let d=this.buffers.indexOf(t);return d===-1&&(this.buffers.push(t),d=this.buffers.length-1),this.attributes[e]=new So(d,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof we||(e instanceof Array&&(e=new Uint16Array(e)),e=new we(e)),e.type=Ot.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const e=[],t=[],i=new we;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];e.push(o.data),t.push(n.size*Gu[n.type]/4),n.buffer=0}for(i.data=zx(e,t),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const e in this.attributes){const t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const e=new Ti;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new we(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new So(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=Ot.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new Ti,i=[],s=[],n=[];let o;for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new Vx[qf(o.buffers[a].data)](s[a]),t.buffers[a]=new we(i[a]);for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(t.attributes=o.attributes,o.indexBuffer){t.indexBuffer=t.buffers[o.buffers.indexOf(o.indexBuffer)],t.indexBuffer.type=Ot.ELEMENT_ARRAY_BUFFER;let a=0,h=0,u=0,d=0;for(let l=0;l<o.buffers.length;l++)if(o.buffers[l]!==o.indexBuffer){d=l;break}for(const l in o.attributes){const c=o.attributes[l];(c.buffer|0)===d&&(h+=c.size*Gu[c.type]/4)}for(let l=0;l<e.length;l++){const c=e[l].indexBuffer.data;for(let f=0;f<c.length;f++)t.indexBuffer.data[f+u]+=a;a+=e[l].buffers[d].data.length/h,u+=c.length}}return t}}class Kf extends Ti{constructor(e=!1){super(),this._buffer=new we(null,e,!1),this._indexBuffer=new we(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,j.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,j.FLOAT).addAttribute("aColor",this._buffer,4,!0,j.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,j.FLOAT).addIndex(this._indexBuffer)}}const Eo=Math.PI*2,Wx=180/Math.PI,$x=Math.PI/180;var Oe=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Oe||{});class ie{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new ie(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}}ie.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const wn=[new ie,new ie,new ie,new ie];class K{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Oe.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new K(0,0,0,0)}clone(){return new K(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){const T=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=T)return!1;const M=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>M}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=wn[0].set(e.left,e.top),h=wn[1].set(e.left,e.bottom),u=wn[2].set(e.right,e.top),d=wn[3].set(e.right,e.bottom);if(u.x<=a.x||h.y<=a.y)return!1;const l=Math.sign(t.a*t.d-t.b*t.c);if(l===0||(t.apply(a,a),t.apply(h,h),t.apply(u,u),t.apply(d,d),Math.max(a.x,h.x,u.x,d.x)<=i||Math.min(a.x,h.x,u.x,d.x)>=s||Math.max(a.y,h.y,u.y,d.y)<=n||Math.min(a.y,h.y,u.y,d.y)>=o))return!1;const c=l*(h.y-a.y),f=l*(a.x-h.x),p=c*i+f*n,g=c*s+f*n,m=c*i+f*o,_=c*s+f*o;if(Math.max(p,g,m,_)<=c*a.x+f*a.y||Math.min(p,g,m,_)>=c*d.x+f*d.y)return!1;const v=l*(a.y-u.y),x=l*(u.x-a.x),b=v*i+x*n,w=v*s+x*n,C=v*i+x*o,S=v*s+x*o;return!(Math.max(b,w,C,S)<=v*a.x+x*a.y||Math.min(b,w,C,S)>=v*d.x+x*d.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(e=1,t=.001){const i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=n-s,this}}K.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Yo{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Oe.CIRC}clone(){return new Yo(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-e,n=this.y-t;return s*=s,n*=n,s+n<=i}getBounds(){return new K(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Yo.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class qo{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Oe.ELIP}clone(){return new qo(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new K(this.x-this.width,this.y-this.height,this.width,this.height)}}qo.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Qi{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const i=[];for(let s=0,n=t.length;s<n;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.type=Oe.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new Qi(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],u=this.points[o*2],d=this.points[o*2+1];h>t!=d>t&&e<(u-a)*((t-h)/(d-h))+a&&(i=!i)}return i}}Qi.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};class Zo{constructor(e=0,t=0,i=0,s=0,n=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=n,this.type=Oe.RREC}clone(){return new Zo(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),n=t-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=e-(this.x+this.width-i),s*s+n*n<=o)||(n=t-(this.y+this.height-i),s*s+n*n<=o)||(s=e-(this.x+i),s*s+n*n<=o))return!0}return!1}}Zo.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class de{constructor(e=1,t=0,i=0,s=1,n=0,o=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,n,o){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,t){t=t||new ie;const i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ie;const i=1/(this.a*this.d+this.c*-this.b),s=e.x,n=e.y;return t.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.a,n=this.c,o=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=n*t-this.d*i,this.d=n*i+this.d*t,this.tx=o*t-this.ty*i,this.ty=o*i+this.ty*t,this}append(e){const t=this.a,i=this.b,s=this.c,n=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*n,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*n,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*n+this.ty,this}setTransform(e,t,i,s,n,o,a,h,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,i=this.b,s=this.c,n=this.d,o=e.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,t),u=Math.abs(a+h);return u<1e-5||Math.abs(Eo-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+n*n),e.position.x=this.tx+(o.x*t+o.y*s),e.position.y=this.ty+(o.x*i+o.y*n),e}invert(){const e=this.a,t=this.b,i=this.c,s=this.d,n=this.tx,o=e*s-t*i;return this.a=s/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(e*this.ty-t*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new de;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new de}static get TEMP_MATRIX(){return new de}}de.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Ui=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Gi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],zi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Hi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],zl=[],Qf=[],An=Math.sign;function Xx(){for(let r=0;r<16;r++){const e=[];zl.push(e);for(let t=0;t<16;t++){const i=An(Ui[r]*Ui[t]+zi[r]*Gi[t]),s=An(Gi[r]*Ui[t]+Hi[r]*Gi[t]),n=An(Ui[r]*zi[t]+zi[r]*Hi[t]),o=An(Gi[r]*zi[t]+Hi[r]*Hi[t]);for(let a=0;a<16;a++)if(Ui[a]===i&&Gi[a]===s&&zi[a]===n&&Hi[a]===o){e.push(a);break}}}for(let r=0;r<16;r++){const e=new de;e.set(Ui[r],Gi[r],zi[r],Hi[r],0,0),Qf.push(e)}}Xx();const me={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ui[r],uY:r=>Gi[r],vX:r=>zi[r],vY:r=>Hi[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>zl[r][e],sub:(r,e)=>zl[r][me.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?me.S:me.N:Math.abs(e)*2<=Math.abs(r)?r>0?me.E:me.W:e>0?r>0?me.SE:me.SW:r>0?me.NE:me.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{const s=Qf[me.inv(e)];s.tx=t,s.ty=i,r.append(s)}};class Kt{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new Kt(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}}Kt.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Hl=class{constructor(){this.worldTransform=new de,this.localTransform=new de,this.position=new Kt(this.onChange,this,0,0),this.scale=new Kt(this.onChange,this,1,1),this.pivot=new Kt(this.onChange,this,0,0),this.skew=new Kt(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Hl.IDENTITY=new Hl;let Yh=Hl;Yh.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var jx=`varying vec2 vTextureCoord;
|
|
3697
|
+
Deprecated since v${r}`),console.warn(i))),Su[e]=!0}function ht(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function _s(r){return r.split("?")[0].split("#")[0]}function dx(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fx(r,e,t){return r.replace(new RegExp(dx(e),"g"),t)}function px(r,e){let t="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",i=0):(t=t.slice(0,h),i=t.length-1-t.lastIndexOf("/")),s=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,s=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+=`/${r.slice(s+1,a)}`:t=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}const Me={toPosix(r){return fx(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ht(r),r=this.toPosix(r);const e=/^file:\/\/\//.exec(r);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(r);return t?t[0]:""},toAbsolute(r,e,t){if(ht(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=_s(this.toPosix(e??V.ADAPTER.getBaseUrl())),s=_s(this.toPosix(t??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Me.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ht(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let e="";const t=r.startsWith("/");this.hasProtocol(r)&&(e=this.rootname(r),r=r.slice(e.length));const i=r.endsWith("/");return r=px(r,!1),r.length>0&&i&&(r+="/"),t?`/${r}`:e+r},isAbsolute(r){return ht(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){const i=r[t];if(ht(i),i.length>0)if(e===void 0)e=i;else{const s=r[t-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(ht(r),r.length===0)return".";r=this.toPosix(r);let e=r.charCodeAt(0);const t=e===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(e=r.charCodeAt(a),e===47){if(!s){i=a;break}}else s=!1;return i===-1?t?"/":this.isUrl(o)?n+r:n:t&&i===1?"//":n+r.slice(0,i)},rootname(r){ht(r),r=this.toPosix(r);let e="";if(r.startsWith("/")?e="/":e=this.getProtocol(r),this.isUrl(r)){const t=r.indexOf("/",e.length);t!==-1?e=r.slice(0,t):e=r,e.endsWith("/")||(e+="/")}return e},basename(r,e){ht(r),e&&ht(e),r=_s(this.toPosix(r));let t=0,i=-1,s=!0,n;if(e!==void 0&&e.length>0&&e.length<=r.length){if(e.length===r.length&&e===r)return"";let o=e.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){t=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===e.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=r.length),r.slice(t,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){t=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(t,i)},extname(r){ht(r),r=_s(this.toPosix(r));let e=-1,t=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){t=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?e===-1?e=o:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||i===-1||n===0||n===1&&e===i-1&&e===t+1?"":r.slice(e,i)},parse(r){ht(r);const e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;r=_s(this.toPosix(r));let t=r.charCodeAt(0);const i=this.isAbsolute(r);let s;e.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,u=r.length-1,d=0;for(;u>=s;--u){if(t=r.charCodeAt(u),t===47){if(!h){o=u+1;break}continue}a===-1&&(h=!1,a=u+1),t===46?n===-1?n=u:d!==1&&(d=1):n!==-1&&(d=-1)}return n===-1||a===-1||d===0||d===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?e.base=e.name=r.slice(1,a):e.base=e.name=r.slice(o,a)):(o===0&&i?(e.name=r.slice(1,n),e.base=r.slice(1,a)):(e.name=r.slice(o,n),e.base=r.slice(o,a)),e.ext=r.slice(n,a)),e.dir=this.dirname(r),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let Ta;async function mx(){return Ta??(Ta=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return je.UNPACK;const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return je.UNPACK;const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(t),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?je.PMA:je.UNPACK})()),Ta}let Sa;function gx(){return typeof Sa>"u"&&(Sa=function(){var e;const r={stencil:!0,failIfMajorPerformanceCaveat:V.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!V.ADAPTER.getWebGLRenderingContext())return!1;const t=V.ADAPTER.createCanvas();let i=t.getContext("webgl",r)||t.getContext("experimental-webgl",r);const s=!!((e=i==null?void 0:i.getContextAttributes())!=null&&e.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Sa}var _x={grad:.9,turn:360,rad:360/(2*Math.PI)},Ht=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Re=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*r)/t+0},it=function(r,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),r>t?t:r>e?r:e},Wf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Eu=function(r){return{r:it(r.r,0,255),g:it(r.g,0,255),b:it(r.b,0,255),a:it(r.a)}},Ea=function(r){return{r:Re(r.r),g:Re(r.g),b:Re(r.b),a:Re(r.a,3)}},yx=/^#([0-9a-f]{3,8})$/i,wn=function(r){var e=r.toString(16);return e.length<2?"0"+e:e},$f=function(r){var e=r.r,t=r.g,i=r.b,s=r.a,n=Math.max(e,t,i),o=n-Math.min(e,t,i),a=o?n===e?(t-i)/o:n===t?2+(i-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Xf=function(r){var e=r.h,t=r.s,i=r.v,s=r.a;e=e/360*6,t/=100,i/=100;var n=Math.floor(e),o=i*(1-t),a=i*(1-(e-n)*t),h=i*(1-(1-e+n)*t),u=n%6;return{r:255*[i,a,o,o,h,i][u],g:255*[h,i,i,a,o,o][u],b:255*[o,o,h,i,i,a][u],a:s}},Cu=function(r){return{h:Wf(r.h),s:it(r.s,0,100),l:it(r.l,0,100),a:it(r.a)}},Mu=function(r){return{h:Re(r.h),s:Re(r.s),l:Re(r.l),a:Re(r.a,3)}},Iu=function(r){return Xf((t=(e=r).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},Vs=function(r){return{h:(e=$f(r)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},vx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ax=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dl={string:[[function(r){var e=yx.exec(r);return e?(r=e[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?Re(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?Re(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var e=bx.exec(r)||Ax.exec(r);return e?e[2]!==e[4]||e[4]!==e[6]?null:Eu({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(r){var e=vx.exec(r)||xx.exec(r);if(!e)return null;var t,i,s=Cu({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(_x[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Iu(s)},"hsl"]],object:[[function(r){var e=r.r,t=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ht(e)&&Ht(t)&&Ht(i)?Eu({r:Number(e),g:Number(t),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var e=r.h,t=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ht(e)||!Ht(t)||!Ht(i))return null;var o=Cu({h:Number(e),s:Number(t),l:Number(i),a:Number(n)});return Iu(o)},"hsl"],[function(r){var e=r.h,t=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ht(e)||!Ht(t)||!Ht(i))return null;var o=function(a){return{h:Wf(a.h),s:it(a.s,0,100),v:it(a.v,0,100),a:it(a.a)}}({h:Number(e),s:Number(t),v:Number(i),a:Number(n)});return Xf(o)},"hsv"]]},Pu=function(r,e){for(var t=0;t<e.length;t++){var i=e[t][0](r);if(i)return[i,e[t][1]]}return[null,void 0]},Tx=function(r){return typeof r=="string"?Pu(r.trim(),Dl.string):typeof r=="object"&&r!==null?Pu(r,Dl.object):[null,void 0]},Ca=function(r,e){var t=Vs(r);return{h:t.h,s:it(t.s+100*e,0,100),l:t.l,a:t.a}},Ma=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ru=function(r,e){var t=Vs(r);return{h:t.h,s:t.s,l:it(t.l+100*e,0,100),a:t.a}},Bl=function(){function r(e){this.parsed=Tx(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return Re(Ma(this.rgba),2)},r.prototype.isDark=function(){return Ma(this.rgba)<.5},r.prototype.isLight=function(){return Ma(this.rgba)>=.5},r.prototype.toHex=function(){return e=Ea(this.rgba),t=e.r,i=e.g,s=e.b,o=(n=e.a)<1?wn(Re(255*n)):"","#"+wn(t)+wn(i)+wn(s)+o;var e,t,i,s,n,o},r.prototype.toRgb=function(){return Ea(this.rgba)},r.prototype.toRgbString=function(){return e=Ea(this.rgba),t=e.r,i=e.g,s=e.b,(n=e.a)<1?"rgba("+t+", "+i+", "+s+", "+n+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,n},r.prototype.toHsl=function(){return Mu(Vs(this.rgba))},r.prototype.toHslString=function(){return e=Mu(Vs(this.rgba)),t=e.h,i=e.s,s=e.l,(n=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+n+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,n},r.prototype.toHsv=function(){return e=$f(this.rgba),{h:Re(e.h),s:Re(e.s),v:Re(e.v),a:Re(e.a,3)};var e},r.prototype.invert=function(){return St({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},r.prototype.saturate=function(e){return e===void 0&&(e=.1),St(Ca(this.rgba,e))},r.prototype.desaturate=function(e){return e===void 0&&(e=.1),St(Ca(this.rgba,-e))},r.prototype.grayscale=function(){return St(Ca(this.rgba,-1))},r.prototype.lighten=function(e){return e===void 0&&(e=.1),St(Ru(this.rgba,e))},r.prototype.darken=function(e){return e===void 0&&(e=.1),St(Ru(this.rgba,-e))},r.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},r.prototype.alpha=function(e){return typeof e=="number"?St({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Re(this.rgba.a,3);var t},r.prototype.hue=function(e){var t=Vs(this.rgba);return typeof e=="number"?St({h:e,s:t.s,l:t.l,a:t.a}):Re(t.h)},r.prototype.isEqual=function(e){return this.toHex()===St(e).toHex()},r}(),St=function(r){return r instanceof Bl?r:new Bl(r)},Du=[],Sx=function(r){r.forEach(function(e){Du.indexOf(e)<0&&(e(Bl,Dl),Du.push(e))})};function Ex(r,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in t)i[t[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,u=i[this.toHex()];if(u)return u;if(o!=null&&o.closest){var d=this.toRgb(),l=1/0,c="black";if(!n.length)for(var f in t)n[f]=new r(t[f]).toRgb();for(var p in t){var g=(a=d,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<l&&(l=g,c=p)}return c}},e.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":t[a];return h?new r(h).toRgb():null},"name"])}Sx([Ex]);const Mr=class so{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof so)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){const i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,n)=>s===t[n]);if(e!==null&&t!==null){const s=Object.keys(e),n=Object.keys(t);return s.length!==n.length?!1:s.every(o=>e[o]===t[o])}return e===t}toRgba(){const[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){const[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){const[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){const[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];const[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,i,s,n]=so.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,n=n*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+n}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){const[t,i,s]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,i,s,n]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=n,e}normalize(e){let t,i,s,n;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,s,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,s,n=255]=e,t/=255,i/=255,s/=255,n/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=so.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=St(e);o.isValid()&&({r:t,g:i,b:s,a:n}=o.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);const[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,n)=>{e[n]=Math.min(Math.max(s,t),i)}),e)}};Mr.shared=new Mr,Mr.temp=new Mr,Mr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ue=Mr;function Cx(r){return J("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),ue.shared.setValue(r).toHex()}function Mx(r){return J("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),ue.shared.setValue(r).toNumber()}function Ix(){const r=[],e=[];for(let i=0;i<32;i++)r[i]=i,e[i]=i;r[Y.NORMAL_NPM]=Y.NORMAL,r[Y.ADD_NPM]=Y.ADD,r[Y.SCREEN_NPM]=Y.SCREEN,e[Y.NORMAL]=Y.NORMAL_NPM,e[Y.ADD]=Y.ADD_NPM,e[Y.SCREEN]=Y.SCREEN_NPM;const t=[];return t.push(e),t.push(r),t}const jf=Ix();function Yf(r,e){return jf[e?1:0][r]}function Px(r,e=null){const t=r*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i<t;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}function qf(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function To(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Bu(r){return!(r&r-1)&&!!r}function Fu(r){let e=(r>65535?1:0)<<4;r>>>=e;let t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function Wr(r,e,t){const i=r.length;let s;if(e>=i||t===0)return;t=e+t>i?i-e:t;const n=i-t;for(s=e;s<n;++s)r[s]=r[s+t];r.length=n}function vi(r){return r===0?0:r<0?-1:1}let Rx=0;function tr(){return++Rx}const Fl=class{constructor(r,e,t,i){this.left=r,this.top=e,this.right=t,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Fl.EMPTY=new Fl(0,0,0,0);let Lu=Fl;const Ou={},Et=Object.create(null),oi=Object.create(null);class Dx{constructor(e,t,i){this._canvas=V.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||V.RESOLUTION,this.resize(e,t)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(e,t){this._checkDestroyed(),this._canvas.width=Math.round(e*this.resolution),this._canvas.height=Math.round(t*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(e){this._checkDestroyed(),this._canvas.width=Math.round(e)}get height(){return this._checkDestroyed(),this._canvas.height}set height(e){this._checkDestroyed(),this._canvas.height=Math.round(e)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function ku(r,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Nu(r,e,t,i,s){const n=4*e;for(let o=i,a=i*n+4*t;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function Bx(r){const{width:e,height:t}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,e,t).data;let n=0,o=0,a=e-1,h=t-1;for(;o<t&&ku(s,e,o);)++o;if(o===t)return Lu.EMPTY;for(;ku(s,e,h);)--h;for(;Nu(s,e,n,o,h);)++n;for(;Nu(s,e,a,o,h);)--a;return++a,++h,new Lu(n,o,a,h)}function Fx(r){const e=Bx(r),{width:t,height:i}=e;let s=null;if(!e.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(e.left,e.top,t,i)}return{width:t,height:i,data:s}}function Lx(r,e=globalThis.location){if(r.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function ei(r,e=1){var i;const t=(i=V.RETINA_PREFIX)==null?void 0:i.exec(r);return t?parseFloat(t[1]):e}var U=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(U||{});const Ll=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Uu=(r,e)=>Ll(r).priority??e,$={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Ll).forEach(e=>{e.type.forEach(t=>{var i,s;return(s=(i=this._removeHandlers)[t])==null?void 0:s.call(i,e)})}),this},add(...r){return r.map(Ll).forEach(e=>{e.type.forEach(t=>{var n,o;const i=this._addHandlers,s=this._queue;i[t]?(n=i[t])==null||n.call(i,e):(s[t]=s[t]||[],(o=s[t])==null||o.push(e))})}),this},handle(r,e,t){var o;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(a=>e(a)),delete n[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,n)=>Uu(n,t)-Uu(s,t)))},i=>{const s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};class Ol{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}const Ox=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
3698
|
+
`);function kx(r){let e="";for(let t=0;t<r;++t)t>0&&(e+=`
|
|
3699
|
+
else `),t<r-1&&(e+=`if(test == ${t}.0){}`);return e}function Nx(r,e){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=Ox.replace(/%forloop%/gi,kx(r));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))r=r/2|0;else break}return r}const Ia=0,Pa=1,Ra=2,Da=3,Ba=4,Fa=5;class Gt{constructor(){this.data=0,this.blendMode=Y.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ia)}set blend(e){!!(this.data&1<<Ia)!==e&&(this.data^=1<<Ia)}get offsets(){return!!(this.data&1<<Pa)}set offsets(e){!!(this.data&1<<Pa)!==e&&(this.data^=1<<Pa)}get culling(){return!!(this.data&1<<Ra)}set culling(e){!!(this.data&1<<Ra)!==e&&(this.data^=1<<Ra)}get depthTest(){return!!(this.data&1<<Da)}set depthTest(e){!!(this.data&1<<Da)!==e&&(this.data^=1<<Da)}get depthMask(){return!!(this.data&1<<Fa)}set depthMask(e){!!(this.data&1<<Fa)!==e&&(this.data^=1<<Fa)}get clockwiseFrontFace(){return!!(this.data&1<<Ba)}set clockwiseFrontFace(e){!!(this.data&1<<Ba)!==e&&(this.data^=1<<Ba)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==Y.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new Gt;return e.depthTest=!1,e.blend=!0,e}}Gt.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const kl=[];function Zf(r,e){if(!r)return null;let t="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(t=i[1].toLowerCase())}for(let i=kl.length-1;i>=0;--i){const s=kl[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class _t{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:u,items:d}=this;this._aliasCount++;for(let l=0,c=d.length;l<c;l++)d[l][u](e,t,i,s,n,o,a,h);return d===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(_t.prototype,{dispatch:{value:_t.prototype.emit},run:{value:_t.prototype.emit}});class Ks{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new _t("setRealSize"),this.onUpdate=new _t("update"),this.onError=new _t("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}}class Xo extends Ks{constructor(e,t){const{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){const s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===je.UNPACK);const n=t.realWidth,o=t.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(t.target,0,0,0,n,o,t.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(t.target,0,i.internalFormat,n,o,0,t.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}const Ux={scaleMode:qt.NEAREST,alphaMode:je.NPM},Nl=class Ir extends rn{constructor(e=null,t=null){super(),t=Object.assign({},Ir.defaultOptions,t);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:u,format:d,type:l,target:c,resolution:f,resourceOptions:p}=t;e&&!(e instanceof Ks)&&(e=Zf(e,p),e.internal=!0),this.resolution=f||V.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=u,this._scaleMode=o,this.format=d,this.type=l,this.target=c,this.alphaMode=i,this.uid=tr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Bu(this.realWidth)&&Bu(this.realHeight)}setResolution(e){const t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete oi[this.cacheId],delete Et[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ir.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,i=V.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${tr()}`}n=e._pixiId}let o=oi[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Ir(e,t),o.cacheId=n,Ir.addToCache(o,n)),o}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);const n=new Xo(e,{width:t,height:i,...s==null?void 0:s.resourceOptions});let o,a;return e instanceof Float32Array?(o=O.RGBA,a=j.FLOAT):e instanceof Int32Array?(o=O.RGBA_INTEGER,a=j.INT):e instanceof Uint32Array?(o=O.RGBA_INTEGER,a=j.UNSIGNED_INT):e instanceof Int16Array?(o=O.RGBA_INTEGER,a=j.SHORT):e instanceof Uint16Array?(o=O.RGBA_INTEGER,a=j.UNSIGNED_SHORT):e instanceof Int8Array?(o=O.RGBA,a=j.BYTE):(o=O.RGBA,a=j.UNSIGNED_BYTE),n.internal=!0,new Ir(n,Object.assign({},Ux,{type:a,format:o},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),oi[t]&&oi[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),oi[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=oi[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete oi[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete oi[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};Nl.defaultOptions={mipmap:Ut.POW2,anisotropicLevel:0,scaleMode:qt.LINEAR,wrapMode:wi.CLAMP,alphaMode:je.UNPACK,target:zr.TEXTURE_2D,format:O.RGBA,type:j.UNSIGNED_BYTE},Nl._globalBatch=0;let Z=Nl;class Ul{constructor(){this.texArray=null,this.blend=0,this.type=Ft.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Gx=0;class we{constructor(e,t=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=Gx++,this.disposeRunner=new _t("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?Ot.ELEMENT_ARRAY_BUFFER:Ot.ARRAY_BUFFER}get index(){return this.type===Ot.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new we(e)}}class So{constructor(e,t=0,i=!1,s=j.FLOAT,n,o,a,h=1){this.buffer=e,this.size=t,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(e,t,i,s,n){return new So(e,t,i,s,n)}}const zx={Float32Array,Uint32Array,Int32Array,Uint8Array};function Hx(r,e){let t=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=e[h],t+=r[h].length;const n=new ArrayBuffer(t*4);let o=null,a=0;for(let h=0;h<r.length;h++){const u=e[h],d=r[h],l=qf(d);s[l]||(s[l]=new zx[l](n)),o=s[l];for(let c=0;c<d.length;c++){const f=(c/u|0)*i+a,p=c%u;o[f+p]=d[c]}a+=u}return new Float32Array(n)}const Gu={5126:4,5123:2,5121:1};let Vx=0;const Wx={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Ti{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=Vx++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new _t("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,s=!1,n,o,a,h=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof we||(t instanceof Array&&(t=new Float32Array(t)),t=new we(t));const u=e.split("|");if(u.length>1){for(let l=0;l<u.length;l++)this.addAttribute(u[l],t,i,s,n);return this}let d=this.buffers.indexOf(t);return d===-1&&(this.buffers.push(t),d=this.buffers.length-1),this.attributes[e]=new So(d,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof we||(e instanceof Array&&(e=new Uint16Array(e)),e=new we(e)),e.type=Ot.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const e=[],t=[],i=new we;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];e.push(o.data),t.push(n.size*Gu[n.type]/4),n.buffer=0}for(i.data=Hx(e,t),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const e in this.attributes){const t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const e=new Ti;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new we(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new So(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=Ot.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new Ti,i=[],s=[],n=[];let o;for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new Wx[qf(o.buffers[a].data)](s[a]),t.buffers[a]=new we(i[a]);for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(t.attributes=o.attributes,o.indexBuffer){t.indexBuffer=t.buffers[o.buffers.indexOf(o.indexBuffer)],t.indexBuffer.type=Ot.ELEMENT_ARRAY_BUFFER;let a=0,h=0,u=0,d=0;for(let l=0;l<o.buffers.length;l++)if(o.buffers[l]!==o.indexBuffer){d=l;break}for(const l in o.attributes){const c=o.attributes[l];(c.buffer|0)===d&&(h+=c.size*Gu[c.type]/4)}for(let l=0;l<e.length;l++){const c=e[l].indexBuffer.data;for(let f=0;f<c.length;f++)t.indexBuffer.data[f+u]+=a;a+=e[l].buffers[d].data.length/h,u+=c.length}}return t}}class Kf extends Ti{constructor(e=!1){super(),this._buffer=new we(null,e,!1),this._indexBuffer=new we(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,j.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,j.FLOAT).addAttribute("aColor",this._buffer,4,!0,j.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,j.FLOAT).addIndex(this._indexBuffer)}}const Eo=Math.PI*2,$x=180/Math.PI,Xx=Math.PI/180;var Oe=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Oe||{});class ie{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new ie(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}}ie.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const An=[new ie,new ie,new ie,new ie];class K{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Oe.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new K(0,0,0,0)}clone(){return new K(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){const T=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=T)return!1;const M=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>M}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=An[0].set(e.left,e.top),h=An[1].set(e.left,e.bottom),u=An[2].set(e.right,e.top),d=An[3].set(e.right,e.bottom);if(u.x<=a.x||h.y<=a.y)return!1;const l=Math.sign(t.a*t.d-t.b*t.c);if(l===0||(t.apply(a,a),t.apply(h,h),t.apply(u,u),t.apply(d,d),Math.max(a.x,h.x,u.x,d.x)<=i||Math.min(a.x,h.x,u.x,d.x)>=s||Math.max(a.y,h.y,u.y,d.y)<=n||Math.min(a.y,h.y,u.y,d.y)>=o))return!1;const c=l*(h.y-a.y),f=l*(a.x-h.x),p=c*i+f*n,g=c*s+f*n,m=c*i+f*o,_=c*s+f*o;if(Math.max(p,g,m,_)<=c*a.x+f*a.y||Math.min(p,g,m,_)>=c*d.x+f*d.y)return!1;const v=l*(a.y-u.y),x=l*(u.x-a.x),b=v*i+x*n,w=v*s+x*n,C=v*i+x*o,S=v*s+x*o;return!(Math.max(b,w,C,S)<=v*a.x+x*a.y||Math.min(b,w,C,S)>=v*d.x+x*d.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(e=1,t=.001){const i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=n-s,this}}K.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class jo{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Oe.CIRC}clone(){return new jo(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-e,n=this.y-t;return s*=s,n*=n,s+n<=i}getBounds(){return new K(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}jo.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Yo{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Oe.ELIP}clone(){return new Yo(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new K(this.x-this.width,this.y-this.height,this.width,this.height)}}Yo.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Qi{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const i=[];for(let s=0,n=t.length;s<n;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.type=Oe.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new Qi(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],u=this.points[o*2],d=this.points[o*2+1];h>t!=d>t&&e<(u-a)*((t-h)/(d-h))+a&&(i=!i)}return i}}Qi.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};class qo{constructor(e=0,t=0,i=0,s=0,n=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=n,this.type=Oe.RREC}clone(){return new qo(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),n=t-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=e-(this.x+this.width-i),s*s+n*n<=o)||(n=t-(this.y+this.height-i),s*s+n*n<=o)||(s=e-(this.x+i),s*s+n*n<=o))return!0}return!1}}qo.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class de{constructor(e=1,t=0,i=0,s=1,n=0,o=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,n,o){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,t){t=t||new ie;const i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ie;const i=1/(this.a*this.d+this.c*-this.b),s=e.x,n=e.y;return t.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.a,n=this.c,o=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=n*t-this.d*i,this.d=n*i+this.d*t,this.tx=o*t-this.ty*i,this.ty=o*i+this.ty*t,this}append(e){const t=this.a,i=this.b,s=this.c,n=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*n,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*n,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*n+this.ty,this}setTransform(e,t,i,s,n,o,a,h,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,i=this.b,s=this.c,n=this.d,o=e.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,t),u=Math.abs(a+h);return u<1e-5||Math.abs(Eo-u)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+n*n),e.position.x=this.tx+(o.x*t+o.y*s),e.position.y=this.ty+(o.x*i+o.y*n),e}invert(){const e=this.a,t=this.b,i=this.c,s=this.d,n=this.tx,o=e*s-t*i;return this.a=s/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(e*this.ty-t*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new de;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new de}static get TEMP_MATRIX(){return new de}}de.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Ui=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Gi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],zi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Hi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Gl=[],Qf=[],Tn=Math.sign;function jx(){for(let r=0;r<16;r++){const e=[];Gl.push(e);for(let t=0;t<16;t++){const i=Tn(Ui[r]*Ui[t]+zi[r]*Gi[t]),s=Tn(Gi[r]*Ui[t]+Hi[r]*Gi[t]),n=Tn(Ui[r]*zi[t]+zi[r]*Hi[t]),o=Tn(Gi[r]*zi[t]+Hi[r]*Hi[t]);for(let a=0;a<16;a++)if(Ui[a]===i&&Gi[a]===s&&zi[a]===n&&Hi[a]===o){e.push(a);break}}}for(let r=0;r<16;r++){const e=new de;e.set(Ui[r],Gi[r],zi[r],Hi[r],0,0),Qf.push(e)}}jx();const me={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Ui[r],uY:r=>Gi[r],vX:r=>zi[r],vY:r=>Hi[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>Gl[r][e],sub:(r,e)=>Gl[r][me.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?me.S:me.N:Math.abs(e)*2<=Math.abs(r)?r>0?me.E:me.W:e>0?r>0?me.SE:me.SW:r>0?me.NE:me.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{const s=Qf[me.inv(e)];s.tx=t,s.ty=i,r.append(s)}};class Kt{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new Kt(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}}Kt.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const zl=class{constructor(){this.worldTransform=new de,this.localTransform=new de,this.position=new Kt(this.onChange,this,0,0),this.scale=new Kt(this.onChange,this,1,1),this.pivot=new Kt(this.onChange,this,0,0),this.skew=new Kt(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};zl.IDENTITY=new zl;let Yh=zl;Yh.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var Yx=`varying vec2 vTextureCoord;
|
|
3700
3700
|
|
|
3701
3701
|
uniform sampler2D uSampler;
|
|
3702
3702
|
|
|
3703
3703
|
void main(void){
|
|
3704
3704
|
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
3705
|
-
}`,
|
|
3705
|
+
}`,qx=`attribute vec2 aVertexPosition;
|
|
3706
3706
|
attribute vec2 aTextureCoord;
|
|
3707
3707
|
|
|
3708
3708
|
uniform mat3 projectionMatrix;
|
|
@@ -3713,7 +3713,7 @@ void main(void){
|
|
|
3713
3713
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
3714
3714
|
vTextureCoord = aTextureCoord;
|
|
3715
3715
|
}
|
|
3716
|
-
`;function zu(r,e,t){const i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function
|
|
3716
|
+
`;function zu(r,e,t){const i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}function La(r){const e=new Array(r);for(let t=0;t<e.length;t++)e[t]=!1;return e}function Jf(r,e){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return La(2*e);case"bvec3":return La(3*e);case"bvec4":return La(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const $r=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
|
|
3717
3717
|
if(uv["${r}"] !== ud["${r}"].value)
|
|
3718
3718
|
{
|
|
3719
3719
|
ud["${r}"].value = uv["${r}"]
|
|
@@ -3833,7 +3833,7 @@ void main(void){
|
|
|
3833
3833
|
cv[3] = v[3];
|
|
3834
3834
|
|
|
3835
3835
|
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
3836
|
-
}`}],
|
|
3836
|
+
}`}],Zx={float:`
|
|
3837
3837
|
if (cv !== v)
|
|
3838
3838
|
{
|
|
3839
3839
|
cu.value = v;
|
|
@@ -3969,7 +3969,7 @@ void main(void){
|
|
|
3969
3969
|
cu.value = v;
|
|
3970
3970
|
|
|
3971
3971
|
gl.uniform1i(location, v);
|
|
3972
|
-
}`},
|
|
3972
|
+
}`},Kx={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Qx(r,e){var i;const t=[`
|
|
3973
3973
|
var v = null;
|
|
3974
3974
|
var cv = null;
|
|
3975
3975
|
var cu = null;
|
|
@@ -3979,18 +3979,18 @@ void main(void){
|
|
|
3979
3979
|
renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
|
|
3980
3980
|
`):t.push(`
|
|
3981
3981
|
renderer.shader.syncUniformGroup(uv.${s}, syncData);
|
|
3982
|
-
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<$r.length;h++)if($r[h].test(n,o)){t.push($r[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?
|
|
3982
|
+
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<$r.length;h++)if($r[h].test(n,o)){t.push($r[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?Zx:Kx)[n.type].replace("location",`ud["${s}"].location`);t.push(`
|
|
3983
3983
|
cu = ud["${s}"];
|
|
3984
3984
|
cv = cu.value;
|
|
3985
3985
|
v = uv["${s}"];
|
|
3986
3986
|
${h};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
|
3987
|
-
`))}const ep={};let pr=ep;function
|
|
3987
|
+
`))}const ep={};let pr=ep;function Jx(){if(pr===ep||pr!=null&&pr.isContextLost()){const r=V.ADAPTER.createCanvas();let e;V.PREFER_ENV>=nr.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),pr=e}return pr}let Sn;function eb(){if(!Sn){Sn=et.MEDIUM;const r=Jx();if(r&&r.getShaderPrecisionFormat){const e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);e&&(Sn=e.precision?et.HIGH:et.MEDIUM)}}return Sn}function Hu(r,e){const t=r.getShaderSource(e).split(`
|
|
3988
3988
|
`).map((u,d)=>`${d}: ${u}`),i=r.getShaderInfoLog(e),s=i.split(`
|
|
3989
3989
|
`),n={},o=s.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!n[u]?(n[u]=!0,!0):!1),a=[""];o.forEach(u=>{t[u-1]=`%c${t[u-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=t.join(`
|
|
3990
|
-
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
3991
|
-
${r}`}else if(t!==et.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let
|
|
3990
|
+
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function tb(r,e,t,i){r.getProgramParameter(e,r.LINK_STATUS)||(r.getShaderParameter(t,r.COMPILE_STATUS)||Hu(r,t),r.getShaderParameter(i,r.COMPILE_STATUS)||Hu(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(e)))}const ib={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function tp(r){return ib[r]}let En=null;const Vu={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function ip(r,e){if(!En){const t=Object.keys(Vu);En={};for(let i=0;i<t.length;++i){const s=t[i];En[r[s]]=Vu[s]}}return En[e]}function Wu(r,e,t){if(r.substring(0,9)!=="precision"){let i=e;return e===et.HIGH&&t!==et.HIGH&&(i=et.MEDIUM),`precision ${i} float;
|
|
3991
|
+
${r}`}else if(t!==et.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let ys;function rb(){if(typeof ys=="boolean")return ys;try{ys=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ys=!1}return ys}let sb=0;const Cn={},Hl=class Pr{constructor(e,t,i="pixi-shader",s={}){this.extra={},this.id=sb++,this.vertexSrc=e||Pr.defaultVertexSrc,this.fragmentSrc=t||Pr.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Cn[i]?(Cn[i]++,i+=`-${Cn[i]}`):Cn[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
3992
3992
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
3993
|
-
${this.fragmentSrc}`,this.vertexSrc=Wu(this.vertexSrc,Pr.defaultVertexPrecision,et.HIGH),this.fragmentSrc=Wu(this.fragmentSrc,Pr.defaultFragmentPrecision,
|
|
3993
|
+
${this.fragmentSrc}`,this.vertexSrc=Wu(this.vertexSrc,Pr.defaultVertexPrecision,et.HIGH),this.fragmentSrc=Wu(this.fragmentSrc,Pr.defaultFragmentPrecision,eb())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return qx}static get defaultFragmentSrc(){return Yx}static from(e,t,i){const s=e+t;let n=Ou[s];return n||(Ou[s]=n=new Pr(e,t,i)),n}};Hl.defaultVertexPrecision=et.HIGH,Hl.defaultFragmentPrecision=Zt.apple.device?et.HIGH:et.MEDIUM;let Qt=Hl,nb=0;class yt{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=nb++,this.static=!!t,this.ubo=!!i,e instanceof we?(this.buffer=e,this.buffer.type=Ot.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new we(new Float32Array(1)),this.buffer.type=Ot.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(e,t,i){if(!this.ubo)this.uniforms[e]=new yt(t,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(e,t,i){return new yt(e,t,i)}static uboFrom(e,t){return new yt(e,t??!0,!0)}}class kt{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof yt?this.uniformGroup=t:this.uniformGroup=new yt(t):this.uniformGroup=new yt({}),this.disposeRunner=new _t("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(const i in t.uniforms){const s=t.uniforms[i];if(s.group===!0&&this.checkUniformExists(e,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(e,t,i){const s=Qt.from(e,t);return new kt(s,i)}}class ob{constructor(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},!t.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!t.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(e){if(!this.programCache[e]){const i=new Int32Array(e);for(let n=0;n<e;n++)i[n]=n;this.defaultGroupCache[e]=yt.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${e}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new Qt(this.vertexSrc,s)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new de,default:this.defaultGroupCache[e]};return new kt(this.programCache[e],t)}generateSampleSrc(e){let t="";t+=`
|
|
3994
3994
|
`,t+=`
|
|
3995
3995
|
`;for(let i=0;i<e;i++)i>0&&(t+=`
|
|
3996
3996
|
else `),i<e-1&&(t+=`if(vTextureId < ${i}.5)`),t+=`
|
|
@@ -3998,7 +3998,7 @@ else `),i<e-1&&(t+=`if(vTextureId < ${i}.5)`),t+=`
|
|
|
3998
3998
|
color = texture2D(uSamplers[${i}], vTextureCoord);`,t+=`
|
|
3999
3999
|
}`;return t+=`
|
|
4000
4000
|
`,t+=`
|
|
4001
|
-
`,t}}class
|
|
4001
|
+
`,t}}class Vl{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let e=0;e<this.count;e++)this.elements[e]=null;this.count=0}}function ab(){return!Zt.apple.device}function lb(r){let e=!0;const t=V.ADAPTER.getNavigator();if(Zt.tablet||Zt.phone){if(Zt.apple.device){const i=t.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(e=!1)}if(Zt.android.device){const i=t.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(e=!1)}}return e?r:4}class Zo{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}}var hb=`varying vec2 vTextureCoord;
|
|
4002
4002
|
varying vec4 vColor;
|
|
4003
4003
|
varying float vTextureId;
|
|
4004
4004
|
uniform sampler2D uSamplers[%count%];
|
|
@@ -4008,7 +4008,7 @@ void main(void){
|
|
|
4008
4008
|
%forloop%
|
|
4009
4009
|
gl_FragColor = color * vColor;
|
|
4010
4010
|
}
|
|
4011
|
-
`,
|
|
4011
|
+
`,cb=`precision highp float;
|
|
4012
4012
|
attribute vec2 aVertexPosition;
|
|
4013
4013
|
attribute vec2 aTextureCoord;
|
|
4014
4014
|
attribute vec4 aColor;
|
|
@@ -4029,14 +4029,14 @@ void main(void){
|
|
|
4029
4029
|
vTextureId = aTextureId;
|
|
4030
4030
|
vColor = aColor * tint;
|
|
4031
4031
|
}
|
|
4032
|
-
`;const
|
|
4032
|
+
`;const Is=class ut extends Zo{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=Kf,this.vertexSize=6,this.state=Gt.for2d(),this.size=ut.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??lb(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??ab(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return J("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return cb}static get defaultFragmentTemplate(){return hb}setShaderGenerator({vertex:e=ut.defaultVertexSrc,fragment:t=ut.defaultFragmentTemplate}={}){this.shaderGenerator=new ob(e,t)}contextChange(){const e=this.renderer.gl;V.PREFER_ENV===nr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),ut.defaultMaxTextures),this.maxTextures=Nx(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:t}=ut,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new Ul);for(;t.length<s;)t.push(new Vl);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:t}=this,i=ut._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++Z._globalBatch,h=0,u=i[0],d=0;s.copyBoundTextures(n,t);for(let l=0;l<this._bufferSize;++l){const c=e[l];e[l]=null,c._batchEnabled!==a&&(u.count>=t&&(s.boundArray(u,n,a,t),this.buildDrawCalls(u,d,l),d=l,u=i[++h],++a),c._batchEnabled=a,c.touched=o,u.elements[u.count++]=c)}u.count>0&&(s.boundArray(u,n,a,t),this.buildDrawCalls(u,d,this._bufferSize),++h,++a);for(let l=0;l<n.length;l++)n[l]=null;Z._globalBatch=a}buildDrawCalls(e,t,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=ut._drawCallPool;let u=this._dcIndex,d=this._aIndex,l=this._iIndex,c=h[u];c.start=this._iIndex,c.texArray=e;for(let f=t;f<i;++f){const p=s[f],g=p._texture.baseTexture,m=jf[g.alphaMode?1:0][p.blendMode];s[f]=null,t<f&&c.blend!==m&&(c.size=l-c.start,t=f,c=h[++u],c.texArray=e,c.start=l),this.packInterleavedGeometry(p,n,o,d,l),d+=p.vertexData.length/2*a,l+=p.indices.length,c.blend=m}t<i&&(c.size=l-c.start,++u),this._dcIndex=u,this._aIndex=d,this._iIndex=l}bindAndClearTexArray(e){const t=this.renderer.texture;for(let i=0;i<e.count;i++)t.bind(e.elements[i],e.ids[i]),e.elements[i]=null;e.count=0}updateGeometry(){const{_packedGeometries:e,_attributeBuffer:t,_indexBuffer:i}=this;ut.canUploadSameBuffer?(e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:t,state:i}=this.renderer,s=ut._drawCallPool;let n=null;for(let o=0;o<e;o++){const{texArray:a,type:h,size:u,start:d,blend:l}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=l,i.set(this.state),t.drawElements(h,u,t.UNSIGNED_SHORT,d*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ut.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(e){const t=To(Math.ceil(e/8)),i=Fu(t),s=t*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new Ol(s*this.vertexSize*4)),n}getIndexBuffer(e){const t=To(Math.ceil(e/12)),i=Fu(t),s=t*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(e,t,i,s,n){const{uint32View:o,float32View:a}=t,h=s/this.vertexSize,u=e.uvs,d=e.indices,l=e.vertexData,c=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),p=ue.shared.setValue(e._tintRGB).toPremultiplied(f,e._texture.baseTexture.alphaMode>0);for(let g=0;g<l.length;g+=2)a[s++]=l[g],a[s++]=l[g+1],a[s++]=u[g],a[s++]=u[g+1],o[s++]=p,a[s++]=c;for(let g=0;g<d.length;g++)i[n++]=h+d[g]}};Is.defaultBatchSize=4096,Is.extension={name:"batch",type:U.RendererPlugin},Is._drawCallPool=[],Is._textureArrayPool=[];let Vi=Is;$.add(Vi);var ub=`varying vec2 vTextureCoord;
|
|
4033
4033
|
|
|
4034
4034
|
uniform sampler2D uSampler;
|
|
4035
4035
|
|
|
4036
4036
|
void main(void){
|
|
4037
4037
|
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
4038
4038
|
}
|
|
4039
|
-
`,
|
|
4039
|
+
`,db=`attribute vec2 aVertexPosition;
|
|
4040
4040
|
|
|
4041
4041
|
uniform mat3 projectionMatrix;
|
|
4042
4042
|
|
|
@@ -4062,7 +4062,7 @@ void main(void)
|
|
|
4062
4062
|
gl_Position = filterVertexPosition();
|
|
4063
4063
|
vTextureCoord = filterTextureCoord();
|
|
4064
4064
|
}
|
|
4065
|
-
`;const $l=class Is extends kt{constructor(e,t,i){const s=Qt.from(e||Is.defaultVertexSrc,t||Is.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Is.defaultResolution,this.multisample=Is.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Gt}apply(e,t,i,s,n){e.applyFilter(this,t,i,s)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return ub}static get defaultFragmentSrc(){return cb}};$l.defaultResolution=1,$l.defaultMultisample=Te.NONE;let ze=$l;class Co{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ue(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:i,backgroundAlpha:s}=e,n=i??t;n!==void 0&&(this.color=n),this.alpha=s}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}}Co.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Co.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"background"};$.add(Co);class rp{constructor(e){this.renderer=e,this.emptyRenderer=new Ko(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){const{boundTextures:i}=this.renderer.texture;for(let s=t-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,i,s){const{elements:n,ids:o,count:a}=e;let h=0;for(let u=0;u<a;u++){const d=n[u],l=d._batchLocation;if(l>=0&&l<s&&t[l]===d){o[u]=l;continue}for(;h<s;){const c=t[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}o[u]=h,d._batchLocation=h,t[h]=d;break}}}destroy(){this.renderer=null}}rp.extension={type:U.RendererSystem,name:"batch"};$.add(rp);let $u=0;class Mo{constructor(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=$u++}init(e){if(e.context)this.initFromContext(e.context);else{const t=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,premultipliedAlpha:i,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=$u++,this.renderer.runners.contextChange.emit(e);const t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){const t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let i;if(V.PREFER_ENV>=nr.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){const t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Mo.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Mo.extension={type:U.RendererSystem,name:"context"};$.add(Mo);class Xl{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new _t("disposeFramebuffer"),this.multisample=Te.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new Z(null,{scaleMode:qt.NEAREST,resolution:1,mipmap:Ut.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Z(null,{scaleMode:qt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ut.OFF,format:O.DEPTH_COMPONENT,type:j.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(e/n,t/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class sp extends Z{constructor(e={}){if(typeof e=="number"){const t=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];e={width:t,height:i,scaleMode:s,resolution:n}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=Te.NONE),super(null,e),this.mipmap=Ut.OFF,this.valid=!0,this._clear=new ue([0,0,0,0]),this.framebuffer=new Xl(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t){this.framebuffer.resize(e*this.resolution,t*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class ti extends Zs{constructor(e){const t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,s=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=Fx(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,s){const n=e.gl,o=t.realWidth,a=t.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===je.UNPACK),!this.noSubImage&&t.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,t.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(t.target,0,i.internalFormat,t.format,i.type,s)),!0}update(){if(this.destroyed)return;const e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}}class np extends ti{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;ti.crossOrigin(i,e,t.crossorigin),i.src=e,e=i}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(t.createBitmap??V.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const t=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===je.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=t._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==t.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}}class qh{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,i){const s=t.width,n=t.height;if(i){const o=e.width/2/s,a=e.height/2/n,h=e.x/s+o,u=e.y/n+a;i=me.add(i,me.NW),this.x0=h+o*me.uX(i),this.y0=u+a*me.uY(i),i=me.add(i,2),this.x1=h+o*me.uX(i),this.y1=u+a*me.uY(i),i=me.add(i,2),this.x2=h+o*me.uX(i),this.y2=u+a*me.uY(i),i=me.add(i,2),this.x3=h+o*me.uX(i),this.y3=u+a*me.uY(i)}else this.x0=e.x/s,this.y0=e.y/n,this.x1=(e.x+e.width)/s,this.y1=e.y/n,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/n,this.x3=e.x/s,this.y3=(e.y+e.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}qh.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Xu=new qh;function Cn(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class W extends tn{constructor(e,t,i,s,n,o,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new K(0,0,1,1)),e instanceof W&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Xu,this.uvMatrix=null,this.orig=i||t,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new ie(o.x,o.y):new ie(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){const{resource:t}=this.baseTexture;t!=null&&t.url&&Et[t.url]&&W.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,W.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new W(this.baseTexture,!this.noFrame&&e,t,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Xu&&(this._uvs=new qh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=V.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else if(e instanceof Z){if(!e.cacheId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${a}-${tr()}`,Z.addToCache(e,e.cacheId)}n=e.cacheId}else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${tr()}`}n=e._pixiId}let o=Et[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(e instanceof Z)?(t.resolution||(t.resolution=ei(e)),o=new W(new Z(e,t)),o.baseTexture.cacheId=n,Z.addToCache(o.baseTexture,n),W.addToCache(o,n)):!o&&e instanceof Z&&(o=new W(e),W.addToCache(o,n)),o}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),s=W.from(e,Object.assign({resourceOptions:i},t),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new W(Z.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){const n=new Z(e,Object.assign({scaleMode:Z.defaultOptions.scaleMode,resolution:ei(t)},s)),{resource:o}=n;o instanceof np&&(o.url=t);const a=new W(n);return i||(i=t),Z.addToCache(a.baseTexture,i),W.addToCache(a,i),i!==t&&(Z.addToCache(a.baseTexture,t),W.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Et[t]&&Et[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Et[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Et[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete Et[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)Et[e.textureCacheIds[t]]===e&&delete Et[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;const{x:t,y:i,width:s,height:n}=e,o=t+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",u=`X: ${t} + ${s} = ${t+s} > ${this.baseTexture.width}`,d=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${u} ${h} ${d}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return W._EMPTY||(W._EMPTY=new W(new Z),Cn(W._EMPTY),Cn(W._EMPTY.baseTexture)),W._EMPTY}static get WHITE(){if(!W._WHITE){const e=V.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),W._WHITE=new W(Z.from(e)),Cn(W._WHITE),Cn(W._WHITE.baseTexture)}return W._WHITE}}class ar extends W{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,i=!0){const s=this.baseTexture.resolution,n=Math.round(e*s)/s,o=Math.round(t*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(e){const{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new ar(new sp(e))}}class op{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Te.NONE){const s=new sp(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ar(s)}getOptimalTexture(e,t,i=1,s=Te.NONE){let n;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=To(e),t=To(t),n=((e&65535)<<16|t&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(e,t,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(e,t,i){const s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||Te.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){const t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(const t in this.texturePool){const i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}op.SCREEN_KEY=-1;class db extends Ti{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class ap extends Ti{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new we(this.vertices),this.uvBuffer=new we(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+t.width/e.width,this.uvs[3]=s,this.uvs[4]=i+t.width/e.width,this.uvs[5]=s+t.height/e.height,this.uvs[6]=i,this.uvs[7]=s+t.height/e.height,i=t.x,s=t.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+t.width,this.vertices[3]=s,this.vertices[4]=i+t.width,this.vertices[5]=s+t.height,this.vertices[6]=i,this.vertices[7]=s+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class fb{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Te.NONE,this.sourceFrame=new K,this.destinationFrame=new K,this.bindingSourceFrame=new K,this.bindingDestinationFrame=new K,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Mn=[new ie,new ie,new ie,new ie],ka=new de;class lp{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new op,this.statePool=[],this.quad=new db,this.quadUv=new ap,this.tempRect=new K,this.activeState={},this.globalUniforms=new yt({outputFrame:new K,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){const i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new fb,o=i.renderTexture;let a,h;if(o.current){const m=o.current;a=m.resolution,h=m.multisample}else a=i.resolution,h=i.multisample;let u=t[0].resolution||a,d=t[0].multisample??h,l=t[0].padding,c=t[0].autoFit,f=t[0].legacy??!0;for(let m=1;m<t.length;m++){const _=t[m];u=Math.min(u,_.resolution||a),d=Math.min(d,_.multisample??h),l=this.useMaxPadding?Math.max(l,_.padding):l+_.padding,c=c&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=u,n.multisample=d,n.legacy=f,n.target=e,n.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),n.sourceFrame.pad(l);const p=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(ka.copyFrom(i.projection.transform).invert(),p),c?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,u,d),n.filters=t,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const g=this.tempRect;g.x=0,g.y=0,g.width=n.sourceFrame.width,g.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,g),i.framebuffer.clear(0,0,0,0)}pop(){const e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;const s=this.globalUniforms.uniforms;s.outputFrame=t.sourceFrame,s.resolution=t.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=t.destinationFrame.width,n[1]=t.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*t.resolution),o[1]=Math.round(n[1]*t.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=t.sourceFrame.width*n[2]-.5*o[2],a[3]=t.sourceFrame.height*n[3]-.5*o[3],t.legacy){const u=s.filterArea;u[0]=t.destinationFrame.width,u[1]=t.destinationFrame.height,u[2]=t.sourceFrame.x,u[3]=t.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,h.renderTexture,Rt.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let u=t.renderTexture,d=this.getOptimalFilterTexture(u.width,u.height,t.resolution);d.filterFrame=u.filterFrame;let l=0;for(l=0;l<i.length-1;++l){l===1&&t.multisample>1&&(d=this.getOptimalFilterTexture(u.width,u.height,t.resolution),d.filterFrame=u.filterFrame),i[l].apply(this,u,d,Rt.CLEAR,t);const c=u;u=d,d=c}i[l].apply(this,u,h.renderTexture,Rt.BLEND,t),l>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(u),this.returnFilterTexture(d)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Rt.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e==null?void 0:e.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,i.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(t===Rt.CLEAR||t===Rt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){const n=this.renderer;n.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ft.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ft.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=t._texture,o=e.set(s.width,0,0,s.height,i.x,i.y),a=t.worldTransform.copyTo(de.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(t.anchor.x,t.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,s=Te.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){const n=e;e=t,t=n}e=e||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||Te.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const i=Mn[0],s=Mn[1],n=Mn[2],o=Mn[3];i.set(t.left,t.top),s.set(t.left,t.bottom),n.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(i,i),e.apply(s,s),e.apply(n,n),e.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),u=Math.max(i.x,s.x,n.x,o.x),d=Math.max(i.y,s.y,n.y,o.y);t.x=a,t.y=h,t.width=u-a,t.height=d-h}roundFrame(e,t,i,s,n){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:u}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}n=n?ka.copyFrom(n):ka.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}}}lp.extension={type:U.RendererSystem,name:"filter"};$.add(lp);class pb{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Te.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const mb=new K;class hp{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Xl(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new K,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;V.PREFER_ENV===nr.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,i=0){const{gl:s}=this;if(e){const n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=i),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let o=0;o<e.colorTextures.length;o++){const a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){const o=t.width>>i,a=t.height>>i,h=o/t.width;this.setViewport(t.x*h,t.y*h,o,a)}else{const o=e.width>>i,a=e.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,s){const n=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==e||n.y!==t)&&(n.x=e,n.y=t,n.width=i,n.height=s,this.gl.viewport(e,t,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,i,s,n=yl.COLOR|yl.DEPTH){const{gl:o}=this;o.clearColor(e,t,i,s),o.clear(n)}initFramebuffer(e){const{gl:t}=this,i=new pb(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){const{gl:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=t.DEPTH_STENCIL:e.depth&&e.stencil?o=t.DEPTH24_STENCIL8:e.depth?o=t.DEPTH_COMPONENT24:o=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,o,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,o,e.width,e.height)}const s=e.colorTextures;let n=s.length;t.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){const{gl:i}=this,s=e.glFramebuffers[this.CONTEXT_UID],n=e.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const u=n[h],d=u.parentTextureArray||u;this.renderer.texture.bind(d,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,d._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,d._glTextures[this.CONTEXT_UID].texture,t),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){const h=e.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,u;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH_STENCIL):e.depth&&e.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH24_STENCIL8):e.depth?(h=i.DEPTH_ATTACHMENT,u=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,u=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,u,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let i=Te.NONE;if(e<=1||t===null)return i;for(let s=0;s<t.length;s++)if(t[s]<=e){i=t[s];break}return i===1&&(i=Te.NONE),i}blit(e,t,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!e){if(!h.msaaBuffer)return;const d=s.colorTextures[0];if(!d)return;h.blitFramebuffer||(h.blitFramebuffer=new Xl(s.width,s.height),h.blitFramebuffer.addColorTexture(0,d)),e=h.blitFramebuffer,e.colorTextures[0]!==d&&(e.colorTextures[0]=d,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}t||(t=mb,t.width=s.width,t.height=s.height),i||(i=t);const u=t.width===i.width&&t.height===i.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,u?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){const i=e.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(e);n>=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){const e=this.current;if(!e)return;const t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;const i=e.width,s=e.height,n=this.gl,o=t.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):e.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),t.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,t.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new K}destroy(){this.renderer=null}}hp.extension={type:U.RendererSystem,name:"framebuffer"};$.add(hp);const Na={5126:4,5123:2,5121:1};class cp{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;V.PREFER_ENV===nr.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),e.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),e.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:i}=this;let s=e.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[t.program.id]||this.initGeometryVao(e,t,n);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){const s=e.buffers[i];t.update(s)}}checkCompatibility(e,t){const i=e.attributes,s=t.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(e,t){const i=e.attributes,s=t.attributeData,n=["g",e.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(e,t,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=t.program;a.glPrograms[n]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,a);const h=this.getSignature(e,a),u=e.glVertexArrayObjects[this.CONTEXT_UID];let d=u[h];if(d)return u[a.id]=d,d;const l=e.buffers,c=e.attributes,f={},p={};for(const g in l)f[g]=0,p[g]=0;for(const g in c)!c[g].size&&a.attributeData[g]?c[g].size=a.attributeData[g].size:c[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),f[c[g].buffer]+=c[g].size*Na[c[g].type];for(const g in c){const m=c[g],_=m.size;m.stride===void 0&&(f[m.buffer]===_*Na[m.type]?m.stride=0:m.stride=f[m.buffer]),m.start===void 0&&(m.start=p[m.buffer],p[m.buffer]+=_*Na[m.type])}d=s.createVertexArray(),s.bindVertexArray(d);for(let g=0;g<l.length;g++){const m=l[g];o.bind(m),i&&m._glBuffers[n].refCount++}return this.activateVao(e,a),u[a.id]=d,u[h]=d,s.bindVertexArray(null),o.unbind(Ot.ARRAY_BUFFER),d}disposeGeometry(e,t){var a;if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];const i=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=e.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(e.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const u=n[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!t&&o.dispose(n[h],t))}if(!t){for(const h in i)if(h[0]==="g"){const u=i[h];this._activeVao===u&&this.unbind(),s.deleteVertexArray(u)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){const t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=e.buffers,a=e.attributes;e.indexBuffer&&n.bind(e.indexBuffer);let h=null;for(const u in a){const d=a[u],l=o[d.buffer],c=l._glBuffers[s];if(t.attributeData[u]){h!==c&&(n.bind(l),h=c);const f=t.attributeData[u].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,d.size,d.type||i.FLOAT,d.normalized,d.stride,d.start),d.instance)if(this.hasInstance)i.vertexAttribDivisor(f,d.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(e,t||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(e,t||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(e,i,t||o.getSize(),s||1):n.drawArrays(e,i,t||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}cp.extension={type:U.RendererSystem,name:"geometry"};$.add(cp);const ju=new de;class up{constructor(e,t){this._texture=e,this.mapCoord=new de,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const i=this.mapCoord;for(let s=0;s<e.length;s+=2){const n=e[s],o=e[s+1];t[s]=n*i.a+o*i.c+i.tx,t[s+1]=n*i.b+o*i.d+i.ty}return t}update(e){const t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;const i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=t.orig,n=t.trim;n&&(ju.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(ju));const o=t.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,u=this.clampOffset;return a[0]=(t._frame.x+h+u)/o.width,a[1]=(t._frame.y+h+u)/o.height,a[2]=(t._frame.x+t._frame.width-h+u)/o.width,a[3]=(t._frame.y+t._frame.height-h+u)/o.height,this.uClampOffset[0]=u/o.realWidth,this.uClampOffset[1]=u/o.realHeight,this.isSimple=t._frame.width===o.width&&t._frame.height===o.height&&t.rotate===0,!0}}var gb=`varying vec2 vMaskCoord;
|
|
4065
|
+
`;const Wl=class Ps extends kt{constructor(e,t,i){const s=Qt.from(e||Ps.defaultVertexSrc,t||Ps.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Ps.defaultResolution,this.multisample=Ps.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Gt}apply(e,t,i,s,n){e.applyFilter(this,t,i,s)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return db}static get defaultFragmentSrc(){return ub}};Wl.defaultResolution=1,Wl.defaultMultisample=Te.NONE;let ze=Wl;class Co{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ue(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:i,backgroundAlpha:s}=e,n=i??t;n!==void 0&&(this.color=n),this.alpha=s}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}}Co.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Co.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"background"};$.add(Co);class rp{constructor(e){this.renderer=e,this.emptyRenderer=new Zo(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){const{boundTextures:i}=this.renderer.texture;for(let s=t-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,i,s){const{elements:n,ids:o,count:a}=e;let h=0;for(let u=0;u<a;u++){const d=n[u],l=d._batchLocation;if(l>=0&&l<s&&t[l]===d){o[u]=l;continue}for(;h<s;){const c=t[h];if(c&&c._batchEnabled===i&&c._batchLocation===h){h++;continue}o[u]=h,d._batchLocation=h,t[h]=d;break}}}destroy(){this.renderer=null}}rp.extension={type:U.RendererSystem,name:"batch"};$.add(rp);let $u=0;class Mo{constructor(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=$u++}init(e){if(e.context)this.initFromContext(e.context);else{const t=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,premultipliedAlpha:i,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=$u++,this.renderer.runners.contextChange.emit(e);const t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){const t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let i;if(V.PREFER_ENV>=nr.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){const t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Mo.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Mo.extension={type:U.RendererSystem,name:"context"};$.add(Mo);class $l{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new _t("disposeFramebuffer"),this.multisample=Te.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new Z(null,{scaleMode:qt.NEAREST,resolution:1,mipmap:Ut.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Z(null,{scaleMode:qt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ut.OFF,format:O.DEPTH_COMPONENT,type:j.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(e/n,t/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class sp extends Z{constructor(e={}){if(typeof e=="number"){const t=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];e={width:t,height:i,scaleMode:s,resolution:n}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=Te.NONE),super(null,e),this.mipmap=Ut.OFF,this.valid=!0,this._clear=new ue([0,0,0,0]),this.framebuffer=new $l(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t){this.framebuffer.resize(e*this.resolution,t*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class ti extends Ks{constructor(e){const t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,s=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=Lx(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,s){const n=e.gl,o=t.realWidth,a=t.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===je.UNPACK),!this.noSubImage&&t.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,t.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(t.target,0,i.internalFormat,t.format,i.type,s)),!0}update(){if(this.destroyed)return;const e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}}class np extends ti{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;ti.crossOrigin(i,e,t.crossorigin),i.src=e,e=i}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(t.createBitmap??V.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const t=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===je.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=t._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==t.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}}class qh{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,i){const s=t.width,n=t.height;if(i){const o=e.width/2/s,a=e.height/2/n,h=e.x/s+o,u=e.y/n+a;i=me.add(i,me.NW),this.x0=h+o*me.uX(i),this.y0=u+a*me.uY(i),i=me.add(i,2),this.x1=h+o*me.uX(i),this.y1=u+a*me.uY(i),i=me.add(i,2),this.x2=h+o*me.uX(i),this.y2=u+a*me.uY(i),i=me.add(i,2),this.x3=h+o*me.uX(i),this.y3=u+a*me.uY(i)}else this.x0=e.x/s,this.y0=e.y/n,this.x1=(e.x+e.width)/s,this.y1=e.y/n,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/n,this.x3=e.x/s,this.y3=(e.y+e.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}qh.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Xu=new qh;function Mn(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class W extends rn{constructor(e,t,i,s,n,o,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new K(0,0,1,1)),e instanceof W&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Xu,this.uvMatrix=null,this.orig=i||t,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new ie(o.x,o.y):new ie(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){const{resource:t}=this.baseTexture;t!=null&&t.url&&Et[t.url]&&W.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,W.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new W(this.baseTexture,!this.noFrame&&e,t,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===Xu&&(this._uvs=new qh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=V.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else if(e instanceof Z){if(!e.cacheId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${a}-${tr()}`,Z.addToCache(e,e.cacheId)}n=e.cacheId}else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${tr()}`}n=e._pixiId}let o=Et[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(e instanceof Z)?(t.resolution||(t.resolution=ei(e)),o=new W(new Z(e,t)),o.baseTexture.cacheId=n,Z.addToCache(o.baseTexture,n),W.addToCache(o,n)):!o&&e instanceof Z&&(o=new W(e),W.addToCache(o,n)),o}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),s=W.from(e,Object.assign({resourceOptions:i},t),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new W(Z.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){const n=new Z(e,Object.assign({scaleMode:Z.defaultOptions.scaleMode,resolution:ei(t)},s)),{resource:o}=n;o instanceof np&&(o.url=t);const a=new W(n);return i||(i=t),Z.addToCache(a.baseTexture,i),W.addToCache(a,i),i!==t&&(Z.addToCache(a.baseTexture,t),W.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Et[t]&&Et[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Et[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Et[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete Et[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)Et[e.textureCacheIds[t]]===e&&delete Et[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;const{x:t,y:i,width:s,height:n}=e,o=t+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",u=`X: ${t} + ${s} = ${t+s} > ${this.baseTexture.width}`,d=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${u} ${h} ${d}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return W._EMPTY||(W._EMPTY=new W(new Z),Mn(W._EMPTY),Mn(W._EMPTY.baseTexture)),W._EMPTY}static get WHITE(){if(!W._WHITE){const e=V.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),W._WHITE=new W(Z.from(e)),Mn(W._WHITE),Mn(W._WHITE.baseTexture)}return W._WHITE}}class ar extends W{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,i=!0){const s=this.baseTexture.resolution,n=Math.round(e*s)/s,o=Math.round(t*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(e){const{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new ar(new sp(e))}}class op{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Te.NONE){const s=new sp(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ar(s)}getOptimalTexture(e,t,i=1,s=Te.NONE){let n;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=To(e),t=To(t),n=((e&65535)<<16|t&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(e,t,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(e,t,i){const s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||Te.NONE);return s.filterFrame=e.filterFrame,s}returnTexture(e){const t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(const t in this.texturePool){const i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const i=this.texturePool[t];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}op.SCREEN_KEY=-1;class fb extends Ti{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class ap extends Ti{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new we(this.vertices),this.uvBuffer=new we(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+t.width/e.width,this.uvs[3]=s,this.uvs[4]=i+t.width/e.width,this.uvs[5]=s+t.height/e.height,this.uvs[6]=i,this.uvs[7]=s+t.height/e.height,i=t.x,s=t.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+t.width,this.vertices[3]=s,this.vertices[4]=i+t.width,this.vertices[5]=s+t.height,this.vertices[6]=i,this.vertices[7]=s+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class pb{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Te.NONE,this.sourceFrame=new K,this.destinationFrame=new K,this.bindingSourceFrame=new K,this.bindingDestinationFrame=new K,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const In=[new ie,new ie,new ie,new ie],Oa=new de;class lp{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new op,this.statePool=[],this.quad=new fb,this.quadUv=new ap,this.tempRect=new K,this.activeState={},this.globalUniforms=new yt({outputFrame:new K,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){const i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new pb,o=i.renderTexture;let a,h;if(o.current){const m=o.current;a=m.resolution,h=m.multisample}else a=i.resolution,h=i.multisample;let u=t[0].resolution||a,d=t[0].multisample??h,l=t[0].padding,c=t[0].autoFit,f=t[0].legacy??!0;for(let m=1;m<t.length;m++){const _=t[m];u=Math.min(u,_.resolution||a),d=Math.min(d,_.multisample??h),l=this.useMaxPadding?Math.max(l,_.padding):l+_.padding,c=c&&_.autoFit,f=f||(_.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=u,n.multisample=d,n.legacy=f,n.target=e,n.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),n.sourceFrame.pad(l);const p=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Oa.copyFrom(i.projection.transform).invert(),p),c?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,u,d),n.filters=t,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const g=this.tempRect;g.x=0,g.y=0,g.width=n.sourceFrame.width,g.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,g),i.framebuffer.clear(0,0,0,0)}pop(){const e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;const s=this.globalUniforms.uniforms;s.outputFrame=t.sourceFrame,s.resolution=t.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=t.destinationFrame.width,n[1]=t.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*t.resolution),o[1]=Math.round(n[1]*t.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=t.sourceFrame.width*n[2]-.5*o[2],a[3]=t.sourceFrame.height*n[3]-.5*o[3],t.legacy){const u=s.filterArea;u[0]=t.destinationFrame.width,u[1]=t.destinationFrame.height,u[2]=t.sourceFrame.x,u[3]=t.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,h.renderTexture,Rt.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let u=t.renderTexture,d=this.getOptimalFilterTexture(u.width,u.height,t.resolution);d.filterFrame=u.filterFrame;let l=0;for(l=0;l<i.length-1;++l){l===1&&t.multisample>1&&(d=this.getOptimalFilterTexture(u.width,u.height,t.resolution),d.filterFrame=u.filterFrame),i[l].apply(this,u,d,Rt.CLEAR,t);const c=u;u=d,d=c}i[l].apply(this,u,h.renderTexture,Rt.BLEND,t),l>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(u),this.returnFilterTexture(d)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Rt.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e==null?void 0:e.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,i.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(t===Rt.CLEAR||t===Rt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){const n=this.renderer;n.state.set(e.state),this.bindAndClear(i,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ft.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ft.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=t._texture,o=e.set(s.width,0,0,s.height,i.x,i.y),a=t.worldTransform.copyTo(de.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(t.anchor.x,t.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,s=Te.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){const n=e;e=t,t=n}e=e||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||Te.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const i=In[0],s=In[1],n=In[2],o=In[3];i.set(t.left,t.top),s.set(t.left,t.bottom),n.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(i,i),e.apply(s,s),e.apply(n,n),e.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),u=Math.max(i.x,s.x,n.x,o.x),d=Math.max(i.y,s.y,n.y,o.y);t.x=a,t.y=h,t.width=u-a,t.height=d-h}roundFrame(e,t,i,s,n){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:u}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}n=n?Oa.copyFrom(n):Oa.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}}}lp.extension={type:U.RendererSystem,name:"filter"};$.add(lp);class mb{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Te.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const gb=new K;class hp{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new $l(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new K,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;V.PREFER_ENV===nr.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,i=0){const{gl:s}=this;if(e){const n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=i),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let o=0;o<e.colorTextures.length;o++){const a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){const o=t.width>>i,a=t.height>>i,h=o/t.width;this.setViewport(t.x*h,t.y*h,o,a)}else{const o=e.width>>i,a=e.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,s){const n=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==e||n.y!==t)&&(n.x=e,n.y=t,n.width=i,n.height=s,this.gl.viewport(e,t,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,i,s,n=_l.COLOR|_l.DEPTH){const{gl:o}=this;o.clearColor(e,t,i,s),o.clear(n)}initFramebuffer(e){const{gl:t}=this,i=new mb(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){const{gl:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=t.DEPTH_STENCIL:e.depth&&e.stencil?o=t.DEPTH24_STENCIL8:e.depth?o=t.DEPTH_COMPONENT24:o=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,o,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,o,e.width,e.height)}const s=e.colorTextures;let n=s.length;t.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){const{gl:i}=this,s=e.glFramebuffers[this.CONTEXT_UID],n=e.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const u=n[h],d=u.parentTextureArray||u;this.renderer.texture.bind(d,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,d._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,u.target,d._glTextures[this.CONTEXT_UID].texture,t),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){const h=e.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,u;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH_STENCIL):e.depth&&e.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,u=i.DEPTH24_STENCIL8):e.depth?(h=i.DEPTH_ATTACHMENT,u=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,u=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,u,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let i=Te.NONE;if(e<=1||t===null)return i;for(let s=0;s<t.length;s++)if(t[s]<=e){i=t[s];break}return i===1&&(i=Te.NONE),i}blit(e,t,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!e){if(!h.msaaBuffer)return;const d=s.colorTextures[0];if(!d)return;h.blitFramebuffer||(h.blitFramebuffer=new $l(s.width,s.height),h.blitFramebuffer.addColorTexture(0,d)),e=h.blitFramebuffer,e.colorTextures[0]!==d&&(e.colorTextures[0]=d,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}t||(t=gb,t.width=s.width,t.height=s.height),i||(i=t);const u=t.width===i.width&&t.height===i.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,u?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){const i=e.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(e);n>=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){const e=this.current;if(!e)return;const t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;const i=e.width,s=e.height,n=this.gl,o=t.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):e.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),t.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,t.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new K}destroy(){this.renderer=null}}hp.extension={type:U.RendererSystem,name:"framebuffer"};$.add(hp);const ka={5126:4,5123:2,5121:1};class cp{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;V.PREFER_ENV===nr.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),e.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),e.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:i}=this;let s=e.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[t.program.id]||this.initGeometryVao(e,t,n);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){const s=e.buffers[i];t.update(s)}}checkCompatibility(e,t){const i=e.attributes,s=t.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(e,t){const i=e.attributes,s=t.attributeData,n=["g",e.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(e,t,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=t.program;a.glPrograms[n]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,a);const h=this.getSignature(e,a),u=e.glVertexArrayObjects[this.CONTEXT_UID];let d=u[h];if(d)return u[a.id]=d,d;const l=e.buffers,c=e.attributes,f={},p={};for(const g in l)f[g]=0,p[g]=0;for(const g in c)!c[g].size&&a.attributeData[g]?c[g].size=a.attributeData[g].size:c[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),f[c[g].buffer]+=c[g].size*ka[c[g].type];for(const g in c){const m=c[g],_=m.size;m.stride===void 0&&(f[m.buffer]===_*ka[m.type]?m.stride=0:m.stride=f[m.buffer]),m.start===void 0&&(m.start=p[m.buffer],p[m.buffer]+=_*ka[m.type])}d=s.createVertexArray(),s.bindVertexArray(d);for(let g=0;g<l.length;g++){const m=l[g];o.bind(m),i&&m._glBuffers[n].refCount++}return this.activateVao(e,a),u[a.id]=d,u[h]=d,s.bindVertexArray(null),o.unbind(Ot.ARRAY_BUFFER),d}disposeGeometry(e,t){var a;if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];const i=e.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=e.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(e.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const u=n[h]._glBuffers[this.CONTEXT_UID];u&&(u.refCount--,u.refCount===0&&!t&&o.dispose(n[h],t))}if(!t){for(const h in i)if(h[0]==="g"){const u=i[h];this._activeVao===u&&this.unbind(),s.deleteVertexArray(u)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){const t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=e.buffers,a=e.attributes;e.indexBuffer&&n.bind(e.indexBuffer);let h=null;for(const u in a){const d=a[u],l=o[d.buffer],c=l._glBuffers[s];if(t.attributeData[u]){h!==c&&(n.bind(l),h=c);const f=t.attributeData[u].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,d.size,d.type||i.FLOAT,d.normalized,d.stride,d.start),d.instance)if(this.hasInstance)i.vertexAttribDivisor(f,d.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(e,t||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(e,t||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(e,i,t||o.getSize(),s||1):n.drawArrays(e,i,t||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}cp.extension={type:U.RendererSystem,name:"geometry"};$.add(cp);const ju=new de;class up{constructor(e,t){this._texture=e,this.mapCoord=new de,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const i=this.mapCoord;for(let s=0;s<e.length;s+=2){const n=e[s],o=e[s+1];t[s]=n*i.a+o*i.c+i.tx,t[s+1]=n*i.b+o*i.d+i.ty}return t}update(e){const t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;const i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=t.orig,n=t.trim;n&&(ju.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(ju));const o=t.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,u=this.clampOffset;return a[0]=(t._frame.x+h+u)/o.width,a[1]=(t._frame.y+h+u)/o.height,a[2]=(t._frame.x+t._frame.width-h+u)/o.width,a[3]=(t._frame.y+t._frame.height-h+u)/o.height,this.uClampOffset[0]=u/o.realWidth,this.uClampOffset[1]=u/o.realHeight,this.isSimple=t._frame.width===o.width&&t._frame.height===o.height&&t.rotate===0,!0}}var _b=`varying vec2 vMaskCoord;
|
|
4066
4066
|
varying vec2 vTextureCoord;
|
|
4067
4067
|
|
|
4068
4068
|
uniform sampler2D uSampler;
|
|
@@ -4087,7 +4087,7 @@ void main(void)
|
|
|
4087
4087
|
|
|
4088
4088
|
gl_FragColor = original;
|
|
4089
4089
|
}
|
|
4090
|
-
`,
|
|
4090
|
+
`,yb=`attribute vec2 aVertexPosition;
|
|
4091
4091
|
attribute vec2 aTextureCoord;
|
|
4092
4092
|
|
|
4093
4093
|
uniform mat3 projectionMatrix;
|
|
@@ -4103,7 +4103,7 @@ void main(void)
|
|
|
4103
4103
|
vTextureCoord = aTextureCoord;
|
|
4104
4104
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
4105
4105
|
}
|
|
4106
|
-
`;class yb extends ze{constructor(e,t,i){let s=null;typeof e!="string"&&t===void 0&&i===void 0&&(s=e,e=void 0,t=void 0,i=void 0),super(e||_b,t||gb,i),this.maskSprite=s,this.maskMatrix=new de}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new up(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,t,i,s))}}class vb{constructor(e=null){this.type=Ce.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ze.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Ce.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class dp{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,t){let i=t;if(!i.isMaskData){const n=this.maskDataPool.pop()||new vb;n.pooled=!0,n.maskObject=t,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==Ce.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ce.SCISSOR:this.renderer.scissor.push(i);break;case Ce.STENCIL:this.renderer.stencil.push(i);break;case Ce.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ce.COLOR:this.pushColorMask(i);break}i.type===Ce.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case Ce.SCISSOR:this.renderer.scissor.pop(t);break;case Ce.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case Ce.SPRITE:this.popSpriteMask(t);break;case Ce.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Ce.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=Ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=Ce.SCISSOR:e.type=Ce.STENCIL:e.type=Ce.COLOR}pushSpriteMask(e){const{maskObject:t}=e,i=e._target;let s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new yb])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=t;const n=i.filterArea;i.filterArea=t.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){const t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){const t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}dp.extension={type:U.RendererSystem,name:"mask"};$.add(dp);class fp{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;const s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Yu=new de,qu=[],pp=class so extends fp{constructor(e){super(e),this.glConst=V.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;const t=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,qu.pop()??new K);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),t&&o.fit(t),e._scissorRectLocal=o}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:i,c:s,d:n}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(n)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||so.isMatrixRotated(t.worldTransform)||so.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,s,n){so.isMatrixRotated(n)||(n=n?Yu.copyFrom(n):Yu.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,e),e.fit(s),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);const{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){const{gl:t}=this.renderer;e&&qu.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){const e=this.maskStack[this.maskStack.length-1]._scissorRect;let t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};pp.extension={type:U.RendererSystem,name:"scissor"};let xb=pp;$.add(xb);class mp extends fp{constructor(e){super(e),this.glConst=V.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){const t=e.maskObject,{gl:i}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;const n=e._colorMask;n!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,n!==0&&(e._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}}mp.extension={type:U.RendererSystem,name:"stencil"};$.add(mp);class gp{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}gp.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"_plugin"};$.add(gp);class _p{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new de,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(e,t,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/t.width*2,n.d=o*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-o-t.y*n.d}setTransform(e){}destroy(){this.renderer=null}}_p.extension={type:U.RendererSystem,name:"projection"};$.add(_p);const bb=new Yh,Zu=new K;class yp{constructor(e){this.renderer=e,this._tempMatrix=new de}generateTexture(e,t){const{region:i,...s}=t||{},n=(i==null?void 0:i.copyTo(Zu))||e.getLocalBounds(Zu,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=ar.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=e.transform;return e.transform=bb,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,a}destroy(){}}yp.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"textureGenerator"};$.add(yp);const Li=new K,ys=new K;class vp{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new K,this.destinationFrame=new K,this.viewportFrame=new K}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){const s=this.renderer;this.current=e;let n,o,a;e?(n=e.baseTexture,a=n.resolution,t||(Li.width=e.frame.width,Li.height=e.frame.height,t=Li),i||(ys.x=e.frame.x,ys.y=e.frame.y,ys.width=t.width,ys.height=t.height,i=ys),o=n.framebuffer):(a=s.resolution,t||(Li.width=s._view.screen.width,Li.height=s._view.screen.height,t=Li),i||(i=Li,i.width=t.width,i.height=t.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,e||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,t,a,!o),e?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=ue.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:u,width:d,height:l}=this.viewportFrame;h=Math.round(h),u=Math.round(u),d=Math.round(d),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,u,d,l)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}vp.extension={type:U.RendererSystem,name:"renderTexture"};$.add(vp);class wb{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Ab(r,e){const t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=e.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=ip(e,n.type),a={type:o,name:n.name,size:tp(o),location:e.getAttribLocation(r,n.name)};t[n.name]=a}return t}function Tb(r,e){const t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=e.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=ip(e,n.type);t[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:Jf(h,n.size)}}return t}function Sb(r,e){var a;const t=zu(r,r.VERTEX_SHADER,e.vertexSrc),i=zu(r,r.FRAGMENT_SHADER,e.fragmentSrc),s=r.createProgram();r.attachShader(s,t),r.attachShader(s,i);const n=(a=e.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||eb(r,s,t,i),e.attributeData=Ab(s,r),e.uniformData=Tb(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const h=Object.keys(e.attributeData);h.sort((u,d)=>u>d?1:-1);for(let u=0;u<h.length;u++)e.attributeData[h[u]].location=u,r.bindAttribLocation(s,u,h[u]);r.linkProgram(s)}r.deleteShader(t),r.deleteShader(i);const o={};for(const h in e.uniformData){const u=e.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:Jf(u.type,u.size)}}return new wb(s,o)}function Eb(r,e,t,i,s){t.buffer.update(s)}const Cb={float:`
|
|
4106
|
+
`;class vb extends ze{constructor(e,t,i){let s=null;typeof e!="string"&&t===void 0&&i===void 0&&(s=e,e=void 0,t=void 0,i=void 0),super(e||yb,t||_b,i),this.maskSprite=s,this.maskMatrix=new de}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new up(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,t,i,s))}}class xb{constructor(e=null){this.type=Ce.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ze.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Ce.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class dp{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,t){let i=t;if(!i.isMaskData){const n=this.maskDataPool.pop()||new xb;n.pooled=!0,n.maskObject=t,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==Ce.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ce.SCISSOR:this.renderer.scissor.push(i);break;case Ce.STENCIL:this.renderer.stencil.push(i);break;case Ce.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ce.COLOR:this.pushColorMask(i);break}i.type===Ce.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case Ce.SCISSOR:this.renderer.scissor.pop(t);break;case Ce.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case Ce.SPRITE:this.popSpriteMask(t);break;case Ce.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Ce.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=Ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=Ce.SCISSOR:e.type=Ce.STENCIL:e.type=Ce.COLOR}pushSpriteMask(e){const{maskObject:t}=e,i=e._target;let s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new vb])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=t;const n=i.filterArea;i.filterArea=t.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){const t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){const t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}dp.extension={type:U.RendererSystem,name:"mask"};$.add(dp);class fp{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;const s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Yu=new de,qu=[],pp=class no extends fp{constructor(e){super(e),this.glConst=V.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;const t=e._scissorRect,{maskObject:i}=e,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,qu.pop()??new K);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),t&&o.fit(t),e._scissorRectLocal=o}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:i,c:s,d:n}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(n)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||no.isMatrixRotated(t.worldTransform)||no.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,s,n){no.isMatrixRotated(n)||(n=n?Yu.copyFrom(n):Yu.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,e),e.fit(s),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);const{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){const{gl:t}=this.renderer;e&&qu.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){const e=this.maskStack[this.maskStack.length-1]._scissorRect;let t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};pp.extension={type:U.RendererSystem,name:"scissor"};let bb=pp;$.add(bb);class mp extends fp{constructor(e){super(e),this.glConst=V.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){const t=e.maskObject,{gl:i}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;const n=e._colorMask;n!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,n!==0&&(e._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(i._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}}mp.extension={type:U.RendererSystem,name:"stencil"};$.add(mp);class gp{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return J("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}gp.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"_plugin"};$.add(gp);class _p{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new de,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(e,t,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/t.width*2,n.d=o*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-o-t.y*n.d}setTransform(e){}destroy(){this.renderer=null}}_p.extension={type:U.RendererSystem,name:"projection"};$.add(_p);const wb=new Yh,Zu=new K;class yp{constructor(e){this.renderer=e,this._tempMatrix=new de}generateTexture(e,t){const{region:i,...s}=t||{},n=(i==null?void 0:i.copyTo(Zu))||e.getLocalBounds(Zu,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=ar.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=e.transform;return e.transform=wb,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,a}destroy(){}}yp.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"textureGenerator"};$.add(yp);const Li=new K,vs=new K;class vp{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new K,this.destinationFrame=new K,this.viewportFrame=new K}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){const s=this.renderer;this.current=e;let n,o,a;e?(n=e.baseTexture,a=n.resolution,t||(Li.width=e.frame.width,Li.height=e.frame.height,t=Li),i||(vs.x=e.frame.x,vs.y=e.frame.y,vs.width=t.width,vs.height=t.height,i=vs),o=n.framebuffer):(a=s.resolution,t||(Li.width=s._view.screen.width,Li.height=s._view.screen.height,t=Li),i||(i=Li,i.width=t.width,i.height=t.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,e||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,t,a,!o),e?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=ue.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:u,width:d,height:l}=this.viewportFrame;h=Math.round(h),u=Math.round(u),d=Math.round(d),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,u,d,l)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}vp.extension={type:U.RendererSystem,name:"renderTexture"};$.add(vp);class Ab{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Tb(r,e){const t={},i=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=e.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=ip(e,n.type),a={type:o,name:n.name,size:tp(o),location:e.getAttribLocation(r,n.name)};t[n.name]=a}return t}function Sb(r,e){const t={},i=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=e.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=ip(e,n.type);t[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:Jf(h,n.size)}}return t}function Eb(r,e){var a;const t=zu(r,r.VERTEX_SHADER,e.vertexSrc),i=zu(r,r.FRAGMENT_SHADER,e.fragmentSrc),s=r.createProgram();r.attachShader(s,t),r.attachShader(s,i);const n=(a=e.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||tb(r,s,t,i),e.attributeData=Tb(s,r),e.uniformData=Sb(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const h=Object.keys(e.attributeData);h.sort((u,d)=>u>d?1:-1);for(let u=0;u<h.length;u++)e.attributeData[h[u]].location=u,r.bindAttribLocation(s,u,h[u]);r.linkProgram(s)}r.deleteShader(t),r.deleteShader(i);const o={};for(const h in e.uniformData){const u=e.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:Jf(u.type,u.size)}}return new Ab(s,o)}function Cb(r,e,t,i,s){t.buffer.update(s)}const Mb={float:`
|
|
4107
4107
|
data[offset] = v;
|
|
4108
4108
|
`,vec2:`
|
|
4109
4109
|
data[offset] = v[0];
|
|
@@ -4141,7 +4141,7 @@ void main(void)
|
|
|
4141
4141
|
{
|
|
4142
4142
|
data[offset + i] = v[i];
|
|
4143
4143
|
}
|
|
4144
|
-
`},xp={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function
|
|
4144
|
+
`},xp={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function Ib(r){const e=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let t=0,i=0,s=0;for(let n=0;n<e.length;n++){const o=e[n];if(t=xp[o.data.type],o.data.size>1&&(t=Math.max(t,16)*o.data.size),o.dataLen=t,i%t!==0&&i<16){const a=i%t%16;i+=a,s+=a}i+t>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=t,i=t):(o.offset=s,i+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function Pb(r,e){const t=[];for(const i in r)e[i]&&t.push(e[i]);return t.sort((i,s)=>i.index-s.index),t}function Rb(r,e){if(!r.autoManage)return{size:0,syncFunc:Cb};const t=Pb(r.uniforms,e),{uboElements:i,size:s}=Ib(t),n=[`
|
|
4145
4145
|
var v = null;
|
|
4146
4146
|
var v2 = null;
|
|
4147
4147
|
var cv = null;
|
|
@@ -4165,7 +4165,7 @@ void main(void)
|
|
|
4165
4165
|
offset += ${p};
|
|
4166
4166
|
}
|
|
4167
4167
|
|
|
4168
|
-
`)}else{const l=
|
|
4168
|
+
`)}else{const l=Mb[a.data.type];n.push(`
|
|
4169
4169
|
cv = ud.${u}.value;
|
|
4170
4170
|
v = uv.${u};
|
|
4171
4171
|
offset = ${a.offset/4};
|
|
@@ -4173,7 +4173,7 @@ void main(void)
|
|
|
4173
4173
|
`)}}return n.push(`
|
|
4174
4174
|
renderer.buffer.update(buffer);
|
|
4175
4175
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
4176
|
-
`))}}let Rb=0;const In={textureCount:0,uboCount:0};class bp{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Rb++}systemCheck(){if(!ib())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;const i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(In.textureCount=0,In.uboCount=0,this.syncUniformGroup(e.uniformGroup,In)),s}setUniforms(e){const t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){const i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=Kx(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;const s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,In,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);const n=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(e,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Pb(e,this.shader.program.uniformData)),e.autoManage){const h=new Float32Array(a.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){const s=e.uniforms,n=[`${i}-`];for(const o in s)n.push(o),t[o]&&n.push(t[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,i=e.program,s=Sb(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}bp.extension={type:U.RendererSystem,name:"shader"};$.add(bp);class Io{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.0 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Io.defaultOptions={hello:!1},Io.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"startup"};$.add(Io);function Db(r,e=[]){return e[Y.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.ADD]=[r.ONE,r.ONE],e[Y.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.NONE]=[0,0],e[Y.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[Y.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[Y.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[Y.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[Y.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[Y.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[Y.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[Y.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[Y.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[Y.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}const Bb=0,Fb=1,Lb=2,Ob=3,kb=4,Nb=5,wp=class jl{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Y.NONE,this._blendEq=!1,this.map=[],this.map[Bb]=this.setBlend,this.map[Fb]=this.setOffset,this.map[Lb]=this.setCullFace,this.map[Ob]=this.setDepthTest,this.map[kb]=this.setFrontFace,this.map[Nb]=this.setDepthMask,this.checks=[],this.defaultState=new Gt,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=Db(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(jl.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(jl.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};wp.extension={type:U.RendererSystem,name:"state"};let Ub=wp;$.add(Ub);class Gb extends tn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(s=>e.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(const s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new _t(t)})}addSystem(e,t){const i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){const i=Object.keys(this._systemsHash);e.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[e.name](t[n])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const Ps=class no{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=no.defaultMaxIdle,this.checkCountMax=no.defaultCheckCountMax,this.mode=no.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Nh.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let i=!1;for(let s=0;s<t.length;s++){const n=t[s];n.resource&&this.count-n.touched>this.maxIdle&&(e.destroyTexture(n,!0),t[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<t.length;n++)t[n]!==null&&(t[s++]=t[n]);t.length=s}}unload(e){const t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};Ps.defaultMode=Nh.AUTO,Ps.defaultMaxIdle=60*60,Ps.defaultCheckCountMax=60*10,Ps.extension={type:U.RendererSystem,name:"textureGC"};let Wi=Ps;$.add(Wi);class Ua{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=j.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}}function zb(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:e={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},e}function Hb(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[j.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA8,[O.RGB]:r.RGB8,[O.RG]:r.RG8,[O.RED]:r.R8,[O.RGBA_INTEGER]:r.RGBA8UI,[O.RGB_INTEGER]:r.RGB8UI,[O.RG_INTEGER]:r.RG8UI,[O.RED_INTEGER]:r.R8UI,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.BYTE]:{[O.RGBA]:r.RGBA8_SNORM,[O.RGB]:r.RGB8_SNORM,[O.RG]:r.RG8_SNORM,[O.RED]:r.R8_SNORM,[O.RGBA_INTEGER]:r.RGBA8I,[O.RGB_INTEGER]:r.RGB8I,[O.RG_INTEGER]:r.RG8I,[O.RED_INTEGER]:r.R8I},[j.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:r.RGBA16UI,[O.RGB_INTEGER]:r.RGB16UI,[O.RG_INTEGER]:r.RG16UI,[O.RED_INTEGER]:r.R16UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[j.SHORT]:{[O.RGBA_INTEGER]:r.RGBA16I,[O.RGB_INTEGER]:r.RGB16I,[O.RG_INTEGER]:r.RG16I,[O.RED_INTEGER]:r.R16I},[j.UNSIGNED_INT]:{[O.RGBA_INTEGER]:r.RGBA32UI,[O.RGB_INTEGER]:r.RGB32UI,[O.RG_INTEGER]:r.RG32UI,[O.RED_INTEGER]:r.R32UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[j.INT]:{[O.RGBA_INTEGER]:r.RGBA32I,[O.RGB_INTEGER]:r.RGB32I,[O.RG_INTEGER]:r.RG32I,[O.RED_INTEGER]:r.R32I},[j.FLOAT]:{[O.RGBA]:r.RGBA32F,[O.RGB]:r.RGB32F,[O.RG]:r.RG32F,[O.RED]:r.R32F,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[j.HALF_FLOAT]:{[O.RGBA]:r.RGBA16F,[O.RGB]:r.RGB16F,[O.RG]:r.RG16F,[O.RED]:r.R16F},[j.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB565},[j.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA4},[j.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGB5_A1},[j.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:r.RGB10_A2,[O.RGBA_INTEGER]:r.RGB10_A2UI},[j.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:r.R11F_G11F_B10F},[j.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:r.RGB9_E5},[j.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[j.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[j.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA,[O.RGB]:r.RGB,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB},[j.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA},[j.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGBA}},e}class Ap{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Z,this.hasIntegerTextures=!1}contextChange(){const e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Hb(e),this.samplerTypes=zb(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Ua(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new Ua(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,t=0){const{gl:i}=this;if(e=e==null?void 0:e.castToBaseTexture(),(e==null?void 0:e.valid)&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;const s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){const{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===e&&(this.currentLocation!==s&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=e-1;n>=0;--n){const o=t[n];o&&o._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(e){const t=new Ua(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){var i;t.internalFormat=((i=this.internalFormats[e.type])==null?void 0:i[e.format])??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??H.FLOAT,this.webGLVersion===2&&e.type===j.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var s;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const i=this.renderer;if(this.initTextureType(e,t),(s=e.resource)==null?void 0:s.upload(i,e,t))t.samplerType!==H.FLOAT&&(this.hasIntegerTextures=!0);else{const n=e.realWidth,o=e.realHeight,a=i.gl;(t.width!==n||t.height!==o||t.dirtyId<0)&&(t.width=n,t.height=o,a.texImage2D(e.target,0,t.internalFormat,n,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const s=this.managedTextures.indexOf(e);s!==-1&&Wr(this.managedTextures,s,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ut.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=wi.CLAMP:t.wrapMode=e.wrapMode,(i=e.resource)!=null&&i.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const i=this.gl;if(t.mipmap&&e.mipmap!==Ut.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===qt.LINEAR){const n=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Ap.extension={type:U.RendererSystem,name:"texture"};$.add(Ap);class Tp{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:i,CONTEXT_UID:s}=this,n=t.createTransformFeedback();e._glTransformFeedbacks[s]=n,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n);for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),n}disposeTransformFeedback(e,t){const i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!t&&n.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Tp.extension={type:U.RendererSystem,name:"transformFeedback"};$.add(Tp);class Po{constructor(e){this.renderer=e}init(e){this.screen=new K(0,0,e.width,e.height),this.element=e.view||V.ADAPTER.createCanvas(),this.resolution=e.resolution||V.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){var t;e&&((t=this.element.parentNode)==null||t.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Po.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Po.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"_view"};$.add(Po);V.PREFER_ENV=nr.WEBGL2;V.STRICT_TEXTURE_CACHE=!1;V.RENDER_OPTIONS={...Mo.defaultOptions,...Co.defaultOptions,...Po.defaultOptions,...Io.defaultOptions};Object.defineProperties(V,{WRAP_MODE:{get(){return Z.defaultOptions.wrapMode},set(r){J("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Z.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return Z.defaultOptions.scaleMode},set(r){J("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Z.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return Z.defaultOptions.mipmap},set(r){J("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Z.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return Z.defaultOptions.anisotropicLevel},set(r){J("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Z.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return J("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ze.defaultResolution},set(r){ze.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return J("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ze.defaultMultisample},set(r){ze.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Vi.defaultMaxTextures},set(r){J("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Vi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Vi.defaultBatchSize},set(r){J("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Vi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Vi.canUploadSameBuffer},set(r){J("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Vi.canUploadSameBuffer=r}},GC_MODE:{get(){return Wi.defaultMode},set(r){J("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Wi.defaultMode=r}},GC_MAX_IDLE:{get(){return Wi.defaultMaxIdle},set(r){J("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Wi.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Wi.defaultCheckCountMax},set(r){J("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Wi.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Qt.defaultVertexPrecision},set(r){J("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Qt.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Qt.defaultFragmentPrecision},set(r){J("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Qt.defaultFragmentPrecision=r}}});var ir=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ir||{});class Ga{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));const t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Sp=class Ye{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ga(null,null,1/0),this.deltaMS=1/Ye.targetFPMS,this.elapsedMS=1/Ye.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,i=ir.NORMAL){return this._addListener(new Ga(e,t,i))}addOnce(e,t,i=ir.NORMAL){return this._addListener(new Ga(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const n=e-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=e-n%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Ye.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,Ye.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!Ye._shared){const e=Ye._shared=new Ye;e.autoStart=!0,e._protected=!0}return Ye._shared}static get system(){if(!Ye._system){const e=Ye._system=new Ye;e.autoStart=!0,e._protected=!0}return Ye._system}};Sp.targetFPMS=.06;let Ke=Sp;Object.defineProperties(V,{TARGET_FPMS:{get(){return Ke.targetFPMS},set(r){J("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Ke.targetFPMS=r}}});class Ep{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,ir.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ke.shared:new Ke,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Ep.extension=U.Application;$.add(Ep);const Cp=[];$.handleByList(U.Renderer,Cp);function Vb(r){for(const e of Cp)if(e.test(r))return new e(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Wb=`attribute vec2 aVertexPosition;
|
|
4176
|
+
`))}}let Db=0;const Pn={textureCount:0,uboCount:0};class bp{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Db++}systemCheck(){if(!rb())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;const i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(Pn.textureCount=0,Pn.uboCount=0,this.syncUniformGroup(e.uniformGroup,Pn)),s}setUniforms(e){const t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){const i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=Qx(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;const s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Pn,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);const n=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(e,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Rb(e,this.shader.program.uniformData)),e.autoManage){const h=new Float32Array(a.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){const s=e.uniforms,n=[`${i}-`];for(const o in s)n.push(o),t[o]&&n.push(t[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,i=e.program,s=Eb(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}bp.extension={type:U.RendererSystem,name:"shader"};$.add(bp);class Io{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.0 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Io.defaultOptions={hello:!1},Io.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"startup"};$.add(Io);function Bb(r,e=[]){return e[Y.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.ADD]=[r.ONE,r.ONE],e[Y.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.NONE]=[0,0],e[Y.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[Y.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[Y.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[Y.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[Y.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[Y.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[Y.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[Y.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[Y.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[Y.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[Y.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}const Fb=0,Lb=1,Ob=2,kb=3,Nb=4,Ub=5,wp=class Xl{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Y.NONE,this._blendEq=!1,this.map=[],this.map[Fb]=this.setBlend,this.map[Lb]=this.setOffset,this.map[Ob]=this.setCullFace,this.map[kb]=this.setDepthTest,this.map[Nb]=this.setFrontFace,this.map[Ub]=this.setDepthMask,this.checks=[],this.defaultState=new Gt,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=Bb(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(Xl.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(Xl.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};wp.extension={type:U.RendererSystem,name:"state"};let Gb=wp;$.add(Gb);class zb extends rn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(s=>e.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(const s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new _t(t)})}addSystem(e,t){const i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){const i=Object.keys(this._systemsHash);e.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[e.name](t[n])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const Rs=class oo{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=oo.defaultMaxIdle,this.checkCountMax=oo.defaultCheckCountMax,this.mode=oo.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Nh.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let i=!1;for(let s=0;s<t.length;s++){const n=t[s];n.resource&&this.count-n.touched>this.maxIdle&&(e.destroyTexture(n,!0),t[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<t.length;n++)t[n]!==null&&(t[s++]=t[n]);t.length=s}}unload(e){const t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};Rs.defaultMode=Nh.AUTO,Rs.defaultMaxIdle=60*60,Rs.defaultCheckCountMax=60*10,Rs.extension={type:U.RendererSystem,name:"textureGC"};let Wi=Rs;$.add(Wi);class Na{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=j.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}}function Hb(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.R8]:H.FLOAT,[r.R8_SNORM]:H.FLOAT,[r.RG8]:H.FLOAT,[r.RG8_SNORM]:H.FLOAT,[r.RGB8]:H.FLOAT,[r.RGB8_SNORM]:H.FLOAT,[r.RGB565]:H.FLOAT,[r.RGBA4]:H.FLOAT,[r.RGB5_A1]:H.FLOAT,[r.RGBA8]:H.FLOAT,[r.RGBA8_SNORM]:H.FLOAT,[r.RGB10_A2]:H.FLOAT,[r.RGB10_A2UI]:H.FLOAT,[r.SRGB8]:H.FLOAT,[r.SRGB8_ALPHA8]:H.FLOAT,[r.R16F]:H.FLOAT,[r.RG16F]:H.FLOAT,[r.RGB16F]:H.FLOAT,[r.RGBA16F]:H.FLOAT,[r.R32F]:H.FLOAT,[r.RG32F]:H.FLOAT,[r.RGB32F]:H.FLOAT,[r.RGBA32F]:H.FLOAT,[r.R11F_G11F_B10F]:H.FLOAT,[r.RGB9_E5]:H.FLOAT,[r.R8I]:H.INT,[r.R8UI]:H.UINT,[r.R16I]:H.INT,[r.R16UI]:H.UINT,[r.R32I]:H.INT,[r.R32UI]:H.UINT,[r.RG8I]:H.INT,[r.RG8UI]:H.UINT,[r.RG16I]:H.INT,[r.RG16UI]:H.UINT,[r.RG32I]:H.INT,[r.RG32UI]:H.UINT,[r.RGB8I]:H.INT,[r.RGB8UI]:H.UINT,[r.RGB16I]:H.INT,[r.RGB16UI]:H.UINT,[r.RGB32I]:H.INT,[r.RGB32UI]:H.UINT,[r.RGBA8I]:H.INT,[r.RGBA8UI]:H.UINT,[r.RGBA16I]:H.INT,[r.RGBA16UI]:H.UINT,[r.RGBA32I]:H.INT,[r.RGBA32UI]:H.UINT,[r.DEPTH_COMPONENT16]:H.FLOAT,[r.DEPTH_COMPONENT24]:H.FLOAT,[r.DEPTH_COMPONENT32F]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT,[r.DEPTH24_STENCIL8]:H.FLOAT,[r.DEPTH32F_STENCIL8]:H.FLOAT}:e={[r.RGB]:H.FLOAT,[r.RGBA]:H.FLOAT,[r.ALPHA]:H.FLOAT,[r.LUMINANCE]:H.FLOAT,[r.LUMINANCE_ALPHA]:H.FLOAT,[r.DEPTH_STENCIL]:H.FLOAT},e}function Vb(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[j.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA8,[O.RGB]:r.RGB8,[O.RG]:r.RG8,[O.RED]:r.R8,[O.RGBA_INTEGER]:r.RGBA8UI,[O.RGB_INTEGER]:r.RGB8UI,[O.RG_INTEGER]:r.RG8UI,[O.RED_INTEGER]:r.R8UI,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.BYTE]:{[O.RGBA]:r.RGBA8_SNORM,[O.RGB]:r.RGB8_SNORM,[O.RG]:r.RG8_SNORM,[O.RED]:r.R8_SNORM,[O.RGBA_INTEGER]:r.RGBA8I,[O.RGB_INTEGER]:r.RGB8I,[O.RG_INTEGER]:r.RG8I,[O.RED_INTEGER]:r.R8I},[j.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:r.RGBA16UI,[O.RGB_INTEGER]:r.RGB16UI,[O.RG_INTEGER]:r.RG16UI,[O.RED_INTEGER]:r.R16UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[j.SHORT]:{[O.RGBA_INTEGER]:r.RGBA16I,[O.RGB_INTEGER]:r.RGB16I,[O.RG_INTEGER]:r.RG16I,[O.RED_INTEGER]:r.R16I},[j.UNSIGNED_INT]:{[O.RGBA_INTEGER]:r.RGBA32UI,[O.RGB_INTEGER]:r.RGB32UI,[O.RG_INTEGER]:r.RG32UI,[O.RED_INTEGER]:r.R32UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[j.INT]:{[O.RGBA_INTEGER]:r.RGBA32I,[O.RGB_INTEGER]:r.RGB32I,[O.RG_INTEGER]:r.RG32I,[O.RED_INTEGER]:r.R32I},[j.FLOAT]:{[O.RGBA]:r.RGBA32F,[O.RGB]:r.RGB32F,[O.RG]:r.RG32F,[O.RED]:r.R32F,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[j.HALF_FLOAT]:{[O.RGBA]:r.RGBA16F,[O.RGB]:r.RGB16F,[O.RG]:r.RG16F,[O.RED]:r.R16F},[j.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB565},[j.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA4},[j.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGB5_A1},[j.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:r.RGB10_A2,[O.RGBA_INTEGER]:r.RGB10_A2UI},[j.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:r.R11F_G11F_B10F},[j.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:r.RGB9_E5},[j.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[j.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[j.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA,[O.RGB]:r.RGB,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[j.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB},[j.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA},[j.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGBA}},e}class Ap{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Z,this.hasIntegerTextures=!1}contextChange(){const e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Vb(e),this.samplerTypes=Hb(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Na(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new Na(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(e,t=0){const{gl:i}=this;if(e=e==null?void 0:e.castToBaseTexture(),(e==null?void 0:e.valid)&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;const s=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){const{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===e&&(this.currentLocation!==s&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=e-1;n>=0;--n){const o=t[n];o&&o._glTextures[s].samplerType!==H.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(e){const t=new Na(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){var i;t.internalFormat=((i=this.internalFormats[e.type])==null?void 0:i[e.format])??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??H.FLOAT,this.webGLVersion===2&&e.type===j.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var s;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const i=this.renderer;if(this.initTextureType(e,t),(s=e.resource)==null?void 0:s.upload(i,e,t))t.samplerType!==H.FLOAT&&(this.hasIntegerTextures=!0);else{const n=e.realWidth,o=e.realHeight,a=i.gl;(t.width!==n||t.height!==o||t.dirtyId<0)&&(t.width=n,t.height=o,a.texImage2D(e.target,0,t.internalFormat,n,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const s=this.managedTextures.indexOf(e);s!==-1&&Wr(this.managedTextures,s,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ut.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=wi.CLAMP:t.wrapMode=e.wrapMode,(i=e.resource)!=null&&i.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const i=this.gl;if(t.mipmap&&e.mipmap!==Ut.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===qt.LINEAR){const n=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===qt.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Ap.extension={type:U.RendererSystem,name:"texture"};$.add(Ap);class Tp{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:i,CONTEXT_UID:s}=this,n=t.createTransformFeedback();e._glTransformFeedbacks[s]=n,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n);for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),n}disposeTransformFeedback(e,t){const i=e._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!t&&n.dispose(a,t))}i&&(t||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Tp.extension={type:U.RendererSystem,name:"transformFeedback"};$.add(Tp);class Po{constructor(e){this.renderer=e}init(e){this.screen=new K(0,0,e.width,e.height),this.element=e.view||V.ADAPTER.createCanvas(),this.resolution=e.resolution||V.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){var t;e&&((t=this.element.parentNode)==null||t.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Po.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Po.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:"_view"};$.add(Po);V.PREFER_ENV=nr.WEBGL2;V.STRICT_TEXTURE_CACHE=!1;V.RENDER_OPTIONS={...Mo.defaultOptions,...Co.defaultOptions,...Po.defaultOptions,...Io.defaultOptions};Object.defineProperties(V,{WRAP_MODE:{get(){return Z.defaultOptions.wrapMode},set(r){J("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Z.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return Z.defaultOptions.scaleMode},set(r){J("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Z.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return Z.defaultOptions.mipmap},set(r){J("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Z.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return Z.defaultOptions.anisotropicLevel},set(r){J("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Z.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return J("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ze.defaultResolution},set(r){ze.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return J("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ze.defaultMultisample},set(r){ze.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Vi.defaultMaxTextures},set(r){J("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Vi.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Vi.defaultBatchSize},set(r){J("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Vi.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Vi.canUploadSameBuffer},set(r){J("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Vi.canUploadSameBuffer=r}},GC_MODE:{get(){return Wi.defaultMode},set(r){J("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Wi.defaultMode=r}},GC_MAX_IDLE:{get(){return Wi.defaultMaxIdle},set(r){J("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Wi.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Wi.defaultCheckCountMax},set(r){J("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Wi.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Qt.defaultVertexPrecision},set(r){J("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Qt.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Qt.defaultFragmentPrecision},set(r){J("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Qt.defaultFragmentPrecision=r}}});var ir=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(ir||{});class Ua{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));const t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Sp=class Ye{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ua(null,null,1/0),this.deltaMS=1/Ye.targetFPMS,this.elapsedMS=1/Ye.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,i=ir.NORMAL){return this._addListener(new Ua(e,t,i))}addOnce(e,t,i=ir.NORMAL){return this._addListener(new Ua(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const n=e-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=e-n%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Ye.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,Ye.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!Ye._shared){const e=Ye._shared=new Ye;e.autoStart=!0,e._protected=!0}return Ye._shared}static get system(){if(!Ye._system){const e=Ye._system=new Ye;e.autoStart=!0,e._protected=!0}return Ye._system}};Sp.targetFPMS=.06;let Ke=Sp;Object.defineProperties(V,{TARGET_FPMS:{get(){return Ke.targetFPMS},set(r){J("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Ke.targetFPMS=r}}});class Ep{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,ir.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ke.shared:new Ke,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Ep.extension=U.Application;$.add(Ep);const Cp=[];$.handleByList(U.Renderer,Cp);function Wb(r){for(const e of Cp)if(e.test(r))return new e(r);throw new Error("Unable to auto-detect a suitable renderer.")}var $b=`attribute vec2 aVertexPosition;
|
|
4177
4177
|
attribute vec2 aTextureCoord;
|
|
4178
4178
|
|
|
4179
4179
|
uniform mat3 projectionMatrix;
|
|
@@ -4184,7 +4184,7 @@ void main(void)
|
|
|
4184
4184
|
{
|
|
4185
4185
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
4186
4186
|
vTextureCoord = aTextureCoord;
|
|
4187
|
-
}
|
|
4187
|
+
}`,Xb=`attribute vec2 aVertexPosition;
|
|
4188
4188
|
|
|
4189
4189
|
uniform mat3 projectionMatrix;
|
|
4190
4190
|
|
|
@@ -4210,7 +4210,7 @@ void main(void)
|
|
|
4210
4210
|
gl_Position = filterVertexPosition();
|
|
4211
4211
|
vTextureCoord = filterTextureCoord();
|
|
4212
4212
|
}
|
|
4213
|
-
`;const Xb=Wb,Mp=$b;class Ip{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{const i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Te.HIGH?this.multisample=Te.HIGH:t>=Te.MEDIUM?this.multisample=Te.MEDIUM:t>=Te.LOW?this.multisample=Te.LOW:this.multisample=Te.NONE}destroy(){}}Ip.extension={type:U.RendererSystem,name:"_multisample"};$.add(Ip);class jb{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Pp{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){const n=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,n.buffer)}}bindBufferRange(e,t,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=e._glBuffers[n]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,o.buffer,i*256,256)}update(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){const{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new jb(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Pp.extension={type:U.RendererSystem,name:"buffer"};$.add(Pp);class Rp{constructor(e){this.renderer=e}render(e,t){const i=this.renderer;let s,n,o,a;if(t&&(s=t.renderTexture,n=t.clear,o=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){const h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(t.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Rp.extension={type:U.RendererSystem,name:"objectRenderer"};$.add(Rp);const oo=class Yl extends Gb{constructor(e){super(),this.type=bf.WEBGL,e=Object.assign({},V.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new yt({projectionMatrix:new de},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Yl.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(J("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=Yl.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:mx()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return J("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return J("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return J("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return J("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){J("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return J("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){J("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return J("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};oo.extension={type:U.Renderer,priority:1},oo.__plugins={},oo.__systems={};let Zh=oo;$.handleByMap(U.RendererPlugin,Zh.__plugins);$.handleByMap(U.RendererSystem,Zh.__systems);$.add(Zh);class Dp extends Zs{constructor(e,t){const{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<e;n++){const o=new Z;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof Zs?this.addResourceAt(e[i],i):this.addResourceAt(Zf(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;const e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}}class Yb extends Dp{constructor(e,t){const{width:i,height:s}=t||{};let n,o;Array.isArray(e)?(n=e,o=e.length):o=e,super(o,{width:i,height:s}),n&&this.initFromArray(n,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=zr.TEXTURE_2D_ARRAY}upload(e,t,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let h=0;h<s;h++){const u=o[h];n[h]<u.dirtyId&&(n[h]=u.dirtyId,u.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,u.resource.width,u.resource.height,1,t.format,i.type,u.resource.source))}return!0}}class qb extends ti{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Bp=class Rs extends Dp{constructor(e,t){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=t||{};if(e&&e.length!==Rs.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Rs.SIDES;a++)this.items[a].target=zr.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,e&&this.initFromArray(e,t),n!==!1&&this.load()}bind(e){super.bind(e),e.target=zr.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=zr.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){const s=this.itemDirtyIds;for(let n=0;n<Rs.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<t.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(e,o,i),s[n]=o.dirtyId):s[n]<-1&&(e.gl.texImage2D(o.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),s[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Rs.SIDES}};Bp.SIDES=6;let Zb=Bp;class Nr extends ti{constructor(e,t){t=t||{};let i,s,n;typeof e=="string"?(i=Nr.EMPTY,s=e,n=!0):(i=e,s=null,n=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??n,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{const i=await V.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===je.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return Nr._EMPTY=Nr._EMPTY??V.ADAPTER.createCanvas(0,0),Nr._EMPTY}}const ql=class ao extends ti{constructor(e,t){t=t||{},super(V.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},ao.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;ti.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,n=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${tr()}`,o.getContext("2d").drawImage(e,0,0,t,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(e){const t=ao.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&ao.SVG_XML.test(e)}};ql.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ql.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Zl=ql;class Kb extends ti{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const Kl=class Ql extends ti{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const s=e[0].src||e[0];ti.crossOrigin(i,s,t.crossorigin);for(let n=0;n<e.length;++n){const o=document.createElement("source");let{src:a,mime:h}=e[n];if(a=a||e[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const u=a.split("?").shift().toLowerCase(),d=u.slice(u.lastIndexOf(".")+1);h=h||Ql.MIME_TYPES[d]||`video/${d}`}o.src=a,h&&(o.type=h),i.appendChild(o)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){const t=Ke.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,i)=>{this.valid?t(this):(this._resolve=t,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ke.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ke.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ke.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Ql.TYPES.includes(t)}};Kl.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Kl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Fp=Kl;Nl.push(Nr,np,qb,Fp,Kb,Zl,jo,Zb,Yb);class Ro{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(e){return this.minX>this.maxX||this.minY>this.maxY?K.EMPTY:(e=e||new K(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){const{a:i,b:s,c:n,d:o,tx:a,ty:h}=e,u=i*t.x+n*t.y+a,d=s*t.x+o*t.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)}addQuad(e){let t=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=e[0],a=e[1];t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[2],a=e[3],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[4],a=e[5],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[6],a=e[7],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=t,this.minY=i,this.maxX=s,this.maxY=n}addFrame(e,t,i,s,n){this.addFrameMatrix(e.worldTransform,t,i,s,n)}addFrameMatrix(e,t,i,s,n){const o=e.a,a=e.b,h=e.c,u=e.d,d=e.tx,l=e.ty;let c=this.minX,f=this.minY,p=this.maxX,g=this.maxY,m=o*t+h*i+d,_=a*t+u*i+l;c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*s+h*i+d,_=a*s+u*i+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*t+h*n+d,_=a*t+u*n+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*s+h*n+d,_=a*s+u*n+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,this.minX=c,this.minY=f,this.maxX=p,this.maxY=g}addVertexData(e,t,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=t;h<i;h+=2){const u=e[h],d=e[h+1];s=u<s?u:s,n=d<n?d:n,o=u>o?u:o,a=d>a?d:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(e,t,i,s){this.addVerticesMatrix(e.worldTransform,t,i,s)}addVerticesMatrix(e,t,i,s,n=0,o=n){const a=e.a,h=e.b,u=e.c,d=e.d,l=e.tx,c=e.ty;let f=this.minX,p=this.minY,g=this.maxX,m=this.maxY;for(let _=i;_<s;_+=2){const v=t[_],x=t[_+1],b=a*v+u*x+l,w=d*x+h*v+c;f=Math.min(f,b-n),g=Math.max(g,b+n),p=Math.min(p,w-o),m=Math.max(m,w+o)}this.minX=f,this.minY=p,this.maxX=g,this.maxY=m}addBounds(e){const t=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>s?e.maxX:s,this.maxY=e.maxY>n?e.maxY:n}addBoundsMask(e,t){const i=e.minX>t.minX?e.minX:t.minX,s=e.minY>t.minY?e.minY:t.minY,n=e.maxX<t.maxX?e.maxX:t.maxX,o=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>u?n:u,this.maxY=o>d?o:d}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const i=e.minX>t.x?e.minX:t.x,s=e.minY>t.y?e.minY:t.y,n=e.maxX<t.x+t.width?e.maxX:t.x+t.width,o=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>u?n:u,this.maxY=o>d?o:d}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,i,s,n,o){e-=n,t-=o,i+=n,s+=o,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>s?this.maxY:s}}class _e extends tn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Yh,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ro,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(e){const t=Object.keys(e);for(let i=0;i<t.length;++i){const s=t[i];Object.defineProperty(_e.prototype,s,Object.getOwnPropertyDescriptor(e,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new K),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new K),e=this._localBoundsRect),this._localBounds||(this._localBounds=new Ro);const t=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,e);return this.parent=i,this.transform=t,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(e,t,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,i,s){return t&&(e=t.toGlobal(e,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,i)}setParent(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e}removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e=0,t=0,i=1,s=1,n=0,o=0,a=0,h=0,u=0){return this.position.x=e,this.position.y=t,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=u,this}destroy(e){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Qb),this.tempDisplayObjectParent}enableTempParent(){const e=this.parent;return this.parent=this._tempDisplayObjectParent,e}disableTempParent(e){this.parent=e}get x(){return this.position.x}set x(e){this.transform.position.x=e}get y(){return this.position.y}set y(e){this.transform.position.y=e}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(e){this.transform.position.copyFrom(e)}get scale(){return this.transform.scale}set scale(e){this.transform.scale.copyFrom(e)}get pivot(){return this.transform.pivot}set pivot(e){this.transform.pivot.copyFrom(e)}get skew(){return this.transform.skew}set skew(e){this.transform.skew.copyFrom(e)}get rotation(){return this.transform.rotation}set rotation(e){this.transform.rotation=e}get angle(){return this.transform.rotation*Wx}set angle(e){this.transform.rotation=e*$x}get zIndex(){return this._zIndex}set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}get mask(){return this._mask}set mask(e){if(this._mask!==e){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,t._maskRefCount===0&&(t.renderable=!0,t.isMask=!1))}if(this._mask=e,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount===0&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class Qb extends _e{constructor(){super(...arguments),this.sortDirty=null}}_e.prototype.displayObjectUpdateTransform=_e.prototype.updateTransform;const Jb=new de;function ew(r,e){return r.zIndex===e.zIndex?r._lastSortedIndex-e._lastSortedIndex:r.zIndex-e.zIndex}const Lp=class Jl extends _e{constructor(){super(),this.children=[],this.sortableChildren=Jl.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const i=this.getChildIndex(e),s=this.getChildIndex(t);this.children[i]=t,this.children[s]=e,this.onChildrenChange(i<s?i:s)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(e);Wr(this.children,i,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],i=this.children.indexOf(t);if(i===-1)return null;t.parent=null,t.transform._parentID=-1,Wr(this.children,i,1),this._boundsID++,this.onChildrenChange(i),t.emit("removed",this),this.emit("childRemoved",t,this,i)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,Wr(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const i=e,s=t,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,i=this.children.length;t<i;++t){const s=this.children[t];s._lastSortedIndex=t,!e&&s.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(ew),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const i=this.children[e];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(t._bounds,i._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const i=super.getLocalBounds(e);if(!t)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Jl.prototype._render&&(i=this.getBounds(!0));const n=e.projection.transform;if(n&&(s?(s=Jb.copyFrom(s),s.prepend(n)):s=n),i&&t.intersects(i,s))this._render(e);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],u=h.cullable;h.cullable=u||!this.cullArea,h.render(e),h.cullable=u}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(t=this.filters)!=null&&t.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(e)}}renderAdvanced(e){var n,o,a;const t=this.filters,i=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<t.length;h++)t[h].enabled&&this._enabledFilters.push(t[h])}const s=t&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ce.NONE));if(s&&e.batch.flush(),t&&((o=this._enabledFilters)!=null&&o.length)&&e.filter.push(this,this._enabledFilters),i&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let h=0,u=this.children.length;h<u;++h)this.children[h].render(e)}s&&e.batch.flush(),i&&e.mask.pop(this),t&&((a=this._enabledFilters)!=null&&a.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,i=this.removeChildren(0,this.children.length);if(t)for(let s=0;s<i.length;++s)i[s].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};Lp.defaultSortableChildren=!1;let vt=Lp;vt.prototype.containerUpdateTransform=vt.prototype.updateTransform;Object.defineProperties(V,{SORTABLE_CHILDREN:{get(){return vt.defaultSortableChildren},set(r){J("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),vt.defaultSortableChildren=r}}});const vs=new ie,tw=new Uint16Array([0,1,2,0,2,3]);class ls extends vt{constructor(e){super(),this._anchor=new Kt(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new ue(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=Y.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||W.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=tw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=V.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=vi(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=vi(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;const t=this.transform.worldTransform,i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,u=this.vertexData,d=e.trim,l=e.orig,c=this._anchor;let f=0,p=0,g=0,m=0;if(d?(p=d.x-c._x*l.width,f=p+d.width,m=d.y-c._y*l.height,g=m+d.height):(p=-c._x*l.width,f=p+l.width,m=-c._y*l.height,g=m+l.height),u[0]=i*p+n*m+a,u[1]=o*m+s*p+h,u[2]=i*f+n*m+a,u[3]=o*m+s*f+h,u[4]=i*f+n*g+a,u[5]=o*g+s*f+h,u[6]=i*p+n*g+a,u[7]=o*g+s*p+h,this._roundPixels){const _=V.RESOLUTION;for(let v=0;v<u.length;++v)u[v]=Math.round(u[v]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const e=this._texture,t=this.vertexTrimmedData,i=e.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,u=n.d,d=n.tx,l=n.ty,c=-s._x*i.width,f=c+i.width,p=-s._y*i.height,g=p+i.height;if(t[0]=o*c+h*p+d,t[1]=u*p+a*c+l,t[2]=o*f+h*p+d,t[3]=u*p+a*f+l,t[4]=o*f+h*g+d,t[5]=u*g+a*f+l,t[6]=o*c+h*g+d,t[7]=u*g+a*c+l,this._roundPixels){const m=V.RESOLUTION;for(let _=0;_<t.length;++_)t[_]=Math.round(t[_]*m)/m}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){const e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||(this._localBounds=new Ro),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new K),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,vs);const t=this._texture.orig.width,i=this._texture.orig.height,s=-t*this.anchor.x;let n=0;return vs.x>=s&&vs.x<s+t&&(n=-i*this.anchor.y,vs.y>=n&&vs.y<n+i)}destroy(e){if(super.destroy(e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof e=="boolean"?e:e==null?void 0:e.texture){const t=typeof e=="boolean"?e:e==null?void 0:e.baseTexture;this._texture.destroy(!!t)}this._texture=null}static from(e,t){const i=e instanceof W?e:W.from(e,t);return new ls(i)}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){const t=vi(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){const t=vi(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get anchor(){return this._anchor}set anchor(e){this._anchor.copyFrom(e)}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||W.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Op=new de;_e.prototype._cacheAsBitmap=!1;_e.prototype._cacheData=null;_e.prototype._cacheAsBitmapResolution=null;_e.prototype._cacheAsBitmapMultisample=null;class iw{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(_e.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let e;r?(this._cacheData||(this._cacheData=new iw),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}});_e.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))};_e.prototype._initCachedDisplayObject=function(r){var c,f;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.alpha;this.alpha=1,r.batch.flush();const t=this.getLocalBounds(new K,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;t.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;t.ceil(i),t.width=Math.max(t.width,1/i),t.height=Math.max(t.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=ar.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),u=`cacheAsBitmap_${tr()}`;this._cacheData.textureCacheId=u,Z.addToCache(h.baseTexture,u),W.addToCache(h,u);const d=this.transform.localTransform.copyTo(Op).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:d,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new ls(h);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)};_e.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))};_e.prototype._initCachedDisplayObjectCanvas=function(r){var d;if((d=this._cacheData)!=null&&d.sprite)return;const e=this.getLocalBounds(new K,!0),t=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);const o=ar.create({width:e.width,height:e.height,resolution:n}),a=`cacheAsBitmap_${tr()}`;this._cacheData.textureCacheId=a,Z.addToCache(o.baseTexture,a),W.addToCache(o,a);const h=Op;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new ls(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)};_e.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};_e.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};_e.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Z.removeFromCache(this._cacheData.textureCacheId),W.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};_e.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)};_e.prototype.name=null;vt.prototype.getChildByName=function(r,e){for(let t=0,i=this.children.length;t<i;t++)if(this.children[t].name===r)return this.children[t];if(e)for(let t=0,i=this.children.length;t<i;t++){const s=this.children[t];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null};_e.prototype.getGlobalPosition=function(r=new ie,e=!1){return this.parent?this.parent.toGlobal(this.position,r,e):(r.x=this.position.x,r.y=this.position.y),r};var rw=`varying vec2 vTextureCoord;
|
|
4213
|
+
`;const jb=$b,Mp=Xb;class Ip{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{const i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Te.HIGH?this.multisample=Te.HIGH:t>=Te.MEDIUM?this.multisample=Te.MEDIUM:t>=Te.LOW?this.multisample=Te.LOW:this.multisample=Te.NONE}destroy(){}}Ip.extension={type:U.RendererSystem,name:"_multisample"};$.add(Ip);class Yb{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Pp{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){const n=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,n.buffer)}}bindBufferRange(e,t,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=e._glBuffers[n]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,o.buffer,i*256,256)}update(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){const{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new Yb(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Pp.extension={type:U.RendererSystem,name:"buffer"};$.add(Pp);class Rp{constructor(e){this.renderer=e}render(e,t){const i=this.renderer;let s,n,o,a;if(t&&(s=t.renderTexture,n=t.clear,o=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=e),!a){const h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(t.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Rp.extension={type:U.RendererSystem,name:"objectRenderer"};$.add(Rp);const ao=class jl extends zb{constructor(e){super(),this.type=bf.WEBGL,e=Object.assign({},V.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new yt({projectionMatrix:new de},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:jl.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(J("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=jl.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:gx()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return J("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return J("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return J("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return J("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){J("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return J("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){J("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return J("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};ao.extension={type:U.Renderer,priority:1},ao.__plugins={},ao.__systems={};let Zh=ao;$.handleByMap(U.RendererPlugin,Zh.__plugins);$.handleByMap(U.RendererSystem,Zh.__systems);$.add(Zh);class Dp extends Ks{constructor(e,t){const{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<e;n++){const o=new Z;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof Ks?this.addResourceAt(e[i],i):this.addResourceAt(Zf(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;const e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}}class qb extends Dp{constructor(e,t){const{width:i,height:s}=t||{};let n,o;Array.isArray(e)?(n=e,o=e.length):o=e,super(o,{width:i,height:s}),n&&this.initFromArray(n,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=zr.TEXTURE_2D_ARRAY}upload(e,t,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let h=0;h<s;h++){const u=o[h];n[h]<u.dirtyId&&(n[h]=u.dirtyId,u.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,u.resource.width,u.resource.height,1,t.format,i.type,u.resource.source))}return!0}}class Zb extends ti{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Bp=class Ds extends Dp{constructor(e,t){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=t||{};if(e&&e.length!==Ds.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Ds.SIDES;a++)this.items[a].target=zr.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,e&&this.initFromArray(e,t),n!==!1&&this.load()}bind(e){super.bind(e),e.target=zr.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=zr.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){const s=this.itemDirtyIds;for(let n=0;n<Ds.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<t.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(e,o,i),s[n]=o.dirtyId):s[n]<-1&&(e.gl.texImage2D(o.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),s[n]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Ds.SIDES}};Bp.SIDES=6;let Kb=Bp;class Nr extends ti{constructor(e,t){t=t||{};let i,s,n;typeof e=="string"?(i=Nr.EMPTY,s=e,n=!0):(i=e,s=null,n=!1),super(i),this.url=s,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??n,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{const i=await V.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===je.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return Nr._EMPTY=Nr._EMPTY??V.ADAPTER.createCanvas(0,0),Nr._EMPTY}}const Yl=class lo extends ti{constructor(e,t){t=t||{},super(V.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},lo.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;ti.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,n=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${tr()}`,o.getContext("2d").drawImage(e,0,0,t,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(e){const t=lo.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&lo.SVG_XML.test(e)}};Yl.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Yl.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let ql=Yl;class Qb extends ti{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const Zl=class Kl extends ti{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const s=e[0].src||e[0];ti.crossOrigin(i,s,t.crossorigin);for(let n=0;n<e.length;++n){const o=document.createElement("source");let{src:a,mime:h}=e[n];if(a=a||e[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const u=a.split("?").shift().toLowerCase(),d=u.slice(u.lastIndexOf(".")+1);h=h||Kl.MIME_TYPES[d]||`video/${d}`}o.src=a,h&&(o.type=h),i.appendChild(o)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){const t=Ke.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,i)=>{this.valid?t(this):(this._resolve=t,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ke.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ke.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ke.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Kl.TYPES.includes(t)}};Zl.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Zl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Fp=Zl;kl.push(Nr,np,Zb,Fp,Qb,ql,Xo,Kb,qb);class Ro{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(e){return this.minX>this.maxX||this.minY>this.maxY?K.EMPTY:(e=e||new K(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){const{a:i,b:s,c:n,d:o,tx:a,ty:h}=e,u=i*t.x+n*t.y+a,d=s*t.x+o*t.y+h;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)}addQuad(e){let t=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=e[0],a=e[1];t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[2],a=e[3],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[4],a=e[5],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=e[6],a=e[7],t=o<t?o:t,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=t,this.minY=i,this.maxX=s,this.maxY=n}addFrame(e,t,i,s,n){this.addFrameMatrix(e.worldTransform,t,i,s,n)}addFrameMatrix(e,t,i,s,n){const o=e.a,a=e.b,h=e.c,u=e.d,d=e.tx,l=e.ty;let c=this.minX,f=this.minY,p=this.maxX,g=this.maxY,m=o*t+h*i+d,_=a*t+u*i+l;c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*s+h*i+d,_=a*s+u*i+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*t+h*n+d,_=a*t+u*n+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,m=o*s+h*n+d,_=a*s+u*n+l,c=m<c?m:c,f=_<f?_:f,p=m>p?m:p,g=_>g?_:g,this.minX=c,this.minY=f,this.maxX=p,this.maxY=g}addVertexData(e,t,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=t;h<i;h+=2){const u=e[h],d=e[h+1];s=u<s?u:s,n=d<n?d:n,o=u>o?u:o,a=d>a?d:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(e,t,i,s){this.addVerticesMatrix(e.worldTransform,t,i,s)}addVerticesMatrix(e,t,i,s,n=0,o=n){const a=e.a,h=e.b,u=e.c,d=e.d,l=e.tx,c=e.ty;let f=this.minX,p=this.minY,g=this.maxX,m=this.maxY;for(let _=i;_<s;_+=2){const v=t[_],x=t[_+1],b=a*v+u*x+l,w=d*x+h*v+c;f=Math.min(f,b-n),g=Math.max(g,b+n),p=Math.min(p,w-o),m=Math.max(m,w+o)}this.minX=f,this.minY=p,this.maxX=g,this.maxY=m}addBounds(e){const t=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>s?e.maxX:s,this.maxY=e.maxY>n?e.maxY:n}addBoundsMask(e,t){const i=e.minX>t.minX?e.minX:t.minX,s=e.minY>t.minY?e.minY:t.minY,n=e.maxX<t.maxX?e.maxX:t.maxX,o=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>u?n:u,this.maxY=o>d?o:d}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const i=e.minX>t.x?e.minX:t.x,s=e.minY>t.y?e.minY:t.y,n=e.maxX<t.x+t.width?e.maxX:t.x+t.width,o=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,u=this.maxX,d=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>u?n:u,this.maxY=o>d?o:d}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,i,s,n,o){e-=n,t-=o,i+=n,s+=o,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>s?this.maxY:s}}class _e extends rn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Yh,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ro,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(e){const t=Object.keys(e);for(let i=0;i<t.length;++i){const s=t[i];Object.defineProperty(_e.prototype,s,Object.getOwnPropertyDescriptor(e,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new K),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new K),e=this._localBoundsRect),this._localBounds||(this._localBounds=new Ro);const t=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,e);return this.parent=i,this.transform=t,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(e,t,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,i,s){return t&&(e=t.toGlobal(e,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,i)}setParent(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e}removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e=0,t=0,i=1,s=1,n=0,o=0,a=0,h=0,u=0){return this.position.x=e,this.position.y=t,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=u,this}destroy(e){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Jb),this.tempDisplayObjectParent}enableTempParent(){const e=this.parent;return this.parent=this._tempDisplayObjectParent,e}disableTempParent(e){this.parent=e}get x(){return this.position.x}set x(e){this.transform.position.x=e}get y(){return this.position.y}set y(e){this.transform.position.y=e}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(e){this.transform.position.copyFrom(e)}get scale(){return this.transform.scale}set scale(e){this.transform.scale.copyFrom(e)}get pivot(){return this.transform.pivot}set pivot(e){this.transform.pivot.copyFrom(e)}get skew(){return this.transform.skew}set skew(e){this.transform.skew.copyFrom(e)}get rotation(){return this.transform.rotation}set rotation(e){this.transform.rotation=e}get angle(){return this.transform.rotation*$x}set angle(e){this.transform.rotation=e*Xx}get zIndex(){return this._zIndex}set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}get mask(){return this._mask}set mask(e){if(this._mask!==e){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,t._maskRefCount===0&&(t.renderable=!0,t.isMask=!1))}if(this._mask=e,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount===0&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class Jb extends _e{constructor(){super(...arguments),this.sortDirty=null}}_e.prototype.displayObjectUpdateTransform=_e.prototype.updateTransform;const ew=new de;function tw(r,e){return r.zIndex===e.zIndex?r._lastSortedIndex-e._lastSortedIndex:r.zIndex-e.zIndex}const Lp=class Ql extends _e{constructor(){super(),this.children=[],this.sortableChildren=Ql.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const i=this.getChildIndex(e),s=this.getChildIndex(t);this.children[i]=t,this.children[s]=e,this.onChildrenChange(i<s?i:s)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(e);Wr(this.children,i,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],i=this.children.indexOf(t);if(i===-1)return null;t.parent=null,t.transform._parentID=-1,Wr(this.children,i,1),this._boundsID++,this.onChildrenChange(i),t.emit("removed",this),this.emit("childRemoved",t,this,i)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,Wr(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const i=e,s=t,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,i=this.children.length;t<i;++t){const s=this.children[t];s._lastSortedIndex=t,!e&&s.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(tw),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const i=this.children[e];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(t._bounds,i._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const i=super.getLocalBounds(e);if(!t)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Ql.prototype._render&&(i=this.getBounds(!0));const n=e.projection.transform;if(n&&(s?(s=ew.copyFrom(s),s.prepend(n)):s=n),i&&t.intersects(i,s))this._render(e);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],u=h.cullable;h.cullable=u||!this.cullArea,h.render(e),h.cullable=u}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(t=this.filters)!=null&&t.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(e)}}renderAdvanced(e){var n,o,a;const t=this.filters,i=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<t.length;h++)t[h].enabled&&this._enabledFilters.push(t[h])}const s=t&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ce.NONE));if(s&&e.batch.flush(),t&&((o=this._enabledFilters)!=null&&o.length)&&e.filter.push(this,this._enabledFilters),i&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let h=0,u=this.children.length;h<u;++h)this.children[h].render(e)}s&&e.batch.flush(),i&&e.mask.pop(this),t&&((a=this._enabledFilters)!=null&&a.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,i=this.removeChildren(0,this.children.length);if(t)for(let s=0;s<i.length;++s)i[s].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};Lp.defaultSortableChildren=!1;let vt=Lp;vt.prototype.containerUpdateTransform=vt.prototype.updateTransform;Object.defineProperties(V,{SORTABLE_CHILDREN:{get(){return vt.defaultSortableChildren},set(r){J("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),vt.defaultSortableChildren=r}}});const xs=new ie,iw=new Uint16Array([0,1,2,0,2,3]);class hs extends vt{constructor(e){super(),this._anchor=new Kt(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new ue(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=Y.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||W.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=iw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=V.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=vi(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=vi(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;const t=this.transform.worldTransform,i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,u=this.vertexData,d=e.trim,l=e.orig,c=this._anchor;let f=0,p=0,g=0,m=0;if(d?(p=d.x-c._x*l.width,f=p+d.width,m=d.y-c._y*l.height,g=m+d.height):(p=-c._x*l.width,f=p+l.width,m=-c._y*l.height,g=m+l.height),u[0]=i*p+n*m+a,u[1]=o*m+s*p+h,u[2]=i*f+n*m+a,u[3]=o*m+s*f+h,u[4]=i*f+n*g+a,u[5]=o*g+s*f+h,u[6]=i*p+n*g+a,u[7]=o*g+s*p+h,this._roundPixels){const _=V.RESOLUTION;for(let v=0;v<u.length;++v)u[v]=Math.round(u[v]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const e=this._texture,t=this.vertexTrimmedData,i=e.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,u=n.d,d=n.tx,l=n.ty,c=-s._x*i.width,f=c+i.width,p=-s._y*i.height,g=p+i.height;if(t[0]=o*c+h*p+d,t[1]=u*p+a*c+l,t[2]=o*f+h*p+d,t[3]=u*p+a*f+l,t[4]=o*f+h*g+d,t[5]=u*g+a*f+l,t[6]=o*c+h*g+d,t[7]=u*g+a*c+l,this._roundPixels){const m=V.RESOLUTION;for(let _=0;_<t.length;++_)t[_]=Math.round(t[_]*m)/m}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){const e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||(this._localBounds=new Ro),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new K),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,xs);const t=this._texture.orig.width,i=this._texture.orig.height,s=-t*this.anchor.x;let n=0;return xs.x>=s&&xs.x<s+t&&(n=-i*this.anchor.y,xs.y>=n&&xs.y<n+i)}destroy(e){if(super.destroy(e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof e=="boolean"?e:e==null?void 0:e.texture){const t=typeof e=="boolean"?e:e==null?void 0:e.baseTexture;this._texture.destroy(!!t)}this._texture=null}static from(e,t){const i=e instanceof W?e:W.from(e,t);return new hs(i)}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){const t=vi(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){const t=vi(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get anchor(){return this._anchor}set anchor(e){this._anchor.copyFrom(e)}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||W.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Op=new de;_e.prototype._cacheAsBitmap=!1;_e.prototype._cacheData=null;_e.prototype._cacheAsBitmapResolution=null;_e.prototype._cacheAsBitmapMultisample=null;class rw{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(_e.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let e;r?(this._cacheData||(this._cacheData=new rw),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}});_e.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))};_e.prototype._initCachedDisplayObject=function(r){var c,f;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.alpha;this.alpha=1,r.batch.flush();const t=this.getLocalBounds(new K,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;t.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;t.ceil(i),t.width=Math.max(t.width,1/i),t.height=Math.max(t.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=ar.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),u=`cacheAsBitmap_${tr()}`;this._cacheData.textureCacheId=u,Z.addToCache(h.baseTexture,u),W.addToCache(h,u);const d=this.transform.localTransform.copyTo(Op).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:d,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new hs(h);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=l.containsPoint.bind(l)};_e.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))};_e.prototype._initCachedDisplayObjectCanvas=function(r){var d;if((d=this._cacheData)!=null&&d.sprite)return;const e=this.getLocalBounds(new K,!0),t=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);const o=ar.create({width:e.width,height:e.height,resolution:n}),a=`cacheAsBitmap_${tr()}`;this._cacheData.textureCacheId=a,Z.addToCache(o.baseTexture,a),W.addToCache(o,a);const h=Op;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new hs(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)};_e.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};_e.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};_e.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Z.removeFromCache(this._cacheData.textureCacheId),W.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};_e.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)};_e.prototype.name=null;vt.prototype.getChildByName=function(r,e){for(let t=0,i=this.children.length;t<i;t++)if(this.children[t].name===r)return this.children[t];if(e)for(let t=0,i=this.children.length;t<i;t++){const s=this.children[t];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null};_e.prototype.getGlobalPosition=function(r=new ie,e=!1){return this.parent?this.parent.toGlobal(this.position,r,e):(r.x=this.position.x,r.y=this.position.y),r};var sw=`varying vec2 vTextureCoord;
|
|
4214
4214
|
|
|
4215
4215
|
uniform sampler2D uSampler;
|
|
4216
4216
|
uniform float uAlpha;
|
|
@@ -4219,9 +4219,9 @@ void main(void)
|
|
|
4219
4219
|
{
|
|
4220
4220
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
4221
4221
|
}
|
|
4222
|
-
`;class
|
|
4223
|
-
`);function
|
|
4224
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const
|
|
4222
|
+
`;class nw extends ze{constructor(e=1){super(jb,sw,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const ow={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},aw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
4223
|
+
`);function lw(r){const e=ow[r],t=e.length;let i=aw,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let h=n.replace("%index%",a.toString());o=a,a>=t&&(o=r-a-1),h=h.replace("%value%",e[o].toString()),s+=h,s+=`
|
|
4224
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const hw=`
|
|
4225
4225
|
attribute vec2 aVertexPosition;
|
|
4226
4226
|
|
|
4227
4227
|
uniform mat3 projectionMatrix;
|
|
@@ -4251,8 +4251,8 @@ void main(void)
|
|
|
4251
4251
|
|
|
4252
4252
|
vec2 textureCoord = filterTextureCoord();
|
|
4253
4253
|
%blur%
|
|
4254
|
-
}`;function
|
|
4255
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class
|
|
4254
|
+
}`;function cw(r,e){const t=Math.ceil(r/2);let i=hw,s="",n;e?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(t-1)}.0`),s+=a,s+=`
|
|
4255
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Jl extends ze{constructor(e,t=8,i=4,s=ze.defaultResolution,n=5){const o=cw(n,e),a=lw(n);super(o,a),this.horizontal=e,this.resolution=s,this._quality=0,this.quality=i,this.blur=t}apply(e,t,i,s){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/t.width):this.uniforms.strength=1/i.height*(i.height/t.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/t.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/t.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,t,i,s);else{const n=e.getFilterTexture(),o=e.renderer;let a=t,h=n;this.state.blend=!1,e.applyFilter(this,a,h,Rt.CLEAR);for(let u=1;u<this.passes-1;u++){e.bindAndClear(a,Rt.BLIT),this.uniforms.uSampler=h;const d=h;h=a,a=d,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,h,i,s),e.returnFilterTexture(n)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}}class uw extends ze{constructor(e=8,t=4,i=ze.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Jl(!0,e,t,i,s),this.blurYFilter=new Jl(!1,e,t,i,s),this.resolution=i,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,i,s){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=e.getFilterTexture();this.blurXFilter.apply(e,t,a,Rt.CLEAR),this.blurYFilter.apply(e,a,i,s),e.returnFilterTexture(a)}else o?this.blurYFilter.apply(e,t,i,s):this.blurXFilter.apply(e,t,i,s)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get blurX(){return this.blurXFilter.blur}set blurX(e){this.blurXFilter.blur=e,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(e){this.blurYFilter.blur=e,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(e){this.blurYFilter.blendMode=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}}var dw=`varying vec2 vTextureCoord;
|
|
4256
4256
|
uniform sampler2D uSampler;
|
|
4257
4257
|
uniform float m[20];
|
|
4258
4258
|
uniform float uAlpha;
|
|
@@ -4304,7 +4304,7 @@ void main(void)
|
|
|
4304
4304
|
|
|
4305
4305
|
gl_FragColor = vec4(rgb, result.a);
|
|
4306
4306
|
}
|
|
4307
|
-
`;class
|
|
4307
|
+
`;class eh extends ze{constructor(){const e={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Mp,dw,e),this.alpha=1}_loadMatrix(e,t=!1){let i=e;t&&(this._multiply(i,this.uniforms.m,e),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(e,t,i){return e[0]=t[0]*i[0]+t[1]*i[5]+t[2]*i[10]+t[3]*i[15],e[1]=t[0]*i[1]+t[1]*i[6]+t[2]*i[11]+t[3]*i[16],e[2]=t[0]*i[2]+t[1]*i[7]+t[2]*i[12]+t[3]*i[17],e[3]=t[0]*i[3]+t[1]*i[8]+t[2]*i[13]+t[3]*i[18],e[4]=t[0]*i[4]+t[1]*i[9]+t[2]*i[14]+t[3]*i[19]+t[4],e[5]=t[5]*i[0]+t[6]*i[5]+t[7]*i[10]+t[8]*i[15],e[6]=t[5]*i[1]+t[6]*i[6]+t[7]*i[11]+t[8]*i[16],e[7]=t[5]*i[2]+t[6]*i[7]+t[7]*i[12]+t[8]*i[17],e[8]=t[5]*i[3]+t[6]*i[8]+t[7]*i[13]+t[8]*i[18],e[9]=t[5]*i[4]+t[6]*i[9]+t[7]*i[14]+t[8]*i[19]+t[9],e[10]=t[10]*i[0]+t[11]*i[5]+t[12]*i[10]+t[13]*i[15],e[11]=t[10]*i[1]+t[11]*i[6]+t[12]*i[11]+t[13]*i[16],e[12]=t[10]*i[2]+t[11]*i[7]+t[12]*i[12]+t[13]*i[17],e[13]=t[10]*i[3]+t[11]*i[8]+t[12]*i[13]+t[13]*i[18],e[14]=t[10]*i[4]+t[11]*i[9]+t[12]*i[14]+t[13]*i[19]+t[14],e[15]=t[15]*i[0]+t[16]*i[5]+t[17]*i[10]+t[18]*i[15],e[16]=t[15]*i[1]+t[16]*i[6]+t[17]*i[11]+t[18]*i[16],e[17]=t[15]*i[2]+t[16]*i[7]+t[17]*i[12]+t[18]*i[17],e[18]=t[15]*i[3]+t[16]*i[8]+t[17]*i[13]+t[18]*i[18],e[19]=t[15]*i[4]+t[16]*i[9]+t[17]*i[14]+t[18]*i[19]+t[19],e}_colorMatrix(e){const t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(e,t){const i=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(i,t)}tint(e,t){const[i,s,n]=ue.shared.setValue(e).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,t)}greyscale(e,t){const i=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(i,t)}blackAndWhite(e){const t=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(t,e)}hue(e,t){e=(e||0)/180*Math.PI;const i=Math.cos(e),s=Math.sin(e),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,u=o*(1-i)-a*s,d=o*(1-i)+a*s,l=o*(1-i)+a*s,c=i+o*(1-i),f=o*(1-i)-a*s,p=o*(1-i)-a*s,g=o*(1-i)+a*s,m=i+o*(1-i),_=[h,u,d,0,0,l,c,f,0,0,p,g,m,0,0,0,0,0,1,0];this._loadMatrix(_,t)}contrast(e,t){const i=(e||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,t)}saturate(e=0,t){const i=e*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,t)}desaturate(){this.saturate(-1)}negative(e){const t=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(t,e)}sepia(e){const t=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(t,e)}technicolor(e){const t=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(t,e)}polaroid(e){const t=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(t,e)}toBGR(e){const t=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(t,e)}kodachrome(e){const t=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(t,e)}browni(e){const t=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(t,e)}vintage(e){const t=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(t,e)}colorTone(e,t,i,s,n){e=e||.2,t=t||.15,i=i||16770432,s=s||3375104;const o=ue.shared,[a,h,u]=o.setValue(i).toArray(),[d,l,c]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,h,u,e,0,d,l,c,t,0,a-d,h-l,u-c,0,0];this._loadMatrix(f,n)}night(e,t){e=e||.1;const i=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(i,t)}predator(e,t){const i=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(i,t)}lsd(e){const t=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(t,e)}reset(){const e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(e,!1)}get matrix(){return this.uniforms.m}set matrix(e){this.uniforms.m=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}eh.prototype.grayscale=eh.prototype.greyscale;var fw=`varying vec2 vFilterCoord;
|
|
4308
4308
|
varying vec2 vTextureCoord;
|
|
4309
4309
|
|
|
4310
4310
|
uniform vec2 scale;
|
|
@@ -4324,7 +4324,7 @@ void main(void)
|
|
|
4324
4324
|
|
|
4325
4325
|
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
4326
4326
|
}
|
|
4327
|
-
`,
|
|
4327
|
+
`,pw=`attribute vec2 aVertexPosition;
|
|
4328
4328
|
|
|
4329
4329
|
uniform mat3 projectionMatrix;
|
|
4330
4330
|
uniform mat3 filterMatrix;
|
|
@@ -4353,7 +4353,7 @@ void main(void)
|
|
|
4353
4353
|
vTextureCoord = filterTextureCoord();
|
|
4354
4354
|
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
4355
4355
|
}
|
|
4356
|
-
`;class
|
|
4356
|
+
`;class mw extends ze{constructor(e,t){const i=new de;e.renderable=!1,super(pw,fw,{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=i,t==null&&(t=20),this.scale=new ie(t,t)}apply(e,t,i,s){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),e.applyFilter(this,t,i,s)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var gw=`varying vec2 v_rgbNW;
|
|
4357
4357
|
varying vec2 v_rgbNE;
|
|
4358
4358
|
varying vec2 v_rgbSW;
|
|
4359
4359
|
varying vec2 v_rgbSE;
|
|
@@ -4474,7 +4474,7 @@ void main() {
|
|
|
4474
4474
|
|
|
4475
4475
|
gl_FragColor = color;
|
|
4476
4476
|
}
|
|
4477
|
-
`,
|
|
4477
|
+
`,_w=`
|
|
4478
4478
|
attribute vec2 aVertexPosition;
|
|
4479
4479
|
|
|
4480
4480
|
uniform mat3 projectionMatrix;
|
|
@@ -4516,7 +4516,7 @@ void main(void) {
|
|
|
4516
4516
|
|
|
4517
4517
|
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
4518
4518
|
}
|
|
4519
|
-
`;class
|
|
4519
|
+
`;class yw extends ze{constructor(){super(_w,gw)}}var vw=`precision highp float;
|
|
4520
4520
|
|
|
4521
4521
|
varying vec2 vTextureCoord;
|
|
4522
4522
|
varying vec4 vColor;
|
|
@@ -4550,8 +4550,8 @@ void main()
|
|
|
4550
4550
|
|
|
4551
4551
|
gl_FragColor = color;
|
|
4552
4552
|
}
|
|
4553
|
-
`;class vw extends ze{constructor(e=.5,t=Math.random()){super(Mp,yw,{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}}const Ku={AlphaFilter:sw,BlurFilter:cw,BlurFilterPass:eh,ColorMatrixFilter:th,DisplacementFilter:pw,FXAAFilter:_w,NoiseFilter:vw};Object.entries(Ku).forEach(([r,e])=>{Object.defineProperty(Ku,r,{get(){return J("7.1.0",`filters.${r} has moved to ${r}`),e}})});class xw{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this.tickerAdded||!this.domElement||(Ke.system.add(this.tickerUpdate,this,ir.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Ke.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const mi=new xw;class sn{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=sn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ie,this.page=new ie,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Do extends sn{constructor(){super(...arguments),this.client=new ie,this.movement=new ie,this.offset=new ie,this.global=new ie,this.screen=new ie}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,s,n,o,a,h,u,d,l,c,f,p,g){throw new Error("Method not implemented.")}}class dt extends Do{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Xr extends Do{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Xr.DOM_DELTA_PIXEL=0,Xr.DOM_DELTA_LINE=1,Xr.DOM_DELTA_PAGE=2;const bw=2048,ww=new ie,za=new ie;class Aw{constructor(e){this.dispatch=new tn,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,s=t.length;i<s;i++)t[i].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){mi.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,ww.set(e,t),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{e.currentTarget=i[n],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i<bw&&e!==this.rootTarget;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,s,n,o=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mi.pauseUpdate=!1),e.interactiveChildren&&e.children){const d=e.children;for(let l=d.length-1;l>=0;l--){const c=d[l],f=this.hitTestMoveRecursive(c,this._isInteractive(t)?t:c.eventMode,i,s,n,o||n(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const h=this._isInteractive(t),u=e.isInteractive();return h&&u&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(e,i)&&s(e,i)?u?[e]:[]:null}hitTestRecursive(e,t,i,s,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mi.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children;for(let u=h.length-1;u>=0;u--){const d=h[u],l=this.hitTestRecursive(d,this._isInteractive(t)?t:d.eventMode,i,s,n);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const c=e.isInteractive();return(l.length>0||c)&&l.push(e),l}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&s(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!!(!e||e.isMask||!e.visible||!e.renderable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren||e.isMask)}hitPruneFn(e,t){var i;if(e.hitArea&&(e.worldTransform.applyInverse(t,za),!e.hitArea.contains(za.x,za.y)))return!0;if(e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,t)))return!0}return!1}hitTestFn(e,t){return e.eventMode==="passive"?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){var n,o;t=t??e.type;const i=`on${t}`;(o=(n=e.currentTarget)[i])==null||o.call(n,e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,u;if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==t.target){const d=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,d,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){const c=this.createPointerEvent(e,"pointerleave",n);for(c.eventPhase=c.AT_TARGET;c.target&&!t.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(n!==t.target){const d=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,d);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let c=n==null?void 0:n.parent;for(;c&&c!==this.rootTarget.parent&&c!==t.target;)c=c.parent;if(!c||c===this.rootTarget.parent){const f=this.clonePointerEvent(t,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(l)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(u=t.target)==null?void 0:u.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(e,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const h=s.clicksByButton[e.button];if(h.target===a.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=t,a.detail=h.clickCount,a.pointerType==="mouse"){const u=a.button===2;this.dispatchEvent(a,u?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof Xr)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const s=this.allocateEvent(dt);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof t=="string"&&(s.type=t),s}createWheelEvent(e){const t=this.allocateEvent(Xr);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const i=this.allocateEvent(dt);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof dt&&t instanceof dt&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Do&&t instanceof Do&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){const i=e.currentTarget._events[t];if(i&&e.currentTarget.isInteractive())if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,n=i.length;s<n&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(t,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}const Tw=1,Sw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ih=class rh{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Aw(null),mi.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new dt(null),this.rootWheelEvent=new Xr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...rh.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,rh._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=t.length;i<s;i++){const n=t[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,mi.pointerMoved();const t=this.normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",s=this.normalizeToPointerData(e);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,mi.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;mi.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;mi.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;e.x=(t-s.left)*(this.domElement.width/s.width)*n,e.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){const n=e.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=e.type,t.push(n)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=Tw),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Sw[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};ih.extension={name:"events",type:[U.RendererSystem,U.CanvasRendererSystem]},ih.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sh=ih;$.add(sh);function Qu(r){return r==="dynamic"||r==="static"}const Ew={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Qu(sh.defaultEventMode)},set interactive(r){J("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sh.defaultEventMode},set eventMode(r){this._internalInteractive=Qu(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,n=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;r=i?`${r}capture`:r;const a=typeof e=="function"?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(r,a,o)}),n?h.once(r,a,o):h.on(r,a,o)},removeEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;r=i?`${r}capture`:r,e=typeof e=="function"?e:e.handleEvent,this.off(r,e,s)},dispatchEvent(r){if(!(r instanceof sn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};_e.mixin(Ew);const Cw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};_e.mixin(Cw);const Mw=9,Pn=100,Iw=0,Pw=0,Ju=2,ed=1,Rw=-1e3,Dw=-1e3,Bw=2;class kp{constructor(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Zt.tablet||Zt.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Pn}px`,t.style.height=`${Pn}px`,t.style.position="absolute",t.style.top=`${Iw}px`,t.style.left=`${Pw}px`,t.style.zIndex=Ju.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const e=document.createElement("button");e.style.width=`${ed}px`,e.style.height=`${ed}px`,e.style.position="absolute",e.style.top=`${Rw}px`,e.style.left=`${Dw}px`,e.style.zIndex=Bw.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)==null||e.appendChild(this.div))}deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)==null||e.removeChild(this.div))}updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}update(){const e=performance.now();if(Zt.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:t,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,u=s/o*h,d=n/a*h;let l=this.div;l.style.left=`${t}px`,l.style.top=`${i}px`,l.style.width=`${o}px`,l.style.height=`${a}px`;for(let c=0;c<this.children.length;c++){const f=this.children[c];if(f.renderId!==this.renderId)f._accessibleActive=!1,Wr(this.children,c,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,c--;else{l=f._accessibleDiv;let p=f.hitArea;const g=f.worldTransform;f.hitArea?(l.style.left=`${(g.tx+p.x*g.a)*u}px`,l.style.top=`${(g.ty+p.y*g.d)*d}px`,l.style.width=`${p.width*g.a*u}px`,l.style.height=`${p.height*g.d*d}px`):(p=f.getBounds(),this.capHitArea(p),l.style.left=`${p.x*u}px`,l.style.top=`${p.y*d}px`,l.style.width=`${p.width*u}px`,l.style.height=`${p.height*d}px`,l.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(l.title=f.accessibleTitle),l.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&l.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==l.title||f.tabIndex!==l.tabIndex)&&(l.title=f.accessibleTitle,l.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(l))}}this.renderId++}updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${Pn}px`,t.style.height=`${Pn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Ju.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{displayObject:i}=e.target,s=this.renderer.events.rootBoundary,n=Object.assign(new sn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,t.forEach(o=>s.dispatchEvent(n,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===Mw&&this.activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}kp.extension={name:"accessibility",type:[U.RendererPlugin,U.CanvasRendererPlugin]};$.add(kp);const Np=class nh{constructor(e){this.stage=new vt,e=Object.assign({forceCanvas:!1},e),this.renderer=Vb(e),nh._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){var e;return(e=this.renderer)==null?void 0:e.view}get screen(){var e;return(e=this.renderer)==null?void 0:e.screen}destroy(e,t){const i=nh._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Np._plugins=[];let Fw=Np;$.handleByList(U.Application,Fw._plugins);class Up{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,i=n}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Up.extension=U.Application;$.add(Up);const td={loader:U.LoadParser,resolver:U.ResolveParser,cache:U.CacheParser,detection:U.DetectionParser};$.handle(U.Asset,r=>{const e=r.ref;Object.entries(td).filter(([t])=>!!e[t]).forEach(([t,i])=>$.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{const e=r.ref;Object.keys(td).filter(t=>!!e[t]).forEach(t=>$.remove(e[t]))});class Lw{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<t;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}}function hs(r,e){if(Array.isArray(e)){for(const t of e)if(r.startsWith(`data:${t}`))return!0;return!1}return r.startsWith(`data:${e}`)}function Mi(r,e){const t=r.split("?")[0],i=Me.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const pt=(r,e,t=!1)=>(Array.isArray(r)||(r=[r]),e?r.map(i=>typeof i=="string"||t?e(i):i):r),oh=(r,e)=>{const t=e.split("?")[1];return t&&(r+=`?${t}`),r};function Gp(r,e,t,i,s){const n=e[t];for(let o=0;o<n.length;o++){const a=n[o];t<e.length-1?Gp(r.replace(i[t],a),e,t+1,i,s):s.push(r.replace(i[t],a))}}function Ow(r){const e=/\{(.*?)\}/g,t=r.match(e),i=[];if(t){const s=[];t.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Gp(r,s,0,t,i)}else i.push(r);return i}const Bo=r=>!Array.isArray(r);class kw{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||console.warn(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const i=pt(e);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(t)){s=h.getCacheableAssets(i,t);break}}s||(s={},i.forEach(a=>{s[a]=t}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==t&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),t instanceof W){const a=t;i.forEach(h=>{a.baseTexture!==W.EMPTY.baseTexture&&Z.addToCache(a.baseTexture,h),W.addToCache(a,h)})}}remove(e){if(!this._cacheMap.has(e)){console.warn(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Xi=new kw;class Nw{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(t.loadParser&&(n=this._parserHash[t.loadParser],n||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!n){for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];if(u.load&&((o=u.test)!=null&&o.call(u,e,t,this))){n=u;break}}if(!n)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(e,t,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];u.parse&&u.parse&&await((a=u.testParse)==null?void 0:a.call(u,s,t,this))&&(s=await u.parse(s,t,this)||s,i.parser=u)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Bo(e),o=pt(e,u=>({alias:[u],src:u})),a=o.length,h=o.map(async u=>{const d=Me.toAbsolute(u.src);if(!s[u.src])try{this.promiseCache[d]||(this.promiseCache[d]=this._getLoadPromiseAndParser(d,u)),s[u.src]=await this.promiseCache[d].promise,t&&t(++i/a)}catch(l){throw delete this.promiseCache[d],delete s[u.src],new Error(`[Loader.load] Failed to load ${d}.
|
|
4554
|
-
${l}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(e){const t=pt(e,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Me.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(e[t.name]&&console.warn(`[Assets] loadParser name conflict "${t.name}"`),{...e,[t.name]:t}),{})}}var bt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(bt||{});const
|
|
4553
|
+
`;class xw extends ze{constructor(e=.5,t=Math.random()){super(Mp,vw,{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}}const Ku={AlphaFilter:nw,BlurFilter:uw,BlurFilterPass:Jl,ColorMatrixFilter:eh,DisplacementFilter:mw,FXAAFilter:yw,NoiseFilter:xw};Object.entries(Ku).forEach(([r,e])=>{Object.defineProperty(Ku,r,{get(){return J("7.1.0",`filters.${r} has moved to ${r}`),e}})});class bw{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this.tickerAdded||!this.domElement||(Ke.system.add(this.tickerUpdate,this,ir.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Ke.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const mi=new bw;class nn{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=nn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ie,this.page=new ie,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Do extends nn{constructor(){super(...arguments),this.client=new ie,this.movement=new ie,this.offset=new ie,this.global=new ie,this.screen=new ie}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,s,n,o,a,h,u,d,l,c,f,p,g){throw new Error("Method not implemented.")}}class dt extends Do{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Xr extends Do{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Xr.DOM_DELTA_PIXEL=0,Xr.DOM_DELTA_LINE=1,Xr.DOM_DELTA_PAGE=2;const ww=2048,Aw=new ie,Ga=new ie;class Tw{constructor(e){this.dispatch=new rn,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,s=t.length;i<s;i++)t[i].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){mi.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,Aw.set(e,t),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{e.currentTarget=i[n],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i<ww&&e!==this.rootTarget;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,s,n,o=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mi.pauseUpdate=!1),e.interactiveChildren&&e.children){const d=e.children;for(let l=d.length-1;l>=0;l--){const c=d[l],f=this.hitTestMoveRecursive(c,this._isInteractive(t)?t:c.eventMode,i,s,n,o||n(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const h=this._isInteractive(t),u=e.isInteractive();return h&&u&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(e,i)&&s(e,i)?u?[e]:[]:null}hitTestRecursive(e,t,i,s,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mi.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children;for(let u=h.length-1;u>=0;u--){const d=h[u],l=this.hitTestRecursive(d,this._isInteractive(t)?t:d.eventMode,i,s,n);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const c=e.isInteractive();return(l.length>0||c)&&l.push(e),l}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&s(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!!(!e||e.isMask||!e.visible||!e.renderable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren||e.isMask)}hitPruneFn(e,t){var i;if(e.hitArea&&(e.worldTransform.applyInverse(t,Ga),!e.hitArea.contains(Ga.x,Ga.y)))return!0;if(e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,t)))return!0}return!1}hitTestFn(e,t){return e.eventMode==="passive"?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){var n,o;t=t??e.type;const i=`on${t}`;(o=(n=e.currentTarget)[i])==null||o.call(n,e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,u;if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==t.target){const d=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,d,n);if(this.dispatchEvent(l,"pointerout"),i&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){const c=this.createPointerEvent(e,"pointerleave",n);for(c.eventPhase=c.AT_TARGET;c.target&&!t.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(n!==t.target){const d=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,d);this.dispatchEvent(l,"pointerover"),i&&this.dispatchEvent(l,"mouseover");let c=n==null?void 0:n.parent;for(;c&&c!==this.rootTarget.parent&&c!==t.target;)c=c.parent;if(!c||c===this.rootTarget.parent){const f=this.clonePointerEvent(t,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(l)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(u=t.target)==null?void 0:u.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(e,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const h=s.clicksByButton[e.button];if(h.target===a.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=t,a.detail=h.clickCount,a.pointerType==="mouse"){const u=a.button===2;this.dispatchEvent(a,u?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof dt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof Xr)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const s=this.allocateEvent(dt);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof t=="string"&&(s.type=t),s}createWheelEvent(e){const t=this.allocateEvent(Xr);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const i=this.allocateEvent(dt);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof dt&&t instanceof dt&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Do&&t instanceof Do&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){const i=e.currentTarget._events[t];if(i&&e.currentTarget.isInteractive())if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,n=i.length;s<n&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(t,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}const Sw=1,Ew={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},th=class ih{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Tw(null),mi.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new dt(null),this.rootWheelEvent=new Xr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...ih.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,ih._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=t.length;i<s;i++){const n=t[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,mi.pointerMoved();const t=this.normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",s=this.normalizeToPointerData(e);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,mi.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;mi.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;mi.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;e.x=(t-s.left)*(this.domElement.width/s.width)*n,e.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){const n=e.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=e.type,t.push(n)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=Sw),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Ew[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};th.extension={name:"events",type:[U.RendererSystem,U.CanvasRendererSystem]},th.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let rh=th;$.add(rh);function Qu(r){return r==="dynamic"||r==="static"}const Cw={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Qu(rh.defaultEventMode)},set interactive(r){J("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??rh.defaultEventMode},set eventMode(r){this._internalInteractive=Qu(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,n=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;r=i?`${r}capture`:r;const a=typeof e=="function"?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(r,a,o)}),n?h.once(r,a,o):h.on(r,a,o)},removeEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;r=i?`${r}capture`:r,e=typeof e=="function"?e:e.handleEvent,this.off(r,e,s)},dispatchEvent(r){if(!(r instanceof nn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};_e.mixin(Cw);const Mw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};_e.mixin(Mw);const Iw=9,Rn=100,Pw=0,Rw=0,Ju=2,ed=1,Dw=-1e3,Bw=-1e3,Fw=2;class kp{constructor(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Zt.tablet||Zt.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Rn}px`,t.style.height=`${Rn}px`,t.style.position="absolute",t.style.top=`${Pw}px`,t.style.left=`${Rw}px`,t.style.zIndex=Ju.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const e=document.createElement("button");e.style.width=`${ed}px`,e.style.height=`${ed}px`,e.style.position="absolute",e.style.top=`${Dw}px`,e.style.left=`${Bw}px`,e.style.zIndex=Fw.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)==null||e.appendChild(this.div))}deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)==null||e.removeChild(this.div))}updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}update(){const e=performance.now();if(Zt.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:t,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,u=s/o*h,d=n/a*h;let l=this.div;l.style.left=`${t}px`,l.style.top=`${i}px`,l.style.width=`${o}px`,l.style.height=`${a}px`;for(let c=0;c<this.children.length;c++){const f=this.children[c];if(f.renderId!==this.renderId)f._accessibleActive=!1,Wr(this.children,c,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,c--;else{l=f._accessibleDiv;let p=f.hitArea;const g=f.worldTransform;f.hitArea?(l.style.left=`${(g.tx+p.x*g.a)*u}px`,l.style.top=`${(g.ty+p.y*g.d)*d}px`,l.style.width=`${p.width*g.a*u}px`,l.style.height=`${p.height*g.d*d}px`):(p=f.getBounds(),this.capHitArea(p),l.style.left=`${p.x*u}px`,l.style.top=`${p.y*d}px`,l.style.width=`${p.width*u}px`,l.style.height=`${p.height*d}px`,l.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(l.title=f.accessibleTitle),l.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&l.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==l.title||f.tabIndex!==l.tabIndex)&&(l.title=f.accessibleTitle,l.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(l))}}this.renderId++}updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${Rn}px`,t.style.height=`${Rn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Ju.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{displayObject:i}=e.target,s=this.renderer.events.rootBoundary,n=Object.assign(new nn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,t.forEach(o=>s.dispatchEvent(n,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===Iw&&this.activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}kp.extension={name:"accessibility",type:[U.RendererPlugin,U.CanvasRendererPlugin]};$.add(kp);const Np=class sh{constructor(e){this.stage=new vt,e=Object.assign({forceCanvas:!1},e),this.renderer=Wb(e),sh._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){var e;return(e=this.renderer)==null?void 0:e.view}get screen(){var e;return(e=this.renderer)==null?void 0:e.screen}destroy(e,t){const i=sh._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Np._plugins=[];let Lw=Np;$.handleByList(U.Application,Lw._plugins);class Up{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,i=n}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Up.extension=U.Application;$.add(Up);const td={loader:U.LoadParser,resolver:U.ResolveParser,cache:U.CacheParser,detection:U.DetectionParser};$.handle(U.Asset,r=>{const e=r.ref;Object.entries(td).filter(([t])=>!!e[t]).forEach(([t,i])=>$.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{const e=r.ref;Object.keys(td).filter(t=>!!e[t]).forEach(t=>$.remove(e[t]))});class Ow{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<t;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}}function cs(r,e){if(Array.isArray(e)){for(const t of e)if(r.startsWith(`data:${t}`))return!0;return!1}return r.startsWith(`data:${e}`)}function Mi(r,e){const t=r.split("?")[0],i=Me.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const pt=(r,e,t=!1)=>(Array.isArray(r)||(r=[r]),e?r.map(i=>typeof i=="string"||t?e(i):i):r),nh=(r,e)=>{const t=e.split("?")[1];return t&&(r+=`?${t}`),r};function Gp(r,e,t,i,s){const n=e[t];for(let o=0;o<n.length;o++){const a=n[o];t<e.length-1?Gp(r.replace(i[t],a),e,t+1,i,s):s.push(r.replace(i[t],a))}}function kw(r){const e=/\{(.*?)\}/g,t=r.match(e),i=[];if(t){const s=[];t.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Gp(r,s,0,t,i)}else i.push(r);return i}const Bo=r=>!Array.isArray(r);class Nw{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||console.warn(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const i=pt(e);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(t)){s=h.getCacheableAssets(i,t);break}}s||(s={},i.forEach(a=>{s[a]=t}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==t&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),t instanceof W){const a=t;i.forEach(h=>{a.baseTexture!==W.EMPTY.baseTexture&&Z.addToCache(a.baseTexture,h),W.addToCache(a,h)})}}remove(e){if(!this._cacheMap.has(e)){console.warn(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Xi=new Nw;class Uw{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(t.loadParser&&(n=this._parserHash[t.loadParser],n||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!n){for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];if(u.load&&((o=u.test)!=null&&o.call(u,e,t,this))){n=u;break}}if(!n)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(e,t,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const u=this.parsers[h];u.parse&&u.parse&&await((a=u.testParse)==null?void 0:a.call(u,s,t,this))&&(s=await u.parse(s,t,this)||s,i.parser=u)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Bo(e),o=pt(e,u=>({alias:[u],src:u})),a=o.length,h=o.map(async u=>{const d=Me.toAbsolute(u.src);if(!s[u.src])try{this.promiseCache[d]||(this.promiseCache[d]=this._getLoadPromiseAndParser(d,u)),s[u.src]=await this.promiseCache[d].promise,t&&t(++i/a)}catch(l){throw delete this.promiseCache[d],delete s[u.src],new Error(`[Loader.load] Failed to load ${d}.
|
|
4554
|
+
${l}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(e){const t=pt(e,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Me.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(e[t.name]&&console.warn(`[Assets] loadParser name conflict "${t.name}"`),{...e,[t.name]:t}),{})}}var bt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(bt||{});const Gw=".json",zw="application/json",Hw={extension:{type:U.LoadParser,priority:bt.Low},name:"loadJson",test(r){return cs(r,zw)||Mi(r,Gw)},async load(r){return await(await V.ADAPTER.fetch(r)).json()}};$.add(Hw);const Vw=".txt",Ww="text/plain",$w={name:"loadTxt",extension:{type:U.LoadParser,priority:bt.Low},test(r){return cs(r,Ww)||Mi(r,Vw)},async load(r){return await(await V.ADAPTER.fetch(r)).text()}};$.add($w);const Xw=["normal","bold","100","200","300","400","500","600","700","800","900"],jw=[".ttf",".otf",".woff",".woff2"],Yw=["font/ttf","font/otf","font/woff","font/woff2"],qw=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Zw(r){const e=Me.extname(r),t=Me.basename(r,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=t.length>0;for(const n of t)if(!n.match(qw)){i=!1;break}let s=t.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Kw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Qw(r){return Kw.test(r)?r:encodeURI(r)}const Jw={extension:{type:U.LoadParser,priority:bt.Low},name:"loadWebFont",test(r){return cs(r,Yw)||Mi(r,jw)},async load(r,e){var i,s,n;const t=V.ADAPTER.getFontFaceSet();if(t){const o=[],a=((i=e.data)==null?void 0:i.family)??Zw(r),h=((n=(s=e.data)==null?void 0:s.weights)==null?void 0:n.filter(d=>Xw.includes(d)))??["normal"],u=e.data??{};for(let d=0;d<h.length;d++){const l=h[d],c=new FontFace(a,`url(${Qw(r)})`,{...u,weight:l});await c.load(),t.add(c),o.push(c)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(e=>V.ADAPTER.getFontFaceSet().delete(e))}};$.add(Jw);const e1=`(function() {
|
|
4555
4555
|
"use strict";
|
|
4556
4556
|
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
4557
4557
|
async function checkImageBitmap() {
|
|
@@ -4568,7 +4568,7 @@ ${l}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(e){const t=pt
|
|
|
4568
4568
|
self.postMessage(result);
|
|
4569
4569
|
});
|
|
4570
4570
|
})();
|
|
4571
|
-
`;let jr=null,
|
|
4571
|
+
`;let jr=null,oh=class extends Worker{constructor(){jr||(jr=URL.createObjectURL(new Blob([e1],{type:"application/javascript"}))),super(jr)}};oh.revokeObjectURL=function(){jr&&(URL.revokeObjectURL(jr),jr=null)};const t1=`(function() {
|
|
4572
4572
|
"use strict";
|
|
4573
4573
|
async function loadImageBitmap(url) {
|
|
4574
4574
|
const response = await fetch(url);
|
|
@@ -4594,8 +4594,8 @@ ${l}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(e){const t=pt
|
|
|
4594
4594
|
}
|
|
4595
4595
|
};
|
|
4596
4596
|
})();
|
|
4597
|
-
`;let Yr=null;class zp extends Worker{constructor(){Yr||(Yr=URL.createObjectURL(new Blob([
|
|
4598
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:e,src:t,data:i,format:s,loadParser:n})):Array.isArray(e)?o.push(...e):o.push(e);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},pt(o).forEach(h=>{const{src:u,srcs:d}=h;let{data:l,format:c,loadParser:f}=h;const p=pt(u||d).map(_=>typeof _=="string"?Ow(_):Array.isArray(_)?_:[_]),g=this.getAlias(h);Array.isArray(g)?g.forEach(a):a(g);const m=[];p.forEach(_=>{_.forEach(v=>{let x={};if(typeof v!="object"){x.src=v;for(let b=0;b<this._parsers.length;b++){const w=this._parsers[b];if(w.test(v)){x=w.parse(v);break}}}else l=v.data??l,c=v.format??c,f=v.loadParser??f,x={...x,...v};if(!g)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this.buildResolvedAsset(x,{aliases:g,data:l,format:c,loadParser:f}),m.push(x)})}),g.forEach(_=>{this._assetMap[_]=m})})}resolveBundle(e){const t=Bo(e);e=pt(e);const i={};return e.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const u=o[h];a[this._extractAssetIdFromBundle(s,h)]=u}i[s]=a}}),t?i[e[0]]:i}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const i={};for(const s in t)i[s]=t[s].src;return i}return t.src}resolve(e){const t=Bo(e);e=pt(e);const i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(u=>{const d=n.filter(l=>l[h]?l[h]===u:!1);d.length&&(n=d)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const i=e[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}buildResolvedAsset(e,t){const{aliases:i,data:s,loadParser:n,format:o}=t;return(this._basePath||this._rootPath)&&(e.src=Me.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=n??e.loadParser,e.format=o??Me.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class d1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new u1,this.loader=new Nw,this.cache=Xi,this._backgroundLoader=new Lw(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let a=e.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const t=((n=e.texturePreference)==null?void 0:n.resolution)??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:(o=e.texturePreference)==null?void 0:o.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,i,s,n){this.resolver.add(e,t,i,s,n)}async load(e,t){this._initialized||await this.init();const i=Bo(e),s=pt(e).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(u=>!this.resolver.hasKey(u))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,t);return i?o[s[0]]:o}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);const s=this.resolver.resolveBundle(e),n={},o=Object.keys(s);let a=0,h=0;const u=()=>{t==null||t(++a/h)},d=o.map(l=>{const c=s[l];return h+=Object.keys(c).length,this._mapLoadToResolve(c,u).then(f=>{n[l]=f})});return await Promise.all(d),i?n[e[0]]:n}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Xi.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=Xi.get(e[i]);return t}async _mapLoadToResolve(e,t){const i=Object.values(e),s=Object.keys(e);this._backgroundLoader.active=!1;const n=await this.loader.load(i,t);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const u=n[a.src],d=[a.src];a.alias&&d.push(...a.alias),o[s[h]]=u,Xi.set(d,u)}),o}async unload(e){this._initialized||await this.init();const t=pt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=pt(e);const t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(i=>{Xi.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}get preferWorkers(){return Qo.config.preferWorkers}set preferWorkers(e){J("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}}const Rn=new d1;$.handleByList(U.LoadParser,Rn.loader.parsers).handleByList(U.ResolveParser,Rn.resolver.parsers).handleByList(U.CacheParser,Rn.cache.parsers).handleByList(U.DetectionParser,Rn.detections);const f1={extension:U.CacheParser,test:r=>Array.isArray(r)&&r.every(e=>e instanceof W),getCacheableAssets:(r,e)=>{const t={};return r.forEach(i=>{e.forEach((s,n)=>{t[i+(n===0?"":n+1)]=s})}),t}};$.add(f1);async function Hp(r){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const p1={extension:{type:U.DetectionParser,priority:1},test:async()=>Hp("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};$.add(p1);const m1={extension:{type:U.DetectionParser,priority:0},test:async()=>Hp("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};$.add(m1);const sd=["png","jpg","jpeg"],g1={extension:{type:U.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...sd],remove:async r=>r.filter(e=>!sd.includes(e))};$.add(g1);const _1="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Kh(r){return _1?!1:document.createElement("video").canPlayType(r)!==""}const y1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};$.add(y1);const v1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};$.add(v1);const x1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};$.add(x1);const b1={extension:U.ResolveParser,test:Qo.test,parse:r=>{var e;return{resolution:parseFloat(((e=V.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:Me.extname(r).slice(1),src:r}}};$.add(b1);var Fe=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Fe||{});const Fo={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Ct,Rr;function nd(){Rr={s3tc:Ct.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ct.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Ct.getExtension("WEBGL_compressed_texture_etc"),etc1:Ct.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Ct.getExtension("WEBGL_compressed_texture_pvrtc")||Ct.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Ct.getExtension("WEBGL_compressed_texture_atc"),astc:Ct.getExtension("WEBGL_compressed_texture_astc"),bptc:Ct.getExtension("EXT_texture_compression_bptc")}}const w1={extension:{type:U.DetectionParser,priority:2},test:async()=>{const r=V.ADAPTER.createCanvas().getContext("webgl");return r?(Ct=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Rr||nd();const e=[];for(const t in Rr)Rr[t]&&e.push(t);return[...e,...r]},remove:async r=>(Rr||nd(),r.filter(e=>!(e in Rr)))};$.add(w1);class A1 extends jo{constructor(e,t={width:1,height:1,autoLoad:!0}){let i,s;typeof e=="string"?(i=e,s=new Uint8Array):(i=null,s=e),super(s,t),this.origin=i,this.buffer=s?new kl(s):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new kl(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class Ji extends A1{constructor(e,t){super(e,t),this.format=t.format,this.levels=t.levels||1,this._width=t.width,this._height=t.height,this._extension=Ji._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||Ji._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,i){const s=e.gl;if(!e.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:u,levelBuffer:d}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,u,0,d)}return!0}onBlobLoaded(){this._levelBuffers=Ji._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,i,s,n,o,a){const h=new Array(i);let u=e.byteOffset,d=o,l=a,c=d+s-1&~(s-1),f=l+n-1&~(n-1),p=c*f*Fo[t];for(let g=0;g<i;g++)h[g]={levelID:g,levelWidth:i>1?d:c,levelHeight:i>1?l:f,levelBuffer:new Uint8Array(e.buffer,u,p)},u+=p,d=d>>1||1,l=l>>1||1,c=d+s-1&~(s-1),f=l+n-1&~(n-1),p=c*f*Fo[t];return h}}const Va=4,Dn=124,T1=32,od=20,S1=542327876,Bn={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},E1={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Fn={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},C1=1,M1=2,I1=4,P1=64,R1=512,D1=131072,B1=827611204,F1=861165636,L1=894720068,O1=808540228,k1=4,N1={[B1]:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,[F1]:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,[L1]:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT},U1={70:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Fe.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Fe.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Fe.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Fe.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function G1(r){const e=new Uint32Array(r);if(e[0]!==S1)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(r,0,Dn/Uint32Array.BYTES_PER_ELEMENT),i=t[Bn.HEIGHT],s=t[Bn.WIDTH],n=t[Bn.MIPMAP_COUNT],o=new Uint32Array(r,Bn.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,T1/Uint32Array.BYTES_PER_ELEMENT),a=o[C1];if(a&I1){const h=o[E1.FOURCC];if(h!==O1){const v=N1[h],x=Va+Dn,b=new Uint8Array(r,x);return[new Ji(b,{format:v,width:s,height:i,levels:n})]}const u=Va+Dn,d=new Uint32Array(e.buffer,u,od/Uint32Array.BYTES_PER_ELEMENT),l=d[Fn.DXGI_FORMAT],c=d[Fn.RESOURCE_DIMENSION],f=d[Fn.MISC_FLAG],p=d[Fn.ARRAY_SIZE],g=U1[l];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(f===k1)throw new Error("DDSParser does not support cubemap textures");if(c===6)throw new Error("DDSParser does not supported 3D texture data");const m=new Array,_=Va+Dn+od;if(p===1)m.push(new Uint8Array(r,_));else{const v=Fo[g];let x=0,b=s,w=i;for(let S=0;S<n;S++){const T=Math.max(1,b+3&-4),M=Math.max(1,w+3&-4),P=T*M*v;x+=P,b=b>>>1,w=w>>>1}let C=_;for(let S=0;S<p;S++)m.push(new Uint8Array(r,C,x)),C+=x}return m.map(v=>new Ji(v,{format:g,width:s,height:i,levels:n}))}throw a&P1?new Error("DDSParser does not support uncompressed texture data."):a&R1?new Error("DDSParser does not supported YUV uncompressed texture data."):a&D1?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&M1?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const ad=[171,75,84,88,32,49,49,187,13,10,26,10],z1=67305985,ct={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},lh=64,ld={[j.UNSIGNED_BYTE]:1,[j.UNSIGNED_SHORT]:2,[j.INT]:4,[j.UNSIGNED_INT]:4,[j.FLOAT]:4,[j.HALF_FLOAT]:8},H1={[O.RGBA]:4,[O.RGB]:3,[O.RG]:2,[O.RED]:1,[O.LUMINANCE]:1,[O.LUMINANCE_ALPHA]:2,[O.ALPHA]:1},V1={[j.UNSIGNED_SHORT_4_4_4_4]:2,[j.UNSIGNED_SHORT_5_5_5_1]:2,[j.UNSIGNED_SHORT_5_6_5]:2};function W1(r,e,t=!1){const i=new DataView(e);if(!$1(r,i))return null;const s=i.getUint32(ct.ENDIANNESS,!0)===z1,n=i.getUint32(ct.GL_TYPE,s),o=i.getUint32(ct.GL_FORMAT,s),a=i.getUint32(ct.GL_INTERNAL_FORMAT,s),h=i.getUint32(ct.PIXEL_WIDTH,s),u=i.getUint32(ct.PIXEL_HEIGHT,s)||1,d=i.getUint32(ct.PIXEL_DEPTH,s)||1,l=i.getUint32(ct.NUMBER_OF_ARRAY_ELEMENTS,s)||1,c=i.getUint32(ct.NUMBER_OF_FACES,s),f=i.getUint32(ct.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(ct.BYTES_OF_KEY_VALUE_DATA,s);if(u===0||d!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");const g=4,m=4,_=h+3&-4,v=u+3&-4,x=new Array(l);let b=h*u;n===0&&(b=_*v);let w;if(n!==0?ld[n]?w=ld[n]*H1[o]:w=V1[n]:w=Fo[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const C=t?j1(i,p,s):null;let S=b*w,T=h,M=u,P=_,R=v,E=lh+p;for(let A=0;A<f;A++){const I=i.getUint32(E,s);let D=E+4;for(let B=0;B<l;B++){let k=x[B];k||(k=x[B]=new Array(f)),k[A]={levelID:A,levelWidth:f>1||n!==0?T:P,levelHeight:f>1||n!==0?M:R,levelBuffer:new Uint8Array(e,D,S)},D+=S}E+=I+4,E=E%4!==0?E+4-E%4:E,T=T>>1||1,M=M>>1||1,P=T+g-1&~(g-1),R=M+m-1&~(m-1),S=P*R*w}return n!==0?{uncompressed:x.map(A=>{let I=A[0].levelBuffer,D=!1;return n===j.FLOAT?I=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===j.UNSIGNED_INT?(D=!0,I=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===j.INT&&(D=!0,I=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new jo(I,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:D?X1(o):o}}),kvData:C}:{compressed:x.map(A=>new Ji(null,{format:a,width:h,height:u,levels:f,levelBuffers:A})),kvData:C}}function $1(r,e){for(let t=0;t<ad.length;t++)if(e.getUint8(t)!==ad[t])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function X1(r){switch(r){case O.RGBA:return O.RGBA_INTEGER;case O.RGB:return O.RGB_INTEGER;case O.RG:return O.RG_INTEGER;case O.RED:return O.RED_INTEGER;default:return r}}function j1(r,e,t){const i=new Map;let s=0;for(;s<e;){const n=r.getUint32(lh+s,t),o=lh+s+4,a=3-(n+3)%4;if(n===0||n>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const u=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),d=new DataView(r.buffer,o+h+1,n-h-1);i.set(u,d),s+=4+n+a}return i}const Y1={extension:{type:U.LoadParser,priority:bt.High},name:"loadDDS",test(r){return Mi(r,".dds")},async load(r,e,t){const i=await(await V.ADAPTER.fetch(r)).arrayBuffer(),s=G1(i).map(n=>{const o=new Z(n,{mipmap:Ut.OFF,alphaMode:je.NO_PREMULTIPLIED_ALPHA,resolution:ei(r),...e.data});return nn(o,t,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(e=>e.destroy(!0)):r.destroy(!0)}};$.add(Y1);const q1={extension:{type:U.LoadParser,priority:bt.High},name:"loadKTX",test(r){return Mi(r,".ktx")},async load(r,e,t){const i=await(await V.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=W1(r,i),a=s??n,h={mipmap:Ut.OFF,alphaMode:je.NO_PREMULTIPLIED_ALPHA,resolution:ei(r),...e.data},u=a.map(d=>{a===n&&Object.assign(h,{type:d.type,format:d.format});const l=d.resource??d,c=new Z(l,h);return c.ktxKeyValueData=o,nn(c,t,r)});return u.length===1?u[0]:u},unload(r){Array.isArray(r)?r.forEach(e=>e.destroy(!0)):r.destroy(!0)}};$.add(q1);const Z1={extension:U.ResolveParser,test:r=>{const e=Me.extname(r).slice(1);return["basis","ktx","dds"].includes(e)},parse:r=>{var t,i;const e=Me.extname(r).slice(1);if(e==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx",".bptc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((t=V.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=V.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:e,src:r}}};$.add(Z1);const Ln=new K,K1=4,Vp=class Ds{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,i,s){const n=new Image;return n.src=await this.base64(e,t,i,s),n}async base64(e,t,i,s){const n=this.canvas(e,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(h)},t,i)});if(n.toDataURL!==void 0)return n.toDataURL(t,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:t,quality:i});return new Promise((a,h)=>{const u=new FileReader;u.onload=()=>a(u.result),u.onerror=h,u.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);o&&Ds._flipY(i,s,n),a&&Ds._unpremultiplyAlpha(i);const h=new Rx(s,n,1),u=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(u,0,0),h.canvas}pixels(e,t){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);return o&&Ds._flipY(i,s,n),a&&Ds._unpremultiplyAlpha(i),i}_rawPixels(e,t){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;e&&(e instanceof ar?a=e:(a=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),h=!0,t&&(Ln.width=t.width,Ln.height=t.height,t=Ln)));const u=i.gl;if(a){if(s=a.baseTexture.resolution,t=t??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===O.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,t||(t=Ln,t.width=i.width/s,t.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const d=Math.max(Math.round(t.width*s),1),l=Math.max(Math.round(t.height*s),1),c=new Uint8Array(K1*d*l);return u.readPixels(Math.round(t.x*s),Math.round(t.y*s),d,l,u.RGBA,u.UNSIGNED_BYTE,c),h&&(a==null||a.destroy(!0)),{pixels:c,width:d,height:l,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(e,t,i){const s=t<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,u=(i-a-1)*s;o.set(e.subarray(h,h+s)),e.copyWithin(h,u,u+s),e.set(o,u)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let i=0;i<t;i+=4){const s=e[i+3];if(s!==0){const n=255.001/s;e[i]=e[i]*n+.5,e[i+1]=e[i+1]*n+.5,e[i+2]=e[i+2]*n+.5}}}};Vp.extension={name:"extract",type:U.RendererSystem};let Q1=Vp;$.add(Q1);const Lo={build(r){const e=r.points;let t,i,s,n,o,a;if(r.type===Oe.CIRC){const p=r.shape;t=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===Oe.ELIP){const p=r.shape;t=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,g=p.width/2,m=p.height/2;t=p.x+g,i=p.y+m,o=a=Math.max(0,Math.min(p.radius,Math.min(g,m))),s=g-o,n=m-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),u=h*8+(s?4:0)+(n?4:0);if(e.length=u,u===0)return;if(h===0){e.length=8,e[0]=e[6]=t+s,e[1]=e[3]=i+n,e[2]=e[4]=t-s,e[5]=e[7]=i-n;return}let d=0,l=h*4+(s?2:0)+2,c=l,f=u;{const p=s+o,g=n,m=t+p,_=t-p,v=i+g;if(e[d++]=m,e[d++]=v,e[--l]=v,e[--l]=_,n){const x=i-g;e[c++]=_,e[c++]=x,e[--f]=x,e[--f]=m}}for(let p=1;p<h;p++){const g=Math.PI/2*(p/h),m=s+Math.cos(g)*o,_=n+Math.sin(g)*a,v=t+m,x=t-m,b=i+_,w=i-_;e[d++]=v,e[d++]=b,e[--l]=b,e[--l]=x,e[c++]=x,e[c++]=w,e[--f]=w,e[--f]=v}{const p=s,g=n+a,m=t+p,_=t-p,v=i+g,x=i-g;e[d++]=m,e[d++]=v,e[--f]=x,e[--f]=m,s&&(e[d++]=_,e[d++]=v,e[--f]=x,e[--f]=_)}},triangulate(r,e){const t=r.points,i=e.points,s=e.indices;if(t.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==Oe.RREC){const d=r.shape;a=d.x,h=d.y}else{const d=r.shape;a=d.x+d.width/2,h=d.y+d.height/2}const u=r.matrix;i.push(r.matrix?u.a*a+u.c*h+u.tx:a,r.matrix?u.b*a+u.d*h+u.ty:h),n++,i.push(t[0],t[1]);for(let d=2;d<t.length;d+=2)i.push(t[d],t[d+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function hd(r,e=!1){const t=r.length;if(t<6)return;let i=0;for(let s=0,n=r[t-2],o=r[t-1];s<t;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!e&&i>0||e&&i<=0){const s=t/2;for(let n=s+s%2;n<t;n+=2){const o=t-n-2,a=t-n-1,h=n,u=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[u]]=[r[u],r[a]]}}}const Wp={build(r){r.points=r.shape.points.slice()},triangulate(r,e){let t=r.points;const i=r.holes,s=e.points,n=e.indices;if(t.length>=6){hd(t,!1);const o=[];for(let u=0;u<i.length;u++){const d=i[u];hd(d.points,!0),o.push(t.length/2),t=t.concat(d.points)}const a=W_(t,o,2);if(!a)return;const h=s.length/2;for(let u=0;u<a.length;u+=3)n.push(a[u]+h),n.push(a[u+1]+h),n.push(a[u+2]+h);for(let u=0;u<t.length;u++)s.push(t[u])}}},J1={build(r){const e=r.shape,t=e.x,i=e.y,s=e.width,n=e.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(t,i,t+s,i,t+s,i+n,t,i+n)},triangulate(r,e){const t=r.points,i=e.points;if(t.length===0)return;const s=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},eA={build(r){Lo.build(r)},triangulate(r,e){Lo.triangulate(r,e)}};var Je=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Je||{}),xi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(xi||{});const is={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,e=20){if(!this.adaptive||!r||isNaN(r))return e;let t=Math.ceil(r/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class cd{static curveTo(e,t,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-t,u=a-e,d=s-t,l=i-e,c=Math.abs(h*l-u*d);if(c<1e-8||n===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.push(e,t),null;const f=h*h+u*u,p=d*d+l*l,g=h*d+u*l,m=n*Math.sqrt(f)/c,_=n*Math.sqrt(p)/c,v=m*g/f,x=_*g/p,b=m*l+_*u,w=m*d+_*h,C=u*(_+v),S=h*(_+v),T=l*(m+x),M=d*(m+x),P=Math.atan2(S-w,C-b),R=Math.atan2(M-w,T-b);return{cx:b+e,cy:w+t,radius:n,startAngle:P,endAngle:R,anticlockwise:u*d>l*h}}static arc(e,t,i,s,n,o,a,h,u){const d=a-o,l=is._segmentsCount(Math.abs(d)*n,Math.ceil(Math.abs(d)/Eo)*40),c=d/(l*2),f=c*2,p=Math.cos(c),g=Math.sin(c),m=l-1,_=m%1/m;for(let v=0;v<=m;++v){const x=v+_*v,b=c+o+f*x,w=Math.cos(b),C=-Math.sin(b);u.push((p*w+g*C)*n+i,(p*-C+g*w)*n+s)}}}class tA{constructor(){this.reset()}begin(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Qh{static curveLength(e,t,i,s,n,o,a,h){let u=0,d=0,l=0,c=0,f=0,p=0,g=0,m=0,_=0,v=0,x=0,b=e,w=t;for(let C=1;C<=10;++C)d=C/10,l=d*d,c=l*d,f=1-d,p=f*f,g=p*f,m=g*e+3*p*d*i+3*f*l*n+c*a,_=g*t+3*p*d*s+3*f*l*o+c*h,v=b-m,x=w-_,b=m,w=_,u+=Math.sqrt(v*v+x*x);return u}static curveTo(e,t,i,s,n,o,a){const h=a[a.length-2],u=a[a.length-1];a.length-=2;const d=is._segmentsCount(Qh.curveLength(h,u,e,t,i,s,n,o));let l=0,c=0,f=0,p=0,g=0;a.push(h,u);for(let m=1,_=0;m<=d;++m)_=m/d,l=1-_,c=l*l,f=c*l,p=_*_,g=p*_,a.push(f*h+3*c*_*e+3*l*p*i+g*n,f*u+3*c*_*t+3*l*p*s+g*o)}}function ud(r,e,t,i,s,n,o,a){const h=r-t*s,u=e-i*s,d=r+t*n,l=e+i*n;let c,f;o?(c=i,f=-t):(c=-i,f=t);const p=h+c,g=u+f,m=d+c,_=l+f;return a.push(p,g,m,_),2}function Oi(r,e,t,i,s,n,o,a){const h=t-r,u=i-e;let d=Math.atan2(h,u),l=Math.atan2(s-r,n-e);a&&d<l?d+=Math.PI*2:!a&&d>l&&(l+=Math.PI*2);let c=d;const f=l-d,p=Math.abs(f),g=Math.sqrt(h*h+u*u),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,_=f/m;if(c+=_,a){o.push(r,e,t,i);for(let v=1,x=c;v<m;v++,x+=_)o.push(r,e,r+Math.sin(x)*g,e+Math.cos(x)*g);o.push(r,e,s,n)}else{o.push(t,i,r,e);for(let v=1,x=c;v<m;v++,x+=_)o.push(r+Math.sin(x)*g,e+Math.cos(x)*g,r,e);o.push(s,n,r,e)}return m*2}function iA(r,e){const t=r.shape;let i=r.points||t.points.slice();const s=e.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new ie(i[0],i[1]),a=new ie(i[i.length-2],i[i.length-1]),h=t.type!==Oe.POLY||t.closeStroke,u=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),u&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const k=(o.x+a.x)*.5,z=(a.y+o.y)*.5;i.unshift(k,z),i.push(k,z)}const d=e.points,l=i.length/2;let c=i.length;const f=d.length/2,p=n.width/2,g=p*p,m=n.miterLimit*n.miterLimit;let _=i[0],v=i[1],x=i[2],b=i[3],w=0,C=0,S=-(v-b),T=_-x,M=0,P=0,R=Math.sqrt(S*S+T*T);S/=R,T/=R,S*=p,T*=p;const E=n.alignment,A=(1-E)*2,I=E*2;h||(n.cap===xi.ROUND?c+=Oi(_-S*(A-I)*.5,v-T*(A-I)*.5,_-S*A,v-T*A,_+S*I,v+T*I,d,!0)+2:n.cap===xi.SQUARE&&(c+=ud(_,v,S,T,A,I,!0,d))),d.push(_-S*A,v-T*A,_+S*I,v+T*I);for(let k=1;k<l-1;++k){_=i[(k-1)*2],v=i[(k-1)*2+1],x=i[k*2],b=i[k*2+1],w=i[(k+1)*2],C=i[(k+1)*2+1],S=-(v-b),T=_-x,R=Math.sqrt(S*S+T*T),S/=R,T/=R,S*=p,T*=p,M=-(b-C),P=x-w,R=Math.sqrt(M*M+P*P),M/=R,P/=R,M*=p,P*=p;const z=x-_,q=v-b,L=x-w,F=C-b,G=z*L+q*F,Q=q*L-F*z,ee=Q<0;if(Math.abs(Q)<.001*Math.abs(G)){d.push(x-S*A,b-T*A,x+S*I,b+T*I),G>=0&&(n.join===Je.ROUND?c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+4:c+=2,d.push(x-M*I,b-P*I,x+M*A,b+P*A));continue}const oe=(-S+_)*(-T+b)-(-S+x)*(-T+v),pe=(-M+w)*(-P+b)-(-M+x)*(-P+C),ye=(z*pe-L*oe)/Q,Ae=(F*oe-q*pe)/Q,ae=(ye-x)*(ye-x)+(Ae-b)*(Ae-b),be=x+(ye-x)*A,ne=b+(Ae-b)*A,ve=x-(ye-x)*I,he=b-(Ae-b)*I,Be=Math.min(z*z+q*q,L*L+F*F),Ne=ee?A:I,Ii=Be+Ne*Ne*g,Pi=ae<=Ii;let an=n.join;if(an===Je.MITER&&ae/g>m&&(an=Je.BEVEL),Pi)switch(an){case Je.MITER:{d.push(be,ne,ve,he);break}case Je.BEVEL:{ee?d.push(be,ne,x+S*I,b+T*I,be,ne,x+M*I,b+P*I):d.push(x-S*A,b-T*A,ve,he,x-M*A,b-P*A,ve,he),c+=2;break}case Je.ROUND:{ee?(d.push(be,ne,x+S*I,b+T*I),c+=Oi(x,b,x+S*I,b+T*I,x+M*I,b+P*I,d,!0)+4,d.push(be,ne,x+M*I,b+P*I)):(d.push(x-S*A,b-T*A,ve,he),c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+4,d.push(x-M*A,b-P*A,ve,he));break}}else{switch(d.push(x-S*A,b-T*A,x+S*I,b+T*I),an){case Je.MITER:{ee?d.push(ve,he,ve,he):d.push(be,ne,be,ne),c+=2;break}case Je.ROUND:{ee?c+=Oi(x,b,x+S*I,b+T*I,x+M*I,b+P*I,d,!0)+2:c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+2;break}}d.push(x-M*A,b-P*A,x+M*I,b+P*I),c+=2}}_=i[(l-2)*2],v=i[(l-2)*2+1],x=i[(l-1)*2],b=i[(l-1)*2+1],S=-(v-b),T=_-x,R=Math.sqrt(S*S+T*T),S/=R,T/=R,S*=p,T*=p,d.push(x-S*A,b-T*A,x+S*I,b+T*I),h||(n.cap===xi.ROUND?c+=Oi(x-S*(A-I)*.5,b-T*(A-I)*.5,x-S*A,b-T*A,x+S*I,b+T*I,d,!1)+2:n.cap===xi.SQUARE&&(c+=ud(x,b,S,T,A,I,!1,d)));const D=e.indices,B=is.epsilon*is.epsilon;for(let k=f;k<c+f-2;++k)_=d[k*2],v=d[k*2+1],x=d[(k+1)*2],b=d[(k+1)*2+1],w=d[(k+2)*2],C=d[(k+2)*2+1],!(Math.abs(_*(b-C)+x*(C-v)+w*(v-b))<B)&&D.push(k,k+1,k+2)}function rA(r,e){let t=0;const i=r.shape,s=r.points||i.points,n=i.type!==Oe.POLY||i.closeStroke;if(s.length===0)return;const o=e.points,a=e.indices,h=s.length/2,u=o.length/2;let d=u;for(o.push(s[0],s[1]),t=1;t<h;t++)o.push(s[t*2],s[t*2+1]),a.push(d,d+1),d++;n&&a.push(d,u)}function dd(r,e){r.lineStyle.native?rA(r,e):iA(r,e)}class Jh{static curveLength(e,t,i,s,n,o){const a=e-2*i+n,h=t-2*s+o,u=2*i-2*e,d=2*s-2*t,l=4*(a*a+h*h),c=4*(a*u+h*d),f=u*u+d*d,p=2*Math.sqrt(l+c+f),g=Math.sqrt(l),m=2*l*g,_=2*Math.sqrt(f),v=c/g;return(m*p+g*c*(p-_)+(4*f*l-c*c)*Math.log((2*g+v+p)/(v+_)))/(4*m)}static curveTo(e,t,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=is._segmentsCount(Jh.curveLength(o,a,e,t,i,s));let u=0,d=0;for(let l=1;l<=h;++l){const c=l/h;u=o+(e-o)*c,d=a+(t-a)*c,n.push(u+(e+(i-e)*c-u)*c,d+(t+(s-t)*c-d)*c)}}}const Wa={[Oe.POLY]:Wp,[Oe.CIRC]:Lo,[Oe.ELIP]:Lo,[Oe.RECT]:J1,[Oe.RREC]:eA},fd=[],On=[];class Oo{constructor(e,t=null,i=null,s=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=s,this.type=e.type}clone(){return new Oo(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const mr=new ie,$p=class Xp extends Kf{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ro,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),On.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),fd.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,i=null,s=null){const n=new Oo(e,t,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const i=new Oo(e,null,null,t),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){const t=this.graphicsData;for(let i=0;i<t.length;++i){const s=t[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(e,mr):mr.copyFrom(e),s.shape.contains(mr.x,mr.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(mr.x,mr.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const e=this.uvs,t=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<t.length;h++){this.shapeIndex++;const u=t[h],d=u.fillStyle,l=u.lineStyle;Wa[u.type].build(u),u.matrix&&this.transformPoints(u.points,u.matrix),(d.visible||l.visible)&&this.processHoles(u.holes);for(let c=0;c<2;c++){const f=c===0?d:l;if(!f.visible)continue;const p=f.texture.baseTexture,g=this.indices.length,m=this.points.length/2;p.wrapMode=wi.REPEAT,c===0?this.processFill(u):this.processLine(u);const _=this.points.length/2-m;_!==0&&(i&&!this._compareStyles(s,f)&&(i.end(g,m),i=null),i||(i=fd.pop()||new tA,i.begin(f,g,m),this.batches.push(i),s=f),this.addUvs(this.points,e,f.texture,m,_,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e<t;e++){const i=this.graphicsData[e],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const e=this.batches;for(let t=0,i=e.length;t<i;t++){const s=e[t];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<Xp.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++Z._globalBatch;for(let l=0;l<this.drawCalls.length;l++)this.drawCalls[l].texArray.clear(),On.push(this.drawCalls[l]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let s=On.pop();s||(s=new Gl,s.texArray=new Wl),s.texArray.count=0,s.start=0,s.size=0,s.type=Ft.TRIANGLES;let n=0,o=null,a=0,h=!1,u=Ft.TRIANGLES,d=0;this.drawCalls.push(s);for(let l=0;l<this.batches.length;l++){const c=this.batches[l],f=8,p=c.style,g=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,u=h?Ft.LINES:Ft.TRIANGLES,o=null,n=f,e++),o!==g&&(o=g,g._batchEnabled!==e&&(n===f&&(e++,n=0,s.size>0&&(s=On.pop(),s||(s=new Gl,s.texArray=new Wl),this.drawCalls.push(s)),s.start=d,s.size=0,s.texArray.count=0,s.type=u),g.touched=1,g._batchEnabled=e,g._batchLocation=n,g.wrapMode=wi.REPEAT,s.texArray.elements[s.texArray.count++]=g,n++)),s.size+=c.size,d+=c.size,a=g._batchLocation,this.addColors(t,p.color,p.alpha,c.attribSize,c.attribStart),this.addTextureIds(i,a,c.attribSize,c.attribStart)}Z._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(e.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let u=0;u<e.length/2;u++)o[h++]=e[u*2],o[h++]=e[u*2+1],o[h++]=t[u*2],o[h++]=t[u*2+1],a[h++]=i[u],o[h++]=s[u];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?Wp.triangulate(e,this):Wa[e.type].triangulate(e,this)}processLine(e){dd(e,this);for(let t=0;t<e.holes.length;t++)dd(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];Wa[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let i=0;i<e.length/2;i++){const s=e[i*2],n=e[i*2+1];e[i*2]=t.a*s+t.c*n+t.tx,e[i*2+1]=t.b*s+t.d*n+t.ty}}addColors(e,t,i,s,n=0){const o=ue.shared.setValue(t).toLittleEndianNumber(),a=ue.shared.setValue(o).toPremultiplied(i);e.length=Math.max(e.length,n+s);for(let h=0;h<s;h++)e[n+h]=a}addTextureIds(e,t,i,s=0){e.length=Math.max(e.length,s+i);for(let n=0;n<i;n++)e[s+n]=t}addUvs(e,t,i,s,n,o=null){let a=0;const h=t.length,u=i.frame;for(;a<n;){let l=e[(s+a)*2],c=e[(s+a)*2+1];if(o){const f=o.a*l+o.c*c+o.tx;c=o.b*l+o.d*c+o.ty,l=f}a++,t.push(l/u.width,c/u.height)}const d=i.baseTexture;(u.width<d.width||u.height<d.height)&&this.adjustUvs(t,i,h,n)}adjustUvs(e,t,i,s){const n=t.baseTexture,o=1e-6,a=i+s*2,h=t.frame,u=h.width/n.width,d=h.height/n.height;let l=h.x/h.width,c=h.y/h.height,f=Math.floor(e[i]+o),p=Math.floor(e[i+1]+o);for(let g=i+2;g<a;g+=2)f=Math.min(f,Math.floor(e[g]+o)),p=Math.min(p,Math.floor(e[g+1]+o));l-=f,c-=p;for(let g=i;g<a;g+=2)e[g]=(e[g]+l)*u,e[g+1]=(e[g+1]+c)*d}};$p.BATCHABLE_SIZE=100;let sA=$p;class Jo{constructor(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Jo;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e}reset(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ec extends Jo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=xi.BUTT,this.join=Je.MITER,this.miterLimit=10}clone(){const e=new ec;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=xi.BUTT,this.join=Je.MITER,this.miterLimit=10}}const $a={},hh=class lo extends vt{constructor(e=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Jo,this._lineStyle=new ec,this._matrix=null,this._holeMode=!1,this.state=Gt.for2d(),this._geometry=e||new sA,this._geometry.refCount++,this._transformID=-1,this._tintColor=new ue(16777215),this.blendMode=Y.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new lo(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,i,s=.5,n=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:i,alignment:s,native:n}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:W.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:xi.BUTT,join:Je.MITER,miterLimit:10};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.width>0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},e)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new Qi,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new Qi,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==e||n!==t)&&i.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Jh.curveTo(e,t,i,s,n),this}bezierCurveTo(e,t,i,s,n,o){return this._initCurve(),Qh.curveTo(e,t,i,s,n,o,this.currentPath.points),this}arcTo(e,t,i,s,n){this._initCurve(e,t);const o=this.currentPath.points,a=cd.curveTo(e,t,i,s,n,o);if(a){const{cx:h,cy:u,radius:d,startAngle:l,endAngle:c,anticlockwise:f}=a;this.arc(h,u,d,l,c,f)}return this}arc(e,t,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=Eo:o&&s<=n&&(s+=Eo),n-s===0)return this;const a=e+Math.cos(s)*i,h=t+Math.sin(s)*i,u=this._geometry.closePointEps;let d=this.currentPath?this.currentPath.points:null;if(d){const l=Math.abs(d[d.length-2]-a),c=Math.abs(d[d.length-1]-h);l<u&&c<u||d.push(a,h)}else this.moveTo(a,h),d=this.currentPath.points;return cd.arc(a,h,e,t,i,s,n,o,d),this}beginFill(e=0,t){return this.beginTextureFill({texture:W.WHITE,color:e,alpha:t})}normalizeColor(e){const t=ue.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:W.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,i,s){return this.drawShape(new K(e,t,i,s))}drawRoundedRect(e,t,i,s,n){return this.drawShape(new Zo(e,t,i,s,n))}drawCircle(e,t,i){return this.drawShape(new Yo(e,t,i))}drawEllipse(e,t,i,s){return this.drawShape(new qo(e,t,i,s))}drawPolygon(...e){let t,i=!0;const s=e[0];s.points?(i=s.closeStroke,t=s.points):Array.isArray(e[0])?t=e[0]:t=e;const n=new Qi(t);return n.closeStroke=i,this.drawShape(n),this}drawShape(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===Oe.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();const t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){const e=this._geometry,t=this.blendMode,i=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(e.points);for(let s=0;s<i;s++){const n=e.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(e.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),u=new Uint16Array(e.indicesUint16.buffer,n.start*2,n.size),d={vertexData:a,blendMode:t,indices:u,uvs:h,_batchRGB:ue.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=d}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,i=this.batches.length;t<i;t++){const s=this.batches[t];s.worldAlpha=this.worldAlpha*s.alpha,e.plugins[this.pluginName].render(s)}}}_renderDirect(e){const t=this._resolveDirectShader(e),i=this._geometry,s=this.worldAlpha,n=t.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,ue.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),e.shader.bind(t),e.geometry.bind(i,t),e.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(e,i.drawCalls[a])}_renderDrawCallDirect(e,t){const{texArray:i,type:s,size:n,start:o}=t,a=i.count;for(let h=0;h<a;h++)e.texture.bind(i.elements[h],h);e.geometry.draw(s,n,o)}_resolveDirectShader(e){let t=this.shader;const i=this.pluginName;if(!t){if(!$a[i]){const{maxTextures:s}=e.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new de,default:yt.from({uSamplers:n},!0)},a=e.plugins[i]._shader.program;$a[i]=new kt(a,o)}t=$a[i]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:i,maxX:s,maxY:n}=e.bounds;this._bounds.addFrame(this.transform,t,i,s,n)}containsPoint(e){return this.worldTransform.applyInverse(e,lo._TEMP_POINT),this._geometry.containsPoint(lo._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t._tintRGB=ue.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;const t=this.transform.worldTransform,i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,u=this._geometry.points,d=this.vertexData;let l=0;for(let c=0;c<u.length;c+=2){const f=u[c],p=u[c+1];d[l++]=i*f+n*p+a,d[l++]=o*p+s*f+h}}closePath(){const e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this}setMatrix(e){return this._matrix=e,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(e)}};hh.curves=is,hh._TEMP_POINT=new ie;let jp=hh;class nA{constructor(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(e){if(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}}const Xa=new ie,pd=new Qi,Yp=class qp extends vt{constructor(e,t,i,s=Ft.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||Gt.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=V.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(e){this.shader=e}get material(){return this.shader}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(e){this.shader.tint=e}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(e){this.shader.texture=e}_render(e){const t=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===Ft.TRIANGLES&&t.length<qp.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(e){const t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){const t=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[s]),e.plugins[s].render(this)}calculateVertices(){const e=this.geometry.buffers[0],t=e.data,i=e._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,u=s.tx,d=s.ty,l=this.vertexData;for(let c=0;c<l.length/2;c++){const f=t[c*2],p=t[c*2+1];l[c*2]=n*f+a*p+u,l[c*2+1]=o*f+h*p+d}if(this._roundPixels){const c=V.RESOLUTION;for(let f=0;f<l.length;++f)l[f]=Math.round(l[f]*c)/c}this.vertexDirty=i}calculateUvs(){const e=this.geometry.buffers[1],t=this.shader;t.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new nA(e,t.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,Xa);const t=this.geometry.getBuffer("aVertexPosition").data,i=pd.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,u=s[a+1]*2,d=s[a+2]*2;if(i[0]=t[h],i[1]=t[h+1],i[2]=t[u],i[3]=t[u+1],i[4]=t[d],i[5]=t[d+1],pd.contains(Xa.x,Xa.y))return!0}return!1}destroy(e){super.destroy(e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Yp.BATCHABLE_SIZE=100;let md=Yp;class oA extends Ti{constructor(e,t,i){super();const s=new we(e),n=new we(t,!0),o=new we(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,j.FLOAT).addAttribute("aTextureCoord",n,2,!1,j.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var aA=`varying vec2 vTextureCoord;
|
|
4597
|
+
`;let Yr=null;class zp extends Worker{constructor(){Yr||(Yr=URL.createObjectURL(new Blob([t1],{type:"application/javascript"}))),super(Yr)}}zp.revokeObjectURL=function(){Yr&&(URL.revokeObjectURL(Yr),Yr=null)};let id=0,za;class i1{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{const t=new oh;t.addEventListener("message",i=>{t.terminate(),oh.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){za===void 0&&(za=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers<za&&(this._createdWorkers++,e=new zp,e.addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error!==void 0?this.resolveHash[e.uuid].reject(e.error):this.resolveHash[e.uuid].resolve(e.data),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:e,arguments:t,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),i=t.id;this.resolveHash[id]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:id++,id:i})}}const rd=new i1;function on(r,e,t){r.resource.internal=!0;const i=new W(r),s=()=>{delete e.promiseCache[t],Xi.has(t)&&Xi.remove(t)};return i.baseTexture.once("destroyed",()=>{t in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const r1=[".jpeg",".jpg",".png",".webp",".avif"],s1=["image/jpeg","image/png","image/webp","image/avif"];async function n1(r){const e=await V.ADAPTER.fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const Ko={name:"loadTextures",extension:{type:U.LoadParser,priority:bt.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return cs(r,s1)||Mi(r,r1)},async load(r,e,t){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await rd.isImageBitmapSupported()?s=await rd.loadImageBitmap(r):s=await n1(r):s=await new Promise((h,u)=>{const d=new Image;d.crossOrigin=this.config.crossOrigin,d.src=r,d.complete?h(d):(d.onload=()=>h(d),d.onerror=l=>u(l))});const n={...e.data};n.resolution??(n.resolution=ei(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new Z(s,n);return o.resource.src=r,on(o,t,r)},unload(r){r.destroy(!0)}};$.add(Ko);const o1=".svg",a1="image/svg+xml",l1={extension:{type:U.LoadParser,priority:bt.High},name:"loadSVG",test(r){return cs(r,a1)||Mi(r,o1)},async testParse(r){return ql.test(r)},async parse(r,e,t){var n;const i=new ql(r,(n=e==null?void 0:e.data)==null?void 0:n.resourceOptions);await i.load();const s=new Z(i,{resolution:ei(r),...e==null?void 0:e.data});return s.resource.src=e.src,on(s,t,e.src)},async load(r,e){return(await V.ADAPTER.fetch(r)).text()},unload:Ko.unload};$.add(l1);const h1=[".mp4",".m4v",".webm",".ogv"],c1=["video/mp4","video/webm","video/ogg"],u1={name:"loadVideo",extension:{type:U.LoadParser,priority:bt.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return cs(r,c1)||Mi(r,h1)},async load(r,e,t){var o;let i;const s=await(await V.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=e==null?void 0:e.data)==null?void 0:o.resourceOptions,autoLoad:!0},h=new Fp(n,a);await h.load();const u=new Z(h,{alphaMode:await mx(),resolution:ei(r),...e==null?void 0:e.data});u.resource.src=r,i=on(u,t,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};$.add(u1);class d1{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){const{alias:t,name:i,src:s,srcs:n}=e;return pt(t||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(e){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const i=[];Array.isArray(t)?t.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(e,o);i.push(h),a=[o,h]}else{const h=o.map(u=>this._createBundleAssetId(e,u));i.push(...h),a=[...o,...h]}this.add({...s,alias:a,src:n})}):Object.keys(t).forEach(s=>{const n=[s,this._createBundleAssetId(e,s)];if(typeof t[s]=="string")this.add({alias:n,src:t[s]});else if(Array.isArray(t[s]))this.add({alias:n,src:t[s]});else{const o=t[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[e]=i}add(e,t,i,s,n){const o=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(J("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
4598
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:e,src:t,data:i,format:s,loadParser:n})):Array.isArray(e)?o.push(...e):o.push(e);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},pt(o).forEach(h=>{const{src:u,srcs:d}=h;let{data:l,format:c,loadParser:f}=h;const p=pt(u||d).map(_=>typeof _=="string"?kw(_):Array.isArray(_)?_:[_]),g=this.getAlias(h);Array.isArray(g)?g.forEach(a):a(g);const m=[];p.forEach(_=>{_.forEach(v=>{let x={};if(typeof v!="object"){x.src=v;for(let b=0;b<this._parsers.length;b++){const w=this._parsers[b];if(w.test(v)){x=w.parse(v);break}}}else l=v.data??l,c=v.format??c,f=v.loadParser??f,x={...x,...v};if(!g)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this.buildResolvedAsset(x,{aliases:g,data:l,format:c,loadParser:f}),m.push(x)})}),g.forEach(_=>{this._assetMap[_]=m})})}resolveBundle(e){const t=Bo(e);e=pt(e);const i={};return e.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const u=o[h];a[this._extractAssetIdFromBundle(s,h)]=u}i[s]=a}}),t?i[e[0]]:i}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const i={};for(const s in t)i[s]=t[s].src;return i}return t.src}resolve(e){const t=Bo(e);e=pt(e);const i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(u=>{const d=n.filter(l=>l[h]?l[h]===u:!1);d.length&&(n=d)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const i=e[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}buildResolvedAsset(e,t){const{aliases:i,data:s,loadParser:n,format:o}=t;return(this._basePath||this._rootPath)&&(e.src=Me.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=n??e.loadParser,e.format=o??Me.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class f1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new d1,this.loader=new Uw,this.cache=Xi,this._backgroundLoader=new Ow(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let a=e.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const t=((n=e.texturePreference)==null?void 0:n.resolution)??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:(o=e.texturePreference)==null?void 0:o.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,i,s,n){this.resolver.add(e,t,i,s,n)}async load(e,t){this._initialized||await this.init();const i=Bo(e),s=pt(e).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(u=>!this.resolver.hasKey(u))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,t);return i?o[s[0]]:o}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);const s=this.resolver.resolveBundle(e),n={},o=Object.keys(s);let a=0,h=0;const u=()=>{t==null||t(++a/h)},d=o.map(l=>{const c=s[l];return h+=Object.keys(c).length,this._mapLoadToResolve(c,u).then(f=>{n[l]=f})});return await Promise.all(d),i?n[e[0]]:n}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Xi.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=Xi.get(e[i]);return t}async _mapLoadToResolve(e,t){const i=Object.values(e),s=Object.keys(e);this._backgroundLoader.active=!1;const n=await this.loader.load(i,t);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const u=n[a.src],d=[a.src];a.alias&&d.push(...a.alias),o[s[h]]=u,Xi.set(d,u)}),o}async unload(e){this._initialized||await this.init();const t=pt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=pt(e);const t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(i=>{Xi.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}get preferWorkers(){return Ko.config.preferWorkers}set preferWorkers(e){J("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}}const Dn=new f1;$.handleByList(U.LoadParser,Dn.loader.parsers).handleByList(U.ResolveParser,Dn.resolver.parsers).handleByList(U.CacheParser,Dn.cache.parsers).handleByList(U.DetectionParser,Dn.detections);const p1={extension:U.CacheParser,test:r=>Array.isArray(r)&&r.every(e=>e instanceof W),getCacheableAssets:(r,e)=>{const t={};return r.forEach(i=>{e.forEach((s,n)=>{t[i+(n===0?"":n+1)]=s})}),t}};$.add(p1);async function Hp(r){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const m1={extension:{type:U.DetectionParser,priority:1},test:async()=>Hp("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};$.add(m1);const g1={extension:{type:U.DetectionParser,priority:0},test:async()=>Hp("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};$.add(g1);const sd=["png","jpg","jpeg"],_1={extension:{type:U.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...sd],remove:async r=>r.filter(e=>!sd.includes(e))};$.add(_1);const y1="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Kh(r){return y1?!1:document.createElement("video").canPlayType(r)!==""}const v1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};$.add(v1);const x1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};$.add(x1);const b1={extension:{type:U.DetectionParser,priority:0},test:async()=>Kh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};$.add(b1);const w1={extension:U.ResolveParser,test:Ko.test,parse:r=>{var e;return{resolution:parseFloat(((e=V.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:Me.extname(r).slice(1),src:r}}};$.add(w1);var Fe=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Fe||{});const Fo={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Ct,Rr;function nd(){Rr={s3tc:Ct.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ct.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Ct.getExtension("WEBGL_compressed_texture_etc"),etc1:Ct.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Ct.getExtension("WEBGL_compressed_texture_pvrtc")||Ct.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Ct.getExtension("WEBGL_compressed_texture_atc"),astc:Ct.getExtension("WEBGL_compressed_texture_astc"),bptc:Ct.getExtension("EXT_texture_compression_bptc")}}const A1={extension:{type:U.DetectionParser,priority:2},test:async()=>{const r=V.ADAPTER.createCanvas().getContext("webgl");return r?(Ct=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Rr||nd();const e=[];for(const t in Rr)Rr[t]&&e.push(t);return[...e,...r]},remove:async r=>(Rr||nd(),r.filter(e=>!(e in Rr)))};$.add(A1);class T1 extends Xo{constructor(e,t={width:1,height:1,autoLoad:!0}){let i,s;typeof e=="string"?(i=e,s=new Uint8Array):(i=null,s=e),super(s,t),this.origin=i,this.buffer=s?new Ol(s):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new Ol(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class Ji extends T1{constructor(e,t){super(e,t),this.format=t.format,this.levels=t.levels||1,this._width=t.width,this._height=t.height,this._extension=Ji._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||Ji._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,i){const s=e.gl;if(!e.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:u,levelBuffer:d}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,u,0,d)}return!0}onBlobLoaded(){this._levelBuffers=Ji._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,i,s,n,o,a){const h=new Array(i);let u=e.byteOffset,d=o,l=a,c=d+s-1&~(s-1),f=l+n-1&~(n-1),p=c*f*Fo[t];for(let g=0;g<i;g++)h[g]={levelID:g,levelWidth:i>1?d:c,levelHeight:i>1?l:f,levelBuffer:new Uint8Array(e.buffer,u,p)},u+=p,d=d>>1||1,l=l>>1||1,c=d+s-1&~(s-1),f=l+n-1&~(n-1),p=c*f*Fo[t];return h}}const Ha=4,Bn=124,S1=32,od=20,E1=542327876,Fn={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},C1={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ln={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},M1=1,I1=2,P1=4,R1=64,D1=512,B1=131072,F1=827611204,L1=861165636,O1=894720068,k1=808540228,N1=4,U1={[F1]:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,[L1]:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,[O1]:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT},G1={70:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Fe.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Fe.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Fe.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Fe.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Fe.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Fe.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Fe.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Fe.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function z1(r){const e=new Uint32Array(r);if(e[0]!==E1)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(r,0,Bn/Uint32Array.BYTES_PER_ELEMENT),i=t[Fn.HEIGHT],s=t[Fn.WIDTH],n=t[Fn.MIPMAP_COUNT],o=new Uint32Array(r,Fn.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,S1/Uint32Array.BYTES_PER_ELEMENT),a=o[M1];if(a&P1){const h=o[C1.FOURCC];if(h!==k1){const v=U1[h],x=Ha+Bn,b=new Uint8Array(r,x);return[new Ji(b,{format:v,width:s,height:i,levels:n})]}const u=Ha+Bn,d=new Uint32Array(e.buffer,u,od/Uint32Array.BYTES_PER_ELEMENT),l=d[Ln.DXGI_FORMAT],c=d[Ln.RESOURCE_DIMENSION],f=d[Ln.MISC_FLAG],p=d[Ln.ARRAY_SIZE],g=G1[l];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(f===N1)throw new Error("DDSParser does not support cubemap textures");if(c===6)throw new Error("DDSParser does not supported 3D texture data");const m=new Array,_=Ha+Bn+od;if(p===1)m.push(new Uint8Array(r,_));else{const v=Fo[g];let x=0,b=s,w=i;for(let S=0;S<n;S++){const T=Math.max(1,b+3&-4),M=Math.max(1,w+3&-4),P=T*M*v;x+=P,b=b>>>1,w=w>>>1}let C=_;for(let S=0;S<p;S++)m.push(new Uint8Array(r,C,x)),C+=x}return m.map(v=>new Ji(v,{format:g,width:s,height:i,levels:n}))}throw a&R1?new Error("DDSParser does not support uncompressed texture data."):a&D1?new Error("DDSParser does not supported YUV uncompressed texture data."):a&B1?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&I1?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const ad=[171,75,84,88,32,49,49,187,13,10,26,10],H1=67305985,ct={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ah=64,ld={[j.UNSIGNED_BYTE]:1,[j.UNSIGNED_SHORT]:2,[j.INT]:4,[j.UNSIGNED_INT]:4,[j.FLOAT]:4,[j.HALF_FLOAT]:8},V1={[O.RGBA]:4,[O.RGB]:3,[O.RG]:2,[O.RED]:1,[O.LUMINANCE]:1,[O.LUMINANCE_ALPHA]:2,[O.ALPHA]:1},W1={[j.UNSIGNED_SHORT_4_4_4_4]:2,[j.UNSIGNED_SHORT_5_5_5_1]:2,[j.UNSIGNED_SHORT_5_6_5]:2};function $1(r,e,t=!1){const i=new DataView(e);if(!X1(r,i))return null;const s=i.getUint32(ct.ENDIANNESS,!0)===H1,n=i.getUint32(ct.GL_TYPE,s),o=i.getUint32(ct.GL_FORMAT,s),a=i.getUint32(ct.GL_INTERNAL_FORMAT,s),h=i.getUint32(ct.PIXEL_WIDTH,s),u=i.getUint32(ct.PIXEL_HEIGHT,s)||1,d=i.getUint32(ct.PIXEL_DEPTH,s)||1,l=i.getUint32(ct.NUMBER_OF_ARRAY_ELEMENTS,s)||1,c=i.getUint32(ct.NUMBER_OF_FACES,s),f=i.getUint32(ct.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(ct.BYTES_OF_KEY_VALUE_DATA,s);if(u===0||d!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");const g=4,m=4,_=h+3&-4,v=u+3&-4,x=new Array(l);let b=h*u;n===0&&(b=_*v);let w;if(n!==0?ld[n]?w=ld[n]*V1[o]:w=W1[n]:w=Fo[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const C=t?Y1(i,p,s):null;let S=b*w,T=h,M=u,P=_,R=v,E=ah+p;for(let A=0;A<f;A++){const I=i.getUint32(E,s);let D=E+4;for(let B=0;B<l;B++){let k=x[B];k||(k=x[B]=new Array(f)),k[A]={levelID:A,levelWidth:f>1||n!==0?T:P,levelHeight:f>1||n!==0?M:R,levelBuffer:new Uint8Array(e,D,S)},D+=S}E+=I+4,E=E%4!==0?E+4-E%4:E,T=T>>1||1,M=M>>1||1,P=T+g-1&~(g-1),R=M+m-1&~(m-1),S=P*R*w}return n!==0?{uncompressed:x.map(A=>{let I=A[0].levelBuffer,D=!1;return n===j.FLOAT?I=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===j.UNSIGNED_INT?(D=!0,I=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===j.INT&&(D=!0,I=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Xo(I,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:D?j1(o):o}}),kvData:C}:{compressed:x.map(A=>new Ji(null,{format:a,width:h,height:u,levels:f,levelBuffers:A})),kvData:C}}function X1(r,e){for(let t=0;t<ad.length;t++)if(e.getUint8(t)!==ad[t])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function j1(r){switch(r){case O.RGBA:return O.RGBA_INTEGER;case O.RGB:return O.RGB_INTEGER;case O.RG:return O.RG_INTEGER;case O.RED:return O.RED_INTEGER;default:return r}}function Y1(r,e,t){const i=new Map;let s=0;for(;s<e;){const n=r.getUint32(ah+s,t),o=ah+s+4,a=3-(n+3)%4;if(n===0||n>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const u=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),d=new DataView(r.buffer,o+h+1,n-h-1);i.set(u,d),s+=4+n+a}return i}const q1={extension:{type:U.LoadParser,priority:bt.High},name:"loadDDS",test(r){return Mi(r,".dds")},async load(r,e,t){const i=await(await V.ADAPTER.fetch(r)).arrayBuffer(),s=z1(i).map(n=>{const o=new Z(n,{mipmap:Ut.OFF,alphaMode:je.NO_PREMULTIPLIED_ALPHA,resolution:ei(r),...e.data});return on(o,t,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(e=>e.destroy(!0)):r.destroy(!0)}};$.add(q1);const Z1={extension:{type:U.LoadParser,priority:bt.High},name:"loadKTX",test(r){return Mi(r,".ktx")},async load(r,e,t){const i=await(await V.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=$1(r,i),a=s??n,h={mipmap:Ut.OFF,alphaMode:je.NO_PREMULTIPLIED_ALPHA,resolution:ei(r),...e.data},u=a.map(d=>{a===n&&Object.assign(h,{type:d.type,format:d.format});const l=d.resource??d,c=new Z(l,h);return c.ktxKeyValueData=o,on(c,t,r)});return u.length===1?u[0]:u},unload(r){Array.isArray(r)?r.forEach(e=>e.destroy(!0)):r.destroy(!0)}};$.add(Z1);const K1={extension:U.ResolveParser,test:r=>{const e=Me.extname(r).slice(1);return["basis","ktx","dds"].includes(e)},parse:r=>{var t,i;const e=Me.extname(r).slice(1);if(e==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx",".bptc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((t=V.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=V.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:e,src:r}}};$.add(K1);const On=new K,Q1=4,Vp=class Bs{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,i,s){const n=new Image;return n.src=await this.base64(e,t,i,s),n}async base64(e,t,i,s){const n=this.canvas(e,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(h)},t,i)});if(n.toDataURL!==void 0)return n.toDataURL(t,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:t,quality:i});return new Promise((a,h)=>{const u=new FileReader;u.onload=()=>a(u.result),u.onerror=h,u.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);o&&Bs._flipY(i,s,n),a&&Bs._unpremultiplyAlpha(i);const h=new Dx(s,n,1),u=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(u,0,0),h.canvas}pixels(e,t){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);return o&&Bs._flipY(i,s,n),a&&Bs._unpremultiplyAlpha(i),i}_rawPixels(e,t){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;e&&(e instanceof ar?a=e:(a=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),h=!0,t&&(On.width=t.width,On.height=t.height,t=On)));const u=i.gl;if(a){if(s=a.baseTexture.resolution,t=t??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===O.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,t||(t=On,t.width=i.width/s,t.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const d=Math.max(Math.round(t.width*s),1),l=Math.max(Math.round(t.height*s),1),c=new Uint8Array(Q1*d*l);return u.readPixels(Math.round(t.x*s),Math.round(t.y*s),d,l,u.RGBA,u.UNSIGNED_BYTE,c),h&&(a==null||a.destroy(!0)),{pixels:c,width:d,height:l,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(e,t,i){const s=t<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,u=(i-a-1)*s;o.set(e.subarray(h,h+s)),e.copyWithin(h,u,u+s),e.set(o,u)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let i=0;i<t;i+=4){const s=e[i+3];if(s!==0){const n=255.001/s;e[i]=e[i]*n+.5,e[i+1]=e[i+1]*n+.5,e[i+2]=e[i+2]*n+.5}}}};Vp.extension={name:"extract",type:U.RendererSystem};let J1=Vp;$.add(J1);const Lo={build(r){const e=r.points;let t,i,s,n,o,a;if(r.type===Oe.CIRC){const p=r.shape;t=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===Oe.ELIP){const p=r.shape;t=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,g=p.width/2,m=p.height/2;t=p.x+g,i=p.y+m,o=a=Math.max(0,Math.min(p.radius,Math.min(g,m))),s=g-o,n=m-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),u=h*8+(s?4:0)+(n?4:0);if(e.length=u,u===0)return;if(h===0){e.length=8,e[0]=e[6]=t+s,e[1]=e[3]=i+n,e[2]=e[4]=t-s,e[5]=e[7]=i-n;return}let d=0,l=h*4+(s?2:0)+2,c=l,f=u;{const p=s+o,g=n,m=t+p,_=t-p,v=i+g;if(e[d++]=m,e[d++]=v,e[--l]=v,e[--l]=_,n){const x=i-g;e[c++]=_,e[c++]=x,e[--f]=x,e[--f]=m}}for(let p=1;p<h;p++){const g=Math.PI/2*(p/h),m=s+Math.cos(g)*o,_=n+Math.sin(g)*a,v=t+m,x=t-m,b=i+_,w=i-_;e[d++]=v,e[d++]=b,e[--l]=b,e[--l]=x,e[c++]=x,e[c++]=w,e[--f]=w,e[--f]=v}{const p=s,g=n+a,m=t+p,_=t-p,v=i+g,x=i-g;e[d++]=m,e[d++]=v,e[--f]=x,e[--f]=m,s&&(e[d++]=_,e[d++]=v,e[--f]=x,e[--f]=_)}},triangulate(r,e){const t=r.points,i=e.points,s=e.indices;if(t.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==Oe.RREC){const d=r.shape;a=d.x,h=d.y}else{const d=r.shape;a=d.x+d.width/2,h=d.y+d.height/2}const u=r.matrix;i.push(r.matrix?u.a*a+u.c*h+u.tx:a,r.matrix?u.b*a+u.d*h+u.ty:h),n++,i.push(t[0],t[1]);for(let d=2;d<t.length;d+=2)i.push(t[d],t[d+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function hd(r,e=!1){const t=r.length;if(t<6)return;let i=0;for(let s=0,n=r[t-2],o=r[t-1];s<t;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!e&&i>0||e&&i<=0){const s=t/2;for(let n=s+s%2;n<t;n+=2){const o=t-n-2,a=t-n-1,h=n,u=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[u]]=[r[u],r[a]]}}}const Wp={build(r){r.points=r.shape.points.slice()},triangulate(r,e){let t=r.points;const i=r.holes,s=e.points,n=e.indices;if(t.length>=6){hd(t,!1);const o=[];for(let u=0;u<i.length;u++){const d=i[u];hd(d.points,!0),o.push(t.length/2),t=t.concat(d.points)}const a=$_(t,o,2);if(!a)return;const h=s.length/2;for(let u=0;u<a.length;u+=3)n.push(a[u]+h),n.push(a[u+1]+h),n.push(a[u+2]+h);for(let u=0;u<t.length;u++)s.push(t[u])}}},eA={build(r){const e=r.shape,t=e.x,i=e.y,s=e.width,n=e.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(t,i,t+s,i,t+s,i+n,t,i+n)},triangulate(r,e){const t=r.points,i=e.points;if(t.length===0)return;const s=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},tA={build(r){Lo.build(r)},triangulate(r,e){Lo.triangulate(r,e)}};var Je=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Je||{}),xi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(xi||{});const rs={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,e=20){if(!this.adaptive||!r||isNaN(r))return e;let t=Math.ceil(r/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class cd{static curveTo(e,t,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-t,u=a-e,d=s-t,l=i-e,c=Math.abs(h*l-u*d);if(c<1e-8||n===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.push(e,t),null;const f=h*h+u*u,p=d*d+l*l,g=h*d+u*l,m=n*Math.sqrt(f)/c,_=n*Math.sqrt(p)/c,v=m*g/f,x=_*g/p,b=m*l+_*u,w=m*d+_*h,C=u*(_+v),S=h*(_+v),T=l*(m+x),M=d*(m+x),P=Math.atan2(S-w,C-b),R=Math.atan2(M-w,T-b);return{cx:b+e,cy:w+t,radius:n,startAngle:P,endAngle:R,anticlockwise:u*d>l*h}}static arc(e,t,i,s,n,o,a,h,u){const d=a-o,l=rs._segmentsCount(Math.abs(d)*n,Math.ceil(Math.abs(d)/Eo)*40),c=d/(l*2),f=c*2,p=Math.cos(c),g=Math.sin(c),m=l-1,_=m%1/m;for(let v=0;v<=m;++v){const x=v+_*v,b=c+o+f*x,w=Math.cos(b),C=-Math.sin(b);u.push((p*w+g*C)*n+i,(p*-C+g*w)*n+s)}}}class iA{constructor(){this.reset()}begin(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Qh{static curveLength(e,t,i,s,n,o,a,h){let u=0,d=0,l=0,c=0,f=0,p=0,g=0,m=0,_=0,v=0,x=0,b=e,w=t;for(let C=1;C<=10;++C)d=C/10,l=d*d,c=l*d,f=1-d,p=f*f,g=p*f,m=g*e+3*p*d*i+3*f*l*n+c*a,_=g*t+3*p*d*s+3*f*l*o+c*h,v=b-m,x=w-_,b=m,w=_,u+=Math.sqrt(v*v+x*x);return u}static curveTo(e,t,i,s,n,o,a){const h=a[a.length-2],u=a[a.length-1];a.length-=2;const d=rs._segmentsCount(Qh.curveLength(h,u,e,t,i,s,n,o));let l=0,c=0,f=0,p=0,g=0;a.push(h,u);for(let m=1,_=0;m<=d;++m)_=m/d,l=1-_,c=l*l,f=c*l,p=_*_,g=p*_,a.push(f*h+3*c*_*e+3*l*p*i+g*n,f*u+3*c*_*t+3*l*p*s+g*o)}}function ud(r,e,t,i,s,n,o,a){const h=r-t*s,u=e-i*s,d=r+t*n,l=e+i*n;let c,f;o?(c=i,f=-t):(c=-i,f=t);const p=h+c,g=u+f,m=d+c,_=l+f;return a.push(p,g,m,_),2}function Oi(r,e,t,i,s,n,o,a){const h=t-r,u=i-e;let d=Math.atan2(h,u),l=Math.atan2(s-r,n-e);a&&d<l?d+=Math.PI*2:!a&&d>l&&(l+=Math.PI*2);let c=d;const f=l-d,p=Math.abs(f),g=Math.sqrt(h*h+u*u),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,_=f/m;if(c+=_,a){o.push(r,e,t,i);for(let v=1,x=c;v<m;v++,x+=_)o.push(r,e,r+Math.sin(x)*g,e+Math.cos(x)*g);o.push(r,e,s,n)}else{o.push(t,i,r,e);for(let v=1,x=c;v<m;v++,x+=_)o.push(r+Math.sin(x)*g,e+Math.cos(x)*g,r,e);o.push(s,n,r,e)}return m*2}function rA(r,e){const t=r.shape;let i=r.points||t.points.slice();const s=e.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new ie(i[0],i[1]),a=new ie(i[i.length-2],i[i.length-1]),h=t.type!==Oe.POLY||t.closeStroke,u=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),u&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const k=(o.x+a.x)*.5,z=(a.y+o.y)*.5;i.unshift(k,z),i.push(k,z)}const d=e.points,l=i.length/2;let c=i.length;const f=d.length/2,p=n.width/2,g=p*p,m=n.miterLimit*n.miterLimit;let _=i[0],v=i[1],x=i[2],b=i[3],w=0,C=0,S=-(v-b),T=_-x,M=0,P=0,R=Math.sqrt(S*S+T*T);S/=R,T/=R,S*=p,T*=p;const E=n.alignment,A=(1-E)*2,I=E*2;h||(n.cap===xi.ROUND?c+=Oi(_-S*(A-I)*.5,v-T*(A-I)*.5,_-S*A,v-T*A,_+S*I,v+T*I,d,!0)+2:n.cap===xi.SQUARE&&(c+=ud(_,v,S,T,A,I,!0,d))),d.push(_-S*A,v-T*A,_+S*I,v+T*I);for(let k=1;k<l-1;++k){_=i[(k-1)*2],v=i[(k-1)*2+1],x=i[k*2],b=i[k*2+1],w=i[(k+1)*2],C=i[(k+1)*2+1],S=-(v-b),T=_-x,R=Math.sqrt(S*S+T*T),S/=R,T/=R,S*=p,T*=p,M=-(b-C),P=x-w,R=Math.sqrt(M*M+P*P),M/=R,P/=R,M*=p,P*=p;const z=x-_,q=v-b,L=x-w,F=C-b,G=z*L+q*F,Q=q*L-F*z,ee=Q<0;if(Math.abs(Q)<.001*Math.abs(G)){d.push(x-S*A,b-T*A,x+S*I,b+T*I),G>=0&&(n.join===Je.ROUND?c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+4:c+=2,d.push(x-M*I,b-P*I,x+M*A,b+P*A));continue}const oe=(-S+_)*(-T+b)-(-S+x)*(-T+v),pe=(-M+w)*(-P+b)-(-M+x)*(-P+C),ye=(z*pe-L*oe)/Q,Ae=(F*oe-q*pe)/Q,ae=(ye-x)*(ye-x)+(Ae-b)*(Ae-b),be=x+(ye-x)*A,ne=b+(Ae-b)*A,ve=x-(ye-x)*I,he=b-(Ae-b)*I,Be=Math.min(z*z+q*q,L*L+F*F),Ne=ee?A:I,Ii=Be+Ne*Ne*g,Pi=ae<=Ii;let ln=n.join;if(ln===Je.MITER&&ae/g>m&&(ln=Je.BEVEL),Pi)switch(ln){case Je.MITER:{d.push(be,ne,ve,he);break}case Je.BEVEL:{ee?d.push(be,ne,x+S*I,b+T*I,be,ne,x+M*I,b+P*I):d.push(x-S*A,b-T*A,ve,he,x-M*A,b-P*A,ve,he),c+=2;break}case Je.ROUND:{ee?(d.push(be,ne,x+S*I,b+T*I),c+=Oi(x,b,x+S*I,b+T*I,x+M*I,b+P*I,d,!0)+4,d.push(be,ne,x+M*I,b+P*I)):(d.push(x-S*A,b-T*A,ve,he),c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+4,d.push(x-M*A,b-P*A,ve,he));break}}else{switch(d.push(x-S*A,b-T*A,x+S*I,b+T*I),ln){case Je.MITER:{ee?d.push(ve,he,ve,he):d.push(be,ne,be,ne),c+=2;break}case Je.ROUND:{ee?c+=Oi(x,b,x+S*I,b+T*I,x+M*I,b+P*I,d,!0)+2:c+=Oi(x,b,x-S*A,b-T*A,x-M*A,b-P*A,d,!1)+2;break}}d.push(x-M*A,b-P*A,x+M*I,b+P*I),c+=2}}_=i[(l-2)*2],v=i[(l-2)*2+1],x=i[(l-1)*2],b=i[(l-1)*2+1],S=-(v-b),T=_-x,R=Math.sqrt(S*S+T*T),S/=R,T/=R,S*=p,T*=p,d.push(x-S*A,b-T*A,x+S*I,b+T*I),h||(n.cap===xi.ROUND?c+=Oi(x-S*(A-I)*.5,b-T*(A-I)*.5,x-S*A,b-T*A,x+S*I,b+T*I,d,!1)+2:n.cap===xi.SQUARE&&(c+=ud(x,b,S,T,A,I,!1,d)));const D=e.indices,B=rs.epsilon*rs.epsilon;for(let k=f;k<c+f-2;++k)_=d[k*2],v=d[k*2+1],x=d[(k+1)*2],b=d[(k+1)*2+1],w=d[(k+2)*2],C=d[(k+2)*2+1],!(Math.abs(_*(b-C)+x*(C-v)+w*(v-b))<B)&&D.push(k,k+1,k+2)}function sA(r,e){let t=0;const i=r.shape,s=r.points||i.points,n=i.type!==Oe.POLY||i.closeStroke;if(s.length===0)return;const o=e.points,a=e.indices,h=s.length/2,u=o.length/2;let d=u;for(o.push(s[0],s[1]),t=1;t<h;t++)o.push(s[t*2],s[t*2+1]),a.push(d,d+1),d++;n&&a.push(d,u)}function dd(r,e){r.lineStyle.native?sA(r,e):rA(r,e)}class Jh{static curveLength(e,t,i,s,n,o){const a=e-2*i+n,h=t-2*s+o,u=2*i-2*e,d=2*s-2*t,l=4*(a*a+h*h),c=4*(a*u+h*d),f=u*u+d*d,p=2*Math.sqrt(l+c+f),g=Math.sqrt(l),m=2*l*g,_=2*Math.sqrt(f),v=c/g;return(m*p+g*c*(p-_)+(4*f*l-c*c)*Math.log((2*g+v+p)/(v+_)))/(4*m)}static curveTo(e,t,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=rs._segmentsCount(Jh.curveLength(o,a,e,t,i,s));let u=0,d=0;for(let l=1;l<=h;++l){const c=l/h;u=o+(e-o)*c,d=a+(t-a)*c,n.push(u+(e+(i-e)*c-u)*c,d+(t+(s-t)*c-d)*c)}}}const Va={[Oe.POLY]:Wp,[Oe.CIRC]:Lo,[Oe.ELIP]:Lo,[Oe.RECT]:eA,[Oe.RREC]:tA},fd=[],kn=[];class Oo{constructor(e,t=null,i=null,s=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=s,this.type=e.type}clone(){return new Oo(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const mr=new ie,$p=class Xp extends Kf{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ro,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),kn.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),fd.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,i=null,s=null){const n=new Oo(e,t,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const i=new Oo(e,null,null,t),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){const t=this.graphicsData;for(let i=0;i<t.length;++i){const s=t[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(e,mr):mr.copyFrom(e),s.shape.contains(mr.x,mr.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(mr.x,mr.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const e=this.uvs,t=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<t.length;h++){this.shapeIndex++;const u=t[h],d=u.fillStyle,l=u.lineStyle;Va[u.type].build(u),u.matrix&&this.transformPoints(u.points,u.matrix),(d.visible||l.visible)&&this.processHoles(u.holes);for(let c=0;c<2;c++){const f=c===0?d:l;if(!f.visible)continue;const p=f.texture.baseTexture,g=this.indices.length,m=this.points.length/2;p.wrapMode=wi.REPEAT,c===0?this.processFill(u):this.processLine(u);const _=this.points.length/2-m;_!==0&&(i&&!this._compareStyles(s,f)&&(i.end(g,m),i=null),i||(i=fd.pop()||new iA,i.begin(f,g,m),this.batches.push(i),s=f),this.addUvs(this.points,e,f.texture,m,_,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e<t;e++){const i=this.graphicsData[e],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const e=this.batches;for(let t=0,i=e.length;t<i;t++){const s=e[t];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<Xp.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++Z._globalBatch;for(let l=0;l<this.drawCalls.length;l++)this.drawCalls[l].texArray.clear(),kn.push(this.drawCalls[l]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let s=kn.pop();s||(s=new Ul,s.texArray=new Vl),s.texArray.count=0,s.start=0,s.size=0,s.type=Ft.TRIANGLES;let n=0,o=null,a=0,h=!1,u=Ft.TRIANGLES,d=0;this.drawCalls.push(s);for(let l=0;l<this.batches.length;l++){const c=this.batches[l],f=8,p=c.style,g=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,u=h?Ft.LINES:Ft.TRIANGLES,o=null,n=f,e++),o!==g&&(o=g,g._batchEnabled!==e&&(n===f&&(e++,n=0,s.size>0&&(s=kn.pop(),s||(s=new Ul,s.texArray=new Vl),this.drawCalls.push(s)),s.start=d,s.size=0,s.texArray.count=0,s.type=u),g.touched=1,g._batchEnabled=e,g._batchLocation=n,g.wrapMode=wi.REPEAT,s.texArray.elements[s.texArray.count++]=g,n++)),s.size+=c.size,d+=c.size,a=g._batchLocation,this.addColors(t,p.color,p.alpha,c.attribSize,c.attribStart),this.addTextureIds(i,a,c.attribSize,c.attribStart)}Z._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(e.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let u=0;u<e.length/2;u++)o[h++]=e[u*2],o[h++]=e[u*2+1],o[h++]=t[u*2],o[h++]=t[u*2+1],a[h++]=i[u],o[h++]=s[u];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?Wp.triangulate(e,this):Va[e.type].triangulate(e,this)}processLine(e){dd(e,this);for(let t=0;t<e.holes.length;t++)dd(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];Va[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let i=0;i<e.length/2;i++){const s=e[i*2],n=e[i*2+1];e[i*2]=t.a*s+t.c*n+t.tx,e[i*2+1]=t.b*s+t.d*n+t.ty}}addColors(e,t,i,s,n=0){const o=ue.shared.setValue(t).toLittleEndianNumber(),a=ue.shared.setValue(o).toPremultiplied(i);e.length=Math.max(e.length,n+s);for(let h=0;h<s;h++)e[n+h]=a}addTextureIds(e,t,i,s=0){e.length=Math.max(e.length,s+i);for(let n=0;n<i;n++)e[s+n]=t}addUvs(e,t,i,s,n,o=null){let a=0;const h=t.length,u=i.frame;for(;a<n;){let l=e[(s+a)*2],c=e[(s+a)*2+1];if(o){const f=o.a*l+o.c*c+o.tx;c=o.b*l+o.d*c+o.ty,l=f}a++,t.push(l/u.width,c/u.height)}const d=i.baseTexture;(u.width<d.width||u.height<d.height)&&this.adjustUvs(t,i,h,n)}adjustUvs(e,t,i,s){const n=t.baseTexture,o=1e-6,a=i+s*2,h=t.frame,u=h.width/n.width,d=h.height/n.height;let l=h.x/h.width,c=h.y/h.height,f=Math.floor(e[i]+o),p=Math.floor(e[i+1]+o);for(let g=i+2;g<a;g+=2)f=Math.min(f,Math.floor(e[g]+o)),p=Math.min(p,Math.floor(e[g+1]+o));l-=f,c-=p;for(let g=i;g<a;g+=2)e[g]=(e[g]+l)*u,e[g+1]=(e[g+1]+c)*d}};$p.BATCHABLE_SIZE=100;let nA=$p;class Qo{constructor(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Qo;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e}reset(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ec extends Qo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=xi.BUTT,this.join=Je.MITER,this.miterLimit=10}clone(){const e=new ec;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=xi.BUTT,this.join=Je.MITER,this.miterLimit=10}}const Wa={},lh=class ho extends vt{constructor(e=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Qo,this._lineStyle=new ec,this._matrix=null,this._holeMode=!1,this.state=Gt.for2d(),this._geometry=e||new nA,this._geometry.refCount++,this._transformID=-1,this._tintColor=new ue(16777215),this.blendMode=Y.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ho(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,i,s=.5,n=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:i,alignment:s,native:n}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:W.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:xi.BUTT,join:Je.MITER,miterLimit:10};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.width>0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},e)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new Qi,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new Qi,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==e||n!==t)&&i.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Jh.curveTo(e,t,i,s,n),this}bezierCurveTo(e,t,i,s,n,o){return this._initCurve(),Qh.curveTo(e,t,i,s,n,o,this.currentPath.points),this}arcTo(e,t,i,s,n){this._initCurve(e,t);const o=this.currentPath.points,a=cd.curveTo(e,t,i,s,n,o);if(a){const{cx:h,cy:u,radius:d,startAngle:l,endAngle:c,anticlockwise:f}=a;this.arc(h,u,d,l,c,f)}return this}arc(e,t,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=Eo:o&&s<=n&&(s+=Eo),n-s===0)return this;const a=e+Math.cos(s)*i,h=t+Math.sin(s)*i,u=this._geometry.closePointEps;let d=this.currentPath?this.currentPath.points:null;if(d){const l=Math.abs(d[d.length-2]-a),c=Math.abs(d[d.length-1]-h);l<u&&c<u||d.push(a,h)}else this.moveTo(a,h),d=this.currentPath.points;return cd.arc(a,h,e,t,i,s,n,o,d),this}beginFill(e=0,t){return this.beginTextureFill({texture:W.WHITE,color:e,alpha:t})}normalizeColor(e){const t=ue.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:W.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,i,s){return this.drawShape(new K(e,t,i,s))}drawRoundedRect(e,t,i,s,n){return this.drawShape(new qo(e,t,i,s,n))}drawCircle(e,t,i){return this.drawShape(new jo(e,t,i))}drawEllipse(e,t,i,s){return this.drawShape(new Yo(e,t,i,s))}drawPolygon(...e){let t,i=!0;const s=e[0];s.points?(i=s.closeStroke,t=s.points):Array.isArray(e[0])?t=e[0]:t=e;const n=new Qi(t);return n.closeStroke=i,this.drawShape(n),this}drawShape(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===Oe.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();const t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){const e=this._geometry,t=this.blendMode,i=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(e.points);for(let s=0;s<i;s++){const n=e.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(e.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),u=new Uint16Array(e.indicesUint16.buffer,n.start*2,n.size),d={vertexData:a,blendMode:t,indices:u,uvs:h,_batchRGB:ue.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=d}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,i=this.batches.length;t<i;t++){const s=this.batches[t];s.worldAlpha=this.worldAlpha*s.alpha,e.plugins[this.pluginName].render(s)}}}_renderDirect(e){const t=this._resolveDirectShader(e),i=this._geometry,s=this.worldAlpha,n=t.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,ue.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),e.shader.bind(t),e.geometry.bind(i,t),e.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(e,i.drawCalls[a])}_renderDrawCallDirect(e,t){const{texArray:i,type:s,size:n,start:o}=t,a=i.count;for(let h=0;h<a;h++)e.texture.bind(i.elements[h],h);e.geometry.draw(s,n,o)}_resolveDirectShader(e){let t=this.shader;const i=this.pluginName;if(!t){if(!Wa[i]){const{maxTextures:s}=e.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new de,default:yt.from({uSamplers:n},!0)},a=e.plugins[i]._shader.program;Wa[i]=new kt(a,o)}t=Wa[i]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:i,maxX:s,maxY:n}=e.bounds;this._bounds.addFrame(this.transform,t,i,s,n)}containsPoint(e){return this.worldTransform.applyInverse(e,ho._TEMP_POINT),this._geometry.containsPoint(ho._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t._tintRGB=ue.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;const t=this.transform.worldTransform,i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,u=this._geometry.points,d=this.vertexData;let l=0;for(let c=0;c<u.length;c+=2){const f=u[c],p=u[c+1];d[l++]=i*f+n*p+a,d[l++]=o*p+s*f+h}}closePath(){const e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this}setMatrix(e){return this._matrix=e,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(e)}};lh.curves=rs,lh._TEMP_POINT=new ie;let jp=lh;class oA{constructor(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(e){if(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}}const $a=new ie,pd=new Qi,Yp=class qp extends vt{constructor(e,t,i,s=Ft.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||Gt.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=V.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(e){this.shader=e}get material(){return this.shader}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(e){this.shader.tint=e}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(e){this.shader.texture=e}_render(e){const t=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===Ft.TRIANGLES&&t.length<qp.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(e){const t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){const t=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[s]),e.plugins[s].render(this)}calculateVertices(){const e=this.geometry.buffers[0],t=e.data,i=e._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,u=s.tx,d=s.ty,l=this.vertexData;for(let c=0;c<l.length/2;c++){const f=t[c*2],p=t[c*2+1];l[c*2]=n*f+a*p+u,l[c*2+1]=o*f+h*p+d}if(this._roundPixels){const c=V.RESOLUTION;for(let f=0;f<l.length;++f)l[f]=Math.round(l[f]*c)/c}this.vertexDirty=i}calculateUvs(){const e=this.geometry.buffers[1],t=this.shader;t.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new oA(e,t.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,$a);const t=this.geometry.getBuffer("aVertexPosition").data,i=pd.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,u=s[a+1]*2,d=s[a+2]*2;if(i[0]=t[h],i[1]=t[h+1],i[2]=t[u],i[3]=t[u+1],i[4]=t[d],i[5]=t[d+1],pd.contains($a.x,$a.y))return!0}return!1}destroy(e){super.destroy(e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Yp.BATCHABLE_SIZE=100;let md=Yp;class aA extends Ti{constructor(e,t,i){super();const s=new we(e),n=new we(t,!0),o=new we(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,j.FLOAT).addAttribute("aTextureCoord",n,2,!1,j.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var lA=`varying vec2 vTextureCoord;
|
|
4599
4599
|
uniform vec4 uColor;
|
|
4600
4600
|
|
|
4601
4601
|
uniform sampler2D uSampler;
|
|
@@ -4604,7 +4604,7 @@ void main(void)
|
|
|
4604
4604
|
{
|
|
4605
4605
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
4606
4606
|
}
|
|
4607
|
-
`,
|
|
4607
|
+
`,hA=`attribute vec2 aVertexPosition;
|
|
4608
4608
|
attribute vec2 aTextureCoord;
|
|
4609
4609
|
|
|
4610
4610
|
uniform mat3 projectionMatrix;
|
|
@@ -4619,7 +4619,7 @@ void main(void)
|
|
|
4619
4619
|
|
|
4620
4620
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
4621
4621
|
}
|
|
4622
|
-
`;class gd extends kt{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:de.IDENTITY,uColor:new Float32Array([1,1,1,1])};t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t),t.uniforms&&Object.assign(i,t.uniforms),super(t.program||Qt.from(lA
|
|
4622
|
+
`;class gd extends kt{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:de.IDENTITY,uColor:new Float32Array([1,1,1,1])};t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t),t.uniforms&&Object.assign(i,t.uniforms),super(t.program||Qt.from(hA,lA),i),this._colorDirty=!1,this.uvMatrix=new up(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new ue(t.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=t.alpha}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const e=this.texture.baseTexture.alphaMode;ue.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class _d{constructor(e,t,i){this.geometry=new Ti,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<e.length;++s){let n=e[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||j.FLOAT,offset:n.offset},t[s]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const e=this.geometry;let t=0;this.indexBuffer=new we(Px(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=t,t+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new we(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new we(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];e.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===j.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];e.addAttribute(a.attributeName,this.staticBuffer,0,a.type===j.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(e,t,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(e,t,i,n.type===j.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(e,t,i,n.type===j.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var cA=`varying vec2 vTextureCoord;
|
|
4623
4623
|
varying vec4 vColor;
|
|
4624
4624
|
|
|
4625
4625
|
uniform sampler2D uSampler;
|
|
@@ -4627,7 +4627,7 @@ uniform sampler2D uSampler;
|
|
|
4627
4627
|
void main(void){
|
|
4628
4628
|
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
4629
4629
|
gl_FragColor = color;
|
|
4630
|
-
}`,
|
|
4630
|
+
}`,uA=`attribute vec2 aVertexPosition;
|
|
4631
4631
|
attribute vec2 aTextureCoord;
|
|
4632
4632
|
attribute vec4 aColor;
|
|
4633
4633
|
|
|
@@ -4652,8 +4652,8 @@ void main(void){
|
|
|
4652
4652
|
vTextureCoord = aTextureCoord;
|
|
4653
4653
|
vColor = aColor * uColor;
|
|
4654
4654
|
}
|
|
4655
|
-
`;class Zp extends
|
|
4656
|
-
`:e,e}static getFromCache(e,t,i,s){let n=i[e];return typeof n!="number"&&(n=X._measureText(e,t,s)+t,i[e]=n),n}static collapseSpaces(e){return e==="normal"||e==="pre-line"}static collapseNewlines(e){return e==="normal"}static trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){const i=e[t];if(!X.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:X._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:X._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let s=0;s<e.length;s++){const n=e[s],o=e[s+1];if(X.isBreakingSpace(n,o)||X.isNewline(n)){i!==""&&(t.push(i),i=""),t.push(n);continue}i+=n}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,n){return!0}static wordWrapSplit(e){return X.graphemeSegmenter(e)}static measureFont(e){if(X._fonts[e])return X._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=X._canvas,s=X._context;s.font=e;const n=X.METRICS_STRING+X.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(X.BASELINE_SYMBOL).width);const h=Math.ceil(X.HEIGHT_MULTIPLIER*a);if(a=a*X.BASELINE_MULTIPLIER|0,o===0||h===0)return X._fonts[e]=t,t;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const u=s.getImageData(0,0,o,h).data,d=u.length,l=o*4;let c=0,f=0,p=!1;for(c=0;c<a;++c){for(let g=0;g<l;g+=4)if(u[f+g]!==255){p=!0;break}if(!p)f+=l;else break}for(t.ascent=a-c,f=d-l,p=!1,c=h;c>a;--c){for(let g=0;g<l;g+=4)if(u[f+g]!==255){p=!0;break}if(!p)f-=l;else break}return t.descent=c-a,t.fontSize=t.ascent+t.descent,X._fonts[e]=t,t}static clearMetrics(e=""){e?delete X._fonts[e]:X._fonts={}}static get _canvas(){var e;if(!X.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",kn))!=null&&e.measureText)return X.__canvas=i,i;t=V.ADAPTER.createCanvas()}catch{t=V.ADAPTER.createCanvas()}t.width=t.height=10,X.__canvas=t}return X.__canvas}static get _context(){return X.__context||(X.__context=X._canvas.getContext("2d",kn)),X.__context}};Mt.METRICS_STRING="|ÉqÅ",Mt.BASELINE_SYMBOL="M",Mt.BASELINE_MULTIPLIER=1.4,Mt.HEIGHT_MULTIPLIER=2,Mt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})(),Mt.experimentalLetterSpacing=!1,Mt._fonts={},Mt._newlines=[10,13],Mt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let di=Mt;const uA=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Kp=class Bs{constructor(e){this.styleID=0,this.reset(),Ya(this,e,e)}clone(){const e={};return Ya(e,this,Bs.defaultStyle),new Bs(e)}reset(){Ya(this,Bs.defaultStyle,Bs.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){const t=ja(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)}get fill(){return this._fill}set fill(e){const t=ja(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){dA(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){const t=ja(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){const e=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!uA.includes(s)&&(s=`"${s}"`),t[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};Kp.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ea.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Si=Kp;function ja(r){const e=ue.shared,t=i=>{const s=e.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(t):t(r)}function dA(r,e){if(!Array.isArray(r)||!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}function Ya(r,e,t){for(const i in t)Array.isArray(e[i])?r[i]=e[i].slice():r[i]=e[i]}const fA={texture:!0,children:!1,baseTexture:!0},Qp=class ch extends ls{constructor(e,t,i){let s=!1;i||(i=V.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=W.from(i);n.orig=new K,n.trim=new K,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=ch.defaultResolution??V.RESOLUTION,this._autoResolution=ch.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=t,this.localStyleID=-1}static get experimentalLetterSpacing(){return di.experimentalLetterSpacing}static set experimentalLetterSpacing(e){J("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),di.experimentalLetterSpacing=e}updateText(e){const t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();const i=this.context,s=di.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,u=s.lineWidths,d=s.maxLineWidth,l=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+t.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=t.strokeThickness,i.textBaseline=t.textBaseline,i.lineJoin=t.lineJoin,i.miterLimit=t.miterLimit;let c,f;const p=t.dropShadow?2:1;for(let g=0;g<p;++g){const m=t.dropShadow&&g===0,_=m?Math.ceil(Math.max(1,o)+t.padding*2):0,v=_*this._resolution;if(m){i.fillStyle="black",i.strokeStyle="black";const b=t.dropShadowColor,w=t.dropShadowBlur*this._resolution,C=t.dropShadowDistance*this._resolution;i.shadowColor=ue.shared.setValue(b).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*C,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*C+v}else i.fillStyle=this._generateFillStyle(t,a,s),i.strokeStyle=t.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let x=(h-l.fontSize)/2;h-l.fontSize<0&&(x=0);for(let b=0;b<a.length;b++)c=t.strokeThickness/2,f=t.strokeThickness/2+b*h+l.ascent+x,t.align==="right"?c+=d-u[b]:t.align==="center"&&(c+=(d-u[b])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(a[b],c+t.padding,f+t.padding-_,!0),t.fill&&this.drawLetterSpacing(a[b],c+t.padding,f+t.padding-_)}this.updateTexture()}drawLetterSpacing(e,t,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(di.experimentalLetterSpacingSupported&&(di.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(e,t,i):this.context.fillText(e,t,i);return}let a=t;const h=di.graphemeSegmenter(e);let u=this.context.measureText(e).width,d=0;for(let l=0;l<h.length;++l){const c=h[l];s?this.context.strokeText(c,a,i):this.context.fillText(c,a,i);let f="";for(let p=l+1;p<h.length;++p)f+=h[p];d=this.context.measureText(f).width,a+=u-d+n,u=d}}updateTexture(){const e=this.canvas;if(this._style.trim){const o=Bx(e);o.data&&(e.width=o.width,e.height=o.height,this.context.putImageData(o.data,0,0))}const t=this._texture,i=this._style,s=i.trim?0:i.padding,n=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-s,t.trim.y=-s,t.orig.width=t._frame.width-s*2,t.orig.height=t._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,i){const s=e.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,h=this.canvas.width/this._resolution-o-a*2,u=this.canvas.height/this._resolution-o-a*2,d=s.slice(),l=e.fillGradientStops.slice();if(!l.length){const c=d.length+1;for(let f=1;f<c;++f)l.push(f/c)}if(d.unshift(s[0]),l.unshift(0),d.push(s[s.length-1]),l.push(1),e.fillGradientType===ea.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,u+a);const c=i.fontProperties.fontSize+e.strokeThickness;for(let f=0;f<t.length;f++){const p=i.lineHeight*(f-1)+c,g=i.lineHeight*f;let m=g;f>0&&p>g&&(m=(g+p)/2);const _=g+c,v=i.lineHeight*(f+1);let x=_;f+1<t.length&&v<_&&(x=(_+v)/2);const b=(x-m)/u;for(let w=0;w<d.length;w++){let C=0;typeof l[w]=="number"?C=l[w]:C=w/d.length;let S=Math.min(1,Math.max(0,m/u+C*b));S=Number(S.toFixed(5)),n.addColorStop(S,d[w])}}}else{n=this.context.createLinearGradient(a,u/2,h+a,u/2);const c=d.length+1;let f=1;for(let p=0;p<d.length;p++){let g;typeof l[p]=="number"?g=l[p]:g=f/c,n.addColorStop(g,d[p]),f++}}return n}destroy(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},fA,e),super.destroy(e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this.updateText(!0);const t=vi(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this.updateText(!0);const t=vi(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get style(){return this._style}set style(e){e=e||{},e instanceof Si?this._style=e:this._style=new Si(e),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}};Qp.defaultAutoResolution=!0;let Jp=Qp;class pA{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function mA(r,e){var i;let t=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof W){const n=r._textures[s].baseTexture;e.includes(n)||(e.push(n),t=!0)}}return t}function gA(r,e){if(r.baseTexture instanceof Z){const t=r.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function _A(r,e){if(r._texture&&r._texture instanceof W){const t=r._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function yA(r,e){return e instanceof Jp?(e.updateText(!0),!0):!1}function vA(r,e){if(e instanceof Si){const t=e.toFontString();return di.measureFont(t),!0}return!1}function xA(r,e){if(r instanceof Jp){e.includes(r.style)||e.push(r.style),e.includes(r)||e.push(r);const t=r._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function bA(r,e){return r instanceof Si?(e.includes(r)||e.push(r),!0):!1}const em=class tm{constructor(e){this.limiter=new pA(tm.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(xA),this.registerFindHook(bA),this.registerFindHook(mA),this.registerFindHook(gA),this.registerFindHook(_A),this.registerUploadHook(yA),this.registerUploadHook(vA)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ke.system.addOnce(this.tick,this,ir.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const e=this.queue[0];let t=!1;if(e&&!e._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Ke.system.addOnce(this.tick,this,ir.UTILITY);else{this.ticking=!1;const e=this.completes.slice(0);this.completes.length=0;for(let t=0,i=e.length;t<i;t++)e[t]()}}registerFindHook(e){return e&&this.addHooks.push(e),this}registerUploadHook(e){return e&&this.uploadHooks.push(e),this}add(e){for(let t=0,i=this.addHooks.length;t<i&&!this.addHooks[t](e,this.queue);t++);if(e instanceof vt)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ke.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};em.uploadsPerFrame=4;let uh=em;Object.defineProperties(V,{UPLOADS_PER_FRAME:{get(){return uh.uploadsPerFrame},set(r){J("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),uh.uploadsPerFrame=r}}});function im(r,e){return e instanceof Z?(e._glTextures[r.CONTEXT_UID]||r.texture.bind(e),!0):!1}function wA(r,e){if(!(e instanceof jp))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&im(r,n.baseTexture)}return t.batchable||r.geometry.bind(t,e._resolveDirectShader(r)),!0}function AA(r,e){return r instanceof jp?(e.push(r),!0):!1}class rm extends uh{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(AA),this.registerUploadHook(im),this.registerUploadHook(wA)}}rm.extension={name:"prepare",type:U.RendererSystem};$.add(rm);var TA=`#version 300 es
|
|
4655
|
+
`;class Zp extends Zo{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new de,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:j.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=kt.from(uA,cA,{}),this.state=Gt.for2d()}render(e){const t=e.children,i=e._maxSize,s=e._batchSize,n=this.renderer;let o=t.length;if(o===0)return;o>i&&!e.autoResize&&(o=i);let a=e._buffers;a||(a=e._buffers=this.generateBuffers(e));const h=t[0]._texture.baseTexture,u=h.alphaMode>0;this.state.blendMode=Yf(e.blendMode,u),n.state.set(this.state);const d=n.gl,l=e.worldTransform.copyTo(this.tempMatrix);l.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=l.toArray(!0),this.shader.uniforms.uColor=ue.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,u).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let c=!1;for(let f=0,p=0;f<o;f+=s,p+=1){let g=o-f;g>s&&(g=s),p>=a.length&&a.push(this._generateOneMoreBuffer(e));const m=a[p];m.uploadDynamic(t,f,g);const _=e._bufferUpdateIDs[p]||0;c=c||m._updateID<_,c&&(m._updateID=e._updateID,m.uploadStatic(t,f,g)),n.geometry.bind(m.geometry),d.drawElements(d.TRIANGLES,g*6,d.UNSIGNED_SHORT,0)}}generateBuffers(e){const t=[],i=e._maxSize,s=e._batchSize,n=e._properties;for(let o=0;o<i;o+=s)t.push(new _d(this.properties,n,s));return t}_generateOneMoreBuffer(e){const t=e._batchSize,i=e._properties;return new _d(this.properties,i,t)}uploadVertices(e,t,i,s,n,o){let a=0,h=0,u=0,d=0;for(let l=0;l<i;++l){const c=e[t+l],f=c._texture,p=c.scale.x,g=c.scale.y,m=f.trim,_=f.orig;m?(h=m.x-c.anchor.x*_.width,a=h+m.width,d=m.y-c.anchor.y*_.height,u=d+m.height):(a=_.width*(1-c.anchor.x),h=_.width*-c.anchor.x,u=_.height*(1-c.anchor.y),d=_.height*-c.anchor.y),s[o]=h*p,s[o+1]=d*g,s[o+n]=a*p,s[o+n+1]=d*g,s[o+n*2]=a*p,s[o+n*2+1]=u*g,s[o+n*3]=h*p,s[o+n*3+1]=u*g,o+=n*4}}uploadPosition(e,t,i,s,n,o){for(let a=0;a<i;a++){const h=e[t+a].position;s[o]=h.x,s[o+1]=h.y,s[o+n]=h.x,s[o+n+1]=h.y,s[o+n*2]=h.x,s[o+n*2+1]=h.y,s[o+n*3]=h.x,s[o+n*3+1]=h.y,o+=n*4}}uploadRotation(e,t,i,s,n,o){for(let a=0;a<i;a++){const h=e[t+a].rotation;s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}uploadUvs(e,t,i,s,n,o){for(let a=0;a<i;++a){const h=e[t+a]._texture._uvs;h?(s[o]=h.x0,s[o+1]=h.y0,s[o+n]=h.x1,s[o+n+1]=h.y1,s[o+n*2]=h.x2,s[o+n*2+1]=h.y2,s[o+n*3]=h.x3,s[o+n*3+1]=h.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(e,t,i,s,n,o){for(let a=0;a<i;++a){const h=e[t+a],u=ue.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[o]=u,s[o+n]=u,s[o+n*2]=u,s[o+n*3]=u,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Zp.extension={name:"particle",type:U.RendererPlugin};$.add(Zp);var Jo=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Jo||{});const Nn={willReadFrequently:!0},Mt=class X{static get experimentalLetterSpacingSupported(){let e=X._experimentalLetterSpacingSupported;if(e!==void 0){const t=V.ADAPTER.getCanvasRenderingContext2D().prototype;e=X._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,n,o,a,h,u){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=u}static measureText(e,t,i,s=X._canvas){i=i??t.wordWrap;const n=t.toFontString(),o=X.measureFont(n);o.fontSize===0&&(o.fontSize=t.fontSize,o.ascent=t.fontSize);const a=s.getContext("2d",Nn);a.font=n;const h=(i?X.wordWrap(e,t,s):e).split(/(?:\r\n|\r|\n)/),u=new Array(h.length);let d=0;for(let p=0;p<h.length;p++){const g=X._measureText(h[p],t.letterSpacing,a);u[p]=g,d=Math.max(d,g)}let l=d+t.strokeThickness;t.dropShadow&&(l+=t.dropShadowDistance);const c=t.lineHeight||o.fontSize+t.strokeThickness;let f=Math.max(c,o.fontSize+t.strokeThickness*2)+t.leading+(h.length-1)*(c+t.leading);return t.dropShadow&&(f+=t.dropShadowDistance),new X(e,t,l,f,h,u,c+t.leading,d,o)}static _measureText(e,t,i){let s=!1;X.experimentalLetterSpacingSupported&&(X.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(e).width;return n>0&&(s?n-=t:n+=(X.graphemeSegmenter(e).length-1)*t),n}static wordWrap(e,t,i=X._canvas){const s=i.getContext("2d",Nn);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:u,whiteSpace:d}=t,l=X.collapseSpaces(d),c=X.collapseNewlines(d);let f=!l;const p=t.wordWrapWidth+u,g=X.tokenize(e);for(let m=0;m<g.length;m++){let _=g[m];if(X.isNewline(_)){if(!c){a+=X.addLine(o),f=!l,o="",n=0;continue}_=" "}if(l){const x=X.isBreakingSpace(_),b=X.isBreakingSpace(o[o.length-1]);if(x&&b)continue}const v=X.getFromCache(_,u,h,s);if(v>p)if(o!==""&&(a+=X.addLine(o),o="",n=0),X.canBreakWords(_,t.breakWords)){const x=X.wordWrapSplit(_);for(let b=0;b<x.length;b++){let w=x[b],C=w,S=1;for(;x[b+S];){const M=x[b+S];if(!X.canBreakChars(C,M,_,b,t.breakWords))w+=M;else break;C=M,S++}b+=S-1;const T=X.getFromCache(w,u,h,s);T+n>p&&(a+=X.addLine(o),f=!1,o="",n=0),o+=w,n+=T}}else{o.length>0&&(a+=X.addLine(o),o="",n=0);const x=m===g.length-1;a+=X.addLine(_,!x),f=!1,o="",n=0}else v+n>p&&(f=!1,a+=X.addLine(o),o="",n=0),(o.length>0||!X.isBreakingSpace(_)||f)&&(o+=_,n+=v)}return a+=X.addLine(o,!1),a}static addLine(e,t=!0){return e=X.trimRight(e),e=t?`${e}
|
|
4656
|
+
`:e,e}static getFromCache(e,t,i,s){let n=i[e];return typeof n!="number"&&(n=X._measureText(e,t,s)+t,i[e]=n),n}static collapseSpaces(e){return e==="normal"||e==="pre-line"}static collapseNewlines(e){return e==="normal"}static trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){const i=e[t];if(!X.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:X._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:X._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let s=0;s<e.length;s++){const n=e[s],o=e[s+1];if(X.isBreakingSpace(n,o)||X.isNewline(n)){i!==""&&(t.push(i),i=""),t.push(n);continue}i+=n}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,s,n){return!0}static wordWrapSplit(e){return X.graphemeSegmenter(e)}static measureFont(e){if(X._fonts[e])return X._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=X._canvas,s=X._context;s.font=e;const n=X.METRICS_STRING+X.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(X.BASELINE_SYMBOL).width);const h=Math.ceil(X.HEIGHT_MULTIPLIER*a);if(a=a*X.BASELINE_MULTIPLIER|0,o===0||h===0)return X._fonts[e]=t,t;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const u=s.getImageData(0,0,o,h).data,d=u.length,l=o*4;let c=0,f=0,p=!1;for(c=0;c<a;++c){for(let g=0;g<l;g+=4)if(u[f+g]!==255){p=!0;break}if(!p)f+=l;else break}for(t.ascent=a-c,f=d-l,p=!1,c=h;c>a;--c){for(let g=0;g<l;g+=4)if(u[f+g]!==255){p=!0;break}if(!p)f-=l;else break}return t.descent=c-a,t.fontSize=t.ascent+t.descent,X._fonts[e]=t,t}static clearMetrics(e=""){e?delete X._fonts[e]:X._fonts={}}static get _canvas(){var e;if(!X.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",Nn))!=null&&e.measureText)return X.__canvas=i,i;t=V.ADAPTER.createCanvas()}catch{t=V.ADAPTER.createCanvas()}t.width=t.height=10,X.__canvas=t}return X.__canvas}static get _context(){return X.__context||(X.__context=X._canvas.getContext("2d",Nn)),X.__context}};Mt.METRICS_STRING="|ÉqÅ",Mt.BASELINE_SYMBOL="M",Mt.BASELINE_MULTIPLIER=1.4,Mt.HEIGHT_MULTIPLIER=2,Mt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})(),Mt.experimentalLetterSpacing=!1,Mt._fonts={},Mt._newlines=[10,13],Mt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let di=Mt;const dA=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Kp=class Fs{constructor(e){this.styleID=0,this.reset(),ja(this,e,e)}clone(){const e={};return ja(e,this,Fs.defaultStyle),new Fs(e)}reset(){ja(this,Fs.defaultStyle,Fs.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){const t=Xa(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)}get fill(){return this._fill}set fill(e){const t=Xa(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){fA(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){const t=Xa(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){const e=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!dA.includes(s)&&(s=`"${s}"`),t[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};Kp.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Jo.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Si=Kp;function Xa(r){const e=ue.shared,t=i=>{const s=e.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(t):t(r)}function fA(r,e){if(!Array.isArray(r)||!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;++t)if(r[t]!==e[t])return!1;return!0}function ja(r,e,t){for(const i in t)Array.isArray(e[i])?r[i]=e[i].slice():r[i]=e[i]}const pA={texture:!0,children:!1,baseTexture:!0},Qp=class hh extends hs{constructor(e,t,i){let s=!1;i||(i=V.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=W.from(i);n.orig=new K,n.trim=new K,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=hh.defaultResolution??V.RESOLUTION,this._autoResolution=hh.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=t,this.localStyleID=-1}static get experimentalLetterSpacing(){return di.experimentalLetterSpacing}static set experimentalLetterSpacing(e){J("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),di.experimentalLetterSpacing=e}updateText(e){const t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();const i=this.context,s=di.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,u=s.lineWidths,d=s.maxLineWidth,l=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+t.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=t.strokeThickness,i.textBaseline=t.textBaseline,i.lineJoin=t.lineJoin,i.miterLimit=t.miterLimit;let c,f;const p=t.dropShadow?2:1;for(let g=0;g<p;++g){const m=t.dropShadow&&g===0,_=m?Math.ceil(Math.max(1,o)+t.padding*2):0,v=_*this._resolution;if(m){i.fillStyle="black",i.strokeStyle="black";const b=t.dropShadowColor,w=t.dropShadowBlur*this._resolution,C=t.dropShadowDistance*this._resolution;i.shadowColor=ue.shared.setValue(b).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*C,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*C+v}else i.fillStyle=this._generateFillStyle(t,a,s),i.strokeStyle=t.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let x=(h-l.fontSize)/2;h-l.fontSize<0&&(x=0);for(let b=0;b<a.length;b++)c=t.strokeThickness/2,f=t.strokeThickness/2+b*h+l.ascent+x,t.align==="right"?c+=d-u[b]:t.align==="center"&&(c+=(d-u[b])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(a[b],c+t.padding,f+t.padding-_,!0),t.fill&&this.drawLetterSpacing(a[b],c+t.padding,f+t.padding-_)}this.updateTexture()}drawLetterSpacing(e,t,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(di.experimentalLetterSpacingSupported&&(di.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(e,t,i):this.context.fillText(e,t,i);return}let a=t;const h=di.graphemeSegmenter(e);let u=this.context.measureText(e).width,d=0;for(let l=0;l<h.length;++l){const c=h[l];s?this.context.strokeText(c,a,i):this.context.fillText(c,a,i);let f="";for(let p=l+1;p<h.length;++p)f+=h[p];d=this.context.measureText(f).width,a+=u-d+n,u=d}}updateTexture(){const e=this.canvas;if(this._style.trim){const o=Fx(e);o.data&&(e.width=o.width,e.height=o.height,this.context.putImageData(o.data,0,0))}const t=this._texture,i=this._style,s=i.trim?0:i.padding,n=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-s,t.trim.y=-s,t.orig.width=t._frame.width-s*2,t.orig.height=t._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,i){const s=e.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,h=this.canvas.width/this._resolution-o-a*2,u=this.canvas.height/this._resolution-o-a*2,d=s.slice(),l=e.fillGradientStops.slice();if(!l.length){const c=d.length+1;for(let f=1;f<c;++f)l.push(f/c)}if(d.unshift(s[0]),l.unshift(0),d.push(s[s.length-1]),l.push(1),e.fillGradientType===Jo.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,u+a);const c=i.fontProperties.fontSize+e.strokeThickness;for(let f=0;f<t.length;f++){const p=i.lineHeight*(f-1)+c,g=i.lineHeight*f;let m=g;f>0&&p>g&&(m=(g+p)/2);const _=g+c,v=i.lineHeight*(f+1);let x=_;f+1<t.length&&v<_&&(x=(_+v)/2);const b=(x-m)/u;for(let w=0;w<d.length;w++){let C=0;typeof l[w]=="number"?C=l[w]:C=w/d.length;let S=Math.min(1,Math.max(0,m/u+C*b));S=Number(S.toFixed(5)),n.addColorStop(S,d[w])}}}else{n=this.context.createLinearGradient(a,u/2,h+a,u/2);const c=d.length+1;let f=1;for(let p=0;p<d.length;p++){let g;typeof l[p]=="number"?g=l[p]:g=f/c,n.addColorStop(g,d[p]),f++}}return n}destroy(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},pA,e),super.destroy(e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this.updateText(!0);const t=vi(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this.updateText(!0);const t=vi(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get style(){return this._style}set style(e){e=e||{},e instanceof Si?this._style=e:this._style=new Si(e),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}};Qp.defaultAutoResolution=!0;let Jp=Qp;class mA{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function gA(r,e){var i;let t=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof W){const n=r._textures[s].baseTexture;e.includes(n)||(e.push(n),t=!0)}}return t}function _A(r,e){if(r.baseTexture instanceof Z){const t=r.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function yA(r,e){if(r._texture&&r._texture instanceof W){const t=r._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function vA(r,e){return e instanceof Jp?(e.updateText(!0),!0):!1}function xA(r,e){if(e instanceof Si){const t=e.toFontString();return di.measureFont(t),!0}return!1}function bA(r,e){if(r instanceof Jp){e.includes(r.style)||e.push(r.style),e.includes(r)||e.push(r);const t=r._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function wA(r,e){return r instanceof Si?(e.includes(r)||e.push(r),!0):!1}const em=class tm{constructor(e){this.limiter=new mA(tm.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(bA),this.registerFindHook(wA),this.registerFindHook(gA),this.registerFindHook(_A),this.registerFindHook(yA),this.registerUploadHook(vA),this.registerUploadHook(xA)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ke.system.addOnce(this.tick,this,ir.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const e=this.queue[0];let t=!1;if(e&&!e._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Ke.system.addOnce(this.tick,this,ir.UTILITY);else{this.ticking=!1;const e=this.completes.slice(0);this.completes.length=0;for(let t=0,i=e.length;t<i;t++)e[t]()}}registerFindHook(e){return e&&this.addHooks.push(e),this}registerUploadHook(e){return e&&this.uploadHooks.push(e),this}add(e){for(let t=0,i=this.addHooks.length;t<i&&!this.addHooks[t](e,this.queue);t++);if(e instanceof vt)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ke.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};em.uploadsPerFrame=4;let ch=em;Object.defineProperties(V,{UPLOADS_PER_FRAME:{get(){return ch.uploadsPerFrame},set(r){J("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),ch.uploadsPerFrame=r}}});function im(r,e){return e instanceof Z?(e._glTextures[r.CONTEXT_UID]||r.texture.bind(e),!0):!1}function AA(r,e){if(!(e instanceof jp))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&im(r,n.baseTexture)}return t.batchable||r.geometry.bind(t,e._resolveDirectShader(r)),!0}function TA(r,e){return r instanceof jp?(e.push(r),!0):!1}class rm extends ch{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(TA),this.registerUploadHook(im),this.registerUploadHook(AA)}}rm.extension={name:"prepare",type:U.RendererSystem};$.add(rm);var SA=`#version 300 es
|
|
4657
4657
|
#define SHADER_NAME Tiling-Sprite-100
|
|
4658
4658
|
|
|
4659
4659
|
precision lowp float;
|
|
@@ -4679,7 +4679,7 @@ void main(void)
|
|
|
4679
4679
|
|
|
4680
4680
|
fragmentColor = texSample * uColor;
|
|
4681
4681
|
}
|
|
4682
|
-
`,
|
|
4682
|
+
`,EA=`#version 300 es
|
|
4683
4683
|
#define SHADER_NAME Tiling-Sprite-300
|
|
4684
4684
|
|
|
4685
4685
|
precision lowp float;
|
|
@@ -4699,7 +4699,7 @@ void main(void)
|
|
|
4699
4699
|
|
|
4700
4700
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
4701
4701
|
}
|
|
4702
|
-
`,
|
|
4702
|
+
`,CA=`#version 100
|
|
4703
4703
|
#ifdef GL_EXT_shader_texture_lod
|
|
4704
4704
|
#extension GL_EXT_shader_texture_lod : enable
|
|
4705
4705
|
#endif
|
|
@@ -4752,7 +4752,7 @@ void main(void)
|
|
|
4752
4752
|
|
|
4753
4753
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
4754
4754
|
}
|
|
4755
|
-
`,
|
|
4755
|
+
`,MA=`#version 100
|
|
4756
4756
|
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
4757
4757
|
|
|
4758
4758
|
precision lowp float;
|
|
@@ -4767,7 +4767,7 @@ void main(void)
|
|
|
4767
4767
|
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
4768
4768
|
gl_FragColor = texSample * uColor;
|
|
4769
4769
|
}
|
|
4770
|
-
`;const Nn=new de;class sm extends Ko{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new ap,this.state=Gt.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=kt.from(yd,CA,t),this.shader=e.context.webGLVersion>1?kt.from(SA,TA,t):kt.from(yd,EA,t)}render(e){const t=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);const n=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=e._texture,h=a.baseTexture,u=h.alphaMode>0,d=e.tileTransform.localTransform,l=e.uvMatrix;let c=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;c&&(h._glTextures[t.CONTEXT_UID]?c=h.wrapMode!==wi.CLAMP:h.wrapMode===wi.CLAMP&&(h.wrapMode=wi.REPEAT));const f=c?this.simpleShader:this.shader,p=a.width,g=a.height,m=e._width,_=e._height;Nn.set(d.a*p/m,d.b*p/_,d.c*g/m,d.d*g/_,d.tx/m,d.ty/_),Nn.invert(),c?Nn.prepend(l.mapCoord):(f.uniforms.uMapCoord=l.mapCoord.toArray(!0),f.uniforms.uClampFrame=l.uClampFrame,f.uniforms.uClampOffset=l.uClampOffset),f.uniforms.uTransform=Nn.toArray(!0),f.uniforms.uColor=ue.shared.setValue(e.tint).premultiply(e.worldAlpha,u).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,t.shader.bind(f),t.geometry.bind(i),this.state.blendMode=Yf(e.blendMode,u),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}sm.extension={name:"tilingSprite",type:U.RendererPlugin};$.add(sm);const nm=class Fs{constructor(e,t,i){this.linkedSheets=[],(e instanceof Z||e instanceof W)&&(e={texture:e,data:t,resolutionFilename:i});const{texture:s,data:n,resolutionFilename:o=null,cachePrefix:a=""}=e;this.cachePrefix=a,this._texture=s instanceof W?s:null,this.baseTexture=s instanceof Z?s:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(o||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(e=null){const{scale:t}=this.data.meta;let i=ei(e,null);return i===null&&(i=typeof t=="number"?t:parseFloat(t??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Fs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=Fs.BATCH_SIZE;for(;t-e<i&&t<this._frameKeys.length;){const s=this._frameKeys[t],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,d=new K(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?a=new K(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new K(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new K(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new W(this.baseTexture,a,d,h,n.rotated?2:0,n.anchor,n.borders),W.addToCache(this.textures[s],this.cachePrefix+s.toString())}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let i=0;i<e[t].length;i++){const s=e[t][i];this.animations[t].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Fs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Fs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)==null||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};nm.BATCH_SIZE=1e3;let vd=nm;const MA=["jpg","png","jpeg","avif","webp"];function om(r,e,t){const i={};if(r.forEach(s=>{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[`${e.cachePrefix}${s}`]=e.textures[s]}),!t){const s=Me.dirname(r[0]);e.linkedSheets.forEach((n,o)=>{Object.assign(i,om([`${s}/${e.data.meta.related_multi_packs[o]}`],n,!0))})}return i}const IA={extension:U.Asset,cache:{test:r=>r instanceof vd,getCacheableAssets:(r,e)=>om(r,e,!1)},resolver:{test:r=>{const e=r.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&MA.includes(i)},parse:r=>{var t;const e=r.split(".");return{resolution:parseFloat(((t=V.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:e[e.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:U.LoadParser,priority:bt.Normal},async testParse(r,e){return Me.extname(e.src).toLowerCase()===".json"&&!!r.frames},async parse(r,e,t){var d,l;const{texture:i,imageFilename:s,cachePrefix:n}=(e==null?void 0:e.data)??{};let o=Me.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(i&&i.baseTexture)a=i;else{const c=oh(o+(s??r.meta.image),e.src);a=(await t.load([c]))[c]}const h=new vd({texture:a.baseTexture,data:r,resolutionFilename:e.src,cachePrefix:n});await h.parse();const u=(d=r==null?void 0:r.meta)==null?void 0:d.related_multi_packs;if(Array.isArray(u)){const c=[];for(const p of u){if(typeof p!="string")continue;let g=o+p;(l=e.data)!=null&&l.ignoreMultiPack||(g=oh(g,e.src),c.push(t.load({src:g,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(c);h.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[h].concat(h.linkedSheets.filter(g=>g!==p))})}return h},unload(r){r.destroy(!0)}}};$.add(IA);class ko{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ho{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in t){const o=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const u in a){const d=a[u].split("="),l=d[0],c=d[1].replace(/"/gm,""),f=parseFloat(c),p=isNaN(f)?c:f;h[l]=p}i[o].push(h)}const s=new ko;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class dh{static test(e){const t=e;return typeof e!="string"&&"getElementsByTagName"in e&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new ko,i=e.getElementsByTagName("info"),s=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField");for(let u=0;u<i.length;u++)t.info.push({face:i[u].getAttribute("face"),size:parseInt(i[u].getAttribute("size"),10)});for(let u=0;u<s.length;u++)t.common.push({lineHeight:parseInt(s[u].getAttribute("lineHeight"),10)});for(let u=0;u<n.length;u++)t.page.push({id:parseInt(n[u].getAttribute("id"),10)||0,file:n[u].getAttribute("file")});for(let u=0;u<o.length;u++){const d=o[u];t.char.push({id:parseInt(d.getAttribute("id"),10),page:parseInt(d.getAttribute("page"),10)||0,x:parseInt(d.getAttribute("x"),10),y:parseInt(d.getAttribute("y"),10),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10),xoffset:parseInt(d.getAttribute("xoffset"),10),yoffset:parseInt(d.getAttribute("yoffset"),10),xadvance:parseInt(d.getAttribute("xadvance"),10)})}for(let u=0;u<a.length;u++)t.kerning.push({first:parseInt(a[u].getAttribute("first"),10),second:parseInt(a[u].getAttribute("second"),10),amount:parseInt(a[u].getAttribute("amount"),10)});for(let u=0;u<h.length;u++)t.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return t}}class fh{static test(e){return typeof e=="string"&&e.includes("<font>")?dh.test(V.ADAPTER.parseXML(e)):!1}static parse(e){return dh.parse(V.ADAPTER.parseXML(e))}}const qa=[ho,dh,fh];function PA(r){for(let e=0;e<qa.length;e++)if(qa[e].test(r))return qa[e];return null}function RA(r,e,t,i,s,n){const o=t.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=t.dropShadow?t.dropShadowDistance:0,u=t.padding||0,d=r.width/i-h-u*2,l=r.height/i-h-u*2,c=o.slice(),f=t.fillGradientStops.slice();if(!f.length){const p=c.length+1;for(let g=1;g<p;++g)f.push(g/p)}if(c.unshift(o[0]),f.unshift(0),c.push(o[o.length-1]),f.push(1),t.fillGradientType===ea.LINEAR_VERTICAL){a=e.createLinearGradient(d/2,u,d/2,l+u);let p=0;const g=(n.fontProperties.fontSize+t.strokeThickness)/l;for(let m=0;m<s.length;m++){const _=n.lineHeight*m;for(let v=0;v<c.length;v++){let x=0;typeof f[v]=="number"?x=f[v]:x=v/c.length;const b=_/l+x*g;let w=Math.max(p,b);w=Math.min(w,1),a.addColorStop(w,c[v]),p=w}}}else{a=e.createLinearGradient(u,l/2,d+u,l/2);const p=c.length+1;let g=1;for(let m=0;m<c.length;m++){let _;typeof f[m]=="number"?_=f[m]:_=g/p,a.addColorStop(_,c[m]),g++}}return a}function DA(r,e,t,i,s,n,o){const a=t.text,h=t.fontProperties;e.translate(i,s),e.scale(n,n);const u=o.strokeThickness/2,d=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=RA(r,e,o,n,[a],t),e.strokeStyle=o.stroke,o.dropShadow){const l=o.dropShadowColor,c=o.dropShadowBlur*n,f=o.dropShadowDistance*n;e.shadowColor=ue.shared.setValue(l).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=c,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,u,d+t.lineHeight-h.descent),o.fill&&e.fillText(a,u,d+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function co(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function am(r){return Array.from?Array.from(r):r.split("")}function BA(r){typeof r=="string"&&(r=[r]);const e=[];for(let t=0,i=r.length;t<i;t++){const s=r[t];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)e.push(String.fromCharCode(a))}else e.push(...am(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const li=class It{constructor(e,t,i){var d;const[s]=e.info,[n]=e.common,[o]=e.page,[a]=e.distanceField,h=ei(o.file),u={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=u;for(let l=0;l<e.page.length;l++){const{id:c,file:f}=e.page[l];u[c]=t instanceof Array?t[l]:t[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(u[c].baseTexture.alphaMode=je.NO_PREMULTIPLIED_ALPHA,u[c].baseTexture.mipmap=Ut.OFF)}for(let l=0;l<e.char.length;l++){const{id:c,page:f}=e.char[l];let{x:p,y:g,width:m,height:_,xoffset:v,yoffset:x,xadvance:b}=e.char[l];p/=h,g/=h,m/=h,_/=h,v/=h,x/=h,b/=h;const w=new K(p+u[f].frame.x/h,g+u[f].frame.y/h,m,_);this.chars[c]={xOffset:v,yOffset:x,xAdvance:b,kerning:{},texture:new W(u[f].baseTexture,w),page:f}}for(let l=0;l<e.kerning.length;l++){let{first:c,second:f,amount:p}=e.kerning[l];c/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[c]=p)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((d=a==null?void 0:a.fieldType)==null?void 0:d.toLowerCase())??"none"}destroy(){for(const e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(const e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,t,i){let s;if(e instanceof ko)s=e;else{const o=PA(e);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(e)}t instanceof W&&(t=[t]);const n=new It(s,t,i);return It.available[n.font]=n,n}static uninstall(e){const t=It.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete It.available[e]}static from(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...u}=Object.assign({},It.defaultOptions,i),d=BA(s),l=t instanceof Si?t:new Si(t),c=a,f=new ko;f.info[0]={face:l.fontFamily,size:l.fontSize},f.common[0]={lineHeight:l.fontSize};let p=0,g=0,m,_,v,x=0;const b=[];for(let C=0;C<d.length;C++){m||(m=V.ADAPTER.createCanvas(),m.width=a,m.height=h,_=m.getContext("2d"),v=new Z(m,{resolution:o,...u}),b.push(new W(v)),f.page.push({id:b.length-1,file:""}));const S=d[C],T=di.measureText(S,l,!1,m),M=T.width,P=Math.ceil(T.height),R=Math.ceil((l.fontStyle==="italic"?2:1)*M);if(g>=h-P*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${S}')`);--C,m=null,_=null,v=null,g=0,p=0,x=0;continue}if(x=Math.max(P+T.fontProperties.descent,x),R*o+p>=c){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${S}')`);--C,g+=x*o,g=Math.ceil(g),p=0,x=0;continue}DA(m,_,T,p,g,o,l);const E=co(T.text);f.char.push({id:E,page:b.length-1,x:p/o,y:g/o,width:R,height:P,xoffset:0,yoffset:0,xadvance:M-(l.dropShadow?l.dropShadowDistance:0)-(l.stroke?l.strokeThickness:0)}),p+=(R+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let C=0,S=d.length;C<S;C++){const T=d[C];for(let M=0;M<S;M++){const P=d[M],R=_.measureText(T).width,E=_.measureText(P).width,A=_.measureText(T+P).width-(R+E);A&&f.kerning.push({first:co(T),second:co(P),amount:A})}}const w=new It(f,b,!0);return It.available[e]!==void 0&&It.uninstall(e),It.available[e]=w,w}};li.ALPHA=[["a","z"],["A","Z"]," "],li.NUMERIC=[["0","9"]],li.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],li.ASCII=[[" ","~"]],li.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:li.ALPHANUMERIC},li.available={};let hi=li;var FA=`// Pixi texture info\r
|
|
4770
|
+
`;const Un=new de;class sm extends Zo{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new ap,this.state=Gt.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=kt.from(yd,MA,t),this.shader=e.context.webGLVersion>1?kt.from(EA,SA,t):kt.from(yd,CA,t)}render(e){const t=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);const n=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=e._texture,h=a.baseTexture,u=h.alphaMode>0,d=e.tileTransform.localTransform,l=e.uvMatrix;let c=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;c&&(h._glTextures[t.CONTEXT_UID]?c=h.wrapMode!==wi.CLAMP:h.wrapMode===wi.CLAMP&&(h.wrapMode=wi.REPEAT));const f=c?this.simpleShader:this.shader,p=a.width,g=a.height,m=e._width,_=e._height;Un.set(d.a*p/m,d.b*p/_,d.c*g/m,d.d*g/_,d.tx/m,d.ty/_),Un.invert(),c?Un.prepend(l.mapCoord):(f.uniforms.uMapCoord=l.mapCoord.toArray(!0),f.uniforms.uClampFrame=l.uClampFrame,f.uniforms.uClampOffset=l.uClampOffset),f.uniforms.uTransform=Un.toArray(!0),f.uniforms.uColor=ue.shared.setValue(e.tint).premultiply(e.worldAlpha,u).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,t.shader.bind(f),t.geometry.bind(i),this.state.blendMode=Yf(e.blendMode,u),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}sm.extension={name:"tilingSprite",type:U.RendererPlugin};$.add(sm);const nm=class Ls{constructor(e,t,i){this.linkedSheets=[],(e instanceof Z||e instanceof W)&&(e={texture:e,data:t,resolutionFilename:i});const{texture:s,data:n,resolutionFilename:o=null,cachePrefix:a=""}=e;this.cachePrefix=a,this._texture=s instanceof W?s:null,this.baseTexture=s instanceof Z?s:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(o||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(e=null){const{scale:t}=this.data.meta;let i=ei(e,null);return i===null&&(i=typeof t=="number"?t:parseFloat(t??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ls.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=Ls.BATCH_SIZE;for(;t-e<i&&t<this._frameKeys.length;){const s=this._frameKeys[t],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,d=new K(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?a=new K(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new K(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new K(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new W(this.baseTexture,a,d,h,n.rotated?2:0,n.anchor,n.borders),W.addToCache(this.textures[s],this.cachePrefix+s.toString())}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let i=0;i<e[t].length;i++){const s=e[t][i];this.animations[t].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ls.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ls.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)==null||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};nm.BATCH_SIZE=1e3;let vd=nm;const IA=["jpg","png","jpeg","avif","webp"];function om(r,e,t){const i={};if(r.forEach(s=>{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[`${e.cachePrefix}${s}`]=e.textures[s]}),!t){const s=Me.dirname(r[0]);e.linkedSheets.forEach((n,o)=>{Object.assign(i,om([`${s}/${e.data.meta.related_multi_packs[o]}`],n,!0))})}return i}const PA={extension:U.Asset,cache:{test:r=>r instanceof vd,getCacheableAssets:(r,e)=>om(r,e,!1)},resolver:{test:r=>{const e=r.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&IA.includes(i)},parse:r=>{var t;const e=r.split(".");return{resolution:parseFloat(((t=V.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:e[e.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:U.LoadParser,priority:bt.Normal},async testParse(r,e){return Me.extname(e.src).toLowerCase()===".json"&&!!r.frames},async parse(r,e,t){var d,l;const{texture:i,imageFilename:s,cachePrefix:n}=(e==null?void 0:e.data)??{};let o=Me.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(i&&i.baseTexture)a=i;else{const c=nh(o+(s??r.meta.image),e.src);a=(await t.load([c]))[c]}const h=new vd({texture:a.baseTexture,data:r,resolutionFilename:e.src,cachePrefix:n});await h.parse();const u=(d=r==null?void 0:r.meta)==null?void 0:d.related_multi_packs;if(Array.isArray(u)){const c=[];for(const p of u){if(typeof p!="string")continue;let g=o+p;(l=e.data)!=null&&l.ignoreMultiPack||(g=nh(g,e.src),c.push(t.load({src:g,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(c);h.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[h].concat(h.linkedSheets.filter(g=>g!==p))})}return h},unload(r){r.destroy(!0)}}};$.add(PA);class ko{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class co{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in t){const o=t[n].match(/^[a-z]+/gm)[0],a=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const u in a){const d=a[u].split("="),l=d[0],c=d[1].replace(/"/gm,""),f=parseFloat(c),p=isNaN(f)?c:f;h[l]=p}i[o].push(h)}const s=new ko;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class uh{static test(e){const t=e;return typeof e!="string"&&"getElementsByTagName"in e&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new ko,i=e.getElementsByTagName("info"),s=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField");for(let u=0;u<i.length;u++)t.info.push({face:i[u].getAttribute("face"),size:parseInt(i[u].getAttribute("size"),10)});for(let u=0;u<s.length;u++)t.common.push({lineHeight:parseInt(s[u].getAttribute("lineHeight"),10)});for(let u=0;u<n.length;u++)t.page.push({id:parseInt(n[u].getAttribute("id"),10)||0,file:n[u].getAttribute("file")});for(let u=0;u<o.length;u++){const d=o[u];t.char.push({id:parseInt(d.getAttribute("id"),10),page:parseInt(d.getAttribute("page"),10)||0,x:parseInt(d.getAttribute("x"),10),y:parseInt(d.getAttribute("y"),10),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10),xoffset:parseInt(d.getAttribute("xoffset"),10),yoffset:parseInt(d.getAttribute("yoffset"),10),xadvance:parseInt(d.getAttribute("xadvance"),10)})}for(let u=0;u<a.length;u++)t.kerning.push({first:parseInt(a[u].getAttribute("first"),10),second:parseInt(a[u].getAttribute("second"),10),amount:parseInt(a[u].getAttribute("amount"),10)});for(let u=0;u<h.length;u++)t.distanceField.push({fieldType:h[u].getAttribute("fieldType"),distanceRange:parseInt(h[u].getAttribute("distanceRange"),10)});return t}}class dh{static test(e){return typeof e=="string"&&e.includes("<font>")?uh.test(V.ADAPTER.parseXML(e)):!1}static parse(e){return uh.parse(V.ADAPTER.parseXML(e))}}const Ya=[co,uh,dh];function RA(r){for(let e=0;e<Ya.length;e++)if(Ya[e].test(r))return Ya[e];return null}function DA(r,e,t,i,s,n){const o=t.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=t.dropShadow?t.dropShadowDistance:0,u=t.padding||0,d=r.width/i-h-u*2,l=r.height/i-h-u*2,c=o.slice(),f=t.fillGradientStops.slice();if(!f.length){const p=c.length+1;for(let g=1;g<p;++g)f.push(g/p)}if(c.unshift(o[0]),f.unshift(0),c.push(o[o.length-1]),f.push(1),t.fillGradientType===Jo.LINEAR_VERTICAL){a=e.createLinearGradient(d/2,u,d/2,l+u);let p=0;const g=(n.fontProperties.fontSize+t.strokeThickness)/l;for(let m=0;m<s.length;m++){const _=n.lineHeight*m;for(let v=0;v<c.length;v++){let x=0;typeof f[v]=="number"?x=f[v]:x=v/c.length;const b=_/l+x*g;let w=Math.max(p,b);w=Math.min(w,1),a.addColorStop(w,c[v]),p=w}}}else{a=e.createLinearGradient(u,l/2,d+u,l/2);const p=c.length+1;let g=1;for(let m=0;m<c.length;m++){let _;typeof f[m]=="number"?_=f[m]:_=g/p,a.addColorStop(_,c[m]),g++}}return a}function BA(r,e,t,i,s,n,o){const a=t.text,h=t.fontProperties;e.translate(i,s),e.scale(n,n);const u=o.strokeThickness/2,d=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=DA(r,e,o,n,[a],t),e.strokeStyle=o.stroke,o.dropShadow){const l=o.dropShadowColor,c=o.dropShadowBlur*n,f=o.dropShadowDistance*n;e.shadowColor=ue.shared.setValue(l).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=c,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,u,d+t.lineHeight-h.descent),o.fill&&e.fillText(a,u,d+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function uo(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function am(r){return Array.from?Array.from(r):r.split("")}function FA(r){typeof r=="string"&&(r=[r]);const e=[];for(let t=0,i=r.length;t<i;t++){const s=r[t];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)e.push(String.fromCharCode(a))}else e.push(...am(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const li=class It{constructor(e,t,i){var d;const[s]=e.info,[n]=e.common,[o]=e.page,[a]=e.distanceField,h=ei(o.file),u={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=u;for(let l=0;l<e.page.length;l++){const{id:c,file:f}=e.page[l];u[c]=t instanceof Array?t[l]:t[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(u[c].baseTexture.alphaMode=je.NO_PREMULTIPLIED_ALPHA,u[c].baseTexture.mipmap=Ut.OFF)}for(let l=0;l<e.char.length;l++){const{id:c,page:f}=e.char[l];let{x:p,y:g,width:m,height:_,xoffset:v,yoffset:x,xadvance:b}=e.char[l];p/=h,g/=h,m/=h,_/=h,v/=h,x/=h,b/=h;const w=new K(p+u[f].frame.x/h,g+u[f].frame.y/h,m,_);this.chars[c]={xOffset:v,yOffset:x,xAdvance:b,kerning:{},texture:new W(u[f].baseTexture,w),page:f}}for(let l=0;l<e.kerning.length;l++){let{first:c,second:f,amount:p}=e.kerning[l];c/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[c]=p)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((d=a==null?void 0:a.fieldType)==null?void 0:d.toLowerCase())??"none"}destroy(){for(const e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(const e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,t,i){let s;if(e instanceof ko)s=e;else{const o=RA(e);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(e)}t instanceof W&&(t=[t]);const n=new It(s,t,i);return It.available[n.font]=n,n}static uninstall(e){const t=It.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete It.available[e]}static from(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...u}=Object.assign({},It.defaultOptions,i),d=FA(s),l=t instanceof Si?t:new Si(t),c=a,f=new ko;f.info[0]={face:l.fontFamily,size:l.fontSize},f.common[0]={lineHeight:l.fontSize};let p=0,g=0,m,_,v,x=0;const b=[];for(let C=0;C<d.length;C++){m||(m=V.ADAPTER.createCanvas(),m.width=a,m.height=h,_=m.getContext("2d"),v=new Z(m,{resolution:o,...u}),b.push(new W(v)),f.page.push({id:b.length-1,file:""}));const S=d[C],T=di.measureText(S,l,!1,m),M=T.width,P=Math.ceil(T.height),R=Math.ceil((l.fontStyle==="italic"?2:1)*M);if(g>=h-P*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${S}')`);--C,m=null,_=null,v=null,g=0,p=0,x=0;continue}if(x=Math.max(P+T.fontProperties.descent,x),R*o+p>=c){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${l.fontFamily}', fontSize: ${l.fontSize}px, char: '${S}')`);--C,g+=x*o,g=Math.ceil(g),p=0,x=0;continue}BA(m,_,T,p,g,o,l);const E=uo(T.text);f.char.push({id:E,page:b.length-1,x:p/o,y:g/o,width:R,height:P,xoffset:0,yoffset:0,xadvance:M-(l.dropShadow?l.dropShadowDistance:0)-(l.stroke?l.strokeThickness:0)}),p+=(R+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let C=0,S=d.length;C<S;C++){const T=d[C];for(let M=0;M<S;M++){const P=d[M],R=_.measureText(T).width,E=_.measureText(P).width,A=_.measureText(T+P).width-(R+E);A&&f.kerning.push({first:uo(T),second:uo(P),amount:A})}}const w=new It(f,b,!0);return It.available[e]!==void 0&&It.uninstall(e),It.available[e]=w,w}};li.ALPHA=[["a","z"],["A","Z"]," "],li.NUMERIC=[["0","9"]],li.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],li.ASCII=[[" ","~"]],li.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:li.ALPHANUMERIC},li.available={};let hi=li;var LA=`// Pixi texture info\r
|
|
4771
4771
|
varying vec2 vTextureCoord;\r
|
|
4772
4772
|
uniform sampler2D uSampler;\r
|
|
4773
4773
|
\r
|
|
@@ -4805,7 +4805,7 @@ void main(void) {\r
|
|
|
4805
4805
|
// NPM Textures, NPM outputs\r
|
|
4806
4806
|
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
4807
4807
|
}\r
|
|
4808
|
-
`,
|
|
4808
|
+
`,OA=`// Mesh material default fragment\r
|
|
4809
4809
|
attribute vec2 aVertexPosition;\r
|
|
4810
4810
|
attribute vec2 aTextureCoord;\r
|
|
4811
4811
|
\r
|
|
@@ -4821,17 +4821,17 @@ void main(void)\r
|
|
|
4821
4821
|
\r
|
|
4822
4822
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
4823
4823
|
}\r
|
|
4824
|
-
`;const xd=[],bd=[],wd=[],
|
|
4825
|
-
`)||" ",u=am(h),d=this._maxWidth*e.size/t,l=e.distanceFieldType==="none"?xd:bd;let c=null,f=0,p=0,g=0,m=-1,_=0,v=0,x=0,b=0;for(let E=0;E<u.length;E++){const A=u[E],I=
|
|
4824
|
+
`;const xd=[],bd=[],wd=[],kA=class lm extends vt{constructor(e,t={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},lm.styleDefaults,t);if(!hi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new ue(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new Kt(()=>{this.dirty=!0},this,0,0),this._roundPixels=V.ROUND_PIXELS,this.dirty=!0,this._resolution=V.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var R;const e=hi.available[this._fontName],t=this.fontSize,i=t/e.size,s=new ie,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
|
4825
|
+
`)||" ",u=am(h),d=this._maxWidth*e.size/t,l=e.distanceFieldType==="none"?xd:bd;let c=null,f=0,p=0,g=0,m=-1,_=0,v=0,x=0,b=0;for(let E=0;E<u.length;E++){const A=u[E],I=uo(A);if(/(?:\s)/.test(A)&&(m=E,_=f,b++),A==="\r"||A===`
|
|
4826
4826
|
`){o.push(f),a.push(-1),p=Math.max(p,f),++g,++v,s.x=0,s.y+=e.lineHeight,c=null,b=0;continue}const D=e.chars[I];if(!D)continue;c&&D.kerning[c]&&(s.x+=D.kerning[c]);const B=wd.pop()||{texture:W.EMPTY,line:0,charCode:0,prevSpaces:0,position:new ie};B.texture=D.texture,B.line=g,B.charCode=I,B.position.x=Math.round(s.x+D.xOffset+this._letterSpacing/2),B.position.y=Math.round(s.y+D.yOffset),B.prevSpaces=b,n.push(B),f=B.position.x+Math.max(D.xAdvance-D.xOffset,D.texture.orig.width),s.x+=D.xAdvance+this._letterSpacing,x=Math.max(x,D.yOffset+D.texture.height),c=I,m!==-1&&d>0&&s.x>d&&(++v,Wr(n,1+m-v,1+E-m),E=m,m=-1,o.push(_),a.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),g++,s.x=0,s.y+=e.lineHeight,c=null,b=0)}const w=u[u.length-1];w!=="\r"&&w!==`
|
|
4827
|
-
`&&(/(?:\s)/.test(w)&&(f=_),o.push(f),p=Math.max(p,f),a.push(-1));const C=[];for(let E=0;E<=g;E++){let A=0;this._align==="right"?A=p-o[E]:this._align==="center"?A=(p-o[E])/2:this._align==="justify"&&(A=a[E]<0?0:(p-o[E])/a[E]),C.push(A)}const S=n.length,T={},M=[],P=this._activePagesMeshData;l.push(...P);for(let E=0;E<S;E++){const A=n[E].texture,I=A.baseTexture.uid;if(!T[I]){let D=l.pop();if(!D){const k=new
|
|
4827
|
+
`&&(/(?:\s)/.test(w)&&(f=_),o.push(f),p=Math.max(p,f),a.push(-1));const C=[];for(let E=0;E<=g;E++){let A=0;this._align==="right"?A=p-o[E]:this._align==="center"?A=(p-o[E])/2:this._align==="justify"&&(A=a[E]<0?0:(p-o[E])/a[E]),C.push(A)}const S=n.length,T={},M=[],P=this._activePagesMeshData;l.push(...P);for(let E=0;E<S;E++){const A=n[E].texture,I=A.baseTexture.uid;if(!T[I]){let D=l.pop();if(!D){const k=new aA;let z,q;e.distanceFieldType==="none"?(z=new gd(W.EMPTY),q=Y.NORMAL):(z=new gd(W.EMPTY,{program:Qt.from(OA,LA),uniforms:{uFWidth:0}}),q=Y.NORMAL_NPM);const L=new md(k,z);L.blendMode=q,D={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:L,vertices:null,uvs:null,indices:null}}D.index=0,D.indexCount=0,D.vertexCount=0,D.uvsCount=0,D.total=0;const{_textureCache:B}=this;B[I]=B[I]||new W(A.baseTexture),D.mesh.texture=B[I],D.mesh.tint=this._tintColor.value,M.push(D),T[I]=D}T[I].total++}for(let E=0;E<P.length;E++)M.includes(P[E])||this.removeChild(P[E].mesh);for(let E=0;E<M.length;E++)M[E].mesh.parent!==this&&this.addChild(M[E].mesh);this._activePagesMeshData=M;for(const E in T){const A=T[E],I=A.total;if(!(((R=A.indices)==null?void 0:R.length)>6*I)||A.vertices.length<md.BATCHABLE_SIZE*2)A.vertices=new Float32Array(4*2*I),A.uvs=new Float32Array(4*2*I),A.indices=new Uint16Array(6*I);else{const D=A.total,B=A.vertices;for(let k=D*4*2;k<B.length;k++)B[k]=0}A.mesh.size=6*I}for(let E=0;E<S;E++){const A=n[E];let I=A.position.x+C[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(I=Math.round(I));const D=I*i,B=A.position.y*i,k=A.texture,z=T[k.baseTexture.uid],q=k.frame,L=k._uvs,F=z.index++;z.indices[F*6+0]=0+F*4,z.indices[F*6+1]=1+F*4,z.indices[F*6+2]=2+F*4,z.indices[F*6+3]=0+F*4,z.indices[F*6+4]=2+F*4,z.indices[F*6+5]=3+F*4,z.vertices[F*8+0]=D,z.vertices[F*8+1]=B,z.vertices[F*8+2]=D+q.width*i,z.vertices[F*8+3]=B,z.vertices[F*8+4]=D+q.width*i,z.vertices[F*8+5]=B+q.height*i,z.vertices[F*8+6]=D,z.vertices[F*8+7]=B+q.height*i,z.uvs[F*8+0]=L.x0,z.uvs[F*8+1]=L.y0,z.uvs[F*8+2]=L.x1,z.uvs[F*8+3]=L.y1,z.uvs[F*8+4]=L.x2,z.uvs[F*8+5]=L.y2,z.uvs[F*8+6]=L.x3,z.uvs[F*8+7]=L.y3}this._textWidth=p*i,this._textHeight=(s.y+e.lineHeight)*i;for(const E in T){const A=T[E];if(this.anchor.x!==0||this.anchor.y!==0){let k=0;const z=this._textWidth*this.anchor.x,q=this._textHeight*this.anchor.y;for(let L=0;L<A.total;L++)A.vertices[k++]-=z,A.vertices[k++]-=q,A.vertices[k++]-=z,A.vertices[k++]-=q,A.vertices[k++]-=z,A.vertices[k++]-=q,A.vertices[k++]-=z,A.vertices[k++]-=q}this._maxLineHeight=x*i;const I=A.mesh.geometry.getBuffer("aVertexPosition"),D=A.mesh.geometry.getBuffer("aTextureCoord"),B=A.mesh.geometry.getIndex();I.data=A.vertices,D.data=A.uvs,B.data=A.indices,I.update(),D.update(),B.update()}for(let E=0;E<n.length;E++)wd.push(n[E]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:i,size:s}=hi.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,u=Math.sqrt(n*n+o*o),d=Math.sqrt(a*a+h*h),l=(Math.abs(u)+Math.abs(d))/2,c=this.fontSize/s,f=e._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=l*t*c*f}super._render(e)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const e=hi.available[this._fontName];if(!e)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(e){if(this.tint!==e){this._tintColor.setValue(e);for(let t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.dirty=!0)}get fontName(){return this._fontName}set fontName(e){if(!hi.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??hi.available[this._fontName].size}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}destroy(e){const{_textureCache:t}=this,i=hi.available[this._fontName].distanceFieldType==="none"?xd:bd;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>t[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=W.EMPTY});for(const s in t)t[s].destroy(),delete t[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};kA.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const NA=[".xml",".fnt"],UA={extension:{type:U.LoadParser,priority:bt.Normal},name:"loadBitmapFont",test(r){return NA.includes(Me.extname(r).toLowerCase())},async testParse(r){return co.test(r)||dh.test(r)},async parse(r,e,t){const i=co.test(r)?co.parse(r):dh.parse(r),{src:s}=e,{page:n}=i,o=[];for(let u=0;u<n.length;++u){const d=n[u].file;let l=Me.join(Me.dirname(s),d);l=nh(l,s),o.push(l)}const a=await t.load(o),h=o.map(u=>a[u]);return hi.install(i,h,!0)},async load(r,e){return(await V.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};$.add(UA);const fh=class Dr extends Si{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new Dr(Object.keys(Dr.defaultOptions).reduce((t,i)=>({...t,[i]:e[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,e.refs===0&&(e.fontFace&&document.fonts.delete(e.fontFace),delete Dr.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:i}=Dr;if(i[e]){const s=i[e];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return V.ADAPTER.fetch(e).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Me.basename(e,Me.extname(e)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:e,fontFace:null},t);i[e]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){const t=e.filter(i=>!this._overrides.includes(i));t.length>0&&(this._overrides.push(...t),this.styleID++)}removeOverride(...e){const t=e.filter(i=>this._overrides.includes(i));t.length>0&&(this._overrides=this._overrides.filter(i=>!t.includes(i)),this.styleID++)}toCSS(e){return[`transform: scale(${e})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((e,t)=>`${e}
|
|
4828
4828
|
@font-face {
|
|
4829
4829
|
font-family: "${t.family}";
|
|
4830
4830
|
src: url('${t.dataSrc}');
|
|
4831
4831
|
font-weight: ${t.weight};
|
|
4832
4832
|
font-style: ${t.style};
|
|
4833
4833
|
font-display: ${t.display};
|
|
4834
|
-
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=
|
|
4834
|
+
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=Mx(e)),typeof e=="number"?Cx(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith("#")&&t<1&&(e+=(t*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${n} ${e}`}reset(){Object.assign(this,Dr.defaultOptions)}onBeforeDraw(){const{fontsDirty:e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&e?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){const{userAgent:e}=V.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}set fillGradientStops(e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};fh.availableFonts={},fh.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let qa=fh;const Gn=class Br extends hs{constructor(e="",t={}){super(W.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=W.from(i,{scaleMode:V.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new K,s.trim=new K,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),u=document.createElementNS(o,"div"),d=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Br.defaultMaxWidth,this.maxHeight=Br.defaultMaxHeight,this._domElement=u,this._styleElement=d,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(d),this._foreignObject.appendChild(u),this._image=i,this._loadImage=new Image,this._autoResolution=Br.defaultAutoResolution,this._resolution=Br.defaultResolution??V.RESOLUTION,this.text=e,this.style=t}measureText(e){var d,l;const{text:t,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),u=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",u.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(d=this._style)==null?void 0:d.toCSS(s)}),this._styleElement.textContent=(l=this._style)==null?void 0:l.toGlobalCSS()),{width:h+i.padding*2,height:u+i.padding*2}}async updateText(e=!0){const{style:t,_image:i,_loadImage:s}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<this._updateID){h();return}await t.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const u=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(u)}`})}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:i,resolution:s}=this,{padding:n}=e,{baseTexture:o}=t;t.trim.width=t._frame.width=i.width/s,t.trim.height=t._frame.height=i.height/s,t.trim.x=-n,t.trim.y=-n,t.orig.width=t._frame.width-n*2,t.orig.height=t._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){var i,s,n,o,a;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},Br.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=t,(s=this._svgRoot)==null||s.remove(),this._svgRoot=t,(n=this._domElement)==null||n.remove(),this._domElement=t,(o=this._foreignObject)==null||o.remove(),this._foreignObject=t,(a=this._styleElement)==null||a.remove(),this._styleElement=t,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=t,this._image.src="",this._image=t}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);const t=vi(this.scale.x)||1;this.scale.x=t*e/this._image.width/this.resolution,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(e){this.updateText(!0);const t=vi(this.scale.y)||1;this.scale.y=t*e/this._image.height/this.resolution,this._height=e}get style(){return this._style}set style(e){this._style!==e&&(e=e||{},e instanceof qa?(this.ownsStyle=!1,this._style=e):e instanceof Si?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=qa.from(e)):(this.ownsStyle=!0,this._style=new qa(e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(e){e=String(e===""||e===null||e===void 0?" ":e),e=this.sanitiseText(e),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}sanitiseText(e){return e.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};Gn.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Gn.defaultMaxWidth=2024,Gn.defaultMaxHeight=2024,Gn.defaultAutoResolution=!0;function GA(r,e){const t=URL.createObjectURL(r),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}function hm(r){return r.length===0?0:r.reduce((t,i)=>t+i,0)/r.length}function ph(r,e){const t=new Blob([r],{type:e});return URL.createObjectURL(t)}function cm(){return/Mac|iPod|iPhone|iPad/.test(navigator==null?void 0:navigator.platform)||/Mac OS|iOS/.test(navigator==null?void 0:navigator.userAgent)}function zA(r){let e=document.createElement("canvas");const t=e.getContext("2d");if(e.width=r.width,e.height=r.height,!t)return;t.drawImage(r,0,0);const i=W.from(e);return e=null,i}function mh(r){let e=document.createElement("canvas");const t=e.getContext("2d");return e.width=r.width,e.height=r.height,t?(t.drawImage(r,0,0),e.toDataURL("image/png",.75)):void 0}function HA(r,e=43){const t=r*Math.PI/180;return e/(2*Math.tan(t/2))}var um={};/*!
|
|
4835
4835
|
* howler.js v2.2.4
|
|
4836
4836
|
* howlerjs.com
|
|
4837
4837
|
*
|
|
@@ -4849,33 +4849,33 @@ void main(void)\r
|
|
|
4849
4849
|
* goldfirestudios.com
|
|
4850
4850
|
*
|
|
4851
4851
|
* MIT License
|
|
4852
|
-
*/(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var i=this;if(!i.ctx||!i.ctx.listener)return i;for(var s=i._howls.length-1;s>=0;s--)i._howls[s].stereo(t);return i},HowlerGlobal.prototype.pos=function(t,i,s){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(i=typeof i!="number"?n._pos[1]:i,s=typeof s!="number"?n._pos[2]:s,typeof t=="number")n._pos=[t,i,s],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(t,i,s,n,o,a){var h=this;if(!h.ctx||!h.ctx.listener)return h;var u=h._orientation;if(i=typeof i!="number"?u[1]:i,s=typeof s!="number"?u[2]:s,n=typeof n!="number"?u[3]:n,o=typeof o!="number"?u[4]:o,a=typeof a!="number"?u[5]:a,typeof t=="number")h._orientation=[t,i,s,n,o,a],typeof h.ctx.listener.forwardX<"u"?(h.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),h.ctx.listener.forwardY.setTargetAtTime(i,Howler.ctx.currentTime,.1),h.ctx.listener.forwardZ.setTargetAtTime(s,Howler.ctx.currentTime,.1),h.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),h.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),h.ctx.listener.upZ.setTargetAtTime(a,Howler.ctx.currentTime,.1)):h.ctx.listener.setOrientation(t,i,s,n,o,a);else return u;return h},Howl.prototype.init=function(t){return function(i){var s=this;return s._orientation=i.orientation||[1,0,0],s._stereo=i.stereo||null,s._pos=i.pos||null,s._pannerAttr={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:360,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:360,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:0,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:"inverse",maxDistance:typeof i.maxDistance<"u"?i.maxDistance:1e4,panningModel:typeof i.panningModel<"u"?i.panningModel:"HRTF",refDistance:typeof i.refDistance<"u"?i.refDistance:1,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:1},s._onstereo=i.onstereo?[{fn:i.onstereo}]:[],s._onpos=i.onpos?[{fn:i.onpos}]:[],s._onorientation=i.onorientation?[{fn:i.onorientation}]:[],t.call(this,i)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,i){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"stereo",action:function(){s.stereo(t,i)}}),s;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof i>"u")if(typeof t=="number")s._stereo=t,s._pos=[t,0,0];else return s._stereo;for(var o=s._getSoundIds(i),a=0;a<o.length;a++){var h=s._soundById(o[a]);if(h)if(typeof t=="number")h._stereo=t,h._pos=[t,0,0],h._node&&(h._pannerAttr.panningModel="equalpower",(!h._panner||!h._panner.pan)&&e(h,n),n==="spatial"?typeof h._panner.positionX<"u"?(h._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),h._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),h._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):h._panner.setPosition(t,0,0):h._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),s._emit("stereo",h._id);else return h._stereo}return s},Howl.prototype.pos=function(t,i,s,n){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"pos",action:function(){o.pos(t,i,s,n)}}),o;if(i=typeof i!="number"?0:i,s=typeof s!="number"?-.5:s,typeof n>"u")if(typeof t=="number")o._pos=[t,i,s];else return o._pos;for(var a=o._getSoundIds(n),h=0;h<a.length;h++){var u=o._soundById(a[h]);if(u)if(typeof t=="number")u._pos=[t,i,s],u._node&&((!u._panner||u._panner.pan)&&e(u,"spatial"),typeof u._panner.positionX<"u"?(u._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(s,Howler.ctx.currentTime)):u._panner.setPosition(t,i,s)),o._emit("pos",u._id);else return u._pos}return o},Howl.prototype.orientation=function(t,i,s,n){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"orientation",action:function(){o.orientation(t,i,s,n)}}),o;if(i=typeof i!="number"?o._orientation[1]:i,s=typeof s!="number"?o._orientation[2]:s,typeof n>"u")if(typeof t=="number")o._orientation=[t,i,s];else return o._orientation;for(var a=o._getSoundIds(n),h=0;h<a.length;h++){var u=o._soundById(a[h]);if(u)if(typeof t=="number")u._orientation=[t,i,s],u._node&&(u._panner||(u._pos||(u._pos=o._pos||[0,0,-.5]),e(u,"spatial")),typeof u._panner.orientationX<"u"?(u._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(s,Howler.ctx.currentTime)):u._panner.setOrientation(t,i,s)),o._emit("orientation",u._id);else return u._orientation}return o},Howl.prototype.pannerAttr=function(){var t=this,i=arguments,s,n,o;if(!t._webAudio)return t;if(i.length===0)return t._pannerAttr;if(i.length===1)if(typeof i[0]=="object")s=i[0],typeof n>"u"&&(s.pannerAttr||(s.pannerAttr={coneInnerAngle:s.coneInnerAngle,coneOuterAngle:s.coneOuterAngle,coneOuterGain:s.coneOuterGain,distanceModel:s.distanceModel,maxDistance:s.maxDistance,refDistance:s.refDistance,rolloffFactor:s.rolloffFactor,panningModel:s.panningModel}),t._pannerAttr={coneInnerAngle:typeof s.pannerAttr.coneInnerAngle<"u"?s.pannerAttr.coneInnerAngle:t._coneInnerAngle,coneOuterAngle:typeof s.pannerAttr.coneOuterAngle<"u"?s.pannerAttr.coneOuterAngle:t._coneOuterAngle,coneOuterGain:typeof s.pannerAttr.coneOuterGain<"u"?s.pannerAttr.coneOuterGain:t._coneOuterGain,distanceModel:typeof s.pannerAttr.distanceModel<"u"?s.pannerAttr.distanceModel:t._distanceModel,maxDistance:typeof s.pannerAttr.maxDistance<"u"?s.pannerAttr.maxDistance:t._maxDistance,refDistance:typeof s.pannerAttr.refDistance<"u"?s.pannerAttr.refDistance:t._refDistance,rolloffFactor:typeof s.pannerAttr.rolloffFactor<"u"?s.pannerAttr.rolloffFactor:t._rolloffFactor,panningModel:typeof s.pannerAttr.panningModel<"u"?s.pannerAttr.panningModel:t._panningModel});else return o=t._soundById(parseInt(i[0],10)),o?o._pannerAttr:t._pannerAttr;else i.length===2&&(s=i[0],n=parseInt(i[1],10));for(var a=t._getSoundIds(n),h=0;h<a.length;h++)if(o=t._soundById(a[h]),o){var u=o._pannerAttr;u={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:u.coneOuterAngle,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:u.coneOuterGain,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:u.distanceModel,maxDistance:typeof s.maxDistance<"u"?s.maxDistance:u.maxDistance,refDistance:typeof s.refDistance<"u"?s.refDistance:u.refDistance,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:u.rolloffFactor,panningModel:typeof s.panningModel<"u"?s.panningModel:u.panningModel};var d=o._panner;d||(o._pos||(o._pos=t._pos||[0,0,-.5]),e(o,"spatial"),d=o._panner),d.coneInnerAngle=u.coneInnerAngle,d.coneOuterAngle=u.coneOuterAngle,d.coneOuterGain=u.coneOuterGain,d.distanceModel=u.distanceModel,d.maxDistance=u.maxDistance,d.refDistance=u.refDistance,d.rolloffFactor=u.rolloffFactor,d.panningModel=u.panningModel}return t},Sound.prototype.init=function(t){return function(){var i=this,s=i._parent;i._orientation=s._orientation,i._stereo=s._stereo,i._pos=s._pos,i._pannerAttr=s._pannerAttr,t.call(this),i._stereo?s.stereo(i._stereo):i._pos&&s.pos(i._pos[0],i._pos[1],i._pos[2],i._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var i=this,s=i._parent;return i._orientation=s._orientation,i._stereo=s._stereo,i._pos=s._pos,i._pannerAttr=s._pannerAttr,i._stereo?s.stereo(i._stereo):i._pos?s.pos(i._pos[0],i._pos[1],i._pos[2],i._id):i._panner&&(i._panner.disconnect(0),i._panner=void 0,s._refreshBuffer(i)),t.call(this)}}(Sound.prototype.reset);var e=function(t,i){i=i||"spatial",i==="spatial"?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,typeof t._panner.positionX<"u"?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),typeof t._panner.orientationX<"u"?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}})()})(um);const HA="data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjQxLjEwMAAAAAAAAAAAAAAA//NwwAAAAAAAAAAAAEluZm8AAAAPAAAAFAAACOAAICAgICwsLCwsNzc3NzdDQ0NDQ09PT09PW1tbW1tmZmZmZnJycnJyfn5+fn6KioqKipWVlZWVoaGhoaGtra2trbm5ubm5xcXFxcXQ0NDQ0Nzc3Nzc6Ojo6Oj09PT09P//////AAAAAExhdmM1OC43NQAAAAAAAAAAAAAAACQCwAAAAAAAAAjgTZykiAAAAAAAAAAAAAAAAAD/80DEABJhFmQCwwYUIDsKrsHAWBMRyeJYliQJBg5RYsWU/W3z/8OLc/3AAAQiIAIjv+7vUCJXd4jucQABAE3lwffiDBD+JC58oCH8H/1h/WH//1HPwTUMFrULH9ELKxULyTodFKYbO//zQsQRFFkScKDSRhyGWpIFpG91I7Fi/F6D2RWwN6TN/t9CiVSG5wMw74ogYcHoEwTFyMmTf4KkxEwmRfjXIYv1tpIOZRv/3O9ibtjR6gYmbGCgQ+Fk0mfSmybOX1cf78g7D6nP6qxCgf/zQMQbF+EacktaSABfy+3JKszHdMgcwwcl/kNFIuAo0I0DD1fWVs/crTSTTRInof3cmIwyLBwGQqCSLq7hyvtRPBB4aFyyXHov9X///7UXKqoIIcgcHict89/0y+n+nf/C0DIjB/+P//NCxBYZU9q0AYpoAHNyXSLn/+EjEbJclC4eJT//8e5aMAWeE4////wvAyAvYjZLjAD0Lg9D0kCU/////zwwBdJcYAehKBIwtYyx6FyXC4XP//////x7l83NDpfqd6gAcA/+wu9A2FGg//NAxAwXCnsq/5M4AhQKAOwmRvQRhjhOe5S8UkAmVHpU8IVU3lwejjIcayXOOceGwjf+D05I8oAu2x382o1ZHHV//31NU4441lmqcv///+RNGrUJKImnTf//iVYK1UZquoZESSy3egH/80LEChchBtMfyzAAk191v20qimbuNqavb211BthJKSJAG2aucbdLeVFVmRjZEVvzOggIwuUFDgvEZA7UeuUqNMLOraDQ5CVCk5m9BsmT3kbNrBdolcFSsqXGwQTWyYUX2wEDEgKkvZb/80DECRYRUpWsikYY1HXLbDZksYxtCHBShdHt/DgYCOM6r8AmUSpfGZYzH7ARMBCj1JtmY/hmwoGio0XBUShoklC5GsNeDR38RQ6d01DyrENtqp6mCJ5GJUckmpUBaIgYK6C0fPjmUf/zQsQLFil+cajTBhydxPRO4mLMWWSGQF2qa1f3PPlHQDJdzCxnwgkzB1SQohrpNRYRgtobv07tBLUFc27jQdWoQY0JNpiMJy654enBVoqnQR571uq/i9rpL1oAqAupJATLLk5L+QT3Kf/zQMQOE9D2bWFaGACZyWQZdt1rd3OVY8s/y2dBlg0m12PFzdFSlYrboY6gMOE1hJp7iFqmDcopF8F2OKEPnktdThRLoy9iuyj//0vD4+qf///++38OsIIFFhpEFZMC4s+gZmilJz1X//NCxBkaW8allZI4AWPWKBoLFWrwfuYvukbk4Rt9tBuJYOBoWpfzfjQaNMp//+OGEzzzDIif3+n/4PBIEt5hjDc9zxv/////nseeNDHGg0MQwxBEFn//////4TpB9d/s9thcHddpssFg//NAxAsVCT8GX5BAAigUAPBBdOBaKEIpaajR1VyCNH/gAwAfjRX8G7B4zfx0HANA8BpjQ6FhfqKxRBQURleGbrufzJywVGVfRdOzp5///ERCxhb//8wqijBAwUYMBCjVWZsv26uwYU3/80LEERRTIuTLwxABmdQgEBGKFNo9amfRWcpnayOUsKJ/UpWo/qyL////sj1b+pc3oarStSWpf/VP+hlotDN/0MVjKMKDAZGL/Ar8QWpCR0msAoVgrMoeT3xHIZd3qARkQge7hzlejQD/80DEGxPQ5sryeYYUBCI58AEvohe5nAMDcPxAbUxN6VCB4xCid97iaTyonF0l4upInmIpD//V0f/OllFls0vEBipVlYYRWhuzlHgpEiJSRmYJQaiptezfqvKm1PBRJKiq7M3s1yoqKv/zQsQmFBEGuojBkAQdCzTSpHY0FSwdboEQKi7pZN986g7UVOkf5ZR6VdbbQwZ+79PW6VoWdwZqA4VT2QGoxuuO0VZgbATjSNkSqqresUZ4lDGM5tfbuZzGHYfri5YKg0eDjgQjhm0Wpf/zQMQxE1jyoqhoxFD16D4jzQUUULEB1QXZhRIdIbHFtSlSvX5anFh11QTHaABkiBXOXoXxGW9galRr4fRiew3yOag/4HjxOydOM9ZyyokPlRKdFBa0CjY1luBiKXXwLw6oeMWEhjoS//NCxD4TUNKKIJpMJNTRh7nf/3kekmjdSWypy9UZXQgZMDh3pnAWB4O2M6nAaelR4r1OmVPFSwoksiWRUE1zc+f1lPc0ZudtdFDr4LLpoSwwGkpVO+oD6Tlb3HsYL7d+R1//td2LQMNF//NAxEwTaP5xYqJMCFlqIwAbEoCJNDEp9/3itYVbV6Yx/v0nuLdzyy50qHQw3cafmKlb6zBo0yXeRMnQG5J4jE7j4PFAkTSpQ9pexojMMsL0PIqP/Z1Xp/TpnVZZ27eWtNWRSSSyWyz/80LEWRSo1nDhWhgAlsstlkskgADyNOHqG5rlhLnSyI0a5oClU7uw0JnJQq2kTMBUYADEskGQ9wdHohh2xMKnCubKTIdyRgT83NEIrcfJpJOL3fV7l9cyXXJwJRDGpJLTZJF1+3OPUX3/80DEYiVyorJfmlgDRVRdYm21rHJXTVH0+ajd35ouiSF1tVcmLGnFummxbrhsXfHNzcf/2qgd/7XhppiSaYkmmQGRpnCsAMAEB4tQrXVA0VOiINSMWfljtMTHsRdZ3iL/V1neW6zvLf/zQsQnDSAiMFXMGADWd4i6zvEX+W/yzud5ZUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==";let VA=class{constructor(){this.sound=new um.Howl({src:[HA]})}play(){this.sound.play()}};const ii=r=>{var e,t;if(typeof r.destroy=="function"){r.destroy();return}for(;r.children.length>0;)ii(r.children[0]),(e=r.children[0])==null||e.removeFromParent();if(r instanceof y.Mesh)try{(t=r.geometry)==null||t.dispose()}catch{}};function WA(r){return new y.Vector3(r[0],r[1],r[2])}function $A(){let r=3,e=Math.max(1/window.devicePixelRatio,.5);return window.innerWidth/window.innerHeight<.65&&(r=4,e=1/window.devicePixelRatio),{tiles:r,renderScale:e}}function XA(r){let e=!1,t=!1,i=!1,s=1/0,n=1/0,o=1/0,a=-1/0,h=-1/0,u=-1/0,d=0,l=0;return r.traverse(f=>{if(f.isMesh&&f.geometry){const p=f;if(p.userData.ignoreSize||p.material.userData.isLOGO)return;p.geometry.computeBoundingBox();let g=p.geometry.attributes.position;const m=p.geometry.morphAttributes.position;let _=p.morphTargetInfluences;const v=Object.keys(p.morphTargetDictionary||{});v.includes("width")&&(t=!0),v.includes("length")&&(e=!0),v.includes("height")&&(i=!0);for(let x=0;x<g.count;x++){let b=g.getX(x),w=g.getY(x),C=g.getZ(x);l=Math.max(w,l),m&&_&&m.forEach((T,M)=>{const P=_&&_[M]||0;b+=T.getX(x)*P,w+=T.getY(x)*P,C+=T.getZ(x)*P}),b<s&&(s=b),w<n&&(n=w),C<o&&(o=C),b>a&&(a=b),w>h&&(h=w),C>u&&(u=C);const S=Math.sqrt(b*b+w*w);S>d&&(d=S)}}}),{box:new y.Box3(new y.Vector3(s,n,o),new y.Vector3(a,h,u)),maxRadius:d,height:l,hasWidth:t,hasLength:e,hasHeight:i}}function jA(r,e,t=null){let i=0;return function(){let s=t||this,n=arguments;clearTimeout(i),i=window.setTimeout(function(){r.apply(s,n)},e)}}class YA{constructor(e,t,i){this.length=e,this.width=t,this.height=i}}const Ad=r=>{var i;let e=0,t=0;if(r.geometry){r.geometry.computeBoundingBox();const s=new y.Vector3;(i=r.geometry.boundingBox)==null||i.getSize(s),s.y?(t=s.y,!s.x&&s.z?e=s.z:s.x&&!s.z?e=s.x:s.x&&s.z&&(e=s.z)):(e=s.z,t=s.x)}return{width:e,height:t}};function tc(){if(typeof navigator>"u")return!1;if(qA())return!0;const r=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|android|mobile|blackberry|iemobile|opera mini/.test(r)}function qA(){try{if(typeof wx<"u"&&wx.getSystemInfo||typeof my<"u"&&my.alert||typeof tt<"u"&&tt.getSystemInfo||typeof swan<"u"&&swan.getSystemInfo)return!0}catch{}return!1}const dm=new ig.GLTFExporter,rs=new Jm.GLTFLoader,No=new eg.DRACOLoader;window&&window.dracoPath?No.setDecoderPath(window.dracoPath):No.setDecoderPath("./draco/");No.setDecoderConfig({type:"wasm"});rs.setDRACOLoader(No);const ZA=new tg.DRACOExporter,Td=[115,103,108,98];function KA(r,e,t){const i=JSON.stringify(e),s=new TextEncoder().encode(i),n=new Uint8Array([115,103,108,98]),o=new Uint8Array(2);o[0]=t>>8,o[1]=t&255;const a=new Uint8Array(4);a[0]=s.length>>24,a[1]=s.length>>16&255,a[2]=s.length>>8&255,a[3]=s.length&255;const h=new Uint8Array(r),u=n.length+o.length+a.length+s.length+h.length,d=new Uint8Array(u);let l=0;return d.set(n,l),l+=n.length,d.set(o,l),l+=o.length,d.set(a,l),l+=a.length,d.set(s,l),l+=s.length,d.set(h,l),d.buffer}function QA(r){const e=new Uint8Array(r.slice(0,4));let t=!0;for(let l=0;l<Td.length;l++)if(e[l]!==Td[l]){t=!1;break}if(!t)throw new Error("Invalid file format");const s=new DataView(r,4,2).getUint16(0,!1),o=new DataView(r,6,4).getUint32(0,!1),a=new Uint8Array(r.slice(10,10+o)),h=new TextDecoder().decode(a),u=JSON.parse(h),d=r.slice(10+o);return{version:s,jsonDescription:u,glbContent:d}}class Uo{constructor(e){this.props=e,this.cache=new Map}load(e,t,i,s){if(this.props.useCache&&this.cache.has(e)){t(this.cache.get(e));return}const n=this;fetch(e).then(o=>{if(!o.ok){s==null||s(new ErrorEvent("NetworkError",{message:"NetworkError for "+e+": "+o.statusText}));return}return o.arrayBuffer()}).then(async o=>{o||s==null||s(new ErrorEvent("Error",{message:"Not a valid sglb file."}));try{const a=n.parse(o);if(!a.glbContent){s==null||s(new ErrorEvent("Error",{message:"No glb content."}));return}const h=mh(a.glbContent,"model/gltf-binary"),u=await rs.loadAsync(h);URL.revokeObjectURL(h),a.glbContent=void 0,a.glb=u.scene,o=void 0,this.cache.set(e,a),t(a)}catch(a){s==null||s(new ErrorEvent("Error",{message:a==null?void 0:a.message}))}}).catch(o=>{s==null||s(new ErrorEvent("Error",{message:o.message}))})}async loadAsync(e){if(this.props.useCache&&this.cache.has(e))return this.cache.get(e);try{const t=await fetch(e);if(!t.ok)throw new Error(`NetworkError for ${e}: ${t.statusText}`);const i=await t.arrayBuffer();if(!i)throw new Error("Not a valid sglb file.");const s=this.parse(i);if(!s.glbContent)throw new Error("No GLB content.");const n=mh(s.glbContent,"model/gltf-binary"),o=await rs.loadAsync(n);return URL.revokeObjectURL(n),s.glbContent=void 0,s.glb=o.scene,this.cache.set(e,s),s}catch(t){throw t}}parse(e){return QA(e)}clear(){[...this.cache.values()]}}/**
|
|
4852
|
+
*/(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var i=this;if(!i.ctx||!i.ctx.listener)return i;for(var s=i._howls.length-1;s>=0;s--)i._howls[s].stereo(t);return i},HowlerGlobal.prototype.pos=function(t,i,s){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(i=typeof i!="number"?n._pos[1]:i,s=typeof s!="number"?n._pos[2]:s,typeof t=="number")n._pos=[t,i,s],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(t,i,s,n,o,a){var h=this;if(!h.ctx||!h.ctx.listener)return h;var u=h._orientation;if(i=typeof i!="number"?u[1]:i,s=typeof s!="number"?u[2]:s,n=typeof n!="number"?u[3]:n,o=typeof o!="number"?u[4]:o,a=typeof a!="number"?u[5]:a,typeof t=="number")h._orientation=[t,i,s,n,o,a],typeof h.ctx.listener.forwardX<"u"?(h.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),h.ctx.listener.forwardY.setTargetAtTime(i,Howler.ctx.currentTime,.1),h.ctx.listener.forwardZ.setTargetAtTime(s,Howler.ctx.currentTime,.1),h.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),h.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),h.ctx.listener.upZ.setTargetAtTime(a,Howler.ctx.currentTime,.1)):h.ctx.listener.setOrientation(t,i,s,n,o,a);else return u;return h},Howl.prototype.init=function(t){return function(i){var s=this;return s._orientation=i.orientation||[1,0,0],s._stereo=i.stereo||null,s._pos=i.pos||null,s._pannerAttr={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:360,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:360,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:0,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:"inverse",maxDistance:typeof i.maxDistance<"u"?i.maxDistance:1e4,panningModel:typeof i.panningModel<"u"?i.panningModel:"HRTF",refDistance:typeof i.refDistance<"u"?i.refDistance:1,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:1},s._onstereo=i.onstereo?[{fn:i.onstereo}]:[],s._onpos=i.onpos?[{fn:i.onpos}]:[],s._onorientation=i.onorientation?[{fn:i.onorientation}]:[],t.call(this,i)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,i){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"stereo",action:function(){s.stereo(t,i)}}),s;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof i>"u")if(typeof t=="number")s._stereo=t,s._pos=[t,0,0];else return s._stereo;for(var o=s._getSoundIds(i),a=0;a<o.length;a++){var h=s._soundById(o[a]);if(h)if(typeof t=="number")h._stereo=t,h._pos=[t,0,0],h._node&&(h._pannerAttr.panningModel="equalpower",(!h._panner||!h._panner.pan)&&e(h,n),n==="spatial"?typeof h._panner.positionX<"u"?(h._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),h._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),h._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):h._panner.setPosition(t,0,0):h._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),s._emit("stereo",h._id);else return h._stereo}return s},Howl.prototype.pos=function(t,i,s,n){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"pos",action:function(){o.pos(t,i,s,n)}}),o;if(i=typeof i!="number"?0:i,s=typeof s!="number"?-.5:s,typeof n>"u")if(typeof t=="number")o._pos=[t,i,s];else return o._pos;for(var a=o._getSoundIds(n),h=0;h<a.length;h++){var u=o._soundById(a[h]);if(u)if(typeof t=="number")u._pos=[t,i,s],u._node&&((!u._panner||u._panner.pan)&&e(u,"spatial"),typeof u._panner.positionX<"u"?(u._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(s,Howler.ctx.currentTime)):u._panner.setPosition(t,i,s)),o._emit("pos",u._id);else return u._pos}return o},Howl.prototype.orientation=function(t,i,s,n){var o=this;if(!o._webAudio)return o;if(o._state!=="loaded")return o._queue.push({event:"orientation",action:function(){o.orientation(t,i,s,n)}}),o;if(i=typeof i!="number"?o._orientation[1]:i,s=typeof s!="number"?o._orientation[2]:s,typeof n>"u")if(typeof t=="number")o._orientation=[t,i,s];else return o._orientation;for(var a=o._getSoundIds(n),h=0;h<a.length;h++){var u=o._soundById(a[h]);if(u)if(typeof t=="number")u._orientation=[t,i,s],u._node&&(u._panner||(u._pos||(u._pos=o._pos||[0,0,-.5]),e(u,"spatial")),typeof u._panner.orientationX<"u"?(u._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(i,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(s,Howler.ctx.currentTime)):u._panner.setOrientation(t,i,s)),o._emit("orientation",u._id);else return u._orientation}return o},Howl.prototype.pannerAttr=function(){var t=this,i=arguments,s,n,o;if(!t._webAudio)return t;if(i.length===0)return t._pannerAttr;if(i.length===1)if(typeof i[0]=="object")s=i[0],typeof n>"u"&&(s.pannerAttr||(s.pannerAttr={coneInnerAngle:s.coneInnerAngle,coneOuterAngle:s.coneOuterAngle,coneOuterGain:s.coneOuterGain,distanceModel:s.distanceModel,maxDistance:s.maxDistance,refDistance:s.refDistance,rolloffFactor:s.rolloffFactor,panningModel:s.panningModel}),t._pannerAttr={coneInnerAngle:typeof s.pannerAttr.coneInnerAngle<"u"?s.pannerAttr.coneInnerAngle:t._coneInnerAngle,coneOuterAngle:typeof s.pannerAttr.coneOuterAngle<"u"?s.pannerAttr.coneOuterAngle:t._coneOuterAngle,coneOuterGain:typeof s.pannerAttr.coneOuterGain<"u"?s.pannerAttr.coneOuterGain:t._coneOuterGain,distanceModel:typeof s.pannerAttr.distanceModel<"u"?s.pannerAttr.distanceModel:t._distanceModel,maxDistance:typeof s.pannerAttr.maxDistance<"u"?s.pannerAttr.maxDistance:t._maxDistance,refDistance:typeof s.pannerAttr.refDistance<"u"?s.pannerAttr.refDistance:t._refDistance,rolloffFactor:typeof s.pannerAttr.rolloffFactor<"u"?s.pannerAttr.rolloffFactor:t._rolloffFactor,panningModel:typeof s.pannerAttr.panningModel<"u"?s.pannerAttr.panningModel:t._panningModel});else return o=t._soundById(parseInt(i[0],10)),o?o._pannerAttr:t._pannerAttr;else i.length===2&&(s=i[0],n=parseInt(i[1],10));for(var a=t._getSoundIds(n),h=0;h<a.length;h++)if(o=t._soundById(a[h]),o){var u=o._pannerAttr;u={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:u.coneOuterAngle,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:u.coneOuterGain,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:u.distanceModel,maxDistance:typeof s.maxDistance<"u"?s.maxDistance:u.maxDistance,refDistance:typeof s.refDistance<"u"?s.refDistance:u.refDistance,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:u.rolloffFactor,panningModel:typeof s.panningModel<"u"?s.panningModel:u.panningModel};var d=o._panner;d||(o._pos||(o._pos=t._pos||[0,0,-.5]),e(o,"spatial"),d=o._panner),d.coneInnerAngle=u.coneInnerAngle,d.coneOuterAngle=u.coneOuterAngle,d.coneOuterGain=u.coneOuterGain,d.distanceModel=u.distanceModel,d.maxDistance=u.maxDistance,d.refDistance=u.refDistance,d.rolloffFactor=u.rolloffFactor,d.panningModel=u.panningModel}return t},Sound.prototype.init=function(t){return function(){var i=this,s=i._parent;i._orientation=s._orientation,i._stereo=s._stereo,i._pos=s._pos,i._pannerAttr=s._pannerAttr,t.call(this),i._stereo?s.stereo(i._stereo):i._pos&&s.pos(i._pos[0],i._pos[1],i._pos[2],i._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var i=this,s=i._parent;return i._orientation=s._orientation,i._stereo=s._stereo,i._pos=s._pos,i._pannerAttr=s._pannerAttr,i._stereo?s.stereo(i._stereo):i._pos?s.pos(i._pos[0],i._pos[1],i._pos[2],i._id):i._panner&&(i._panner.disconnect(0),i._panner=void 0,s._refreshBuffer(i)),t.call(this)}}(Sound.prototype.reset);var e=function(t,i){i=i||"spatial",i==="spatial"?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,typeof t._panner.positionX<"u"?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),typeof t._panner.orientationX<"u"?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}})()})(um);const VA="data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjQxLjEwMAAAAAAAAAAAAAAA//NwwAAAAAAAAAAAAEluZm8AAAAPAAAAFAAACOAAICAgICwsLCwsNzc3NzdDQ0NDQ09PT09PW1tbW1tmZmZmZnJycnJyfn5+fn6KioqKipWVlZWVoaGhoaGtra2trbm5ubm5xcXFxcXQ0NDQ0Nzc3Nzc6Ojo6Oj09PT09P//////AAAAAExhdmM1OC43NQAAAAAAAAAAAAAAACQCwAAAAAAAAAjgTZykiAAAAAAAAAAAAAAAAAD/80DEABJhFmQCwwYUIDsKrsHAWBMRyeJYliQJBg5RYsWU/W3z/8OLc/3AAAQiIAIjv+7vUCJXd4jucQABAE3lwffiDBD+JC58oCH8H/1h/WH//1HPwTUMFrULH9ELKxULyTodFKYbO//zQsQRFFkScKDSRhyGWpIFpG91I7Fi/F6D2RWwN6TN/t9CiVSG5wMw74ogYcHoEwTFyMmTf4KkxEwmRfjXIYv1tpIOZRv/3O9ibtjR6gYmbGCgQ+Fk0mfSmybOX1cf78g7D6nP6qxCgf/zQMQbF+EacktaSABfy+3JKszHdMgcwwcl/kNFIuAo0I0DD1fWVs/crTSTTRInof3cmIwyLBwGQqCSLq7hyvtRPBB4aFyyXHov9X///7UXKqoIIcgcHict89/0y+n+nf/C0DIjB/+P//NCxBYZU9q0AYpoAHNyXSLn/+EjEbJclC4eJT//8e5aMAWeE4////wvAyAvYjZLjAD0Lg9D0kCU/////zwwBdJcYAehKBIwtYyx6FyXC4XP//////x7l83NDpfqd6gAcA/+wu9A2FGg//NAxAwXCnsq/5M4AhQKAOwmRvQRhjhOe5S8UkAmVHpU8IVU3lwejjIcayXOOceGwjf+D05I8oAu2x382o1ZHHV//31NU4441lmqcv///+RNGrUJKImnTf//iVYK1UZquoZESSy3egH/80LEChchBtMfyzAAk191v20qimbuNqavb211BthJKSJAG2aucbdLeVFVmRjZEVvzOggIwuUFDgvEZA7UeuUqNMLOraDQ5CVCk5m9BsmT3kbNrBdolcFSsqXGwQTWyYUX2wEDEgKkvZb/80DECRYRUpWsikYY1HXLbDZksYxtCHBShdHt/DgYCOM6r8AmUSpfGZYzH7ARMBCj1JtmY/hmwoGio0XBUShoklC5GsNeDR38RQ6d01DyrENtqp6mCJ5GJUckmpUBaIgYK6C0fPjmUf/zQsQLFil+cajTBhydxPRO4mLMWWSGQF2qa1f3PPlHQDJdzCxnwgkzB1SQohrpNRYRgtobv07tBLUFc27jQdWoQY0JNpiMJy654enBVoqnQR571uq/i9rpL1oAqAupJATLLk5L+QT3Kf/zQMQOE9D2bWFaGACZyWQZdt1rd3OVY8s/y2dBlg0m12PFzdFSlYrboY6gMOE1hJp7iFqmDcopF8F2OKEPnktdThRLoy9iuyj//0vD4+qf///++38OsIIFFhpEFZMC4s+gZmilJz1X//NCxBkaW8allZI4AWPWKBoLFWrwfuYvukbk4Rt9tBuJYOBoWpfzfjQaNMp//+OGEzzzDIif3+n/4PBIEt5hjDc9zxv/////nseeNDHGg0MQwxBEFn//////4TpB9d/s9thcHddpssFg//NAxAsVCT8GX5BAAigUAPBBdOBaKEIpaajR1VyCNH/gAwAfjRX8G7B4zfx0HANA8BpjQ6FhfqKxRBQURleGbrufzJywVGVfRdOzp5///ERCxhb//8wqijBAwUYMBCjVWZsv26uwYU3/80LEERRTIuTLwxABmdQgEBGKFNo9amfRWcpnayOUsKJ/UpWo/qyL////sj1b+pc3oarStSWpf/VP+hlotDN/0MVjKMKDAZGL/Ar8QWpCR0msAoVgrMoeT3xHIZd3qARkQge7hzlejQD/80DEGxPQ5sryeYYUBCI58AEvohe5nAMDcPxAbUxN6VCB4xCid97iaTyonF0l4upInmIpD//V0f/OllFls0vEBipVlYYRWhuzlHgpEiJSRmYJQaiptezfqvKm1PBRJKiq7M3s1yoqKv/zQsQmFBEGuojBkAQdCzTSpHY0FSwdboEQKi7pZN986g7UVOkf5ZR6VdbbQwZ+79PW6VoWdwZqA4VT2QGoxuuO0VZgbATjSNkSqqresUZ4lDGM5tfbuZzGHYfri5YKg0eDjgQjhm0Wpf/zQMQxE1jyoqhoxFD16D4jzQUUULEB1QXZhRIdIbHFtSlSvX5anFh11QTHaABkiBXOXoXxGW9galRr4fRiew3yOag/4HjxOydOM9ZyyokPlRKdFBa0CjY1luBiKXXwLw6oeMWEhjoS//NCxD4TUNKKIJpMJNTRh7nf/3kekmjdSWypy9UZXQgZMDh3pnAWB4O2M6nAaelR4r1OmVPFSwoksiWRUE1zc+f1lPc0ZudtdFDr4LLpoSwwGkpVO+oD6Tlb3HsYL7d+R1//td2LQMNF//NAxEwTaP5xYqJMCFlqIwAbEoCJNDEp9/3itYVbV6Yx/v0nuLdzyy50qHQw3cafmKlb6zBo0yXeRMnQG5J4jE7j4PFAkTSpQ9pexojMMsL0PIqP/Z1Xp/TpnVZZ27eWtNWRSSSyWyz/80LEWRSo1nDhWhgAlsstlkskgADyNOHqG5rlhLnSyI0a5oClU7uw0JnJQq2kTMBUYADEskGQ9wdHohh2xMKnCubKTIdyRgT83NEIrcfJpJOL3fV7l9cyXXJwJRDGpJLTZJF1+3OPUX3/80DEYiVyorJfmlgDRVRdYm21rHJXTVH0+ajd35ouiSF1tVcmLGnFummxbrhsXfHNzcf/2qgd/7XhppiSaYkmmQGRpnCsAMAEB4tQrXVA0VOiINSMWfljtMTHsRdZ3iL/V1neW6zvLf/zQsQnDSAiMFXMGADWd4i6zvEX+W/yzud5ZUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==";let WA=class{constructor(){this.sound=new um.Howl({src:[VA]})}play(){this.sound.play()}};const ii=r=>{var e,t;if(typeof r.destroy=="function"){r.destroy();return}for(;r.children.length>0;)ii(r.children[0]),(e=r.children[0])==null||e.removeFromParent();if(r instanceof y.Mesh)try{(t=r.geometry)==null||t.dispose()}catch{}};function $A(r){return new y.Vector3(r[0],r[1],r[2])}function XA(){let r=3,e=Math.max(1/window.devicePixelRatio,.5);return window.innerWidth/window.innerHeight<.65&&(r=4,e=1/window.devicePixelRatio),{tiles:r,renderScale:e}}function jA(r){let e=!1,t=!1,i=!1,s=1/0,n=1/0,o=1/0,a=-1/0,h=-1/0,u=-1/0,d=0,l=0;return r.traverse(f=>{if(f.isMesh&&f.geometry){const p=f;if(p.userData.ignoreSize||p.material.userData.isLOGO)return;p.geometry.computeBoundingBox();let g=p.geometry.attributes.position;const m=p.geometry.morphAttributes.position;let _=p.morphTargetInfluences;const v=Object.keys(p.morphTargetDictionary||{});v.includes("width")&&(t=!0),v.includes("length")&&(e=!0),v.includes("height")&&(i=!0);for(let x=0;x<g.count;x++){let b=g.getX(x),w=g.getY(x),C=g.getZ(x);l=Math.max(w,l),m&&_&&m.forEach((T,M)=>{const P=_&&_[M]||0;b+=T.getX(x)*P,w+=T.getY(x)*P,C+=T.getZ(x)*P}),b<s&&(s=b),w<n&&(n=w),C<o&&(o=C),b>a&&(a=b),w>h&&(h=w),C>u&&(u=C);const S=Math.sqrt(b*b+w*w);S>d&&(d=S)}}}),{box:new y.Box3(new y.Vector3(s,n,o),new y.Vector3(a,h,u)),maxRadius:d,height:l,hasWidth:t,hasLength:e,hasHeight:i}}function YA(r,e,t=null){let i=0;return function(){let s=t||this,n=arguments;clearTimeout(i),i=window.setTimeout(function(){r.apply(s,n)},e)}}class qA{constructor(e,t,i){this.length=e,this.width=t,this.height=i}}const Ad=r=>{var i;let e=0,t=0;if(r.geometry){r.geometry.computeBoundingBox();const s=new y.Vector3;(i=r.geometry.boundingBox)==null||i.getSize(s),s.y?(t=s.y,!s.x&&s.z?e=s.z:s.x&&!s.z?e=s.x:s.x&&s.z&&(e=s.z)):(e=s.z,t=s.x)}return{width:e,height:t}};function tc(){var e;if(typeof navigator>"u")return!1;if(ZA())return!0;const r=(e=navigator.userAgent)==null?void 0:e.toLowerCase();return/iphone|ipad|ipod|android|mobile|blackberry|iemobile|opera mini/.test(r)}function ZA(){try{if(typeof wx<"u"&&wx.getSystemInfo||typeof my<"u"&&my.alert||typeof tt<"u"&&tt.getSystemInfo||typeof swan<"u"&&swan.getSystemInfo)return!0}catch{}return!1}const dm=new rg.GLTFExporter,ss=new eg.GLTFLoader,fm=new tg.DRACOLoader;let gh="./draco/";try{gh=new URL("./draco/",typeof document>"u"?require("url").pathToFileURL(__filename).href:Qr&&Qr.src||new URL("shop-components.cjs",document.baseURI).href).href}catch{gh="./draco/"}typeof window<"u"&&window.dracoPath&&(gh=window.dracoPath);fm.setDecoderConfig({type:"wasm"});ss.setDRACOLoader(fm);const KA=new ig.DRACOExporter,Td=[115,103,108,98];function QA(r,e,t){const i=JSON.stringify(e),s=new TextEncoder().encode(i),n=new Uint8Array([115,103,108,98]),o=new Uint8Array(2);o[0]=t>>8,o[1]=t&255;const a=new Uint8Array(4);a[0]=s.length>>24,a[1]=s.length>>16&255,a[2]=s.length>>8&255,a[3]=s.length&255;const h=new Uint8Array(r),u=n.length+o.length+a.length+s.length+h.length,d=new Uint8Array(u);let l=0;return d.set(n,l),l+=n.length,d.set(o,l),l+=o.length,d.set(a,l),l+=a.length,d.set(s,l),l+=s.length,d.set(h,l),d.buffer}function JA(r){const e=new Uint8Array(r.slice(0,4));let t=!0;for(let l=0;l<Td.length;l++)if(e[l]!==Td[l]){t=!1;break}if(!t)throw new Error("Invalid file format");const s=new DataView(r,4,2).getUint16(0,!1),o=new DataView(r,6,4).getUint32(0,!1),a=new Uint8Array(r.slice(10,10+o)),h=new TextDecoder().decode(a),u=JSON.parse(h),d=r.slice(10+o);return{version:s,jsonDescription:u,glbContent:d}}class No{constructor(e){this.props=e,this.cache=new Map}load(e,t,i,s){if(this.props.useCache&&this.cache.has(e)){t(this.cache.get(e));return}const n=this;fetch(e).then(o=>{if(!o.ok){s==null||s(new ErrorEvent("NetworkError",{message:"NetworkError for "+e+": "+o.statusText}));return}return o.arrayBuffer()}).then(async o=>{o||s==null||s(new ErrorEvent("Error",{message:"Not a valid sglb file."}));try{const a=n.parse(o);if(!a.glbContent){s==null||s(new ErrorEvent("Error",{message:"No glb content."}));return}const h=ph(a.glbContent,"model/gltf-binary"),u=await ss.loadAsync(h);URL.revokeObjectURL(h),a.glbContent=void 0,a.glb=u.scene,o=void 0,this.cache.set(e,a),t(a)}catch(a){s==null||s(new ErrorEvent("Error",{message:a==null?void 0:a.message}))}}).catch(o=>{s==null||s(new ErrorEvent("Error",{message:o.message}))})}async loadAsync(e){if(this.props.useCache&&this.cache.has(e))return this.cache.get(e);try{const t=await fetch(e);if(!t.ok)throw new Error(`NetworkError for ${e}: ${t.statusText}`);const i=await t.arrayBuffer();if(!i)throw new Error("Not a valid sglb file.");const s=this.parse(i);if(!s.glbContent)throw new Error("No GLB content.");const n=ph(s.glbContent,"model/gltf-binary"),o=await ss.loadAsync(n);return URL.revokeObjectURL(n),s.glbContent=void 0,s.glb=o.scene,this.cache.set(e,s),s}catch(t){throw t}}parse(e){return JA(e)}clear(){[...this.cache.values()]}}/**
|
|
4853
4853
|
* @license
|
|
4854
4854
|
* Copyright 2019 Google LLC
|
|
4855
4855
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4856
|
-
*/const
|
|
4856
|
+
*/const fo=globalThis,ic=fo.ShadowRoot&&(fo.ShadyCSS===void 0||fo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rc=Symbol(),Sd=new WeakMap;let pm=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==rc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(ic&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Sd.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Sd.set(t,e))}return e}toString(){return this.cssText}};const eT=r=>new pm(typeof r=="string"?r:r+"",void 0,rc),mm=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,s,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new pm(t,r,rc)},tT=(r,e)=>{if(ic)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),s=fo.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},Ed=ic?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return eT(t)})(r):r;/**
|
|
4857
4857
|
* @license
|
|
4858
4858
|
* Copyright 2017 Google LLC
|
|
4859
4859
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4860
|
-
*/const{is:
|
|
4860
|
+
*/const{is:iT,defineProperty:rT,getOwnPropertyDescriptor:sT,getOwnPropertyNames:nT,getOwnPropertySymbols:oT,getPrototypeOf:aT}=Object,Ai=globalThis,Cd=Ai.trustedTypes,lT=Cd?Cd.emptyScript:"",Za=Ai.reactiveElementPolyfillSupport,Ws=(r,e)=>r,Uo={toAttribute(r,e){switch(e){case Boolean:r=r?lT:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},sc=(r,e)=>!iT(r,e),Md={attribute:!0,type:String,converter:Uo,reflect:!1,hasChanged:sc};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ai.litPropertyMetadata??(Ai.litPropertyMetadata=new WeakMap);let Fr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Md){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&rT(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=sT(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const a=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Md}static _$Ei(){if(this.hasOwnProperty(Ws("elementProperties")))return;const e=aT(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ws("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ws("properties"))){const t=this.properties,i=[...nT(t),...oT(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(Ed(s))}else e!==void 0&&t.push(Ed(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tT(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Uo).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const o=i.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Uo;this._$Em=s,this[s]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??sc)(this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$ET??(this._$ET=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$E_)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(t)):this._$Ej()}catch(s){throw e=!1,this._$Ej(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ej(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$ET&&(this._$ET=this._$ET.forEach(t=>this._$EO(t,this[t]))),this._$Ej()}updated(e){}firstUpdated(e){}};Fr.elementStyles=[],Fr.shadowRootOptions={mode:"open"},Fr[Ws("elementProperties")]=new Map,Fr[Ws("finalized")]=new Map,Za==null||Za({ReactiveElement:Fr}),(Ai.reactiveElementVersions??(Ai.reactiveElementVersions=[])).push("2.0.3");/**
|
|
4861
4861
|
* @license
|
|
4862
4862
|
* Copyright 2017 Google LLC
|
|
4863
4863
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4864
|
-
*/const
|
|
4865
|
-
\f\r]`,
|
|
4866
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dd=/'/g,Bd=/"/g,
|
|
4864
|
+
*/const $s=globalThis,Go=$s.trustedTypes,Id=Go?Go.createPolicy("lit-html",{createHTML:r=>r}):void 0,gm="$lit$",gi=`lit$${(Math.random()+"").slice(9)}$`,_m="?"+gi,hT=`<${_m}>`,rr=document,Qs=()=>rr.createComment(""),Js=r=>r===null||typeof r!="object"&&typeof r!="function",ym=Array.isArray,cT=r=>ym(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Ka=`[
|
|
4865
|
+
\f\r]`,bs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Pd=/-->/g,Rd=/>/g,ki=RegExp(`>|${Ka}(?:([^\\s"'>=/]+)(${Ka}*=${Ka}*(?:[^
|
|
4866
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dd=/'/g,Bd=/"/g,vm=/^(?:script|style|textarea|title)$/i,xm=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Tt=xm(1),Fd=xm(2),ns=Symbol.for("lit-noChange"),De=Symbol.for("lit-nothing"),Ld=new WeakMap,Yi=rr.createTreeWalker(rr,129);function bm(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Id!==void 0?Id.createHTML(e):e}const uT=(r,e)=>{const t=r.length-1,i=[];let s,n=e===2?"<svg>":"",o=bs;for(let a=0;a<t;a++){const h=r[a];let u,d,l=-1,c=0;for(;c<h.length&&(o.lastIndex=c,d=o.exec(h),d!==null);)c=o.lastIndex,o===bs?d[1]==="!--"?o=Pd:d[1]!==void 0?o=Rd:d[2]!==void 0?(vm.test(d[2])&&(s=RegExp("</"+d[2],"g")),o=ki):d[3]!==void 0&&(o=ki):o===ki?d[0]===">"?(o=s??bs,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,u=d[1],o=d[3]===void 0?ki:d[3]==='"'?Bd:Dd):o===Bd||o===Dd?o=ki:o===Pd||o===Rd?o=bs:(o=ki,s=void 0);const f=o===ki&&r[a+1].startsWith("/>")?" ":"";n+=o===bs?h+hT:l>=0?(i.push(u),h.slice(0,l)+gm+h.slice(l)+gi+f):h+gi+(l===-2?a:f)}return[bm(r,n+(r[t]||"<?>")+(e===2?"</svg>":"")),i]};class en{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0;const a=e.length-1,h=this.parts,[u,d]=uT(e,t);if(this.el=en.createElement(u,i),Yi.currentNode=this.el.content,t===2){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=Yi.nextNode())!==null&&h.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const l of s.getAttributeNames())if(l.endsWith(gm)){const c=d[o++],f=s.getAttribute(l).split(gi),p=/([.?@])?(.*)/.exec(c);h.push({type:1,index:n,name:p[2],strings:f,ctor:p[1]==="."?fT:p[1]==="?"?pT:p[1]==="@"?mT:ea}),s.removeAttribute(l)}else l.startsWith(gi)&&(h.push({type:6,index:n}),s.removeAttribute(l));if(vm.test(s.tagName)){const l=s.textContent.split(gi),c=l.length-1;if(c>0){s.textContent=Go?Go.emptyScript:"";for(let f=0;f<c;f++)s.append(l[f],Qs()),Yi.nextNode(),h.push({type:2,index:++n});s.append(l[c],Qs())}}}else if(s.nodeType===8)if(s.data===_m)h.push({type:2,index:n});else{let l=-1;for(;(l=s.data.indexOf(gi,l+1))!==-1;)h.push({type:7,index:n}),l+=gi.length-1}n++}}static createElement(e,t){const i=rr.createElement("template");return i.innerHTML=e,i}}function os(r,e,t=r,i){var o,a;if(e===ns)return e;let s=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Js(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=s:t._$Cl=s),s!==void 0&&(e=os(r,s._$AS(r,e.values),s,i)),e}class dT{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??rr).importNode(t,!0);Yi.currentNode=s;let n=Yi.nextNode(),o=0,a=0,h=i[0];for(;h!==void 0;){if(o===h.index){let u;h.type===2?u=new an(n,n.nextSibling,this,e):h.type===1?u=new h.ctor(n,h.name,h.strings,this,e):h.type===6&&(u=new gT(n,this,e)),this._$AV.push(u),h=i[++a]}o!==(h==null?void 0:h.index)&&(n=Yi.nextNode(),o++)}return Yi.currentNode=rr,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class an{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=De,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=os(this,e,t),Js(e)?e===De||e==null||e===""?(this._$AH!==De&&this._$AR(),this._$AH=De):e!==this._$AH&&e!==ns&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):cT(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==De&&Js(this._$AH)?this._$AA.nextSibling.data=e:this.$(rr.createTextNode(e)),this._$AH=e}g(e){var n;const{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=en.createElement(bm(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(t);else{const o=new dT(s,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=Ld.get(e.strings);return t===void 0&&Ld.set(e.strings,t=new en(e)),t}T(e){ym(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new an(this.k(Qs()),this.k(Qs()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class ea{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=De,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=De}_$AI(e,t=this,i,s){const n=this.strings;let o=!1;if(n===void 0)e=os(this,e,t,0),o=!Js(e)||e!==this._$AH&&e!==ns,o&&(this._$AH=e);else{const a=e;let h,u;for(e=n[0],h=0;h<n.length-1;h++)u=os(this,a[i+h],t,h),u===ns&&(u=this._$AH[h]),o||(o=!Js(u)||u!==this._$AH[h]),u===De?e=De:e!==De&&(e+=(u??"")+n[h+1]),this._$AH[h]=u}o&&!s&&this.O(e)}O(e){e===De?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class fT extends ea{constructor(){super(...arguments),this.type=3}O(e){this.element[this.name]=e===De?void 0:e}}class pT extends ea{constructor(){super(...arguments),this.type=4}O(e){this.element.toggleAttribute(this.name,!!e&&e!==De)}}class mT extends ea{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=os(this,e,t,0)??De)===ns)return;const i=this._$AH,s=e===De&&i!==De||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==De&&(i===De||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class gT{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){os(this,e)}}const Qa=$s.litHtmlPolyfillSupport;Qa==null||Qa(en,an),($s.litHtmlVersions??($s.litHtmlVersions=[])).push("3.1.1");const _T=(r,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let s=i._$litPart$;if(s===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=s=new an(e.insertBefore(Qs(),n),n,void 0,t??{})}return s._$AI(r),s};/**
|
|
4867
4867
|
* @license
|
|
4868
4868
|
* Copyright 2017 Google LLC
|
|
4869
4869
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4870
|
-
*/class qr extends Fr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=
|
|
4870
|
+
*/class qr extends Fr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=_T(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return ns}}var ef;qr._$litElement$=!0,qr.finalized=!0,(ef=globalThis.litElementHydrateSupport)==null||ef.call(globalThis,{LitElement:qr});const Ja=globalThis.litElementPolyfillSupport;Ja==null||Ja({LitElement:qr});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.3");/**
|
|
4871
4871
|
* @license
|
|
4872
4872
|
* Copyright 2017 Google LLC
|
|
4873
4873
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4874
|
-
*/const
|
|
4874
|
+
*/const wm=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
|
|
4875
4875
|
* @license
|
|
4876
4876
|
* Copyright 2017 Google LLC
|
|
4877
4877
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4878
|
-
*/const
|
|
4878
|
+
*/const yT={attribute:!0,type:String,converter:Uo,reflect:!1,hasChanged:sc},vT=(r=yT,e,t)=>{const{kind:i,metadata:s}=t;let n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(t.name,r),i==="accessor"){const{name:o}=t;return{set(a){const h=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,h,r)},init(a){return a!==void 0&&this.C(o,void 0,r),a}}}if(i==="setter"){const{name:o}=t;return function(a){const h=this[o];e.call(this,a),this.requestUpdate(o,h,r)}}throw Error("Unsupported decorator location: "+i)};function He(r){return(e,t)=>typeof t=="object"?vT(r,e,t):((i,s,n)=>{const o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,e,t)}/**
|
|
4879
4879
|
* @license
|
|
4880
4880
|
* Copyright 2017 Google LLC
|
|
4881
4881
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -4887,7 +4887,7 @@ void main(void)\r
|
|
|
4887
4887
|
* @license
|
|
4888
4888
|
* Copyright 2017 Google LLC
|
|
4889
4889
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4890
|
-
*/function vT(r,e){return(t,i,s)=>{const n=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(r))??null};if(e){const{get:o,set:a}=typeof i=="object"?t:s??(()=>{const h=Symbol();return{get(){return this[h]},set(u){this[h]=u}}})();return Od(t,i,{get(){let h=o.call(this);return h===void 0&&(h=n(this),(h!==null||this.hasUpdated)&&a.call(this,h)),h}})}return Od(t,i,{get(){return n(this)}})}}const xT=`*{box-sizing:border-box}.slot-item-container.is-mobile .main{pointer-events:none;border-width:1px;opacity:.8}.slot-item-container.is-mobile .main.focus{width:18px!important;height:18px!important;border-width:2px;opacity:1}.slot-item-container.is-mobile .main.filled{opacity:1;border-width:1px;width:14px!important;height:14px!important;background-image:none;border-radius:50%}.slot-item-container.is-mobile .main.to-be-installed{opacity:1;pointer-events:auto;width:38px!important;height:38px!important;border-color:#000;border-width:1px;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3e%3cg%3e%3cg%3e%3cpath%20d='M20,10.75L0,10.75L0,9.25L20,9.25L20,10.75Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3cg%20transform='matrix(0,1,1,0,10,-10)'%3e%3cpath%20d='M30,0.75L10,0.75L10,-0.75L30,-0.75L30,0.75Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e");background-size:20px auto;background-repeat:no-repeat;background-position:center;background-color:#fff9}.slot-item-container.is-mobile .main.to-be-installed+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container.is-mobile .main.to-be-installed.filled{opacity:1;border-width:2px;width:18px!important;height:18px!important;background-image:none;border-radius:50%;border-color:#00ff95}.slot-item-container.is-mobile .main.to-be-installed.to-be-replaced{opacity:1;border-width:1px;pointer-events:auto;width:38px!important;height:38px!important;border-radius:50%;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_504_014299'%3e%3crect%20x='0'%20y='0'%20width='40'%20height='40'%20rx='20'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_504_014299)'%3e%3cg%3e%3cg%3e%3cpath%20d='M31.695414,17L26.009501,10.74549544L24.899591,11.75450456L28.304586,15.5L8.75,15.5L8.75,17L31.695414,17Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M8.3045862,23L13.9904997,29.2545042L15.10041,28.2454953L11.6954139,24.5L31.25,24.5L31.25,23L8.3045862,23Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e");background-size:38px auto;border-color:#000}.slot-item-container.is-mobile .info{left:100%;margin-top:0;margin-left:4px}.slot-item-container.is-mobile .info .name-wrapper{margin-top:0;border-radius:0;background:#000;color:#fff}.slot-item-container.is-mobile .info>img{display:none}.slot-item-container .main{pointer-events:auto;cursor:pointer;font-size:12px;color:#fff;width:22px;height:22px;background:#fff0;border:2px solid #fff;border-radius:0;transition:background .2s,width .14s,height .14s,border .14s}.slot-item-container .main.disable{cursor:not-allowed}.slot-item-container .main.drag-over{border-color:red}.slot-item-container .main.can-install{position:relative;width:44px;height:44px;background:#0066ff1a;border-color:#06f}.slot-item-container .main.filled{border-color:#00ff95;border-radius:50%}.slot-item-container .main.selected{border-width:4px}.slot-item-container .main.selected+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .main.focus{border-color:#000}.slot-item-container .main.focus+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .main.has-error{border-color:red}.slot-item-container .main.hidden{display:none}.slot-item-container .main.hidden+.info{display:none}.slot-item-container .main:after{pointer-events:none;content:attr(data-name);transition:all .2s .3s;opacity:0;position:absolute;left:50%;bottom:100%;transform:translate3d(-50%,5px,0);white-space:nowrap;font-size:12px;color:#000;padding:2px 8px;border-radius:2px;background:#fff}.slot-item-container .main:hover{background:#ffffff80}.slot-item-container .main:hover+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .name{position:relative}.slot-item-container .name-wrapper{margin-top:-10px;white-space:nowrap;font-size:12px;color:#fff;padding:2px 8px;background:#000}.slot-item-container .functions-wrapper{z-index:20000;position:absolute;left:0;top:100%}.slot-item-container .functions-wrapper>.functions{display:inline-block;min-width:100px;padding:6px 0;border-left:1px solid #00ff95;border-radius:0 2px 2px 0;background:#0003;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.slot-item-container .functions-wrapper>.functions .btn-add{cursor:pointer;padding:2px 0;margin:0 8px;display:flex;justify-content:center;align-content:center;align-items:center;border:1px dashed #eee;font-size:12px;color:#eee;border-radius:2px;-webkit-backdrop-filter:none;backdrop-filter:none;background:#00050a80}.slot-item-container .functions-wrapper>.functions .btn-add.btn-not-allowed{cursor:not-allowed}.slot-item-container .functions-wrapper>.functions .function{display:flex;justify-content:space-between;white-space:nowrap;margin-bottom:6px;padding:0 8px;font-size:12px;color:#fff}.slot-item-container .functions-wrapper>.functions .function span{margin-right:4px}.slot-item-container .functions-wrapper>.functions .function .btn-remove{pointer-events:none;opacity:0;cursor:pointer;align-self:center;margin-right:0;height:14px;width:14px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAACnSURBVEiJxZaxFcMgDETPTuUtWCWTM4pZAq5RojRpnOfEyEKxSnh3HySeBEhNjZJJTRgUG89GyZWilbKOgJCaKmWtFG2UvFnwQr56jYAcengg3dozELPGIjh96x6hu26/DIa9vD0jq/nUA3nikQEkAOW9nACUGbf7skxlX2mIj1Ob0jK76QdxbYpGFNlk3rPnNndDQltFaLMLbdehAyd8ZP5l6Ed+W17xG7oN9QkytAAAAABJRU5ErkJggg==) center no-repeat;background-size:10px 10px}.slot-item-container .functions-wrapper>.functions .function:hover .btn-remove{pointer-events:auto;opacity:1;transform:scale(1.2)}.slot-item-container .device-name{position:relative;margin:2px 0;display:flex;min-width:120px;align-items:center;align-content:center;justify-content:space-between;white-space:nowrap;height:30px;padding:0 8px;font-size:14px;font-weight:700;color:#000;background:#fff}.slot-item-container .device-name .device-logo{margin-left:-8px;margin-right:4px;width:30px;height:30px;object-fit:contain}.slot-item-container .device-name span{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:250px}.slot-item-container .device-name .btn-close{margin-left:8px;cursor:pointer;height:20px;width:20px;background:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_504_017509'%3e%3crect%20x='0'%20y='0'%20width='20'%20height='20'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_504_017509)'%3e%3cg%3e%3cpath%20d='M4.375,16.875L4.375,4.375L15.625,4.375L15.625,16.875L4.375,16.875ZM14.375,5.625L5.625,5.625L5.625,15.625L14.375,15.625L14.375,5.625Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M8.125,12.1875L8.125,8.125L9.375,8.125L9.375,12.1875L8.125,12.1875Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M10.625,12.1875L10.625,8.125L11.875,8.125L11.875,12.1875L10.625,12.1875Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M16.875,5.625L3.125,5.625L3.125,4.375L16.875,4.375L16.875,5.625Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M6.4446528999999995,5.625L13.545177899999999,5.625L11.8665838,2.5L8.15767372,2.5L6.4446528999999995,5.625ZM11.4548223,4.3749999L8.5553472,4.3749999L8.8979512,3.75L11.1191032,3.75L11.4548223,4.3749999Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e") center no-repeat;background-size:100% auto}.slot-item-container .device-name.empty{color:#000c;font-weight:400}.slot-item-container .device-name.empty .btn-close{display:none}.slot-item-container .device-name.empty:before{height:0}.slot-item-container .all-functions{opacity:0;pointer-events:none;min-width:80px;position:absolute;left:-10px;margin-left:100%;bottom:0;padding:6px 0;background:#fff;transition:all .3s}.slot-item-container .all-functions.show{opacity:1;pointer-events:auto;left:16px}.slot-item-container .all-functions label{margin-left:8px;margin-bottom:20px;color:#444e69;font-size:14px}.slot-item-container .all-functions .btn-close{cursor:pointer;position:absolute;right:7px;top:7px;height:16px;width:16px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAB4SURBVDiNpZPLEYAgDAUXe6MuoK4UpwdBwQkQJDcyb9+QnxORCOC9jyxE4Y78DiWxAIcmISKnxaSrtZhMNSOB+ZeacAS7ngl3k1JOBSBpk1INPib0YHjH+Du2S1DhlSZOYbPJ1iLtrLKrG2a9yJopYzTD8Jx+ArgAylOzjm1WpDwAAAAASUVORK5CYII=) center no-repeat;background-size:10px 10px}.slot-item-container .all-functions .functions{display:inline-block;max-height:200px;overflow-x:hidden;overflow-y:auto}.slot-item-container .all-functions .functions::-webkit-scrollbar{width:4px}.slot-item-container .all-functions .functions::-webkit-scrollbar-track{background-color:#fff}.slot-item-container .all-functions .functions::-webkit-scrollbar-thumb{background:#787878;border-radius:25px}.slot-item-container .all-functions .function{display:flex;justify-content:space-between;white-space:nowrap;padding:5px 10px;font-size:12px;color:#787878}.slot-item-container .all-functions .function span{display:flex;align-content:center;align-items:center;margin-right:4px}.slot-item-container .all-functions .function:hover{background:#444e6933}.slot-item-container .all-functions .btn-add{cursor:pointer;width:16px;font-size:16px;text-align:center;font-style:normal}.slot-item-container .info{overflow:hidden;margin-left:-2px;margin-top:-19px;position:absolute;left:100%;top:50%;transform:translateY(-50%);width:0;display:flex;align-items:flex-start;transition:all .3s}.slot-item-container .info>img{flex:0 0 auto;width:53px;height:29px}`,bT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGsAAAA7CAYAAAB8MXT7AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGTSURBVHic7dxLbQNBEIThnigADGEhxAwcBoZgCIZgBoZgCIZgCIaQMIgZVC4daw/xXPLoqdX/3fbW0milUtfutMCdpCkiLhEx1U6CLkkvkt4k7atnQYekfR7US/Us6JB0yIOaqmfBA5JWks6SrhzUwCRN+TYdq2dBx+ygDtWzoEPSNg9qVz0LOmZBgsQ3sqUkvufqAf6SpFVEnCPiFhHr1tqteCR8hyBhYrY6OlTPgo5cHX1I2lbPgo6lBInFk3Rc+uroqXqAn8ogcc3H19bae+U8eIDEZ0LSJoMEZeHIWB2ZIPEZoCw0QVlogsRnYlYWsjoaGUHCRK6OOKiRfa2OMvWtqufBAwQJE5SFJmZl4aZ6FnSQ+Azk6mjxZeFv+/fycfbDWrTW1pSFgyLxmcjVEWXh6CgLTZD4DMzKwguro4ERJEywOjIhaUdZaIAgYYKy0ABloQkSnwlxKZUHcSmVBxKfgVwdnSgLB8d35iZIfCYoC01QFpog8Y3rftFWrotO+cilVKMiSJigLDSS30hQFhr4BEcKZN0LNhDxAAAAAElFTkSuQmCC";var wT=Object.defineProperty,AT=Object.getOwnPropertyDescriptor,ke=(r,e,t,i)=>{for(var s=i>1?void 0:i?AT(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&wT(e,t,s),s};let Ee=class extends qr{constructor(r){super(),this.props=r,this._size=12,this._showDialog=!1,this.selected=!1,this.focused=!1,this.toBeInstalled=!1,this.toBeReplaced=!1,this.hasError=!1,this.canInstall=!1,this.hide=!1,this.disable=!1,this.filled=!1,this.allFunctions=[],this.functions=[],this.deviceName="",this.deviceLogo="",this.removeDevice=()=>{this.props.onRemove&&this.props.onRemove()}}get hasMoreFunctions(){return this.allFunctions.length>this.functions.length}onClick(r){r.preventDefault(),r.stopPropagation()}setSize(r=12){this._size=r}addFunction(r){this.dispatchEvent(new CustomEvent("function-added",{detail:r}))}render(){var r;return Tt`
|
|
4890
|
+
*/function xT(r,e){return(t,i,s)=>{const n=o=>{var a;return((a=o.renderRoot)==null?void 0:a.querySelector(r))??null};if(e){const{get:o,set:a}=typeof i=="object"?t:s??(()=>{const h=Symbol();return{get(){return this[h]},set(u){this[h]=u}}})();return Od(t,i,{get(){let h=o.call(this);return h===void 0&&(h=n(this),(h!==null||this.hasUpdated)&&a.call(this,h)),h}})}return Od(t,i,{get(){return n(this)}})}}const bT=`*{box-sizing:border-box}.slot-item-container.is-mobile .main{pointer-events:none;border-width:1px;opacity:.8}.slot-item-container.is-mobile .main.focus{width:18px!important;height:18px!important;border-width:2px;opacity:1}.slot-item-container.is-mobile .main.filled{opacity:1;border-width:1px;width:14px!important;height:14px!important;background-image:none;border-radius:50%}.slot-item-container.is-mobile .main.to-be-installed{opacity:1;pointer-events:auto;width:38px!important;height:38px!important;border-color:#000;border-width:1px;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3e%3cg%3e%3cg%3e%3cpath%20d='M20,10.75L0,10.75L0,9.25L20,9.25L20,10.75Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3cg%20transform='matrix(0,1,1,0,10,-10)'%3e%3cpath%20d='M30,0.75L10,0.75L10,-0.75L30,-0.75L30,0.75Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e");background-size:20px auto;background-repeat:no-repeat;background-position:center;background-color:#fff9}.slot-item-container.is-mobile .main.to-be-installed+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container.is-mobile .main.to-be-installed.filled{opacity:1;border-width:2px;width:18px!important;height:18px!important;background-image:none;border-radius:50%;border-color:#00ff95}.slot-item-container.is-mobile .main.to-be-installed.to-be-replaced{opacity:1;border-width:1px;pointer-events:auto;width:38px!important;height:38px!important;border-radius:50%;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_504_014299'%3e%3crect%20x='0'%20y='0'%20width='40'%20height='40'%20rx='20'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_504_014299)'%3e%3cg%3e%3cg%3e%3cpath%20d='M31.695414,17L26.009501,10.74549544L24.899591,11.75450456L28.304586,15.5L8.75,15.5L8.75,17L31.695414,17Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M8.3045862,23L13.9904997,29.2545042L15.10041,28.2454953L11.6954139,24.5L31.25,24.5L31.25,23L8.3045862,23Z'%20fill-rule='evenodd'%20fill='%23000000'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e");background-size:38px auto;border-color:#000}.slot-item-container.is-mobile .info{left:100%;margin-top:0;margin-left:4px}.slot-item-container.is-mobile .info .name-wrapper{margin-top:0;border-radius:0;background:#000;color:#fff}.slot-item-container.is-mobile .info>img{display:none}.slot-item-container .main{pointer-events:auto;cursor:pointer;font-size:12px;color:#fff;width:22px;height:22px;background:#fff0;border:2px solid #fff;border-radius:0;transition:background .2s,width .14s,height .14s,border .14s}.slot-item-container .main.disable{cursor:not-allowed}.slot-item-container .main.drag-over{border-color:red}.slot-item-container .main.can-install{position:relative;width:44px;height:44px;background:#0066ff1a;border-color:#06f}.slot-item-container .main.filled{border-color:#00ff95;border-radius:50%}.slot-item-container .main.selected{border-width:4px}.slot-item-container .main.selected+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .main.focus{border-color:#000}.slot-item-container .main.focus+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .main.has-error{border-color:red}.slot-item-container .main.hidden{display:none}.slot-item-container .main.hidden+.info{display:none}.slot-item-container .main:after{pointer-events:none;content:attr(data-name);transition:all .2s .3s;opacity:0;position:absolute;left:50%;bottom:100%;transform:translate3d(-50%,5px,0);white-space:nowrap;font-size:12px;color:#000;padding:2px 8px;border-radius:2px;background:#fff}.slot-item-container .main:hover{background:#ffffff80}.slot-item-container .main:hover+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .name{position:relative}.slot-item-container .name-wrapper{margin-top:-10px;white-space:nowrap;font-size:12px;color:#fff;padding:2px 8px;background:#000}.slot-item-container .functions-wrapper{z-index:20000;position:absolute;left:0;top:100%}.slot-item-container .functions-wrapper>.functions{display:inline-block;min-width:100px;padding:6px 0;border-left:1px solid #00ff95;border-radius:0 2px 2px 0;background:#0003;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.slot-item-container .functions-wrapper>.functions .btn-add{cursor:pointer;padding:2px 0;margin:0 8px;display:flex;justify-content:center;align-content:center;align-items:center;border:1px dashed #eee;font-size:12px;color:#eee;border-radius:2px;-webkit-backdrop-filter:none;backdrop-filter:none;background:#00050a80}.slot-item-container .functions-wrapper>.functions .btn-add.btn-not-allowed{cursor:not-allowed}.slot-item-container .functions-wrapper>.functions .function{display:flex;justify-content:space-between;white-space:nowrap;margin-bottom:6px;padding:0 8px;font-size:12px;color:#fff}.slot-item-container .functions-wrapper>.functions .function span{margin-right:4px}.slot-item-container .functions-wrapper>.functions .function .btn-remove{pointer-events:none;opacity:0;cursor:pointer;align-self:center;margin-right:0;height:14px;width:14px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAACnSURBVEiJxZaxFcMgDETPTuUtWCWTM4pZAq5RojRpnOfEyEKxSnh3HySeBEhNjZJJTRgUG89GyZWilbKOgJCaKmWtFG2UvFnwQr56jYAcengg3dozELPGIjh96x6hu26/DIa9vD0jq/nUA3nikQEkAOW9nACUGbf7skxlX2mIj1Ob0jK76QdxbYpGFNlk3rPnNndDQltFaLMLbdehAyd8ZP5l6Ed+W17xG7oN9QkytAAAAABJRU5ErkJggg==) center no-repeat;background-size:10px 10px}.slot-item-container .functions-wrapper>.functions .function:hover .btn-remove{pointer-events:auto;opacity:1;transform:scale(1.2)}.slot-item-container .device-name{position:relative;margin:2px 0;display:flex;min-width:120px;align-items:center;align-content:center;justify-content:space-between;white-space:nowrap;height:30px;padding:0 8px;font-size:14px;font-weight:700;color:#000;background:#fff}.slot-item-container .device-name .device-logo{margin-left:-8px;margin-right:4px;width:30px;height:30px;object-fit:contain}.slot-item-container .device-name span{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:250px}.slot-item-container .device-name .btn-close{margin-left:8px;cursor:pointer;height:20px;width:20px;background:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_504_017509'%3e%3crect%20x='0'%20y='0'%20width='20'%20height='20'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_504_017509)'%3e%3cg%3e%3cpath%20d='M4.375,16.875L4.375,4.375L15.625,4.375L15.625,16.875L4.375,16.875ZM14.375,5.625L5.625,5.625L5.625,15.625L14.375,15.625L14.375,5.625Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M8.125,12.1875L8.125,8.125L9.375,8.125L9.375,12.1875L8.125,12.1875Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M10.625,12.1875L10.625,8.125L11.875,8.125L11.875,12.1875L10.625,12.1875Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M16.875,5.625L3.125,5.625L3.125,4.375L16.875,4.375L16.875,5.625Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M6.4446528999999995,5.625L13.545177899999999,5.625L11.8665838,2.5L8.15767372,2.5L6.4446528999999995,5.625ZM11.4548223,4.3749999L8.5553472,4.3749999L8.8979512,3.75L11.1191032,3.75L11.4548223,4.3749999Z'%20fill-rule='evenodd'%20fill='%23999999'%20fill-opacity='1'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e") center no-repeat;background-size:100% auto}.slot-item-container .device-name.empty{color:#000c;font-weight:400}.slot-item-container .device-name.empty .btn-close{display:none}.slot-item-container .device-name.empty:before{height:0}.slot-item-container .all-functions{opacity:0;pointer-events:none;min-width:80px;position:absolute;left:-10px;margin-left:100%;bottom:0;padding:6px 0;background:#fff;transition:all .3s}.slot-item-container .all-functions.show{opacity:1;pointer-events:auto;left:16px}.slot-item-container .all-functions label{margin-left:8px;margin-bottom:20px;color:#444e69;font-size:14px}.slot-item-container .all-functions .btn-close{cursor:pointer;position:absolute;right:7px;top:7px;height:16px;width:16px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAB4SURBVDiNpZPLEYAgDAUXe6MuoK4UpwdBwQkQJDcyb9+QnxORCOC9jyxE4Y78DiWxAIcmISKnxaSrtZhMNSOB+ZeacAS7ngl3k1JOBSBpk1INPib0YHjH+Du2S1DhlSZOYbPJ1iLtrLKrG2a9yJopYzTD8Jx+ArgAylOzjm1WpDwAAAAASUVORK5CYII=) center no-repeat;background-size:10px 10px}.slot-item-container .all-functions .functions{display:inline-block;max-height:200px;overflow-x:hidden;overflow-y:auto}.slot-item-container .all-functions .functions::-webkit-scrollbar{width:4px}.slot-item-container .all-functions .functions::-webkit-scrollbar-track{background-color:#fff}.slot-item-container .all-functions .functions::-webkit-scrollbar-thumb{background:#787878;border-radius:25px}.slot-item-container .all-functions .function{display:flex;justify-content:space-between;white-space:nowrap;padding:5px 10px;font-size:12px;color:#787878}.slot-item-container .all-functions .function span{display:flex;align-content:center;align-items:center;margin-right:4px}.slot-item-container .all-functions .function:hover{background:#444e6933}.slot-item-container .all-functions .btn-add{cursor:pointer;width:16px;font-size:16px;text-align:center;font-style:normal}.slot-item-container .info{overflow:hidden;margin-left:-2px;margin-top:-19px;position:absolute;left:100%;top:50%;transform:translateY(-50%);width:0;display:flex;align-items:flex-start;transition:all .3s}.slot-item-container .info>img{flex:0 0 auto;width:53px;height:29px}`,wT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGsAAAA7CAYAAAB8MXT7AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGTSURBVHic7dxLbQNBEIThnigADGEhxAwcBoZgCIZgBoZgCIZgCIaQMIgZVC4daw/xXPLoqdX/3fbW0milUtfutMCdpCkiLhEx1U6CLkkvkt4k7atnQYekfR7US/Us6JB0yIOaqmfBA5JWks6SrhzUwCRN+TYdq2dBx+ygDtWzoEPSNg9qVz0LOmZBgsQ3sqUkvufqAf6SpFVEnCPiFhHr1tqteCR8hyBhYrY6OlTPgo5cHX1I2lbPgo6lBInFk3Rc+uroqXqAn8ogcc3H19bae+U8eIDEZ0LSJoMEZeHIWB2ZIPEZoCw0QVlogsRnYlYWsjoaGUHCRK6OOKiRfa2OMvWtqufBAwQJE5SFJmZl4aZ6FnSQ+Azk6mjxZeFv+/fycfbDWrTW1pSFgyLxmcjVEWXh6CgLTZD4DMzKwguro4ERJEywOjIhaUdZaIAgYYKy0ABloQkSnwlxKZUHcSmVBxKfgVwdnSgLB8d35iZIfCYoC01QFpog8Y3rftFWrotO+cilVKMiSJigLDSS30hQFhr4BEcKZN0LNhDxAAAAAElFTkSuQmCC";var AT=Object.defineProperty,TT=Object.getOwnPropertyDescriptor,ke=(r,e,t,i)=>{for(var s=i>1?void 0:i?TT(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&AT(e,t,s),s};let Ee=class extends qr{constructor(r){super(),this.props=r,this._size=12,this._showDialog=!1,this.selected=!1,this.focused=!1,this.toBeInstalled=!1,this.toBeReplaced=!1,this.hasError=!1,this.canInstall=!1,this.hide=!1,this.disable=!1,this.filled=!1,this.allFunctions=[],this.functions=[],this.deviceName="",this.deviceLogo="",this.removeDevice=()=>{this.props.onRemove&&this.props.onRemove()}}get hasMoreFunctions(){return this.allFunctions.length>this.functions.length}onClick(r){r.preventDefault(),r.stopPropagation()}setSize(r=12){this._size=r}addFunction(r){this.dispatchEvent(new CustomEvent("function-added",{detail:r}))}render(){var r;return Tt`
|
|
4891
4891
|
<div class="slot-item-container ${this.props.isMobile&&"is-mobile"}">
|
|
4892
4892
|
<div class="main
|
|
4893
4893
|
${this.selected?"selected":""}
|
|
@@ -4903,7 +4903,7 @@ void main(void)\r
|
|
|
4903
4903
|
style="${`width: ${this._size+"px"}; height:${this._size+"px"}`}"
|
|
4904
4904
|
></div>
|
|
4905
4905
|
<div class="info" @click="${this.onClick}">
|
|
4906
|
-
<img alt="" src="${
|
|
4906
|
+
<img alt="" src="${wT}">
|
|
4907
4907
|
<div class="name">
|
|
4908
4908
|
<div class="name-wrapper">${(r=this.slot)==null?void 0:r.name}</div>
|
|
4909
4909
|
<div class="functions-wrapper">
|
|
@@ -4943,7 +4943,7 @@ void main(void)\r
|
|
|
4943
4943
|
</div>
|
|
4944
4944
|
</div>
|
|
4945
4945
|
</div>
|
|
4946
|
-
`}};Ee.styles=
|
|
4946
|
+
`}};Ee.styles=mm([bT]);ke([nc()],Ee.prototype,"_size",2);ke([nc()],Ee.prototype,"_showDialog",2);ke([He({type:Boolean})],Ee.prototype,"selected",2);ke([He({type:Boolean})],Ee.prototype,"focused",2);ke([He({type:Boolean})],Ee.prototype,"toBeInstalled",2);ke([He({type:Boolean})],Ee.prototype,"toBeReplaced",2);ke([He({type:Boolean})],Ee.prototype,"hasError",2);ke([He({type:Boolean})],Ee.prototype,"canInstall",2);ke([He({type:Boolean})],Ee.prototype,"hide",2);ke([He({type:Boolean})],Ee.prototype,"disable",2);ke([He({type:Boolean})],Ee.prototype,"filled",2);ke([He({type:Object})],Ee.prototype,"allFunctions",2);ke([He({type:Object})],Ee.prototype,"functions",2);ke([He({type:String})],Ee.prototype,"deviceName",2);ke([He({type:String})],Ee.prototype,"deviceLogo",2);ke([He()],Ee.prototype,"slot",2);Ee=ke([wm("slot-item")],Ee);const Le={ON_DROP:"slot-on-drop",ON_DEVICE_DELETED:"slot-on-device-deleted",ON_DEVICE_REPLACED:"slot-on-device-replaced",ON_BEFORE_SELECTED:"slot-on-before-selected",ON_SELECTED:"slot-on-selected",ON_ADD_BUTTON_CLICKED:"slot-add-button-clicked",ON_DEVICE_SELECTED:"slot-on-device-selected",ON_DROP_ERROR:"slot-on-drop-error",ON_ERROR_STATE_CHANGE:"slot-on-error-state-change",ON_FUNCTION_REMOVED:"slot-on-function-removed",ON_FUNCTION_ADDED:"slot-on-function-added"};class _h extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this.props=e,this._emitter=new as,this._slotContainer=new y.Group,this._bracketSlots=[],this._hasError=!1,this.useBracket=!1,this.addEventListener=this._emitter.addListener.bind(this._emitter),this.removeEventListener=this._emitter.removeListener.bind(this._emitter),this._canInstall=!1,this._loading=!1,this._selected=!1,this._deviceSelected=!1,this._focused=!1,this._toBeInstalled=!1,this._toBeReplaced=!1,this._allFunctions=new Set,this._functions=new Set,this._timer=0,this._parentPos=new y.Vector3,this._wrapper=new y.Group,this._showSlot=!0,this._isMirror=!1,this._preventDefaults=i=>{i.preventDefault(),i.stopPropagation()},this.getWP=this._slotContainer.getWorldPosition.bind(this._slotContainer),this._showSlot=typeof e.show=="boolean"?e.show:!0,this.name=e.name,this._isMirror=e.isMirror,this._slotUI=new Ee({name:e.name,isMobile:e.isMobile,onRemove:()=>{this.clearSlot(),this._emitter.emit(Le.ON_DEVICE_DELETED)}}),this._slotUI.slot=this,this._slotUI.hide=!this._showSlot||this.isMirror,t.append(this._slotUI),this._parentPos.copy(this.props.slot.position),this._slotUI.addEventListener("function-removed",({detail:i})=>{this.removeFunction(i)}),this._slotUI.addEventListener("function-added",({detail:i})=>{this.addFunction(i)}),this.add(this._slotContainer),this.props.slot.add(this),setTimeout(()=>{var i;(i=this.props.slot.parent)==null||i.add(this._wrapper),this._wrapper.add(this.props.slot)},10),["dragenter","dragover","dragleave","drop"].forEach(i=>{t.addEventListener(i,this._preventDefaults,!1)}),t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.toBeInstalled?this._emitter.emit(Le.ON_ADD_BUTTON_CLICKED):this.selected=!this.selected}),t.addEventListener("dragover",i=>{if(i.preventDefault(),i.dataTransfer.dropEffect="copy",!this._canInstall){i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}}),t.addEventListener("drop",async i=>{var n;if(i.preventDefault(),i.stopPropagation(),!this._canInstall)return;const s=(n=i.dataTransfer)==null?void 0:n.getData("application/json");if(s){const o=JSON.parse(s);try{await this.install(o),this._emitter.emit(Le.ON_DROP,this)}catch(a){this._emitter.emit(Le.ON_DROP_ERROR,a)}}else this._emitter.emit(Le.ON_DROP_ERROR,new Error("No device info"))})}get hasDevice(){return this._slotContainer.children.length>0}get isMirror(){return this._isMirror}shapeKeyChanged(e,t){var i;if(this.props.follows.has(e)){const s=this.props.follows.get(e);if(s){let n="x";["height","mast"].includes(e)?n="y":["width","liftOuterWidth"].includes(e)&&(n="z");const o=((i=this.props.slot)==null?void 0:i.position[n])>0?1:-1;this._wrapper.position[n]=(t-s.origin)*s.scale*o}}}async loadGlb(e){const i=await new No({useCache:!0}).loadAsync(e);if(i.glb)return i.glb.clone(!0)}async installBracket(e){const i=await new No({useCache:!0}).loadAsync(e);if(!i.glb)return;const s=i.glb.clone(!0);s.traverse(n=>{n.userData.isBracket=!0}),this.useBracket=!0,this._slotContainer.add(s)}async install(e){if(!this._loading){this._loading=!0;try{const t=await this.loadGlb(e.url);if(!t)throw new Error(`Fail to load device from: ${e.url}`);if(t.traverse(i=>{i.userData.isDevice=!0}),this.isMirror&&t.scale.set(1,1,-1),e.bracketUrl){const i=await this.loadGlb(e.bracketUrl);if(i)this.clearSlot(),this._emitter.emit(Le.ON_DEVICE_REPLACED),i.traverse(s=>{s.name.startsWith("Slot")&&this._bracketSlots.push(s),s.userData.isBracket=!0}),this._slotContainer.add(i);else throw new Error(`Fail to load bracket from: ${e.bracketUrl}`);this._bracketSlots.forEach(s=>{s.add(t)})}else this.clearSlot(),this._emitter.emit(Le.ON_DEVICE_REPLACED),this._slotContainer.add(t);this.mirrorTarget&&this.mirrorTarget.install(e),this.deviceInfo=e,this._slotUI.deviceLogo=e.logo||"",this._slotUI.deviceName=e.name,this._slotUI.filled=!0,this.holeTarget&&(this.holeTarget.visible=!1)}catch(t){throw t}finally{this._loading=!1}}}get device(){return this._slotContainer.children.length?this._slotContainer.children[0]:null}get allFunctions(){return[...this._allFunctions]}set allFunctions(e){this._functions.forEach(t=>{e.includes(t)||this._functions.delete(t)}),this._allFunctions=new Set(e),this._slotUI.allFunctions=e}get functions(){return[...this._functions]}addFunction(e){this._allFunctions.has(e)&&(this._functions.add(e),this._slotUI.functions=[...this.functions],this._emitter.emit(Le.ON_FUNCTION_ADDED,e))}removeFunction(e){this._functions.has(e)&&(this._functions.delete(e),this._slotUI.functions=[...this.functions],this._emitter.emit(Le.ON_FUNCTION_REMOVED,e))}clearFunctions(){this._functions.forEach(e=>this.removeFunction(e))}addFunctions(e){e.forEach(t=>this.addFunction(t)),this._slotUI.functions=this.functions}changeName(e){var t;this.name=e,this.props.slot.userData.name=e,this.props.name=e,(t=this.element)==null||t.setAttribute("data-name",this.props.name)}clearSlot(){this._bracketSlots=[],this._slotContainer.children.forEach(e=>{e.removeFromParent(),ii(e)}),this._slotUI.filled=!1,this.deviceInfo=void 0,this._slotUI.deviceName="",this._slotUI.deviceLogo="",this.holeTarget&&(this.holeTarget.visible=!0),this.mirrorTarget&&this.mirrorTarget.clearSlot()}enable(){this._slotUI.disable=!1}disable(){this._slotUI.disable=!0}hide(){this._slotUI.hide=!0}show(){this.isMirror||(this._slotUI.hide=!1)}get selected(){return this._selected}get focused(){return this._focused}set focused(e){this._focused=e,this._slotUI.focused=e}get toBeInstalled(){return this._toBeInstalled}set toBeInstalled(e){this._toBeInstalled=e,this._slotUI.toBeInstalled=e}get toBeReplaced(){return this._toBeReplaced}set toBeReplaced(e){this._toBeReplaced=e,this._slotUI.toBeReplaced=e}set selected(e){e&&this._emitter.emit(Le.ON_BEFORE_SELECTED,e),this._selected=e,this._slotUI.selected=e,this._emitter.emit(Le.ON_SELECTED,e),this.element.style.zIndex="100",this.selected?this.renderOrder=1/0:this.renderOrder=1}get deviceSelected(){return this._deviceSelected}set deviceSelected(e){this._deviceSelected=e,this._emitter.emit(Le.ON_DEVICE_SELECTED,e)}get error(){return this._hasError}set error(e){this._loading&&setTimeout(()=>{this.error=e},100),this._hasError=e,this._slotUI.hasError=e,this._emitter.emit(Le.ON_ERROR_STATE_CHANGE,e)}getCanInstall(){return this._canInstall}canInstall(e){this._canInstall=e,this._slotUI.canInstall=e}dispose(){cancelAnimationFrame(this._timer),["dragenter","dragover","dragleave","drop"].forEach(e=>{this.element.addEventListener(e,this._preventDefaults,!1)}),this.clearSlot(),this._emitter.removeAllListeners(),ii(this._slotContainer),this.element.remove()}render(e){const t=this.element.style.transform,i=/translate\(-?\d*\.?\d*%?,?\s-?\d*\.?\d*%?\)\s*translate\((-?\d*\.?\d*)px,\s*(-?\d*\.?\d*)px\)/.exec(t);if(!i)return;const s=new y.Vector2(parseFloat(i[1]),parseFloat(i[2])),n=e.mousePos.distanceTo(s);let o=this.props.isMobile?12:18,a=38,h=30;if(this._canInstall&&(o=34,a=60,h=60),n<h){let u=(h-n)*1+o;n<20&&(u=a),u>a&&(u=a),this._slotUI.setSize(u)}else this._slotUI.setSize(o)}clone(e){return new y.Group}}var ST=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,oc=(r,e,t,i)=>{for(var s=i>1?void 0:i?ET(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&ST(e,t,s),s};class CT{constructor(e,t,i,s){this.name=e,this.slot=t,this.start=i,this.end=s,this.split="--",this.uuid="",this.valid=!1,this.editable=!1,this.highlight=!1,this.uuid=e+this.split+t}update(e,t){this.start=e.clone(),this.end=t.clone()}}exports.DeviceLines=class extends qr{constructor(e,t=0){super(),this.offset=e,this.heightOffset=t,this.lines=new Map,this.setOffset(this.offset.x,this.offset.y)}setOffset(e,t){this.offset.set(e,t),this.style.setProperty("--left",this.offset.x+"px"),this.style.setProperty("--top",this.offset.y+"px")}setHeightOffset(e){this.heightOffset=e,this.style.setProperty("--heightOffset",this.heightOffset+"px")}hide(){var e;(e=this.container)==null||e.classList.add("hidden")}show(){var e;(e=this.container)==null||e.classList.remove("hidden")}addLine(e){this.lines.has(e.uuid)||this.lines.set(e.uuid,e)}clear(){this.lines.clear()}removeLine(e){this.lines.delete(e.uuid)}getLineByName(e){const t=[];return this.lines.forEach((i,s)=>{i.name===e&&t.push(i)}),t}getLineBySlot(e){const t=[];return this.lines.forEach((i,s)=>{i.slot===e&&t.push(i)}),t}getPath(e){const t=e.end.clone();t.set(t.x-this.offset.x,t.y-this.offset.y);const i=e.start.clone().add(t).multiplyScalar(.5),s=e.start.clone().add(t).multiplyScalar(.7);return`M${e.start.x} ${e.start.y}
|
|
4947
4947
|
C${i.x} ${e.start.y}
|
|
4948
4948
|
${s.x} ${e.end.y}
|
|
4949
4949
|
${t.x} ${t.y}
|
|
@@ -4954,7 +4954,7 @@ void main(void)\r
|
|
|
4954
4954
|
class="${e.valid?"valid":""} ${e.editable?"editable":""} ${e.highlight?"highlight":""}"
|
|
4955
4955
|
d="${this.getPath(e)}"></path>`)}
|
|
4956
4956
|
</g>
|
|
4957
|
-
</svg>`}};exports.DeviceLines.styles=
|
|
4957
|
+
</svg>`}};exports.DeviceLines.styles=mm`
|
|
4958
4958
|
:host {
|
|
4959
4959
|
--left: 0px;
|
|
4960
4960
|
--top: 0px;
|
|
@@ -5005,7 +5005,7 @@ d="${this.getPath(e)}"></path>`)}
|
|
|
5005
5005
|
}
|
|
5006
5006
|
}
|
|
5007
5007
|
}
|
|
5008
|
-
`;oc([nc()],exports.DeviceLines.prototype,"lines",2);oc([vT(".container")],exports.DeviceLines.prototype,"container",2);exports.DeviceLines=oc([bm("device-lines")],exports.DeviceLines);class CT extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this._text=document.createElement("div");const i=tc(),s=i?"#ddd":"#eee";this.element.style.pointerEvents="auto",this.element.style.padding=i?"2px 6px":"3px 12px",this.element.style.borderTop=`1px solid ${s}`,this.element.style.borderBottom=this.element.style.borderTop;const n="6px",o=document.createElement("div");o.style.pointerEvents="none",Object.assign(o.style,{pointerEvents:"none",borderLeft:`1px solid ${s}`,borderRight:`1px solid ${s}`,position:"absolute",left:"0",top:"0",boxSizing:"border-box",height:n,width:"100%"}),this.element.append(o);const a=document.createElement("div");a.style.pointerEvents="none",Object.assign(a.style,{pointerEvents:"none",borderLeft:`1px solid ${s}`,borderRight:`1px solid ${s}`,position:"absolute",left:"0",bottom:"0",boxSizing:"border-box",height:n,width:"100%"}),this.element.append(a),this._text.style.fontSize=i?"10px":"14px",this._text.style.font="SF Pro SC,SF Pro Text,SF Pro Icons,PingFang SC,Helvetica Neue,Helvetica,Arial,sans-serif",this._text.style.color="#fff",this._text.style.fontWeight="500",this._text.style.transition="all .16s",this._text.innerText=e,this.element.append(this._text),this._text.addEventListener("pointermove",()=>{var h;o.style.borderColor=a.style.borderColor=this.element.style.borderColor="#666",this._text.style.color="#000",(h=this.onPointMove)==null||h.call(this)}),this._text.addEventListener("pointerleave",()=>{var h;o.style.borderColor=a.style.borderColor=this.element.style.borderColor=s,this._text.style.transform="scale(1)",this._text.style.color="#fff",(h=this.onPointLeave)==null||h.call(this)})}set text(e){this._text.innerText=e}dispose(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class fo extends y.Group{constructor(e,t=!0,i=!0){super(),this._startWith=e,this._showText=t,this.useStartEnd=i,this._line2Length=.01,this._line=new y.LineSegments(new y.BufferGeometry,new y.LineBasicMaterial({color:"#666",linewidth:2})),this._line2=new y.LineSegments(new y.BufferGeometry,new y.LineBasicMaterial({color:"#666",linewidth:2})),this._text=new CT(""),this._line.frustumCulled=!1,this.add(this._line,this._line2),this._showText&&(this.add(this._text),this._text.onPointMove=()=>{this._line.material.color.set("#000"),this._line2.material.color.set("#000")},this._text.onPointLeave=()=>{this._line.material.color.set("#666"),this._line2.material.color.set("#666")})}updateMaterial(e){this._line.material=e}reset(){var e;(e=this._line.geometry)==null||e.dispose(),this._line.computeLineDistances()}update(e,t,i=0){var f,p;(f=this._line.geometry)==null||f.dispose(),this._line.geometry.setFromPoints([e,t]),this._line.computeLineDistances();const s=this._line2Length+i*.02,n=new y.Vector3().subVectors(t,e).normalize();let o;Math.abs(n.z)>Math.abs(n.x)&&Math.abs(n.z)>Math.abs(n.y)?o=new y.Vector3(-n.y,n.x,0):Math.abs(n.y)>Math.abs(n.x)?o=new y.Vector3(1,0,0):o=new y.Vector3(0,1,0),o.length()<.001&&(Math.abs(n.x)<.9?o=new y.Vector3(1,0,0):o=new y.Vector3(0,1,0)),o.normalize();const a=new y.Vector3().addVectors(e,o.clone().multiplyScalar(s)),h=new y.Vector3().addVectors(e,o.clone().multiplyScalar(-s)),u=new y.Vector3().addVectors(t,o.clone().multiplyScalar(s)),d=new y.Vector3().addVectors(t,o.clone().multiplyScalar(-s));(p=this._line2.geometry)==null||p.dispose(),this._line2.geometry=new y.BufferGeometry,this._line2.geometry.setFromPoints([a,h,u,d]),this._line2.computeLineDistances();const l=e.distanceTo(t);this._startWith?this._text.text=`${this._startWith}${(l*1e3).toFixed(0)} mm`:this._text.text=`${(l*1e3).toFixed(0)} mm`;const c=new y.Vector3;c.addVectors(e,t).multiplyScalar(.5),this._text.position.copy(c),this.useStartEnd||(this._line2.visible=!1)}destroy(){this._text.dispose(),this.children.forEach(e=>ii(e)),this.removeFromParent()}}class wm extends y.Object3D{constructor(e,t){super(),this.radius=e,this._text=new MT(""),this._line=new fo(void 0,!1,!1),this._box=new y.Mesh,this._arc=new ng.Line2,this._previousPosition=null,this._updateTimer=null,this._updateDelay=300,this._accumulatedAngle=0,this._lastAngle=null,this._line.updateMaterial(new y.LineDashedMaterial({color:"#555",dashSize:.06,gapSize:.06})),this._line.renderOrder=0,this._box.geometry=new y.RingGeometry(e,e+.003,128),this._box.material=new y.MeshBasicMaterial({color:"#666",side:y.DoubleSide}),this._arc.geometry=new pc.LineGeometry,this._arc.geometry.setPositions([0,0,0,0,0,0]),this._arc.geometry.instanceCount=0,this._arc.material=new tf.LineMaterial({color:"#eee",linewidth:2,resolution:new y.Vector2(window.innerWidth,window.innerHeight)}),this._arc.visible=!1,this._arc.rotateX(-Math.PI/2),this.position.y=t,this._arc.position.y=.001,this.add(this._box),this.add(this._arc),this.add(this._line),this.add(this._text)}hide(){this._text.hide(),this._line.visible=!1,this._arc.visible=!1}show(){this._text.show(),this._line.visible=!0}dispose(){this._updateTimer&&(clearTimeout(this._updateTimer),this._updateTimer=null),this._box.geometry&&this._box.geometry.dispose(),this._arc.geometry&&this._arc.geometry.dispose(),this._arc.visible=!1,this._previousPosition=null}update(e){var t;this.radius=e,(t=this._box.geometry)==null||t.dispose(),this._box.geometry=new y.RingGeometry(e,e+.003,128),this._line.updateMaterial(new y.LineDashedMaterial({color:"#555",dashSize:.06*e,gapSize:.06*e})),this._text.update((e*1e3).toFixed(0))}change(e){const t=e.clone();t.setZ(0),t.normalize().multiplyScalar(this.radius),this._text.position.set(t.x,t.y,t.z),this._text.updateColor("#eee"),this._line.update(t,new y.Vector3),this._previousPosition&&this._updateArc(this._previousPosition,t),this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._previousPosition=null,this._accumulatedAngle=0,this._lastAngle=null,this._clearArc(),this._updateTimer=null},this._updateDelay),this._previousPosition||(this._previousPosition=t.clone(),this._lastAngle=Math.atan2(t.y,t.x),this._accumulatedAngle=0)}_updateArc(e,t){const i=Math.atan2(t.y,t.x);if(this._lastAngle!==null){let h=i-this._lastAngle;h>Math.PI?h-=2*Math.PI:h<-Math.PI&&(h+=2*Math.PI),this._accumulatedAngle+=h}if(this._lastAngle=i,Math.abs(this._accumulatedAngle)<.01){this._arc.visible=!1;return}const s=Math.atan2(e.y,e.x),n=s+this._accumulatedAngle;let o=.006*this.radius;o<.003&&(o=.003),o>.006&&(o=.006);const a=this._createArcGeometry(s,n,this.radius+o);this._arc.geometry&&this._arc.geometry.dispose(),this._arc.geometry=a,this._arc.visible=!0}_clearArc(){this._text.updateColor(),this._arc.geometry&&(this._arc.geometry.setPositions([0,0,0,0,0,0]),this._arc.geometry.instanceCount=0,this._arc.computeLineDistances()),this._arc.visible=!1}_createArcGeometry(e,t,i){const s=[],n=t-e,o=Math.max(128,Math.floor(Math.abs(n)/(Math.PI/128))),a=n/o;for(let u=0;u<=o;u++){const d=e+u*a,l=Math.cos(d),c=Math.sin(d);s.push(i*l,0,i*c)}const h=new pc.LineGeometry;return h.setPositions(s),h.instanceCount=Math.max(0,s.length/3-1),h}}class MT extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this._wrapper=document.createElement("div"),this._circle=document.createElement("div");const i=tc();this._wrapper.style.fontSize=i?"10px":"11px",this._wrapper.style.color="#fff",this._wrapper.style.whiteSpace="nowrap",this._wrapper.style.position="absolute",this._wrapper.style.transform="translateX(-50%)",this._wrapper.style.top="6px",this._wrapper.style.font="SF Pro SC,SF Pro Text,SF Pro Icons,PingFang SC,Helvetica Neue,Helvetica,Arial,sans-serif";const s=this._circle;s.style.position="relative",s.style.zIndex="10",s.style.width=s.style.height="5px",s.style.borderRadius="50%",s.style.background="#666",t.append(this._wrapper,s),this.update(e)}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}update(e){this._wrapper.innerText="旋转半径:"+e+" mm",this.updateColor("#eee")}updateColor(e="#666"){this._circle.style.background=e}}const IT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAUCAYAAADY6P5TAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEvSURBVFiFzZdbFYMwEEQroRKQgAQkVEIlICEOkFAJlRAJSIgEJNx+sPS0nGxIaOhyv3nM7mTmwOViDHAFesADD+BqrakKQAcMwMQ3AWis9e1C3HLASJoAdNZ6sxG3/MZQMZy1dhWgFbfWRzDGlFjAwFlyyXdh5OD5OIqykBgBy1yiF0aMUQaJugLclOcEoP3nULmFgQgeyCwOoJGBYrijByspDM98ZIszJAt8Ks8dag/VUFYYLtetjHdruRz5JZf8WBg1Ae7KcgOluaSsMAKJwqgJ6Vz2WzcvhZHjVlFh1ESG1DQ67SYtyGs8OwujNpTkUtw4nVtbyLK1XDafF3aKW90Z3EpBbi5lE0u9n3qoNTKk9rHh3heZqqwA8Vw6a11VkVwuPK31HALzb5pfovYC2xSs5LCDIUcAAAAASUVORK5CYII=",PT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAKCAYAAACngj4SAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAChSURBVDiNrdJbFYMwEIRhJFQCEpCAhEqIhDhBAlKQgAQkIOHrSziHpmkbLvua7P4zO9s0FYUeM0b0NT2nC9FnLQho7wQ9MOwgQ3K4ZPDrrtGmFcKKkL0HTAXXw2HX6HYuFnR/hMWC6ykX+W1AzJqq1abDGguux6LoPK9aUGFOm1Y+F+Bh+7DlsSKehRXgnfdDm5od7GdeN8ADnpuKQ3ldqReHZFd3742nZgAAAABJRU5ErkJggg==",kd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAdzSURBVHic7Z3hlZs6EIUvW4E7CB3EHcQdxB08OngugVTg8yrwSQVOKnBSwW4qsFOB3cF9PxhZQsYYjEAS1neOD7ssCwPXMxoNIGWIDJJLAAsASwCfAOTyey6bLOQDABf5qJ9P8vkry48sy05j2+ySzLcBjyC5QiXOV1kuWv+hPxcAvwD8BvCBSsRL6394JDjBSC4ArFEJtG7Y5ILqwp4A/JHlxfyoC04yN/4vh/bEz9Dim9uY+/8O4EfI4nmFZEFyz1veSe5Iri0BXB13Icfekjxaxz6TPMixXXt2fJDM5WLZF+og63MPNi1IbsQGW7zyJYUToXZyEUxP8iLSPUS80hLvdYQTobbWN3fHKvMLGpKrBq/bzla4htC3C8mbutIg3JnkxrddzhCvil4omwbhDqy6IPEisV5xJFn4tsk1rDJI8wtZ+rapN+JV73PzqnuwSk7MtvkQzflabdUxGsMdIGFSnfuZZFPHPxysELjnXDOoFsTbzAJA6dumRiyxSt/2+Ma6Hlvf9lyRb9QumjAwIZKQqOLAznvEEbFUcvFS7VVXWO/WvHsTLYnVnSBEM8JgEqsDlmi7qQ++TWL1xxKtnOqgKvs5J7H6I6KdJxFNsh5FygafxLqOxVgHme6b8QIYkWqcZoW6Mr13vvMXhboi8u56x+a34eXKTWMhXSO3SQirgqZi5WSniSvS1ChyFztUoTCcetjMoNGnHbqjTQqF42P1z4pnd7IwssKUwo8Mq/uIz2eN1NWMg3vzxoUWvu3pihEa+zU/4l3RJhoRC/ZcAkKdxkfnXUC8ggE1L+tWILbartW45o1D5IIpL+tWq43du4C4BQNqXlY82jB67wJmIdhSTG/vl1FXkaP1LiB+wQCA+m5+Ya5/s7b7V5a/J7Eq0cZ/svza+FcrHEZd1ZiJh5kp/q0e1D3tqMMhMA/BgFodt1DrzJD4jyx/TmpVoo3vsqyHxTmFQ2BWHpY3ngP1Pa9h5f1AmItgQC1bXAE6JKpXVn94sSrRxocsl4AW7Iss/0xuTuIRKqfQ7dic2i9gdiHxWlu0V8yi/QLmJRhQc6jlG3T7lYboCRfVji3eoMda+mjeNhEAJ1ku31ANYQekhCNklDafTA87eTEl0YWTLHNTsNSGhYvSZvEGPWDkyY8t1xt2ua/jd0Uyah/jYinBcvt+2OTIBTgAOHi6GJ3wbKeOfkaOn09sRNM4VGcXF8N1P0wiwNmyMx+63x7HV48dnuHqpJ40ZMNbBovmUrAGsRSTjuB2PRefgokhZcPFGCSaK8FaxCqf3ecAW66Cea8juhbNhWCBiaXridRtSD61IZZRzkQbKlhIYok9ut5rCOY9Q3Ml2hDBQhNLbKoJdpBfVr4MMnEh2rOChSiW2KWeCHg3X4wO5h2woaI9I1ioYolt6gHf/RuMOpU/k+pkWVYC+GatXmCkTit1p9hOvL6JLb7JZXky+0LTjn/UgWc9rY+HhexZCuqXIzZmfAzyAdJnROsqWAxiAbUnp9bmmxJn34bdo69oXQSLRSwAt10veqwndqVFtKJh21bBWD2WHotYuo5orDzIymAyxSbuiEZbtDbBqN8hCF4soGbv3lwZbOJh00W0e4LFJhZQG81hY67UHbMIeCRak2AxigXU2q+V/QdF7sWynrSJ1nFdDGJd2y/axXnqikfhx7z+tIjWhdK3/Y+gbqpuu1yM9IU+Nt8EfUQU00ex4YU+84/m6Df55NYNgPdDXhOFb3u7wLZwaGwUXVhUdBSt8G1nV9hlvBTjpKPIFm0eiFb4tq8P7No3ZkA3NJ/hjmiFb7v6QN3Nuh8OjY3VCQffib6HJVrh256+GN5Vdtk4ZwS1xUeIaIVvO/rSy7uMf9rF7mWx0su7jH9SD31E7WWxwfoI5v0eO6QuOiYvmwgOGcGcLkZ6TnSG+kGb7m1Xw05UtnVMoXE8WJ8hYljZjL4mKXsh6HIE85SAjAvHmCqFabKcUeAYk+UYO1ePWqXpqBxBXWx3f0vLyhpL5wd4MYyoNd7bnKzX6IJ+wipkOOXUlJN8M2YMfUxNaSUh+SQHnQFWszLtfGxME2/3whJr+j4t09T2nbHE8jO1vRiSRHtAMGIZBi2M8HhO2aNGskGVYOy8i2VCXQ+bLvsJGNYfci1929OIZeQ+qG/UREjE2QcvlsIKA0cGMjrBFFjt1ZGx3EcUww/Gt2w7Z2+T890Z5/seZQJmhcjjHBMSVuW6o3GepW+bBsHqfo/pbYc5hMkGrzpG6VX3YPWWyTl24e4IVfi2axRYZVBm+h+NcKxGHdhZtm9n5VX3EOHKBo8rGVByIt5UUFdzKDbvXkIomzvCKfE2PsQzRDpYNh1lfT61TcEhwq3lItniHSX0FGMIKAKtxWveecueAbVRmW8DbESUNaopHpe4HbDrhGqU6Q9UMyao309qgyzLTsa+7E8O4LMsm/YPVPOo/QTwI8uyoMbzD04wE7ngS/l8AbBC8wUeghL/J4CPLMt+Od6/U4IWrAlpQ5aoPOSTLHNoIRfGzxfoMd9P0J74F5VIlyzLopok6H/tVqA8kSYfTwAAAABJRU5ErkJggg==",RT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYwAAACsCAYAAABo4pvIAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAzYSURBVHic7d3hcdtIEobhD05gmYGRgbkRLDKwMjiGoBCUgeoi0F0Evo1AdASiIxAcgbkR9P1Aj9mESIm2QMwAeJ8qlihKomeXwHzsHgCsBBTOzGpJK7+pd7/2r3+ceCw69Vh8nkvt/fbW4/H7vaR//H4bfqeNX6uqij8DilPlHgCWxcxW6ibvNFmn+x/DY/Fn0mHyPXVLE7F0ejKOf3/SpRO1B9c55wJNOg6rfrD1/5v7/31pbN97j7WS9lVVnf3vAoZGYGAwPqHW6ia+tbrJce0/Tj+Lk176+k/4/ui2tAnRA/VUaNbqQjXdr8PvtDoOku/xeyoXDIXAwMXMbK1DGHzUcTikiatVN1l9Uy8YmLiG1wuY2r9+0vHrUuvwOux0/PrseF1wKQIDR06EQvw+TTatunexrXgXOwmh+ku31AJc6xAoMUxaESboITAWyoOhVjdhfAr307vQnbpQ2KlrDe2yDBSj8EBJ20S/Qml12B7S/XZp7UIQGLMX3lk2Og6Gnbqd/1u4zySAI+EghRQmH9VtS7W6bWYrKpLFIDBmJFQNf6nbwdOCc6oYvqqrFrY5xof56AXJJ53e3r5J2hIi80FgTFRoIcRwaP32Vb7TUjFgTCdaW426thYhMgMExgT4u7m1Dm2lxn+UqoatCAcUyrffRodqpPEfbcWbm0khMAoUdrBUPTTyUFC3g7UsQmPKvBJpdNzOiq3TLQFSHgKjAKGM/6xDOb+T9Le6d17bXGMDxmJmjY73g1aHRfX/ESD5ERgZhBbTZx2OOCEggOCVAEn7CQEyMgJjJL2Nv9Hxhr/NNS5gKnr7UK0uQNiHMH1mtjKzGzN7MLNnvz34Rg/gHXz/aszs3vetH75/bbyCB8pmZrVvsI/WeTSzWz8/AsCV+L536/vcj7Dv1bnHBvxkZmt/l/MUqogb3uUAefSqjx++X95R3SOLEBK0moDCER4Y3YmQuKfVBEyLh8dd2I8JDwzD+6J3hAQwP2fCo849LkyI9z/TwnVqNxESwIyF8IgL5qxD4jTfYB786KYvZnaTe0wAxudzQTraivVJdE60nDaUpACkn92GuxAed1QdCxSqCY5wAvCm3pFWj8wZM2eHk+p+VhO5xwRgWrzqSCcIPrHWMTMeFGltgmoCwCB6ax33tLMnzM+biG2nOveYAMxPWAulXTU1vUNiuRAZgFGERfJngqNwrE8AKEVoVz0xHxWEoABQqhAczE85ERQApiIEB62qMREUAKaK4BiJH4nwRFAAmDqC40rCeRQEBYBZ8Y5JumZVnXs8k9U7RO0u93gA4Br6cx2nAvyisE5B6gJYBA+OB684uFr2W3rtpzr3eABgbL31jTr3eIoUTq2/yz0WAMjNugsbPpvZbe6xFMOrimfSFACO+fyYzhhvco8nq1BVkKAAcIZXGz/M7D73WEYXqgoWtQHgAr1qo849nlGEvtwm91gAYGoWsbbBEVAAMIxw5YvH2Z23EVpQy+u/AcAV+Hkb9z63rnOPZxBhsWa+5RMAZDKbFlVIvzr3WABgrsbq4ny4xpOm/pqklaQ/q6pqr/HvAAAkn2P/lLSa1FFUIenuco8FAJYmXMiwzj2WVxEWAJBfCI0yF8PN7MYXtze5xwIASxeu+t3kHsuRMLAy0wwAFsjM1kW9kQ9hUeceCwDgWFgq2OQeSPp4wTrrQAAAZ3lo5Ks0QljQhgKAwmVrT1n3iVCEBQBMSAiNcebuUNrwmbMAMDF+ROv11539Ylf5F08AAL8tXH+qvuY/8sgVZwFg+vzkvqdrPfm9mT1e5ckBAKPz604NWwSM1vMCAIxm8HM0wiI3R0QBwMz4kVPDFAS+bjHtD+YAAJzli+DvW3IY5EkAAMV715XGaUUBwHKEOb/+nT/+wudaAMBy+KG2D7/6R42XJ6srjQsAUCCf+y+/kocvdDfXGxIAoETpIysu/eWGhW4AWK6Lz83w6oILCwLAQl1UZaS1i5HGBAAo1JtrGV5dbMYbEgCgRF5lnF6e8EuX/xh5TACAQvUvGfIh/OxW0n/GHhAAoFhbSS/bUp4kzdijAQCU6eS6dvqM7kxjAgAUKhYTqSW1Fu0oAMBLW3UZ0eHMbgDAKUcnc6ejo7huFACgzzPCpK4lVUvaV1W1zzoqAEBxPBt2ZtZ8UNeb2uYdEgCgYK2k9QdJnyR9yzsWAEDBvkr6mFpSbdahAABKtpNXGGtJrF8AAF6zSudhtDlHAQAo2l4hMAAAOGcvaaV0fC0AAOeYmVFhAAAu8kHSPl7vHACAyDOi/aDUmwIA4BUEBgDgLbV0CAwAAM5ZSdp9kJ/Bl3kwAIBy1fI1jO+S/so7FgBAwT5J+pYqjDrvWAAABWvUZUV3QgYfoAQA6IsfspdO3NuKdQwAwEtrSbuqqvYpMP6W9K+MAwIAlOmzuozo+Id8P+cbDwCgRN6OavoPPr94EACwWP1iIl588N+iLQUAOPgs6b8vHjWzmrYUACBJR0el739WGFVVtZJaM9tkGBcAoCCeBbuqqk5fPsrMbqgyAAAXrWv7L21GGREAoDhePDxe8osbqgwAWC4ze7z4qFmqDABYJj+U9u3qIvwBaxkAsDB+3ahfPyfPzB7M7O4qowIAFMfM7szsy+/8Ye3H4NbDDwsAUBIzW79rzve0oTUFADPnC923+Z8EAFAsM7v9pYXuV56o9kUQPi8DAGbm3a2oE0+48dAY5gkBANmFguBm6Ce+N7OnQZ8UAJCNLzncX+vJnzjUFgCmz4uA969bvPIPpPKFRXAAmKiwzLB6+7ff9w9dp+cFALg6v5LHeOfYhVV1jpwCgIkIc3cz9j+8ITQAYBpCWGxyDWAzamkDAPhl4VJPm9wD4RwNAChUWHfe5B6LJNpTAFAib0OVExaJf+hGeQMDgAUKb+TLPKI1pNld7rEAwFKlK40Xv1QQ+mV3uccCAEszmbBIPDSe/FP7rnsmIQAgfbzqg8+9de7x/DK/Vsl0kg4AJih0dq5zIcGx+AdzcP0pALgCn2N/zGaODYvh97SoAGAYs+3ieH/tcbL9NQAoRGhBPcx6PqVFBQC/L1xdYxlzaDiK6nHW6QgAA/F582GWLahLeP9tPos1AHAFYWH7LvdYsvJLilBtAECPVxWPi60qzmFtAwAO/IxtqopzQpo+2tifCAUABVjMEVBDscNnznJpEQCL0FvU3uQez6T4eRvpIlp3BAeAuWKuG0hI3fwfLwgAAwrnVNB+GpIfTcX6BoDJC0HBlS+uieAAMFUhKFinGBPBAWAqCIpChBeC4ABQFIKiUP7CPBEcAHIjKCYitKo4RA3AaPxUgNjx2OQeEy4UguOHB0ede0wA5qd3wt2Dma1zjwm/yV/MdFVc2lUABuFvSh+sw3kUc+Ll4m1Y57ilXQXgV/XXJwiKmeu1q+6pOgC8JlQTqe3U5B4TRmaH61WldhWL5AAk/Wxnx2qCtVB0wjsI1jqABbPuatlfwtpEk3tMKFRY64hHWDW5xwXgesxsHVpOj15Z0G3A5bwkTZcdfiY8gPnwkLin5YTBecuK8AAm7ERI3HPeBK6qFx4caQUUrHeEEyGBfM6FB/1PIA9fh7wJIfFESKA4vuYRF8wf/fs699iAOfNWU9r3LCxc17nHBrzJDhciS4fqplKY6gMYwIlW04NXFuxfV1LlHsBS+BrHWtJnSbWkVtLfknZVVW1zjQuYit4+1Ejain1oVARGBv4OKG74taSd2PiBn3oBsVb3Jmurw36yzzW2pSIwCuABciPpkwgQLNSZgIj7QZtrbOgQGAXyAGkk/aVux1mr23F2kr5J2rLzYMr8iKVah228UVc97CR9VbeNU0EUhsCYgNDCWqvbwRr/0VZdgOzEDoZChe230SEgpMP2uxUtpkkgMCbKDxds1LWxUpjsddgJW1HGY2Qn3tzUOrRYU/XAdjlRBMaMnAkR6bidtZPU8m4O7+VrDisdt06l43Boq6raZRkgBkdgzJyHSOoXx0X1Vl018l2HxUWCBEe8Yqj9tla3DaX7O3XbTmortVQO80ZgLFCYBFKQfAz39+omgr1obS2GL0KndlLaHtJjMRjSGwuqhgUiMHDkREWyCt+3OoRJqkxa8c6yeP66xttH/5pe3/S67tS9tjtJe4IBEYGBi4UwWek4TFLF0uplhbIPj+9peQ0vhMEqfP0Uvq91/Lq0IhTwGwgMDKb3Lnalw7vY9H0tDw4dqhPpUK1IIVy0wIDxduGpWy3pD70MhpWO/1/uJP2jEA5UfxgKgYFRhQmx1vGk99F/JT6WbvverfXf3aubHJM23E+/27//wqUT6htXPk1jTeoz9//Q6UCIf9/q5X/zd/WqNXGQAkZGYKB4YaLuf43300QsvZy8+9+/9fhrzoVP+8pjMdjiY0eBRiWA0v0fPGR4m68wwtkAAAAASUVORK5CYII=";class Nd extends Lt.CSS2DObject{constructor(e,t){const i=document.createElement("div");super(i),this.props=e,this.amr=t,this._direction=1,this._controllingRotate=!1,this._controlling=!1,this._startAt=0,this._looper=0,this._initial=0,this._canRotate=!1,this._emitter=new os,this.addListener=this._emitter.addListener.bind(this._emitter),this.removeListener=this._emitter.removeListener.bind(this._emitter),this._update=()=>{if(this._looper=requestAnimationFrame(this._update),this._controlling){let a=(Date.now()-this._startAt)/200;a>4&&(a=4);let h=this._initial+.005*a*this._direction;if(h>this.props.max||h<this.props.min){this.mechanism&&(h<this.props.min?(this.mechanism.position.setZ(this.props.min),this._emitter.emit("change",this.props.min)):h>this.props.max&&(this.mechanism.position.setZ(this.props.max),this._emitter.emit("change",this.props.max)));return}if(this._initial=h,!this.mechanism)return;this.mechanism.position.setZ(h),this._emitter.emit("change",h)}};const s=tc();e.userData&&e.userData.target&&(this.name=e.userData.target.name,t.traverse(a=>{a.name===e.userData.target.name&&(this.mechanism=a)})),i.style.fontSize="30px",i.style.color="#0066FF",i.style.cursor="pointer",i.style.pointerEvents="auto";const n=document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.transform="translateX(-50%) rotate(-180deg)",n.style.marginBottom="5px",n.style.width=n.style.height=s?"34px":"44px",n.style.background=`url(${kd}) center no-repeat`,n.style.backgroundSize="100% auto",n.setAttribute("data-direction","up"),n.style.transition="all .2s";const o=document.createElement("div");if(o.style.position="absolute",o.style.left="0",o.style.transform="translateX(-50%)",n.style.bottom=o.style.top="8px",o.style.width=o.style.height=n.style.width,o.style.background=`url(${kd}) center no-repeat`,o.style.backgroundSize="100% auto",o.style.transition="all .2s",o.setAttribute("data-direction","down"),Array.from([n,o]).forEach(a=>{s||a.addEventListener("mousemove",()=>{a.style.filter="invert(100%)"}),a.addEventListener("mouseleave",()=>{a.style.filter=""}),a.addEventListener("pointerdown",()=>{this.mechanism&&(a.style.filter="invert(100%)",this._controlling=!0,this._startAt=Date.now(),this._initial=this.mechanism.position.z,this._direction=a.getAttribute("data-direction")==="up"?1:-1,this._update())}),a.addEventListener("pointerup",()=>{this._controlling=!1,cancelAnimationFrame(this._looper),a.style.filter=""}),a.addEventListener("pointerleave",()=>{this._controlling=!1,cancelAnimationFrame(this._looper),a.style.filter=""})}),e.userData&&(this._canRotate=e.userData.canRotate,this._canRotate)){const{rotateTarget:a,rotateDuration:h,rotateStep:u,rotateMax:d,rotateMin:l}=e.userData;let c;if(a&&(t.traverse(f=>{f.name===a.name&&(c=f)}),c)){const f=document.createElement("div");f.style.background=`url(${RT}) center no-repeat`,f.style.backgroundSize="100% auto",f.style.position="absolute",f.style.top="-50%",f.style.left="-50%",f.style.width=s?"140px":"160px",f.style.height=s?"70px":"80px",f.style.transform="translateX(-50%) translateY(-50%)",i.append(f);const p=document.createElement("div");p.style.background=`url(${PT}) center no-repeat`,p.style.backgroundSize="100% auto",p.style.width=p.style.height=s?"20px":"26px",p.style.position="absolute",p.style.top="0",p.style.transform="translateY(-50%)",p.style.marginBottom="5px",p.setAttribute("data-direction","left"),i.append(p);const g=document.createElement("div");g.style.background=`url(${IT}) center no-repeat`,g.style.backgroundSize="100% auto",g.style.width=g.style.height=s?"20px":"26px",g.style.position="absolute",p.style.left=g.style.right=s?"62px":"69px",g.style.top="0",g.style.transform="translateY(-50%)",g.style.marginBottom="5px",g.setAttribute("data-direction","right"),i.append(g),Array.from([p,g]).forEach(m=>{s||m.addEventListener("mousemove",()=>{m.style.filter="invert(100%)"}),m.addEventListener("mouseleave",()=>{m.style.filter=""}),m.addEventListener("pointerdown",()=>{if(this._timer&&this._timer.isPlaying())return;m.style.filter="invert(100%)",this._controllingRotate=!0,this._startAt=Date.now(),this._direction=m.getAttribute("data-direction")==="left"?1:-1;let _=u/180*Math.PI*this._direction+c.rotation.z;_>d/180*Math.PI?_=d/180*Math.PI:_<l/180*Math.PI&&(_=l/180*Math.PI),this._timer=new yo(c.rotation).to({z:_}).duration(h).start(),this._update()}),m.addEventListener("pointerup",()=>{this._controllingRotate=!1,cancelAnimationFrame(this._looper),m.style.filter=""}),m.addEventListener("pointerleave",()=>{this._controllingRotate=!1,cancelAnimationFrame(this._looper),m.style.filter=""})})}}i.append(n,o),this.scale.set(.01,.01,.01),this.matrixAutoUpdate=!1,this.updateMatrix()}hide(){this.element.style.display="none",this.traverse(e=>{e.visible=!1,e instanceof Lt.CSS2DObject&&(e.element.style.visibility="hidden")}),this.visible=!1}show(){this.element.style.display="auto",this.traverse(e=>{e.visible=!0,e instanceof Lt.CSS2DObject&&(e.element.style.visibility="visible")}),this.visible=!0}dispose(){this._emitter.removeAllListeners(),cancelAnimationFrame(this._looper),this.element.remove()}}class DT extends og.CSS3DObject{constructor(e){const t=document.createElement("div");super(t),this.props=e,this._scale=.01,this._emitter=new os,this.addEventListener=this._emitter.on.bind(this._emitter),this.removeEventListener=this._emitter.on.bind(this._emitter),this._mouseStart=new y.Vector2,this._targetSize=new y.Vector2,this._caches=[],this._sizeFlag="width",this._direction=1,this._lines=[],this._pointerdown=h=>{const{pageX:u,pageY:d}=h;this.endNode.setPointerCapture(h.pointerId),this._mouseStart.set(u,d),this._targetSize.setX(parseFloat(this.endNode.parentElement.style.width)),this._targetSize.setY(parseFloat(this.endNode.parentElement.style.height))},this._pointermove=h=>{if(!this._mouseStart.x)return;const{pageX:u,pageY:d}=h;let l=u-this._mouseStart.x,c=l+this._targetSize.x;this._sizeFlag==="height"&&(l=d-this._mouseStart.y,c=l*this._direction+this._targetSize.y);const f=c%10;c=c-f,l=(c-this._targetSize.x)*this._direction,this._sizeFlag==="height"&&(l=(c-this._targetSize.y)*this._direction),this._textNode.innerText=(c/100).toFixed(2)+" m",this.endNode.parentElement.style[this._sizeFlag]=`${c}px`},this._pointercancel=h=>{this.endNode.releasePointerCapture(h.pointerId),this._mouseStart.set(0,0)};const{start:i,end:s}=e,n=s.distanceTo(i);this.props.axios==="z"?this.props.axios="y":this.props.axios==="y"&&(this.props.axios="z"),this.props.axios==="y"&&(this._sizeFlag="height");const o=document.createElement("div");o.style.position="absolute",o.style.left="0",o.style.bottom="0",t.append(o),this._textNode=document.createElement("div"),this._textNode.innerText=n.toFixed(2)+" m",o.append(this._textNode);const a=document.createElement("div");this.endNode=a,a.style.position="absolute",a.style.left="auto",a.style.right="0",a.style.width="4px",a.style.height="4px",a.style.background="#0066FF",a.style.borderRadius="50%",a.style.margin="-2px -2px 0 0",a.style.cursor="pointer",o.append(a),this.scale.set(this._scale,this._scale,this._scale),t.style.fontSize="6px",t.style.color="#fff",o.style[this._sizeFlag]=n*100+"px",o.style.textAlign="center",this._sizeFlag==="height"?(o.style.borderLeft="0.1px dashed #fff",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.whiteSpace="nowrap",a.style.top="0",a.style.left="0",a.style.right="auto",a.style.margin="-2px 0 0 -2px"):o.style.borderBottom="0.1px dashed #fff",a.addEventListener("pointerdown",this._pointerdown),a.addEventListener("pointermove",this._pointermove),a.addEventListener("pointerup",this._pointercancel),s[this.props.axios]<i[this.props.axios]?this.rotateY(Math.PI):this._direction=-1}_getIndexByAxios(){return this.props.axios==="y"?1:this.props.axios==="z"?2:0}dispose(){this._lines.forEach(e=>e.dispose()),this._emitter.removeAllListeners(),this.endNode.removeEventListener("pointerdown",this._pointerdown),this.endNode.removeEventListener("pointermove",this._pointermove),this.endNode.removeEventListener("pointerup",this._pointercancel),this.element.remove(),this._caches.forEach(e=>e.clear()),this._caches=[]}}class BT extends y.Object3D{constructor(){super(),this._box3=new y.Box3,this._line11=new fo("长:"),this._line12=new fo("宽:"),this._line13=new fo("高:"),this._outline=new wm(0,0),this._radius=0,this._hasWidthConfig=!1,this._hasLengthConfig=!1,this._hasHeightConfig=!1,this.follow="",this.followOrigin=0,this.followScale=1,this.originOffset=0,this.translateCache=0,this.head=0,this.tail=0,this._change=()=>{if(!this._app)return;const e=this._app.camera;e&&this._outline.change(e.position)},this.add(this._outline,this._line11,this._line12,this._line13)}get hasSizeConfig(){return{length:this._hasLengthConfig,width:this._hasWidthConfig,height:this._hasHeightConfig}}get size(){return this._box3.clone()}get radius(){return this._radius}init(e){this._app=e,this._app.controls.addEventListener("change",this._change)}reset(){this.hide(),this._line11.reset()}generate(e,t=0){e&&(this._object=e),this.update(t)}show(e=!0){const t=[this._line11,this._line12,this._line13];e&&(this.visible=!0,this._outline.visible=!0,this._outline.show(),t.push(this._outline)),t.forEach(i=>{i.traverse(s=>{s.visible=!0,s instanceof Lt.CSS2DObject&&(s.element.style.visibility="visible")})})}hide(e=!0){const t=[this._line11,this._line12,this._line13];e&&(this.visible=!1,this._outline.visible=!1,this._outline.hide(),t.push(this._outline)),t.forEach(i=>{i.traverse(s=>{s.visible=!1,s instanceof Lt.CSS2DObject&&(s.element.style.visibility="hidden")})})}destroy(){var e;(e=this._app)==null||e.controls.removeEventListener("change",this._change),this._line11.destroy(),this._line12.destroy(),this._line13.destroy()}update(e=0){if(!this._object)return;const t=this._object,{box:i,maxRadius:s,hasLength:n,hasHeight:o,hasWidth:a}=XA(t);this.tail=Math.abs(i.min.x),this.head=Math.abs(i.max.x),this._hasWidthConfig=a,this._hasLengthConfig=n,this._hasHeightConfig=o,this._box3.copy(i),this._radius=s,this.follow&&e&&(this.originOffset=(this.followOrigin-e)*this.followScale),this._outline.update(this._radius),this._change();const h=this._box3.min.x,u=this._box3.max.x,d=this._box3.min.z,l=this._box3.max.z,c=this._box3.min.y,f=this._box3.max.y;let p=.2;const g=new y.Vector3(h,f,0),m=new y.Vector3(u,f,0);this._line11.update(g.clone().sub(new y.Vector3(0,-p/1.8,0)),m.clone().sub(new y.Vector3(0,-p/1.8,0)),this._radius);const _=new y.Vector3(u,c,0);this._line12.update(m.clone().add(new y.Vector3(p,0,0)),_.clone().add(new y.Vector3(p,0,0)),this._radius);const v=new y.Vector3(h,f,d),x=new y.Vector3(h,f,l),b=v.clone();b.y-=p/6;const w=x.clone();w.y-=p/6,this._line13.update(b,w,this._radius)}}class Ud extends y.Object3D{constructor(e=.6,t=.4,i=.2){super(),this.isGoods=!0,this._generate(e,t,i)}updateSize(e=.1,t=.1,i=.1){this._generate(e,t,i)}clearAll(){ii(this)}hide(){this.traverse(e=>e.visible=!1)}show(){this.traverse(e=>e.visible=!0)}_generate(e,t,i){this.clearAll();const s=new y.Mesh(new y.BoxGeometry(e,t,i),new y.MeshBasicMaterial({color:new y.Color("#0f5fd5"),transparent:!0,opacity:.4}));s.geometry.translate(0,0,i/2);const n=new y.EdgesGeometry(s.geometry),o=new y.LineDashedMaterial({color:new y.Color("#000"),dashSize:.015,gapSize:.015}),a=new y.LineSegments(n,o);a.computeLineDistances(),this.add(s,a)}}const FT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAALSURBVAiZY2AAAgAABQABYlUyiAAAAABJRU5ErkJggg==";class yh{constructor(e){this._props=e,this.name="",this.transparentTexture=ac.load(FT),this._offscreen=new OffscreenCanvas(0,0),this._defaults={...e},this.target=e.target,this.parent=this.target.parent,this.reset()}get imageSize(){return this._props.imageSize}get size(){return this._props.size}get defaultConfigs(){return{canvasWidth:200,canvasHeight:200,scaleX:1,scaleY:1,x:0,y:0,ox:0,oy:0,url:this._defaults.imageUrl}}clear(){this.change()}change(e,t=new y.Vector2(1,1),i=new y.Vector2){this.imageUrl=e;let s;if(e){const n=new Image;n.crossOrigin="anonymous",n.src=e,n.onload=async()=>{var u;let o=window.devicePixelRatio*2;this._offscreen.width=n.width+o,this._offscreen.height=n.height+o;const a=this._offscreen.getContext("2d");a==null||a.clearRect(0,0,this._offscreen.width,this._offscreen.height),a==null||a.drawImage(n,o/2,o/2,n.width,n.height),s=new y.Texture(this._offscreen),s.minFilter=1003,s.colorSpace=y.SRGBColorSpace,s.wrapS=s.wrapT=y.ClampToEdgeWrapping,s.repeat.set(1/t.x,1/t.y),s.offset.set(i.x,i.y),s.flipY=!1,s.needsUpdate=!0;const h=this._props.target;h.material&&((u=h.material.map)==null||u.dispose(),s?(h.material.map=s,h.material.opacity=1):(h.material.map=this.transparentTexture,h.material.opacity=0))}}else{const n=this._props.target;n.material&&(n.material.map=this.transparentTexture)}}reset(){this._props=this._defaults,this.name=this._props.name,this.imageUrl=this._props.imageUrl,this.target=this._props.target,this.change(this.imageUrl||"")}dispose(){this._offscreen=null}}function Am(r){return r.type?r.type==="Mesh":r.isMesh}const LT=r=>{const e=window.performance.now(),t=[];r.updateWorldMatrix(!0,!0),r.traverse(n=>{if(Am(n)||n.geometry){const o=n.geometry.clone();if(o.applyMatrix4(n.matrixWorld),o.morphTargetsRelative=!1,o.morphAttributes)for(const a in o.morphAttributes)delete o.morphAttributes[a];for(const a in o.attributes)a!=="position"&&o.deleteAttribute(a);t.push(o)}});const i=ag.mergeGeometries(t,!1),s=window.performance.now()-e;return console.log(`Merge object: ${r.name} time: ${s.toFixed(2)} ms`),i},ac=new y.TextureLoader;ac.crossOrigin="anonymous";class Tm extends y.Object3D{constructor(e){super(),this._props=e,this._emitter=new os,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._container=new y.Group,this.lines=new y.Group,this.sizeBox=new BT,this._goodsSize=new YA(0,0,0),this._slots=[],this._logos=[],this._skins=[],this._levels=new Map,this._bodyOpacity=1,this._masts=new Map,this._liftMaxHeight=0,this._jackMaxHeight=0,this._forkMaxHeight=0,this.controllers=[],this.goods=[],this._breathLights=[],this._shelves=new Map,this._shelfMaxLevel=1,this._url="",this._showController=!0,this._showSlots=!0,this._shapeKeys=new Map,this._shapeKeyTimer=0,this._shapeKeyCache="",this._materialsCache=new Map,this.opacityCache=void 0,this._pointCloudMode=!1,this._pointClouds=[],this._originalMeshes=new Map,this._pointCloudAnimations=[],this.actions=[],this._url=e.url||"",this._url&&this.load(this._url).then(),this.add(this._container,this.lines),this._props.showSizeBox&&this.add(this.sizeBox),this.showController=typeof e.showController=="boolean"?e.showController:!0,this._showSlots=typeof e.showSlots=="boolean"?e.showSlots:!0}get shapeKeys(){return this._shapeKeys}get size(){const e=this.sizeBox.size.getSize(new y.Vector3);return{width:e.z,length:e.x,height:e.y}}get goodsSize(){return this._goodsSize}get showController(){return this._showController}set showController(e){this._showController=e,this.controllers.forEach(t=>e?t.show():t.hide())}get slots(){return this._slots}get logos(){return this._logos}get skins(){return this._skins}get bodyOpacity(){return this._bodyOpacity}get fork(){return this._fork}get forkHeight(){var e;return((e=this._fork)==null?void 0:e.position.z)||0}get liftHeight(){var e;return((e=this._lift)==null?void 0:e.position.z)||0}get jack(){return this._jack}get jackHeight(){var e;return((e=this._jack)==null?void 0:e.position.z)||0}get lift(){return this._lift}set bodyOpacity(e){this._bodyOpacity=e,e<1?this._materialsCache.forEach(t=>{t.mat.transparent=!0,t.mat.opacity=e,t.mat.metalness=0,t.mat.roughness=1,t.mat.color=new y.Color("#3859be"),t.mat.needsUpdate=!0}):this._materialsCache.forEach(t=>{t.mat.transparent=t.transparent,t.mat.opacity=t.opacity,t.mat.metalness=t.metalness,t.mat.roughness=t.roughness,t.mat.color=t.color,t.mat.needsUpdate=!0})}init(e){this._app=e,this.sizeBox.init(e),this.addEventListener("shape-key-changed",(t,i)=>{this._slots.forEach(s=>s.shapeKeyChanged(t,i)),this.sizeBox.follow===t?(this.sizeBox.generate(this._container,i),this.sizeBox.originOffset&&(this._container.traverse(s=>{s instanceof y.Mesh&&!s.userData.isDevice&&!s.userData.isBracket&&s.geometry.translate(this.sizeBox.originOffset-this.sizeBox.translateCache,0,0),s instanceof _h&&!s.props.slot.userData.ignoreOriginChanged&&s.parent&&s.parent.position.add(new y.Vector3(this.sizeBox.originOffset-this.sizeBox.translateCache,0,0))}),this.sizeBox.translateCache=this.sizeBox.originOffset,this.sizeBox.generate(this._container))):this.sizeBox.generate(this._container),["width","length","height"].includes(t)&&this._emitter.emit("size-changed",t,i)})}async load(e,t=""){this._url=e,this.name||(this.name=e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))),!e.startsWith("blob")&&e.endsWith(".sglb");let i;if(t==="glb"||e.endsWith(".glb"))i=(await rs.loadAsync(e)).scene;else{const n=await new Uo({useCache:!0}).loadAsync(e);if(!n.glb)return;i=n.glb}this._generateAmr(i.clone(!0)),i=null,this._emitter.emit("amr-loaded")}changeSkin(e,t){e&&(e.change(t),this._app&&this._app.usePathTracing&&(this._app.sampleCount=0,this._app.usePathTracing&&(this._app.pathTracer.pausePathTracing=!1,this._app.pathTracer.updateMaterials())))}changeLogo(e,t){e.change(t.url,new y.Vector2(t.scaleX,t.scaleY),new y.Vector2(t.ox,t.oy))}setShapeKey(e,t,i=!0){i&&this._shapeKeyTimer&&e===this._shapeKeyCache&&clearTimeout(this._shapeKeyTimer),this._shapeKeyCache=e,this._shapeKeyTimer=window.setTimeout(()=>{this._container.traverse(s=>{if(!Object.keys(s.morphTargetDictionary||{}).includes(e))return;let n=t;s.userData[`origin_${e}`]&&(n-=s.userData[`origin_${e}`]);const o=s.morphTargetDictionary[e];s.morphTargetInfluences&&(s.morphTargetInfluences[o]=n),s instanceof y.Mesh&&s.geometry.translate(0,0,1e-5)}),i&&this._emitter.emit("shape-key-changed",e,t)},100)}_generateAmr(e){this._mergedGeometry=LT(e),e.traverse(t=>{t.userData.isShelf&&(this._shelf=t),t.userData.isFork&&(this._fork=t),t.userData.isMast&&t.userData.mastLevel&&this._masts.set(t.userData.mastLevel,t),t.userData.isJack&&(this._jack=t),t.userData.isLift&&(this._lift=t),Object.keys(t.morphTargetDictionary||{}).forEach(i=>{let s=t.morphTargetInfluences[t.morphTargetDictionary[i]];t.userData[`origin_${i}`]&&(s+=t.userData[`origin_${i}`]),this._shapeKeys.has(i)||this._shapeKeys.set(i,s)})}),e.traverse(t=>{if(t instanceof y.Mesh){if(t.castShadow=!0,t.receiveShadow=!0,t.material)if(Array.isArray(t.material))t.material.forEach(s=>{s.userData.changeColor&&(this.skins.find(n=>n.name===s.userData.name)||this.skins.push(new Mh({name:s.userData.name,target:s})))});else{if(t.material.userData.isBreathLight&&t.material.emissiveIntensity){t.material.emissive||(t.material.emissive=new y.Color(16777215)),t.material.emissiveIntensity=2,t.material.toneMapped=!1;const s=1e3,n=new Pt.Tween(t.material).to({emissiveIntensity:.2}).easing(Pt.Easing.Quintic.InOut).duration(s),o=new Pt.Tween(t.material).to({emissiveIntensity:2}).easing(Pt.Easing.Quintic.InOut).duration(s);n.onComplete(()=>o.start()),o.onComplete(()=>n.start()),n.start(),this._breathLights.push(n,o)}t.material.userData.changeColor&&(this.skins.find(s=>s.name===t.material.userData.name)||this.skins.push(new Mh({name:t.material.userData.name,target:t.material})))}if(t.material)if(Array.isArray(t.material))t.material.forEach(n=>{if(n.userData.isLOGO){t.material.transparent=!0;let o;const a={width:0,height:0};t.material.map&&t.material.map.image&&(a.width=t.material.map.image.width,a.height=t.material.map.image.height,o=gh(t.material.map.image));const h=new yh({name:n.userData.name,target:t,size:Ad(t),imageSize:a,imageUrl:o});this._logos.push(h)}n.userData.isTransparent&&(n.transparent=!0),this._materialsCache.set(n.uuid,{opacity:n.opacity,transparent:n.transparent,roughness:n.roughness,metalness:n.metalness,color:n.color,mat:n})});else{const s=t.material;if(s.userData.isLOGO){t.material.transparent=!0;let n;const o={width:0,height:0};t.material.map&&t.material.map.image&&(o.width=t.material.map.image.width,o.height=t.material.map.image.height,n=gh(t.material.map.image));const a=new yh({name:s.userData.name,target:t,size:Ad(t),imageSize:o,imageUrl:n});this._logos.push(a)}s.userData.isTransparent&&(s.transparent=!0),this._materialsCache.set(s.uuid,{opacity:s.opacity,transparent:s.transparent,roughness:s.roughness,metalness:s.metalness,color:s.color,mat:s})}}this.generateController(t,e),this.generateDimension(t,e);const i=this.generateSlot(t,e);i&&this._slots.push(i),t.userData.isOrigin&&Object.keys(t.userData).forEach(n=>{if(n.startsWith("follow_")){const o=n.replace("follow_","");this.shapeKeys.has(o)&&(this.sizeBox.follow=o,this.sizeBox.followOrigin=this._shapeKeys.get(o)||0,this.sizeBox.followScale=t.userData[n])}})}),this.slots.forEach(t=>{t.props.mirrorTarget&&(t.mirrorTarget=this.slots.find(i=>i.props.slot.name===t.props.mirrorTarget))}),e.updateMatrixWorld(!0),this._container.add(e),this.sizeBox.generate(e),this.sizeBox.show()}setHeight(e){this.setShapeKey("height",e)}setWeight(e){this.setShapeKey("width",e)}setLength(e){this.setShapeKey("length",e)}limitValue(e){this.name==="SFL-CDD14"&&(e>1.6?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),["SFL-CDD20","SFL-CDD20-Y"].includes(this.name)&&(e>1.6?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),this.name==="SFL-CDD15"&&(e>2.43?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),["SFL-CPD20-Y","SFL-CPD30-Y"].includes(this.name)&&(e>3.5?this.setShapeKey("mast",2):e>3?this.setShapeKey("mast",1):this.setShapeKey("mast",0))}setForkHeight(e){if(this._fork){if(e>this._forkMaxHeight&&(e=this._forkMaxHeight),this._fork.position.z=e,this._masts.size===1){const t=this._masts.get(2),i=(t==null?void 0:t.userData.startHeight)||.1;t&&(t.position.z=(e-i)*.5)}this._emitter.emit("fork-height-change",e)}}setForkMaxHeight(e){this._fork&&(this._forkMaxHeight=e,this.limitValue(e),this.controllers.forEach(t=>{t.name.toLowerCase().includes("fork")&&(t.props.max=e)}),this._fork&&this.forkHeight>this._forkMaxHeight&&this.setForkHeight(e))}setLiftHeight(e){this._lift&&(e>this._liftMaxHeight&&(e=this._liftMaxHeight),this._lift.position.z=e)}getLiftMaxHeight(){return this._liftMaxHeight}setLiftMaxHeight(e){if(!this._lift)return;this._liftMaxHeight=e,this.limitValue(e),this.controllers.forEach(n=>{n.name.toLowerCase().includes("lift")&&(n.props.max=e)}),this.liftHeight>this._liftMaxHeight&&this.setLiftHeight(e);let t=.46;this.levelOffset&&(t=this.levelOffset+.1);let i=e+t;const s=this.getShelfMinHeight()+t||0;i<s&&(i=s),this.setHeight(i)}setJackMaxHeight(e){this._jack&&(this._jackMaxHeight=e,this.limitValue(e),this.controllers.forEach(t=>{t.name.toLowerCase().includes("jack")&&(t.props.max=e)}),this.jackHeight>this._jackMaxHeight&&this.setJackHeight(e))}setJackHeight(e){this._jack&&(e>this._jackMaxHeight&&(e=this._jackMaxHeight),requestAnimationFrame(()=>{this.setShapeKey("jackHeight",e,!1)}),this._jack.position.z=e)}setLevel(e){}setGoodsSize(e){this._goodsSize.length=e.length,this._goodsSize.width=e.width,this._goodsSize.height=e.height,this.setShelfLevel(this._shelfMaxLevel)}getShelfMinHeight(){const e=this.levelOffset,t=this._shelfMaxLevel,i=this._shelves.get(0);return i?i.position.z+e*t+.1:0}getShelfMaxShelfHeight(){const e=this.levelOffset,t=this._shelfMaxLevel,i=this._shelves.get(0);if(i)return i.position.z+e*(t-1)}get levelOffset(){return this._goodsSize.height+.2}setShapeKeyToMesh(e,t,i){if(!Object.keys(e.morphTargetDictionary||{}).includes(t))return;const s=e.morphTargetDictionary[t];e.morphTargetInfluences&&(e.morphTargetInfluences[s]=i),e.geometry.translate(0,0,1e-5)}setShelfLevel(e=3){var s;if(!this._shelf)return;this._shelfMaxLevel=e;const t=this.levelOffset;this._shelves.delete(0),this._shelves.forEach(n=>{ii(n),n.parent&&n.removeFromParent()}),this.goods=[],this._shelves.clear(),this._shelves.set(0,this._shelf);for(let n=1;n<e;n++){if(!this._shelf)return;this._shelf.traverse(h=>{Am(h)&&(this.setShapeKeyToMesh(h,"goodsWidth",this._goodsSize.width),this.setShapeKeyToMesh(h,"goodsLength",this._goodsSize.length))});const o=this._shelf.clone(!0);o.position.z+=t*n,this._shelves.set(n,o),(s=this._shelf.parent)==null||s.add(o);let a;if(o.traverse(h=>{h.userData.isShelfContainer&&(a=h)}),(this.shapeKeys.has("goodsLength")||this.shapeKeys.has("goodsWidth"))&&(a==null||a.position.setX((a==null?void 0:a.position.x)-this._goodsSize.length/2)),a){const h=new Ud(this._goodsSize.length,this._goodsSize.width,this._goodsSize.height);if(a.add(h),this.goods.push(h),n===1){const u=new Ud(this._goodsSize.length,this._goodsSize.width,this._goodsSize.height);u.position.z-=t,a.add(u),this.goods.push(u)}}}const i=this.getShelfMinHeight()||0;this._liftMaxHeight<i&&this.setLiftMaxHeight(i)}generateOuterLine(){this.traverse(e=>{if(e.userData.isOuterObject){const t=this.sizeBox.radius;this._outline?this._outline.update(t):(this._outline=new wm(t,0),this.add(this._outline))}})}generateController(e,t){if(this.showController){if(e.userData.isForkController&&e.userData.target){const i=e.userData.target.name,{min:s,max:n}=e.userData;let o;if(t.traverse(h=>{h.name===i&&(o=h)}),!o)return;const a=new Nd({name:"",target:i,default:0,min:s,max:n},o);e.add(a)}else if(e.userData.isController&&e.userData.target){const i=e.userData.target.name,{min:s,max:n}=e.userData;let o;if(t.traverse(h=>{h.name===i&&(o=h)}),!o)return;const a=new Nd({name:"",userData:e.userData,target:e.userData.key,default:0,min:s||0,max:n||1},o);e.add(a),this.controllers.push(a),(o.userData.isFork||o.userData.isLift||o.userData.isJack)&&(this._forkMaxHeight=n||1,this._liftMaxHeight=n||1,this._jackMaxHeight=n||1,a.addListener("change",h=>{this.setForkHeight(h),this.setLiftHeight(h),this.setJackHeight(h)}))}}}generateDimension(e,t){if(e.userData.isDimension){const i=e.userData.divider,s=WA(e.userData.startOrigin),n=e.userData.axios;let o,a;if(n==="x"?(o=new y.Vector3(e.userData.start-e.position.x,0,0),a=o.clone().setX(e.userData.end-e.position.x)):n==="z"?(o=new y.Vector3(0,e.userData.start-e.position.y,0),a=o.clone().setY(e.userData.end-e.position.y)):(o=new y.Vector3(0,0,e.userData.start-e.position.z),a=o.clone().setZ(e.userData.end-e.position.z)),!Object.keys(e.userData).flatMap(l=>l.startsWith("target")?e.userData[l].name:[]).length)return;const d=new DT({start:o,end:a,startOrigin:s,axios:n,divider:i});e.add(d)}}generateSlot(e,t){var i,s;if(e.userData.isSlot){const n=e.userData.name,o=e.userData.isMirror,a=(i=e.userData.mirrorSlot)==null?void 0:i.name;if(n){const h=e.userData.holeTarget&&e.userData.holeTarget.name;let u;h&&t.traverse(f=>{f.name===h&&(u=f)});const d=new Map;Object.keys(e.userData).forEach(f=>{if(f.startsWith("follow_")){const p=f.split("_")[1];if(p){let g=e.userData[f];d.set(p,{scale:g,origin:this.shapeKeys.get(p)||0})}}});const l=(s=this._app)==null?void 0:s.props.isMobile,c=new _h({name:n,follows:d,slot:e,show:this._showSlots,isMirror:o,mirrorTarget:a,isMobile:l});return c.holeTarget=u,c.addEventListener(Le.ON_DROP,f=>{this._app&&this._app.props.useSound&&this._app.sound.play()}),c.addEventListener(Le.ON_BEFORE_SELECTED,f=>{this._slots.forEach(p=>{p.selected&&(p.selected=!1)})}),c.addEventListener(Le.ON_ERROR_STATE_CHANGE,f=>{if(this._app)if(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(p=>!!p.parent),f){if(c.device){if(this._app._outlinePassError.selectedObjects.find(g=>{var m;return g.parent==((m=c.device)==null?void 0:m.parent)}))return;this._app._outlinePassError.selectedObjects=[c.device,...this._app._outlinePassError.selectedObjects]}}else c.device&&(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(p=>{var g;return p.parent!=((g=c.device)==null?void 0:g.parent)}))}),c}}}clean(){this._emitter.removeAllListeners(),this.controllers.forEach(e=>e.dispose()),this.controllers=[],ii(this._container),this._levels.forEach(e=>e.destroy()),this._levels.clear(),this._slots=[],this._logos=[],this._skins=[],this._materialsCache.clear(),this.opacityCache=void 0,this._breathLights.forEach(e=>e.stop()),this._breathLights=[],this.sizeBox.reset()}destroy(){this._pointCloudMode&&this._clearPointClouds(),this.clean(),this.sizeBox.destroy()}setPointCloudMode(e){this._pointCloudMode=e,e?(this.sizeBox.hide(),this.controllers.forEach(t=>t.hide()),this.slots.forEach(t=>t.hide()),this._createPointClouds()):(this.sizeBox.show(),this.slots.forEach(t=>t.hide()),this.controllers.forEach(t=>t.show()),this._clearPointClouds())}_createPointClouds(){this._clearPointClouds();const e=[],t=[],i=.02,s=.05,n=1e7;new y.Vector3;const o=new y.Vector3(1/0,1/0,1/0),a=new y.Vector3(-1/0,-1/0,-1/0);this._container.traverse(d=>{if(d instanceof y.Mesh&&d.geometry&&d.visible){this._originalMeshes.set(d.uuid,{mesh:d,visible:d.visible}),d.visible=!1,d.geometry.computeBoundingBox();const l=d.geometry.boundingBox.clone();l.applyMatrix4(d.matrixWorld),o.min(l.min),a.max(l.max);const c=d.geometry,f=c.attributes.position,p=c.index;if(f){d.updateMatrixWorld();const g=d.matrixWorld;if(p){const m=p.array;for(let _=0;_<m.length;_+=3){const v=m[_],x=m[_+1],b=m[_+2],w=new y.Vector3(f.getX(v),f.getY(v),f.getZ(v)).applyMatrix4(g),C=new y.Vector3(f.getX(x),f.getY(x),f.getZ(x)).applyMatrix4(g),S=new y.Vector3(f.getX(b),f.getY(b),f.getZ(b)).applyMatrix4(g);e.length<n*3&&this._generatePointsOnTriangle(w,C,S,i,s,e,t)}}else for(let m=0;m<f.count;m++){const _=new y.Vector3(f.getX(m),f.getY(m),f.getZ(m)).applyMatrix4(g);e.push(_.x,_.y,_.z);const v=(_.y-o.y)/(a.y-o.y);t.push(0,v*.5,.5+v*.5)}}}});const h=this._removeDuplicatePoints(e,t,i*.5),u=1e5;if(h.positions.length>u*3){const d=u*3/h.positions.length,l=[],c=[];for(let f=0;f<h.positions.length;f+=3)Math.random()<d&&(l.push(h.positions[f],h.positions[f+1],h.positions[f+2]),c.push(h.colors[f],h.colors[f+1],h.colors[f+2]));h.positions=l,h.colors=c}if(h.positions.length>0){const d=o.clone().add(a).multiplyScalar(.5),l=a.clone().sub(o),c=Math.max(l.x,l.y,l.z);if(c===0||!isFinite(c)){console.warn("Point cloud generation failed: invalid model bounds");return}const f=new Float32Array(h.positions.length),p=new Float32Array(h.positions),g=new Float32Array(h.colors.length),m=new Float32Array(h.colors);for(let T=0;T<h.positions.length;T+=3){const M=T/3;p[T],p[T+1],p[T+2];const R=M/(h.positions.length/3)*Math.PI*4,E=Math.random(),A=Math.sqrt(E),I=.05+Math.random()*.1,D=c*2.2*(I+A*(1-I)),B=3,k=M%B*(Math.PI*2/B)+R,z=Math.random()*.4,q=D*(1+z),L=A,F=.25+A*.2,Q=(Math.random()<.5?-1:1)*Math.random()*c*F*L,ee=(Math.random()-.5)*c*.25*L,oe=c*.3*(1+A*.5),pe=1.2,ye=.85;f[T]=d.x+Math.cos(k)*q*pe+(Math.random()-.5)*oe,f[T+1]=d.y+Q+ee,f[T+2]=d.z+Math.sin(k)*q*ye+(Math.random()-.5)*oe;const Ae=Math.random(),ae=Math.random()<.1?1.5:1,be=A>.75?.7:A>.5?.4:0,ne=Ae*(1-be);ne<.7?(g[T]=(.1+Math.random()*.2)*ae,g[T+1]=(.6+Math.random()*.4)*ae,g[T+2]=(.8+Math.random()*.2)*ae):ne<.8?(g[T]=(.6+Math.random()*.4)*ae,g[T+1]=(.1+Math.random()*.3)*ae,g[T+2]=(.8+Math.random()*.2)*ae):ne<.92?(g[T]=(.8+Math.random()*.2)*ae,g[T+1]=(.2+Math.random()*.3)*ae,g[T+2]=(.6+Math.random()*.3)*ae):(g[T]=(.9+Math.random()*.1)*ae,g[T+1]=(.4+Math.random()*.3)*ae,g[T+2]=(.1+Math.random()*.2)*ae)}const _=new y.BufferGeometry;_.setAttribute("position",new y.Float32BufferAttribute(f,3)),_.setAttribute("color",new y.Float32BufferAttribute(g,3));const v=new y.PointsMaterial({size:.002,color:"#367BF5",vertexColors:!1,opacity:.1,transparent:!1,depthWrite:!1,sizeAttenuation:!0}),x=new y.Points(_,v);this.add(x),this._pointClouds.push(x);const b=_.attributes.position,w=_.attributes.color,C={progress:0};v.opacity=.3;const S=new Pt.Tween(C).to({progress:1},600).easing(Pt.Easing.Linear.None).onUpdate(()=>{const T=C.progress,M=b.array,P=w.array,R=.6,E=T<R,A=T<.9,I=E?T/R:1,D=I*I,B=D*Math.PI*1.25,k=E?0:(T-R)/(1-R),q=(1-Math.pow(1-k,3))*Math.PI*.75,L=E?B:B+q;for(let G=0;G<M.length;G+=3){const Q=f[G],ee=f[G+1],oe=f[G+2],pe=p[G],ye=p[G+1],Ae=p[G+2],ae=E?D:1,be=Q+(pe-Q)*ae,ne=ee+(ye-ee)*ae,ve=oe+(Ae-oe)*ae,he=be-d.x,Be=ve-d.z;if(E){const Ne=Math.sqrt(he*he+Be*Be),Pi=Math.atan2(Be,he)+L;M[G]=d.x+Math.cos(Pi)*Ne,M[G+1]=ne,M[G+2]=d.z+Math.sin(Pi)*Ne}else{const Ne=Math.sqrt(he*he+Be*Be),Pi=Math.atan2(Be,he)+L;M[G]=d.x+Math.cos(Pi)*Ne,M[G+1]=ne,M[G+2]=d.z+Math.sin(Pi)*Ne}A&&(P[G]=g[G]+(m[G]-g[G])*T,P[G+1]=g[G+1]+(m[G+1]-g[G+1])*T,P[G+2]=g[G+2]+(m[G+2]-g[G+2])*T)}let F=.3;E?F=.3+.4*D:F=.7-.1*k,v.opacity=F,b.needsUpdate=!0,A&&(w.needsUpdate=!0)}).onComplete(()=>{const T=this._pointCloudAnimations.indexOf(S);T>-1&&this._pointCloudAnimations.splice(T,1);const M=new tf.LineMaterial({color:"#222",linewidth:.001,opacity:.1,transparent:!0,depthTest:!0,depthWrite:!1}),P=new y.MeshBasicMaterial({colorWrite:!0,color:"#0000ff",depthWrite:!1,depthTest:!0,transparent:!0,opacity:.12}),R=new y.Mesh(this._mergedGeometry,P);R.renderOrder=0,this.lines.add(R);const E=new y.EdgesGeometry(this._mergedGeometry,15),A=new sg.LineSegmentsGeometry().fromEdgesGeometry(E),I=new rg.LineSegments2(A,M);I.renderOrder=1,this.slots.forEach(D=>D.show()),x.visible=!1}).start();this._pointCloudAnimations.push(S)}}_generatePointsOnTriangle(e,t,i,s,n,o,a){const h=e.distanceTo(t),u=t.distanceTo(i),d=i.distanceTo(e),l=Math.max(h,u,d),c=Math.max(2,Math.ceil(l/s));if(l>n)for(let f=0;f<=c;f++)for(let p=0;p<=c-f;p++){const g=f/c,m=p/c,_=1-g-m;if(_>=0){const v=new y.Vector3().addScaledVector(e,g).addScaledVector(t,m).addScaledVector(i,_);o.push(v.x,v.y,v.z),a.push(0,v.y/5,1-v.y/1.4)}}else{o.push(e.x,e.y,e.z),o.push(t.x,t.y,t.z),o.push(i.x,i.y,i.z);for(let f=0;f<3;f++)a.push(0,0,0)}}_removeDuplicatePoints(e,t,i){const s=[],n=[],o=new Map;for(let a=0;a<e.length;a+=3){const h=e[a],u=e[a+1],d=e[a+2],l=`${Math.round(h/i)}_${Math.round(u/i)}_${Math.round(d/i)}`;o.has(l)||(o.set(l,!0),s.push(h,u,d),n.push(t[a],t[a+1],t[a+2]))}return{positions:s,colors:n}}_clearPointClouds(){this._pointCloudAnimations.forEach(e=>{e.stop()}),this._pointCloudAnimations=[],this._pointClouds.forEach(e=>{e.geometry.dispose(),e.material instanceof y.PointsMaterial&&e.material.dispose(),e.removeFromParent()}),this._pointClouds=[],this._originalMeshes.forEach(({mesh:e,visible:t})=>{e.visible=t}),this._originalMeshes.clear()}playAction(e,t=!0){}pauseAction(e){console.log(`Pausing action: ${e}`)}}const Sm=0,OT=1,kT=2,Gd=2,tl=1.25,zd=1,$s=6*4+4+4,ia=65535,NT=Math.pow(2,-24),il=Symbol("SKIP_GENERATION");function UT(r){return r.index?r.index.count:r.attributes.position.count}function cs(r){return UT(r)/3}function GT(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function zT(r,e){if(!r.index){const t=r.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=GT(t,i);r.setIndex(new y.BufferAttribute(s,1));for(let n=0;n<t;n++)s[n]=n}}function Em(r){const e=cs(r),t=r.drawRange,i=t.start/3,s=(t.start+t.count)/3,n=Math.max(0,i),o=Math.min(e,s)-n;return[{offset:Math.floor(n),count:Math.floor(o)}]}function Cm(r){if(!r.groups||!r.groups.length)return Em(r);const e=[],t=new Set,i=r.drawRange,s=i.start/3,n=(i.start+i.count)/3;for(const a of r.groups){const h=a.start/3,u=(a.start+a.count)/3;t.add(Math.max(s,h)),t.add(Math.min(n,u))}const o=Array.from(t.values()).sort((a,h)=>a-h);for(let a=0;a<o.length-1;a++){const h=o[a],u=o[a+1];e.push({offset:Math.floor(h),count:Math.floor(u-h)})}return e}function HT(r){if(r.groups.length===0)return!1;const e=cs(r),t=Cm(r).sort((n,o)=>n.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return t.forEach(({count:n})=>s+=n),e!==s}function rl(r,e,t,i,s){let n=1/0,o=1/0,a=1/0,h=-1/0,u=-1/0,d=-1/0,l=1/0,c=1/0,f=1/0,p=-1/0,g=-1/0,m=-1/0;for(let _=e*6,v=(e+t)*6;_<v;_+=6){const x=r[_+0],b=r[_+1],w=x-b,C=x+b;w<n&&(n=w),C>h&&(h=C),x<l&&(l=x),x>p&&(p=x);const S=r[_+2],T=r[_+3],M=S-T,P=S+T;M<o&&(o=M),P>u&&(u=P),S<c&&(c=S),S>g&&(g=S);const R=r[_+4],E=r[_+5],A=R-E,I=R+E;A<a&&(a=A),I>d&&(d=I),R<f&&(f=R),R>m&&(m=R)}i[0]=n,i[1]=o,i[2]=a,i[3]=h,i[4]=u,i[5]=d,s[0]=l,s[1]=c,s[2]=f,s[3]=p,s[4]=g,s[5]=m}function VT(r,e=null,t=null,i=null){const s=r.attributes.position,n=r.index?r.index.array:null,o=cs(r),a=s.normalized;let h;e===null?(h=new Float32Array(o*6*4),t=0,i=o):(h=e,t=t||0,i=i||o);const u=s.array,d=s.offset||0;let l=3;s.isInterleavedBufferAttribute&&(l=s.data.stride);const c=["getX","getY","getZ"];for(let f=t;f<t+i;f++){const p=f*3,g=f*6;let m=p+0,_=p+1,v=p+2;n&&(m=n[m],_=n[_],v=n[v]),a||(m=m*l+d,_=_*l+d,v=v*l+d);for(let x=0;x<3;x++){let b,w,C;a?(b=s[c[x]](m),w=s[c[x]](_),C=s[c[x]](v)):(b=u[m+x],w=u[_+x],C=u[v+x]);let S=b;w<S&&(S=w),C<S&&(S=C);let T=b;w>T&&(T=w),C>T&&(T=C);const M=(T-S)/2,P=x*2;h[g+P+0]=S+M,h[g+P+1]=M+(Math.abs(S)+M)*NT}}return h}function xe(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function Hd(r){let e=-1,t=-1/0;for(let i=0;i<3;i++){const s=r[i+3]-r[i];s>t&&(t=s,e=i)}return e}function Vd(r,e){e.set(r)}function Wd(r,e,t){let i,s;for(let n=0;n<3;n++){const o=n+3;i=r[n],s=e[n],t[n]=i<s?i:s,i=r[o],s=e[o],t[o]=i>s?i:s}}function Gn(r,e,t){for(let i=0;i<3;i++){const s=e[r+2*i],n=e[r+2*i+1],o=s-n,a=s+n;o<t[i]&&(t[i]=o),a>t[i+3]&&(t[i+3]=a)}}function bs(r){const e=r[3]-r[0],t=r[4]-r[1],i=r[5]-r[2];return 2*(e*t+t*i+i*e)}const Vt=32,WT=(r,e)=>r.candidate-e.candidate,ai=new Array(Vt).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),zn=new Float32Array(6);function $T(r,e,t,i,s,n){let o=-1,a=0;if(n===Sm)o=Hd(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(n===OT)o=Hd(r),o!==-1&&(a=XT(t,i,s,o));else if(n===kT){const h=bs(r);let u=tl*s;const d=i*6,l=(i+s)*6;for(let c=0;c<3;c++){const f=e[c],m=(e[c+3]-f)/Vt;if(s<Vt/4){const _=[...ai];_.length=s;let v=0;for(let b=d;b<l;b+=6,v++){const w=_[v];w.candidate=t[b+2*c],w.count=0;const{bounds:C,leftCacheBounds:S,rightCacheBounds:T}=w;for(let M=0;M<3;M++)T[M]=1/0,T[M+3]=-1/0,S[M]=1/0,S[M+3]=-1/0,C[M]=1/0,C[M+3]=-1/0;Gn(b,t,C)}_.sort(WT);let x=s;for(let b=0;b<x;b++){const w=_[b];for(;b+1<x&&_[b+1].candidate===w.candidate;)_.splice(b+1,1),x--}for(let b=d;b<l;b+=6){const w=t[b+2*c];for(let C=0;C<x;C++){const S=_[C];w>=S.candidate?Gn(b,t,S.rightCacheBounds):(Gn(b,t,S.leftCacheBounds),S.count++)}}for(let b=0;b<x;b++){const w=_[b],C=w.count,S=s-w.count,T=w.leftCacheBounds,M=w.rightCacheBounds;let P=0;C!==0&&(P=bs(T)/h);let R=0;S!==0&&(R=bs(M)/h);const E=zd+tl*(P*C+R*S);E<u&&(o=c,u=E,a=w.candidate)}}else{for(let x=0;x<Vt;x++){const b=ai[x];b.count=0,b.candidate=f+m+x*m;const w=b.bounds;for(let C=0;C<3;C++)w[C]=1/0,w[C+3]=-1/0}for(let x=d;x<l;x+=6){let C=~~((t[x+2*c]-f)/m);C>=Vt&&(C=Vt-1);const S=ai[C];S.count++,Gn(x,t,S.bounds)}const _=ai[Vt-1];Vd(_.bounds,_.rightCacheBounds);for(let x=Vt-2;x>=0;x--){const b=ai[x],w=ai[x+1];Wd(b.bounds,w.rightCacheBounds,b.rightCacheBounds)}let v=0;for(let x=0;x<Vt-1;x++){const b=ai[x],w=b.count,C=b.bounds,T=ai[x+1].rightCacheBounds;w!==0&&(v===0?Vd(C,zn):Wd(C,zn,zn)),v+=w;let M=0,P=0;v!==0&&(M=bs(zn)/h);const R=s-v;R!==0&&(P=bs(T)/h);const E=zd+tl*(M*v+P*R);E<u&&(o=c,u=E,a=b.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:o,pos:a}}function XT(r,e,t,i){let s=0;for(let n=e,o=e+t;n<o;n++)s+=r[n*6+i*2];return s/t}class sl{constructor(){this.boundingData=new Float32Array(6)}}function jT(r,e,t,i,s,n){let o=i,a=i+s-1;const h=n.pos,u=n.axis*2;for(;;){for(;o<=a&&t[o*6+u]<h;)o++;for(;o<=a&&t[a*6+u]>=h;)a--;if(o<a){for(let d=0;d<3;d++){let l=e[o*3+d];e[o*3+d]=e[a*3+d],e[a*3+d]=l}for(let d=0;d<6;d++){let l=t[o*6+d];t[o*6+d]=t[a*6+d],t[a*6+d]=l}o++,a--}else return o}}function YT(r,e,t,i,s,n){let o=i,a=i+s-1;const h=n.pos,u=n.axis*2;for(;;){for(;o<=a&&t[o*6+u]<h;)o++;for(;o<=a&&t[a*6+u]>=h;)a--;if(o<a){let d=r[o];r[o]=r[a],r[a]=d;for(let l=0;l<6;l++){let c=t[o*6+l];t[o*6+l]=t[a*6+l],t[a*6+l]=c}o++,a--}else return o}}function Xe(r,e){return e[r+15]===65535}function Qe(r,e){return e[r+6]}function rt(r,e){return e[r+14]}function st(r){return r+8}function nt(r,e){return e[r+6]}function Mm(r,e){return e[r+7]}let Im,Ls,po,Pm;const qT=Math.pow(2,32);function vh(r){return"count"in r?1:1+vh(r.left)+vh(r.right)}function ZT(r,e,t){return Im=new Float32Array(t),Ls=new Uint32Array(t),po=new Uint16Array(t),Pm=new Uint8Array(t),xh(r,e)}function xh(r,e){const t=r/4,i=r/2,s="count"in e,n=e.boundingData;for(let o=0;o<6;o++)Im[t+o]=n[o];if(s)if(e.buffer){const o=e.buffer;Pm.set(new Uint8Array(o),r);for(let a=r,h=r+o.byteLength;a<h;a+=$s){const u=a/2;Xe(u,po)||(Ls[a/4+6]+=t)}return r+o.byteLength}else{const o=e.offset,a=e.count;return Ls[t+6]=o,po[i+14]=a,po[i+15]=ia,r+$s}else{const o=e.left,a=e.right,h=e.splitAxis;let u;if(u=xh(r+$s,o),u/4>qT)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Ls[t+6]=u/4,u=xh(u,a),Ls[t+7]=h,u}}function KT(r,e){const t=(r.index?r.index.count:r.attributes.position.count)/3,i=t>2**16,s=i?4:2,n=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),o=i?new Uint32Array(n):new Uint16Array(n);for(let a=0,h=o.length;a<h;a++)o[a]=a;return o}function QT(r,e,t,i,s){const{maxDepth:n,verbose:o,maxLeafTris:a,strategy:h,onProgress:u,indirect:d}=s,l=r._indirectBuffer,c=r.geometry,f=c.index?c.index.array:null,p=d?YT:jT,g=cs(c),m=new Float32Array(6);let _=!1;const v=new sl;return rl(e,t,i,v.boundingData,m),b(v,t,i,m),v;function x(w){u&&u(w/g)}function b(w,C,S,T=null,M=0){if(!_&&M>=n&&(_=!0,o&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(c))),S<=a||M>=n)return x(C+S),w.offset=C,w.count=S,w;const P=$T(w.boundingData,T,e,C,S,h);if(P.axis===-1)return x(C+S),w.offset=C,w.count=S,w;const R=p(l,f,e,C,S,P);if(R===C||R===C+S)x(C+S),w.offset=C,w.count=S;else{w.splitAxis=P.axis;const E=new sl,A=C,I=R-C;w.left=E,rl(e,A,I,E.boundingData,m),b(E,A,I,m,M+1);const D=new sl,B=R,k=S-I;w.right=D,rl(e,B,k,D.boundingData,m),b(D,B,k,m,M+1)}return w}}function JT(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=KT(t,e.useSharedArrayBuffer),HT(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||zT(t,e);const i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=VT(t),n=e.indirect?Em(t):Cm(t);r._roots=n.map(o=>{const a=QT(r,s,o.offset,o.count,e),h=vh(a),u=new i($s*h);return ZT(0,a,u),u})}class ri{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,o=e.length;n<o;n++){const h=e[n][t];i=h<i?h:i,s=h>s?h:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,o=t.length;n<o;n++){const a=t[n],h=e.dot(a);i=h<i?h:i,s=h>s?h:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}ri.prototype.setFromBox=function(){const r=new y.Vector3;return function(t,i){const s=i.min,n=i.max;let o=1/0,a=-1/0;for(let h=0;h<=1;h++)for(let u=0;u<=1;u++)for(let d=0;d<=1;d++){r.x=s.x*h+n.x*(1-h),r.y=s.y*u+n.y*(1-u),r.z=s.z*d+n.z*(1-d);const l=t.dot(r);o=Math.min(l,o),a=Math.max(l,a)}this.min=o,this.max=a}}();const eS=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Vector3;return function(s,n,o){const a=s.start,h=r,u=n.start,d=e;t.subVectors(a,u),r.subVectors(s.end,s.start),e.subVectors(n.end,n.start);const l=t.dot(d),c=d.dot(h),f=d.dot(d),p=t.dot(h),m=h.dot(h)*f-c*c;let _,v;m!==0?_=(l*c-p*f)/m:_=0,v=(l+_*c)/f,o.x=_,o.y=v}}(),lc=function(){const r=new y.Vector2,e=new y.Vector3,t=new y.Vector3;return function(s,n,o,a){eS(s,n,r);let h=r.x,u=r.y;if(h>=0&&h<=1&&u>=0&&u<=1){s.at(h,o),n.at(u,a);return}else if(h>=0&&h<=1){u<0?n.at(0,a):n.at(1,a),s.closestPointToPoint(a,!0,o);return}else if(u>=0&&u<=1){h<0?s.at(0,o):s.at(1,o),n.closestPointToPoint(o,!0,a);return}else{let d;h<0?d=s.start:d=s.end;let l;u<0?l=n.start:l=n.end;const c=e,f=t;if(s.closestPointToPoint(l,!0,e),n.closestPointToPoint(d,!0,t),c.distanceToSquared(l)<=f.distanceToSquared(d)){o.copy(c),a.copy(l);return}else{o.copy(d),a.copy(f);return}}}}(),tS=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Plane,i=new y.Line3;return function(n,o){const{radius:a,center:h}=n,{a:u,b:d,c:l}=o;if(i.start=u,i.end=d,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a||(i.start=u,i.end=l,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a)||(i.start=d,i.end=l,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a))return!0;const g=o.getPlane(t);if(Math.abs(g.distanceToPoint(h))<=a){const _=g.projectPoint(h,e);if(o.containsPoint(_))return!0}return!1}}(),iS=1e-15;function nl(r){return Math.abs(r)<iS}class xt extends y.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new y.Vector3),this.satBounds=new Array(4).fill().map(()=>new ri),this.points=[this.a,this.b,this.c],this.sphere=new y.Sphere,this.plane=new y.Plane,this.needsUpdate=!0}intersectsSphere(e){return tS(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,o=this.satBounds,a=n[0],h=o[0];this.getNormal(a),h.setFromPoints(a,s);const u=n[1],d=o[1];u.subVectors(e,t),d.setFromPoints(u,s);const l=n[2],c=o[2];l.subVectors(t,i),c.setFromPoints(l,s);const f=n[3],p=o[3];f.subVectors(i,e),p.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}xt.prototype.closestPointToSegment=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Line3;return function(s,n=null,o=null){const{start:a,end:h}=s,u=this.points;let d,l=1/0;for(let c=0;c<3;c++){const f=(c+1)%3;t.start.copy(u[c]),t.end.copy(u[f]),lc(t,s,r,e),d=r.distanceToSquared(e),d<l&&(l=d,n&&n.copy(r),o&&o.copy(e))}return this.closestPointToPoint(a,r),d=a.distanceToSquared(r),d<l&&(l=d,n&&n.copy(r),o&&o.copy(a)),this.closestPointToPoint(h,r),d=h.distanceToSquared(r),d<l&&(l=d,n&&n.copy(r),o&&o.copy(h)),Math.sqrt(l)}}();xt.prototype.intersectsTriangle=function(){const r=new xt,e=new Array(3),t=new Array(3),i=new ri,s=new ri,n=new y.Vector3,o=new y.Vector3,a=new y.Vector3,h=new y.Vector3,u=new y.Vector3,d=new y.Line3,l=new y.Line3,c=new y.Line3,f=new y.Vector3;function p(g,m,_){const v=g.points;let x=0,b=-1;for(let w=0;w<3;w++){const{start:C,end:S}=d;C.copy(v[w]),S.copy(v[(w+1)%3]),d.delta(o);const T=nl(m.distanceToPoint(C));if(nl(m.normal.dot(o))&&T){_.copy(d),x=2;break}const M=m.intersectLine(d,f);if(!M&&T&&f.copy(C),(M||T)&&!nl(f.distanceTo(S))){if(x<=1)(x===1?_.start:_.end).copy(f),T&&(b=x);else if(x>=2){(b===1?_.start:_.end).copy(f),x=2;break}if(x++,x===2&&b===-1)break}}return x}return function(m,_=null,v=!1){this.needsUpdate&&this.update(),m.isExtendedTriangle?m.needsUpdate&&m.update():(r.copy(m),r.update(),m=r);const x=this.plane,b=m.plane;if(Math.abs(x.normal.dot(b.normal))>1-1e-10){const w=this.satBounds,C=this.satAxes;t[0]=m.a,t[1]=m.b,t[2]=m.c;for(let M=0;M<4;M++){const P=w[M],R=C[M];if(i.setFromPoints(R,t),P.isSeparated(i))return!1}const S=m.satBounds,T=m.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let M=0;M<4;M++){const P=S[M],R=T[M];if(i.setFromPoints(R,e),P.isSeparated(i))return!1}for(let M=0;M<4;M++){const P=C[M];for(let R=0;R<4;R++){const E=T[R];if(n.crossVectors(P,E),i.setFromPoints(n,e),s.setFromPoints(n,t),i.isSeparated(s))return!1}}return _&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),_.start.set(0,0,0),_.end.set(0,0,0)),!0}else{const w=p(this,b,l);if(w===1&&m.containsPoint(l.end))return _&&(_.start.copy(l.end),_.end.copy(l.end)),!0;if(w!==2)return!1;const C=p(m,x,c);if(C===1&&this.containsPoint(c.end))return _&&(_.start.copy(c.end),_.end.copy(c.end)),!0;if(C!==2)return!1;if(l.delta(a),c.delta(h),a.dot(h)<0){let A=c.start;c.start=c.end,c.end=A}const S=l.start.dot(a),T=l.end.dot(a),M=c.start.dot(a),P=c.end.dot(a),R=T<M,E=S<P;return S!==P&&M!==T&&R===E?!1:(_&&(u.subVectors(l.start,c.start),u.dot(a)>0?_.start.copy(l.start):_.start.copy(c.start),u.subVectors(l.end,c.end),u.dot(a)<0?_.end.copy(l.end):_.end.copy(c.end)),!0)}}}();xt.prototype.distanceToPoint=function(){const r=new y.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();xt.prototype.distanceToTriangle=function(){const r=new y.Vector3,e=new y.Vector3,t=["a","b","c"],i=new y.Line3,s=new y.Line3;return function(o,a=null,h=null){const u=a||h?i:null;if(this.intersectsTriangle(o,u))return(a||h)&&(a&&u.getCenter(a),h&&u.getCenter(h)),0;let d=1/0;for(let l=0;l<3;l++){let c;const f=t[l],p=o[f];this.closestPointToPoint(p,r),c=p.distanceToSquared(r),c<d&&(d=c,a&&a.copy(r),h&&h.copy(p));const g=this[f];o.closestPointToPoint(g,r),c=g.distanceToSquared(r),c<d&&(d=c,a&&a.copy(g),h&&h.copy(r))}for(let l=0;l<3;l++){const c=t[l],f=t[(l+1)%3];i.set(this[c],this[f]);for(let p=0;p<3;p++){const g=t[p],m=t[(p+1)%3];s.set(o[g],o[m]),lc(i,s,r,e);const _=r.distanceToSquared(e);_<d&&(d=_,a&&a.copy(r),h&&h.copy(e))}}return Math.sqrt(d)}}();class Ve{constructor(e,t,i){this.isOrientedBox=!0,this.min=new y.Vector3,this.max=new y.Vector3,this.matrix=new y.Matrix4,this.invMatrix=new y.Matrix4,this.points=new Array(8).fill().map(()=>new y.Vector3),this.satAxes=new Array(3).fill().map(()=>new y.Vector3),this.satBounds=new Array(3).fill().map(()=>new ri),this.alignedSatBounds=new Array(3).fill().map(()=>new ri),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ve.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let u=0;u<=1;u++)for(let d=0;d<=1;d++)for(let l=0;l<=1;l++){const c=1*u|2*d|4*l,f=s[c];f.x=u?i.x:t.x,f.y=d?i.y:t.y,f.z=l?i.z:t.z,f.applyMatrix4(e)}const n=this.satBounds,o=this.satAxes,a=s[0];for(let u=0;u<3;u++){const d=o[u],l=n[u],c=1<<u,f=s[c];d.subVectors(a,f),l.setFromPoints(d,s)}const h=this.alignedSatBounds;h[0].setFromPointsField(s,"x"),h[1].setFromPointsField(s,"y"),h[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Ve.prototype.intersectsBox=function(){const r=new ri;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,o=this.satAxes,a=this.alignedSatBounds;if(r.min=i.x,r.max=s.x,a[0].isSeparated(r)||(r.min=i.y,r.max=s.y,a[1].isSeparated(r))||(r.min=i.z,r.max=s.z,a[2].isSeparated(r)))return!1;for(let h=0;h<3;h++){const u=o[h],d=n[h];if(r.setFromBox(u,t),d.isSeparated(r))return!1}return!0}}();Ve.prototype.intersectsTriangle=function(){const r=new xt,e=new Array(3),t=new ri,i=new ri,s=new y.Vector3;return function(o){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(r.copy(o),r.update(),o=r);const a=this.satBounds,h=this.satAxes;e[0]=o.a,e[1]=o.b,e[2]=o.c;for(let c=0;c<3;c++){const f=a[c],p=h[c];if(t.setFromPoints(p,e),f.isSeparated(t))return!1}const u=o.satBounds,d=o.satAxes,l=this.points;for(let c=0;c<3;c++){const f=u[c],p=d[c];if(t.setFromPoints(p,l),f.isSeparated(t))return!1}for(let c=0;c<3;c++){const f=h[c];for(let p=0;p<4;p++){const g=d[p];if(s.crossVectors(f,g),t.setFromPoints(s,e),i.setFromPoints(s,l),t.isSeparated(i))return!1}}return!0}}();Ve.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Ve.prototype.distanceToPoint=function(){const r=new y.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();Ve.prototype.distanceToBox=function(){const r=["x","y","z"],e=new Array(12).fill().map(()=>new y.Line3),t=new Array(12).fill().map(()=>new y.Line3),i=new y.Vector3,s=new y.Vector3;return function(o,a=0,h=null,u=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(h||u)&&(o.getCenter(s),this.closestPointToPoint(s,i),o.closestPointToPoint(i,s),h&&h.copy(i),u&&u.copy(s)),0;const d=a*a,l=o.min,c=o.max,f=this.points;let p=1/0;for(let m=0;m<8;m++){const _=f[m];s.copy(_).clamp(l,c);const v=_.distanceToSquared(s);if(v<p&&(p=v,h&&h.copy(_),u&&u.copy(s),v<d))return Math.sqrt(v)}let g=0;for(let m=0;m<3;m++)for(let _=0;_<=1;_++)for(let v=0;v<=1;v++){const x=(m+1)%3,b=(m+2)%3,w=_<<x|v<<b,C=1<<m|_<<x|v<<b,S=f[w],T=f[C];e[g].set(S,T);const P=r[m],R=r[x],E=r[b],A=t[g],I=A.start,D=A.end;I[P]=l[P],I[R]=_?l[R]:c[R],I[E]=v?l[E]:c[R],D[P]=c[P],D[R]=_?l[R]:c[R],D[E]=v?l[E]:c[R],g++}for(let m=0;m<=1;m++)for(let _=0;_<=1;_++)for(let v=0;v<=1;v++){s.x=m?c.x:l.x,s.y=_?c.y:l.y,s.z=v?c.z:l.z,this.closestPointToPoint(s,i);const x=s.distanceToSquared(i);if(x<p&&(p=x,h&&h.copy(i),u&&u.copy(s),x<d))return Math.sqrt(x)}for(let m=0;m<12;m++){const _=e[m];for(let v=0;v<12;v++){const x=t[v];lc(_,x,i,s);const b=i.distanceToSquared(s);if(b<p&&(p=b,h&&h.copy(i),u&&u.copy(s),b<d))return Math.sqrt(b)}}return Math.sqrt(p)}}();class hc{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class rS extends hc{constructor(){super(()=>new xt)}}const ot=new rS;class sS{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const fe=new sS;let bi,Ur;const gr=[],Hn=new hc(()=>new y.Box3);function nS(r,e,t,i,s,n){bi=Hn.getPrimitive(),Ur=Hn.getPrimitive(),gr.push(bi,Ur),fe.setBuffer(r._roots[e]);const o=bh(0,r.geometry,t,i,s,n);fe.clearBuffer(),Hn.releasePrimitive(bi),Hn.releasePrimitive(Ur),gr.pop(),gr.pop();const a=gr.length;return a>0&&(Ur=gr[a-1],bi=gr[a-2]),o}function bh(r,e,t,i,s=null,n=0,o=0){const{float32Array:a,uint16Array:h,uint32Array:u}=fe;let d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);return xe(r,a,bi),i(c,f,!1,o,n+r,bi)}else{let P=function(E){const{uint16Array:A,uint32Array:I}=fe;let D=E*2;for(;!Xe(D,A);)E=st(E),D=E*2;return Qe(E,I)},R=function(E){const{uint16Array:A,uint32Array:I}=fe;let D=E*2;for(;!Xe(D,A);)E=nt(E,I),D=E*2;return Qe(E,I)+rt(D,A)};const c=st(r),f=nt(r,u);let p=c,g=f,m,_,v,x;if(s&&(v=bi,x=Ur,xe(p,a,v),xe(g,a,x),m=s(v),_=s(x),_<m)){p=f,g=c;const E=m;m=_,_=E,v=x}v||(v=bi,xe(p,a,v));const b=Xe(p*2,h),w=t(v,b,m,o+1,n+p);let C;if(w===Gd){const E=P(p),I=R(p)-E;C=i(E,I,!0,o+1,n+p,v)}else C=w&&bh(p,e,t,i,s,n,o+1);if(C)return!0;x=Ur,xe(g,a,x);const S=Xe(g*2,h),T=t(x,S,_,o+1,n+g);let M;if(T===Gd){const E=P(g),I=R(g)-E;M=i(E,I,!0,o+1,n+g,x)}else M=T&&bh(g,e,t,i,s,n,o+1);return!!M}}const ws=new y.Vector3,ol=new y.Vector3;function oS(r,e,t={},i=0,s=1/0){const n=i*i,o=s*s;let a=1/0,h=null;if(r.shapecast({boundsTraverseOrder:d=>(ws.copy(e).clamp(d.min,d.max),ws.distanceToSquared(e)),intersectsBounds:(d,l,c)=>c<a&&c<o,intersectsTriangle:(d,l)=>{d.closestPointToPoint(e,ws);const c=e.distanceToSquared(ws);return c<a&&(ol.copy(ws),a=c,h=l),c<n}}),a===1/0)return null;const u=Math.sqrt(a);return t.point?t.point.copy(ol):t.point=ol.clone(),t.distance=u,t.faceIndex=h,t}const _r=new y.Vector3,yr=new y.Vector3,vr=new y.Vector3,Vn=new y.Vector2,Wn=new y.Vector2,$n=new y.Vector2,$d=new y.Vector3,Xd=new y.Vector3,jd=new y.Vector3,Xn=new y.Vector3;function aS(r,e,t,i,s,n,o,a){let h;if(n===y.BackSide?h=r.intersectTriangle(i,t,e,!0,s):h=r.intersectTriangle(e,t,i,n!==y.DoubleSide,s),h===null)return null;const u=r.origin.distanceTo(s);return u<o||u>a?null:{distance:u,point:s.clone()}}function lS(r,e,t,i,s,n,o,a,h,u,d){_r.fromBufferAttribute(e,n),yr.fromBufferAttribute(e,o),vr.fromBufferAttribute(e,a);const l=aS(r,_r,yr,vr,Xn,h,u,d);if(l){i&&(Vn.fromBufferAttribute(i,n),Wn.fromBufferAttribute(i,o),$n.fromBufferAttribute(i,a),l.uv=y.Triangle.getInterpolation(Xn,_r,yr,vr,Vn,Wn,$n,new y.Vector2)),s&&(Vn.fromBufferAttribute(s,n),Wn.fromBufferAttribute(s,o),$n.fromBufferAttribute(s,a),l.uv1=y.Triangle.getInterpolation(Xn,_r,yr,vr,Vn,Wn,$n,new y.Vector2)),t&&($d.fromBufferAttribute(t,n),Xd.fromBufferAttribute(t,o),jd.fromBufferAttribute(t,a),l.normal=y.Triangle.getInterpolation(Xn,_r,yr,vr,$d,Xd,jd,new y.Vector3),l.normal.dot(r.direction)>0&&l.normal.multiplyScalar(-1));const c={a:n,b:o,c:a,normal:new y.Vector3,materialIndex:0};y.Triangle.getNormal(_r,yr,vr,c.normal),l.face=c,l.faceIndex=n}return l}function ra(r,e,t,i,s,n,o){const a=i*3;let h=a+0,u=a+1,d=a+2;const l=r.index;r.index&&(h=l.getX(h),u=l.getX(u),d=l.getX(d));const{position:c,normal:f,uv:p,uv1:g}=r.attributes,m=lS(t,c,f,p,g,h,u,d,e,n,o);return m?(m.faceIndex=i,s&&s.push(m),m):null}function Se(r,e,t,i){const s=r.a,n=r.b,o=r.c;let a=e,h=e+1,u=e+2;t&&(a=t.getX(a),h=t.getX(h),u=t.getX(u)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),n.x=i.getX(h),n.y=i.getY(h),n.z=i.getZ(h),o.x=i.getX(u),o.y=i.getY(u),o.z=i.getZ(u)}function hS(r,e,t,i,s,n,o,a){const{geometry:h,_indirectBuffer:u}=r;for(let d=i,l=i+s;d<l;d++)ra(h,e,t,d,n,o,a)}function cS(r,e,t,i,s,n,o){const{geometry:a,_indirectBuffer:h}=r;let u=1/0,d=null;for(let l=i,c=i+s;l<c;l++){let f;f=ra(a,e,t,l,null,n,o),f&&f.distance<u&&(d=f,u=f.distance)}return d}function uS(r,e,t,i,s,n,o){const{geometry:a}=t,{index:h}=a,u=a.attributes.position;for(let d=r,l=e+r;d<l;d++){let c;if(c=d,Se(o,c*3,h,u),o.needsUpdate=!0,i(o,c,s,n))return!0}return!1}function dS(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,h,u=0;const d=r._roots;for(let c=0,f=d.length;c<f;c++)n=d[c],o=new Uint32Array(n),a=new Uint16Array(n),h=new Float32Array(n),l(0,u),u+=n.byteLength;function l(c,f,p=!1){const g=c*2;if(a[g+15]===ia){const _=o[c+6],v=a[g+14];let x=1/0,b=1/0,w=1/0,C=-1/0,S=-1/0,T=-1/0;for(let M=3*_,P=3*(_+v);M<P;M++){let R=i[M];const E=s.getX(R),A=s.getY(R),I=s.getZ(R);E<x&&(x=E),E>C&&(C=E),A<b&&(b=A),A>S&&(S=A),I<w&&(w=I),I>T&&(T=I)}return h[c+0]!==x||h[c+1]!==b||h[c+2]!==w||h[c+3]!==C||h[c+4]!==S||h[c+5]!==T?(h[c+0]=x,h[c+1]=b,h[c+2]=w,h[c+3]=C,h[c+4]=S,h[c+5]=T,!0):!1}else{const _=c+8,v=o[c+6],x=_+f,b=v+f;let w=p,C=!1,S=!1;e?w||(C=e.has(x),S=e.has(b),w=!C&&!S):(C=!0,S=!0);const T=w||C,M=w||S;let P=!1;T&&(P=l(_,f,w));let R=!1;M&&(R=l(v,f,w));const E=P||R;if(E)for(let A=0;A<3;A++){const I=_+A,D=v+A,B=h[I],k=h[I+3],z=h[D],q=h[D+3];h[c+A]=B<z?B:z,h[c+A+3]=k>q?k:q}return E}}}function Ei(r,e,t,i,s){let n,o,a,h,u,d;const l=1/t.direction.x,c=1/t.direction.y,f=1/t.direction.z,p=t.origin.x,g=t.origin.y,m=t.origin.z;let _=e[r],v=e[r+3],x=e[r+1],b=e[r+3+1],w=e[r+2],C=e[r+3+2];return l>=0?(n=(_-p)*l,o=(v-p)*l):(n=(v-p)*l,o=(_-p)*l),c>=0?(a=(x-g)*c,h=(b-g)*c):(a=(b-g)*c,h=(x-g)*c),n>h||a>o||((a>n||isNaN(n))&&(n=a),(h<o||isNaN(o))&&(o=h),f>=0?(u=(w-m)*f,d=(C-m)*f):(u=(C-m)*f,d=(w-m)*f),n>d||u>o)?!1:((u>n||n!==n)&&(n=u),(d<o||o!==o)&&(o=d),n<=s&&o>=i)}function fS(r,e,t,i,s,n,o,a){const{geometry:h,_indirectBuffer:u}=r;for(let d=i,l=i+s;d<l;d++){let c=u?u[d]:d;ra(h,e,t,c,n,o,a)}}function pS(r,e,t,i,s,n,o){const{geometry:a,_indirectBuffer:h}=r;let u=1/0,d=null;for(let l=i,c=i+s;l<c;l++){let f;f=ra(a,e,t,h?h[l]:l,null,n,o),f&&f.distance<u&&(d=f,u=f.distance)}return d}function mS(r,e,t,i,s,n,o){const{geometry:a}=t,{index:h}=a,u=a.attributes.position;for(let d=r,l=e+r;d<l;d++){let c;if(c=t.resolveTriangleIndex(d),Se(o,c*3,h,u),o.needsUpdate=!0,i(o,c,s,n))return!0}return!1}function gS(r,e,t,i,s,n,o){fe.setBuffer(r._roots[e]),wh(0,r,t,i,s,n,o),fe.clearBuffer()}function wh(r,e,t,i,s,n,o){const{float32Array:a,uint16Array:h,uint32Array:u}=fe,d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);hS(e,t,i,c,f,s,n,o)}else{const c=st(r);Ei(c,a,i,n,o)&&wh(c,e,t,i,s,n,o);const f=nt(r,u);Ei(f,a,i,n,o)&&wh(f,e,t,i,s,n,o)}}const _S=["x","y","z"];function yS(r,e,t,i,s,n){fe.setBuffer(r._roots[e]);const o=Ah(0,r,t,i,s,n);return fe.clearBuffer(),o}function Ah(r,e,t,i,s,n){const{float32Array:o,uint16Array:a,uint32Array:h}=fe;let u=r*2;if(Xe(u,a)){const l=Qe(r,h),c=rt(u,a);return cS(e,t,i,l,c,s,n)}else{const l=Mm(r,h),c=_S[l],p=i.direction[c]>=0;let g,m;p?(g=st(r),m=nt(r,h)):(g=nt(r,h),m=st(r));const v=Ei(g,o,i,s,n)?Ah(g,e,t,i,s,n):null;if(v){const w=v.point[c];if(p?w<=o[m+l]:w>=o[m+l+3])return v}const b=Ei(m,o,i,s,n)?Ah(m,e,t,i,s,n):null;return v&&b?v.distance<=b.distance?v:b:v||b||null}}const jn=new y.Box3,xr=new xt,br=new xt,As=new y.Matrix4,Yd=new Ve,Yn=new Ve;function vS(r,e,t,i){fe.setBuffer(r._roots[e]);const s=Th(0,r,t,i);return fe.clearBuffer(),s}function Th(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=fe;let h=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Yd.set(t.boundingBox.min,t.boundingBox.max,i),s=Yd),Xe(h,o)){const d=e.geometry,l=d.index,c=d.attributes.position,f=t.index,p=t.attributes.position,g=Qe(r,a),m=rt(h,o);if(As.copy(i).invert(),t.boundsTree)return xe(r,n,Yn),Yn.matrix.copy(As),Yn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Yn.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(i),v.b.applyMatrix4(i),v.c.applyMatrix4(i),v.needsUpdate=!0;for(let x=g*3,b=(m+g)*3;x<b;x+=3)if(Se(br,x,l,c),br.needsUpdate=!0,v.intersectsTriangle(br))return!0;return!1}});for(let _=g*3,v=(m+g)*3;_<v;_+=3){Se(xr,_,l,c),xr.a.applyMatrix4(As),xr.b.applyMatrix4(As),xr.c.applyMatrix4(As),xr.needsUpdate=!0;for(let x=0,b=f.count;x<b;x+=3)if(Se(br,x,f,p),br.needsUpdate=!0,xr.intersectsTriangle(br))return!0}}else{const d=r+8,l=a[r+6];return xe(d,n,jn),!!(s.intersectsBox(jn)&&Th(d,e,t,i,s)||(xe(l,n,jn),s.intersectsBox(jn)&&Th(l,e,t,i,s)))}}const qn=new y.Matrix4,al=new Ve,Ts=new Ve,xS=new y.Vector3,bS=new y.Vector3,wS=new y.Vector3,AS=new y.Vector3;function TS(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),al.set(e.boundingBox.min,e.boundingBox.max,t),al.needsUpdate=!0;const a=r.geometry,h=a.attributes.position,u=a.index,d=e.attributes.position,l=e.index,c=ot.getPrimitive(),f=ot.getPrimitive();let p=xS,g=bS,m=null,_=null;s&&(m=wS,_=AS);let v=1/0,x=null,b=null;return qn.copy(t).invert(),Ts.matrix.copy(qn),r.shapecast({boundsTraverseOrder:w=>al.distanceToBox(w),intersectsBounds:(w,C,S)=>S<v&&S<o?(C&&(Ts.min.copy(w.min),Ts.max.copy(w.max),Ts.needsUpdate=!0),!0):!1,intersectsRange:(w,C)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:T=>Ts.distanceToBox(T),intersectsBounds:(T,M,P)=>P<v&&P<o,intersectsRange:(T,M)=>{for(let P=T,R=T+M;P<R;P++){Se(f,3*P,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let E=w,A=w+C;E<A;E++){Se(c,3*E,u,h),c.needsUpdate=!0;const I=c.distanceToTriangle(f,p,m);if(I<v&&(g.copy(p),_&&_.copy(m),v=I,x=E,b=P),I<n)return!0}}}});{const S=cs(e);for(let T=0,M=S;T<M;T++){Se(f,3*T,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=w,R=w+C;P<R;P++){Se(c,3*P,u,h),c.needsUpdate=!0;const E=c.distanceToTriangle(f,p,m);if(E<v&&(g.copy(p),_&&_.copy(m),v=E,x=P,b=T),E<n)return!0}}}}}),ot.releasePrimitive(c),ot.releasePrimitive(f),v===1/0?null:(i.point?i.point.copy(g):i.point=g.clone(),i.distance=v,i.faceIndex=x,s&&(s.point?s.point.copy(_):s.point=_.clone(),s.point.applyMatrix4(qn),g.applyMatrix4(qn),s.distance=g.sub(s.point).length(),s.faceIndex=b),i)}function SS(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,h,u=0;const d=r._roots;for(let c=0,f=d.length;c<f;c++)n=d[c],o=new Uint32Array(n),a=new Uint16Array(n),h=new Float32Array(n),l(0,u),u+=n.byteLength;function l(c,f,p=!1){const g=c*2;if(a[g+15]===ia){const _=o[c+6],v=a[g+14];let x=1/0,b=1/0,w=1/0,C=-1/0,S=-1/0,T=-1/0;for(let M=_,P=_+v;M<P;M++){const R=3*r.resolveTriangleIndex(M);for(let E=0;E<3;E++){let A=R+E;A=i?i[A]:A;const I=s.getX(A),D=s.getY(A),B=s.getZ(A);I<x&&(x=I),I>C&&(C=I),D<b&&(b=D),D>S&&(S=D),B<w&&(w=B),B>T&&(T=B)}}return h[c+0]!==x||h[c+1]!==b||h[c+2]!==w||h[c+3]!==C||h[c+4]!==S||h[c+5]!==T?(h[c+0]=x,h[c+1]=b,h[c+2]=w,h[c+3]=C,h[c+4]=S,h[c+5]=T,!0):!1}else{const _=c+8,v=o[c+6],x=_+f,b=v+f;let w=p,C=!1,S=!1;e?w||(C=e.has(x),S=e.has(b),w=!C&&!S):(C=!0,S=!0);const T=w||C,M=w||S;let P=!1;T&&(P=l(_,f,w));let R=!1;M&&(R=l(v,f,w));const E=P||R;if(E)for(let A=0;A<3;A++){const I=_+A,D=v+A,B=h[I],k=h[I+3],z=h[D],q=h[D+3];h[c+A]=B<z?B:z,h[c+A+3]=k>q?k:q}return E}}}function ES(r,e,t,i,s,n,o){fe.setBuffer(r._roots[e]),Sh(0,r,t,i,s,n,o),fe.clearBuffer()}function Sh(r,e,t,i,s,n,o){const{float32Array:a,uint16Array:h,uint32Array:u}=fe,d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);fS(e,t,i,c,f,s,n,o)}else{const c=st(r);Ei(c,a,i,n,o)&&Sh(c,e,t,i,s,n,o);const f=nt(r,u);Ei(f,a,i,n,o)&&Sh(f,e,t,i,s,n,o)}}const CS=["x","y","z"];function MS(r,e,t,i,s,n){fe.setBuffer(r._roots[e]);const o=Eh(0,r,t,i,s,n);return fe.clearBuffer(),o}function Eh(r,e,t,i,s,n){const{float32Array:o,uint16Array:a,uint32Array:h}=fe;let u=r*2;if(Xe(u,a)){const l=Qe(r,h),c=rt(u,a);return pS(e,t,i,l,c,s,n)}else{const l=Mm(r,h),c=CS[l],p=i.direction[c]>=0;let g,m;p?(g=st(r),m=nt(r,h)):(g=nt(r,h),m=st(r));const v=Ei(g,o,i,s,n)?Eh(g,e,t,i,s,n):null;if(v){const w=v.point[c];if(p?w<=o[m+l]:w>=o[m+l+3])return v}const b=Ei(m,o,i,s,n)?Eh(m,e,t,i,s,n):null;return v&&b?v.distance<=b.distance?v:b:v||b||null}}const Zn=new y.Box3,wr=new xt,Ar=new xt,Ss=new y.Matrix4,qd=new Ve,Kn=new Ve;function IS(r,e,t,i){fe.setBuffer(r._roots[e]);const s=Ch(0,r,t,i);return fe.clearBuffer(),s}function Ch(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=fe;let h=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),qd.set(t.boundingBox.min,t.boundingBox.max,i),s=qd),Xe(h,o)){const d=e.geometry,l=d.index,c=d.attributes.position,f=t.index,p=t.attributes.position,g=Qe(r,a),m=rt(h,o);if(Ss.copy(i).invert(),t.boundsTree)return xe(r,n,Kn),Kn.matrix.copy(Ss),Kn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Kn.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(i),v.b.applyMatrix4(i),v.c.applyMatrix4(i),v.needsUpdate=!0;for(let x=g,b=m+g;x<b;x++)if(Se(Ar,3*e.resolveTriangleIndex(x),l,c),Ar.needsUpdate=!0,v.intersectsTriangle(Ar))return!0;return!1}});for(let _=g,v=m+g;_<v;_++){const x=e.resolveTriangleIndex(_);Se(wr,3*x,l,c),wr.a.applyMatrix4(Ss),wr.b.applyMatrix4(Ss),wr.c.applyMatrix4(Ss),wr.needsUpdate=!0;for(let b=0,w=f.count;b<w;b+=3)if(Se(Ar,b,f,p),Ar.needsUpdate=!0,wr.intersectsTriangle(Ar))return!0}}else{const d=r+8,l=a[r+6];return xe(d,n,Zn),!!(s.intersectsBox(Zn)&&Ch(d,e,t,i,s)||(xe(l,n,Zn),s.intersectsBox(Zn)&&Ch(l,e,t,i,s)))}}const Qn=new y.Matrix4,ll=new Ve,Es=new Ve,PS=new y.Vector3,RS=new y.Vector3,DS=new y.Vector3,BS=new y.Vector3;function FS(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),ll.set(e.boundingBox.min,e.boundingBox.max,t),ll.needsUpdate=!0;const a=r.geometry,h=a.attributes.position,u=a.index,d=e.attributes.position,l=e.index,c=ot.getPrimitive(),f=ot.getPrimitive();let p=PS,g=RS,m=null,_=null;s&&(m=DS,_=BS);let v=1/0,x=null,b=null;return Qn.copy(t).invert(),Es.matrix.copy(Qn),r.shapecast({boundsTraverseOrder:w=>ll.distanceToBox(w),intersectsBounds:(w,C,S)=>S<v&&S<o?(C&&(Es.min.copy(w.min),Es.max.copy(w.max),Es.needsUpdate=!0),!0):!1,intersectsRange:(w,C)=>{if(e.boundsTree){const S=e.boundsTree;return S.shapecast({boundsTraverseOrder:T=>Es.distanceToBox(T),intersectsBounds:(T,M,P)=>P<v&&P<o,intersectsRange:(T,M)=>{for(let P=T,R=T+M;P<R;P++){const E=S.resolveTriangleIndex(P);Se(f,3*E,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let A=w,I=w+C;A<I;A++){const D=r.resolveTriangleIndex(A);Se(c,3*D,u,h),c.needsUpdate=!0;const B=c.distanceToTriangle(f,p,m);if(B<v&&(g.copy(p),_&&_.copy(m),v=B,x=A,b=P),B<n)return!0}}}})}else{const S=cs(e);for(let T=0,M=S;T<M;T++){Se(f,3*T,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=w,R=w+C;P<R;P++){const E=r.resolveTriangleIndex(P);Se(c,3*E,u,h),c.needsUpdate=!0;const A=c.distanceToTriangle(f,p,m);if(A<v&&(g.copy(p),_&&_.copy(m),v=A,x=P,b=T),A<n)return!0}}}}}),ot.releasePrimitive(c),ot.releasePrimitive(f),v===1/0?null:(i.point?i.point.copy(g):i.point=g.clone(),i.distance=v,i.faceIndex=x,s&&(s.point?s.point.copy(_):s.point=_.clone(),s.point.applyMatrix4(Qn),g.applyMatrix4(Qn),s.distance=g.sub(s.point).length(),s.faceIndex=b),i)}function LS(){return typeof SharedArrayBuffer<"u"}const Xs=new fe.constructor,Ho=new fe.constructor,fi=new hc(()=>new y.Box3),Tr=new y.Box3,Sr=new y.Box3,hl=new y.Box3,cl=new y.Box3;let ul=!1;function OS(r,e,t,i){if(ul)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");ul=!0;const s=r._roots,n=e._roots;let o,a=0,h=0;const u=new y.Matrix4().copy(t).invert();for(let d=0,l=s.length;d<l;d++){Xs.setBuffer(s[d]),h=0;const c=fi.getPrimitive();xe(0,Xs.float32Array,c),c.applyMatrix4(u);for(let f=0,p=n.length;f<p&&(Ho.setBuffer(n[d]),o=ft(0,0,t,u,i,a,h,0,0,c),Ho.clearBuffer(),h+=n[f].length,!o);f++);if(fi.releasePrimitive(c),Xs.clearBuffer(),a+=s[d].length,o)break}return ul=!1,o}function ft(r,e,t,i,s,n=0,o=0,a=0,h=0,u=null,d=!1){let l,c;d?(l=Ho,c=Xs):(l=Xs,c=Ho);const f=l.float32Array,p=l.uint32Array,g=l.uint16Array,m=c.float32Array,_=c.uint32Array,v=c.uint16Array,x=r*2,b=e*2,w=Xe(x,g),C=Xe(b,v);let S=!1;if(C&&w)d?S=s(Qe(e,_),rt(e*2,v),Qe(r,p),rt(r*2,g),h,o+e,a,n+r):S=s(Qe(r,p),rt(r*2,g),Qe(e,_),rt(e*2,v),a,n+r,h,o+e);else if(C){const T=fi.getPrimitive();xe(e,m,T),T.applyMatrix4(t);const M=st(r),P=nt(r,p);xe(M,f,Tr),xe(P,f,Sr);const R=T.intersectsBox(Tr),E=T.intersectsBox(Sr);S=R&&ft(e,M,i,t,s,o,n,h,a+1,T,!d)||E&&ft(e,P,i,t,s,o,n,h,a+1,T,!d),fi.releasePrimitive(T)}else{const T=st(e),M=nt(e,_);xe(T,m,hl),xe(M,m,cl);const P=u.intersectsBox(hl),R=u.intersectsBox(cl);if(P&&R)S=ft(r,T,t,i,s,n,o,a,h+1,u,d)||ft(r,M,t,i,s,n,o,a,h+1,u,d);else if(P)if(w)S=ft(r,T,t,i,s,n,o,a,h+1,u,d);else{const E=fi.getPrimitive();E.copy(hl).applyMatrix4(t);const A=st(r),I=nt(r,p);xe(A,f,Tr),xe(I,f,Sr);const D=E.intersectsBox(Tr),B=E.intersectsBox(Sr);S=D&&ft(T,A,i,t,s,o,n,h,a+1,E,!d)||B&&ft(T,I,i,t,s,o,n,h,a+1,E,!d),fi.releasePrimitive(E)}else if(R)if(w)S=ft(r,M,t,i,s,n,o,a,h+1,u,d);else{const E=fi.getPrimitive();E.copy(cl).applyMatrix4(t);const A=st(r),I=nt(r,p);xe(A,f,Tr),xe(I,f,Sr);const D=E.intersectsBox(Tr),B=E.intersectsBox(Sr);S=D&&ft(M,A,i,t,s,o,n,h,a+1,E,!d)||B&&ft(M,I,i,t,s,o,n,h,a+1,E,!d),fi.releasePrimitive(E)}}return S}const Jn=new Ve,Zd=new y.Box3,kS={strategy:Sm,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0};class cc{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,o=i.getIndex();let a;return t.cloneBuffers?a={roots:s.map(h=>h.slice()),index:o?o.array.slice():null,indirectBuffer:n?n.slice():null}:a={roots:s,index:o?o.array:null,indirectBuffer:n},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:s,roots:n,indirectBuffer:o}=e,a=new cc(t,{...i,[il]:!0});if(a._roots=n,a._indirectBuffer=o||null,i.setIndex){const h=t.getIndex();if(h===null){const u=new y.BufferAttribute(e.index,1,!1);t.setIndex(u)}else h.array!==s&&(h.array.set(s),h.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...kS,[il]:!1},t),t.useSharedArrayBuffer&&!LS())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[il]||(JT(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new y.Box3))),this.resolveTriangleIndex=t.indirect?i=>this._indirectBuffer[i]:i=>i}refit(e=null){return(this.indirect?SS:dS)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);o(0);function o(a,h=0){const u=a*2,d=n[u+15]===ia;if(d){const l=s[a+6],c=n[u+14];e(h,d,new Float32Array(i,a*4,6),l,c)}else{const l=a+$s/4,c=s[a+6],f=s[a+7];e(h,d,new Float32Array(i,a*4,6),f)||(o(l,h+1),o(c,h+1))}}}raycast(e,t=y.FrontSide,i=0,s=1/0){const n=this._roots,o=this.geometry,a=[],h=t.isMaterial,u=Array.isArray(t),d=o.groups,l=h?t.side:t,c=this.indirect?ES:gS;for(let f=0,p=n.length;f<p;f++){const g=u?t[d[f].materialIndex].side:l,m=a.length;if(c(this,f,g,e,a,i,s),u){const _=d[f].materialIndex;for(let v=m,x=a.length;v<x;v++)a[v].face.materialIndex=_}}return a}raycastFirst(e,t=y.FrontSide,i=0,s=1/0){const n=this._roots,o=this.geometry,a=t.isMaterial,h=Array.isArray(t);let u=null;const d=o.groups,l=a?t.side:t,c=this.indirect?MS:yS;for(let f=0,p=n.length;f<p;f++){const g=h?t[d[f].materialIndex].side:l,m=c(this,f,g,e,i,s);m!=null&&(u==null||m.distance<u.distance)&&(u=m,h&&(m.face.materialIndex=d[f].materialIndex))}return u}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?IS:vS;for(let o=0,a=s.length;o<a&&(i=n(this,o,e,t),!i);o++);return i}shapecast(e){const t=ot.getPrimitive(),i=this.indirect?mS:uS;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:o,intersectsTriangle:a}=e;if(o&&a){const l=o;o=(c,f,p,g,m)=>l(c,f,p,g,m)?!0:i(c,f,this,a,p,g,t)}else o||(a?o=(l,c,f,p)=>i(l,c,this,a,f,p,t):o=(l,c,f)=>f);let h=!1,u=0;const d=this._roots;for(let l=0,c=d.length;l<c;l++){const f=d[l];if(h=nS(this,l,n,o,s,u),h)break;u+=f.byteLength}return ot.releasePrimitive(t),h}bvhcast(e,t,i){let{intersectsRanges:s,intersectsTriangles:n}=i;const o=ot.getPrimitive(),a=this.geometry.index,h=this.geometry.attributes.position,u=this.indirect?p=>{const g=this.resolveTriangleIndex(p);Se(o,g*3,a,h)}:p=>{Se(o,p*3,a,h)},d=ot.getPrimitive(),l=e.geometry.index,c=e.geometry.attributes.position,f=e.indirect?p=>{const g=e.resolveTriangleIndex(p);Se(d,g*3,l,c)}:p=>{Se(d,p*3,l,c)};if(n){const p=(g,m,_,v,x,b,w,C)=>{for(let S=_,T=_+v;S<T;S++){f(S),d.a.applyMatrix4(t),d.b.applyMatrix4(t),d.c.applyMatrix4(t),d.needsUpdate=!0;for(let M=g,P=g+m;M<P;M++)if(u(M),o.needsUpdate=!0,n(o,d,M,S,x,b,w,C))return!0}return!1};if(s){const g=s;s=function(m,_,v,x,b,w,C,S){return g(m,_,v,x,b,w,C,S)?!0:p(m,_,v,x,b,w,C,S)}}else s=p}return OS(this,e,t,s)}intersectsBox(e,t){return Jn.set(e.min,e.max,t),Jn.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Jn.intersectsBox(i),intersectsTriangle:i=>Jn.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,o=1/0){return(this.indirect?FS:TS)(this,e,t,i,s,n,o)}closestPointToPoint(e,t={},i=0,s=1/0){return oS(this,e,t,i,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(i=>{xe(0,new Float32Array(i),Zd),e.union(Zd)}),e}}class NS{constructor(e){this.name="WorkerBase",this.running=!1,this.worker=e,this.worker.onerror=t=>{throw t.message?new Error(`${this.name}: Could not create Web Worker with error "${t.message}"`):new Error(`${this.name}: Could not create Web Worker.`)}}runTask(){}generate(...e){if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");if(this.worker===null)throw new Error("GenerateMeshBVHWorker: Worker has been disposed.");this.running=!0;const t=this.runTask(this.worker,...e);return t.finally(()=>{this.running=!1}),t}dispose(){this.worker.terminate(),this.worker=null}}class US extends NS{constructor(e){const t=new Worker(e||new URL("data:text/javascript;base64,aW1wb3J0IHsKCUJ1ZmZlckdlb21ldHJ5LAoJQnVmZmVyQXR0cmlidXRlLAp9IGZyb20gJ3RocmVlJzsKaW1wb3J0IHsgTWVzaEJWSCB9IGZyb20gJy4uL2NvcmUvTWVzaEJWSC5qcyc7Cgpvbm1lc3NhZ2UgPSAoIHsgZGF0YSB9ICkgPT4gewoKCWxldCBwcmV2VGltZSA9IHBlcmZvcm1hbmNlLm5vdygpOwoJZnVuY3Rpb24gb25Qcm9ncmVzc0NhbGxiYWNrKCBwcm9ncmVzcyApIHsKCgkJLy8gYWNjb3VudCBmb3IgZXJyb3IKCQlwcm9ncmVzcyA9IE1hdGgubWluKCBwcm9ncmVzcywgMSApOwoKCQljb25zdCBjdXJyVGltZSA9IHBlcmZvcm1hbmNlLm5vdygpOwoJCWlmICggY3VyclRpbWUgLSBwcmV2VGltZSA+PSAxMCAmJiBwcm9ncmVzcyAhPT0gMS4wICkgewoKCQkJcG9zdE1lc3NhZ2UoIHsKCgkJCQllcnJvcjogbnVsbCwKCQkJCXNlcmlhbGl6ZWQ6IG51bGwsCgkJCQlwb3NpdGlvbjogbnVsbCwKCQkJCXByb2dyZXNzLAoKCQkJfSApOwoJCQlwcmV2VGltZSA9IGN1cnJUaW1lOwoKCQl9CgoJfQoKCWNvbnN0IHsgaW5kZXgsIHBvc2l0aW9uLCBvcHRpb25zIH0gPSBkYXRhOwoJdHJ5IHsKCgkJY29uc3QgZ2VvbWV0cnkgPSBuZXcgQnVmZmVyR2VvbWV0cnkoKTsKCQlnZW9tZXRyeS5zZXRBdHRyaWJ1dGUoICdwb3NpdGlvbicsIG5ldyBCdWZmZXJBdHRyaWJ1dGUoIHBvc2l0aW9uLCAzLCBmYWxzZSApICk7CgkJaWYgKCBpbmRleCApIHsKCgkJCWdlb21ldHJ5LnNldEluZGV4KCBuZXcgQnVmZmVyQXR0cmlidXRlKCBpbmRleCwgMSwgZmFsc2UgKSApOwoKCQl9CgoJCWlmICggb3B0aW9ucy5pbmNsdWRlZFByb2dyZXNzQ2FsbGJhY2sgKSB7CgoJCQlvcHRpb25zLm9uUHJvZ3Jlc3MgPSBvblByb2dyZXNzQ2FsbGJhY2s7CgoJCX0KCgkJaWYgKCBvcHRpb25zLmdyb3VwcyApIHsKCgkJCWNvbnN0IGdyb3VwcyA9IG9wdGlvbnMuZ3JvdXBzOwoJCQlmb3IgKCBjb25zdCBpIGluIGdyb3VwcyApIHsKCgkJCQljb25zdCBncm91cCA9IGdyb3Vwc1sgaSBdOwoJCQkJZ2VvbWV0cnkuYWRkR3JvdXAoIGdyb3VwLnN0YXJ0LCBncm91cC5jb3VudCwgZ3JvdXAubWF0ZXJpYWxJbmRleCApOwoKCQkJfQoKCQl9CgoJCWNvbnN0IGJ2aCA9IG5ldyBNZXNoQlZIKCBnZW9tZXRyeSwgb3B0aW9ucyApOwoJCWNvbnN0IHNlcmlhbGl6ZWQgPSBNZXNoQlZILnNlcmlhbGl6ZSggYnZoLCB7IGNvcHlJbmRleEJ1ZmZlcjogZmFsc2UgfSApOwoJCWxldCB0b1RyYW5zZmVyID0gWyBwb3NpdGlvbi5idWZmZXIsIC4uLnNlcmlhbGl6ZWQucm9vdHMgXTsKCQlpZiAoIHNlcmlhbGl6ZWQuaW5kZXggKSB7CgoJCQl0b1RyYW5zZmVyLnB1c2goIHNlcmlhbGl6ZWQuaW5kZXguYnVmZmVyICk7CgoJCX0KCgkJdG9UcmFuc2ZlciA9IHRvVHJhbnNmZXIuZmlsdGVyKCB2ID0+ICggdHlwZW9mIFNoYXJlZEFycmF5QnVmZmVyID09PSAndW5kZWZpbmVkJyApIHx8ICEgKCB2IGluc3RhbmNlb2YgU2hhcmVkQXJyYXlCdWZmZXIgKSApOwoKCQlpZiAoIGJ2aC5faW5kaXJlY3RCdWZmZXIgKSB7CgoJCQl0b1RyYW5zZmVyLnB1c2goIHNlcmlhbGl6ZWQuaW5kaXJlY3RCdWZmZXIuYnVmZmVyICk7CgoJCX0KCgkJcG9zdE1lc3NhZ2UoIHsKCgkJCWVycm9yOiBudWxsLAoJCQlzZXJpYWxpemVkLAoJCQlwb3NpdGlvbiwKCQkJcHJvZ3Jlc3M6IDEsCgoJCX0sIHRvVHJhbnNmZXIgKTsKCgl9IGNhdGNoICggZXJyb3IgKSB7CgoJCXBvc3RNZXNzYWdlKCB7CgoJCQllcnJvciwKCQkJc2VyaWFsaXplZDogbnVsbCwKCQkJcG9zaXRpb246IG51bGwsCgkJCXByb2dyZXNzOiAxLAoKCQl9ICk7CgoJfQoKfTsK",typeof document>"u"?require("url").pathToFileURL(__filename).href:go&&go.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});super(t),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((s,n)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=u=>{n(new Error(`GenerateMeshBVHWorker: ${u.message}`))},e.onmessage=u=>{const{data:d}=u;if(d.error)n(new Error(d.error)),e.onmessage=null;else if(d.serialized){const{serialized:l,position:c}=d,f=cc.deserialize(l,t,{setIndex:!1}),p=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=c,l.index)if(t.index)t.index.array=l.index;else{const g=new y.BufferAttribute(l.index,1,!1);t.setIndex(g)}p.setBoundingBox&&(t.boundingBox=f.getBoundingBox(new y.Box3)),i.onProgress&&i.onProgress(d.progress),s(f),e.onmessage=null}else i.onProgress&&i.onProgress(d.progress)};const o=t.index?t.index.array:null,a=t.attributes.position.array,h=[a];o&&h.push(o),e.postMessage({index:o,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},h.map(u=>u.buffer).filter(u=>typeof SharedArrayBuffer>"u"||!(u instanceof SharedArrayBuffer)))})}}class GS{constructor(e,t){this.lock=!1,this.lockX=!1,this.lockY=!1,this.invRotMat=new y.Matrix4,this.mouse=new y.Vector3,this.rotateStart=new y.Vector2,this.rotateEnd=new y.Vector2,this.rotateDelta=new y.Vector2,this.selectedAxis=null,this.isDragging=!1,this.context=null,this.orbitState=!0,this._animator=0,this._emitter=new os,this.addListener=this._emitter.addListener.bind(this._emitter),this.removeAllListeners=this._emitter.removeAllListeners.bind(this._emitter),this._text=document.createElement("div"),this._textTimer=0,this._update=()=>{this.lock||(this._textTimer&&(window.clearTimeout(this._textTimer),this._textTimer=0),this._textTimer=window.setTimeout(()=>{this._text.style.opacity="0"},800),this.camera.updateMatrix(),this.invRotMat.extractRotation(this.camera.matrix).invert(),this.axes.forEach(s=>{this.setAxisPosition(s)}),this.axes.sort((s,n)=>s.position.z>n.position.z?1:-1),this.drawLayers(!0),this._text.style.opacity="1",this._text.innerText=this.camera.position.distanceTo(this.orbit.target).toFixed(2)+" m")},this.updateMouseFromEvent=s=>{this.rect=this.domElement.getBoundingClientRect();const n=this.domElement.width/this.domElement.clientWidth,o=this.domElement.height/this.domElement.clientHeight,{left:a,top:h}=this.rect;this.mouse.set((s.clientX-a)*n,(s.clientY-h)*o,0)},this.updateSelectedAxisUnderMouse=()=>{this.selectedAxis=null,this.axes.forEach(s=>{this.mouse.distanceTo(s.position)<s.size&&(this.selectedAxis=s)})},this.onPointerDown=s=>{this.rotateStart.set(s.clientX,s.clientY),this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse(),this.orbitState=this.orbit.enabled,this.orbit.enabled=!1,window.addEventListener("pointermove",this.onDrag,!1),window.addEventListener("pointerup",this.onPointerUp,!1)},this.onPointerUp=()=>{this.domElement.style.backgroundColor="#FFF0",setTimeout(()=>this.isDragging=!1,0),this.domElement.classList.remove("dragging"),this.orbit.enabled=this.orbitState,window.removeEventListener("pointermove",this.onDrag,!1),window.removeEventListener("pointerup",this.onPointerUp,!1)},this.onPointerEnter=()=>{this.domElement.style.backgroundColor="#FFF3",this.rect=this.domElement.getBoundingClientRect()},this.onPointerMove=s=>{if(this.lock||this.isDragging)return;const n=this.selectedAxis;s&&(this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse()),n!==this.selectedAxis&&this.drawLayers()},this.onDrag=s=>{this.lock||(this.isDragging||this.domElement.classList.add("dragging"),this.isDragging=!0,this.selectedAxis=null,this.rotateEnd.set(s.clientX,s.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(.5),this.rotateStart.copy(this.rotateEnd),this.orbit.update())},this.onMouseClick=s=>{if(this.lock||(this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse(),this.isDragging||!this.selectedAxis))return;this._animator&&cancelAnimationFrame(this._animator);const n=this.selectedAxis.direction.clone();this.camera.lookAt(0,0,0);const o=this.camera.position.distanceTo(this.orbit.target);n.multiplyScalar(o),this.selectedAxis.axis==="z"?n.setZ(this.orbit.target.z+o):this.selectedAxis.axis==="-z"?n.setZ(this.orbit.target.z-o):n.setZ(this.orbit.target.z);const a=500,h=performance.now(),u=1,d=this.selectedAxis.axis,l=()=>{const f=performance.now()-h,p=Math.min(f/a,u);if(this.camera.position.lerp(n,p),this.orbit.update(),p!==u){this._animator=window.requestAnimationFrame(l);return}else this._animator=0,this.onPointerMove(void 0),this._emitter.emit("axis-select-end",d);this.onPointerMove(void 0)};this._emitter.emit("axis-select-start",d),l()},this.drawCircle=(s,n=10,o="#FF0000")=>{this.context&&(this.context.beginPath(),this.context.rect(s.x-n,s.y-n,n*2,n*2),this.context.fillStyle=o,this.context.fill(),this.context.closePath())},this.drawLine=(s,n,o=1,a="#FF0000")=>{this.context&&(this.context.beginPath(),this.context.moveTo(s.x,s.y),this.context.lineTo(n.x,n.y),this.context.lineWidth=o,this.context.strokeStyle=a,this.context.stroke(),this.context.closePath())},this.drawLayers=(s=!1)=>{this.context&&(s&&this.context.clearRect(0,0,this.domElement.width,this.domElement.height),this.axes.forEach(n=>{const o=this.selectedAxis===n,a=n.position.z>=-.01?n.color[0]:n.color[1];if(n.line&&this.drawLine(this.center,n.position,n.line,a),this.drawCircle(n.position,n.size,o?"#0066ff":a),n.label){const h=n.axis==="-x"?this.options.fontSize-3:this.options.fontSize;this.context.font=[this.options.fontWeight,h+"px",this.options.fontFamily].join(" "),this.context.fillStyle=this.options.fontColor,this.context.textBaseline="middle",this.context.textAlign="center",this.context.fillText(n.label,n.position.x,n.position.y)}}))},this.setAxisPosition=s=>{const n=s.direction.clone().applyMatrix4(this.invRotMat),o=s.size;s.position.set(n.x*(this.center.x-o/2-this.options.padding)+this.center.x,this.center.y-n.y*(this.center.y-o/2-this.options.padding),n.z)};const i={offset:new y.Vector2,size:90,padding:8,bubbleSizePrimary:8,bubbleSizeSecondary:6,lineWidth:2,fontSize:11,fontFamily:"arial",fontWeight:"normal",fontColor:"#fff",className:"orbit-controls-gizmo",colors:{x:["#f35f5f","#902525"],y:["#78da2f","#71ae45"],z:["#1d92fa","#d0d1d1"]}};this.options={...i,...t},this.orbit=e,this.camera=e.object,this.center=new y.Vector3(this.options.size/2,this.options.size/2,0),this.axes=this.createAxes(),this.domElement=this.createCanvas(this.options),this.orbit.addEventListener("change",this._update),this._text.style.cssText=`
|
|
5008
|
+
`;oc([nc()],exports.DeviceLines.prototype,"lines",2);oc([xT(".container")],exports.DeviceLines.prototype,"container",2);exports.DeviceLines=oc([wm("device-lines")],exports.DeviceLines);class MT extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this._text=document.createElement("div");const i=tc(),s=i?"#ddd":"#eee";this.element.style.pointerEvents="auto",this.element.style.padding=i?"2px 6px":"3px 12px",this.element.style.borderTop=`1px solid ${s}`,this.element.style.borderBottom=this.element.style.borderTop;const n="6px",o=document.createElement("div");o.style.pointerEvents="none",Object.assign(o.style,{pointerEvents:"none",borderLeft:`1px solid ${s}`,borderRight:`1px solid ${s}`,position:"absolute",left:"0",top:"0",boxSizing:"border-box",height:n,width:"100%"}),this.element.append(o);const a=document.createElement("div");a.style.pointerEvents="none",Object.assign(a.style,{pointerEvents:"none",borderLeft:`1px solid ${s}`,borderRight:`1px solid ${s}`,position:"absolute",left:"0",bottom:"0",boxSizing:"border-box",height:n,width:"100%"}),this.element.append(a),this._text.style.fontSize=i?"10px":"14px",this._text.style.font="SF Pro SC,SF Pro Text,SF Pro Icons,PingFang SC,Helvetica Neue,Helvetica,Arial,sans-serif",this._text.style.color="#fff",this._text.style.fontWeight="500",this._text.style.transition="all .16s",this._text.innerText=e,this.element.append(this._text),this._text.addEventListener("pointermove",()=>{var h;o.style.borderColor=a.style.borderColor=this.element.style.borderColor="#666",this._text.style.color="#000",(h=this.onPointMove)==null||h.call(this)}),this._text.addEventListener("pointerleave",()=>{var h;o.style.borderColor=a.style.borderColor=this.element.style.borderColor=s,this._text.style.transform="scale(1)",this._text.style.color="#fff",(h=this.onPointLeave)==null||h.call(this)})}set text(e){this._text.innerText=e}dispose(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class po extends y.Group{constructor(e,t=!0,i=!0){super(),this._startWith=e,this._showText=t,this.useStartEnd=i,this._line2Length=.01,this._line=new y.LineSegments(new y.BufferGeometry,new y.LineBasicMaterial({color:"#666",linewidth:2})),this._line2=new y.LineSegments(new y.BufferGeometry,new y.LineBasicMaterial({color:"#666",linewidth:2})),this._text=new MT(""),this._line.frustumCulled=!1,this.add(this._line,this._line2),this._showText&&(this.add(this._text),this._text.onPointMove=()=>{this._line.material.color.set("#000"),this._line2.material.color.set("#000")},this._text.onPointLeave=()=>{this._line.material.color.set("#666"),this._line2.material.color.set("#666")})}updateMaterial(e){this._line.material=e}reset(){var e;(e=this._line.geometry)==null||e.dispose(),this._line.computeLineDistances()}update(e,t,i=0){var f,p;(f=this._line.geometry)==null||f.dispose(),this._line.geometry.setFromPoints([e,t]),this._line.computeLineDistances();const s=this._line2Length+i*.02,n=new y.Vector3().subVectors(t,e).normalize();let o;Math.abs(n.z)>Math.abs(n.x)&&Math.abs(n.z)>Math.abs(n.y)?o=new y.Vector3(-n.y,n.x,0):Math.abs(n.y)>Math.abs(n.x)?o=new y.Vector3(1,0,0):o=new y.Vector3(0,1,0),o.length()<.001&&(Math.abs(n.x)<.9?o=new y.Vector3(1,0,0):o=new y.Vector3(0,1,0)),o.normalize();const a=new y.Vector3().addVectors(e,o.clone().multiplyScalar(s)),h=new y.Vector3().addVectors(e,o.clone().multiplyScalar(-s)),u=new y.Vector3().addVectors(t,o.clone().multiplyScalar(s)),d=new y.Vector3().addVectors(t,o.clone().multiplyScalar(-s));(p=this._line2.geometry)==null||p.dispose(),this._line2.geometry=new y.BufferGeometry,this._line2.geometry.setFromPoints([a,h,u,d]),this._line2.computeLineDistances();const l=e.distanceTo(t);this._startWith?this._text.text=`${this._startWith}${(l*1e3).toFixed(0)} mm`:this._text.text=`${(l*1e3).toFixed(0)} mm`;const c=new y.Vector3;c.addVectors(e,t).multiplyScalar(.5),this._text.position.copy(c),this.useStartEnd||(this._line2.visible=!1)}destroy(){this._text.dispose(),this.children.forEach(e=>ii(e)),this.removeFromParent()}}class Am extends y.Object3D{constructor(e,t){super(),this.radius=e,this._text=new IT(""),this._line=new po(void 0,!1,!1),this._box=new y.Mesh,this._arc=new og.Line2,this._previousPosition=null,this._updateTimer=null,this._updateDelay=300,this._accumulatedAngle=0,this._lastAngle=null,this._line.updateMaterial(new y.LineDashedMaterial({color:"#555",dashSize:.06,gapSize:.06})),this._line.renderOrder=0,this._box.geometry=new y.RingGeometry(e,e+.003,128),this._box.material=new y.MeshBasicMaterial({color:"#666",side:y.DoubleSide}),this._arc.geometry=new pc.LineGeometry,this._arc.geometry.setPositions([0,0,0,0,0,0]),this._arc.geometry.instanceCount=0,this._arc.material=new tf.LineMaterial({color:"#eee",linewidth:2,resolution:new y.Vector2(window.innerWidth,window.innerHeight)}),this._arc.visible=!1,this._arc.rotateX(-Math.PI/2),this.position.y=t,this._arc.position.y=.001,this.add(this._box),this.add(this._arc),this.add(this._line),this.add(this._text)}hide(){this._text.hide(),this._line.visible=!1,this._arc.visible=!1}show(){this._text.show(),this._line.visible=!0}dispose(){this._updateTimer&&(clearTimeout(this._updateTimer),this._updateTimer=null),this._box.geometry&&this._box.geometry.dispose(),this._arc.geometry&&this._arc.geometry.dispose(),this._arc.visible=!1,this._previousPosition=null}update(e){var t;this.radius=e,(t=this._box.geometry)==null||t.dispose(),this._box.geometry=new y.RingGeometry(e,e+.003,128),this._line.updateMaterial(new y.LineDashedMaterial({color:"#555",dashSize:.06*e,gapSize:.06*e})),this._text.update((e*1e3).toFixed(0))}change(e){const t=e.clone();t.setZ(0),t.normalize().multiplyScalar(this.radius),this._text.position.set(t.x,t.y,t.z),this._text.updateColor("#eee"),this._line.update(t,new y.Vector3),this._previousPosition&&this._updateArc(this._previousPosition,t),this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._previousPosition=null,this._accumulatedAngle=0,this._lastAngle=null,this._clearArc(),this._updateTimer=null},this._updateDelay),this._previousPosition||(this._previousPosition=t.clone(),this._lastAngle=Math.atan2(t.y,t.x),this._accumulatedAngle=0)}_updateArc(e,t){const i=Math.atan2(t.y,t.x);if(this._lastAngle!==null){let h=i-this._lastAngle;h>Math.PI?h-=2*Math.PI:h<-Math.PI&&(h+=2*Math.PI),this._accumulatedAngle+=h}if(this._lastAngle=i,Math.abs(this._accumulatedAngle)<.01){this._arc.visible=!1;return}const s=Math.atan2(e.y,e.x),n=s+this._accumulatedAngle;let o=.006*this.radius;o<.003&&(o=.003),o>.006&&(o=.006);const a=this._createArcGeometry(s,n,this.radius+o);this._arc.geometry&&this._arc.geometry.dispose(),this._arc.geometry=a,this._arc.visible=!0}_clearArc(){this._text.updateColor(),this._arc.geometry&&(this._arc.geometry.setPositions([0,0,0,0,0,0]),this._arc.geometry.instanceCount=0,this._arc.computeLineDistances()),this._arc.visible=!1}_createArcGeometry(e,t,i){const s=[],n=t-e,o=Math.max(128,Math.floor(Math.abs(n)/(Math.PI/128))),a=n/o;for(let u=0;u<=o;u++){const d=e+u*a,l=Math.cos(d),c=Math.sin(d);s.push(i*l,0,i*c)}const h=new pc.LineGeometry;return h.setPositions(s),h.instanceCount=Math.max(0,s.length/3-1),h}}class IT extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this._wrapper=document.createElement("div"),this._circle=document.createElement("div");const i=tc();this._wrapper.style.fontSize=i?"10px":"11px",this._wrapper.style.color="#fff",this._wrapper.style.whiteSpace="nowrap",this._wrapper.style.position="absolute",this._wrapper.style.transform="translateX(-50%)",this._wrapper.style.top="6px",this._wrapper.style.font="SF Pro SC,SF Pro Text,SF Pro Icons,PingFang SC,Helvetica Neue,Helvetica,Arial,sans-serif";const s=this._circle;s.style.position="relative",s.style.zIndex="10",s.style.width=s.style.height="5px",s.style.borderRadius="50%",s.style.background="#666",t.append(this._wrapper,s),this.update(e)}show(){this.element.style.display="block"}hide(){this.element.style.display="none"}update(e){this._wrapper.innerText="旋转半径:"+e+" mm",this.updateColor("#eee")}updateColor(e="#666"){this._circle.style.background=e}}const PT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAUCAYAAADY6P5TAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEvSURBVFiFzZdbFYMwEEQroRKQgAQkVEIlICEOkFAJlRAJSIgEJNx+sPS0nGxIaOhyv3nM7mTmwOViDHAFesADD+BqrakKQAcMwMQ3AWis9e1C3HLASJoAdNZ6sxG3/MZQMZy1dhWgFbfWRzDGlFjAwFlyyXdh5OD5OIqykBgBy1yiF0aMUQaJugLclOcEoP3nULmFgQgeyCwOoJGBYrijByspDM98ZIszJAt8Ks8dag/VUFYYLtetjHdruRz5JZf8WBg1Ae7KcgOluaSsMAKJwqgJ6Vz2WzcvhZHjVlFh1ESG1DQ67SYtyGs8OwujNpTkUtw4nVtbyLK1XDafF3aKW90Z3EpBbi5lE0u9n3qoNTKk9rHh3heZqqwA8Vw6a11VkVwuPK31HALzb5pfovYC2xSs5LCDIUcAAAAASUVORK5CYII=",RT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAKCAYAAACngj4SAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAChSURBVDiNrdJbFYMwEIRhJFQCEpCAhEqIhDhBAlKQgAQkIOHrSziHpmkbLvua7P4zO9s0FYUeM0b0NT2nC9FnLQho7wQ9MOwgQ3K4ZPDrrtGmFcKKkL0HTAXXw2HX6HYuFnR/hMWC6ykX+W1AzJqq1abDGguux6LoPK9aUGFOm1Y+F+Bh+7DlsSKehRXgnfdDm5od7GdeN8ADnpuKQ3ldqReHZFd3742nZgAAAABJRU5ErkJggg==",kd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAdzSURBVHic7Z3hlZs6EIUvW4E7CB3EHcQdxB08OngugVTg8yrwSQVOKnBSwW4qsFOB3cF9PxhZQsYYjEAS1neOD7ssCwPXMxoNIGWIDJJLAAsASwCfAOTyey6bLOQDABf5qJ9P8vkry48sy05j2+ySzLcBjyC5QiXOV1kuWv+hPxcAvwD8BvCBSsRL6394JDjBSC4ArFEJtG7Y5ILqwp4A/JHlxfyoC04yN/4vh/bEz9Dim9uY+/8O4EfI4nmFZEFyz1veSe5Iri0BXB13Icfekjxaxz6TPMixXXt2fJDM5WLZF+og63MPNi1IbsQGW7zyJYUToXZyEUxP8iLSPUS80hLvdYQTobbWN3fHKvMLGpKrBq/bzla4htC3C8mbutIg3JnkxrddzhCvil4omwbhDqy6IPEisV5xJFn4tsk1rDJI8wtZ+rapN+JV73PzqnuwSk7MtvkQzflabdUxGsMdIGFSnfuZZFPHPxysELjnXDOoFsTbzAJA6dumRiyxSt/2+Ma6Hlvf9lyRb9QumjAwIZKQqOLAznvEEbFUcvFS7VVXWO/WvHsTLYnVnSBEM8JgEqsDlmi7qQ++TWL1xxKtnOqgKvs5J7H6I6KdJxFNsh5FygafxLqOxVgHme6b8QIYkWqcZoW6Mr13vvMXhboi8u56x+a34eXKTWMhXSO3SQirgqZi5WSniSvS1ChyFztUoTCcetjMoNGnHbqjTQqF42P1z4pnd7IwssKUwo8Mq/uIz2eN1NWMg3vzxoUWvu3pihEa+zU/4l3RJhoRC/ZcAkKdxkfnXUC8ggE1L+tWILbartW45o1D5IIpL+tWq43du4C4BQNqXlY82jB67wJmIdhSTG/vl1FXkaP1LiB+wQCA+m5+Ya5/s7b7V5a/J7Eq0cZ/svza+FcrHEZd1ZiJh5kp/q0e1D3tqMMhMA/BgFodt1DrzJD4jyx/TmpVoo3vsqyHxTmFQ2BWHpY3ngP1Pa9h5f1AmItgQC1bXAE6JKpXVn94sSrRxocsl4AW7Iss/0xuTuIRKqfQ7dic2i9gdiHxWlu0V8yi/QLmJRhQc6jlG3T7lYboCRfVji3eoMda+mjeNhEAJ1ku31ANYQekhCNklDafTA87eTEl0YWTLHNTsNSGhYvSZvEGPWDkyY8t1xt2ua/jd0Uyah/jYinBcvt+2OTIBTgAOHi6GJ3wbKeOfkaOn09sRNM4VGcXF8N1P0wiwNmyMx+63x7HV48dnuHqpJ40ZMNbBovmUrAGsRSTjuB2PRefgokhZcPFGCSaK8FaxCqf3ecAW66Cea8juhbNhWCBiaXridRtSD61IZZRzkQbKlhIYok9ut5rCOY9Q3Ml2hDBQhNLbKoJdpBfVr4MMnEh2rOChSiW2KWeCHg3X4wO5h2woaI9I1ioYolt6gHf/RuMOpU/k+pkWVYC+GatXmCkTit1p9hOvL6JLb7JZXky+0LTjn/UgWc9rY+HhexZCuqXIzZmfAzyAdJnROsqWAxiAbUnp9bmmxJn34bdo69oXQSLRSwAt10veqwndqVFtKJh21bBWD2WHotYuo5orDzIymAyxSbuiEZbtDbBqN8hCF4soGbv3lwZbOJh00W0e4LFJhZQG81hY67UHbMIeCRak2AxigXU2q+V/QdF7sWynrSJ1nFdDGJd2y/axXnqikfhx7z+tIjWhdK3/Y+gbqpuu1yM9IU+Nt8EfUQU00ex4YU+84/m6Df55NYNgPdDXhOFb3u7wLZwaGwUXVhUdBSt8G1nV9hlvBTjpKPIFm0eiFb4tq8P7No3ZkA3NJ/hjmiFb7v6QN3Nuh8OjY3VCQffib6HJVrh256+GN5Vdtk4ZwS1xUeIaIVvO/rSy7uMf9rF7mWx0su7jH9SD31E7WWxwfoI5v0eO6QuOiYvmwgOGcGcLkZ6TnSG+kGb7m1Xw05UtnVMoXE8WJ8hYljZjL4mKXsh6HIE85SAjAvHmCqFabKcUeAYk+UYO1ePWqXpqBxBXWx3f0vLyhpL5wd4MYyoNd7bnKzX6IJ+wipkOOXUlJN8M2YMfUxNaSUh+SQHnQFWszLtfGxME2/3whJr+j4t09T2nbHE8jO1vRiSRHtAMGIZBi2M8HhO2aNGskGVYOy8i2VCXQ+bLvsJGNYfci1929OIZeQ+qG/UREjE2QcvlsIKA0cGMjrBFFjt1ZGx3EcUww/Gt2w7Z2+T890Z5/seZQJmhcjjHBMSVuW6o3GepW+bBsHqfo/pbYc5hMkGrzpG6VX3YPWWyTl24e4IVfi2axRYZVBm+h+NcKxGHdhZtm9n5VX3EOHKBo8rGVByIt5UUFdzKDbvXkIomzvCKfE2PsQzRDpYNh1lfT61TcEhwq3lItniHSX0FGMIKAKtxWveecueAbVRmW8DbESUNaopHpe4HbDrhGqU6Q9UMyao309qgyzLTsa+7E8O4LMsm/YPVPOo/QTwI8uyoMbzD04wE7ngS/l8AbBC8wUeghL/J4CPLMt+Od6/U4IWrAlpQ5aoPOSTLHNoIRfGzxfoMd9P0J74F5VIlyzLopok6H/tVqA8kSYfTwAAAABJRU5ErkJggg==",DT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYwAAACsCAYAAABo4pvIAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAzYSURBVHic7d3hcdtIEobhD05gmYGRgbkRLDKwMjiGoBCUgeoi0F0Evo1AdASiIxAcgbkR9P1Aj9mESIm2QMwAeJ8qlihKomeXwHzsHgCsBBTOzGpJK7+pd7/2r3+ceCw69Vh8nkvt/fbW4/H7vaR//H4bfqeNX6uqij8DilPlHgCWxcxW6ibvNFmn+x/DY/Fn0mHyPXVLE7F0ejKOf3/SpRO1B9c55wJNOg6rfrD1/5v7/31pbN97j7WS9lVVnf3vAoZGYGAwPqHW6ia+tbrJce0/Tj+Lk176+k/4/ui2tAnRA/VUaNbqQjXdr8PvtDoOku/xeyoXDIXAwMXMbK1DGHzUcTikiatVN1l9Uy8YmLiG1wuY2r9+0vHrUuvwOux0/PrseF1wKQIDR06EQvw+TTatunexrXgXOwmh+ku31AJc6xAoMUxaESboITAWyoOhVjdhfAr307vQnbpQ2KlrDe2yDBSj8EBJ20S/Qml12B7S/XZp7UIQGLMX3lk2Og6Gnbqd/1u4zySAI+EghRQmH9VtS7W6bWYrKpLFIDBmJFQNf6nbwdOCc6oYvqqrFrY5xof56AXJJ53e3r5J2hIi80FgTFRoIcRwaP32Vb7TUjFgTCdaW426thYhMgMExgT4u7m1Dm2lxn+UqoatCAcUyrffRodqpPEfbcWbm0khMAoUdrBUPTTyUFC3g7UsQmPKvBJpdNzOiq3TLQFSHgKjAKGM/6xDOb+T9Le6d17bXGMDxmJmjY73g1aHRfX/ESD5ERgZhBbTZx2OOCEggOCVAEn7CQEyMgJjJL2Nv9Hxhr/NNS5gKnr7UK0uQNiHMH1mtjKzGzN7MLNnvz34Rg/gHXz/aszs3vetH75/bbyCB8pmZrVvsI/WeTSzWz8/AsCV+L536/vcj7Dv1bnHBvxkZmt/l/MUqogb3uUAefSqjx++X95R3SOLEBK0moDCER4Y3YmQuKfVBEyLh8dd2I8JDwzD+6J3hAQwP2fCo849LkyI9z/TwnVqNxESwIyF8IgL5qxD4jTfYB786KYvZnaTe0wAxudzQTraivVJdE60nDaUpACkn92GuxAed1QdCxSqCY5wAvCm3pFWj8wZM2eHk+p+VhO5xwRgWrzqSCcIPrHWMTMeFGltgmoCwCB6ax33tLMnzM+biG2nOveYAMxPWAulXTU1vUNiuRAZgFGERfJngqNwrE8AKEVoVz0xHxWEoABQqhAczE85ERQApiIEB62qMREUAKaK4BiJH4nwRFAAmDqC40rCeRQEBYBZ8Y5JumZVnXs8k9U7RO0u93gA4Br6cx2nAvyisE5B6gJYBA+OB684uFr2W3rtpzr3eABgbL31jTr3eIoUTq2/yz0WAMjNugsbPpvZbe6xFMOrimfSFACO+fyYzhhvco8nq1BVkKAAcIZXGz/M7D73WEYXqgoWtQHgAr1qo849nlGEvtwm91gAYGoWsbbBEVAAMIxw5YvH2Z23EVpQy+u/AcAV+Hkb9z63rnOPZxBhsWa+5RMAZDKbFlVIvzr3WABgrsbq4ny4xpOm/pqklaQ/q6pqr/HvAAAkn2P/lLSa1FFUIenuco8FAJYmXMiwzj2WVxEWAJBfCI0yF8PN7MYXtze5xwIASxeu+t3kHsuRMLAy0wwAFsjM1kW9kQ9hUeceCwDgWFgq2OQeSPp4wTrrQAAAZ3lo5Ks0QljQhgKAwmVrT1n3iVCEBQBMSAiNcebuUNrwmbMAMDF+ROv11539Ylf5F08AAL8tXH+qvuY/8sgVZwFg+vzkvqdrPfm9mT1e5ckBAKPz604NWwSM1vMCAIxm8HM0wiI3R0QBwMz4kVPDFAS+bjHtD+YAAJzli+DvW3IY5EkAAMV715XGaUUBwHKEOb/+nT/+wudaAMBy+KG2D7/6R42XJ6srjQsAUCCf+y+/kocvdDfXGxIAoETpIysu/eWGhW4AWK6Lz83w6oILCwLAQl1UZaS1i5HGBAAo1JtrGV5dbMYbEgCgRF5lnF6e8EuX/xh5TACAQvUvGfIh/OxW0n/GHhAAoFhbSS/bUp4kzdijAQCU6eS6dvqM7kxjAgAUKhYTqSW1Fu0oAMBLW3UZ0eHMbgDAKUcnc6ejo7huFACgzzPCpK4lVUvaV1W1zzoqAEBxPBt2ZtZ8UNeb2uYdEgCgYK2k9QdJnyR9yzsWAEDBvkr6mFpSbdahAABKtpNXGGtJrF8AAF6zSudhtDlHAQAo2l4hMAAAOGcvaaV0fC0AAOeYmVFhAAAu8kHSPl7vHACAyDOi/aDUmwIA4BUEBgDgLbV0CAwAAM5ZSdp9kJ/Bl3kwAIBy1fI1jO+S/so7FgBAwT5J+pYqjDrvWAAABWvUZUV3QgYfoAQA6IsfspdO3NuKdQwAwEtrSbuqqvYpMP6W9K+MAwIAlOmzuozo+Id8P+cbDwCgRN6OavoPPr94EACwWP1iIl588N+iLQUAOPgs6b8vHjWzmrYUACBJR0el739WGFVVtZJaM9tkGBcAoCCeBbuqqk5fPsrMbqgyAAAXrWv7L21GGREAoDhePDxe8osbqgwAWC4ze7z4qFmqDABYJj+U9u3qIvwBaxkAsDB+3ahfPyfPzB7M7O4qowIAFMfM7szsy+/8Ye3H4NbDDwsAUBIzW79rzve0oTUFADPnC923+Z8EAFAsM7v9pYXuV56o9kUQPi8DAGbm3a2oE0+48dAY5gkBANmFguBm6Ce+N7OnQZ8UAJCNLzncX+vJnzjUFgCmz4uA969bvPIPpPKFRXAAmKiwzLB6+7ff9w9dp+cFALg6v5LHeOfYhVV1jpwCgIkIc3cz9j+8ITQAYBpCWGxyDWAzamkDAPhl4VJPm9wD4RwNAChUWHfe5B6LJNpTAFAib0OVExaJf+hGeQMDgAUKb+TLPKI1pNld7rEAwFKlK40Xv1QQ+mV3uccCAEszmbBIPDSe/FP7rnsmIQAgfbzqg8+9de7x/DK/Vsl0kg4AJih0dq5zIcGx+AdzcP0pALgCn2N/zGaODYvh97SoAGAYs+3ieH/tcbL9NQAoRGhBPcx6PqVFBQC/L1xdYxlzaDiK6nHW6QgAA/F582GWLahLeP9tPos1AHAFYWH7LvdYsvJLilBtAECPVxWPi60qzmFtAwAO/IxtqopzQpo+2tifCAUABVjMEVBDscNnznJpEQCL0FvU3uQez6T4eRvpIlp3BAeAuWKuG0hI3fwfLwgAAwrnVNB+GpIfTcX6BoDJC0HBlS+uieAAMFUhKFinGBPBAWAqCIpChBeC4ABQFIKiUP7CPBEcAHIjKCYitKo4RA3AaPxUgNjx2OQeEy4UguOHB0ede0wA5qd3wt2Dma1zjwm/yV/MdFVc2lUABuFvSh+sw3kUc+Ll4m1Y57ilXQXgV/XXJwiKmeu1q+6pOgC8JlQTqe3U5B4TRmaH61WldhWL5AAk/Wxnx2qCtVB0wjsI1jqABbPuatlfwtpEk3tMKFRY64hHWDW5xwXgesxsHVpOj15Z0G3A5bwkTZcdfiY8gPnwkLin5YTBecuK8AAm7ERI3HPeBK6qFx4caQUUrHeEEyGBfM6FB/1PIA9fh7wJIfFESKA4vuYRF8wf/fs699iAOfNWU9r3LCxc17nHBrzJDhciS4fqplKY6gMYwIlW04NXFuxfV1LlHsBS+BrHWtJnSbWkVtLfknZVVW1zjQuYit4+1Ejain1oVARGBv4OKG74taSd2PiBn3oBsVb3Jmurw36yzzW2pSIwCuABciPpkwgQLNSZgIj7QZtrbOgQGAXyAGkk/aVux1mr23F2kr5J2rLzYMr8iKVah228UVc97CR9VbeNU0EUhsCYgNDCWqvbwRr/0VZdgOzEDoZChe230SEgpMP2uxUtpkkgMCbKDxds1LWxUpjsddgJW1HGY2Qn3tzUOrRYU/XAdjlRBMaMnAkR6bidtZPU8m4O7+VrDisdt06l43Boq6raZRkgBkdgzJyHSOoXx0X1Vl018l2HxUWCBEe8Yqj9tla3DaX7O3XbTmortVQO80ZgLFCYBFKQfAz39+omgr1obS2GL0KndlLaHtJjMRjSGwuqhgUiMHDkREWyCt+3OoRJqkxa8c6yeP66xttH/5pe3/S67tS9tjtJe4IBEYGBi4UwWek4TFLF0uplhbIPj+9peQ0vhMEqfP0Uvq91/Lq0IhTwGwgMDKb3Lnalw7vY9H0tDw4dqhPpUK1IIVy0wIDxduGpWy3pD70MhpWO/1/uJP2jEA5UfxgKgYFRhQmx1vGk99F/JT6WbvverfXf3aubHJM23E+/27//wqUT6htXPk1jTeoz9//Q6UCIf9/q5X/zd/WqNXGQAkZGYKB4YaLuf43300QsvZy8+9+/9fhrzoVP+8pjMdjiY0eBRiWA0v0fPGR4m68wwtkAAAAASUVORK5CYII=";class Nd extends Lt.CSS2DObject{constructor(e,t){const i=document.createElement("div");super(i),this.props=e,this.amr=t,this._direction=1,this._controllingRotate=!1,this._controlling=!1,this._startAt=0,this._looper=0,this._initial=0,this._canRotate=!1,this._emitter=new as,this.addListener=this._emitter.addListener.bind(this._emitter),this.removeListener=this._emitter.removeListener.bind(this._emitter),this._update=()=>{if(this._looper=requestAnimationFrame(this._update),this._controlling){let a=(Date.now()-this._startAt)/200;a>4&&(a=4);let h=this._initial+.005*a*this._direction;if(h>this.props.max||h<this.props.min){this.mechanism&&(h<this.props.min?(this.mechanism.position.setZ(this.props.min),this._emitter.emit("change",this.props.min)):h>this.props.max&&(this.mechanism.position.setZ(this.props.max),this._emitter.emit("change",this.props.max)));return}if(this._initial=h,!this.mechanism)return;this.mechanism.position.setZ(h),this._emitter.emit("change",h)}};const s=tc();e.userData&&e.userData.target&&(this.name=e.userData.target.name,t.traverse(a=>{a.name===e.userData.target.name&&(this.mechanism=a)})),i.style.fontSize="30px",i.style.color="#0066FF",i.style.cursor="pointer",i.style.pointerEvents="auto";const n=document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.transform="translateX(-50%) rotate(-180deg)",n.style.marginBottom="5px",n.style.width=n.style.height=s?"34px":"44px",n.style.background=`url(${kd}) center no-repeat`,n.style.backgroundSize="100% auto",n.setAttribute("data-direction","up"),n.style.transition="all .2s";const o=document.createElement("div");if(o.style.position="absolute",o.style.left="0",o.style.transform="translateX(-50%)",n.style.bottom=o.style.top="8px",o.style.width=o.style.height=n.style.width,o.style.background=`url(${kd}) center no-repeat`,o.style.backgroundSize="100% auto",o.style.transition="all .2s",o.setAttribute("data-direction","down"),Array.from([n,o]).forEach(a=>{s||a.addEventListener("mousemove",()=>{a.style.filter="invert(100%)"}),a.addEventListener("mouseleave",()=>{a.style.filter=""}),a.addEventListener("pointerdown",()=>{this.mechanism&&(a.style.filter="invert(100%)",this._controlling=!0,this._startAt=Date.now(),this._initial=this.mechanism.position.z,this._direction=a.getAttribute("data-direction")==="up"?1:-1,this._update())}),a.addEventListener("pointerup",()=>{this._controlling=!1,cancelAnimationFrame(this._looper),a.style.filter=""}),a.addEventListener("pointerleave",()=>{this._controlling=!1,cancelAnimationFrame(this._looper),a.style.filter=""})}),e.userData&&(this._canRotate=e.userData.canRotate,this._canRotate)){const{rotateTarget:a,rotateDuration:h,rotateStep:u,rotateMax:d,rotateMin:l}=e.userData;let c;if(a&&(t.traverse(f=>{f.name===a.name&&(c=f)}),c)){const f=document.createElement("div");f.style.background=`url(${DT}) center no-repeat`,f.style.backgroundSize="100% auto",f.style.position="absolute",f.style.top="-50%",f.style.left="-50%",f.style.width=s?"140px":"160px",f.style.height=s?"70px":"80px",f.style.transform="translateX(-50%) translateY(-50%)",i.append(f);const p=document.createElement("div");p.style.background=`url(${RT}) center no-repeat`,p.style.backgroundSize="100% auto",p.style.width=p.style.height=s?"20px":"26px",p.style.position="absolute",p.style.top="0",p.style.transform="translateY(-50%)",p.style.marginBottom="5px",p.setAttribute("data-direction","left"),i.append(p);const g=document.createElement("div");g.style.background=`url(${PT}) center no-repeat`,g.style.backgroundSize="100% auto",g.style.width=g.style.height=s?"20px":"26px",g.style.position="absolute",p.style.left=g.style.right=s?"62px":"69px",g.style.top="0",g.style.transform="translateY(-50%)",g.style.marginBottom="5px",g.setAttribute("data-direction","right"),i.append(g),Array.from([p,g]).forEach(m=>{s||m.addEventListener("mousemove",()=>{m.style.filter="invert(100%)"}),m.addEventListener("mouseleave",()=>{m.style.filter=""}),m.addEventListener("pointerdown",()=>{if(this._timer&&this._timer.isPlaying())return;m.style.filter="invert(100%)",this._controllingRotate=!0,this._startAt=Date.now(),this._direction=m.getAttribute("data-direction")==="left"?1:-1;let _=u/180*Math.PI*this._direction+c.rotation.z;_>d/180*Math.PI?_=d/180*Math.PI:_<l/180*Math.PI&&(_=l/180*Math.PI),this._timer=new yo(c.rotation).to({z:_}).duration(h).start(),this._update()}),m.addEventListener("pointerup",()=>{this._controllingRotate=!1,cancelAnimationFrame(this._looper),m.style.filter=""}),m.addEventListener("pointerleave",()=>{this._controllingRotate=!1,cancelAnimationFrame(this._looper),m.style.filter=""})})}}i.append(n,o),this.scale.set(.01,.01,.01),this.matrixAutoUpdate=!1,this.updateMatrix()}hide(){this.element.style.display="none",this.traverse(e=>{e.visible=!1,e instanceof Lt.CSS2DObject&&(e.element.style.visibility="hidden")}),this.visible=!1}show(){this.element.style.display="auto",this.traverse(e=>{e.visible=!0,e instanceof Lt.CSS2DObject&&(e.element.style.visibility="visible")}),this.visible=!0}dispose(){this._emitter.removeAllListeners(),cancelAnimationFrame(this._looper),this.element.remove()}}class BT extends ag.CSS3DObject{constructor(e){const t=document.createElement("div");super(t),this.props=e,this._scale=.01,this._emitter=new as,this.addEventListener=this._emitter.on.bind(this._emitter),this.removeEventListener=this._emitter.on.bind(this._emitter),this._mouseStart=new y.Vector2,this._targetSize=new y.Vector2,this._caches=[],this._sizeFlag="width",this._direction=1,this._lines=[],this._pointerdown=h=>{const{pageX:u,pageY:d}=h;this.endNode.setPointerCapture(h.pointerId),this._mouseStart.set(u,d),this._targetSize.setX(parseFloat(this.endNode.parentElement.style.width)),this._targetSize.setY(parseFloat(this.endNode.parentElement.style.height))},this._pointermove=h=>{if(!this._mouseStart.x)return;const{pageX:u,pageY:d}=h;let l=u-this._mouseStart.x,c=l+this._targetSize.x;this._sizeFlag==="height"&&(l=d-this._mouseStart.y,c=l*this._direction+this._targetSize.y);const f=c%10;c=c-f,l=(c-this._targetSize.x)*this._direction,this._sizeFlag==="height"&&(l=(c-this._targetSize.y)*this._direction),this._textNode.innerText=(c/100).toFixed(2)+" m",this.endNode.parentElement.style[this._sizeFlag]=`${c}px`},this._pointercancel=h=>{this.endNode.releasePointerCapture(h.pointerId),this._mouseStart.set(0,0)};const{start:i,end:s}=e,n=s.distanceTo(i);this.props.axios==="z"?this.props.axios="y":this.props.axios==="y"&&(this.props.axios="z"),this.props.axios==="y"&&(this._sizeFlag="height");const o=document.createElement("div");o.style.position="absolute",o.style.left="0",o.style.bottom="0",t.append(o),this._textNode=document.createElement("div"),this._textNode.innerText=n.toFixed(2)+" m",o.append(this._textNode);const a=document.createElement("div");this.endNode=a,a.style.position="absolute",a.style.left="auto",a.style.right="0",a.style.width="4px",a.style.height="4px",a.style.background="#0066FF",a.style.borderRadius="50%",a.style.margin="-2px -2px 0 0",a.style.cursor="pointer",o.append(a),this.scale.set(this._scale,this._scale,this._scale),t.style.fontSize="6px",t.style.color="#fff",o.style[this._sizeFlag]=n*100+"px",o.style.textAlign="center",this._sizeFlag==="height"?(o.style.borderLeft="0.1px dashed #fff",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.whiteSpace="nowrap",a.style.top="0",a.style.left="0",a.style.right="auto",a.style.margin="-2px 0 0 -2px"):o.style.borderBottom="0.1px dashed #fff",a.addEventListener("pointerdown",this._pointerdown),a.addEventListener("pointermove",this._pointermove),a.addEventListener("pointerup",this._pointercancel),s[this.props.axios]<i[this.props.axios]?this.rotateY(Math.PI):this._direction=-1}_getIndexByAxios(){return this.props.axios==="y"?1:this.props.axios==="z"?2:0}dispose(){this._lines.forEach(e=>e.dispose()),this._emitter.removeAllListeners(),this.endNode.removeEventListener("pointerdown",this._pointerdown),this.endNode.removeEventListener("pointermove",this._pointermove),this.endNode.removeEventListener("pointerup",this._pointercancel),this.element.remove(),this._caches.forEach(e=>e.clear()),this._caches=[]}}class FT extends y.Object3D{constructor(){super(),this._box3=new y.Box3,this._line11=new po("长:"),this._line12=new po("宽:"),this._line13=new po("高:"),this._outline=new Am(0,0),this._radius=0,this._hasWidthConfig=!1,this._hasLengthConfig=!1,this._hasHeightConfig=!1,this.follow="",this.followOrigin=0,this.followScale=1,this.originOffset=0,this.translateCache=0,this.head=0,this.tail=0,this._change=()=>{if(!this._app)return;const e=this._app.camera;e&&this._outline.change(e.position)},this.add(this._outline,this._line11,this._line12,this._line13)}get hasSizeConfig(){return{length:this._hasLengthConfig,width:this._hasWidthConfig,height:this._hasHeightConfig}}get size(){return this._box3.clone()}get radius(){return this._radius}init(e){this._app=e,this._app.controls.addEventListener("change",this._change)}reset(){this.hide(),this._line11.reset()}generate(e,t=0){e&&(this._object=e),this.update(t)}show(e=!0){const t=[this._line11,this._line12,this._line13];e&&(this.visible=!0,this._outline.visible=!0,this._outline.show(),t.push(this._outline)),t.forEach(i=>{i.traverse(s=>{s.visible=!0,s instanceof Lt.CSS2DObject&&(s.element.style.visibility="visible")})})}hide(e=!0){const t=[this._line11,this._line12,this._line13];e&&(this.visible=!1,this._outline.visible=!1,this._outline.hide(),t.push(this._outline)),t.forEach(i=>{i.traverse(s=>{s.visible=!1,s instanceof Lt.CSS2DObject&&(s.element.style.visibility="hidden")})})}destroy(){var e;(e=this._app)==null||e.controls.removeEventListener("change",this._change),this._line11.destroy(),this._line12.destroy(),this._line13.destroy()}update(e=0){if(!this._object)return;const t=this._object,{box:i,maxRadius:s,hasLength:n,hasHeight:o,hasWidth:a}=jA(t);this.tail=Math.abs(i.min.x),this.head=Math.abs(i.max.x),this._hasWidthConfig=a,this._hasLengthConfig=n,this._hasHeightConfig=o,this._box3.copy(i),this._radius=s,this.follow&&e&&(this.originOffset=(this.followOrigin-e)*this.followScale),this._outline.update(this._radius),this._change();const h=this._box3.min.x,u=this._box3.max.x,d=this._box3.min.z,l=this._box3.max.z,c=this._box3.min.y,f=this._box3.max.y;let p=.2;const g=new y.Vector3(h,f,0),m=new y.Vector3(u,f,0);this._line11.update(g.clone().sub(new y.Vector3(0,-p/1.8,0)),m.clone().sub(new y.Vector3(0,-p/1.8,0)),this._radius);const _=new y.Vector3(u,c,0);this._line12.update(m.clone().add(new y.Vector3(p,0,0)),_.clone().add(new y.Vector3(p,0,0)),this._radius);const v=new y.Vector3(h,f,d),x=new y.Vector3(h,f,l),b=v.clone();b.y-=p/6;const w=x.clone();w.y-=p/6,this._line13.update(b,w,this._radius)}}class Ud extends y.Object3D{constructor(e=.6,t=.4,i=.2){super(),this.isGoods=!0,this._generate(e,t,i)}updateSize(e=.1,t=.1,i=.1){this._generate(e,t,i)}clearAll(){ii(this)}hide(){this.traverse(e=>e.visible=!1)}show(){this.traverse(e=>e.visible=!0)}_generate(e,t,i){this.clearAll();const s=new y.Mesh(new y.BoxGeometry(e,t,i),new y.MeshBasicMaterial({color:new y.Color("#0f5fd5"),transparent:!0,opacity:.4}));s.geometry.translate(0,0,i/2);const n=new y.EdgesGeometry(s.geometry),o=new y.LineDashedMaterial({color:new y.Color("#000"),dashSize:.015,gapSize:.015}),a=new y.LineSegments(n,o);a.computeLineDistances(),this.add(s,a)}}const LT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAALSURBVAiZY2AAAgAABQABYlUyiAAAAABJRU5ErkJggg==";class yh{constructor(e){this._props=e,this.name="",this.transparentTexture=ac.load(LT),this._offscreen=new OffscreenCanvas(0,0),this._defaults={...e},this.target=e.target,this.parent=this.target.parent,this.reset()}get imageSize(){return this._props.imageSize}get size(){return this._props.size}get defaultConfigs(){return{canvasWidth:200,canvasHeight:200,scaleX:1,scaleY:1,x:0,y:0,ox:0,oy:0,url:this._defaults.imageUrl}}clear(){this.change()}change(e,t=new y.Vector2(1,1),i=new y.Vector2){this.imageUrl=e;let s;if(e){const n=new Image;n.crossOrigin="anonymous",n.src=e,n.onload=async()=>{var u;let o=window.devicePixelRatio*2;this._offscreen.width=n.width+o,this._offscreen.height=n.height+o;const a=this._offscreen.getContext("2d");a==null||a.clearRect(0,0,this._offscreen.width,this._offscreen.height),a==null||a.drawImage(n,o/2,o/2,n.width,n.height),s=new y.Texture(this._offscreen),s.minFilter=1003,s.colorSpace=y.SRGBColorSpace,s.wrapS=s.wrapT=y.ClampToEdgeWrapping,s.repeat.set(1/t.x,1/t.y),s.offset.set(i.x,i.y),s.flipY=!1,s.needsUpdate=!0;const h=this._props.target;h.material&&((u=h.material.map)==null||u.dispose(),s?(h.material.map=s,h.material.opacity=1):(h.material.map=this.transparentTexture,h.material.opacity=0))}}else{const n=this._props.target;n.material&&(n.material.map=this.transparentTexture)}}reset(){this._props=this._defaults,this.name=this._props.name,this.imageUrl=this._props.imageUrl,this.target=this._props.target,this.change(this.imageUrl||"")}dispose(){this._offscreen=null}}function Tm(r){return r.type?r.type==="Mesh":r.isMesh}const OT=r=>{const e=window.performance.now(),t=[];r.updateWorldMatrix(!0,!0),r.traverse(n=>{if(Tm(n)||n.geometry){const o=n.geometry.clone();if(o.applyMatrix4(n.matrixWorld),o.morphTargetsRelative=!1,o.morphAttributes)for(const a in o.morphAttributes)delete o.morphAttributes[a];for(const a in o.attributes)a!=="position"&&o.deleteAttribute(a);t.push(o)}});const i=lg.mergeGeometries(t,!1),s=window.performance.now()-e;return console.log(`Merge object: ${r.name} time: ${s.toFixed(2)} ms`),i},ac=new y.TextureLoader;ac.crossOrigin="anonymous";class Sm extends y.Object3D{constructor(e){super(),this._props=e,this._emitter=new as,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._container=new y.Group,this.lines=new y.Group,this.sizeBox=new FT,this._goodsSize=new qA(0,0,0),this._slots=[],this._logos=[],this._skins=[],this._levels=new Map,this._bodyOpacity=1,this._masts=new Map,this._liftMaxHeight=0,this._jackMaxHeight=0,this._forkMaxHeight=0,this.controllers=[],this.goods=[],this._breathLights=[],this._shelves=new Map,this._shelfMaxLevel=1,this._url="",this._showController=!0,this._showSlots=!0,this._shapeKeys=new Map,this._shapeKeyTimer=0,this._shapeKeyCache="",this._materialsCache=new Map,this.opacityCache=void 0,this._pointCloudMode=!1,this._pointClouds=[],this._originalMeshes=new Map,this._pointCloudAnimations=[],this.actions=[],this._url=e.url||"",this._url&&this.load(this._url).then(),this.add(this._container,this.lines),this._props.showSizeBox&&this.add(this.sizeBox),this.showController=typeof e.showController=="boolean"?e.showController:!0,this._showSlots=typeof e.showSlots=="boolean"?e.showSlots:!0}get shapeKeys(){return this._shapeKeys}get size(){const e=this.sizeBox.size.getSize(new y.Vector3);return{width:e.z,length:e.x,height:e.y}}get goodsSize(){return this._goodsSize}get showController(){return this._showController}set showController(e){this._showController=e,this.controllers.forEach(t=>e?t.show():t.hide())}get slots(){return this._slots}get logos(){return this._logos}get skins(){return this._skins}get bodyOpacity(){return this._bodyOpacity}get fork(){return this._fork}get forkHeight(){var e;return((e=this._fork)==null?void 0:e.position.z)||0}get liftHeight(){var e;return((e=this._lift)==null?void 0:e.position.z)||0}get jack(){return this._jack}get jackHeight(){var e;return((e=this._jack)==null?void 0:e.position.z)||0}get lift(){return this._lift}set bodyOpacity(e){this._bodyOpacity=e,e<1?this._materialsCache.forEach(t=>{t.mat.transparent=!0,t.mat.opacity=e,t.mat.metalness=0,t.mat.roughness=1,t.mat.color=new y.Color("#3859be"),t.mat.needsUpdate=!0}):this._materialsCache.forEach(t=>{t.mat.transparent=t.transparent,t.mat.opacity=t.opacity,t.mat.metalness=t.metalness,t.mat.roughness=t.roughness,t.mat.color=t.color,t.mat.needsUpdate=!0})}init(e){this._app=e,this.sizeBox.init(e),this.addEventListener("shape-key-changed",(t,i)=>{this._slots.forEach(s=>s.shapeKeyChanged(t,i)),this.sizeBox.follow===t?(this.sizeBox.generate(this._container,i),this.sizeBox.originOffset&&(this._container.traverse(s=>{s instanceof y.Mesh&&!s.userData.isDevice&&!s.userData.isBracket&&s.geometry.translate(this.sizeBox.originOffset-this.sizeBox.translateCache,0,0),s instanceof _h&&!s.props.slot.userData.ignoreOriginChanged&&s.parent&&s.parent.position.add(new y.Vector3(this.sizeBox.originOffset-this.sizeBox.translateCache,0,0))}),this.sizeBox.translateCache=this.sizeBox.originOffset,this.sizeBox.generate(this._container))):this.sizeBox.generate(this._container),["width","length","height"].includes(t)&&this._emitter.emit("size-changed",t,i)})}async load(e,t=""){this._url=e,this.name||(this.name=e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."))),!e.startsWith("blob")&&e.endsWith(".sglb");let i;if(t==="glb"||e.endsWith(".glb"))i=(await ss.loadAsync(e)).scene;else{const n=await new No({useCache:!0}).loadAsync(e);if(!n.glb)return;i=n.glb}this._generateAmr(i.clone(!0)),i=null,this._emitter.emit("amr-loaded")}changeSkin(e,t){e&&(e.change(t),this._app&&this._app.usePathTracing&&(this._app.sampleCount=0,this._app.usePathTracing&&(this._app.pathTracer.pausePathTracing=!1,this._app.pathTracer.updateMaterials())))}changeLogo(e,t){e.change(t.url,new y.Vector2(t.scaleX,t.scaleY),new y.Vector2(t.ox,t.oy))}setShapeKey(e,t,i=!0){i&&this._shapeKeyTimer&&e===this._shapeKeyCache&&clearTimeout(this._shapeKeyTimer),this._shapeKeyCache=e,this._shapeKeyTimer=window.setTimeout(()=>{this._container.traverse(s=>{if(!Object.keys(s.morphTargetDictionary||{}).includes(e))return;let n=t;s.userData[`origin_${e}`]&&(n-=s.userData[`origin_${e}`]);const o=s.morphTargetDictionary[e];s.morphTargetInfluences&&(s.morphTargetInfluences[o]=n),s instanceof y.Mesh&&s.geometry.translate(0,0,1e-5)}),i&&this._emitter.emit("shape-key-changed",e,t)},100)}_generateAmr(e){this._mergedGeometry=OT(e),e.traverse(t=>{t.userData.isShelf&&(this._shelf=t),t.userData.isFork&&(this._fork=t),t.userData.isMast&&t.userData.mastLevel&&this._masts.set(t.userData.mastLevel,t),t.userData.isJack&&(this._jack=t),t.userData.isLift&&(this._lift=t),Object.keys(t.morphTargetDictionary||{}).forEach(i=>{let s=t.morphTargetInfluences[t.morphTargetDictionary[i]];t.userData[`origin_${i}`]&&(s+=t.userData[`origin_${i}`]),this._shapeKeys.has(i)||this._shapeKeys.set(i,s)})}),e.traverse(t=>{if(t instanceof y.Mesh){if(t.castShadow=!0,t.receiveShadow=!0,t.material)if(Array.isArray(t.material))t.material.forEach(s=>{s.userData.changeColor&&(this.skins.find(n=>n.name===s.userData.name)||this.skins.push(new Mh({name:s.userData.name,target:s})))});else{if(t.material.userData.isBreathLight&&t.material.emissiveIntensity){t.material.emissive||(t.material.emissive=new y.Color(16777215)),t.material.emissiveIntensity=2,t.material.toneMapped=!1;const s=1e3,n=new Pt.Tween(t.material).to({emissiveIntensity:.2}).easing(Pt.Easing.Quintic.InOut).duration(s),o=new Pt.Tween(t.material).to({emissiveIntensity:2}).easing(Pt.Easing.Quintic.InOut).duration(s);n.onComplete(()=>o.start()),o.onComplete(()=>n.start()),n.start(),this._breathLights.push(n,o)}t.material.userData.changeColor&&(this.skins.find(s=>s.name===t.material.userData.name)||this.skins.push(new Mh({name:t.material.userData.name,target:t.material})))}if(t.material)if(Array.isArray(t.material))t.material.forEach(n=>{if(n.userData.isLOGO){t.material.transparent=!0;let o;const a={width:0,height:0};t.material.map&&t.material.map.image&&(a.width=t.material.map.image.width,a.height=t.material.map.image.height,o=mh(t.material.map.image));const h=new yh({name:n.userData.name,target:t,size:Ad(t),imageSize:a,imageUrl:o});this._logos.push(h)}n.userData.isTransparent&&(n.transparent=!0),this._materialsCache.set(n.uuid,{opacity:n.opacity,transparent:n.transparent,roughness:n.roughness,metalness:n.metalness,color:n.color,mat:n})});else{const s=t.material;if(s.userData.isLOGO){t.material.transparent=!0;let n;const o={width:0,height:0};t.material.map&&t.material.map.image&&(o.width=t.material.map.image.width,o.height=t.material.map.image.height,n=mh(t.material.map.image));const a=new yh({name:s.userData.name,target:t,size:Ad(t),imageSize:o,imageUrl:n});this._logos.push(a)}s.userData.isTransparent&&(s.transparent=!0),this._materialsCache.set(s.uuid,{opacity:s.opacity,transparent:s.transparent,roughness:s.roughness,metalness:s.metalness,color:s.color,mat:s})}}this.generateController(t,e),this.generateDimension(t,e);const i=this.generateSlot(t,e);i&&this._slots.push(i),t.userData.isOrigin&&Object.keys(t.userData).forEach(n=>{if(n.startsWith("follow_")){const o=n.replace("follow_","");this.shapeKeys.has(o)&&(this.sizeBox.follow=o,this.sizeBox.followOrigin=this._shapeKeys.get(o)||0,this.sizeBox.followScale=t.userData[n])}})}),this.slots.forEach(t=>{t.props.mirrorTarget&&(t.mirrorTarget=this.slots.find(i=>i.props.slot.name===t.props.mirrorTarget))}),e.updateMatrixWorld(!0),this._container.add(e),this.sizeBox.generate(e),this.sizeBox.show()}setHeight(e){this.setShapeKey("height",e)}setWeight(e){this.setShapeKey("width",e)}setLength(e){this.setShapeKey("length",e)}limitValue(e){this.name==="SFL-CDD14"&&(e>1.6?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),["SFL-CDD20","SFL-CDD20-Y"].includes(this.name)&&(e>1.6?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),this.name==="SFL-CDD15"&&(e>2.43?this.setShapeKey("mast",1):this.setShapeKey("mast",0)),["SFL-CPD20-Y","SFL-CPD30-Y"].includes(this.name)&&(e>3.5?this.setShapeKey("mast",2):e>3?this.setShapeKey("mast",1):this.setShapeKey("mast",0))}setForkHeight(e){if(this._fork){if(e>this._forkMaxHeight&&(e=this._forkMaxHeight),this._fork.position.z=e,this._masts.size===1){const t=this._masts.get(2),i=(t==null?void 0:t.userData.startHeight)||.1;t&&(t.position.z=(e-i)*.5)}this._emitter.emit("fork-height-change",e)}}setForkMaxHeight(e){this._fork&&(this._forkMaxHeight=e,this.limitValue(e),this.controllers.forEach(t=>{t.name.toLowerCase().includes("fork")&&(t.props.max=e)}),this._fork&&this.forkHeight>this._forkMaxHeight&&this.setForkHeight(e))}setLiftHeight(e){this._lift&&(e>this._liftMaxHeight&&(e=this._liftMaxHeight),this._lift.position.z=e)}getLiftMaxHeight(){return this._liftMaxHeight}setLiftMaxHeight(e){if(!this._lift)return;this._liftMaxHeight=e,this.limitValue(e),this.controllers.forEach(n=>{n.name.toLowerCase().includes("lift")&&(n.props.max=e)}),this.liftHeight>this._liftMaxHeight&&this.setLiftHeight(e);let t=.46;this.levelOffset&&(t=this.levelOffset+.1);let i=e+t;const s=this.getShelfMinHeight()+t||0;i<s&&(i=s),this.setHeight(i)}setJackMaxHeight(e){this._jack&&(this._jackMaxHeight=e,this.limitValue(e),this.controllers.forEach(t=>{t.name.toLowerCase().includes("jack")&&(t.props.max=e)}),this.jackHeight>this._jackMaxHeight&&this.setJackHeight(e))}setJackHeight(e){this._jack&&(e>this._jackMaxHeight&&(e=this._jackMaxHeight),requestAnimationFrame(()=>{this.setShapeKey("jackHeight",e,!1)}),this._jack.position.z=e)}setLevel(e){}setGoodsSize(e){this._goodsSize.length=e.length,this._goodsSize.width=e.width,this._goodsSize.height=e.height,this.setShelfLevel(this._shelfMaxLevel)}getShelfMinHeight(){const e=this.levelOffset,t=this._shelfMaxLevel,i=this._shelves.get(0);return i?i.position.z+e*t+.1:0}getShelfMaxShelfHeight(){const e=this.levelOffset,t=this._shelfMaxLevel,i=this._shelves.get(0);if(i)return i.position.z+e*(t-1)}get levelOffset(){return this._goodsSize.height+.2}setShapeKeyToMesh(e,t,i){if(!Object.keys(e.morphTargetDictionary||{}).includes(t))return;const s=e.morphTargetDictionary[t];e.morphTargetInfluences&&(e.morphTargetInfluences[s]=i),e.geometry.translate(0,0,1e-5)}setShelfLevel(e=3){var s;if(!this._shelf)return;this._shelfMaxLevel=e;const t=this.levelOffset;this._shelves.delete(0),this._shelves.forEach(n=>{ii(n),n.parent&&n.removeFromParent()}),this.goods=[],this._shelves.clear(),this._shelves.set(0,this._shelf);for(let n=1;n<e;n++){if(!this._shelf)return;this._shelf.traverse(h=>{Tm(h)&&(this.setShapeKeyToMesh(h,"goodsWidth",this._goodsSize.width),this.setShapeKeyToMesh(h,"goodsLength",this._goodsSize.length))});const o=this._shelf.clone(!0);o.position.z+=t*n,this._shelves.set(n,o),(s=this._shelf.parent)==null||s.add(o);let a;if(o.traverse(h=>{h.userData.isShelfContainer&&(a=h)}),(this.shapeKeys.has("goodsLength")||this.shapeKeys.has("goodsWidth"))&&(a==null||a.position.setX((a==null?void 0:a.position.x)-this._goodsSize.length/2)),a){const h=new Ud(this._goodsSize.length,this._goodsSize.width,this._goodsSize.height);if(a.add(h),this.goods.push(h),n===1){const u=new Ud(this._goodsSize.length,this._goodsSize.width,this._goodsSize.height);u.position.z-=t,a.add(u),this.goods.push(u)}}}const i=this.getShelfMinHeight()||0;this._liftMaxHeight<i&&this.setLiftMaxHeight(i)}generateOuterLine(){this.traverse(e=>{if(e.userData.isOuterObject){const t=this.sizeBox.radius;this._outline?this._outline.update(t):(this._outline=new Am(t,0),this.add(this._outline))}})}generateController(e,t){if(this.showController){if(e.userData.isForkController&&e.userData.target){const i=e.userData.target.name,{min:s,max:n}=e.userData;let o;if(t.traverse(h=>{h.name===i&&(o=h)}),!o)return;const a=new Nd({name:"",target:i,default:0,min:s,max:n},o);e.add(a)}else if(e.userData.isController&&e.userData.target){const i=e.userData.target.name,{min:s,max:n}=e.userData;let o;if(t.traverse(h=>{h.name===i&&(o=h)}),!o)return;const a=new Nd({name:"",userData:e.userData,target:e.userData.key,default:0,min:s||0,max:n||1},o);e.add(a),this.controllers.push(a),(o.userData.isFork||o.userData.isLift||o.userData.isJack)&&(this._forkMaxHeight=n||1,this._liftMaxHeight=n||1,this._jackMaxHeight=n||1,a.addListener("change",h=>{this.setForkHeight(h),this.setLiftHeight(h),this.setJackHeight(h)}))}}}generateDimension(e,t){if(e.userData.isDimension){const i=e.userData.divider,s=$A(e.userData.startOrigin),n=e.userData.axios;let o,a;if(n==="x"?(o=new y.Vector3(e.userData.start-e.position.x,0,0),a=o.clone().setX(e.userData.end-e.position.x)):n==="z"?(o=new y.Vector3(0,e.userData.start-e.position.y,0),a=o.clone().setY(e.userData.end-e.position.y)):(o=new y.Vector3(0,0,e.userData.start-e.position.z),a=o.clone().setZ(e.userData.end-e.position.z)),!Object.keys(e.userData).flatMap(l=>l.startsWith("target")?e.userData[l].name:[]).length)return;const d=new BT({start:o,end:a,startOrigin:s,axios:n,divider:i});e.add(d)}}generateSlot(e,t){var i,s;if(e.userData.isSlot){const n=e.userData.name,o=e.userData.isMirror,a=(i=e.userData.mirrorSlot)==null?void 0:i.name;if(n){const h=e.userData.holeTarget&&e.userData.holeTarget.name;let u;h&&t.traverse(f=>{f.name===h&&(u=f)});const d=new Map;Object.keys(e.userData).forEach(f=>{if(f.startsWith("follow_")){const p=f.split("_")[1];if(p){let g=e.userData[f];d.set(p,{scale:g,origin:this.shapeKeys.get(p)||0})}}});const l=(s=this._app)==null?void 0:s.props.isMobile,c=new _h({name:n,follows:d,slot:e,show:this._showSlots,isMirror:o,mirrorTarget:a,isMobile:l});return c.holeTarget=u,c.addEventListener(Le.ON_DROP,f=>{this._app&&this._app.props.useSound&&this._app.sound.play()}),c.addEventListener(Le.ON_BEFORE_SELECTED,f=>{this._slots.forEach(p=>{p.selected&&(p.selected=!1)})}),c.addEventListener(Le.ON_ERROR_STATE_CHANGE,f=>{if(this._app)if(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(p=>!!p.parent),f){if(c.device){if(this._app._outlinePassError.selectedObjects.find(g=>{var m;return g.parent==((m=c.device)==null?void 0:m.parent)}))return;this._app._outlinePassError.selectedObjects=[c.device,...this._app._outlinePassError.selectedObjects]}}else c.device&&(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(p=>{var g;return p.parent!=((g=c.device)==null?void 0:g.parent)}))}),c}}}clean(){this._emitter.removeAllListeners(),this.controllers.forEach(e=>e.dispose()),this.controllers=[],ii(this._container),this._levels.forEach(e=>e.destroy()),this._levels.clear(),this._slots=[],this._logos=[],this._skins=[],this._materialsCache.clear(),this.opacityCache=void 0,this._breathLights.forEach(e=>e.stop()),this._breathLights=[],this.sizeBox.reset()}destroy(){this._pointCloudMode&&this._clearPointClouds(),this.clean(),this.sizeBox.destroy()}setPointCloudMode(e){this._pointCloudMode=e,e?(this.sizeBox.hide(),this.controllers.forEach(t=>t.hide()),this.slots.forEach(t=>t.hide()),this._createPointClouds()):(this.sizeBox.show(),this.slots.forEach(t=>t.hide()),this.controllers.forEach(t=>t.show()),this._clearPointClouds())}_createPointClouds(){this._clearPointClouds();const e=[],t=[],i=.02,s=.05,n=1e7;new y.Vector3;const o=new y.Vector3(1/0,1/0,1/0),a=new y.Vector3(-1/0,-1/0,-1/0);this._container.traverse(d=>{if(d instanceof y.Mesh&&d.geometry&&d.visible){this._originalMeshes.set(d.uuid,{mesh:d,visible:d.visible}),d.visible=!1,d.geometry.computeBoundingBox();const l=d.geometry.boundingBox.clone();l.applyMatrix4(d.matrixWorld),o.min(l.min),a.max(l.max);const c=d.geometry,f=c.attributes.position,p=c.index;if(f){d.updateMatrixWorld();const g=d.matrixWorld;if(p){const m=p.array;for(let _=0;_<m.length;_+=3){const v=m[_],x=m[_+1],b=m[_+2],w=new y.Vector3(f.getX(v),f.getY(v),f.getZ(v)).applyMatrix4(g),C=new y.Vector3(f.getX(x),f.getY(x),f.getZ(x)).applyMatrix4(g),S=new y.Vector3(f.getX(b),f.getY(b),f.getZ(b)).applyMatrix4(g);e.length<n*3&&this._generatePointsOnTriangle(w,C,S,i,s,e,t)}}else for(let m=0;m<f.count;m++){const _=new y.Vector3(f.getX(m),f.getY(m),f.getZ(m)).applyMatrix4(g);e.push(_.x,_.y,_.z);const v=(_.y-o.y)/(a.y-o.y);t.push(0,v*.5,.5+v*.5)}}}});const h=this._removeDuplicatePoints(e,t,i*.5),u=1e5;if(h.positions.length>u*3){const d=u*3/h.positions.length,l=[],c=[];for(let f=0;f<h.positions.length;f+=3)Math.random()<d&&(l.push(h.positions[f],h.positions[f+1],h.positions[f+2]),c.push(h.colors[f],h.colors[f+1],h.colors[f+2]));h.positions=l,h.colors=c}if(h.positions.length>0){const d=o.clone().add(a).multiplyScalar(.5),l=a.clone().sub(o),c=Math.max(l.x,l.y,l.z);if(c===0||!isFinite(c)){console.warn("Point cloud generation failed: invalid model bounds");return}const f=new Float32Array(h.positions.length),p=new Float32Array(h.positions),g=new Float32Array(h.colors.length),m=new Float32Array(h.colors);for(let T=0;T<h.positions.length;T+=3){const M=T/3;p[T],p[T+1],p[T+2];const R=M/(h.positions.length/3)*Math.PI*4,E=Math.random(),A=Math.sqrt(E),I=.05+Math.random()*.1,D=c*2.2*(I+A*(1-I)),B=3,k=M%B*(Math.PI*2/B)+R,z=Math.random()*.4,q=D*(1+z),L=A,F=.25+A*.2,Q=(Math.random()<.5?-1:1)*Math.random()*c*F*L,ee=(Math.random()-.5)*c*.25*L,oe=c*.3*(1+A*.5),pe=1.2,ye=.85;f[T]=d.x+Math.cos(k)*q*pe+(Math.random()-.5)*oe,f[T+1]=d.y+Q+ee,f[T+2]=d.z+Math.sin(k)*q*ye+(Math.random()-.5)*oe;const Ae=Math.random(),ae=Math.random()<.1?1.5:1,be=A>.75?.7:A>.5?.4:0,ne=Ae*(1-be);ne<.7?(g[T]=(.1+Math.random()*.2)*ae,g[T+1]=(.6+Math.random()*.4)*ae,g[T+2]=(.8+Math.random()*.2)*ae):ne<.8?(g[T]=(.6+Math.random()*.4)*ae,g[T+1]=(.1+Math.random()*.3)*ae,g[T+2]=(.8+Math.random()*.2)*ae):ne<.92?(g[T]=(.8+Math.random()*.2)*ae,g[T+1]=(.2+Math.random()*.3)*ae,g[T+2]=(.6+Math.random()*.3)*ae):(g[T]=(.9+Math.random()*.1)*ae,g[T+1]=(.4+Math.random()*.3)*ae,g[T+2]=(.1+Math.random()*.2)*ae)}const _=new y.BufferGeometry;_.setAttribute("position",new y.Float32BufferAttribute(f,3)),_.setAttribute("color",new y.Float32BufferAttribute(g,3));const v=new y.PointsMaterial({size:.002,color:"#367BF5",vertexColors:!1,opacity:.1,transparent:!1,depthWrite:!1,sizeAttenuation:!0}),x=new y.Points(_,v);this.add(x),this._pointClouds.push(x);const b=_.attributes.position,w=_.attributes.color,C={progress:0};v.opacity=.3;const S=new Pt.Tween(C).to({progress:1},600).easing(Pt.Easing.Linear.None).onUpdate(()=>{const T=C.progress,M=b.array,P=w.array,R=.6,E=T<R,A=T<.9,I=E?T/R:1,D=I*I,B=D*Math.PI*1.25,k=E?0:(T-R)/(1-R),q=(1-Math.pow(1-k,3))*Math.PI*.75,L=E?B:B+q;for(let G=0;G<M.length;G+=3){const Q=f[G],ee=f[G+1],oe=f[G+2],pe=p[G],ye=p[G+1],Ae=p[G+2],ae=E?D:1,be=Q+(pe-Q)*ae,ne=ee+(ye-ee)*ae,ve=oe+(Ae-oe)*ae,he=be-d.x,Be=ve-d.z;if(E){const Ne=Math.sqrt(he*he+Be*Be),Pi=Math.atan2(Be,he)+L;M[G]=d.x+Math.cos(Pi)*Ne,M[G+1]=ne,M[G+2]=d.z+Math.sin(Pi)*Ne}else{const Ne=Math.sqrt(he*he+Be*Be),Pi=Math.atan2(Be,he)+L;M[G]=d.x+Math.cos(Pi)*Ne,M[G+1]=ne,M[G+2]=d.z+Math.sin(Pi)*Ne}A&&(P[G]=g[G]+(m[G]-g[G])*T,P[G+1]=g[G+1]+(m[G+1]-g[G+1])*T,P[G+2]=g[G+2]+(m[G+2]-g[G+2])*T)}let F=.3;E?F=.3+.4*D:F=.7-.1*k,v.opacity=F,b.needsUpdate=!0,A&&(w.needsUpdate=!0)}).onComplete(()=>{const T=this._pointCloudAnimations.indexOf(S);T>-1&&this._pointCloudAnimations.splice(T,1);const M=new tf.LineMaterial({color:"#222",linewidth:.001,opacity:.1,transparent:!0,depthTest:!0,depthWrite:!1}),P=new y.MeshBasicMaterial({colorWrite:!0,color:"#0000ff",depthWrite:!1,depthTest:!0,transparent:!0,opacity:.12}),R=new y.Mesh(this._mergedGeometry,P);R.renderOrder=0,this.lines.add(R);const E=new y.EdgesGeometry(this._mergedGeometry,15),A=new ng.LineSegmentsGeometry().fromEdgesGeometry(E),I=new sg.LineSegments2(A,M);I.renderOrder=1,this.slots.forEach(D=>D.show()),x.visible=!1}).start();this._pointCloudAnimations.push(S)}}_generatePointsOnTriangle(e,t,i,s,n,o,a){const h=e.distanceTo(t),u=t.distanceTo(i),d=i.distanceTo(e),l=Math.max(h,u,d),c=Math.max(2,Math.ceil(l/s));if(l>n)for(let f=0;f<=c;f++)for(let p=0;p<=c-f;p++){const g=f/c,m=p/c,_=1-g-m;if(_>=0){const v=new y.Vector3().addScaledVector(e,g).addScaledVector(t,m).addScaledVector(i,_);o.push(v.x,v.y,v.z),a.push(0,v.y/5,1-v.y/1.4)}}else{o.push(e.x,e.y,e.z),o.push(t.x,t.y,t.z),o.push(i.x,i.y,i.z);for(let f=0;f<3;f++)a.push(0,0,0)}}_removeDuplicatePoints(e,t,i){const s=[],n=[],o=new Map;for(let a=0;a<e.length;a+=3){const h=e[a],u=e[a+1],d=e[a+2],l=`${Math.round(h/i)}_${Math.round(u/i)}_${Math.round(d/i)}`;o.has(l)||(o.set(l,!0),s.push(h,u,d),n.push(t[a],t[a+1],t[a+2]))}return{positions:s,colors:n}}_clearPointClouds(){this._pointCloudAnimations.forEach(e=>{e.stop()}),this._pointCloudAnimations=[],this._pointClouds.forEach(e=>{e.geometry.dispose(),e.material instanceof y.PointsMaterial&&e.material.dispose(),e.removeFromParent()}),this._pointClouds=[],this._originalMeshes.forEach(({mesh:e,visible:t})=>{e.visible=t}),this._originalMeshes.clear()}playAction(e,t=!0){}pauseAction(e){console.log(`Pausing action: ${e}`)}}const Em=0,kT=1,NT=2,Gd=2,el=1.25,zd=1,Xs=6*4+4+4,ta=65535,UT=Math.pow(2,-24),tl=Symbol("SKIP_GENERATION");function GT(r){return r.index?r.index.count:r.attributes.position.count}function us(r){return GT(r)/3}function zT(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function HT(r,e){if(!r.index){const t=r.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=zT(t,i);r.setIndex(new y.BufferAttribute(s,1));for(let n=0;n<t;n++)s[n]=n}}function Cm(r){const e=us(r),t=r.drawRange,i=t.start/3,s=(t.start+t.count)/3,n=Math.max(0,i),o=Math.min(e,s)-n;return[{offset:Math.floor(n),count:Math.floor(o)}]}function Mm(r){if(!r.groups||!r.groups.length)return Cm(r);const e=[],t=new Set,i=r.drawRange,s=i.start/3,n=(i.start+i.count)/3;for(const a of r.groups){const h=a.start/3,u=(a.start+a.count)/3;t.add(Math.max(s,h)),t.add(Math.min(n,u))}const o=Array.from(t.values()).sort((a,h)=>a-h);for(let a=0;a<o.length-1;a++){const h=o[a],u=o[a+1];e.push({offset:Math.floor(h),count:Math.floor(u-h)})}return e}function VT(r){if(r.groups.length===0)return!1;const e=us(r),t=Mm(r).sort((n,o)=>n.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return t.forEach(({count:n})=>s+=n),e!==s}function il(r,e,t,i,s){let n=1/0,o=1/0,a=1/0,h=-1/0,u=-1/0,d=-1/0,l=1/0,c=1/0,f=1/0,p=-1/0,g=-1/0,m=-1/0;for(let _=e*6,v=(e+t)*6;_<v;_+=6){const x=r[_+0],b=r[_+1],w=x-b,C=x+b;w<n&&(n=w),C>h&&(h=C),x<l&&(l=x),x>p&&(p=x);const S=r[_+2],T=r[_+3],M=S-T,P=S+T;M<o&&(o=M),P>u&&(u=P),S<c&&(c=S),S>g&&(g=S);const R=r[_+4],E=r[_+5],A=R-E,I=R+E;A<a&&(a=A),I>d&&(d=I),R<f&&(f=R),R>m&&(m=R)}i[0]=n,i[1]=o,i[2]=a,i[3]=h,i[4]=u,i[5]=d,s[0]=l,s[1]=c,s[2]=f,s[3]=p,s[4]=g,s[5]=m}function WT(r,e=null,t=null,i=null){const s=r.attributes.position,n=r.index?r.index.array:null,o=us(r),a=s.normalized;let h;e===null?(h=new Float32Array(o*6*4),t=0,i=o):(h=e,t=t||0,i=i||o);const u=s.array,d=s.offset||0;let l=3;s.isInterleavedBufferAttribute&&(l=s.data.stride);const c=["getX","getY","getZ"];for(let f=t;f<t+i;f++){const p=f*3,g=f*6;let m=p+0,_=p+1,v=p+2;n&&(m=n[m],_=n[_],v=n[v]),a||(m=m*l+d,_=_*l+d,v=v*l+d);for(let x=0;x<3;x++){let b,w,C;a?(b=s[c[x]](m),w=s[c[x]](_),C=s[c[x]](v)):(b=u[m+x],w=u[_+x],C=u[v+x]);let S=b;w<S&&(S=w),C<S&&(S=C);let T=b;w>T&&(T=w),C>T&&(T=C);const M=(T-S)/2,P=x*2;h[g+P+0]=S+M,h[g+P+1]=M+(Math.abs(S)+M)*UT}}return h}function xe(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function Hd(r){let e=-1,t=-1/0;for(let i=0;i<3;i++){const s=r[i+3]-r[i];s>t&&(t=s,e=i)}return e}function Vd(r,e){e.set(r)}function Wd(r,e,t){let i,s;for(let n=0;n<3;n++){const o=n+3;i=r[n],s=e[n],t[n]=i<s?i:s,i=r[o],s=e[o],t[o]=i>s?i:s}}function zn(r,e,t){for(let i=0;i<3;i++){const s=e[r+2*i],n=e[r+2*i+1],o=s-n,a=s+n;o<t[i]&&(t[i]=o),a>t[i+3]&&(t[i+3]=a)}}function ws(r){const e=r[3]-r[0],t=r[4]-r[1],i=r[5]-r[2];return 2*(e*t+t*i+i*e)}const Vt=32,$T=(r,e)=>r.candidate-e.candidate,ai=new Array(Vt).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Hn=new Float32Array(6);function XT(r,e,t,i,s,n){let o=-1,a=0;if(n===Em)o=Hd(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(n===kT)o=Hd(r),o!==-1&&(a=jT(t,i,s,o));else if(n===NT){const h=ws(r);let u=el*s;const d=i*6,l=(i+s)*6;for(let c=0;c<3;c++){const f=e[c],m=(e[c+3]-f)/Vt;if(s<Vt/4){const _=[...ai];_.length=s;let v=0;for(let b=d;b<l;b+=6,v++){const w=_[v];w.candidate=t[b+2*c],w.count=0;const{bounds:C,leftCacheBounds:S,rightCacheBounds:T}=w;for(let M=0;M<3;M++)T[M]=1/0,T[M+3]=-1/0,S[M]=1/0,S[M+3]=-1/0,C[M]=1/0,C[M+3]=-1/0;zn(b,t,C)}_.sort($T);let x=s;for(let b=0;b<x;b++){const w=_[b];for(;b+1<x&&_[b+1].candidate===w.candidate;)_.splice(b+1,1),x--}for(let b=d;b<l;b+=6){const w=t[b+2*c];for(let C=0;C<x;C++){const S=_[C];w>=S.candidate?zn(b,t,S.rightCacheBounds):(zn(b,t,S.leftCacheBounds),S.count++)}}for(let b=0;b<x;b++){const w=_[b],C=w.count,S=s-w.count,T=w.leftCacheBounds,M=w.rightCacheBounds;let P=0;C!==0&&(P=ws(T)/h);let R=0;S!==0&&(R=ws(M)/h);const E=zd+el*(P*C+R*S);E<u&&(o=c,u=E,a=w.candidate)}}else{for(let x=0;x<Vt;x++){const b=ai[x];b.count=0,b.candidate=f+m+x*m;const w=b.bounds;for(let C=0;C<3;C++)w[C]=1/0,w[C+3]=-1/0}for(let x=d;x<l;x+=6){let C=~~((t[x+2*c]-f)/m);C>=Vt&&(C=Vt-1);const S=ai[C];S.count++,zn(x,t,S.bounds)}const _=ai[Vt-1];Vd(_.bounds,_.rightCacheBounds);for(let x=Vt-2;x>=0;x--){const b=ai[x],w=ai[x+1];Wd(b.bounds,w.rightCacheBounds,b.rightCacheBounds)}let v=0;for(let x=0;x<Vt-1;x++){const b=ai[x],w=b.count,C=b.bounds,T=ai[x+1].rightCacheBounds;w!==0&&(v===0?Vd(C,Hn):Wd(C,Hn,Hn)),v+=w;let M=0,P=0;v!==0&&(M=ws(Hn)/h);const R=s-v;R!==0&&(P=ws(T)/h);const E=zd+el*(M*v+P*R);E<u&&(o=c,u=E,a=b.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:o,pos:a}}function jT(r,e,t,i){let s=0;for(let n=e,o=e+t;n<o;n++)s+=r[n*6+i*2];return s/t}class rl{constructor(){this.boundingData=new Float32Array(6)}}function YT(r,e,t,i,s,n){let o=i,a=i+s-1;const h=n.pos,u=n.axis*2;for(;;){for(;o<=a&&t[o*6+u]<h;)o++;for(;o<=a&&t[a*6+u]>=h;)a--;if(o<a){for(let d=0;d<3;d++){let l=e[o*3+d];e[o*3+d]=e[a*3+d],e[a*3+d]=l}for(let d=0;d<6;d++){let l=t[o*6+d];t[o*6+d]=t[a*6+d],t[a*6+d]=l}o++,a--}else return o}}function qT(r,e,t,i,s,n){let o=i,a=i+s-1;const h=n.pos,u=n.axis*2;for(;;){for(;o<=a&&t[o*6+u]<h;)o++;for(;o<=a&&t[a*6+u]>=h;)a--;if(o<a){let d=r[o];r[o]=r[a],r[a]=d;for(let l=0;l<6;l++){let c=t[o*6+l];t[o*6+l]=t[a*6+l],t[a*6+l]=c}o++,a--}else return o}}function Xe(r,e){return e[r+15]===65535}function Qe(r,e){return e[r+6]}function rt(r,e){return e[r+14]}function st(r){return r+8}function nt(r,e){return e[r+6]}function Im(r,e){return e[r+7]}let Pm,Os,mo,Rm;const ZT=Math.pow(2,32);function vh(r){return"count"in r?1:1+vh(r.left)+vh(r.right)}function KT(r,e,t){return Pm=new Float32Array(t),Os=new Uint32Array(t),mo=new Uint16Array(t),Rm=new Uint8Array(t),xh(r,e)}function xh(r,e){const t=r/4,i=r/2,s="count"in e,n=e.boundingData;for(let o=0;o<6;o++)Pm[t+o]=n[o];if(s)if(e.buffer){const o=e.buffer;Rm.set(new Uint8Array(o),r);for(let a=r,h=r+o.byteLength;a<h;a+=Xs){const u=a/2;Xe(u,mo)||(Os[a/4+6]+=t)}return r+o.byteLength}else{const o=e.offset,a=e.count;return Os[t+6]=o,mo[i+14]=a,mo[i+15]=ta,r+Xs}else{const o=e.left,a=e.right,h=e.splitAxis;let u;if(u=xh(r+Xs,o),u/4>ZT)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Os[t+6]=u/4,u=xh(u,a),Os[t+7]=h,u}}function QT(r,e){const t=(r.index?r.index.count:r.attributes.position.count)/3,i=t>2**16,s=i?4:2,n=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),o=i?new Uint32Array(n):new Uint16Array(n);for(let a=0,h=o.length;a<h;a++)o[a]=a;return o}function JT(r,e,t,i,s){const{maxDepth:n,verbose:o,maxLeafTris:a,strategy:h,onProgress:u,indirect:d}=s,l=r._indirectBuffer,c=r.geometry,f=c.index?c.index.array:null,p=d?qT:YT,g=us(c),m=new Float32Array(6);let _=!1;const v=new rl;return il(e,t,i,v.boundingData,m),b(v,t,i,m),v;function x(w){u&&u(w/g)}function b(w,C,S,T=null,M=0){if(!_&&M>=n&&(_=!0,o&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(c))),S<=a||M>=n)return x(C+S),w.offset=C,w.count=S,w;const P=XT(w.boundingData,T,e,C,S,h);if(P.axis===-1)return x(C+S),w.offset=C,w.count=S,w;const R=p(l,f,e,C,S,P);if(R===C||R===C+S)x(C+S),w.offset=C,w.count=S;else{w.splitAxis=P.axis;const E=new rl,A=C,I=R-C;w.left=E,il(e,A,I,E.boundingData,m),b(E,A,I,m,M+1);const D=new rl,B=R,k=S-I;w.right=D,il(e,B,k,D.boundingData,m),b(D,B,k,m,M+1)}return w}}function eS(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=QT(t,e.useSharedArrayBuffer),VT(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||HT(t,e);const i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=WT(t),n=e.indirect?Cm(t):Mm(t);r._roots=n.map(o=>{const a=JT(r,s,o.offset,o.count,e),h=vh(a),u=new i(Xs*h);return KT(0,a,u),u})}class ri{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,o=e.length;n<o;n++){const h=e[n][t];i=h<i?h:i,s=h>s?h:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,o=t.length;n<o;n++){const a=t[n],h=e.dot(a);i=h<i?h:i,s=h>s?h:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}ri.prototype.setFromBox=function(){const r=new y.Vector3;return function(t,i){const s=i.min,n=i.max;let o=1/0,a=-1/0;for(let h=0;h<=1;h++)for(let u=0;u<=1;u++)for(let d=0;d<=1;d++){r.x=s.x*h+n.x*(1-h),r.y=s.y*u+n.y*(1-u),r.z=s.z*d+n.z*(1-d);const l=t.dot(r);o=Math.min(l,o),a=Math.max(l,a)}this.min=o,this.max=a}}();const tS=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Vector3;return function(s,n,o){const a=s.start,h=r,u=n.start,d=e;t.subVectors(a,u),r.subVectors(s.end,s.start),e.subVectors(n.end,n.start);const l=t.dot(d),c=d.dot(h),f=d.dot(d),p=t.dot(h),m=h.dot(h)*f-c*c;let _,v;m!==0?_=(l*c-p*f)/m:_=0,v=(l+_*c)/f,o.x=_,o.y=v}}(),lc=function(){const r=new y.Vector2,e=new y.Vector3,t=new y.Vector3;return function(s,n,o,a){tS(s,n,r);let h=r.x,u=r.y;if(h>=0&&h<=1&&u>=0&&u<=1){s.at(h,o),n.at(u,a);return}else if(h>=0&&h<=1){u<0?n.at(0,a):n.at(1,a),s.closestPointToPoint(a,!0,o);return}else if(u>=0&&u<=1){h<0?s.at(0,o):s.at(1,o),n.closestPointToPoint(o,!0,a);return}else{let d;h<0?d=s.start:d=s.end;let l;u<0?l=n.start:l=n.end;const c=e,f=t;if(s.closestPointToPoint(l,!0,e),n.closestPointToPoint(d,!0,t),c.distanceToSquared(l)<=f.distanceToSquared(d)){o.copy(c),a.copy(l);return}else{o.copy(d),a.copy(f);return}}}}(),iS=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Plane,i=new y.Line3;return function(n,o){const{radius:a,center:h}=n,{a:u,b:d,c:l}=o;if(i.start=u,i.end=d,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a||(i.start=u,i.end=l,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a)||(i.start=d,i.end=l,i.closestPointToPoint(h,!0,r).distanceTo(h)<=a))return!0;const g=o.getPlane(t);if(Math.abs(g.distanceToPoint(h))<=a){const _=g.projectPoint(h,e);if(o.containsPoint(_))return!0}return!1}}(),rS=1e-15;function sl(r){return Math.abs(r)<rS}class xt extends y.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new y.Vector3),this.satBounds=new Array(4).fill().map(()=>new ri),this.points=[this.a,this.b,this.c],this.sphere=new y.Sphere,this.plane=new y.Plane,this.needsUpdate=!0}intersectsSphere(e){return iS(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,o=this.satBounds,a=n[0],h=o[0];this.getNormal(a),h.setFromPoints(a,s);const u=n[1],d=o[1];u.subVectors(e,t),d.setFromPoints(u,s);const l=n[2],c=o[2];l.subVectors(t,i),c.setFromPoints(l,s);const f=n[3],p=o[3];f.subVectors(i,e),p.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}xt.prototype.closestPointToSegment=function(){const r=new y.Vector3,e=new y.Vector3,t=new y.Line3;return function(s,n=null,o=null){const{start:a,end:h}=s,u=this.points;let d,l=1/0;for(let c=0;c<3;c++){const f=(c+1)%3;t.start.copy(u[c]),t.end.copy(u[f]),lc(t,s,r,e),d=r.distanceToSquared(e),d<l&&(l=d,n&&n.copy(r),o&&o.copy(e))}return this.closestPointToPoint(a,r),d=a.distanceToSquared(r),d<l&&(l=d,n&&n.copy(r),o&&o.copy(a)),this.closestPointToPoint(h,r),d=h.distanceToSquared(r),d<l&&(l=d,n&&n.copy(r),o&&o.copy(h)),Math.sqrt(l)}}();xt.prototype.intersectsTriangle=function(){const r=new xt,e=new Array(3),t=new Array(3),i=new ri,s=new ri,n=new y.Vector3,o=new y.Vector3,a=new y.Vector3,h=new y.Vector3,u=new y.Vector3,d=new y.Line3,l=new y.Line3,c=new y.Line3,f=new y.Vector3;function p(g,m,_){const v=g.points;let x=0,b=-1;for(let w=0;w<3;w++){const{start:C,end:S}=d;C.copy(v[w]),S.copy(v[(w+1)%3]),d.delta(o);const T=sl(m.distanceToPoint(C));if(sl(m.normal.dot(o))&&T){_.copy(d),x=2;break}const M=m.intersectLine(d,f);if(!M&&T&&f.copy(C),(M||T)&&!sl(f.distanceTo(S))){if(x<=1)(x===1?_.start:_.end).copy(f),T&&(b=x);else if(x>=2){(b===1?_.start:_.end).copy(f),x=2;break}if(x++,x===2&&b===-1)break}}return x}return function(m,_=null,v=!1){this.needsUpdate&&this.update(),m.isExtendedTriangle?m.needsUpdate&&m.update():(r.copy(m),r.update(),m=r);const x=this.plane,b=m.plane;if(Math.abs(x.normal.dot(b.normal))>1-1e-10){const w=this.satBounds,C=this.satAxes;t[0]=m.a,t[1]=m.b,t[2]=m.c;for(let M=0;M<4;M++){const P=w[M],R=C[M];if(i.setFromPoints(R,t),P.isSeparated(i))return!1}const S=m.satBounds,T=m.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let M=0;M<4;M++){const P=S[M],R=T[M];if(i.setFromPoints(R,e),P.isSeparated(i))return!1}for(let M=0;M<4;M++){const P=C[M];for(let R=0;R<4;R++){const E=T[R];if(n.crossVectors(P,E),i.setFromPoints(n,e),s.setFromPoints(n,t),i.isSeparated(s))return!1}}return _&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),_.start.set(0,0,0),_.end.set(0,0,0)),!0}else{const w=p(this,b,l);if(w===1&&m.containsPoint(l.end))return _&&(_.start.copy(l.end),_.end.copy(l.end)),!0;if(w!==2)return!1;const C=p(m,x,c);if(C===1&&this.containsPoint(c.end))return _&&(_.start.copy(c.end),_.end.copy(c.end)),!0;if(C!==2)return!1;if(l.delta(a),c.delta(h),a.dot(h)<0){let A=c.start;c.start=c.end,c.end=A}const S=l.start.dot(a),T=l.end.dot(a),M=c.start.dot(a),P=c.end.dot(a),R=T<M,E=S<P;return S!==P&&M!==T&&R===E?!1:(_&&(u.subVectors(l.start,c.start),u.dot(a)>0?_.start.copy(l.start):_.start.copy(c.start),u.subVectors(l.end,c.end),u.dot(a)<0?_.end.copy(l.end):_.end.copy(c.end)),!0)}}}();xt.prototype.distanceToPoint=function(){const r=new y.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();xt.prototype.distanceToTriangle=function(){const r=new y.Vector3,e=new y.Vector3,t=["a","b","c"],i=new y.Line3,s=new y.Line3;return function(o,a=null,h=null){const u=a||h?i:null;if(this.intersectsTriangle(o,u))return(a||h)&&(a&&u.getCenter(a),h&&u.getCenter(h)),0;let d=1/0;for(let l=0;l<3;l++){let c;const f=t[l],p=o[f];this.closestPointToPoint(p,r),c=p.distanceToSquared(r),c<d&&(d=c,a&&a.copy(r),h&&h.copy(p));const g=this[f];o.closestPointToPoint(g,r),c=g.distanceToSquared(r),c<d&&(d=c,a&&a.copy(g),h&&h.copy(r))}for(let l=0;l<3;l++){const c=t[l],f=t[(l+1)%3];i.set(this[c],this[f]);for(let p=0;p<3;p++){const g=t[p],m=t[(p+1)%3];s.set(o[g],o[m]),lc(i,s,r,e);const _=r.distanceToSquared(e);_<d&&(d=_,a&&a.copy(r),h&&h.copy(e))}}return Math.sqrt(d)}}();class Ve{constructor(e,t,i){this.isOrientedBox=!0,this.min=new y.Vector3,this.max=new y.Vector3,this.matrix=new y.Matrix4,this.invMatrix=new y.Matrix4,this.points=new Array(8).fill().map(()=>new y.Vector3),this.satAxes=new Array(3).fill().map(()=>new y.Vector3),this.satBounds=new Array(3).fill().map(()=>new ri),this.alignedSatBounds=new Array(3).fill().map(()=>new ri),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ve.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let u=0;u<=1;u++)for(let d=0;d<=1;d++)for(let l=0;l<=1;l++){const c=1*u|2*d|4*l,f=s[c];f.x=u?i.x:t.x,f.y=d?i.y:t.y,f.z=l?i.z:t.z,f.applyMatrix4(e)}const n=this.satBounds,o=this.satAxes,a=s[0];for(let u=0;u<3;u++){const d=o[u],l=n[u],c=1<<u,f=s[c];d.subVectors(a,f),l.setFromPoints(d,s)}const h=this.alignedSatBounds;h[0].setFromPointsField(s,"x"),h[1].setFromPointsField(s,"y"),h[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Ve.prototype.intersectsBox=function(){const r=new ri;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,o=this.satAxes,a=this.alignedSatBounds;if(r.min=i.x,r.max=s.x,a[0].isSeparated(r)||(r.min=i.y,r.max=s.y,a[1].isSeparated(r))||(r.min=i.z,r.max=s.z,a[2].isSeparated(r)))return!1;for(let h=0;h<3;h++){const u=o[h],d=n[h];if(r.setFromBox(u,t),d.isSeparated(r))return!1}return!0}}();Ve.prototype.intersectsTriangle=function(){const r=new xt,e=new Array(3),t=new ri,i=new ri,s=new y.Vector3;return function(o){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(r.copy(o),r.update(),o=r);const a=this.satBounds,h=this.satAxes;e[0]=o.a,e[1]=o.b,e[2]=o.c;for(let c=0;c<3;c++){const f=a[c],p=h[c];if(t.setFromPoints(p,e),f.isSeparated(t))return!1}const u=o.satBounds,d=o.satAxes,l=this.points;for(let c=0;c<3;c++){const f=u[c],p=d[c];if(t.setFromPoints(p,l),f.isSeparated(t))return!1}for(let c=0;c<3;c++){const f=h[c];for(let p=0;p<4;p++){const g=d[p];if(s.crossVectors(f,g),t.setFromPoints(s,e),i.setFromPoints(s,l),t.isSeparated(i))return!1}}return!0}}();Ve.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Ve.prototype.distanceToPoint=function(){const r=new y.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();Ve.prototype.distanceToBox=function(){const r=["x","y","z"],e=new Array(12).fill().map(()=>new y.Line3),t=new Array(12).fill().map(()=>new y.Line3),i=new y.Vector3,s=new y.Vector3;return function(o,a=0,h=null,u=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(h||u)&&(o.getCenter(s),this.closestPointToPoint(s,i),o.closestPointToPoint(i,s),h&&h.copy(i),u&&u.copy(s)),0;const d=a*a,l=o.min,c=o.max,f=this.points;let p=1/0;for(let m=0;m<8;m++){const _=f[m];s.copy(_).clamp(l,c);const v=_.distanceToSquared(s);if(v<p&&(p=v,h&&h.copy(_),u&&u.copy(s),v<d))return Math.sqrt(v)}let g=0;for(let m=0;m<3;m++)for(let _=0;_<=1;_++)for(let v=0;v<=1;v++){const x=(m+1)%3,b=(m+2)%3,w=_<<x|v<<b,C=1<<m|_<<x|v<<b,S=f[w],T=f[C];e[g].set(S,T);const P=r[m],R=r[x],E=r[b],A=t[g],I=A.start,D=A.end;I[P]=l[P],I[R]=_?l[R]:c[R],I[E]=v?l[E]:c[R],D[P]=c[P],D[R]=_?l[R]:c[R],D[E]=v?l[E]:c[R],g++}for(let m=0;m<=1;m++)for(let _=0;_<=1;_++)for(let v=0;v<=1;v++){s.x=m?c.x:l.x,s.y=_?c.y:l.y,s.z=v?c.z:l.z,this.closestPointToPoint(s,i);const x=s.distanceToSquared(i);if(x<p&&(p=x,h&&h.copy(i),u&&u.copy(s),x<d))return Math.sqrt(x)}for(let m=0;m<12;m++){const _=e[m];for(let v=0;v<12;v++){const x=t[v];lc(_,x,i,s);const b=i.distanceToSquared(s);if(b<p&&(p=b,h&&h.copy(i),u&&u.copy(s),b<d))return Math.sqrt(b)}}return Math.sqrt(p)}}();class hc{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class sS extends hc{constructor(){super(()=>new xt)}}const ot=new sS;class nS{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const fe=new nS;let bi,Ur;const gr=[],Vn=new hc(()=>new y.Box3);function oS(r,e,t,i,s,n){bi=Vn.getPrimitive(),Ur=Vn.getPrimitive(),gr.push(bi,Ur),fe.setBuffer(r._roots[e]);const o=bh(0,r.geometry,t,i,s,n);fe.clearBuffer(),Vn.releasePrimitive(bi),Vn.releasePrimitive(Ur),gr.pop(),gr.pop();const a=gr.length;return a>0&&(Ur=gr[a-1],bi=gr[a-2]),o}function bh(r,e,t,i,s=null,n=0,o=0){const{float32Array:a,uint16Array:h,uint32Array:u}=fe;let d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);return xe(r,a,bi),i(c,f,!1,o,n+r,bi)}else{let P=function(E){const{uint16Array:A,uint32Array:I}=fe;let D=E*2;for(;!Xe(D,A);)E=st(E),D=E*2;return Qe(E,I)},R=function(E){const{uint16Array:A,uint32Array:I}=fe;let D=E*2;for(;!Xe(D,A);)E=nt(E,I),D=E*2;return Qe(E,I)+rt(D,A)};const c=st(r),f=nt(r,u);let p=c,g=f,m,_,v,x;if(s&&(v=bi,x=Ur,xe(p,a,v),xe(g,a,x),m=s(v),_=s(x),_<m)){p=f,g=c;const E=m;m=_,_=E,v=x}v||(v=bi,xe(p,a,v));const b=Xe(p*2,h),w=t(v,b,m,o+1,n+p);let C;if(w===Gd){const E=P(p),I=R(p)-E;C=i(E,I,!0,o+1,n+p,v)}else C=w&&bh(p,e,t,i,s,n,o+1);if(C)return!0;x=Ur,xe(g,a,x);const S=Xe(g*2,h),T=t(x,S,_,o+1,n+g);let M;if(T===Gd){const E=P(g),I=R(g)-E;M=i(E,I,!0,o+1,n+g,x)}else M=T&&bh(g,e,t,i,s,n,o+1);return!!M}}const As=new y.Vector3,nl=new y.Vector3;function aS(r,e,t={},i=0,s=1/0){const n=i*i,o=s*s;let a=1/0,h=null;if(r.shapecast({boundsTraverseOrder:d=>(As.copy(e).clamp(d.min,d.max),As.distanceToSquared(e)),intersectsBounds:(d,l,c)=>c<a&&c<o,intersectsTriangle:(d,l)=>{d.closestPointToPoint(e,As);const c=e.distanceToSquared(As);return c<a&&(nl.copy(As),a=c,h=l),c<n}}),a===1/0)return null;const u=Math.sqrt(a);return t.point?t.point.copy(nl):t.point=nl.clone(),t.distance=u,t.faceIndex=h,t}const _r=new y.Vector3,yr=new y.Vector3,vr=new y.Vector3,Wn=new y.Vector2,$n=new y.Vector2,Xn=new y.Vector2,$d=new y.Vector3,Xd=new y.Vector3,jd=new y.Vector3,jn=new y.Vector3;function lS(r,e,t,i,s,n,o,a){let h;if(n===y.BackSide?h=r.intersectTriangle(i,t,e,!0,s):h=r.intersectTriangle(e,t,i,n!==y.DoubleSide,s),h===null)return null;const u=r.origin.distanceTo(s);return u<o||u>a?null:{distance:u,point:s.clone()}}function hS(r,e,t,i,s,n,o,a,h,u,d){_r.fromBufferAttribute(e,n),yr.fromBufferAttribute(e,o),vr.fromBufferAttribute(e,a);const l=lS(r,_r,yr,vr,jn,h,u,d);if(l){i&&(Wn.fromBufferAttribute(i,n),$n.fromBufferAttribute(i,o),Xn.fromBufferAttribute(i,a),l.uv=y.Triangle.getInterpolation(jn,_r,yr,vr,Wn,$n,Xn,new y.Vector2)),s&&(Wn.fromBufferAttribute(s,n),$n.fromBufferAttribute(s,o),Xn.fromBufferAttribute(s,a),l.uv1=y.Triangle.getInterpolation(jn,_r,yr,vr,Wn,$n,Xn,new y.Vector2)),t&&($d.fromBufferAttribute(t,n),Xd.fromBufferAttribute(t,o),jd.fromBufferAttribute(t,a),l.normal=y.Triangle.getInterpolation(jn,_r,yr,vr,$d,Xd,jd,new y.Vector3),l.normal.dot(r.direction)>0&&l.normal.multiplyScalar(-1));const c={a:n,b:o,c:a,normal:new y.Vector3,materialIndex:0};y.Triangle.getNormal(_r,yr,vr,c.normal),l.face=c,l.faceIndex=n}return l}function ia(r,e,t,i,s,n,o){const a=i*3;let h=a+0,u=a+1,d=a+2;const l=r.index;r.index&&(h=l.getX(h),u=l.getX(u),d=l.getX(d));const{position:c,normal:f,uv:p,uv1:g}=r.attributes,m=hS(t,c,f,p,g,h,u,d,e,n,o);return m?(m.faceIndex=i,s&&s.push(m),m):null}function Se(r,e,t,i){const s=r.a,n=r.b,o=r.c;let a=e,h=e+1,u=e+2;t&&(a=t.getX(a),h=t.getX(h),u=t.getX(u)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),n.x=i.getX(h),n.y=i.getY(h),n.z=i.getZ(h),o.x=i.getX(u),o.y=i.getY(u),o.z=i.getZ(u)}function cS(r,e,t,i,s,n,o,a){const{geometry:h,_indirectBuffer:u}=r;for(let d=i,l=i+s;d<l;d++)ia(h,e,t,d,n,o,a)}function uS(r,e,t,i,s,n,o){const{geometry:a,_indirectBuffer:h}=r;let u=1/0,d=null;for(let l=i,c=i+s;l<c;l++){let f;f=ia(a,e,t,l,null,n,o),f&&f.distance<u&&(d=f,u=f.distance)}return d}function dS(r,e,t,i,s,n,o){const{geometry:a}=t,{index:h}=a,u=a.attributes.position;for(let d=r,l=e+r;d<l;d++){let c;if(c=d,Se(o,c*3,h,u),o.needsUpdate=!0,i(o,c,s,n))return!0}return!1}function fS(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,h,u=0;const d=r._roots;for(let c=0,f=d.length;c<f;c++)n=d[c],o=new Uint32Array(n),a=new Uint16Array(n),h=new Float32Array(n),l(0,u),u+=n.byteLength;function l(c,f,p=!1){const g=c*2;if(a[g+15]===ta){const _=o[c+6],v=a[g+14];let x=1/0,b=1/0,w=1/0,C=-1/0,S=-1/0,T=-1/0;for(let M=3*_,P=3*(_+v);M<P;M++){let R=i[M];const E=s.getX(R),A=s.getY(R),I=s.getZ(R);E<x&&(x=E),E>C&&(C=E),A<b&&(b=A),A>S&&(S=A),I<w&&(w=I),I>T&&(T=I)}return h[c+0]!==x||h[c+1]!==b||h[c+2]!==w||h[c+3]!==C||h[c+4]!==S||h[c+5]!==T?(h[c+0]=x,h[c+1]=b,h[c+2]=w,h[c+3]=C,h[c+4]=S,h[c+5]=T,!0):!1}else{const _=c+8,v=o[c+6],x=_+f,b=v+f;let w=p,C=!1,S=!1;e?w||(C=e.has(x),S=e.has(b),w=!C&&!S):(C=!0,S=!0);const T=w||C,M=w||S;let P=!1;T&&(P=l(_,f,w));let R=!1;M&&(R=l(v,f,w));const E=P||R;if(E)for(let A=0;A<3;A++){const I=_+A,D=v+A,B=h[I],k=h[I+3],z=h[D],q=h[D+3];h[c+A]=B<z?B:z,h[c+A+3]=k>q?k:q}return E}}}function Ei(r,e,t,i,s){let n,o,a,h,u,d;const l=1/t.direction.x,c=1/t.direction.y,f=1/t.direction.z,p=t.origin.x,g=t.origin.y,m=t.origin.z;let _=e[r],v=e[r+3],x=e[r+1],b=e[r+3+1],w=e[r+2],C=e[r+3+2];return l>=0?(n=(_-p)*l,o=(v-p)*l):(n=(v-p)*l,o=(_-p)*l),c>=0?(a=(x-g)*c,h=(b-g)*c):(a=(b-g)*c,h=(x-g)*c),n>h||a>o||((a>n||isNaN(n))&&(n=a),(h<o||isNaN(o))&&(o=h),f>=0?(u=(w-m)*f,d=(C-m)*f):(u=(C-m)*f,d=(w-m)*f),n>d||u>o)?!1:((u>n||n!==n)&&(n=u),(d<o||o!==o)&&(o=d),n<=s&&o>=i)}function pS(r,e,t,i,s,n,o,a){const{geometry:h,_indirectBuffer:u}=r;for(let d=i,l=i+s;d<l;d++){let c=u?u[d]:d;ia(h,e,t,c,n,o,a)}}function mS(r,e,t,i,s,n,o){const{geometry:a,_indirectBuffer:h}=r;let u=1/0,d=null;for(let l=i,c=i+s;l<c;l++){let f;f=ia(a,e,t,h?h[l]:l,null,n,o),f&&f.distance<u&&(d=f,u=f.distance)}return d}function gS(r,e,t,i,s,n,o){const{geometry:a}=t,{index:h}=a,u=a.attributes.position;for(let d=r,l=e+r;d<l;d++){let c;if(c=t.resolveTriangleIndex(d),Se(o,c*3,h,u),o.needsUpdate=!0,i(o,c,s,n))return!0}return!1}function _S(r,e,t,i,s,n,o){fe.setBuffer(r._roots[e]),wh(0,r,t,i,s,n,o),fe.clearBuffer()}function wh(r,e,t,i,s,n,o){const{float32Array:a,uint16Array:h,uint32Array:u}=fe,d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);cS(e,t,i,c,f,s,n,o)}else{const c=st(r);Ei(c,a,i,n,o)&&wh(c,e,t,i,s,n,o);const f=nt(r,u);Ei(f,a,i,n,o)&&wh(f,e,t,i,s,n,o)}}const yS=["x","y","z"];function vS(r,e,t,i,s,n){fe.setBuffer(r._roots[e]);const o=Ah(0,r,t,i,s,n);return fe.clearBuffer(),o}function Ah(r,e,t,i,s,n){const{float32Array:o,uint16Array:a,uint32Array:h}=fe;let u=r*2;if(Xe(u,a)){const l=Qe(r,h),c=rt(u,a);return uS(e,t,i,l,c,s,n)}else{const l=Im(r,h),c=yS[l],p=i.direction[c]>=0;let g,m;p?(g=st(r),m=nt(r,h)):(g=nt(r,h),m=st(r));const v=Ei(g,o,i,s,n)?Ah(g,e,t,i,s,n):null;if(v){const w=v.point[c];if(p?w<=o[m+l]:w>=o[m+l+3])return v}const b=Ei(m,o,i,s,n)?Ah(m,e,t,i,s,n):null;return v&&b?v.distance<=b.distance?v:b:v||b||null}}const Yn=new y.Box3,xr=new xt,br=new xt,Ts=new y.Matrix4,Yd=new Ve,qn=new Ve;function xS(r,e,t,i){fe.setBuffer(r._roots[e]);const s=Th(0,r,t,i);return fe.clearBuffer(),s}function Th(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=fe;let h=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Yd.set(t.boundingBox.min,t.boundingBox.max,i),s=Yd),Xe(h,o)){const d=e.geometry,l=d.index,c=d.attributes.position,f=t.index,p=t.attributes.position,g=Qe(r,a),m=rt(h,o);if(Ts.copy(i).invert(),t.boundsTree)return xe(r,n,qn),qn.matrix.copy(Ts),qn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>qn.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(i),v.b.applyMatrix4(i),v.c.applyMatrix4(i),v.needsUpdate=!0;for(let x=g*3,b=(m+g)*3;x<b;x+=3)if(Se(br,x,l,c),br.needsUpdate=!0,v.intersectsTriangle(br))return!0;return!1}});for(let _=g*3,v=(m+g)*3;_<v;_+=3){Se(xr,_,l,c),xr.a.applyMatrix4(Ts),xr.b.applyMatrix4(Ts),xr.c.applyMatrix4(Ts),xr.needsUpdate=!0;for(let x=0,b=f.count;x<b;x+=3)if(Se(br,x,f,p),br.needsUpdate=!0,xr.intersectsTriangle(br))return!0}}else{const d=r+8,l=a[r+6];return xe(d,n,Yn),!!(s.intersectsBox(Yn)&&Th(d,e,t,i,s)||(xe(l,n,Yn),s.intersectsBox(Yn)&&Th(l,e,t,i,s)))}}const Zn=new y.Matrix4,ol=new Ve,Ss=new Ve,bS=new y.Vector3,wS=new y.Vector3,AS=new y.Vector3,TS=new y.Vector3;function SS(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),ol.set(e.boundingBox.min,e.boundingBox.max,t),ol.needsUpdate=!0;const a=r.geometry,h=a.attributes.position,u=a.index,d=e.attributes.position,l=e.index,c=ot.getPrimitive(),f=ot.getPrimitive();let p=bS,g=wS,m=null,_=null;s&&(m=AS,_=TS);let v=1/0,x=null,b=null;return Zn.copy(t).invert(),Ss.matrix.copy(Zn),r.shapecast({boundsTraverseOrder:w=>ol.distanceToBox(w),intersectsBounds:(w,C,S)=>S<v&&S<o?(C&&(Ss.min.copy(w.min),Ss.max.copy(w.max),Ss.needsUpdate=!0),!0):!1,intersectsRange:(w,C)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:T=>Ss.distanceToBox(T),intersectsBounds:(T,M,P)=>P<v&&P<o,intersectsRange:(T,M)=>{for(let P=T,R=T+M;P<R;P++){Se(f,3*P,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let E=w,A=w+C;E<A;E++){Se(c,3*E,u,h),c.needsUpdate=!0;const I=c.distanceToTriangle(f,p,m);if(I<v&&(g.copy(p),_&&_.copy(m),v=I,x=E,b=P),I<n)return!0}}}});{const S=us(e);for(let T=0,M=S;T<M;T++){Se(f,3*T,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=w,R=w+C;P<R;P++){Se(c,3*P,u,h),c.needsUpdate=!0;const E=c.distanceToTriangle(f,p,m);if(E<v&&(g.copy(p),_&&_.copy(m),v=E,x=P,b=T),E<n)return!0}}}}}),ot.releasePrimitive(c),ot.releasePrimitive(f),v===1/0?null:(i.point?i.point.copy(g):i.point=g.clone(),i.distance=v,i.faceIndex=x,s&&(s.point?s.point.copy(_):s.point=_.clone(),s.point.applyMatrix4(Zn),g.applyMatrix4(Zn),s.distance=g.sub(s.point).length(),s.faceIndex=b),i)}function ES(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,h,u=0;const d=r._roots;for(let c=0,f=d.length;c<f;c++)n=d[c],o=new Uint32Array(n),a=new Uint16Array(n),h=new Float32Array(n),l(0,u),u+=n.byteLength;function l(c,f,p=!1){const g=c*2;if(a[g+15]===ta){const _=o[c+6],v=a[g+14];let x=1/0,b=1/0,w=1/0,C=-1/0,S=-1/0,T=-1/0;for(let M=_,P=_+v;M<P;M++){const R=3*r.resolveTriangleIndex(M);for(let E=0;E<3;E++){let A=R+E;A=i?i[A]:A;const I=s.getX(A),D=s.getY(A),B=s.getZ(A);I<x&&(x=I),I>C&&(C=I),D<b&&(b=D),D>S&&(S=D),B<w&&(w=B),B>T&&(T=B)}}return h[c+0]!==x||h[c+1]!==b||h[c+2]!==w||h[c+3]!==C||h[c+4]!==S||h[c+5]!==T?(h[c+0]=x,h[c+1]=b,h[c+2]=w,h[c+3]=C,h[c+4]=S,h[c+5]=T,!0):!1}else{const _=c+8,v=o[c+6],x=_+f,b=v+f;let w=p,C=!1,S=!1;e?w||(C=e.has(x),S=e.has(b),w=!C&&!S):(C=!0,S=!0);const T=w||C,M=w||S;let P=!1;T&&(P=l(_,f,w));let R=!1;M&&(R=l(v,f,w));const E=P||R;if(E)for(let A=0;A<3;A++){const I=_+A,D=v+A,B=h[I],k=h[I+3],z=h[D],q=h[D+3];h[c+A]=B<z?B:z,h[c+A+3]=k>q?k:q}return E}}}function CS(r,e,t,i,s,n,o){fe.setBuffer(r._roots[e]),Sh(0,r,t,i,s,n,o),fe.clearBuffer()}function Sh(r,e,t,i,s,n,o){const{float32Array:a,uint16Array:h,uint32Array:u}=fe,d=r*2;if(Xe(d,h)){const c=Qe(r,u),f=rt(d,h);pS(e,t,i,c,f,s,n,o)}else{const c=st(r);Ei(c,a,i,n,o)&&Sh(c,e,t,i,s,n,o);const f=nt(r,u);Ei(f,a,i,n,o)&&Sh(f,e,t,i,s,n,o)}}const MS=["x","y","z"];function IS(r,e,t,i,s,n){fe.setBuffer(r._roots[e]);const o=Eh(0,r,t,i,s,n);return fe.clearBuffer(),o}function Eh(r,e,t,i,s,n){const{float32Array:o,uint16Array:a,uint32Array:h}=fe;let u=r*2;if(Xe(u,a)){const l=Qe(r,h),c=rt(u,a);return mS(e,t,i,l,c,s,n)}else{const l=Im(r,h),c=MS[l],p=i.direction[c]>=0;let g,m;p?(g=st(r),m=nt(r,h)):(g=nt(r,h),m=st(r));const v=Ei(g,o,i,s,n)?Eh(g,e,t,i,s,n):null;if(v){const w=v.point[c];if(p?w<=o[m+l]:w>=o[m+l+3])return v}const b=Ei(m,o,i,s,n)?Eh(m,e,t,i,s,n):null;return v&&b?v.distance<=b.distance?v:b:v||b||null}}const Kn=new y.Box3,wr=new xt,Ar=new xt,Es=new y.Matrix4,qd=new Ve,Qn=new Ve;function PS(r,e,t,i){fe.setBuffer(r._roots[e]);const s=Ch(0,r,t,i);return fe.clearBuffer(),s}function Ch(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=fe;let h=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),qd.set(t.boundingBox.min,t.boundingBox.max,i),s=qd),Xe(h,o)){const d=e.geometry,l=d.index,c=d.attributes.position,f=t.index,p=t.attributes.position,g=Qe(r,a),m=rt(h,o);if(Es.copy(i).invert(),t.boundsTree)return xe(r,n,Qn),Qn.matrix.copy(Es),Qn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Qn.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(i),v.b.applyMatrix4(i),v.c.applyMatrix4(i),v.needsUpdate=!0;for(let x=g,b=m+g;x<b;x++)if(Se(Ar,3*e.resolveTriangleIndex(x),l,c),Ar.needsUpdate=!0,v.intersectsTriangle(Ar))return!0;return!1}});for(let _=g,v=m+g;_<v;_++){const x=e.resolveTriangleIndex(_);Se(wr,3*x,l,c),wr.a.applyMatrix4(Es),wr.b.applyMatrix4(Es),wr.c.applyMatrix4(Es),wr.needsUpdate=!0;for(let b=0,w=f.count;b<w;b+=3)if(Se(Ar,b,f,p),Ar.needsUpdate=!0,wr.intersectsTriangle(Ar))return!0}}else{const d=r+8,l=a[r+6];return xe(d,n,Kn),!!(s.intersectsBox(Kn)&&Ch(d,e,t,i,s)||(xe(l,n,Kn),s.intersectsBox(Kn)&&Ch(l,e,t,i,s)))}}const Jn=new y.Matrix4,al=new Ve,Cs=new Ve,RS=new y.Vector3,DS=new y.Vector3,BS=new y.Vector3,FS=new y.Vector3;function LS(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),al.set(e.boundingBox.min,e.boundingBox.max,t),al.needsUpdate=!0;const a=r.geometry,h=a.attributes.position,u=a.index,d=e.attributes.position,l=e.index,c=ot.getPrimitive(),f=ot.getPrimitive();let p=RS,g=DS,m=null,_=null;s&&(m=BS,_=FS);let v=1/0,x=null,b=null;return Jn.copy(t).invert(),Cs.matrix.copy(Jn),r.shapecast({boundsTraverseOrder:w=>al.distanceToBox(w),intersectsBounds:(w,C,S)=>S<v&&S<o?(C&&(Cs.min.copy(w.min),Cs.max.copy(w.max),Cs.needsUpdate=!0),!0):!1,intersectsRange:(w,C)=>{if(e.boundsTree){const S=e.boundsTree;return S.shapecast({boundsTraverseOrder:T=>Cs.distanceToBox(T),intersectsBounds:(T,M,P)=>P<v&&P<o,intersectsRange:(T,M)=>{for(let P=T,R=T+M;P<R;P++){const E=S.resolveTriangleIndex(P);Se(f,3*E,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let A=w,I=w+C;A<I;A++){const D=r.resolveTriangleIndex(A);Se(c,3*D,u,h),c.needsUpdate=!0;const B=c.distanceToTriangle(f,p,m);if(B<v&&(g.copy(p),_&&_.copy(m),v=B,x=A,b=P),B<n)return!0}}}})}else{const S=us(e);for(let T=0,M=S;T<M;T++){Se(f,3*T,l,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=w,R=w+C;P<R;P++){const E=r.resolveTriangleIndex(P);Se(c,3*E,u,h),c.needsUpdate=!0;const A=c.distanceToTriangle(f,p,m);if(A<v&&(g.copy(p),_&&_.copy(m),v=A,x=P,b=T),A<n)return!0}}}}}),ot.releasePrimitive(c),ot.releasePrimitive(f),v===1/0?null:(i.point?i.point.copy(g):i.point=g.clone(),i.distance=v,i.faceIndex=x,s&&(s.point?s.point.copy(_):s.point=_.clone(),s.point.applyMatrix4(Jn),g.applyMatrix4(Jn),s.distance=g.sub(s.point).length(),s.faceIndex=b),i)}function OS(){return typeof SharedArrayBuffer<"u"}const js=new fe.constructor,zo=new fe.constructor,fi=new hc(()=>new y.Box3),Tr=new y.Box3,Sr=new y.Box3,ll=new y.Box3,hl=new y.Box3;let cl=!1;function kS(r,e,t,i){if(cl)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");cl=!0;const s=r._roots,n=e._roots;let o,a=0,h=0;const u=new y.Matrix4().copy(t).invert();for(let d=0,l=s.length;d<l;d++){js.setBuffer(s[d]),h=0;const c=fi.getPrimitive();xe(0,js.float32Array,c),c.applyMatrix4(u);for(let f=0,p=n.length;f<p&&(zo.setBuffer(n[d]),o=ft(0,0,t,u,i,a,h,0,0,c),zo.clearBuffer(),h+=n[f].length,!o);f++);if(fi.releasePrimitive(c),js.clearBuffer(),a+=s[d].length,o)break}return cl=!1,o}function ft(r,e,t,i,s,n=0,o=0,a=0,h=0,u=null,d=!1){let l,c;d?(l=zo,c=js):(l=js,c=zo);const f=l.float32Array,p=l.uint32Array,g=l.uint16Array,m=c.float32Array,_=c.uint32Array,v=c.uint16Array,x=r*2,b=e*2,w=Xe(x,g),C=Xe(b,v);let S=!1;if(C&&w)d?S=s(Qe(e,_),rt(e*2,v),Qe(r,p),rt(r*2,g),h,o+e,a,n+r):S=s(Qe(r,p),rt(r*2,g),Qe(e,_),rt(e*2,v),a,n+r,h,o+e);else if(C){const T=fi.getPrimitive();xe(e,m,T),T.applyMatrix4(t);const M=st(r),P=nt(r,p);xe(M,f,Tr),xe(P,f,Sr);const R=T.intersectsBox(Tr),E=T.intersectsBox(Sr);S=R&&ft(e,M,i,t,s,o,n,h,a+1,T,!d)||E&&ft(e,P,i,t,s,o,n,h,a+1,T,!d),fi.releasePrimitive(T)}else{const T=st(e),M=nt(e,_);xe(T,m,ll),xe(M,m,hl);const P=u.intersectsBox(ll),R=u.intersectsBox(hl);if(P&&R)S=ft(r,T,t,i,s,n,o,a,h+1,u,d)||ft(r,M,t,i,s,n,o,a,h+1,u,d);else if(P)if(w)S=ft(r,T,t,i,s,n,o,a,h+1,u,d);else{const E=fi.getPrimitive();E.copy(ll).applyMatrix4(t);const A=st(r),I=nt(r,p);xe(A,f,Tr),xe(I,f,Sr);const D=E.intersectsBox(Tr),B=E.intersectsBox(Sr);S=D&&ft(T,A,i,t,s,o,n,h,a+1,E,!d)||B&&ft(T,I,i,t,s,o,n,h,a+1,E,!d),fi.releasePrimitive(E)}else if(R)if(w)S=ft(r,M,t,i,s,n,o,a,h+1,u,d);else{const E=fi.getPrimitive();E.copy(hl).applyMatrix4(t);const A=st(r),I=nt(r,p);xe(A,f,Tr),xe(I,f,Sr);const D=E.intersectsBox(Tr),B=E.intersectsBox(Sr);S=D&&ft(M,A,i,t,s,o,n,h,a+1,E,!d)||B&&ft(M,I,i,t,s,o,n,h,a+1,E,!d),fi.releasePrimitive(E)}}return S}const eo=new Ve,Zd=new y.Box3,NS={strategy:Em,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0};class cc{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,o=i.getIndex();let a;return t.cloneBuffers?a={roots:s.map(h=>h.slice()),index:o?o.array.slice():null,indirectBuffer:n?n.slice():null}:a={roots:s,index:o?o.array:null,indirectBuffer:n},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:s,roots:n,indirectBuffer:o}=e,a=new cc(t,{...i,[tl]:!0});if(a._roots=n,a._indirectBuffer=o||null,i.setIndex){const h=t.getIndex();if(h===null){const u=new y.BufferAttribute(e.index,1,!1);t.setIndex(u)}else h.array!==s&&(h.array.set(s),h.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...NS,[tl]:!1},t),t.useSharedArrayBuffer&&!OS())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[tl]||(eS(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new y.Box3))),this.resolveTriangleIndex=t.indirect?i=>this._indirectBuffer[i]:i=>i}refit(e=null){return(this.indirect?ES:fS)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);o(0);function o(a,h=0){const u=a*2,d=n[u+15]===ta;if(d){const l=s[a+6],c=n[u+14];e(h,d,new Float32Array(i,a*4,6),l,c)}else{const l=a+Xs/4,c=s[a+6],f=s[a+7];e(h,d,new Float32Array(i,a*4,6),f)||(o(l,h+1),o(c,h+1))}}}raycast(e,t=y.FrontSide,i=0,s=1/0){const n=this._roots,o=this.geometry,a=[],h=t.isMaterial,u=Array.isArray(t),d=o.groups,l=h?t.side:t,c=this.indirect?CS:_S;for(let f=0,p=n.length;f<p;f++){const g=u?t[d[f].materialIndex].side:l,m=a.length;if(c(this,f,g,e,a,i,s),u){const _=d[f].materialIndex;for(let v=m,x=a.length;v<x;v++)a[v].face.materialIndex=_}}return a}raycastFirst(e,t=y.FrontSide,i=0,s=1/0){const n=this._roots,o=this.geometry,a=t.isMaterial,h=Array.isArray(t);let u=null;const d=o.groups,l=a?t.side:t,c=this.indirect?IS:vS;for(let f=0,p=n.length;f<p;f++){const g=h?t[d[f].materialIndex].side:l,m=c(this,f,g,e,i,s);m!=null&&(u==null||m.distance<u.distance)&&(u=m,h&&(m.face.materialIndex=d[f].materialIndex))}return u}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?PS:xS;for(let o=0,a=s.length;o<a&&(i=n(this,o,e,t),!i);o++);return i}shapecast(e){const t=ot.getPrimitive(),i=this.indirect?gS:dS;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:o,intersectsTriangle:a}=e;if(o&&a){const l=o;o=(c,f,p,g,m)=>l(c,f,p,g,m)?!0:i(c,f,this,a,p,g,t)}else o||(a?o=(l,c,f,p)=>i(l,c,this,a,f,p,t):o=(l,c,f)=>f);let h=!1,u=0;const d=this._roots;for(let l=0,c=d.length;l<c;l++){const f=d[l];if(h=oS(this,l,n,o,s,u),h)break;u+=f.byteLength}return ot.releasePrimitive(t),h}bvhcast(e,t,i){let{intersectsRanges:s,intersectsTriangles:n}=i;const o=ot.getPrimitive(),a=this.geometry.index,h=this.geometry.attributes.position,u=this.indirect?p=>{const g=this.resolveTriangleIndex(p);Se(o,g*3,a,h)}:p=>{Se(o,p*3,a,h)},d=ot.getPrimitive(),l=e.geometry.index,c=e.geometry.attributes.position,f=e.indirect?p=>{const g=e.resolveTriangleIndex(p);Se(d,g*3,l,c)}:p=>{Se(d,p*3,l,c)};if(n){const p=(g,m,_,v,x,b,w,C)=>{for(let S=_,T=_+v;S<T;S++){f(S),d.a.applyMatrix4(t),d.b.applyMatrix4(t),d.c.applyMatrix4(t),d.needsUpdate=!0;for(let M=g,P=g+m;M<P;M++)if(u(M),o.needsUpdate=!0,n(o,d,M,S,x,b,w,C))return!0}return!1};if(s){const g=s;s=function(m,_,v,x,b,w,C,S){return g(m,_,v,x,b,w,C,S)?!0:p(m,_,v,x,b,w,C,S)}}else s=p}return kS(this,e,t,s)}intersectsBox(e,t){return eo.set(e.min,e.max,t),eo.needsUpdate=!0,this.shapecast({intersectsBounds:i=>eo.intersectsBox(i),intersectsTriangle:i=>eo.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,o=1/0){return(this.indirect?LS:SS)(this,e,t,i,s,n,o)}closestPointToPoint(e,t={},i=0,s=1/0){return aS(this,e,t,i,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(i=>{xe(0,new Float32Array(i),Zd),e.union(Zd)}),e}}class US{constructor(e){this.name="WorkerBase",this.running=!1,this.worker=e,this.worker.onerror=t=>{throw t.message?new Error(`${this.name}: Could not create Web Worker with error "${t.message}"`):new Error(`${this.name}: Could not create Web Worker.`)}}runTask(){}generate(...e){if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");if(this.worker===null)throw new Error("GenerateMeshBVHWorker: Worker has been disposed.");this.running=!0;const t=this.runTask(this.worker,...e);return t.finally(()=>{this.running=!1}),t}dispose(){this.worker.terminate(),this.worker=null}}class GS extends US{constructor(e){const t=new Worker(e||new URL("data:text/javascript;base64,aW1wb3J0IHsKCUJ1ZmZlckdlb21ldHJ5LAoJQnVmZmVyQXR0cmlidXRlLAp9IGZyb20gJ3RocmVlJzsKaW1wb3J0IHsgTWVzaEJWSCB9IGZyb20gJy4uL2NvcmUvTWVzaEJWSC5qcyc7Cgpvbm1lc3NhZ2UgPSAoIHsgZGF0YSB9ICkgPT4gewoKCWxldCBwcmV2VGltZSA9IHBlcmZvcm1hbmNlLm5vdygpOwoJZnVuY3Rpb24gb25Qcm9ncmVzc0NhbGxiYWNrKCBwcm9ncmVzcyApIHsKCgkJLy8gYWNjb3VudCBmb3IgZXJyb3IKCQlwcm9ncmVzcyA9IE1hdGgubWluKCBwcm9ncmVzcywgMSApOwoKCQljb25zdCBjdXJyVGltZSA9IHBlcmZvcm1hbmNlLm5vdygpOwoJCWlmICggY3VyclRpbWUgLSBwcmV2VGltZSA+PSAxMCAmJiBwcm9ncmVzcyAhPT0gMS4wICkgewoKCQkJcG9zdE1lc3NhZ2UoIHsKCgkJCQllcnJvcjogbnVsbCwKCQkJCXNlcmlhbGl6ZWQ6IG51bGwsCgkJCQlwb3NpdGlvbjogbnVsbCwKCQkJCXByb2dyZXNzLAoKCQkJfSApOwoJCQlwcmV2VGltZSA9IGN1cnJUaW1lOwoKCQl9CgoJfQoKCWNvbnN0IHsgaW5kZXgsIHBvc2l0aW9uLCBvcHRpb25zIH0gPSBkYXRhOwoJdHJ5IHsKCgkJY29uc3QgZ2VvbWV0cnkgPSBuZXcgQnVmZmVyR2VvbWV0cnkoKTsKCQlnZW9tZXRyeS5zZXRBdHRyaWJ1dGUoICdwb3NpdGlvbicsIG5ldyBCdWZmZXJBdHRyaWJ1dGUoIHBvc2l0aW9uLCAzLCBmYWxzZSApICk7CgkJaWYgKCBpbmRleCApIHsKCgkJCWdlb21ldHJ5LnNldEluZGV4KCBuZXcgQnVmZmVyQXR0cmlidXRlKCBpbmRleCwgMSwgZmFsc2UgKSApOwoKCQl9CgoJCWlmICggb3B0aW9ucy5pbmNsdWRlZFByb2dyZXNzQ2FsbGJhY2sgKSB7CgoJCQlvcHRpb25zLm9uUHJvZ3Jlc3MgPSBvblByb2dyZXNzQ2FsbGJhY2s7CgoJCX0KCgkJaWYgKCBvcHRpb25zLmdyb3VwcyApIHsKCgkJCWNvbnN0IGdyb3VwcyA9IG9wdGlvbnMuZ3JvdXBzOwoJCQlmb3IgKCBjb25zdCBpIGluIGdyb3VwcyApIHsKCgkJCQljb25zdCBncm91cCA9IGdyb3Vwc1sgaSBdOwoJCQkJZ2VvbWV0cnkuYWRkR3JvdXAoIGdyb3VwLnN0YXJ0LCBncm91cC5jb3VudCwgZ3JvdXAubWF0ZXJpYWxJbmRleCApOwoKCQkJfQoKCQl9CgoJCWNvbnN0IGJ2aCA9IG5ldyBNZXNoQlZIKCBnZW9tZXRyeSwgb3B0aW9ucyApOwoJCWNvbnN0IHNlcmlhbGl6ZWQgPSBNZXNoQlZILnNlcmlhbGl6ZSggYnZoLCB7IGNvcHlJbmRleEJ1ZmZlcjogZmFsc2UgfSApOwoJCWxldCB0b1RyYW5zZmVyID0gWyBwb3NpdGlvbi5idWZmZXIsIC4uLnNlcmlhbGl6ZWQucm9vdHMgXTsKCQlpZiAoIHNlcmlhbGl6ZWQuaW5kZXggKSB7CgoJCQl0b1RyYW5zZmVyLnB1c2goIHNlcmlhbGl6ZWQuaW5kZXguYnVmZmVyICk7CgoJCX0KCgkJdG9UcmFuc2ZlciA9IHRvVHJhbnNmZXIuZmlsdGVyKCB2ID0+ICggdHlwZW9mIFNoYXJlZEFycmF5QnVmZmVyID09PSAndW5kZWZpbmVkJyApIHx8ICEgKCB2IGluc3RhbmNlb2YgU2hhcmVkQXJyYXlCdWZmZXIgKSApOwoKCQlpZiAoIGJ2aC5faW5kaXJlY3RCdWZmZXIgKSB7CgoJCQl0b1RyYW5zZmVyLnB1c2goIHNlcmlhbGl6ZWQuaW5kaXJlY3RCdWZmZXIuYnVmZmVyICk7CgoJCX0KCgkJcG9zdE1lc3NhZ2UoIHsKCgkJCWVycm9yOiBudWxsLAoJCQlzZXJpYWxpemVkLAoJCQlwb3NpdGlvbiwKCQkJcHJvZ3Jlc3M6IDEsCgoJCX0sIHRvVHJhbnNmZXIgKTsKCgl9IGNhdGNoICggZXJyb3IgKSB7CgoJCXBvc3RNZXNzYWdlKCB7CgoJCQllcnJvciwKCQkJc2VyaWFsaXplZDogbnVsbCwKCQkJcG9zaXRpb246IG51bGwsCgkJCXByb2dyZXNzOiAxLAoKCQl9ICk7CgoJfQoKfTsK",typeof document>"u"?require("url").pathToFileURL(__filename).href:Qr&&Qr.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});super(t),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((s,n)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=u=>{n(new Error(`GenerateMeshBVHWorker: ${u.message}`))},e.onmessage=u=>{const{data:d}=u;if(d.error)n(new Error(d.error)),e.onmessage=null;else if(d.serialized){const{serialized:l,position:c}=d,f=cc.deserialize(l,t,{setIndex:!1}),p=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=c,l.index)if(t.index)t.index.array=l.index;else{const g=new y.BufferAttribute(l.index,1,!1);t.setIndex(g)}p.setBoundingBox&&(t.boundingBox=f.getBoundingBox(new y.Box3)),i.onProgress&&i.onProgress(d.progress),s(f),e.onmessage=null}else i.onProgress&&i.onProgress(d.progress)};const o=t.index?t.index.array:null,a=t.attributes.position.array,h=[a];o&&h.push(o),e.postMessage({index:o,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},h.map(u=>u.buffer).filter(u=>typeof SharedArrayBuffer>"u"||!(u instanceof SharedArrayBuffer)))})}}class zS{constructor(e,t){this.lock=!1,this.lockX=!1,this.lockY=!1,this.invRotMat=new y.Matrix4,this.mouse=new y.Vector3,this.rotateStart=new y.Vector2,this.rotateEnd=new y.Vector2,this.rotateDelta=new y.Vector2,this.selectedAxis=null,this.isDragging=!1,this.context=null,this.orbitState=!0,this._animator=0,this._emitter=new as,this.addListener=this._emitter.addListener.bind(this._emitter),this.removeAllListeners=this._emitter.removeAllListeners.bind(this._emitter),this._text=document.createElement("div"),this._textTimer=0,this._update=()=>{this.lock||(this._textTimer&&(window.clearTimeout(this._textTimer),this._textTimer=0),this._textTimer=window.setTimeout(()=>{this._text.style.opacity="0"},800),this.camera.updateMatrix(),this.invRotMat.extractRotation(this.camera.matrix).invert(),this.axes.forEach(s=>{this.setAxisPosition(s)}),this.axes.sort((s,n)=>s.position.z>n.position.z?1:-1),this.drawLayers(!0),this._text.style.opacity="1",this._text.innerText=this.camera.position.distanceTo(this.orbit.target).toFixed(2)+" m")},this.updateMouseFromEvent=s=>{this.rect=this.domElement.getBoundingClientRect();const n=this.domElement.width/this.domElement.clientWidth,o=this.domElement.height/this.domElement.clientHeight,{left:a,top:h}=this.rect;this.mouse.set((s.clientX-a)*n,(s.clientY-h)*o,0)},this.updateSelectedAxisUnderMouse=()=>{this.selectedAxis=null,this.axes.forEach(s=>{this.mouse.distanceTo(s.position)<s.size&&(this.selectedAxis=s)})},this.onPointerDown=s=>{this.rotateStart.set(s.clientX,s.clientY),this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse(),this.orbitState=this.orbit.enabled,this.orbit.enabled=!1,window.addEventListener("pointermove",this.onDrag,!1),window.addEventListener("pointerup",this.onPointerUp,!1)},this.onPointerUp=()=>{this.domElement.style.backgroundColor="#FFF0",setTimeout(()=>this.isDragging=!1,0),this.domElement.classList.remove("dragging"),this.orbit.enabled=this.orbitState,window.removeEventListener("pointermove",this.onDrag,!1),window.removeEventListener("pointerup",this.onPointerUp,!1)},this.onPointerEnter=()=>{this.domElement.style.backgroundColor="#FFF3",this.rect=this.domElement.getBoundingClientRect()},this.onPointerMove=s=>{if(this.lock||this.isDragging)return;const n=this.selectedAxis;s&&(this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse()),n!==this.selectedAxis&&this.drawLayers()},this.onDrag=s=>{this.lock||(this.isDragging||this.domElement.classList.add("dragging"),this.isDragging=!0,this.selectedAxis=null,this.rotateEnd.set(s.clientX,s.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(.5),this.rotateStart.copy(this.rotateEnd),this.orbit.update())},this.onMouseClick=s=>{if(this.lock||(this.updateMouseFromEvent(s),this.updateSelectedAxisUnderMouse(),this.isDragging||!this.selectedAxis))return;this._animator&&cancelAnimationFrame(this._animator);const n=this.selectedAxis.direction.clone();this.camera.lookAt(0,0,0);const o=this.camera.position.distanceTo(this.orbit.target);n.multiplyScalar(o),this.selectedAxis.axis==="z"?n.setZ(this.orbit.target.z+o):this.selectedAxis.axis==="-z"?n.setZ(this.orbit.target.z-o):n.setZ(this.orbit.target.z);const a=500,h=performance.now(),u=1,d=this.selectedAxis.axis,l=()=>{const f=performance.now()-h,p=Math.min(f/a,u);if(this.camera.position.lerp(n,p),this.orbit.update(),p!==u){this._animator=window.requestAnimationFrame(l);return}else this._animator=0,this.onPointerMove(void 0),this._emitter.emit("axis-select-end",d);this.onPointerMove(void 0)};this._emitter.emit("axis-select-start",d),l()},this.drawCircle=(s,n=10,o="#FF0000")=>{this.context&&(this.context.beginPath(),this.context.rect(s.x-n,s.y-n,n*2,n*2),this.context.fillStyle=o,this.context.fill(),this.context.closePath())},this.drawLine=(s,n,o=1,a="#FF0000")=>{this.context&&(this.context.beginPath(),this.context.moveTo(s.x,s.y),this.context.lineTo(n.x,n.y),this.context.lineWidth=o,this.context.strokeStyle=a,this.context.stroke(),this.context.closePath())},this.drawLayers=(s=!1)=>{this.context&&(s&&this.context.clearRect(0,0,this.domElement.width,this.domElement.height),this.axes.forEach(n=>{const o=this.selectedAxis===n,a=n.position.z>=-.01?n.color[0]:n.color[1];if(n.line&&this.drawLine(this.center,n.position,n.line,a),this.drawCircle(n.position,n.size,o?"#0066ff":a),n.label){const h=n.axis==="-x"?this.options.fontSize-3:this.options.fontSize;this.context.font=[this.options.fontWeight,h+"px",this.options.fontFamily].join(" "),this.context.fillStyle=this.options.fontColor,this.context.textBaseline="middle",this.context.textAlign="center",this.context.fillText(n.label,n.position.x,n.position.y)}}))},this.setAxisPosition=s=>{const n=s.direction.clone().applyMatrix4(this.invRotMat),o=s.size;s.position.set(n.x*(this.center.x-o/2-this.options.padding)+this.center.x,this.center.y-n.y*(this.center.y-o/2-this.options.padding),n.z)};const i={offset:new y.Vector2,size:90,padding:8,bubbleSizePrimary:8,bubbleSizeSecondary:6,lineWidth:2,fontSize:11,fontFamily:"arial",fontWeight:"normal",fontColor:"#fff",className:"orbit-controls-gizmo",colors:{x:["#f35f5f","#902525"],y:["#78da2f","#71ae45"],z:["#1d92fa","#d0d1d1"]}};this.options={...i,...t},this.orbit=e,this.camera=e.object,this.center=new y.Vector3(this.options.size/2,this.options.size/2,0),this.axes=this.createAxes(),this.domElement=this.createCanvas(this.options),this.orbit.addEventListener("change",this._update),this._text.style.cssText=`
|
|
5009
5009
|
transition: all 0.8s ease-in-out;
|
|
5010
5010
|
color: rgb(68, 78, 105);
|
|
5011
5011
|
position: absolute;
|
|
@@ -5028,14 +5028,14 @@ d="${this.getPath(e)}"></path>`)}
|
|
|
5028
5028
|
border-radius: 100%;
|
|
5029
5029
|
transition: background-color .15s linear;
|
|
5030
5030
|
cursor: pointer;
|
|
5031
|
-
`,t.addEventListener("pointerdown",this.onPointerDown,!1),t.addEventListener("pointerenter",this.onPointerEnter,!1),t.addEventListener("pointermove",this.onPointerMove,!1),t.addEventListener("click",this.onMouseClick,!1),this.context=t.getContext("2d"),t}destroy(){cancelAnimationFrame(this._animator),this.orbit.removeEventListener("change",this._update),this.orbit.enabled=this.orbitState,window.removeEventListener("pointermove",this.onDrag,!1),window.removeEventListener("pointerup",this.onPointerUp,!1),this._emitter.removeAllListeners(),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!1),this.domElement.removeEventListener("pointerenter",this.onPointerEnter,!1),this.domElement.removeEventListener("pointermove",this.onPointerMove,!1),this.domElement.removeEventListener("click",this.onMouseClick,!1),this.domElement.remove(),window.clearTimeout(this._textTimer),this._text.remove()}}class
|
|
5031
|
+
`,t.addEventListener("pointerdown",this.onPointerDown,!1),t.addEventListener("pointerenter",this.onPointerEnter,!1),t.addEventListener("pointermove",this.onPointerMove,!1),t.addEventListener("click",this.onMouseClick,!1),this.context=t.getContext("2d"),t}destroy(){cancelAnimationFrame(this._animator),this.orbit.removeEventListener("change",this._update),this.orbit.enabled=this.orbitState,window.removeEventListener("pointermove",this.onDrag,!1),window.removeEventListener("pointerup",this.onPointerUp,!1),this._emitter.removeAllListeners(),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!1),this.domElement.removeEventListener("pointerenter",this.onPointerEnter,!1),this.domElement.removeEventListener("pointermove",this.onPointerMove,!1),this.domElement.removeEventListener("click",this.onMouseClick,!1),this.domElement.remove(),window.clearTimeout(this._textTimer),this._text.remove()}}class HS{get isFinished(){return this.params?this.framesDone>=this.params.frames:!0}set visible(e){this.shadowCatcherMesh.visible=e,this.progShadowGrp.visible=e,e||(this.isRendering=!1)}get paused(){return this.params?this.params.paused:!0}set paused(e){this.params&&(this.params.paused=e,e&&(this.isRendering=!1))}constructor(e,t,{resolution:i=1024,shadowMapRes:s=512,shadowBias:n=.001,lightCount:o=8,size:a=4,frames:h=40,lightRadius:u=2,ambientWeight:d=.5,alphaTest:l=.98,paused:c=!1}={}){this.params={enabled:!0,frames:h,lightRadius:u,ambientWeight:d,alphaTest:l,debugHelpers:!1,size:a,paused:c},this.scene=t,this.renderer=e,this.buffer1Active=!1,this.dirLights=[],this.dirLightsHelpers=[],this.clearColor=new y.Color,this.clearAlpha=0,this.progress=0,this.discardMaterial=new WS,this.lights=[],this.meshes=[],this.objectsToShow=[],this.autoHiddenObjects=[],this.objectsToShowSet=new Set,this.objectsToShowAncestors=new Set,this.framesDone=0,this.fixedCamera=null,this.isRendering=!1,this.isZUp=y.Object3D.DEFAULT_UP.z===1,this.progShadowGrp=new y.Group,this.progShadowGrp.name="progressive_shadow_assets",this.scene.add(this.progShadowGrp),this.lightOrigin=new y.Group,this.lightOrigin.name="light_origin",this.isZUp?this.lightOrigin.position.set(a,a,a*1.5):this.lightOrigin.position.set(a,a,a),this.progShadowGrp.add(this.lightOrigin),this.lightGroup=new y.Group,this.lightGroup.name="all_dir_lights",this.progShadowGrp.add(this.lightGroup);const f=Math.PI;for(let m=0;m<o;m++){const _=new y.DirectionalLight(16777215,f/o);_.name="dir_light_"+m,_.castShadow=!0,_.shadow.bias=n,_.shadow.camera.near=.1,_.shadow.camera.far=50,_.shadow.camera.right=a/2,_.shadow.camera.left=-a/2,_.shadow.camera.top=a/2,_.shadow.camera.bottom=-a/2,_.shadow.mapSize.width=s,_.shadow.mapSize.height=s,this.dirLights.push(_),this.lightGroup.add(_)}const p=/(Android|iPad|iPhone|iPod)/g.test(navigator==null?void 0:navigator.userAgent)?y.HalfFloatType:y.FloatType;this.progressiveLightMap1=new y.WebGLRenderTarget(i,i,{type:p}),this.progressiveLightMap2=new y.WebGLRenderTarget(i,i,{type:p}),this.progressiveLightMap1.texture.colorSpace=y.NoColorSpace,this.progressiveLightMap2.texture.colorSpace=y.NoColorSpace,this.shadowCatcherMaterial=new VS({map:this.progressiveLightMap2.texture,transparent:!0,opacity:1});const g=new y.PlaneGeometry(a,a);this.isZUp||g.rotateX(-Math.PI/2),this.shadowCatcherMesh=new y.Mesh(g,this.shadowCatcherMaterial),this.isZUp?this.shadowCatcherMesh.position.z=.001:this.shadowCatcherMesh.position.y=.001,this.shadowCatcherMesh.name="shadowCatcherMesh",this.shadowCatcherMesh.receiveShadow=!0,this.progShadowGrp.add(this.shadowCatcherMesh),this.addObjectToShow(this.progShadowGrp),this.addObjectToShow(this.lightGroup),this.addObjectToShow(this.lightOrigin),this.addObjectToShow(this.shadowCatcherMesh),this.rebuildObjectsToShowAncestors(),this.debugHelpersGroup=new y.Group,this.targetMat=new y.MeshLambertMaterial({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:h},this.targetMat.onBeforeCompile=m=>{m.vertexShader=`varying vec2 vUv;
|
|
5032
5032
|
`+m.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const _=m.fragmentShader.indexOf("void main() {");m.fragmentShader=`varying vec2 vUv;
|
|
5033
5033
|
`+m.fragmentShader.slice(0,_)+`uniform sampler2D previousShadowMap;
|
|
5034
5034
|
uniform float averagingWindow;
|
|
5035
5035
|
`+m.fragmentShader.slice(_-1,-1)+`
|
|
5036
5036
|
vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
|
|
5037
5037
|
gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow);
|
|
5038
|
-
}`,m.uniforms.previousShadowMap=this.previousShadowMap,m.uniforms.averagingWindow=this.averagingWindow}}renderOnRenderTargets(e){this.prepare(),this.averagingWindow.value=this.params.frames;const t=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,i=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1;this.renderer.setRenderTarget(t),this.previousShadowMap.value=i.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.finish(),this.renderer.setRenderTarget(null)}showDebugHelpers(e){if(!this.debugHelpersGroup.children.length){const t=new y.Mesh(new y.PlaneGeometry(2,2),new y.MeshBasicMaterial({map:this.progressiveLightMap1.texture,side:y.DoubleSide}));this.isZUp?t.position.z=this.params.size/2:t.position.y=this.params.size/2;for(const n of this.dirLights){const o=new y.DirectionalLightHelper(n);this.dirLightsHelpers.push(o)}const i=this.isZUp?new y.Vector3(0,0,1):new y.Vector3(0,1,0),s=new y.PlaneHelper(new y.Plane(i,.001),this.params.size,16776960);this.debugHelpersGroup.add(t,s,...this.dirLightsHelpers)}e?(this.progShadowGrp.add(this.debugHelpersGroup),this.dirLightsHelpers.forEach(t=>{t.update()})):this.progShadowGrp.remove(this.debugHelpersGroup)}randomiseLights(){const e=this.lightOrigin.position.length();for(let t=0;t<this.dirLights.length;t++){if(Math.random()>this.params.ambientWeight)this.dirLights[t].position.set(this.lightOrigin.position.x+y.MathUtils.randFloatSpread(this.params.lightRadius),this.lightOrigin.position.y+y.MathUtils.randFloatSpread(this.params.lightRadius),this.lightOrigin.position.z+y.MathUtils.randFloatSpread(this.params.lightRadius));else{const i=Math.acos(2*Math.random()-1)-1.570795,s=2*3.14159*Math.random();this.isZUp?this.dirLights[t].position.set(Math.cos(i)*Math.cos(s)*e,Math.cos(i)*Math.sin(s)*e,Math.abs(Math.sin(i)*e)):this.dirLights[t].position.set(Math.cos(i)*Math.cos(s)*e,Math.abs(Math.cos(i)*Math.sin(s)*e),Math.sin(i)*e)}this.params.debugHelpers&&this.dirLightsHelpers[t].update()}}async recalculate(){this.params.enabled&&(this.clear(),this.framesDone=0,this.fixedCamera=null,this.isRendering=!1)}prepare(){this.lights.forEach(t=>{t.object.intensity=0}),this.meshes.forEach(t=>{t.object.material=this.discardMaterial}),this.autoHiddenObjects.length=0;const e=t=>this.objectsToShowAncestors.has(t);this.scene.traverse(t=>{t!==this.scene&&(this.isExcludedObject(t)||e(t)||t.isLight||t.isCamera||t.visible&&(this.autoHiddenObjects.push({object:t,visible:t.visible}),t.visible=!1))}),this.lightGroup.visible=!0,this.shadowCatcherMesh.material=this.targetMat,this.params.debugHelpers&&this.showDebugHelpers(!1)}finish(){this.lights.forEach(e=>{e.object.intensity=e.intensity}),this.meshes.forEach(e=>{e.object.material=e.material}),this.autoHiddenObjects.forEach(e=>{e.object.visible=e.visible}),this.autoHiddenObjects.length=0,this.lightGroup.visible=!1,this.shadowCatcherMesh.material=this.shadowCatcherMaterial,this.params.debugHelpers&&this.showDebugHelpers(!0)}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.shadowCatcherMesh.material.alphaTest=0,this.updateShadowObjectsList()}updateShadowObjectsList(){this.lights.length=0,this.meshes.length=0,this.objectsToShow.length=0,this.objectsToShowSet.clear(),this.addObjectToShow(this.progShadowGrp),this.addObjectToShow(this.lightGroup),this.addObjectToShow(this.lightOrigin),this.addObjectToShow(this.shadowCatcherMesh),this.scene.traverse(e=>{if(e!==this.scene){if(this.isExcludedObject(e)){this.addObjectToShow(e);return}if(e===this.progShadowGrp||e===this.lightGroup||e===this.lightOrigin){this.addObjectToShow(e);return}if(e===this.shadowCatcherMesh){this.addObjectToShow(e);return}if(e.isLight&&e.parent!==this.lightGroup){this.lights.push({object:e,intensity:e.intensity});return}e.isGoods||e.isTransformControls||e.geometry&&e!==this.shadowCatcherMesh&&e.castShadow&&(this.meshes.push({object:e,material:e.material}),this.addObjectToShow(e))}}),this.rebuildObjectsToShowAncestors()}addObjectToShow(e){e&&(this.objectsToShowSet.has(e)||(this.objectsToShow.push({object:e,visible:e.visible}),this.objectsToShowSet.add(e)))}rebuildObjectsToShowAncestors(){this.objectsToShowAncestors.clear();const e=t=>{let i=t;for(;i&&!this.objectsToShowAncestors.has(i);)this.objectsToShowAncestors.add(i),i=i.parent};this.objectsToShow.forEach(({object:t})=>{e(t)})}isExcludedObject(e){const t=e;return!!(t.isCSS2DObject||t.isCSS3DObject||t.isHelper||typeof e.type=="string"&&e.type.endsWith("Helper")||typeof e.name=="string"&&e.name.toLowerCase().includes("helper"))}update(e){!this.params||!this.shadowCatcherMesh||!this.progressiveLightMap1||!this.progressiveLightMap2||!this.params.enabled||this.framesDone>=this.params.frames||this.params.paused||!this.shadowCatcherMesh.visible||!this.progShadowGrp.visible||(this.framesDone===0&&(this.fixedCamera=e.clone(),this.isRendering=!0),this.shadowCatcherMesh.material.alphaTest=y.MathUtils.clamp(y.MathUtils.mapLinear(this.framesDone,2,this.params.frames-1,0,this.params.alphaTest),0,1),this.renderOnRenderTargets(this.fixedCamera||e),this.randomiseLights(),this.progress=y.MathUtils.mapLinear(this.framesDone,0,this.params.frames-1,0,100),this.framesDone++,this.framesDone>=this.params.frames&&(this.fixedCamera=null,this.isRendering=!1))}destroy(){this.scene&&this.progShadowGrp&&this.scene.remove(this.progShadowGrp),this.progressiveLightMap1&&(this.progressiveLightMap1.dispose(),this.progressiveLightMap1=null),this.progressiveLightMap2&&(this.progressiveLightMap2.dispose(),this.progressiveLightMap2=null),this.shadowCatcherMaterial&&(this.shadowCatcherMaterial.dispose(),this.shadowCatcherMaterial=null),this.targetMat&&(this.targetMat.dispose(),this.targetMat=null),this.discardMaterial&&(this.discardMaterial.dispose(),this.discardMaterial=null),this.shadowCatcherMesh&&(this.shadowCatcherMesh.geometry&&this.shadowCatcherMesh.geometry.dispose(),this.shadowCatcherMesh=null),this.dirLights.forEach(e=>{e.parent&&e.parent.remove(e);const t=e;t.dispose&&typeof t.dispose=="function"&&t.dispose()}),this.dirLights=[],this.dirLightsHelpers.forEach(e=>{e.parent&&e.parent.remove(e);const t=e;t.dispose&&typeof t.dispose=="function"&&t.dispose()}),this.dirLightsHelpers=[],this.debugHelpersGroup&&(this.debugHelpersGroup.children.forEach(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),this.debugHelpersGroup.clear(),this.debugHelpersGroup=null),this.progShadowGrp&&(this.progShadowGrp.clear(),this.progShadowGrp=null),this.lightGroup&&(this.lightGroup.clear(),this.lightGroup=null),this.lightOrigin&&(this.lightOrigin.clear(),this.lightOrigin=null),this.lights=[],this.meshes=[],this.objectsToShow=[],this.autoHiddenObjects=[],this.objectsToShowSet=new Set,this.objectsToShowAncestors=new Set,this.scene=null,this.renderer=null,this.fixedCamera=null,this.clearColor=null,this.previousShadowMap=null,this.averagingWindow=null,this.params=null}}function
|
|
5038
|
+
}`,m.uniforms.previousShadowMap=this.previousShadowMap,m.uniforms.averagingWindow=this.averagingWindow}}renderOnRenderTargets(e){this.prepare(),this.averagingWindow.value=this.params.frames;const t=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,i=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1;this.renderer.setRenderTarget(t),this.previousShadowMap.value=i.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.finish(),this.renderer.setRenderTarget(null)}showDebugHelpers(e){if(!this.debugHelpersGroup.children.length){const t=new y.Mesh(new y.PlaneGeometry(2,2),new y.MeshBasicMaterial({map:this.progressiveLightMap1.texture,side:y.DoubleSide}));this.isZUp?t.position.z=this.params.size/2:t.position.y=this.params.size/2;for(const n of this.dirLights){const o=new y.DirectionalLightHelper(n);this.dirLightsHelpers.push(o)}const i=this.isZUp?new y.Vector3(0,0,1):new y.Vector3(0,1,0),s=new y.PlaneHelper(new y.Plane(i,.001),this.params.size,16776960);this.debugHelpersGroup.add(t,s,...this.dirLightsHelpers)}e?(this.progShadowGrp.add(this.debugHelpersGroup),this.dirLightsHelpers.forEach(t=>{t.update()})):this.progShadowGrp.remove(this.debugHelpersGroup)}randomiseLights(){const e=this.lightOrigin.position.length();for(let t=0;t<this.dirLights.length;t++){if(Math.random()>this.params.ambientWeight)this.dirLights[t].position.set(this.lightOrigin.position.x+y.MathUtils.randFloatSpread(this.params.lightRadius),this.lightOrigin.position.y+y.MathUtils.randFloatSpread(this.params.lightRadius),this.lightOrigin.position.z+y.MathUtils.randFloatSpread(this.params.lightRadius));else{const i=Math.acos(2*Math.random()-1)-1.570795,s=2*3.14159*Math.random();this.isZUp?this.dirLights[t].position.set(Math.cos(i)*Math.cos(s)*e,Math.cos(i)*Math.sin(s)*e,Math.abs(Math.sin(i)*e)):this.dirLights[t].position.set(Math.cos(i)*Math.cos(s)*e,Math.abs(Math.cos(i)*Math.sin(s)*e),Math.sin(i)*e)}this.params.debugHelpers&&this.dirLightsHelpers[t].update()}}async recalculate(){this.params.enabled&&(this.clear(),this.framesDone=0,this.fixedCamera=null,this.isRendering=!1)}prepare(){this.lights.forEach(t=>{t.object.intensity=0}),this.meshes.forEach(t=>{t.object.material=this.discardMaterial}),this.autoHiddenObjects.length=0;const e=t=>this.objectsToShowAncestors.has(t);this.scene.traverse(t=>{t!==this.scene&&(this.isExcludedObject(t)||e(t)||t.isLight||t.isCamera||t.visible&&(this.autoHiddenObjects.push({object:t,visible:t.visible}),t.visible=!1))}),this.lightGroup.visible=!0,this.shadowCatcherMesh.material=this.targetMat,this.params.debugHelpers&&this.showDebugHelpers(!1)}finish(){this.lights.forEach(e=>{e.object.intensity=e.intensity}),this.meshes.forEach(e=>{e.object.material=e.material}),this.autoHiddenObjects.forEach(e=>{e.object.visible=e.visible}),this.autoHiddenObjects.length=0,this.lightGroup.visible=!1,this.shadowCatcherMesh.material=this.shadowCatcherMaterial,this.params.debugHelpers&&this.showDebugHelpers(!0)}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.shadowCatcherMesh.material.alphaTest=0,this.updateShadowObjectsList()}updateShadowObjectsList(){this.lights.length=0,this.meshes.length=0,this.objectsToShow.length=0,this.objectsToShowSet.clear(),this.addObjectToShow(this.progShadowGrp),this.addObjectToShow(this.lightGroup),this.addObjectToShow(this.lightOrigin),this.addObjectToShow(this.shadowCatcherMesh),this.scene.traverse(e=>{if(e!==this.scene){if(this.isExcludedObject(e)){this.addObjectToShow(e);return}if(e===this.progShadowGrp||e===this.lightGroup||e===this.lightOrigin){this.addObjectToShow(e);return}if(e===this.shadowCatcherMesh){this.addObjectToShow(e);return}if(e.isLight&&e.parent!==this.lightGroup){this.lights.push({object:e,intensity:e.intensity});return}e.isGoods||e.isTransformControls||e.geometry&&e!==this.shadowCatcherMesh&&e.castShadow&&(this.meshes.push({object:e,material:e.material}),this.addObjectToShow(e))}}),this.rebuildObjectsToShowAncestors()}addObjectToShow(e){e&&(this.objectsToShowSet.has(e)||(this.objectsToShow.push({object:e,visible:e.visible}),this.objectsToShowSet.add(e)))}rebuildObjectsToShowAncestors(){this.objectsToShowAncestors.clear();const e=t=>{let i=t;for(;i&&!this.objectsToShowAncestors.has(i);)this.objectsToShowAncestors.add(i),i=i.parent};this.objectsToShow.forEach(({object:t})=>{e(t)})}isExcludedObject(e){const t=e;return!!(t.isCSS2DObject||t.isCSS3DObject||t.isHelper||typeof e.type=="string"&&e.type.endsWith("Helper")||typeof e.name=="string"&&e.name.toLowerCase().includes("helper"))}update(e){!this.params||!this.shadowCatcherMesh||!this.progressiveLightMap1||!this.progressiveLightMap2||!this.params.enabled||this.framesDone>=this.params.frames||this.params.paused||!this.shadowCatcherMesh.visible||!this.progShadowGrp.visible||(this.framesDone===0&&(this.fixedCamera=e.clone(),this.isRendering=!0),this.shadowCatcherMesh.material.alphaTest=y.MathUtils.clamp(y.MathUtils.mapLinear(this.framesDone,2,this.params.frames-1,0,this.params.alphaTest),0,1),this.renderOnRenderTargets(this.fixedCamera||e),this.randomiseLights(),this.progress=y.MathUtils.mapLinear(this.framesDone,0,this.params.frames-1,0,100),this.framesDone++,this.framesDone>=this.params.frames&&(this.fixedCamera=null,this.isRendering=!1))}destroy(){this.scene&&this.progShadowGrp&&this.scene.remove(this.progShadowGrp),this.progressiveLightMap1&&(this.progressiveLightMap1.dispose(),this.progressiveLightMap1=null),this.progressiveLightMap2&&(this.progressiveLightMap2.dispose(),this.progressiveLightMap2=null),this.shadowCatcherMaterial&&(this.shadowCatcherMaterial.dispose(),this.shadowCatcherMaterial=null),this.targetMat&&(this.targetMat.dispose(),this.targetMat=null),this.discardMaterial&&(this.discardMaterial.dispose(),this.discardMaterial=null),this.shadowCatcherMesh&&(this.shadowCatcherMesh.geometry&&this.shadowCatcherMesh.geometry.dispose(),this.shadowCatcherMesh=null),this.dirLights.forEach(e=>{e.parent&&e.parent.remove(e);const t=e;t.dispose&&typeof t.dispose=="function"&&t.dispose()}),this.dirLights=[],this.dirLightsHelpers.forEach(e=>{e.parent&&e.parent.remove(e);const t=e;t.dispose&&typeof t.dispose=="function"&&t.dispose()}),this.dirLightsHelpers=[],this.debugHelpersGroup&&(this.debugHelpersGroup.children.forEach(e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}),this.debugHelpersGroup.clear(),this.debugHelpersGroup=null),this.progShadowGrp&&(this.progShadowGrp.clear(),this.progShadowGrp=null),this.lightGroup&&(this.lightGroup.clear(),this.lightGroup=null),this.lightOrigin&&(this.lightOrigin.clear(),this.lightOrigin=null),this.lights=[],this.meshes=[],this.objectsToShow=[],this.autoHiddenObjects=[],this.objectsToShowSet=new Set,this.objectsToShowAncestors=new Set,this.scene=null,this.renderer=null,this.fixedCamera=null,this.clearColor=null,this.previousShadowMap=null,this.averagingWindow=null,this.params=null}}function Dm(r={},e,t,i=s=>{}){const s=class extends y.ShaderMaterial{constructor(n={}){const o=Object.entries(r);super({uniforms:o.reduce((a,[h,u])=>{const d=y.UniformsUtils.clone({[h]:{value:u}});return{...a,...d}},{}),vertexShader:e,fragmentShader:t}),o.forEach(([a])=>Object.defineProperty(this,a,{get:()=>this.uniforms[a].value,set:h=>this.uniforms[a].value=h})),Object.assign(this,n),i&&i(this)}};return s.key=y.MathUtils.generateUUID(),s}const VS=Dm({transparent:!0,color:new y.Color(0,0,0),alphaTest:0,opacity:1,map:null,depthWrite:!1,toneMapped:!1,blend:2},`varying vec2 vUv;
|
|
5039
5039
|
void main() {
|
|
5040
5040
|
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
|
|
5041
5041
|
vUv = uv;
|
|
@@ -5050,7 +5050,7 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
|
|
|
5050
5050
|
gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity);
|
|
5051
5051
|
#include <tonemapping_fragment>
|
|
5052
5052
|
#include <colorspace_fragment>
|
|
5053
|
-
}`),
|
|
5053
|
+
}`),WS=Dm({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");class $S extends Lt.CSS2DObject{constructor(e){const t=document.createElement("div");super(t),this._controls=e}}const XS="https://cdn2.seer-group.com/libs/hdr/aristea_wreck_512.hdr",jS="https://cdn2.seer-group.com/libs/fonts.type.json",YS=new Zm.Font(jS);class Mh{constructor(e){var t;this._props=e,this.name="",this._defaults={color:""},this.color="",this.name=this._props.name,this.color=this._defaults.color="#"+((t=e.target.color)==null?void 0:t.getHexString())}change(e){var t;this.color=e,(t=this._props.target.color)==null||t.set(e)}reset(){this.change(this._defaults.color)}}var Bm=(r=>(r[r.DEFAULT=0]="DEFAULT",r[r.CAN_INSTALL=1]="CAN_INSTALL",r))(Bm||{});const Kd=.15;y.Object3D.DEFAULT_UP.set(0,0,1);let Lr,go=0,Ih=0;const qS=()=>{Lr=void 0,go=0,Ih=0},ZS=new y.MeshBasicMaterial({colorWrite:!1});class KS{constructor(e){this.props=e,this.stats=new Ns,this.scene=new y.Scene,this.overlayScene=new y.Scene,this.renderer=new y.WebGLRenderer({antialias:!0,alpha:!0,logarithmicDepthBuffer:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.css2dRenderer=new Lt.CSS2DRenderer,this.mousePos=new y.Vector2,this.mouseCoord=new y.Vector2,this.offset=new y.Vector2,this.size=new y.Vector2,this.amr=new Sm({showSizeBox:!0,showController:!0}),this._clock=new y.Clock(!0),this._uiHiddenTime=this._clock.getElapsedTime(),this.camera=new y.PerspectiveCamera(39.6,window.innerWidth/window.innerHeight,.1,1e4),this.d=2,this.orthographicCamera=new y.OrthographicCamera(-this.d*(window.innerWidth/window.innerHeight),this.d*(window.innerWidth/window.innerHeight),this.d,-this.d,.1,1e3),this._axisMoving=!1,this._container=new y.Group,this._raycaster=new y.Raycaster,this._selected=[],this._pointerDownTimeout=0,this._dragging=!1,this.maxSample=1024*2,this.sampleCount=0,this._usePathTracing=!1,this._fpsCache=[],this._fpsCacheMax=20,this._emitter=new as,this.sound=new WA,this._rafId=null,this._destroyed=!1,this._ground=new y.Mesh(new y.PlaneGeometry(100,100),new y.MeshPhysicalMaterial({color:new y.Color("#eee"),metalness:.4,roughness:.1,clearcoat:1,clearcoatRoughness:.1})),this.light=new y.PointLight(16777215,10,30),this._amrRender=new y.WebGLRenderTarget(1024,1024,{format:y.RGBAFormat,type:y.UnsignedByteType,colorSpace:y.SRGBColorSpace,samples:8}),this._pointCloudMode=!1,this._shadowMode=!1,this.addEventListener=this._emitter.on.bind(this._emitter),this.removeEventListener=this._emitter.on.bind(this._emitter),this._showSlots=!0,this._showSize=!0,this._showControls=!0,this._drag=d=>{this._dragging=!0,this._pointermove(d)},this._dragend=d=>{this._dragging=!1},this._pointermove=d=>{if(this._pointerDownTimeout)return clearTimeout(this._pointerDownTimeout),this._pointerDownTimeout=0;let{top:l,left:c}=this.renderer.domElement.getBoundingClientRect();this.offset.set(c,l),this.mousePos.set(d.clientX-c,d.clientY-l),this.mouseCoord.set((d.clientX-c)/this.size.x*2-1,-((d.clientY-l)/this.size.y)*2+1),this._raycaster.setFromCamera(this.mouseCoord,this.camera)},this._pointerdown=d=>{const l=()=>{let c=[...this._outlinePass.selectedObjects];this._outlinePass.selectedObjects=[],this.amr.slots.forEach(g=>g.selected=!1);const p=this._raycaster.intersectObjects(this.amr.slots,!1)[0];p&&this.amr.slots.forEach(g=>{g.traverse(m=>{m==p.object?c!=null&&c.includes(g)?(c=void 0,g.deviceSelected=!1):(this._outlinePass.selectedObjects=[g],g.deviceSelected=!0):g.deviceSelected=!1})}),this._pointerDownTimeout=0};this._pointerDownTimeout=window.setTimeout(l,200)},this._detectTrackpad=()=>{Lr||typeof Lr<"u"||(go===0&&(Ih=performance.now()),go++,performance.now()-Ih>66&&(go>5?Lr=!0:Lr=!1,Lr?this.controls.zoomSpeed=.2:this.controls.zoomSpeed=1,setTimeout(qS,2e3)))},this.debounceForkHeightChange=YA(()=>{var d;(d=this._progressShadow)==null||d.recalculate()},300),this.focusSlots=d=>{if(this.amr.slots.forEach(E=>E.focused=!1),!d.length){this.fit();return}const l=d.flatMap(E=>{if(E.focused=!0,!E.parent)return[];const A=new y.Vector3;return E.parent.getWorldPosition(A),[A]});if(!l.length)return;const c=l.reduce((E,A)=>E.add(A),new y.Vector3).multiplyScalar(1/l.length),f=this.controls.target.clone(),p=this.camera.position.clone().sub(f).normalize();let g=0;for(const E of l){const A=E.clone().sub(c),I=A.dot(p),D=Math.sqrt(Math.max(0,A.lengthSq()-I*I));D>g&&(g=D)}g=g*1.2+.45;const m=this.camera.fov*Math.PI/180,_=2*Math.atan(Math.tan(m/2)*this.camera.aspect),v=g/Math.tan(_/2),x=g/Math.tan(m/2),b=Math.max(v,x),w=new y.Vector3(0,0,c.z),C=c.clone().sub(w).normalize().multiplyScalar(b<1?1:b).add(c),S=this.camera.position.clone(),T=f.clone(),M={t:0};let P=500;const R=S.distanceTo(C)+T.distanceTo(w);R>.001&&(P=Math.min(1e3,Math.max(450,R*45))),this._fitAnimation=new yo(M).to({t:1},P).easing(Pt.Easing.Quadratic.InOut).onStart(()=>{this.controls.enabled=!1}).onUpdate(()=>{const E=M.t;this.camera.position.lerpVectors(S,C,E),this.controls.target.lerpVectors(T,w,E)}).onComplete(()=>{this.controls.enabled=!0}).start()},this.fit=()=>{new y.Box3().setFromObject(this._container);const l=this.amr.sizeBox.size.getSize(new y.Vector3),c=l.clone().multiplyScalar(.5),f=new y.Vector3(0,0,c.z);let p=c.clone().sub(f);p.lengthSq()<1e-6&&(p=new y.Vector3(1,0,0));const g=p.clone().normalize(),m=l.clone().multiplyScalar(.5),_=[new y.Vector3(m.x,m.y,m.z),new y.Vector3(m.x,m.y,-m.z),new y.Vector3(m.x,-m.y,m.z),new y.Vector3(m.x,-m.y,-m.z),new y.Vector3(-m.x,m.y,m.z),new y.Vector3(-m.x,m.y,-m.z),new y.Vector3(-m.x,-m.y,m.z),new y.Vector3(-m.x,-m.y,-m.z)];let v=0;for(const k of _){const z=k.dot(g),q=Math.sqrt(Math.max(0,k.lengthSq()-z*z));q>v&&(v=q)}v=v*1.05;const x=this.camera.fov*Math.PI/180,b=2*Math.atan(Math.tan(x/2)*this.camera.aspect),w=v/Math.tan(b/2),C=v/Math.tan(x/2),S=Math.max(w,C),T=c.clone();let M=l.z/3;l.z<l.x&&l.z<l.y&&(M=l.x*.8),l.z>l.x&&l.z>l.y&&(M=0),T.z+=M;const P=p.clone().normalize().multiplyScalar(S<1?1:S).add(T),R=Math.max(l.x*2,5);this.light.position.set(R,0,l.z*2);const E=this.camera.position.clone(),A=this.controls.target.clone(),I={t:0};let D=600;const B=E.distanceTo(P)+A.distanceTo(f);B>.001&&(D=Math.min(800,Math.max(650,B*45))),this._fitAnimation=new yo(I).to({t:1},D).easing(Pt.Easing.Quadratic.InOut).onStart(()=>{this.controls.enabled=!1}).onUpdate(()=>{const k=I.t;this.camera.position.lerpVectors(E,P,k),this.controls.target.lerpVectors(A,f,k)}).onComplete(()=>{this.controls.enabled=!0,!this.shadowMode&&(this._progressShadow.visible=!0,this._progressShadow.isFinished||this._progressShadow.recalculate())}).start(),this.controls.minDistance=Math.max(.2,Math.min(S*.25,S-.1)),this.controls.maxDistance=S*4},this.resize=()=>{var g;const d=this.renderer.domElement.parentElement;if(!d)return;d.style.display="flex",this.renderer.domElement.style.width="100%",this.renderer.domElement.style.height="100%",this.renderer.domElement.style.flexGrow="1";const l=d.clientWidth,c=d.clientHeight;this.size.set(l,c),this.camera.aspect=l/c,this.camera.updateProjectionMatrix(),this._amrRender.setSize(l,c),this._updateCamera(),this.css2dRenderer.setSize(l,c);const f=this.renderer.getPixelRatio();(g=this.pathTracer)==null||g.updateCamera(),this.sampleCount=0,this.renderer.setSize(l,c),this._composer.setSize(l,c),this._composer.passes.forEach(m=>m.setSize(l,c));const p=this._fxaaPass.material.uniforms;p.resolution.value.x=1/(l*f),p.resolution.value.y=1/(c*f),this._bloomPass&&this._bloomPass.setSize(l,c)},this.ticker=()=>{if(!this._destroyed){if(this.stats.begin(),this.renderer.domElement.dispatchEvent(new CustomEvent("ticker")),this._rafId=requestAnimationFrame(this.ticker),this.renderer.autoClear=!1,this.renderer.clear(),this.usePathTracing){this.hideAmrUI(),this.sampleCount<this.maxSample?this.sampleCount++:this.pathTracer.pausePathTracing=!0,this.pathTracer.renderSample();const d=this.renderer.autoClear;this.renderer.autoClear=!1,this.scene.overrideMaterial=ZS,this.renderer.clearDepth(),this.renderer.render(this.scene,this.mainCamera),this.scene.overrideMaterial=null,this.renderer.render(this.overlayScene,this.mainCamera),this.renderer.autoClear=d}else{this._clock.getElapsedTime()-this._uiHiddenTime>.15?this.showAmrUI(!0):this.hideAmrUI(!1,!1);const l=this.stats.fps();this.usePathTracing||(this._fpsCache.length>this._fpsCacheMax&&this._fpsCache.shift(),this._fpsCache.push(l)),this.amr.slots.forEach(c=>{this._dragging?c.getCanInstall()&&c.render(this):c.render(this)}),Pt.update(),this.controls.update(),this._progressShadow.update(this.mainCamera),this.css2dRenderer.render(this.scene,this.mainCamera),this.updatePosition(),this.scene.overrideMaterial=null,this.renderer.render(this.scene,this.mainCamera)}this.stats.end()}},this.stats.showPanel(0),this.hideState(),e.fov&&(this.camera.fov=e.fov,this.camera.updateProjectionMatrix()),yf(ss,this.renderer),this._ground.visible=!1,this.controls=new jm.OrbitControls(this.camera,this.renderer.domElement),this.controls.enablePan=!0,this.controls.rotateSpeed=this.props.isMobile?.6:.5,this.controls.dampingFactor=Kd,this.controls.enableDamping=!0,this.controls.maxDistance=10,this.controls.minDistance=1,this.controls.zoomSpeed=this.props.isMobile?.3:cm()?.2:1,this._cameraPositionUI=new $S(this.controls),this.renderer.setPixelRatio(window.devicePixelRatio||1),this.renderer.autoClear=!0,this.renderer.toneMapping=y.ACESFilmicToneMapping,this.renderer.toneMappingExposure=1.4,this.renderer.outputColorSpace=y.SRGBColorSpace,this.renderer.localClippingEnabled=!0,this.renderer.shadowMap.enabled=!0,this.css2dRenderer.domElement.style.pointerEvents="none",this.css2dRenderer.domElement.style.position="absolute",this.css2dRenderer.domElement.style.top="0px",y.ShaderChunk.tonemapping_pars_fragment=y.ShaderChunk.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }",`
|
|
5054
5054
|
float startCompression = 0.8;
|
|
5055
5055
|
float desaturation = 0.5;
|
|
5056
5056
|
vec3 CustomToneMapping( vec3 color ) {
|
|
@@ -5069,9 +5069,9 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
|
|
|
5069
5069
|
color *= newPeak * invPeak;
|
|
5070
5070
|
float g = 1. - 3. / (desaturation * extraBrightness + 3.);
|
|
5071
5071
|
return mix(color, vec3(1, 1, 1), g);
|
|
5072
|
-
}`),this.camera.position.set(10,-10,5),this.camera.lookAt(new y.Vector3);const{tiles:t}=$A();this.pathTracer=new W0(this.renderer),this.pathTracer.filterGlossyFactor=.6;let i=window.devicePixelRatio;i<2&&(i=2),this.pathTracer.renderScale=this.props.isMobile?1:i,this.pathTracer.bounces=this.props.isMobile?8:10,this.pathTracer.transmissiveBounces=this.props.isMobile?1:3,this.pathTracer.tiles.set(t,t),this.pathTracer.fadeDuration=0;const s=new US(e.workerUrl),n=typeof navigator<"u"?navigator.hardwareConcurrency:4;s.maxWorkerCount=n,this.pathTracer.setBVHWorker(s),this.orthographicCamera.left=-20,this.orthographicCamera.right=20,this.orthographicCamera.top=-20,this.orthographicCamera.bottom=20;let o=this.controls.target.x,a=this.controls.target.y;const h=()=>{this.controls.target.x=o,this.controls.target.y=a};this.controls.addEventListener("change",()=>{var d;this.sampleCount=0,h(),this._uiHiddenTime=this._clock.getElapsedTime(),this.orthographicCamera.position.copy(this.camera.position),this.orthographicCamera.lookAt(this.controls.target),this.usePathTracing&&(this.pathTracer.pausePathTracing=!1,(d=this.pathTracer)==null||d.updateCamera()),this._updateCamera(),!(Math.abs(this.camera.position.x)<.001||Math.abs(this.camera.position.y)<.001)&&(this._axisMoving||(this.mainCamera=this.camera,this.usePathTracing&&this.generateBVH().then()))}),this._mainCamera=this.camera,this._composer=new Ym.EffectComposer(this.renderer),this._composer.setPixelRatio(window.devicePixelRatio);const u=new dc.RenderPass(this.scene,this.camera);this._composer.addPass(u),this._composer.addPass(new jm.OutputPass),this._outlinePass=new fc.OutlinePass(new y.Vector2(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePass.visibleEdgeColor.set(26367),this._outlinePass.edgeThickness=.5,this._outlinePass.hiddenEdgeColor.set(26367),this._outlinePass.edgeStrength=3,this._outlinePass.edgeGlow=0,this._composer.addPass(this._outlinePass),this._outlinePassError=new fc.OutlinePass(new y.Vector2(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePassError.visibleEdgeColor.set(16711680),this._outlinePassError.edgeThickness=.5,this._outlinePassError.hiddenEdgeColor.set(16711680),this._outlinePassError.edgeStrength=3,this._outlinePassError.edgeGlow=0,this._composer.addPass(this._outlinePassError),this._bloomPass=new $m.UnrealBloomPass(new y.Vector2(window.innerWidth,window.innerHeight),.1,.1,.2),this._bloomPass.enabled=!1,this._bloomPass.renderToScreen=!1,this._composer.addPass(this._bloomPass),this._composer.renderTarget1.texture.colorSpace=y.SRGBColorSpace,this._composer.renderTarget2.texture.colorSpace=y.SRGBColorSpace,this._fxaaPass=new Vm.ShaderPass(Wm.FXAAShader),this._composer.addPass(this._fxaaPass),this._progressShadow=new zS(this.renderer,this.scene,{size:8,lightCount:e.isMobile?6:12,frames:e.isMobile?80:120,lightRadius:8,ambientWeight:.8}),this._progressShadow.lightOrigin.position.set(3,2.5,6),this._progressShadow.visible=!1,this._container.add(this.amr),this.scene.add(this._container),this.ticker(),this._loadEnv(),this._initEvents(),this.scene.add(this._cameraPositionUI),this._ground.rotateX(-Math.PI/2),this.scene.add(this._ground),(typeof e.useAxisBall!="boolean"||e.useAxisBall)&&(this._controlsGizmo=new GS(this.controls,{size:160,padding:12,offset:e.axisBallOffset||new y.Vector2(10,10),fontSize:17,bubbleSizePrimary:18,bubbleSizeSecondary:14}),this._controlsGizmo.addListener("axis-select-start",()=>{this._axisMoving=!0,this.mainCamera=this.orthographicCamera,this.usePathTracing&&this.generateBVH().then()}),this._controlsGizmo.addListener("axis-select-end",()=>{this._axisMoving=!1})),this.test=new y.Mesh(new y.PlaneGeometry(2,2),new y.MeshBasicMaterial({map:this._amrRender.texture,opacity:.5,transparent:!0,side:y.DoubleSide})),this.test.position.set(0,1,0),this.test.visible=!1,this.scene.add(this.test)}get pointCloudMode(){return this._pointCloudMode}set pointCloudMode(e){this._pointCloudMode=e,this.amr.setPointCloudMode(e),e?setTimeout(()=>{console.log(this.amr.lines.children)},3e3):this._outlinePass.selectedObjects=[],this._bloomPass,e?this.scene.fog=null:this.scene.background=null}get usePathTracing(){return this._usePathTracing}_clearAmrContent(){const e=this.renderer.getRenderTarget();this.renderer.setRenderTarget(this._amrRender),this.renderer.setClearColor(0,0),this.renderer.clear(!0,!0,!0),this.renderer.setRenderTarget(e)}get shadowMode(){return this._shadowMode}set shadowMode(e){e?(this._progressShadow.visible=!1,this.amr.bodyOpacity=.2):(this._progressShadow.visible=!0,this.amr.bodyOpacity=1,this._progressShadow.isFinished||this._progressShadow.recalculate().then()),this._shadowMode=e}set usePathTracing(e){this._clearAmrContent(),e?(this.scene.add(this.light),this.renderer.toneMappingExposure=1.8,this.overlayScene.add(this._progressShadow.shadowCatcherMesh),this.amr&&(this.amr.bodyOpacity=1),this.hideAmrUI(),this.pathTracer.renderToCanvas=!0,this.scene.background=null):(this.light.removeFromParent(),this.renderer.toneMappingExposure=1.4,this.scene.add(this._progressShadow.shadowCatcherMesh),this.pathTracer.renderToCanvas=!1,this.amr.logos.forEach(t=>{var i;(i=t.parent)==null||i.add(t.target)}),this.showAmrUI(),this.amr&&this.amr.opacityCache!==void 0?(this.amr.bodyOpacity=this.amr.opacityCache,this.amr.opacityCache=void 0):this.amr&&(this.amr.bodyOpacity=1),this.pathTracer.reset(),this._ground.visible=!1,this.scene.background=this.scene.environment),this._usePathTracing=e,this.controls.dampingFactor=e?1:Kd,this.sampleCount=0}get fpsAverage(){return hm(this._fpsCache)}get mainCamera(){return this._mainCamera}set mainCamera(e){this._mainCamera=e,this._composer.passes.forEach(t=>{t instanceof dc.RenderPass&&(t.camera=e)}),e instanceof y.OrthographicCamera?this.scene.background=null:this.scene.background=this.scene.environment}showState(){this.stats.dom.style.display="block"}hideState(){this.stats.dom.style.display="none"}hideAmrUI(e=!0,t=!0){this.shadowMode||this.amr.slots.forEach(i=>i.hide()),this.amr.sizeBox.hide(e),this.amr.controllers.forEach(i=>i.hide()),t&&this.amr.goods.forEach(i=>i.hide())}showAmrUI(e=!0){this.showSlots&&this.amr.slots.forEach(t=>t.show()),this.showSize&&this.amr.sizeBox.show(e),this.showControls&&this.amr.controllers.forEach(t=>t.show()),this.amr.goods.forEach(t=>t.show())}get showSlots(){return this._showSlots}set showSlots(e){this._showSlots=e,this.amr.slots.forEach(t=>e?t.show():t.hide())}get showSize(){return this._showSize}set showSize(e){this._showSize=e,e?this.amr.sizeBox.show(!0):this.amr.sizeBox.hide(!0)}get showControls(){return this._showControls}set showControls(e){this._showControls=e,this.amr.controllers.forEach(t=>e?t.show():t.hide())}_updateCamera(){const e=this.mainCamera.position.distanceTo(this.controls.target),t=2*Math.tan(this.camera.fov*.5*Math.PI/180)*e,i=this.size.x/this.size.y;this.orthographicCamera.left=-t*i/2,this.orthographicCamera.right=t*i/2,this.orthographicCamera.top=t/2,this.orthographicCamera.bottom=-t/2,this.orthographicCamera.updateProjectionMatrix()}_loadEnv(){new Hm.HDRLoader().load($S,t=>{t.mapping=y.EquirectangularReflectionMapping,this._usePathTracing||(this.scene.background=t,this.scene.backgroundBlurriness=1,this.scene.backgroundIntensity=1,this.scene.backgroundRotation=new y.Euler(Math.PI/2,0,Math.PI*.98*.8),this.scene.environment=t,this.overlayScene.environment=t,this.scene.environmentRotation=this.scene.backgroundRotation,this.overlayScene.environmentRotation=this.scene.environmentRotation,this.scene.environmentIntensity=1.4,this.overlayScene.environmentIntensity=this.scene.environmentIntensity),this.pathTracer.updateEnvironment()},()=>{},()=>{})}_initEvents(){window.addEventListener("drag",this._drag),window.addEventListener("dragend",this._dragend),document.addEventListener("wheel",this._detectTrackpad),window.addEventListener("pointermove",this._pointermove),this.renderer.domElement.addEventListener("pointerdown",this._pointerdown)}switchCamera(){this.mainCamera=this.mainCamera===this.camera?this.orthographicCamera:this.camera}toCameraTop(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(0,e+this.controls.target.y,0))}toCameraRight(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(0,this.controls.target.y,e))}toCameraFace(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(e,this.controls.target.y,0))}async generateBVH(){this.pathTracer.pausePathTracing=!1,this.amr.slots.forEach(e=>e.hide()),this.amr&&(this.amr.opacityCache=this.amr.bodyOpacity,this.amr.bodyOpacity=1,this.overlayScene.clear(),this.amr.logos.forEach(e=>{const t=new y.Group;e.target.updateMatrixWorld(!0),t.applyMatrix4(e.target.matrixWorld),t.add(e.target),this.overlayScene.add(t)})),this.usePathTracing=!0,this.pathTracer.setScene(this.scene,this.mainCamera)}async download(e=!1){if(e&&!this.usePathTracing){const t=this._amrRender.width,i=this._amrRender.height,s=new Uint8Array(t*i*4);this.renderer.setRenderTarget(this._amrRender),this.renderer.readRenderTargetPixels(this._amrRender,0,0,t,i,s),this.renderer.setRenderTarget(null);const n=document.createElement("canvas");n.width=t,n.height=i;const o=n.getContext("2d"),a=new ImageData(t,i);for(let h=0;h<i;h++)for(let u=0;u<t;u++){const d=((i-h-1)*t+u)*4,l=(h*t+u)*4;a.data[l]=s[d],a.data[l+1]=s[d+1],a.data[l+2]=s[d+2],a.data[l+3]=s[d+3]}return o.putImageData(a,0,0),n.toDataURL("image/png")}else return new Promise((t,i)=>{this._uiHiddenTime=this._clock.getElapsedTime(),this.hideAmrUI();const s=this.scene.background;this.scene.background=null,setTimeout(()=>{const n=this.renderer.domElement.toDataURL("image/png");return this.scene.background=s,t(n)},this.fpsAverage)})}async captureTriViews(e){var o;const t=(e==null?void 0:e.subject)??this._container;(o=this._progressShadow)==null||o.visible;const i=this.scene.background,s=this.showSize;return new Bm({renderer:this.renderer,scene:this.scene,overlayScene:this.overlayScene,subject:t,onBeforeCapture:()=>{this.scene.background=null,this.hideAmrUI(),this.showSize=!1,this.usePathTracing&&(this.usePathTracing=!1),this._progressShadow.visible=!1},onAfterCapture:()=>{this.scene.background=i,this.showAmrUI(),this.showSize=s,this._progressShadow.visible=!0}}).capture(e)}clearAMR(){ii(this.overlayScene),this.amr.clean(),this.usePathTracing=!1}async exportAMR(){const e=this._container.clone(!0);return e.traverse(t=>{t.dispose&&(t.dispose(),t.removeFromParent())}),await dm.parseAsync(e,{onlyVisible:!0,binary:!0})}async addAMR(e,t=""){this.amr.init(this),await this.amr.load(e,t),this._progressShadow.clear(),this.amr.addEventListener("fork-height-change",this.debounceForkHeightChange),this.amr.addEventListener("shape-key-changed",(i,s)=>{this.pathTracer.reset(),this.sampleCount=0,this.pathTracer.setScene(this.scene,this.camera),this.overlayScene.traverse(n=>{if(!Object.keys(n.morphTargetDictionary||{}).includes(i))return;let o=s;n.userData[`origin_${i}`]&&(o-=n.userData[`origin_${i}`]);const a=n.morphTargetDictionary[i];n.morphTargetInfluences&&(n.morphTargetInfluences[a]=o),n instanceof y.Mesh&&n.geometry.translate(0,0,1e-5)}),this._progressShadow.clear(),this._progressShadow.recalculate()})}select(e){typeof e=="string"||(Array.isArray(e)?this._outlinePass.selectedObjects=[...e]:this._outlinePass.selectedObjects=[e])}appendTo(e){e.append(this.renderer.domElement),e.append(this.stats.dom),e.append(this.css2dRenderer.domElement),this.props.isMobile&&(e.classList.add("is-mobile"),e.style.cssText=`
|
|
5072
|
+
}`),this.camera.position.set(10,-10,5),this.camera.lookAt(new y.Vector3);const{tiles:t}=XA();this.pathTracer=new $0(this.renderer),this.pathTracer.filterGlossyFactor=.6;let i=window.devicePixelRatio;i<2&&(i=2),this.pathTracer.renderScale=this.props.isMobile?1:i,this.pathTracer.bounces=this.props.isMobile?8:10,this.pathTracer.transmissiveBounces=this.props.isMobile?1:3,this.pathTracer.tiles.set(t,t),this.pathTracer.fadeDuration=0;const s=new GS(e.workerUrl),n=typeof navigator<"u"?navigator.hardwareConcurrency:4;s.maxWorkerCount=n,this.pathTracer.setBVHWorker(s),this.orthographicCamera.left=-20,this.orthographicCamera.right=20,this.orthographicCamera.top=-20,this.orthographicCamera.bottom=20;let o=this.controls.target.x,a=this.controls.target.y;const h=()=>{this.controls.target.x=o,this.controls.target.y=a};this.controls.addEventListener("change",()=>{var d;this.sampleCount=0,h(),this._uiHiddenTime=this._clock.getElapsedTime(),this.orthographicCamera.position.copy(this.camera.position),this.orthographicCamera.lookAt(this.controls.target),this.usePathTracing&&(this.pathTracer.pausePathTracing=!1,(d=this.pathTracer)==null||d.updateCamera()),this._updateCamera(),!(Math.abs(this.camera.position.x)<.001||Math.abs(this.camera.position.y)<.001)&&(this._axisMoving||(this.mainCamera=this.camera,this.usePathTracing&&this.generateBVH().then()))}),this._mainCamera=this.camera,this._composer=new qm.EffectComposer(this.renderer),this._composer.setPixelRatio(window.devicePixelRatio);const u=new dc.RenderPass(this.scene,this.camera);this._composer.addPass(u),this._composer.addPass(new Ym.OutputPass),this._outlinePass=new fc.OutlinePass(new y.Vector2(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePass.visibleEdgeColor.set(26367),this._outlinePass.edgeThickness=.5,this._outlinePass.hiddenEdgeColor.set(26367),this._outlinePass.edgeStrength=3,this._outlinePass.edgeGlow=0,this._composer.addPass(this._outlinePass),this._outlinePassError=new fc.OutlinePass(new y.Vector2(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePassError.visibleEdgeColor.set(16711680),this._outlinePassError.edgeThickness=.5,this._outlinePassError.hiddenEdgeColor.set(16711680),this._outlinePassError.edgeStrength=3,this._outlinePassError.edgeGlow=0,this._composer.addPass(this._outlinePassError),this._bloomPass=new Xm.UnrealBloomPass(new y.Vector2(window.innerWidth,window.innerHeight),.1,.1,.2),this._bloomPass.enabled=!1,this._bloomPass.renderToScreen=!1,this._composer.addPass(this._bloomPass),this._composer.renderTarget1.texture.colorSpace=y.SRGBColorSpace,this._composer.renderTarget2.texture.colorSpace=y.SRGBColorSpace,this._fxaaPass=new Wm.ShaderPass($m.FXAAShader),this._composer.addPass(this._fxaaPass),this._progressShadow=new HS(this.renderer,this.scene,{size:8,lightCount:e.isMobile?6:12,frames:e.isMobile?80:120,lightRadius:8,ambientWeight:.8}),this._progressShadow.lightOrigin.position.set(3,2.5,6),this._progressShadow.visible=!1,this._container.add(this.amr),this.scene.add(this._container),this.ticker(),this._loadEnv(),this._initEvents(),this.scene.add(this._cameraPositionUI),this._ground.rotateX(-Math.PI/2),this.scene.add(this._ground),(typeof e.useAxisBall!="boolean"||e.useAxisBall)&&(this._controlsGizmo=new zS(this.controls,{size:160,padding:12,offset:e.axisBallOffset||new y.Vector2(10,10),fontSize:17,bubbleSizePrimary:18,bubbleSizeSecondary:14}),this._controlsGizmo.addListener("axis-select-start",()=>{this._axisMoving=!0,this.mainCamera=this.orthographicCamera,this.usePathTracing&&this.generateBVH().then()}),this._controlsGizmo.addListener("axis-select-end",()=>{this._axisMoving=!1})),this.test=new y.Mesh(new y.PlaneGeometry(2,2),new y.MeshBasicMaterial({map:this._amrRender.texture,opacity:.5,transparent:!0,side:y.DoubleSide})),this.test.position.set(0,1,0),this.test.visible=!1,this.scene.add(this.test)}get pointCloudMode(){return this._pointCloudMode}set pointCloudMode(e){this._pointCloudMode=e,this.amr.setPointCloudMode(e),e?setTimeout(()=>{console.log(this.amr.lines.children)},3e3):this._outlinePass.selectedObjects=[],this._bloomPass,e?this.scene.fog=null:this.scene.background=null}get usePathTracing(){return this._usePathTracing}_clearAmrContent(){const e=this.renderer.getRenderTarget();this.renderer.setRenderTarget(this._amrRender),this.renderer.setClearColor(0,0),this.renderer.clear(!0,!0,!0),this.renderer.setRenderTarget(e)}get shadowMode(){return this._shadowMode}set shadowMode(e){e?(this._progressShadow.visible=!1,this.amr.bodyOpacity=.2):(this._progressShadow.visible=!0,this.amr.bodyOpacity=1,this._progressShadow.isFinished||this._progressShadow.recalculate().then()),this._shadowMode=e}set usePathTracing(e){this._clearAmrContent(),e?(this.scene.add(this.light),this.renderer.toneMappingExposure=1.8,this.overlayScene.add(this._progressShadow.shadowCatcherMesh),this.amr&&(this.amr.bodyOpacity=1),this.hideAmrUI(),this.pathTracer.renderToCanvas=!0,this.scene.background=null):(this.light.removeFromParent(),this.renderer.toneMappingExposure=1.4,this.scene.add(this._progressShadow.shadowCatcherMesh),this.pathTracer.renderToCanvas=!1,this.amr.logos.forEach(t=>{var i;(i=t.parent)==null||i.add(t.target)}),this.showAmrUI(),this.amr&&this.amr.opacityCache!==void 0?(this.amr.bodyOpacity=this.amr.opacityCache,this.amr.opacityCache=void 0):this.amr&&(this.amr.bodyOpacity=1),this.pathTracer.reset(),this._ground.visible=!1,this.scene.background=this.scene.environment),this._usePathTracing=e,this.controls.dampingFactor=e?1:Kd,this.sampleCount=0}get fpsAverage(){return hm(this._fpsCache)}get mainCamera(){return this._mainCamera}set mainCamera(e){this._mainCamera=e,this._composer.passes.forEach(t=>{t instanceof dc.RenderPass&&(t.camera=e)}),e instanceof y.OrthographicCamera?this.scene.background=null:this.scene.background=this.scene.environment}showState(){this.stats.dom.style.display="block"}hideState(){this.stats.dom.style.display="none"}hideAmrUI(e=!0,t=!0){this.shadowMode||this.amr.slots.forEach(i=>i.hide()),this.amr.sizeBox.hide(e),this.amr.controllers.forEach(i=>i.hide()),t&&this.amr.goods.forEach(i=>i.hide())}showAmrUI(e=!0){this.showSlots&&this.amr.slots.forEach(t=>t.show()),this.showSize&&this.amr.sizeBox.show(e),this.showControls&&this.amr.controllers.forEach(t=>t.show()),this.amr.goods.forEach(t=>t.show())}get showSlots(){return this._showSlots}set showSlots(e){this._showSlots=e,this.amr.slots.forEach(t=>e?t.show():t.hide())}get showSize(){return this._showSize}set showSize(e){this._showSize=e,e?this.amr.sizeBox.show(!0):this.amr.sizeBox.hide(!0)}get showControls(){return this._showControls}set showControls(e){this._showControls=e,this.amr.controllers.forEach(t=>e?t.show():t.hide())}_updateCamera(){const e=this.mainCamera.position.distanceTo(this.controls.target),t=2*Math.tan(this.camera.fov*.5*Math.PI/180)*e,i=this.size.x/this.size.y;this.orthographicCamera.left=-t*i/2,this.orthographicCamera.right=t*i/2,this.orthographicCamera.top=t/2,this.orthographicCamera.bottom=-t/2,this.orthographicCamera.updateProjectionMatrix()}_loadEnv(){new Vm.HDRLoader().load(XS,t=>{t.mapping=y.EquirectangularReflectionMapping,this._usePathTracing||(this.scene.background=t,this.scene.backgroundBlurriness=1,this.scene.backgroundIntensity=1,this.scene.backgroundRotation=new y.Euler(Math.PI/2,0,Math.PI*.98*.8),this.scene.environment=t,this.overlayScene.environment=t,this.scene.environmentRotation=this.scene.backgroundRotation,this.overlayScene.environmentRotation=this.scene.environmentRotation,this.scene.environmentIntensity=1.4,this.overlayScene.environmentIntensity=this.scene.environmentIntensity),this.pathTracer.updateEnvironment()},()=>{},()=>{})}_initEvents(){window.addEventListener("drag",this._drag),window.addEventListener("dragend",this._dragend),document.addEventListener("wheel",this._detectTrackpad),window.addEventListener("pointermove",this._pointermove),this.renderer.domElement.addEventListener("pointerdown",this._pointerdown)}switchCamera(){this.mainCamera=this.mainCamera===this.camera?this.orthographicCamera:this.camera}toCameraTop(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(0,e+this.controls.target.y,0))}toCameraRight(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(0,this.controls.target.y,e))}toCameraFace(){const e=this.camera.position.distanceTo(this.controls.target);this.camera.position.copy(new y.Vector3(e,this.controls.target.y,0))}async generateBVH(){this.pathTracer.pausePathTracing=!1,this.amr.slots.forEach(e=>e.hide()),this.amr&&(this.amr.opacityCache=this.amr.bodyOpacity,this.amr.bodyOpacity=1,this.overlayScene.clear(),this.amr.logos.forEach(e=>{const t=new y.Group;e.target.updateMatrixWorld(!0),t.applyMatrix4(e.target.matrixWorld),t.add(e.target),this.overlayScene.add(t)})),this.usePathTracing=!0,this.pathTracer.setScene(this.scene,this.mainCamera)}async download(e=!1){if(e&&!this.usePathTracing){const t=this._amrRender.width,i=this._amrRender.height,s=new Uint8Array(t*i*4);this.renderer.setRenderTarget(this._amrRender),this.renderer.readRenderTargetPixels(this._amrRender,0,0,t,i,s),this.renderer.setRenderTarget(null);const n=document.createElement("canvas");n.width=t,n.height=i;const o=n.getContext("2d"),a=new ImageData(t,i);for(let h=0;h<i;h++)for(let u=0;u<t;u++){const d=((i-h-1)*t+u)*4,l=(h*t+u)*4;a.data[l]=s[d],a.data[l+1]=s[d+1],a.data[l+2]=s[d+2],a.data[l+3]=s[d+3]}return o.putImageData(a,0,0),n.toDataURL("image/png")}else return new Promise((t,i)=>{this._uiHiddenTime=this._clock.getElapsedTime(),this.hideAmrUI();const s=this.scene.background;this.scene.background=null,setTimeout(()=>{const n=this.renderer.domElement.toDataURL("image/png");return this.scene.background=s,t(n)},this.fpsAverage)})}async captureTriViews(e){var o;const t=(e==null?void 0:e.subject)??this._container;(o=this._progressShadow)==null||o.visible;const i=this.scene.background,s=this.showSize;return new Fm({renderer:this.renderer,scene:this.scene,overlayScene:this.overlayScene,subject:t,onBeforeCapture:()=>{this.scene.background=null,this.hideAmrUI(),this.showSize=!1,this.usePathTracing&&(this.usePathTracing=!1),this._progressShadow.visible=!1},onAfterCapture:()=>{this.scene.background=i,this.showAmrUI(),this.showSize=s,this._progressShadow.visible=!0}}).capture(e)}clearAMR(){ii(this.overlayScene),this.amr.clean(),this.usePathTracing=!1}async exportAMR(){const e=this._container.clone(!0);return e.traverse(t=>{t.dispose&&(t.dispose(),t.removeFromParent())}),await dm.parseAsync(e,{onlyVisible:!0,binary:!0})}async addAMR(e,t=""){this.amr.init(this),await this.amr.load(e,t),this._progressShadow.clear(),this.amr.addEventListener("fork-height-change",this.debounceForkHeightChange),this.amr.addEventListener("shape-key-changed",(i,s)=>{this.pathTracer.reset(),this.sampleCount=0,this.pathTracer.setScene(this.scene,this.camera),this.overlayScene.traverse(n=>{if(!Object.keys(n.morphTargetDictionary||{}).includes(i))return;let o=s;n.userData[`origin_${i}`]&&(o-=n.userData[`origin_${i}`]);const a=n.morphTargetDictionary[i];n.morphTargetInfluences&&(n.morphTargetInfluences[a]=o),n instanceof y.Mesh&&n.geometry.translate(0,0,1e-5)}),this._progressShadow.clear(),this._progressShadow.recalculate()})}select(e){typeof e=="string"||(Array.isArray(e)?this._outlinePass.selectedObjects=[...e]:this._outlinePass.selectedObjects=[e])}appendTo(e){e.append(this.renderer.domElement),e.append(this.stats.dom),e.append(this.css2dRenderer.domElement),this.props.isMobile&&(e.classList.add("is-mobile"),e.style.cssText=`
|
|
5073
5073
|
-webkit-user-select: none;
|
|
5074
5074
|
user-select: none;
|
|
5075
5075
|
touch-action: none;
|
|
5076
5076
|
-webkit-touch-callout: none;
|
|
5077
|
-
`),this._controlsGizmo&&this._controlsGizmo.appendTo(e),this.stats.dom.style.bottom="0",this.stats.dom.style.top="auto",this.resize(),this._resizeObserver=new ResizeObserver(this.resize.bind(this)),this._resizeObserver.observe(e)}add(e){this._container.add(e)}updatePosition(){}removeFromParent(){var t;const e=this.renderer.domElement.parentElement;e&&((t=this._resizeObserver)==null||t.unobserve(e),e.removeChild(this.renderer.domElement))}clean(){this.amr.clean(),this._progressShadow.clear()}destroy(){var t,i,s;this._destroyed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._clock.stop(),(t=this._controlsGizmo)==null||t.destroy(),this.amr.destroy(),this.amr.removeFromParent(),this._progressShadow.destroy(),Pt.removeAll(),this.stats.dom.remove(),this._emitter.removeAllListeners(),(i=this._fitAnimation)==null||i.stop(),window.removeEventListener("drag",this._drag),document.removeEventListener("wheel",this._detectTrackpad),window.removeEventListener("pointermove",this._pointermove),this.renderer.domElement.removeEventListener("pointerdown",this._pointerdown);const e=this.renderer.domElement.parentElement;e&&((s=this._resizeObserver)==null||s.unobserve(e)),this.controls.dispose(),this.renderer.domElement.remove(),this.renderer.dispose(),this._composer.dispose(),ii(this.scene),this.scene.clear()}}class Bm{constructor(e){this.deps=e,this.canvas=null,this.pixelBuffer=null,this.orthoCamera=new y.OrthographicCamera(-1,1,1,-1,.1,1e3),this.orthoCamera.position.set(0,0,5),this.perspectiveCamera=new y.PerspectiveCamera(45,1,.1,2e3)}async capture(e){var p,g,m,_,v,x;const t=this.deps.renderer,i=(e==null?void 0:e.subject)??this.deps.subject;if(!i)throw new Error("TriViewCapture: subject is required.");const s=new y.Vector2;t.getSize(s);const n=((p=e==null?void 0:e.size)==null?void 0:p.width)??Math.round(s.x),o=((g=e==null?void 0:e.size)==null?void 0:g.height)??Math.round(s.y),a=(e==null?void 0:e.margin)??.15,h=(e==null?void 0:e.includeOverlay)??!1,u=n/o||1,d=this.resolveViews(e==null?void 0:e.views),l=new y.WebGLRenderTarget(n,o,{format:y.RGBAFormat,type:y.UnsignedByteType});l.texture.colorSpace=y.SRGBColorSpace,l.texture.generateMipmaps=!1,l.depthBuffer=!0;const c=this.storeRendererState(t),f={};try{(_=(m=this.deps).onBeforeCapture)==null||_.call(m);const b=this.computeBounds(i);this.applyRendererState(t,n,o,e==null?void 0:e.backgroundColor);for(const w of d){const C=this.configureCamera(b,w,u,a,n,o);t.setRenderTarget(l),t.clear(!0,!0,!0),t.render(this.deps.scene,C),h&&this.deps.overlayScene&&(t.clearDepth(),t.render(this.deps.overlayScene,C));const S=this.readPixels(t,l,n,o);f[w.key]=S}}finally{l.dispose(),this.restoreRendererState(t,c),(x=(v=this.deps).onAfterCapture)==null||x.call(v)}return f}resolveViews(e){return e&&e.length?e.map(t=>({key:t.key,direction:t.direction.clone(),up:t.up.clone(),plane:t.plane})):[{key:"top",direction:new y.Vector3(0,0,1),up:new y.Vector3(0,1,0),plane:{width:"x",height:"y",depth:"z"}},{key:"front",direction:new y.Vector3(0,-1,0),up:new y.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"}},{key:"side",direction:new y.Vector3(1,0,0),up:new y.Vector3(0,0,1),plane:{width:"y",height:"z",depth:"x"}},{key:"perspective",direction:new y.Vector3(1,1,1),up:new y.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"},mode:"perspective",fov:39.6}]}computeBounds(e){const t=new y.Box3,i=new y.Box3,s=new y.Vector3,n=new y.Vector3,o=new y.Sphere;return e.updateMatrixWorld(!0),e.traverse(a=>{if(!a.visible)return;const u=a.geometry;if(!u)return;u.boundingBox||u.computeBoundingBox();const d=u.boundingBox;d&&(i.copy(d).applyMatrix4(a.matrixWorld),t.union(i))}),t.isEmpty()?(t.setFromCenterAndSize(s,new y.Vector3(.001,.001,.001)),n.set(.001,.001,.001),o.center.copy(s),o.radius=.001):(t.getCenter(s),t.getSize(n),t.getBoundingSphere(o)),(!Number.isFinite(o.radius)||o.radius<=0)&&(o.radius=Math.max(n.length()*.5,.001)),{box:t,center:s,size:n,sphere:o}}configureCamera(e,t,i,s,n,o){const a=t.direction.clone().normalize();a.lengthSq()===0&&a.set(0,0,1);const h=t.up.clone().normalize();if(Math.abs(h.dot(a))>.999&&(h.set(0,0,1),Math.abs(h.dot(a))>.999&&h.set(0,1,0)),(t.mode??"orthographic")==="perspective"){const b=this.perspectiveCamera,w=t.fov??45,C=y.MathUtils.degToRad(w),S=Math.max(Math.tan(C/2),1e-4),T=Math.max(S*(i||1),1e-4),M=this.getPerspectiveDirection(t,e.size).normalize(),P=new y.Vector3().crossVectors(M,h).normalize();P.lengthSq()<1e-6&&P.set(1,0,0);const R=new y.Vector3().crossVectors(P,M).normalize(),E=Math.max(e.size.x*.5,1e-4),A=Math.max(e.size.y*.5,1e-4),I=Math.max(e.size.z*.5,1e-4),D=[new y.Vector3(-E,-A,-I),new y.Vector3(-E,-A,I),new y.Vector3(-E,A,-I),new y.Vector3(-E,A,I),new y.Vector3(E,-A,-I),new y.Vector3(E,-A,I),new y.Vector3(E,A,-I),new y.Vector3(E,A,I)];let B=0,k=-1/0;for(const L of D){const F=P.dot(L),G=R.dot(L),Q=M.dot(L);k=Math.max(k,Q);const ee=Q+Math.abs(F)/T,oe=Q+Math.abs(G)/S;B=Math.max(B,ee,oe)}B=Math.max(B,k+.1);const z=B*(1+s);let q=1/0;for(const L of D){const F=M.dot(L),G=z-F;G>.001&&(q=Math.min(q,G))}return b.fov=w,b.aspect=i||n/Math.max(o,1),b.near=Math.max(.1,Number.isFinite(q)?q*.5:z*.1),b.far=Math.max(b.near+1,z+e.sphere.radius*3),b.position.copy(e.center).add(M.clone().multiplyScalar(z)),b.up.copy(R),b.lookAt(e.center),b.updateProjectionMatrix(),b.updateMatrixWorld(!0),b}const d=this.orthoCamera,l=e.size,c=e.center,f=Math.max(l[t.plane.width]*.5,.01),p=Math.max(l[t.plane.height]*.5,.01),g=Math.max(l[t.plane.depth]*.5,.01);let m=f*(1+s),_=p*(1+s);m/i>_?_=m/i:m=_*i;const v=g*(1+s)+Math.max(m,_),x=c.clone().add(a.multiplyScalar(v));return d.left=-m,d.right=m,d.top=_,d.bottom=-_,d.near=.1,d.far=v*4,d.zoom=1,d.position.copy(x),d.up.copy(h),d.lookAt(c),d.updateProjectionMatrix(),d.updateMatrixWorld(!0),d}getPerspectiveDirection(e,t){const i=e.direction.clone();i.lengthSq()===0&&i.set(1,1,1);const s=new y.Vector3(Math.abs(i.x)||1,Math.abs(i.y)||1,Math.abs(i.z)||1),n=new y.Vector3(Math.sign(i.x||1),Math.sign(i.y||1),Math.sign(i.z||1)),o=.25,a=new y.Vector3(Math.max(o,s.x)*Math.max(t.x,.001),Math.max(o,s.y)*Math.max(t.y,.001),0),h=Math.max((t.x+t.y)*.5,.001),u=Math.max(t.z,.001),d=Math.max(o,s.z),l=u*.5+h*.5;return a.z=d*l,a.multiply(n),a}storeRendererState(e){const t=new y.Vector2;e.getSize(t);const i=new y.Vector4;e.getViewport(i);const s=new y.Vector4;e.getScissor(s);const n=e.getClearColor(new y.Color),o=e.getClearAlpha();return{size:t,pixelRatio:e.getPixelRatio(),viewport:i,scissor:s,scissorTest:e.getScissorTest(),autoClear:e.autoClear,target:e.getRenderTarget(),clearColor:n,clearAlpha:o}}applyRendererState(e,t,i,s){if(e.setPixelRatio(1),e.setSize(t,i,!1),e.setViewport(0,0,t,i),e.setScissor(0,0,t,i),e.setScissorTest(!1),e.autoClear=!0,s!==void 0)if(s===null){const n=e.getClearColor(new y.Color);e.setClearColor(n,0)}else s instanceof y.Color?e.setClearColor(s,1):e.setClearColor(new y.Color(s),1);else{const n=e.getClearColor(new y.Color);e.setClearColor(n,0)}}restoreRendererState(e,t){e.setPixelRatio(t.pixelRatio),e.setSize(t.size.x,t.size.y,!1),e.setViewport(t.viewport.x,t.viewport.y,t.viewport.z,t.viewport.w),e.setScissor(t.scissor.x,t.scissor.y,t.scissor.z,t.scissor.w),e.setScissorTest(t.scissorTest),e.autoClear=t.autoClear,e.setRenderTarget(t.target),e.setClearColor(t.clearColor,t.clearAlpha)}readPixels(e,t,i,s){const n=i*s*4;(!this.pixelBuffer||this.pixelBuffer.length!==n)&&(this.pixelBuffer=new Uint8Array(n)),e.readRenderTargetPixels(t,0,0,i,s,this.pixelBuffer);const o=this.ensureCanvas(i,s),a=o.getContext("2d");if(!a)throw new Error("TriViewCapture: failed to get 2D context.");const h=a.createImageData(i,s),u=h.data,d=this.pixelBuffer;for(let l=0;l<s;l+=1){const f=(s-l-1)*i*4,p=l*i*4;u.set(d.subarray(f,f+i*4),p)}return a.putImageData(h,0,0),o.toDataURL("image/png")}ensureCanvas(e,t){if(typeof document>"u")throw new Error("TriViewCapture: document is not available in this environment.");return this.canvas||(this.canvas=document.createElement("canvas")),(this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t),this.canvas}}const KS="shop-components",QS="0.2.1",JS="Shop components",eE="dist/shop-components.umd.js",tE="dist/shop-components.mjs",iE="dist/main.d.ts",rE={dts:"tsc --emitDeclarationOnly & tsc & storybook build -o dist",test:'echo "Error: no test specified" && exit 1',dev:"storybook dev -p 6006",build:"storybook build -o dist",vite:"vite build",vitedev:"vite dev",version:"auto-changelog -p && git add CHANGELOG.md"},sE=["dist","package.json"],nE=[],oE="machengda<machengda@seer-group.com>",aE="ISC",lE={"@needle-tools/gltf-progressive":"^3.3.5","@storybook/addon-essentials":"^8.0.6","@storybook/addon-links":"^8.0.6","@storybook/addon-mdx-gfm":"^8.0.6","@storybook/addon-themes":"^8.0.6","@storybook/blocks":"^8.0.6","@storybook/web-components":"^8.0.6","@storybook/web-components-vite":"^8.0.6","auto-changelog":"^2.4.0",react:"^18.2.0","react-dom":"^18.2.0",storybook:"^8.0.6",vite:"^5.1.6","vite-plugin-dts":"^3.7.3"},hE={"string-width":"4.2.3"},cE={"@nodetoy/three-nodetoy":"^0.1.36","@tweakpane/core":"^2.0.3","@tweenjs/tween.js":"^23.1.2","@types/bezier-js":"^4.1.1","@types/howler":"^2.2.11","@types/three":"0.180.0","bezier-js":"^6.1.4",eventemitter3:"^5.0.1",howler:"^2.2.4",lit:"^3.1.0","pixi-viewport":"^5.0.2","pixi.js":"7.4.0","stats-fps.js":"0.0.6",stylus:"^0.63.0",terser:"^5.44.0",three:"0.180.0","three-gpu-pathtracer":"0.0.23","three-mesh-bvh":"^0.7.5","troika-three-text":"^0.49.1",tweakpane:"^4.0.3"},uE={name:KS,version:QS,description:JS,main:eE,module:tE,types:iE,scripts:rE,files:sE,keywords:nE,author:oE,license:aE,devDependencies:lE,resolutions:hE,dependencies:cE};function Qd(){const r="Nebular Engin",e=uE.version,t=`%c ${r} %c v${e} `;console.log(t,"background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;","background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;")}const Jd="__SHOP_COMPONENTS_BANNER_PRINTED__";try{const r=globalThis;r[Jd]||(r[Jd]=!0,Qd())}catch{Qd()}exports.Amr=Tm;exports.Line=ET;exports.Logo=yh;exports.SGLBLoader=Uo;exports.SLOT_EVENTS=Le;exports.Scene3D=ZS;exports.Skin=Mh;exports.Slot=_h;exports.SlotState=Dm;exports.TriViewCapture=Bm;exports.arrayBufferToUrl=mh;exports.calculateArrayAverage=hm;exports.calculateFocalLength=zA;exports.createSGLBFile=KA;exports.downloadBlob=UA;exports.dracoExporter=ZA;exports.font=jS;exports.gltfExporter=dm;exports.gltfLoader=rs;exports.imageBitmapToPixiTexture=GA;exports.imageBitmapToUrl=gh;exports.isAppleDevice=cm;exports.textureLoader=ac;
|
|
5077
|
+
`),this._controlsGizmo&&this._controlsGizmo.appendTo(e),this.stats.dom.style.bottom="0",this.stats.dom.style.top="auto",this.resize(),this._resizeObserver=new ResizeObserver(this.resize.bind(this)),this._resizeObserver.observe(e)}add(e){this._container.add(e)}updatePosition(){}removeFromParent(){var t;const e=this.renderer.domElement.parentElement;e&&((t=this._resizeObserver)==null||t.unobserve(e),e.removeChild(this.renderer.domElement))}clean(){this.amr.clean(),this._progressShadow.clear()}destroy(){var t,i,s;this._destroyed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._clock.stop(),(t=this._controlsGizmo)==null||t.destroy(),this.amr.destroy(),this.amr.removeFromParent(),this._progressShadow.destroy(),Pt.removeAll(),this.stats.dom.remove(),this._emitter.removeAllListeners(),(i=this._fitAnimation)==null||i.stop(),window.removeEventListener("drag",this._drag),document.removeEventListener("wheel",this._detectTrackpad),window.removeEventListener("pointermove",this._pointermove),this.renderer.domElement.removeEventListener("pointerdown",this._pointerdown);const e=this.renderer.domElement.parentElement;e&&((s=this._resizeObserver)==null||s.unobserve(e)),this.controls.dispose(),this.renderer.domElement.remove(),this.renderer.dispose(),this._composer.dispose(),ii(this.scene),this.scene.clear()}}class Fm{constructor(e){this.deps=e,this.canvas=null,this.pixelBuffer=null,this.orthoCamera=new y.OrthographicCamera(-1,1,1,-1,.1,1e3),this.orthoCamera.position.set(0,0,5),this.perspectiveCamera=new y.PerspectiveCamera(45,1,.1,2e3)}async capture(e){var p,g,m,_,v,x;const t=this.deps.renderer,i=(e==null?void 0:e.subject)??this.deps.subject;if(!i)throw new Error("TriViewCapture: subject is required.");const s=new y.Vector2;t.getSize(s);const n=((p=e==null?void 0:e.size)==null?void 0:p.width)??Math.round(s.x),o=((g=e==null?void 0:e.size)==null?void 0:g.height)??Math.round(s.y),a=(e==null?void 0:e.margin)??.15,h=(e==null?void 0:e.includeOverlay)??!1,u=n/o||1,d=this.resolveViews(e==null?void 0:e.views),l=new y.WebGLRenderTarget(n,o,{format:y.RGBAFormat,type:y.UnsignedByteType});l.texture.colorSpace=y.SRGBColorSpace,l.texture.generateMipmaps=!1,l.depthBuffer=!0;const c=this.storeRendererState(t),f={};try{(_=(m=this.deps).onBeforeCapture)==null||_.call(m);const b=this.computeBounds(i);this.applyRendererState(t,n,o,e==null?void 0:e.backgroundColor);for(const w of d){const C=this.configureCamera(b,w,u,a,n,o);t.setRenderTarget(l),t.clear(!0,!0,!0),t.render(this.deps.scene,C),h&&this.deps.overlayScene&&(t.clearDepth(),t.render(this.deps.overlayScene,C));const S=this.readPixels(t,l,n,o);f[w.key]=S}}finally{l.dispose(),this.restoreRendererState(t,c),(x=(v=this.deps).onAfterCapture)==null||x.call(v)}return f}resolveViews(e){return e&&e.length?e.map(t=>({key:t.key,direction:t.direction.clone(),up:t.up.clone(),plane:t.plane})):[{key:"top",direction:new y.Vector3(0,0,1),up:new y.Vector3(0,1,0),plane:{width:"x",height:"y",depth:"z"}},{key:"front",direction:new y.Vector3(0,-1,0),up:new y.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"}},{key:"side",direction:new y.Vector3(1,0,0),up:new y.Vector3(0,0,1),plane:{width:"y",height:"z",depth:"x"}},{key:"perspective",direction:new y.Vector3(1,1,1),up:new y.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"},mode:"perspective",fov:39.6}]}computeBounds(e){const t=new y.Box3,i=new y.Box3,s=new y.Vector3,n=new y.Vector3,o=new y.Sphere;return e.updateMatrixWorld(!0),e.traverse(a=>{if(!a.visible)return;const u=a.geometry;if(!u)return;u.boundingBox||u.computeBoundingBox();const d=u.boundingBox;d&&(i.copy(d).applyMatrix4(a.matrixWorld),t.union(i))}),t.isEmpty()?(t.setFromCenterAndSize(s,new y.Vector3(.001,.001,.001)),n.set(.001,.001,.001),o.center.copy(s),o.radius=.001):(t.getCenter(s),t.getSize(n),t.getBoundingSphere(o)),(!Number.isFinite(o.radius)||o.radius<=0)&&(o.radius=Math.max(n.length()*.5,.001)),{box:t,center:s,size:n,sphere:o}}configureCamera(e,t,i,s,n,o){const a=t.direction.clone().normalize();a.lengthSq()===0&&a.set(0,0,1);const h=t.up.clone().normalize();if(Math.abs(h.dot(a))>.999&&(h.set(0,0,1),Math.abs(h.dot(a))>.999&&h.set(0,1,0)),(t.mode??"orthographic")==="perspective"){const b=this.perspectiveCamera,w=t.fov??45,C=y.MathUtils.degToRad(w),S=Math.max(Math.tan(C/2),1e-4),T=Math.max(S*(i||1),1e-4),M=this.getPerspectiveDirection(t,e.size).normalize(),P=new y.Vector3().crossVectors(M,h).normalize();P.lengthSq()<1e-6&&P.set(1,0,0);const R=new y.Vector3().crossVectors(P,M).normalize(),E=Math.max(e.size.x*.5,1e-4),A=Math.max(e.size.y*.5,1e-4),I=Math.max(e.size.z*.5,1e-4),D=[new y.Vector3(-E,-A,-I),new y.Vector3(-E,-A,I),new y.Vector3(-E,A,-I),new y.Vector3(-E,A,I),new y.Vector3(E,-A,-I),new y.Vector3(E,-A,I),new y.Vector3(E,A,-I),new y.Vector3(E,A,I)];let B=0,k=-1/0;for(const L of D){const F=P.dot(L),G=R.dot(L),Q=M.dot(L);k=Math.max(k,Q);const ee=Q+Math.abs(F)/T,oe=Q+Math.abs(G)/S;B=Math.max(B,ee,oe)}B=Math.max(B,k+.1);const z=B*(1+s);let q=1/0;for(const L of D){const F=M.dot(L),G=z-F;G>.001&&(q=Math.min(q,G))}return b.fov=w,b.aspect=i||n/Math.max(o,1),b.near=Math.max(.1,Number.isFinite(q)?q*.5:z*.1),b.far=Math.max(b.near+1,z+e.sphere.radius*3),b.position.copy(e.center).add(M.clone().multiplyScalar(z)),b.up.copy(R),b.lookAt(e.center),b.updateProjectionMatrix(),b.updateMatrixWorld(!0),b}const d=this.orthoCamera,l=e.size,c=e.center,f=Math.max(l[t.plane.width]*.5,.01),p=Math.max(l[t.plane.height]*.5,.01),g=Math.max(l[t.plane.depth]*.5,.01);let m=f*(1+s),_=p*(1+s);m/i>_?_=m/i:m=_*i;const v=g*(1+s)+Math.max(m,_),x=c.clone().add(a.multiplyScalar(v));return d.left=-m,d.right=m,d.top=_,d.bottom=-_,d.near=.1,d.far=v*4,d.zoom=1,d.position.copy(x),d.up.copy(h),d.lookAt(c),d.updateProjectionMatrix(),d.updateMatrixWorld(!0),d}getPerspectiveDirection(e,t){const i=e.direction.clone();i.lengthSq()===0&&i.set(1,1,1);const s=new y.Vector3(Math.abs(i.x)||1,Math.abs(i.y)||1,Math.abs(i.z)||1),n=new y.Vector3(Math.sign(i.x||1),Math.sign(i.y||1),Math.sign(i.z||1)),o=.25,a=new y.Vector3(Math.max(o,s.x)*Math.max(t.x,.001),Math.max(o,s.y)*Math.max(t.y,.001),0),h=Math.max((t.x+t.y)*.5,.001),u=Math.max(t.z,.001),d=Math.max(o,s.z),l=u*.5+h*.5;return a.z=d*l,a.multiply(n),a}storeRendererState(e){const t=new y.Vector2;e.getSize(t);const i=new y.Vector4;e.getViewport(i);const s=new y.Vector4;e.getScissor(s);const n=e.getClearColor(new y.Color),o=e.getClearAlpha();return{size:t,pixelRatio:e.getPixelRatio(),viewport:i,scissor:s,scissorTest:e.getScissorTest(),autoClear:e.autoClear,target:e.getRenderTarget(),clearColor:n,clearAlpha:o}}applyRendererState(e,t,i,s){if(e.setPixelRatio(1),e.setSize(t,i,!1),e.setViewport(0,0,t,i),e.setScissor(0,0,t,i),e.setScissorTest(!1),e.autoClear=!0,s!==void 0)if(s===null){const n=e.getClearColor(new y.Color);e.setClearColor(n,0)}else s instanceof y.Color?e.setClearColor(s,1):e.setClearColor(new y.Color(s),1);else{const n=e.getClearColor(new y.Color);e.setClearColor(n,0)}}restoreRendererState(e,t){e.setPixelRatio(t.pixelRatio),e.setSize(t.size.x,t.size.y,!1),e.setViewport(t.viewport.x,t.viewport.y,t.viewport.z,t.viewport.w),e.setScissor(t.scissor.x,t.scissor.y,t.scissor.z,t.scissor.w),e.setScissorTest(t.scissorTest),e.autoClear=t.autoClear,e.setRenderTarget(t.target),e.setClearColor(t.clearColor,t.clearAlpha)}readPixels(e,t,i,s){const n=i*s*4;(!this.pixelBuffer||this.pixelBuffer.length!==n)&&(this.pixelBuffer=new Uint8Array(n)),e.readRenderTargetPixels(t,0,0,i,s,this.pixelBuffer);const o=this.ensureCanvas(i,s),a=o.getContext("2d");if(!a)throw new Error("TriViewCapture: failed to get 2D context.");const h=a.createImageData(i,s),u=h.data,d=this.pixelBuffer;for(let l=0;l<s;l+=1){const f=(s-l-1)*i*4,p=l*i*4;u.set(d.subarray(f,f+i*4),p)}return a.putImageData(h,0,0),o.toDataURL("image/png")}ensureCanvas(e,t){if(typeof document>"u")throw new Error("TriViewCapture: document is not available in this environment.");return this.canvas||(this.canvas=document.createElement("canvas")),(this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t),this.canvas}}const QS="shop-components",JS="0.2.3",eE="Shop components",tE="dist/shop-components.umd.js",iE="dist/shop-components.mjs",rE="dist/main.d.ts",sE={dts:"tsc --emitDeclarationOnly & tsc & storybook build -o dist",test:'echo "Error: no test specified" && exit 1',dev:"storybook dev -p 6006",build:"storybook build -o dist",vite:"vite build",vitedev:"vite dev",version:"auto-changelog -p && git add CHANGELOG.md"},nE=["dist","package.json"],oE=[],aE="machengda<machengda@seer-group.com>",lE="ISC",hE={"@needle-tools/gltf-progressive":"^3.3.5","@storybook/addon-essentials":"^8.0.6","@storybook/addon-links":"^8.0.6","@storybook/addon-mdx-gfm":"^8.0.6","@storybook/addon-themes":"^8.0.6","@storybook/blocks":"^8.0.6","@storybook/web-components":"^8.0.6","@storybook/web-components-vite":"^8.0.6","auto-changelog":"^2.4.0",react:"^18.2.0","react-dom":"^18.2.0",storybook:"^8.0.6",vite:"^5.1.6","vite-plugin-dts":"^3.7.3"},cE={"string-width":"4.2.3"},uE={"@nodetoy/three-nodetoy":"^0.1.36","@tweakpane/core":"^2.0.3","@tweenjs/tween.js":"^23.1.2","@types/bezier-js":"^4.1.1","@types/howler":"^2.2.11","@types/three":"0.180.0","bezier-js":"^6.1.4",eventemitter3:"^5.0.1",howler:"^2.2.4",lit:"^3.1.0","pixi-viewport":"^5.0.2","pixi.js":"7.4.0","stats-fps.js":"0.0.6",stylus:"^0.63.0",terser:"^5.44.0",three:"0.180.0","three-gpu-pathtracer":"0.0.23","three-mesh-bvh":"^0.7.5","troika-three-text":"^0.49.1",tweakpane:"^4.0.3"},dE={name:QS,version:JS,description:eE,main:tE,module:iE,types:rE,scripts:sE,files:nE,keywords:oE,author:aE,license:lE,devDependencies:hE,resolutions:cE,dependencies:uE};function Qd(){const r="Nebular Engin",e=dE.version,t=`%c ${r} %c v${e} `;console.log(t,"background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;","background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;")}const Jd="__SHOP_COMPONENTS_BANNER_PRINTED__";try{const r=globalThis;r[Jd]||(r[Jd]=!0,Qd())}catch{Qd()}exports.Amr=Sm;exports.Line=CT;exports.Logo=yh;exports.SGLBLoader=No;exports.SLOT_EVENTS=Le;exports.Scene3D=KS;exports.Skin=Mh;exports.Slot=_h;exports.SlotState=Bm;exports.TriViewCapture=Fm;exports.arrayBufferToUrl=ph;exports.calculateArrayAverage=hm;exports.calculateFocalLength=HA;exports.createSGLBFile=QA;exports.downloadBlob=GA;exports.dracoExporter=KA;exports.font=YS;exports.gltfExporter=dm;exports.gltfLoader=ss;exports.imageBitmapToPixiTexture=zA;exports.imageBitmapToUrl=mh;exports.isAppleDevice=cm;exports.textureLoader=ac;
|