@uptimizr/dashboard 0.1.0
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/LICENSE +201 -0
- package/README.md +76 -0
- package/out/404.html +1 -0
- package/out/__next.__PAGE__.txt +9 -0
- package/out/__next._full.txt +20 -0
- package/out/__next._head.txt +6 -0
- package/out/__next._index.txt +5 -0
- package/out/__next._tree.txt +4 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_buildManifest.js +11 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_clientMiddlewareManifest.js +1 -0
- package/out/_next/static/93W3szqylNKDg-afLRmVW/_ssgManifest.js +1 -0
- package/out/_next/static/chunks/0-2y-_oomza2l.js +87 -0
- package/out/_next/static/chunks/00k_j_r7bv_eb.js +266 -0
- package/out/_next/static/chunks/00zdau6mcqeae.js +1 -0
- package/out/_next/static/chunks/023axeoslq39i.js +1 -0
- package/out/_next/static/chunks/068j6934u8j16.js +1 -0
- package/out/_next/static/chunks/0_rf76jneiwal.js +176 -0
- package/out/_next/static/chunks/0aznt7717miff.js +1 -0
- package/out/_next/static/chunks/0cu-q5q3a7uf3.js +1 -0
- package/out/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/out/_next/static/chunks/0dm32-jq30tg8.js +1 -0
- package/out/_next/static/chunks/0dn0yx0rn6mpf.js +1 -0
- package/out/_next/static/chunks/0flc7nppbmsl1.js +3 -0
- package/out/_next/static/chunks/0fskcfh9vbhtv.js +1 -0
- package/out/_next/static/chunks/0gv7mblzv3dl3.js +87 -0
- package/out/_next/static/chunks/0impkpmxx3ttp.js +1 -0
- package/out/_next/static/chunks/0jmn7u31w95ly.js +91 -0
- package/out/_next/static/chunks/0n8n481szj90g.js +1 -0
- package/out/_next/static/chunks/0o6ayai0s01js.js +1 -0
- package/out/_next/static/chunks/0rys92_73hdb0.js +22 -0
- package/out/_next/static/chunks/0tl_moiyi2txt.js +1 -0
- package/out/_next/static/chunks/0tx1j_ghpz7rc.css +3 -0
- package/out/_next/static/chunks/0ufbyo1x3qkmo.js +1 -0
- package/out/_next/static/chunks/0v82oqyoy9zol.js +1 -0
- package/out/_next/static/chunks/0wrm9jr-9bw0e.js +1893 -0
- package/out/_next/static/chunks/0wwcfw8i3j_zx.js +1 -0
- package/out/_next/static/chunks/0ys9-ozuluawt.js +1 -0
- package/out/_next/static/chunks/1-61zh4waha61.js +1 -0
- package/out/_next/static/chunks/10r_824wzt8hj.js +1 -0
- package/out/_next/static/chunks/112hws17nz665.js +7 -0
- package/out/_next/static/chunks/123xxske5c9na.js +1 -0
- package/out/_next/static/chunks/13isnf0--pmx1.js +1 -0
- package/out/_next/static/chunks/157d9euci08yu.js +1 -0
- package/out/_next/static/chunks/15s7425ffrec9.js +3 -0
- package/out/_next/static/chunks/163fa70v4mgxj.js +1 -0
- package/out/_next/static/chunks/17q0c2h5ui10r.js +4 -0
- package/out/_next/static/chunks/18u58lorfahxi.js +4 -0
- package/out/_next/static/chunks/1_aahautsz2v_.js +1 -0
- package/out/_next/static/chunks/1a9l89j7e6mqu.js +23 -0
- package/out/_next/static/chunks/1dsy2ngmfflis.js +123 -0
- package/out/_next/static/chunks/1flb8adpj6_2o.js +62 -0
- package/out/_next/static/chunks/1lsg-22yob8dx.js +1 -0
- package/out/_next/static/chunks/1nj82er7msdto.js +2 -0
- package/out/_next/static/chunks/1o1d0p-v1z8ty.js +1 -0
- package/out/_next/static/chunks/1pdep2_c530sg.js +1 -0
- package/out/_next/static/chunks/1thjncpj7u6pq.js +1 -0
- package/out/_next/static/chunks/1vdjn0pkoyypn.js +1 -0
- package/out/_next/static/chunks/1yehxf-fmeicg.js +1 -0
- package/out/_next/static/chunks/1zvc1tv--w8nn.js +1 -0
- package/out/_next/static/chunks/1zx2q-r32thv1.js +4 -0
- package/out/_next/static/chunks/2-sjjedfr0kfq.js +1 -0
- package/out/_next/static/chunks/21o42k82w4llc.js +1 -0
- package/out/_next/static/chunks/25b9x-li-tvk2.js +1 -0
- package/out/_next/static/chunks/2712627rfsmwn.js +1 -0
- package/out/_next/static/chunks/296w2ke-v5tbm.js +9 -0
- package/out/_next/static/chunks/29tfeb6amdkjb.js +23 -0
- package/out/_next/static/chunks/2a3spdq-m8drh.js +3 -0
- package/out/_next/static/chunks/2aelw3far6rii.js +1 -0
- package/out/_next/static/chunks/2aor7m-wbis85.js +1 -0
- package/out/_next/static/chunks/2cbmf9m7lqv6k.js +4 -0
- package/out/_next/static/chunks/2d09v5u7dfq0q.js +1 -0
- package/out/_next/static/chunks/2feca0xcipcyt.js +850 -0
- package/out/_next/static/chunks/2fh-_9b6tqhvb.js +1 -0
- package/out/_next/static/chunks/2g5gecypj0rqe.js +1 -0
- package/out/_next/static/chunks/2kazjq29jeamx.js +1109 -0
- package/out/_next/static/chunks/2p2vv6cc9i-3q.js +255 -0
- package/out/_next/static/chunks/2szdcpl41-kzv.js +1 -0
- package/out/_next/static/chunks/2tws5udjdcmh3.js +1 -0
- package/out/_next/static/chunks/2u6shh3oeycm-.js +1 -0
- package/out/_next/static/chunks/2unhhuv0arlcv.js +1 -0
- package/out/_next/static/chunks/2xwy0-qfho1iz.js +91 -0
- package/out/_next/static/chunks/2ycvtdd68gub7.js +1 -0
- package/out/_next/static/chunks/2yiy_l8bwiw2_.js +3 -0
- package/out/_next/static/chunks/2yph6f7khgqii.js +1 -0
- package/out/_next/static/chunks/3-shckrcpvbxu.js +1681 -0
- package/out/_next/static/chunks/30fq_t9e2_fv-.js +1 -0
- package/out/_next/static/chunks/30yzu213bqtq0.js +5 -0
- package/out/_next/static/chunks/310uz81hnnzsu.js +1 -0
- package/out/_next/static/chunks/3218lp8l0a5g_.js +1 -0
- package/out/_next/static/chunks/35h5n42wxwgzk.js +123 -0
- package/out/_next/static/chunks/37vzwr3ciejf1.js +1 -0
- package/out/_next/static/chunks/38fhw7fatsyvd.js +3 -0
- package/out/_next/static/chunks/3be6s4_kn9q-o.js +1 -0
- package/out/_next/static/chunks/3i3gbhccmhu7j.js +210 -0
- package/out/_next/static/chunks/3l1dr_qm_x5kp.js +1 -0
- package/out/_next/static/chunks/3mqy-84_ul3t2.js +1 -0
- package/out/_next/static/chunks/3nz-dh9d7cehk.js +1 -0
- package/out/_next/static/chunks/3pufs8g4ui943.js +1 -0
- package/out/_next/static/chunks/3sjq_xoi4rbyg.js +31 -0
- package/out/_next/static/chunks/3t06schbtqonl.js +1 -0
- package/out/_next/static/chunks/3v3-7fio3nw_t.js +1 -0
- package/out/_next/static/chunks/3v5ha25nxo43j.js +1 -0
- package/out/_next/static/chunks/3yfrsm8lfi6ls.js +22 -0
- package/out/_next/static/chunks/3zskk1hxu3-_o.js +1 -0
- package/out/_next/static/chunks/turbopack-2ropzf0axp1x9.js +1 -0
- package/out/_next/static/media/0c89a48fa5027cee-s.p.2cyn07wtgehh0.woff2 +0 -0
- package/out/_next/static/media/13bf9871fe164e7f-s.2f7nqdagzwx2-.woff2 +0 -0
- package/out/_next/static/media/28868e710e86be81-s.2eksvhm1z0jwa.woff2 +0 -0
- package/out/_next/static/media/32687112bd2dd8db-s.1gepa_7fcx9fm.woff2 +0 -0
- package/out/_next/static/media/3fe682a82f50d426-s.0vfdmo25voy_0.woff2 +0 -0
- package/out/_next/static/media/70bc3e132a0a741e-s.p.3t6q91iet4nsy.woff2 +0 -0
- package/out/_next/static/media/71b036adf157cdcf-s.0bp8oijd_gu96.woff2 +0 -0
- package/out/_next/static/media/89b21bb081cb7469-s.1fby2rem9ngyr.woff2 +0 -0
- package/out/_next/static/media/cc545e633e20c56d-s.176arc174-8zp.woff2 +0 -0
- package/out/_next/static/media/icon.08h29dad3pcxg.svg +4 -0
- package/out/_not-found/__next._full.txt +16 -0
- package/out/_not-found/__next._head.txt +6 -0
- package/out/_not-found/__next._index.txt +5 -0
- package/out/_not-found/__next._not-found.__PAGE__.txt +5 -0
- package/out/_not-found/__next._not-found.txt +5 -0
- package/out/_not-found/__next._tree.txt +2 -0
- package/out/_not-found.html +1 -0
- package/out/_not-found.txt +16 -0
- package/out/api/projects +1 -0
- package/out/icon.svg +4 -0
- package/out/index.html +1 -0
- package/out/index.txt +20 -0
- package/out/logo.svg +46 -0
- package/package.json +67 -0
- package/server/standalone.mjs +182 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,97998,e=>{"use strict";var t,s,r=e.i(96265),i=e.i(40408),o=e.i(35407),a=e.i(21249),n=e.i(1773);function h(e,t,s=null){let l=t.pathArray,u=t.closeArray,c=t.closePath,d=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),f=t.instance,p=t.updatable;if(f){let e=r.TmpVectors.Vector3[0].setAll(Number.MAX_VALUE),s=r.TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE),h=f.getVerticesData(o.VertexBuffer.PositionKind);if((t=>{let r=l[0].length,o=0,a=f._originalBuilderSideOrientation===i.Mesh.DOUBLESIDE?2:1;for(let i=1;i<=a;++i)for(let i=0;i<l.length;++i){let a=l[i],n=a.length;r=r<n?r:n;for(let i=0;i<r;++i){let r=a[i];t[o]=r.x,t[o+1]=r.y,t[o+2]=r.z,e.minimizeInPlaceFromFloats(r.x,r.y,r.z),s.maximizeInPlaceFromFloats(r.x,r.y,r.z),o+=3}if(f._creationDataStorage&&f._creationDataStorage.closePath){let e=a[0];t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z,o+=3}}})(h),f.hasBoundingInfo?f.getBoundingInfo().reConstruct(e,s,f._worldMatrix):f.buildBoundingInfo(e,s,f._worldMatrix),f.updateVerticesData(o.VertexBuffer.PositionKind,h,!1,!1),t.colors){let e=f.getVerticesData(o.VertexBuffer.ColorKind);for(let s=0,r=0;s<t.colors.length;s++,r+=4){let i=t.colors[s];e[r]=i.r,e[r+1]=i.g,e[r+2]=i.b,e[r+3]=i.a}f.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1)}if(t.uvs){let e=f.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<t.uvs.length;s++)e[2*s]=t.uvs[s].x,e[2*s+1]=n.useOpenGLOrientationForUV?1-t.uvs[s].y:t.uvs[s].y;f.updateVerticesData(o.VertexBuffer.UVKind,e,!1,!1)}if(!f.areNormalsFrozen||f.isFacetDataEnabled){let e=f.getIndices(),t=f.getVerticesData(o.VertexBuffer.NormalKind),s=f.isFacetDataEnabled?f.getFacetDataParameters():null;if(a.VertexData.ComputeNormals(h,e,t,s),f._creationDataStorage&&f._creationDataStorage.closePath){let e,s;for(let r=0;r<l.length;r++)e=3*f._creationDataStorage.idx[r],s=r+1<l.length?(f._creationDataStorage.idx[r+1]-1)*3:t.length-3,t[e]=(t[e]+t[s])*.5,t[e+1]=(t[e+1]+t[s+1])*.5,t[e+2]=(t[e+2]+t[s+2])*.5,t[s]=t[e],t[s+1]=t[e+1],t[s+2]=t[e+2]}f.areNormalsFrozen||f.updateVerticesData(o.VertexBuffer.NormalKind,t,!1,!1)}return f}{let r=new i.Mesh(e,s);r._originalBuilderSideOrientation=d,r._creationDataStorage=new i._CreationDataStorage;let h=function(e){let t,s,r,i,h,l,u,c,d,f,p,x,g,_=e.pathArray,m=e.closeArray||!1,M=e.closePath||!1,y=e.invertUV||!1,V=Math.floor(_[0].length/2),O=e.offset||V;O=O>V?V:Math.floor(O);let A=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,v=e.uvs,T=e.colors,b=[],I=[],D=[],w=[],P=[],F=[],B=[],L=[],E=[],C=[];if(_.length<2){let e=[],t=[];for(r=0;r<_[0].length-O;r++)e.push(_[0][r]),t.push(_[0][r+O]);_=[e,t]}let S=0,z=+!!M,R=+!!m;for(s=0,t=_[0].length;s<_.length+R;s++){for(B[s]=0,P[s]=[0],t=t<(l=(h=s===_.length?_[0]:_[s]).length)?t:l,i=0;i<l;)b.push(h[i].x,h[i].y,h[i].z),i>0&&(u=h[i].subtract(h[i-1]).length()+B[s],P[s].push(u),B[s]=u),i++;M&&(i--,b.push(h[0].x,h[0].y,h[0].z),u=h[i].subtract(h[0]).length()+B[s],P[s].push(u),B[s]=u),E[s]=l+z,C[s]=S,S+=l+z}for(r=0;r<t+z;r++)for(s=0,L[r]=0,F[r]=[0];s<_.length-1+R;s++)c=_[s],d=s===_.length-1?_[0]:_[s+1],r===t?(f=c[0],p=d[0]):(f=c[r],p=d[r]),u=p.subtract(f).length()+L[r],F[r].push(u),L[r]=u;if(v)for(s=0;s<v.length;s++)w.push(v[s].x,n.useOpenGLOrientationForUV?1-v[s].y:v[s].y);else for(s=0;s<_.length+R;s++)for(r=0;r<t+z;r++)x=0!=B[s]?P[s][r]/B[s]:0,g=0!=L[r]?F[r][s]/L[r]:0,y?w.push(g,x):w.push(x,n.useOpenGLOrientationForUV?1-g:g);let U=0,N=E[s=0]-1,W=E[s+1]-1,G=N<W?N:W,k=C[1]-C[0],H=E.length-1;for(;U<=G&&s<H;)I.push(U,U+k,U+1),I.push(U+k+1,U+1,U+k),(U+=1)===G&&(k=C[++s+1]-C[s],N=E[s]-1,W=E[s+1]-1,U=C[s],G=N<W?N+U:W+U);if(a.VertexData.ComputeNormals(b,I,D),M){let e,t;for(s=0;s<_.length;s++){e=3*C[s],t=s+1<_.length?(C[s+1]-1)*3:D.length-3,D[e]=(D[e]+D[t])*.5,D[e+1]=(D[e+1]+D[t+1])*.5,D[e+2]=(D[e+2]+D[t+2])*.5;let r=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=r,D[e+1]/=r,D[e+2]/=r,D[t]=D[e],D[t+1]=D[e+1],D[t+2]=D[e+2]}}if(m){let e=3*C[0],s=3*C[_.length];for(r=0;r<t+z;r++){D[e]=(D[e]+D[s])*.5,D[e+1]=(D[e+1]+D[s+1])*.5,D[e+2]=(D[e+2]+D[s+2])*.5;let t=Math.sqrt(D[e]*D[e]+D[e+1]*D[e+1]+D[e+2]*D[e+2]);D[e]/=t,D[e+1]/=t,D[e+2]/=t,D[s]=D[e],D[s+1]=D[e+1],D[s+2]=D[e+2],e+=3,s+=3}}a.VertexData._ComputeSides(A,b,I,D,w,e.frontUVs,e.backUVs);let X=null;if(T){X=new Float32Array(4*T.length);for(let e=0;e<T.length;e++)X[4*e]=T[e].r,X[4*e+1]=T[e].g,X[4*e+2]=T[e].b,X[4*e+3]=T[e].a}let Z=new a.VertexData,K=new Float32Array(b),Y=new Float32Array(D),q=new Float32Array(w);return Z.indices=I,Z.positions=K,Z.normals=Y,Z.uvs=q,X&&Z.set(X,o.VertexBuffer.ColorKind),M&&(Z._idx=C),Z}(t);return c&&(r._creationDataStorage.idx=h._idx),r._creationDataStorage.closePath=c,r._creationDataStorage.closeArray=u,h.applyToMesh(r,p),r}}var l=e.i(70653);function u(e){let t=e.pattern||i.Mesh.NO_FLIP,s=e.tileWidth||e.tileSize||1,r=e.tileHeight||e.tileSize||1,o=e.alignHorizontal||0,n=e.alignVertical||0,h=e.width||e.size||1,l=Math.floor(h/s),u=h-l*s,c=e.height||e.size||1,d=Math.floor(c/r),f=c-d*r,p=s*l/2,x=r*d/2,g=0,_=0,m=0,M=0,y=0,V=0;if(u>0||f>0){switch(m=-p,M=-x,y=p,V=x,o){case i.Mesh.CENTER:u/=2,m-=u,y+=u;break;case i.Mesh.LEFT:y+=u,g=-u/2;break;case i.Mesh.RIGHT:m-=u,g=u/2}switch(n){case i.Mesh.CENTER:f/=2,M-=f,V+=f;break;case i.Mesh.BOTTOM:V+=f,_=-f/2;break;case i.Mesh.TOP:M-=f,_=f/2}}let O=[],A=[],v=[];v[0]=[0,0,1,0,1,1,0,1],v[1]=[0,0,1,0,1,1,0,1],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(v[1]=[1,1,0,1,0,0,1,0]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(v[1]=[1,0,0,0,0,1,1,1]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(v[1]=[0,1,1,1,1,0,0,0]);let T=[],b=[],I=[],D=0;for(let e=0;e<d;e++)for(let o=0;o<l;o++)O.push(-p+o*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+e*r+_,0),O.push(-p+(o+1)*s+g,-x+(e+1)*r+_,0),O.push(-p+o*s+g,-x+(e+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(v[(o%2+e%2)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(v[e%2]):T.concat(v[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1),D+=4;if(u>0||f>0){let e,a,h,c,v,w=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.TOP),P=f>0&&(n===i.Mesh.CENTER||n===i.Mesh.BOTTOM),F=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.RIGHT),B=u>0&&(o===i.Mesh.CENTER||o===i.Mesh.LEFT);if(w&&F&&(O.push(m+g,M+_,0),O.push(-p+g,M+_,0),O.push(-p+g,M+f+_,0),O.push(m+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,c=1,v=1,e=[a=1-u/s,h=1-f/r,c,h,c,v,a,v],t===i.Mesh.ROTATE_ROW&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),t===i.Mesh.FLIP_ROW&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),t===i.Mesh.FLIP_N_ROTATE_ROW&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&B&&(O.push(p+g,M+_,0),O.push(y+g,M+_,0),O.push(y+g,M+f+_,0),O.push(p+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,v=1,e=[a=0,h=1-f/r,c=u/s,h,c,v,a,v],(t===i.Mesh.ROTATE_ROW||t===i.Mesh.ROTATE_TILE&&l%2==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW||t===i.Mesh.FLIP_TILE&&l%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_TILE&&l%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&F&&(O.push(m+g,x+_,0),O.push(-p+g,x+_,0),O.push(-p+g,V+_,0),O.push(m+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,h=0,c=1,e=[a=1-u/s,h,c,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&d%1==0)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&d%2==0)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&d%2==0)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),P&&B&&(O.push(p+g,x+_,0),O.push(y+g,x+_,0),O.push(y+g,V+_,0),O.push(p+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,e=[a=0,h=0,c=u/s,h,c,v=f/r,a,v],(t===i.Mesh.ROTATE_ROW&&d%2==1||t===i.Mesh.ROTATE_TILE&&(d+l)%2==1)&&(e=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_ROW&&d%2==1||t===i.Mesh.FLIP_TILE&&(d+l)%2==1)&&(e=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_ROW&&d%2==1||t===i.Mesh.FLIP_N_ROTATE_TILE&&(d+l)%2==1)&&(e=[a,1-h,c,1-h,c,1-v,a,1-v]),T=T.concat(e),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w){let e=[];a=0,h=1-f/r,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+_,0),O.push(-p+(r+1)*s+g,M+f+_,0),O.push(-p+r*s+g,M+f+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[1]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(P){let e=[];a=0,h=0,c=1,v=f/r,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let r=0;r<l;r++)O.push(-p+r*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V-f+_,0),O.push(-p+(r+1)*s+g,V+_,0),O.push(-p+r*s+g,V+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(r+d)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[d%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(F){let e=[];a=1-u/s,h=0,c=1,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(m+g,-x+s*r+_,0),O.push(m+u+g,-x+s*r+_,0),O.push(m+u+g,-x+(s+1)*r+_,0),O.push(m+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+1)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(B){let e=[];a=0,h=0,c=u/r,v=1,e[0]=[a,h,c,h,c,v,a,v],e[1]=[a,h,c,h,c,v,a,v],(t===i.Mesh.ROTATE_TILE||t===i.Mesh.ROTATE_ROW)&&(e[1]=[1-a,1-h,1-c,1-h,1-c,1-v,1-a,1-v]),(t===i.Mesh.FLIP_TILE||t===i.Mesh.FLIP_ROW)&&(e[1]=[1-a,h,1-c,h,1-c,v,1-a,v]),(t===i.Mesh.FLIP_N_ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_ROW)&&(e[1]=[a,1-h,c,1-h,c,1-v,a,1-v]);for(let s=0;s<d;s++)O.push(y-u+g,-x+s*r+_,0),O.push(y+g,-x+s*r+_,0),O.push(y+g,-x+(s+1)*r+_,0),O.push(y-u+g,-x+(s+1)*r+_,0),I.push(D,D+1,D+3,D+1,D+2,D+3),D+=4,T=t===i.Mesh.FLIP_TILE||t===i.Mesh.ROTATE_TILE||t===i.Mesh.FLIP_N_ROTATE_TILE?T.concat(e[(s+l)%2]):t===i.Mesh.FLIP_ROW||t===i.Mesh.ROTATE_ROW||t===i.Mesh.FLIP_N_ROTATE_ROW?T.concat(e[s%2]):T.concat(e[0]),b.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}}let w=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;a.VertexData._ComputeSides(w,O,I,A,T,e.frontUVs,e.backUVs);let P=new a.VertexData;return P.indices=I,P.positions=O,P.normals=A,P.uvs=T,P.colors=w===a.VertexData.DOUBLESIDE?b.concat(b):b,P}function c(e){let t,s=e.faceUV||Array(6),o=e.faceColors,h=e.pattern||i.Mesh.NO_FLIP,c=e.width||e.size||1,d=e.height||e.size||1,f=e.depth||e.size||1,p=e.tileWidth||e.tileSize||1,x=e.tileHeight||e.tileSize||1,g=e.alignHorizontal||0,_=e.alignVertical||0,m=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;for(let e=0;e<6;e++)void 0===s[e]&&(s[e]=new r.Vector4(0,0,1,1)),o&&void 0===o[e]&&(o[e]=new l.Color4(1,1,1,1));let M=c/2,y=d/2,V=f/2,O=[];for(let e=0;e<2;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});for(let e=2;e<4;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:f,height:d,alignVertical:_,alignHorizontal:g,sideOrientation:m});let A=_;_===i.Mesh.BOTTOM?A=i.Mesh.TOP:_===i.Mesh.TOP&&(A=i.Mesh.BOTTOM);for(let e=4;e<6;e++)O[e]=u({pattern:h,tileWidth:p,tileHeight:x,width:c,height:f,alignVertical:A,alignHorizontal:g,sideOrientation:m});let v=[],T=[],b=[],I=[],D=[],w=[],P=[],F=[],B=0;for(let e=0;e<6;e++){let i=O[e].positions.length;w[e]=[],P[e]=[];for(let t=0;t<i/3;t++)w[e].push(new r.Vector3(O[e].positions[3*t],O[e].positions[3*t+1],O[e].positions[3*t+2])),P[e].push(new r.Vector3(O[e].normals[3*t],O[e].normals[3*t+1],O[e].normals[3*t+2]));t=O[e].uvs.length,F[e]=[];for(let r=0;r<t;r+=2)F[e][r]=s[e].x+(s[e].z-s[e].x)*O[e].uvs[r],F[e][r+1]=s[e].y+(s[e].w-s[e].y)*O[e].uvs[r+1],n.useOpenGLOrientationForUV&&(F[e][r+1]=1-F[e][r+1]);if(b=b.concat(F[e]),I=I.concat(O[e].indices.map(e=>e+B)),B+=w[e].length,o){let t=o[e];for(let s=0;s<w[e].length;s++)D.push(t.r,t.g,t.b,t.a)}}let L=[{m:r.Matrix.RotationY(Math.PI),t:new r.Vector3(0,0,V),op:1},{m:r.Matrix.Identity(),t:new r.Vector3(0,0,V),op:-1},{m:r.Matrix.RotationY(-Math.PI/2),t:new r.Vector3(M,0,0),op:1},{m:r.Matrix.RotationY(Math.PI/2),t:new r.Vector3(M,0,0),op:-1},{m:r.Matrix.RotationX(Math.PI/2),t:new r.Vector3(0,y,0),op:1},{m:r.Matrix.RotationX(-Math.PI/2),t:new r.Vector3(0,y,0),op:-1}];for(let e=0;e<6;e++){let{m:t,t:s,op:i}=L[e];for(let o of w[e]){let e=r.Vector3.TransformCoordinates(o,t),a=1===i?e.add(s):e.subtract(s);v.push(a.x,a.y,a.z)}for(let s of P[e]){let e=r.Vector3.TransformNormal(s,t);T.push(e.x,e.y,e.z)}}let E=new a.VertexData;return E.indices=I,E.positions=v,E.normals=T,E.uvs=b,o&&(E.colors=m===a.VertexData.DOUBLESIDE?D.concat(D):D),E}a.VertexData.CreateTiledPlane=u,a.VertexData.CreateTiledBox=c;var d=e.i(70247),f=i,p=e.i(13379),x=e.i(12638),g=e.i(71265),_=e.i(24632);class m extends x.AbstractMesh{constructor(e,t){for(const s of(super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice(),t.getAnimationRanges()))null!=s&&this.createAnimationRange(s.name,s.from,s.to);if(this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),t.skeleton||t.morphTargetManager||!t.hasBoundingInfo)this.refreshBoundingInfo(!0,!0);else{const e=t.getBoundingInfo();this.buildBoundingInfo(e.minimum,e.maximum)}this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}set receiveShadows(e){this._sourceMesh?.receiveShadows!==e&&p.Logger.Warn("Setting receiveShadows on an instanced mesh has no effect")}get material(){return this._sourceMesh.material}set material(e){this._sourceMesh?.material!==e&&p.Logger.Warn("Setting material on an instanced mesh has no effect")}get visibility(){return this._sourceMesh.visibility}set visibility(e){this._sourceMesh?.visibility!==e&&p.Logger.Warn("Setting visibility on an instanced mesh has no effect")}get skeleton(){return this._sourceMesh.skeleton}set skeleton(e){this._sourceMesh?.skeleton!==e&&p.Logger.Warn("Setting skeleton on an instanced mesh has no effect")}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&p.Logger.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}get geometry(){return this._sourceMesh._geometry}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t,s){return this._sourceMesh.getVerticesData(e,t,s)}copyVerticesData(e,t){this._sourceMesh.copyVerticesData(e,t)}getVertexBuffer(e,t){return this._sourceMesh.getVertexBuffer(e,t)}setVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,s,r),this.sourceMesh}updateVerticesData(e,t,s,r){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,s,r),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;let s=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getData("object"==typeof e?e:{applySkeleton:e,applyMorph:t},null,o.VertexBuffer.PositionKind),s),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||p.Logger.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD!==this._sourceMesh&&this._currentLOD.billboardMode!==_.TransformNode.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new r.Matrix);let e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,r.TmpVectors.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(r.TmpVectors.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;let t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){let t=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this}_generatePointsArray(){return this._sourceMesh._generatePointsArray()}_updateBoundingInfo(){return this.hasBoundingInfo?this.getBoundingInfo().update(this.worldMatrixFromCache):this.buildBoundingInfo(this.absolutePosition,this.absolutePosition,this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this}clone(e,t=null,s,r){let i=(r||this._sourceMesh).createInstance(e);if(g.DeepCopier.DeepCopy(this,i,["name","subMeshes","uniqueId","parent","lightSources","receiveShadows","material","visibility","skeleton","sourceMesh","isAnInstance","facetNb","isFacetDataEnabled","isBlocked","useBones","hasInstances","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","hasBoundingInfo","geometry"],[]),t&&(i.parent=t),!s)for(let e=0;e<this.getScene().meshes.length;e++){let t=this.getScene().meshes[e];t.parent===this&&t.clone(t.name,i)}return i.computeWorldMatrix(!0),this.onClonedObservable.notifyObservers(i),i}dispose(e,t=!1){this._sourceMesh.removeInstance(this),super.dispose(e,t)}_serializeAsParent(e){super._serializeAsParent(e),e.parentId=this._sourceMesh.uniqueId,e.parentInstanceIndex=this._indexInSourceMeshInstanceArray}instantiateHierarchy(e=null,t,s){let r=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0,t&&t.newSourcedMesh);for(let e of(r&&s&&s(this,r),this.getChildTransformNodes(!0)))e.instantiateHierarchy(r,t,s);return r}}var M=e.i(23507),y=e.i(80871),V=e.i(66749);e.i(58720);var O=e.i(31278);e.i(65295);var A=e.i(22369),v=e.i(81623),T=e.i(92040),b=e.i(97001),I=e.i(12033);let D={effect:null,subMesh:null};class w extends A.PushMaterial{constructor(e,t,s,i={},o=!0){super(e,t,o),this._textures={},this._internalTextures={},this._textureArrays={},this._externalTextures={},this._floats={},this._ints={},this._uints={},this._floatsArrays={},this._colors3={},this._colors3Arrays={},this._colors4={},this._colors4Arrays={},this._vectors2={},this._vectors3={},this._vectors4={},this._quaternions={},this._quaternionsArrays={},this._matrices={},this._matrixArrays={},this._matrices3x3={},this._matrices2x2={},this._vectors2Arrays={},this._vectors3Arrays={},this._vectors4Arrays={},this._uniformBuffers={},this._textureSamplers={},this._storageBuffers={},this._cachedWorldViewMatrix=new r.Matrix,this._cachedWorldViewProjectionMatrix=new r.Matrix,this._multiview=!1,this._vertexPullingMetadata=null,this._materialHelperNeedsPreviousMatrices=!1,this._shaderPath=s,this._options={needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1,...i}}get shaderPath(){return this._shaderPath}set shaderPath(e){this._shaderPath=e}get options(){return this._options}get isMultiview(){return this._multiview}getClassName(){return"ShaderMaterial"}needAlphaBlending(){return this.alpha<1||this._options.needAlphaBlending}needAlphaTesting(){return this._options.needAlphaTesting}_checkUniform(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)}setTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this}setInternalTexture(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._internalTextures[e]=t,this}removeTexture(e){delete this._textures[e]}setTextureArray(e,t){return -1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this}setExternalTexture(e,t){return -1===this._options.externalTextures.indexOf(e)&&this._options.externalTextures.push(e),this._externalTextures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setUInt(e,t){return this._checkUniform(e),this._uints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor3Array(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b),e),[]),this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setColor4Array(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((e,t)=>(e.push(t.r,t.g,t.b,t.a),e),[]),this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setVector4(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}setQuaternion(e,t){return this._checkUniform(e),this._quaternions[e]=t,this}setQuaternionArray(e,t){return this._checkUniform(e),this._quaternionsArrays[e]=t.reduce((e,t)=>(t.toArray(e,e.length),e),[]),this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}setMatrices(e,t){this._checkUniform(e);let s=new Float32Array(16*t.length);for(let e=0;e<t.length;e++)t[e].copyToArray(s,16*e);return this._matrixArrays[e]=s,this}setMatrix3x3(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this}setMatrix2x2(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this}setArray2(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this}setArray3(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this}setArray4(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this}setUniformBuffer(e,t){return -1===this._options.uniformBuffers.indexOf(e)&&this._options.uniformBuffers.push(e),this._uniformBuffers[e]=t,this}setTextureSampler(e,t){return -1===this._options.samplerObjects.indexOf(e)&&this._options.samplerObjects.push(e),this._textureSamplers[e]=t,this}setStorageBuffer(e,t){return -1===this._options.storageBuffers.indexOf(e)&&this._options.storageBuffers.push(e),this._storageBuffers[e]=t,this}setDefine(e,t){let s=e.trimEnd()+" ",r=this.options.defines.findIndex(t=>t===e||t.startsWith(s));return r>=0&&this.options.defines.splice(r,1),("boolean"!=typeof t||t)&&this.options.defines.push(s+t),this}isReadyForSubMesh(e,t,s){return this.isReady(e,s,t)}isReady(e,t,s){let r=s&&this._storeEffectOnSubMeshes;if(this.isFrozen){let e=r?s._drawWrapper:this._drawWrapper;if(e.effect&&e._wasPreviouslyReady&&e._wasPreviouslyUsingInstances===t)return!0}let i=this.getScene(),a=i.getEngine(),n=[],h=[],l=null,u=this._shaderPath,c=this._options.uniforms,d=this._options.uniformBuffers,f=this._options.samplers;a.getCaps().multiview&&i.activeCamera&&i.activeCamera.outputRenderTarget&&i.activeCamera.outputRenderTarget.getViewCount()>1&&(this._multiview=!0,n.push("#define MULTIVIEW"),-1!==c.indexOf("viewProjection")&&-1===c.indexOf("viewProjectionR")&&c.push("viewProjectionR"));for(let e=0;e<this._options.defines.length;e++){let t=0===this._options.defines[e].indexOf("#define")?this._options.defines[e]:`#define ${this._options.defines[e]}`;n.push(t)}for(let e=0;e<this._options.attributes.length;e++)h.push(this._options.attributes[e]);if(e&&e.isVerticesDataPresent(o.VertexBuffer.ColorKind)&&(-1===h.indexOf(o.VertexBuffer.ColorKind)&&h.push(o.VertexBuffer.ColorKind),n.push("#define VERTEXCOLOR")),t&&(n.push("#define INSTANCES"),(0,b.PushAttributesForInstances)(h,this._materialHelperNeedsPreviousMatrices),e?.hasThinInstances&&(n.push("#define THIN_INSTANCES"),e&&e.isVerticesDataPresent(o.VertexBuffer.ColorInstanceKind)&&(h.push(o.VertexBuffer.ColorInstanceKind),n.push("#define INSTANCESCOLOR")))),e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton){h.push(o.VertexBuffer.MatricesIndicesKind),h.push(o.VertexBuffer.MatricesWeightsKind),e.numBoneInfluencers>4&&(h.push(o.VertexBuffer.MatricesIndicesExtraKind),h.push(o.VertexBuffer.MatricesWeightsExtraKind));let t=e.skeleton;n.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),(l=new O.EffectFallbacks).addCPUSkinningFallback(0,e),t.isUsingTextureForMatrices?(n.push("#define BONETEXTURE"),-1===c.indexOf("boneTextureInfo")&&c.push("boneTextureInfo"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(n.push("#define BonesPerMesh "+(t.bones.length+1)),-1===c.indexOf("mBones")&&c.push("mBones"))}else n.push("#define NUM_BONE_INFLUENCERS 0");let p=0,x=e?e.morphTargetManager:null;if(x){let t=-1!==n.indexOf("#define UV1"),s=-1!==n.indexOf("#define UV2"),r=-1!==n.indexOf("#define TANGENT"),i=-1!==n.indexOf("#define NORMAL"),o=-1!==n.indexOf("#define VERTEXCOLOR");p=(0,b.PrepareDefinesAndAttributesForMorphTargets)(x,n,h,e,!0,i,r,t,s,o),x.isUsingTextureForTargets&&(-1===c.indexOf("morphTargetTextureIndices")&&c.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),p>0&&((c=c.slice()).push("morphTargetInfluences"),c.push("morphTargetCount"),c.push("morphTargetTextureInfo"),c.push("morphTargetTextureIndices"))}else n.push("#define NUM_MORPH_INFLUENCERS 0");if(e){let s=e.bakedVertexAnimationManager;s&&s.isEnabled&&(n.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===c.indexOf("bakedVertexAnimationSettings")&&c.push("bakedVertexAnimationSettings"),-1===c.indexOf("bakedVertexAnimationTextureSizeInverted")&&c.push("bakedVertexAnimationTextureSizeInverted"),-1===c.indexOf("bakedVertexAnimationTime")&&c.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture"),t&&h.push("bakedVertexAnimationSettingsInstanced"))}for(let e in this._textures)if(!this._textures[e].isReady())return!1;for(let e in this._internalTextures)if(!this._internalTextures[e].isReady)return!1;e&&this.needAlphaTestingForMesh(e)&&n.push("#define ALPHATEST"),!1!==this._options.useClipPlane&&((0,T.AddClipPlaneUniforms)(c),(0,T.PrepareStringDefinesForClipPlanes)(this,i,n)),i.fogEnabled&&e?.applyFog&&i.fogMode!==V.Scene.FOGMODE_NONE&&(n.push("#define FOG"),-1===c.indexOf("view")&&c.push("view"),-1===c.indexOf("vFogInfos")&&c.push("vFogInfos"),-1===c.indexOf("vFogColor")&&c.push("vFogColor")),this._useLogarithmicDepth&&(n.push("#define LOGARITHMICDEPTH"),-1===c.indexOf("logarithmicDepthConstant")&&c.push("logarithmicDepthConstant"));let g=s?s.getRenderingMesh():e;if(g&&this.useVertexPulling){let e=g.geometry;e&&(this._vertexPullingMetadata=(0,I.PrepareVertexPullingUniforms)(e),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((e,t)=>{c.push(`vp_${t}_info`)})),n.push("#define USE_VERTEX_PULLING");let t=g.geometry?.getIndexBuffer();t&&!g.isUnIndexed&&(n.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"),t.is32Bits&&n.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"))}this.customShaderNameResolve&&(c=c.slice(),d=d.slice(),f=f.slice(),u=this.customShaderNameResolve(this.name,c,d,f,n,h));let _=r?s._getDrawWrapper(void 0,!0):this._drawWrapper,m=_?.effect??null,M=_?.defines??null,y=n.join("\n"),A=m;return M!==y&&(A=a.createEffect(u,{attributes:h,uniformsNames:c,uniformBuffersNames:d,samplers:f,defines:y,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:p},shaderLanguage:this._options.shaderLanguage,extraInitializationsAsync:this._options.extraInitializationsAsync},a),r?s.setEffect(A,y,this._materialContext):_&&_.setEffect(A,y),this._onEffectCreatedObservable&&(D.effect=A,D.subMesh=s??e?.subMeshes[0]??null,this._onEffectCreatedObservable.notifyObservers(D))),_._wasPreviouslyUsingInstances=!!t,!!A?.isReady()&&(m!==A&&i.resetCachedMaterial(),_._wasPreviouslyReady=!0,!0)}bindOnlyWorldMatrix(e,t){let s=t??this.getEffect();if(!s)return;let r=this._options.uniforms;-1!==r.indexOf("world")&&s.setMatrix("world",e);let i=this.getScene();-1!==r.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),s.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==r.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),s.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)),-1!==r.indexOf("view")&&s.setMatrix("view",i.getViewMatrix())}bindForSubMesh(e,t,s){this.bind(e,t,s._drawWrapperOverride?.effect,s)}bind(e,t,s,r){let i=r&&this._storeEffectOnSubMeshes,o=s??(i?r.effect:this.getEffect());if(!o)return;let a=this.getScene();this._activeEffect=o,this.bindOnlyWorldMatrix(e,s);let n=this._options.uniformBuffers,h=!1;if(o&&n&&n.length>0&&a.getEngine().supportsUniformBuffers)for(let s=0;s<n.length;++s)switch(n[s]){case"Mesh":t&&(t.getMeshUniformBuffer().bindToEffect(o,"Mesh"),t.transferToEffect(e));break;case"Scene":(0,b.BindSceneUniformBuffer)(o,a.getSceneUniformBuffer()),a.finalizeSceneUbo(),h=!0}let l=t&&i?this._mustRebind(a,o,r,t.visibility):a.getCachedMaterial()!==this;if(o&&l){let e;for(e in h||-1===this._options.uniforms.indexOf("view")||o.setMatrix("view",a.getViewMatrix()),h||-1===this._options.uniforms.indexOf("projection")||o.setMatrix("projection",a.getProjectionMatrix()),!h&&-1!==this._options.uniforms.indexOf("viewProjection")&&(o.setMatrix("viewProjection",a.getTransformMatrix()),this._multiview&&o.setMatrix("viewProjectionR",a._transformMatrixR)),a.activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&o.setVector3("cameraPosition",a.activeCamera.globalPosition),(0,b.BindBonesParameters)(t,o),(0,T.BindClipPlane)(o,this,a),this._vertexPullingMetadata&&(0,I.BindVertexPullingUniforms)(o,this._vertexPullingMetadata),this._useLogarithmicDepth&&(0,b.BindLogDepth)(i?r.materialDefines:o.defines,o,a),t&&(0,b.BindFogParameters)(a,t,o),this._textures)o.setTexture(e,this._textures[e]);for(e in this._internalTextures)o._bindTexture(e,this._internalTextures[e]);for(e in this._textureArrays)o.setTextureArray(e,this._textureArrays[e]);for(e in this._ints)o.setInt(e,this._ints[e]);for(e in this._uints)o.setUInt(e,this._uints[e]);for(e in this._floats)o.setFloat(e,this._floats[e]);for(e in this._floatsArrays)o.setArray(e,this._floatsArrays[e]);for(e in this._colors3)o.setColor3(e,this._colors3[e]);for(e in this._colors3Arrays)o.setArray3(e,this._colors3Arrays[e]);for(e in this._colors4){let t=this._colors4[e];o.setFloat4(e,t.r,t.g,t.b,t.a)}for(e in this._colors4Arrays)o.setArray4(e,this._colors4Arrays[e]);for(e in this._vectors2)o.setVector2(e,this._vectors2[e]);for(e in this._vectors3)o.setVector3(e,this._vectors3[e]);for(e in this._vectors4)o.setVector4(e,this._vectors4[e]);for(e in this._quaternions)o.setQuaternion(e,this._quaternions[e]);for(e in this._matrices)o.setMatrix(e,this._matrices[e]);for(e in this._matrixArrays)o.setMatrices(e,this._matrixArrays[e]);for(e in this._matrices3x3)o.setMatrix3x3(e,this._matrices3x3[e]);for(e in this._matrices2x2)o.setMatrix2x2(e,this._matrices2x2[e]);for(e in this._vectors2Arrays)o.setArray2(e,this._vectors2Arrays[e]);for(e in this._vectors3Arrays)o.setArray3(e,this._vectors3Arrays[e]);for(e in this._vectors4Arrays)o.setArray4(e,this._vectors4Arrays[e]);for(e in this._quaternionsArrays)o.setArray4(e,this._quaternionsArrays[e]);for(e in this._uniformBuffers){let t=this._uniformBuffers[e].getBuffer();t&&o.bindUniformBuffer(t,e)}let s=a.getEngine(),n=s.setExternalTexture;if(n)for(e in this._externalTextures)n.call(s,e,this._externalTextures[e]);let l=s.setTextureSampler;if(l)for(e in this._textureSamplers)l.call(s,e,this._textureSamplers[e]);let u=s.setStorageBuffer;if(u)for(e in this._storageBuffers)u.call(s,e,this._storageBuffers[e])}if(o&&t&&(l||!this.isFrozen)){(0,b.BindMorphTargetParameters)(t,o),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(o);let e=t.bakedVertexAnimationManager;if(e&&e.isEnabled){let e=i?r._drawWrapper:this._drawWrapper;t.bakedVertexAnimationManager?.bind(o,!!e._wasPreviouslyUsingInstances)}}this._afterBind(t,o,r)}getActiveTextures(){let e=super.getActiveTextures();for(let t in this._textures)e.push(this._textures[t]);for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)e.push(s[t])}return e}hasTexture(e){if(super.hasTexture(e))return!0;for(let t in this._textures)if(this._textures[t]===e)return!0;let t=e.getInternalTexture();for(let e in this._internalTextures)if(this._internalTextures[e]===t)return!0;for(let t in this._textureArrays){let s=this._textureArrays[t];for(let t=0;t<s.length;t++)if(s[t]===e)return!0}return!1}clone(e){let t=y.SerializationHelper.Clone(()=>new w(e,this.getScene(),this._shaderPath,this._options,this._storeEffectOnSubMeshes),this);for(let s of(t.name=e,t.id=e,"object"==typeof t._shaderPath&&(t._shaderPath={...t._shaderPath}),this._options={...this._options},Object.keys(this._options))){let e=this._options[s];Array.isArray(e)&&(this._options[s]=e.slice(0))}for(let e in this.stencil.copyTo(t.stencil),this._textures)t.setTexture(e,this._textures[e]);for(let e in this._internalTextures)t.setInternalTexture(e,this._internalTextures[e]);for(let e in this._textureArrays)t.setTextureArray(e,this._textureArrays[e]);for(let e in this._externalTextures)t.setExternalTexture(e,this._externalTextures[e]);for(let e in this._ints)t.setInt(e,this._ints[e]);for(let e in this._uints)t.setUInt(e,this._uints[e]);for(let e in this._floats)t.setFloat(e,this._floats[e]);for(let e in this._floatsArrays)t.setFloats(e,this._floatsArrays[e]);for(let e in this._colors3)t.setColor3(e,this._colors3[e]);for(let e in this._colors3Arrays)t._colors3Arrays[e]=this._colors3Arrays[e];for(let e in this._colors4)t.setColor4(e,this._colors4[e]);for(let e in this._colors4Arrays)t._colors4Arrays[e]=this._colors4Arrays[e];for(let e in this._vectors2)t.setVector2(e,this._vectors2[e]);for(let e in this._vectors3)t.setVector3(e,this._vectors3[e]);for(let e in this._vectors4)t.setVector4(e,this._vectors4[e]);for(let e in this._quaternions)t.setQuaternion(e,this._quaternions[e]);for(let e in this._quaternionsArrays)t._quaternionsArrays[e]=this._quaternionsArrays[e];for(let e in this._matrices)t.setMatrix(e,this._matrices[e]);for(let e in this._matrixArrays)t._matrixArrays[e]=this._matrixArrays[e].slice();for(let e in this._matrices3x3)t.setMatrix3x3(e,this._matrices3x3[e]);for(let e in this._matrices2x2)t.setMatrix2x2(e,this._matrices2x2[e]);for(let e in this._vectors2Arrays)t.setArray2(e,this._vectors2Arrays[e]);for(let e in this._vectors3Arrays)t.setArray3(e,this._vectors3Arrays[e]);for(let e in this._vectors4Arrays)t.setArray4(e,this._vectors4Arrays[e]);for(let e in this._uniformBuffers)t.setUniformBuffer(e,this._uniformBuffers[e]);for(let e in this._textureSamplers)t.setTextureSampler(e,this._textureSamplers[e]);for(let e in this._storageBuffers)t.setStorageBuffer(e,this._storageBuffers[e]);return t}dispose(e,t,s){if(t){let e;for(e in this._textures)this._textures[e].dispose();for(e in this._internalTextures)this._internalTextures[e].dispose();for(e in this._textureArrays){let t=this._textureArrays[e];for(let e=0;e<t.length;e++)t[e].dispose()}}this._textures={},this._internalTextures={},super.dispose(e,t,s)}serialize(){let e,t=y.SerializationHelper.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.uniqueId=this.uniqueId,t.options=this._options,t.shaderPath=this._shaderPath,t.storeEffectOnSubMeshes=this._storeEffectOnSubMeshes,t.stencil=this.stencil.serialize(),t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];let s=this._textureArrays[e];for(let r=0;r<s.length;r++)t.textureArrays[e].push(s[r].serialize())}for(e in t.ints={},this._ints)t.ints[e]=this._ints[e];for(e in t.uints={},this._uints)t.uints[e]=this._uints[e];for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.floatsArrays={},this._floatsArrays)t.floatsArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3){let s=this._colors3[e];t.colors3[e]=[s.r,s.g,s.b]}for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4){let s=this._colors4[e];t.colors4[e]=[s.r,s.g,s.b,s.a]}for(e in t.colors4Arrays={},this._colors4Arrays)t.colors4Arrays[e]=this._colors4Arrays[e];for(e in t.vectors2={},this._vectors2){let s=this._vectors2[e];t.vectors2[e]=[s.x,s.y]}for(e in t.vectors3={},this._vectors3){let s=this._vectors3[e];t.vectors3[e]=[s.x,s.y,s.z]}for(e in t.vectors4={},this._vectors4){let s=this._vectors4[e];t.vectors4[e]=[s.x,s.y,s.z,s.w]}for(e in t.quaternions={},this._quaternions)t.quaternions[e]=this._quaternions[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrixArray={},this._matrixArrays)t.matrixArray[e]=this._matrixArrays[e];for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];for(e in t.vectors4Arrays={},this._vectors4Arrays)t.vectors4Arrays[e]=this._vectors4Arrays[e];for(e in t.quaternionsArrays={},this._quaternionsArrays)t.quaternionsArrays[e]=this._quaternionsArrays[e];return t}}w.SnippetUrl="https://snippet.babylonjs.com";var P=e.i(75405);class F extends f.Mesh{_isShaderMaterial(e){return!!e&&"ShaderMaterial"===e.getClassName()}constructor(t,s=null,r=null,i=null,a,n,h,u){super(t,s,r,i,a),this.useVertexColor=n,this.useVertexAlpha=h,this.color=new l.Color3(1,1,1),this.alpha=1,this._shaderLanguage=0,this._ownsMaterial=!1,i&&(this.color=i.color.clone(),this.alpha=i.alpha,this.useVertexColor=i.useVertexColor,this.useVertexAlpha=i.useVertexAlpha),this.intersectionThreshold=.1;const c={attributes:[o.VertexBuffer.PositionKind],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:[],useClipPlane:null,shaderLanguage:0};if(this.useVertexAlpha?c.defines.push("#define VERTEXALPHA"):c.needAlphaBlending=!1,this.useVertexColor?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(o.VertexBuffer.ColorKind)):(c.uniforms.push("color"),this._color4=new l.Color4),u)this.material=u;else{this.getScene().getEngine().isWebGPU&&!F.ForceGLSL&&(this._shaderLanguage=1),c.shaderLanguage=this._shaderLanguage,c.extraInitializationsAsync=async()=>{1===this._shaderLanguage?await Promise.all([e.A(20169),e.A(57284)]):await Promise.all([e.A(76121),e.A(83228)])};const t=new w("colorShader",this.getScene(),"color",c,!1);t.doNotSerialize=!0,this._ownsMaterial=!0,this._setInternalMaterial(t)}}getClassName(){return"LinesMesh"}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){let t=this.material;if(t===e)return;let s=t&&this._ownsMaterial;this._ownsMaterial=!1,this._setInternalMaterial(e),s&&t?.dispose()}_setInternalMaterial(e){this._setMaterial(e),this.material&&(this.material.fillMode=M.Material.LineListDrawMode,this.material.disableLighting=!0)}get checkCollisions(){return!1}set checkCollisions(e){}_bind(e,t){if(!this._geometry)return this;let s=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(!this._userInstancedBuffersStorage||this.hasThinInstances?this._geometry._bind(t,s):this._geometry._bind(t,s,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects),!this.useVertexColor&&this._isShaderMaterial(this.material)){let{r:e,g:t,b:s}=this.color;this._color4.set(e,t,s,this.alpha),this.material.setColor4("color",this._color4)}return this}_draw(e,t,s){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;let r=this.getScene().getEngine();return this._unIndexed?r.drawArraysType(M.Material.LineListDrawMode,e.verticesStart,e.verticesCount,s):r.drawElementsType(M.Material.LineListDrawMode,e.indexStart,e.indexCount,s),this}dispose(e,t=!1,s){!s&&(this._ownsMaterial?this.material?.dispose(!1,!1,!0):t&&this.material?.dispose(!1,!1,!0)),super.dispose(e)}clone(e,t=null,s){return t&&void 0===t._addToSceneRootNodes?(t.source=this,new F(e,this.getScene(),t.parent,t.source,t.doNotCloneChildren)):new F(e,this.getScene(),t,this,s)}createInstance(e){let t=new B(e,this);if(this.instancedBuffers)for(let e in t.instancedBuffers={},this.instancedBuffers)t.instancedBuffers[e]=this.instancedBuffers[e];return t}serialize(e){super.serialize(e),e.color=this.color.asArray(),e.alpha=this.alpha}static Parse(e,t){let s=new F(e.name,t);return s.color=l.Color3.FromArray(e.color),s.alpha=e.alpha,s}}F.ForceGLSL=!1;class B extends m{constructor(e,t){super(e,t),this.intersectionThreshold=t.intersectionThreshold}getClassName(){return"InstancedLinesMesh"}}function L(e,t,s=null){let r=t.instance,i=t.lines,n=t.colors;if(r){let e,t,s=r.getVerticesData(o.VertexBuffer.PositionKind);n&&(e=r.getVerticesData(o.VertexBuffer.ColorKind));let a=0,h=0;for(let r=0;r<i.length;r++){let o=i[r];for(let i=0;i<o.length;i++)s[a]=o[i].x,s[a+1]=o[i].y,s[a+2]=o[i].z,n&&e&&(t=n[r],e[h]=t[i].r,e[h+1]=t[i].g,e[h+2]=t[i].b,e[h+3]=t[i].a,h+=4),a+=3}return r.updateVerticesData(o.VertexBuffer.PositionKind,s,!1,!1),n&&e&&r.updateVerticesData(o.VertexBuffer.ColorKind,e,!1,!1),r.refreshBoundingInfo(),r}let h=new F(e,s,null,void 0,void 0,!!n,t.useVertexAlpha,t.material);return(function(e){let t=[],s=[],r=e.lines,i=e.colors,o=[],n=0;for(let e=0;e<r.length;e++){let a=r[e];for(let r=0;r<a.length;r++){let{x:h,y:l,z:u}=a[r];if(s.push(h,l,u),i){let{r:t,g:s,b:a,a:n}=i[e][r];o.push(t,s,a,n)}r>0&&(t.push(n-1),t.push(n)),n++}}let h=new a.VertexData;return h.indices=t,h.positions=s,i&&(h.colors=o),h})(t).applyToMesh(h,t.updatable),h}(t=F.prototype).enableEdgesRendering??(t.enableEdgesRendering=(0,P._MissingSideEffect)("LinesMesh","enableEdgesRendering")),(s=B.prototype).enableEdgesRendering??(s.enableEdgesRendering=(0,P._MissingSideEffect)("InstancedLinesMesh","enableEdgesRendering"));var E=r,C=e.i(75991),S=e.i(89030);class z extends E.Vector2{constructor(e,t){super(e.x,e.y),this.index=t}}class R{constructor(){this.elements=[]}add(e){let t=[];for(let s of e){let e=new z(s,this.elements.length);t.push(e),this.elements.push(e)}return t}computeBounds(){let e=new E.Vector2(this.elements[0].x,this.elements[0].y),t=new E.Vector2(this.elements[0].x,this.elements[0].y);for(let s of this.elements)s.x<e.x?e.x=s.x:s.x>t.x&&(t.x=s.x),s.y<e.y?e.y=s.y:s.y>t.y&&(t.y=s.y);return{min:e,max:t,width:t.x-e.x,height:t.y-e.y}}}class U{_addToepoint(e){for(let t of e)this._epoints.push(t.x,t.y)}constructor(e,t,s,r=earcut){let i;this._points=new R,this._outlinepoints=new R,this._holes=[],this._epoints=[],this._eholes=[],this.bjsEarcut=r,this._name=e,this._scene=s||v.EngineStore.LastCreatedScene,i=t instanceof C.Path2?t.getPoints():t,this._addToepoint(i),this._points.add(i),this._outlinepoints.add(i),void 0===this.bjsEarcut&&p.Logger.Warn("Earcut was not found, the polygon will not be built.")}addHole(e){this._points.add(e);let t=new R;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this}build(e=!1,t=0,s=2){let r=new i.Mesh(this._name,this._scene),a=this.buildVertexData(t,s);return r.setVerticesData(o.VertexBuffer.PositionKind,a.positions,e),r.setVerticesData(o.VertexBuffer.NormalKind,a.normals,e),r.setVerticesData(o.VertexBuffer.UVKind,a.uvs,e),r.setIndices(a.indices),r}buildVertexData(e=0,t=2){let s=new a.VertexData,r=[],i=[],o=[],n=this._points.computeBounds();for(let e of this._points.elements)r.push(0,1,0),i.push(e.x,0,e.y),o.push((e.x-n.min.x)/n.width,(e.y-n.min.y)/n.height);let h=[],l=this.bjsEarcut(this._epoints,this._eholes,2);for(let e=0;e<l.length;e++)h.push(l[e]);if(e>0){let s=i.length/3;for(let t of this._points.elements)r.push(0,-1,0),i.push(t.x,-e,t.y),o.push(1-(t.x-n.min.x)/n.width,1-(t.y-n.min.y)/n.height);let a=h.length;for(let e=0;e<a;e+=3){let t=h[e+0],r=h[e+1],i=h[e+2];h.push(i+s),h.push(r+s),h.push(t+s)}for(let s of(this._addSide(i,r,o,h,n,this._outlinepoints,e,!1,t),this._holes))this._addSide(i,r,o,h,n,s,e,!0,t)}return s.indices=h,s.positions=i,s.normals=r,s.uvs=o,s}_addSide(e,t,s,r,i,o,a,n,h){let l=e.length/3,u=0;for(let c=0;c<o.elements.length;c++){let d,f=o.elements[c],p=o.elements[(c+1)%o.elements.length];e.push(f.x,0,f.y),e.push(f.x,-a,f.y),e.push(p.x,0,p.y),e.push(p.x,-a,p.y);let x=o.elements[(c+o.elements.length-1)%o.elements.length],g=o.elements[(c+2)%o.elements.length],_=new E.Vector3(-(p.y-f.y),0,p.x-f.x),m=new E.Vector3(-(f.y-x.y),0,f.x-x.x),M=new E.Vector3(-(g.y-p.y),0,g.x-p.x);n||(_=_.scale(-1),m=m.scale(-1),M=M.scale(-1));let y=_.normalizeToNew(),V=m.normalizeToNew(),O=E.Vector3.Dot(V,y);V=O>h?O<S.Epsilon-1?new E.Vector3(f.x,0,f.y).subtract(new E.Vector3(p.x,0,p.y)).normalize():m.add(_).normalize():y;let A=E.Vector3.Dot(M,_);d=A>h?A<S.Epsilon-1?new E.Vector3(p.x,0,p.y).subtract(new E.Vector3(f.x,0,f.y)).normalize():M.add(_).normalize():y,s.push(u/i.width,0),s.push(u/i.width,1),u+=_.length(),s.push(u/i.width,0),s.push(u/i.width,1),t.push(V.x,V.y,V.z),t.push(V.x,V.y,V.z),t.push(d.x,d.y,d.z),t.push(d.x,d.y,d.z),n?(r.push(l),r.push(l+2),r.push(l+1),r.push(l+1),r.push(l+2),r.push(l+3)):(r.push(l),r.push(l+1),r.push(l+2),r.push(l+1),r.push(l+3),r.push(l+2)),l+=4}}}function N(e,t,s=null,h=earcut){let u;t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);let c=t.shape,d=t.holes||[],f=t.depth||0,p=t.smoothingThreshold||2,x=[];for(let e=0;e<c.length;e++)x[e]=new r.Vector2(c[e].x,c[e].z);x[0].equalsWithEpsilon(x[x.length-1],1e-8)&&x.pop();let g=new U(e,x,s||v.EngineStore.LastCreatedScene,h);for(let e=0;e<d.length;e++){u=[];for(let t=0;t<d[e].length;t++)u.push(new r.Vector2(d[e][t].x,d[e][t].z));g.addHole(u)}let _=g.build(!1,f,p);return _._originalBuilderSideOrientation=t.sideOrientation,(function(e,t,s,i,h,u,c){let d,f,p,x,g=s||[,,,],_=[],m=c||!1;for(let e=0;e<3;e++)void 0===g[e]&&(g[e]=new r.Vector4(0,0,1,1)),i&&void 0===i[e]&&(i[e]=new l.Color4(1,1,1,1));let M=e.getVerticesData(o.VertexBuffer.PositionKind),y=e.getVerticesData(o.VertexBuffer.NormalKind),V=e.getVerticesData(o.VertexBuffer.UVKind),O=e.getIndices(),A=M.length/9,v=0,T=[0];if(m)for(let e=A;e<M.length/3;e+=4)T.push(v+=Math.sqrt((f=M[3*(e+2)]-M[3*e])*f+(p=M[3*(e+2)+2]-M[3*e+2])*p));let b=0;for(let e=0;e<y.length;e+=3).001>Math.abs(y[e+1])&&(b=1),.001>Math.abs(y[e+1]-1)&&(b=0),.001>Math.abs(y[e+1]+1)&&(b=2),x=e/3,1===b?((d=x-A)%4<1.5?m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)]/v:V[2*x]=g[b].x:m?V[2*x]=g[b].x+(g[b].z-g[b].x)*T[Math.floor(d/4)+1]/v:V[2*x]=g[b].z,d%2==0?V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].w:g[b].w:V[2*x+1]=n.useOpenGLOrientationForUV?1-g[b].y:g[b].y):(V[2*x]=(1-V[2*x])*g[b].x+V[2*x]*g[b].z,V[2*x+1]=(1-V[2*x+1])*g[b].y+V[2*x+1]*g[b].w,n.useOpenGLOrientationForUV&&(V[2*x+1]=1-V[2*x+1])),i&&_.push(i[b].r,i[b].g,i[b].b,i[b].a);a.VertexData._ComputeSides(t,M,O,y,V,h,u);let I=new a.VertexData;return I.indices=O,I.positions=M,I.normals=y,I.uvs=V,i&&(I.colors=t===a.VertexData.DOUBLESIDE?_.concat(_):_),I})(_,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs,t.wrap).applyToMesh(_,t.updatable),_}function W(e,t,s=null,r=earcut){return N(e,t,s,r)}function G(e,t,s,o,a,n,l,u,c,d,f,p,x,g,_,m,M,y,V,O,A){let v,T=(e,t,s,o,a,n,h,l,u,c,d)=>{let f=s.getTangents(),p=s.getNormals(),x=s.getBinormals(),g=s.getDistances();if(d){for(let e=0;e<f.length;e++)if(0==f[e].x&&0==f[e].y&&0==f[e].z&&f[e].copyFrom(f[e-1]),0==p[e].x&&0==p[e].y&&0==p[e].z&&p[e].copyFrom(p[e-1]),0==x[e].x&&0==x[e].y&&0==x[e].z&&x[e].copyFrom(x[e-1]),e>0){let t=f[e-1];0>r.Vector3.Dot(t,f[e])&&f[e].scaleInPlace(-1),t=p[e-1],0>r.Vector3.Dot(t,p[e])&&p[e].scaleInPlace(-1),t=x[e-1],0>r.Vector3.Dot(t,x[e])&&x[e].scaleInPlace(-1)}}let _=0,m=c&&l?l:()=>null!==n?n:0,M=c&&h?h:()=>null!==a?a:r.Vector3.OneReadOnly,y=2*(u!==i.Mesh.NO_CAP&&u!==i.Mesh.CAP_END),V=r.TmpVectors.Matrix[0];for(let s=0;s<t.length;s++){let i=[],a=m(s,g[s]),n=M(s,g[s]);r.Matrix.RotationAxisToRef(f[s],_,V);for(let o=0;o<e.length;o++){let a=f[s].scale(e[o].z).add(p[s].scale(e[o].x)).add(x[s].scale(e[o].y)),h=r.Vector3.Zero();r.Vector3.TransformCoordinatesToRef(a,V,h),h.multiplyInPlace(n).addInPlace(t[s]),i[o]=h}o[y]=i,_+=a,y++}let O=A||(e=>{let t,s=[],i=r.Vector3.Zero();for(t=0;t<e.length;t++)i.addInPlace(e[t]);for(i.scaleInPlace(1/e.length),t=0;t<e.length;t++)s.push(i);return s});switch(u){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:o[0]=O(o[2]),o[1]=o[2];break;case i.Mesh.CAP_END:o[y]=o[y-1],o[y+1]=O(o[y-1]);break;case i.Mesh.CAP_ALL:o[0]=O(o[2]),o[1]=o[2],o[y]=o[y-1],o[y+1]=O(o[y-1])}return o},b=null!==o?new r.Vector3(o,o,o):null;if(_){let e=_._creationDataStorage;return V?e.path3D.update(s,V):e.path3D.update(s),_=h("",{pathArray:v=T(t,s,e.path3D,e.pathArray,b,a,n,l,e.cap,f,O),closeArray:!1,closePath:!1,offset:0,updatable:!1,sideOrientation:0,instance:_},p||void 0)}let I=V?new C.Path3D(s,V):new C.Path3D(s),D=h(e,{pathArray:v=T(t,s,I,[],b,a,n,l,d=d<0||d>3?0:d,f,O),closeArray:u,closePath:c,updatable:x,sideOrientation:g,invertUV:m,frontUVs:M||void 0,backUVs:y||void 0},p);return D._creationDataStorage.pathArray=v,D._creationDataStorage.path3D=I,D._creationDataStorage.cap=d,D}var k=i;class H extends k.Mesh{constructor(e,t){super(e,t),this.generateOctree=!1}getClassName(){return"GroundMesh"}get subdivisions(){return Math.min(this._subdivisionsX,this._subdivisionsY)}get subdivisionsX(){return this._subdivisionsX}get subdivisionsY(){return this._subdivisionsY}optimize(e,t=32){this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),(0,P._IsSideEffectImplemented)(this.createOrUpdateSubmeshesOctree)&&this.createOrUpdateSubmeshesOctree(t)}getHeightAtCoordinates(e,t){let s=this.getWorldMatrix(),i=r.TmpVectors.Matrix[5];s.invertToRef(i);let o=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,i,o),e=o.x,t=o.z,e<this._minX||e>=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let a=this._getFacetAt(e,t),n=-(a.x*e+a.z*t+a.w)/a.y;return r.Vector3.TransformCoordinatesFromFloatsToRef(0,n,0,s,o),o.y}getNormalAtCoordinates(e,t){let s=new r.Vector3(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,s),s}getNormalAtCoordinatesToRef(e,t,s){let i=this.getWorldMatrix(),o=r.TmpVectors.Matrix[5];i.invertToRef(o);let a=r.TmpVectors.Vector3[8];if(r.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,o,a),e=a.x,t=a.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());let n=this._getFacetAt(e,t);return r.Vector3.TransformNormalFromFloatsToRef(n.x,n.y,n.z,i,s),this}updateCoordinateHeights(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this}_getFacetAt(e,t){let s=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),r=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),i=this._heightQuads[r*this._subdivisionsX+s];return t<i.slope.x*e+i.slope.y?i.facet1:i.facet2}_initHeightQuads(){let e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=[];for(let s=0;s<t;s++)for(let t=0;t<e;t++){let i={slope:r.Vector2.Zero(),facet1:new r.Vector4(0,0,0,0),facet2:new r.Vector4(0,0,0,0)};this._heightQuads[s*e+t]=i}return this}_computeHeightQuads(){let e,t,s,i,a,n,h,l=this.getVerticesData(o.VertexBuffer.PositionKind);if(!l)return this;let u=r.TmpVectors.Vector3[3],c=r.TmpVectors.Vector3[2],d=r.TmpVectors.Vector3[1],f=r.TmpVectors.Vector3[0],p=r.TmpVectors.Vector3[4],x=r.TmpVectors.Vector3[5],g=r.TmpVectors.Vector3[6],_=r.TmpVectors.Vector3[7],m=r.TmpVectors.Vector3[8],M=this._subdivisionsX,y=this._subdivisionsY;for(let o=0;o<y;o++)for(let y=0;y<M;y++){e=3*y,t=o*(M+1)*3,s=(o+1)*(M+1)*3,u.x=l[t+e],u.y=l[t+e+1],u.z=l[t+e+2],c.x=l[t+e+3],c.y=l[t+e+4],c.z=l[t+e+5],d.x=l[s+e],d.y=l[s+e+1],d.z=l[s+e+2],f.x=l[s+e+3],f.y=l[s+e+4],f.z=l[s+e+5],i=(f.z-u.z)/(f.x-u.x),a=u.z-i*u.x,c.subtractToRef(u,p),d.subtractToRef(u,x),f.subtractToRef(u,g),r.Vector3.CrossToRef(g,x,_),r.Vector3.CrossToRef(p,g,m),_.normalize(),m.normalize(),n=-(_.x*u.x+_.y*u.y+_.z*u.z),h=-(m.x*c.x+m.y*c.y+m.z*c.z);let V=this._heightQuads[o*M+y];V.slope.copyFromFloats(i,a),V.facet1.copyFromFloats(_.x,_.y,_.z,n),V.facet2.copyFromFloats(m.x,m.y,m.z,h)}return this}serialize(e){super.serialize(e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height}static Parse(e,t){let s=new H(e.name,t);return s._subdivisionsX=e.subdivisionsX||1,s._subdivisionsY=e.subdivisionsY||1,s._minX=e.minX,s._maxX=e.maxX,s._minZ=e.minZ,s._maxZ=e.maxZ,s._width=e.width,s._height=e.height,s}}var X=e.i(65740);function Z(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i,o,h,u,c,d,f=[];f[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},f[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},f[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},f[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},f[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},f[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},f[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},f[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},f[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},f[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},f[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},f[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},f[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},f[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},f[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};let p=e.type&&(e.type<0||e.type>=f.length)?0:e.type||0,x=e.size,g=e.sizeX||x||1,_=e.sizeY||x||1,m=e.sizeZ||x||1,M=e.custom||f[p],y=M.face.length,V=e.faceUV||Array(y),O=e.faceColors,A=void 0===e.flat||e.flat,v=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,T=[],b=[],I=[],D=[],w=[],P=0,F=0,B=[];if(A)for(s=0;s<y;s++)O&&void 0===O[s]&&(O[s]=new l.Color4(1,1,1,1)),V&&void 0===V[s]&&(V[s]=new r.Vector4(0,0,1,1));if(A)for(s=0;s<y;s++){let e=M.face[s].length;for(t=0,u=.5*Math.tan((h=2*Math.PI/e)/2),c=.5;t<e;t++)T.push(M.vertex[M.face[s][t]][0]*g,M.vertex[M.face[s][t]][1]*_,M.vertex[M.face[s][t]][2]*m),B.push(P),P++,i=V[s].x+(V[s].z-V[s].x)*(.5+u),o=V[s].y+(V[s].w-V[s].y)*(c-.5),D.push(i,n.useOpenGLOrientationForUV?1-o:o),d=u*Math.cos(h)-c*Math.sin(h),c=u*Math.sin(h)+c*Math.cos(h),u=d,O&&w.push(O[s].r,O[s].g,O[s].b,O[s].a);for(t=0;t<e-2;t++)b.push(B[0+F],B[t+2+F],B[t+1+F]);F+=e}else{for(t=0;t<M.vertex.length;t++)T.push(M.vertex[t][0]*g,M.vertex[t][1]*_,M.vertex[t][2]*m),D.push(0,+!!n.useOpenGLOrientationForUV);for(s=0;s<y;s++)for(t=0;t<M.face[s].length-2;t++)b.push(M.face[s][0],M.face[s][t+2],M.face[s][t+1])}a.VertexData.ComputeNormals(T,b,I),a.VertexData._ComputeSides(v,T,b,I,D,e.frontUVs,e.backUVs);let L=new a.VertexData;return L.positions=T,L.indices=b,L.normals=I,L.uvs=D,O&&A&&(L.colors=w),L})(t).applyToMesh(o,t.updatable),o}var K=e.i(46703);let Y=new r.Vector3(1,0,0),q=new r.Vector3(-1,0,0),j=new r.Vector3(0,1,0),Q=new r.Vector3(0,-1,0),$=new r.Vector3(0,0,1),J=new r.Vector3(0,0,-1);class ee{constructor(e=r.Vector3.Zero(),t=r.Vector3.Up(),s=r.Vector2.Zero(),i=0,o=0,a=null,n=null,h=null,l=null){this.position=e,this.normal=t,this.uv=s,this.vertexIdx=i,this.vertexIdxForBones=o,this.localPositionOverride=a,this.localNormalOverride=n,this.matrixIndicesOverride=h,this.matrixWeightsOverride=l}clone(){return new ee(this.position.clone(),this.normal.clone(),this.uv.clone(),this.vertexIdx,this.vertexIdxForBones,this.localPositionOverride?.slice(),this.localNormalOverride?.slice(),this.matrixIndicesOverride?.slice(),this.matrixWeightsOverride?.slice())}}class et{constructor(e=0,t=0){this.x=e,this.y=t,e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("x is not an integer, floor(x) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("y is not an integer, floor(y) used"))}clone(){return new et(this.x,this.y)}rotate60About(e){let t=this.x;return this.x=e.x+e.y-this.y,this.y=t+this.y-e.x,this}rotateNeg60About(e){let t=this.x;return this.x=t+this.y-e.y,this.y=e.x+e.y-t,this}rotate120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m not an integer only floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n not an integer only floor(n) used"));let s=this.x;return this.x=e-s-this.y,this.y=t+s,this}rotateNeg120(e,t){e!==Math.floor(e)&&(e=Math.floor(e),p.Logger.Warn("m is not an integer, floor(m) used")),t!==Math.floor(t)&&(t=Math.floor(t),p.Logger.Warn("n is not an integer, floor(n) used"));let s=this.x;return this.x=this.y-t,this.y=e+t-s-this.y,this}toCartesianOrigin(e,t){let s=r.Vector3.Zero();return s.x=e.x+2*this.x*t+this.y*t,s.y=e.y+Math.sqrt(3)*this.y*t,s}static Zero(){return new et(0,0)}}class es{constructor(){this.cartesian=[],this.vertices=[],this.max=[],this.min=[],this.closestTo=[],this.innerFacets=[],this.isoVecsABOB=[],this.isoVecsOBOA=[],this.isoVecsBAOA=[],this.vertexTypes=[],this.IDATA=new er("icosahedron","Regular",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[[0,2,1],[0,3,2],[0,4,3],[0,5,4],[0,1,5],[7,6,1],[8,7,2],[9,8,3],[10,9,4],[6,10,5],[2,7,1],[3,8,2],[4,9,3],[5,10,4],[1,6,5],[11,6,7],[11,7,8],[11,8,9],[11,9,10],[11,10,6]])}setIndices(){let e,t,s,r,i,o,a,n,h=12,l={},u=this.m,c=this.n,d=u;0!==c&&(d=(0,K.HighestCommonFactor)(u,c));let f=u/d,p=c/d,x=et.Zero(),g=new et(u,c),_=new et(-c,u+c),m=et.Zero(),M=et.Zero(),y=et.Zero(),V=[],O=[],A=this.vertByDist,v=(e,t,s,r)=>{o=e+"|"+s,a=t+"|"+r,o in l||a in l?o in l&&!(a in l)?l[a]=l[o]:a in l&&!(o in l)&&(l[o]=l[a]):(l[o]=h,l[a]=h,h++),A[s][0]>2?O[l[o]]=[-A[s][0],A[s][1],l[o]]:O[l[o]]=[V[A[s][0]],A[s][1],l[o]]};this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(let a=0;a<20;a++){if(s=(V=this.IDATA.face[a])[2],r=V[1],i=V[0],(o=a+"|"+(n=x.x+"|"+x.y))in l||(l[o]=s,O[s]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=g.x+"|"+g.y))in l||(l[o]=r,O[r]=[V[A[n][0]],A[n][1]]),(o=a+"|"+(n=_.x+"|"+_.y))in l||(l[o]=i,O[i]=[V[A[n][0]],A[n][1]]),e=this.IDATA.edgematch[a][0],"B"===(t=this.IDATA.edgematch[a][1]))for(let t=1;t<d;t++)M.x=u-t*(f+p),M.y=c+t*f,y.x=-t*p,y.y=t*(f+p),v(a,e,n=M.x+"|"+M.y,y.x+"|"+y.y);if("O"===t)for(let t=1;t<d;t++)y.x=-t*p,y.y=t*(f+p),m.x=t*f,m.y=t*p,v(a,e,n=y.x+"|"+y.y,m.x+"|"+m.y);if(e=this.IDATA.edgematch[a][2],(t=this.IDATA.edgematch[a][3])&&"A"===t)for(let t=1;t<d;t++)m.x=t*f,m.y=t*p,M.x=u-(d-t)*(f+p),M.y=c+(d-t)*f,v(a,e,n=m.x+"|"+m.y,M.x+"|"+M.y);for(let e=0;e<this.vertices.length;e++)(o=a+"|"+(n=this.vertices[e].x+"|"+this.vertices[e].y))in l||(l[o]=h++,A[n][0]>2?O[l[o]]=[-A[n][0],A[n][1],l[o]]:O[l[o]]=[V[A[n][0]],A[n][1],l[o]])}this.closestTo=O,this.vecToidx=l}calcCoeffs(){let e=this.m,t=this.n,s=Math.sqrt(3)/3,r=e*e+t*t+e*t;this.coau=(e+t)/r,this.cobu=-t/r,this.coav=-s*(e-t)/r,this.cobv=s*(2*e+t)/r}createInnerFacets(){let e=this.m,t=this.n;for(let s=0;s<t+e+1;s++)for(let e=this.min[s];e<this.max[s]+1;e++)e<this.max[s]&&e<this.max[s+1]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+e+"|"+(s+1),"|"+(e+1)+"|"+s]),s>0&&e<this.max[s-1]&&e+1<this.max[s]+1&&this.innerFacets.push(["|"+e+"|"+s,"|"+(e+1)+"|"+s,"|"+(e+1)+"|"+(s-1)])}edgeVecsABOB(){let e=this.m,t=this.n,s=new et(-t,e+t);for(let r=1;r<e+t;r++){let e=new et(this.min[r],r),t=new et(this.min[r-1],r-1),i=new et(this.min[r+1],r+1),o=e.clone(),a=t.clone(),n=i.clone();o.rotate60About(s),a.rotate60About(s),n.rotate60About(s);let h=new et(this.max[o.y],o.y),l=new et(this.max[o.y-1],o.y-1),u=new et(this.max[o.y-1]-1,o.y-1);(o.x!==h.x||o.y!==h.y)&&(o.x!==l.x?(this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,u]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,u,h])):o.y===n.y?(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,1]),this.isoVecsABOB.push([e,l,i])):(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([e,t,l]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([e,l,h])))}}mapABOBtoOBOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,0===this.vertexTypes[t][r]&&e.rotateNeg120(this.m,this.n),s.push(e.clone());this.isoVecsOBOA.push(s)}}mapABOBtoBAOA(){let e=new et(0,0);for(let t=0;t<this.isoVecsABOB.length;t++){let s=[];for(let r=0;r<3;r++)e.x=this.isoVecsABOB[t][r].x,e.y=this.isoVecsABOB[t][r].y,1===this.vertexTypes[t][r]&&e.rotate120(this.m,this.n),s.push(e.clone());this.isoVecsBAOA.push(s)}}MapToFace(e,t){let s,i,o=this.IDATA.face[e],a=o[2],n=o[1],h=o[0],l=r.Vector3.FromArray(this.IDATA.vertex[a]),u=r.Vector3.FromArray(this.IDATA.vertex[n]),c=r.Vector3.FromArray(this.IDATA.vertex[h]),d=u.subtract(l),f=c.subtract(l),p=d.scale(this.coau).add(f.scale(this.cobu)),x=d.scale(this.coav).add(f.scale(this.cobv)),g=[];for(let r=0;r<this.cartesian.length;r++)i=p.scale(this.cartesian[r].x).add(x.scale(this.cartesian[r].y)).add(l),g[r]=[i.x,i.y,i.z],s=e+"|"+this.vertices[r].x+"|"+this.vertices[r].y,t.vertex[this.vecToidx[s]]=[i.x,i.y,i.z]}build(e,t){let s,r,i=[],o=et.Zero(),a=new et(e,t),n=new et(-t,e+t);i.push(o,a,n);for(let s=t;s<e+1;s++)for(let t=0;t<e+1-s;t++)i.push(new et(t,s));if(t>0){let s=(0,K.HighestCommonFactor)(e,t),r=e/s,o=t/s;for(let a=1;a<s;a++)i.push(new et(a*r,a*o)),i.push(new et(-a*o,a*(r+o))),i.push(new et(e-a*(r+o),t+a*r));let a=e/t;for(let s=1;s<t;s++)for(let r=0;r<s*a;r++)i.push(new et(r,s)),i.push(new et(r,s).rotate120(e,t)),i.push(new et(r,s).rotateNeg120(e,t))}i.sort((e,t)=>e.x-t.x),i.sort((e,t)=>e.y-t.y);let h=Array(e+t+1),l=Array(e+t+1);for(let e=0;e<h.length;e++)h[e]=1/0,l[e]=-1/0;let u=i.length;for(let e=0;e<u;e++)r=i[e].x,h[s=i[e].y]=Math.min(r,h[s]),l[s]=Math.max(r,l[s]);let c=(s,r)=>{let i=s.clone();return("A"===r&&i.rotateNeg120(e,t),"B"===r&&i.rotate120(e,t),i.x<0)?i.y:i.x+i.y},d=[],f=[],p=[],x=[],g={},_=[],m=-1,M=-1;for(let e=0;e<u;e++)d[e]=i[e].toCartesianOrigin(new et(0,0),.5),f[e]=c(i[e],"O"),p[e]=c(i[e],"A"),x[e]=c(i[e],"B"),f[e]===p[e]&&p[e]===x[e]?(m=3,M=f[e]):f[e]===p[e]?(m=4,M=f[e]):p[e]===x[e]?(m=5,M=p[e]):x[e]===f[e]&&(m=6,M=f[e]),f[e]<p[e]&&f[e]<x[e]&&(m=2,M=f[e]),p[e]<f[e]&&p[e]<x[e]&&(m=1,M=p[e]),x[e]<p[e]&&x[e]<f[e]&&(m=0,M=x[e]),_.push([m,M,i[e].x,i[e].y]);_.sort((e,t)=>e[2]-t[2]),_.sort((e,t)=>e[3]-t[3]),_.sort((e,t)=>e[1]-t[1]),_.sort((e,t)=>e[0]-t[0]);for(let e=0;e<_.length;e++)g[_[e][2]+"|"+_[e][3]]=[_[e][0],_[e][1],e];return this.m=e,this.n=t,this.vertices=i,this.vertByDist=g,this.cartesian=d,this.min=h,this.max=l,this}}class er{constructor(e,t,s,r){this.name=e,this.category=t,this.vertex=s,this.face=r}}class ei extends er{innerToData(e,t){for(let s=0;s<t.innerFacets.length;s++)this.face.push(t.innerFacets[s].map(s=>t.vecToidx[e+s]))}mapABOBtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsABOB.length;r++){let i=[];for(let o=0;o<3;o++)0===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y):i.push(s+"|"+t.isoVecsABOB[r][o].x+"|"+t.isoVecsABOB[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapOBOAtoDATA(e,t){let s=t.IDATA.edgematch[e][0];for(let r=0;r<t.isoVecsOBOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y):i.push(s+"|"+t.isoVecsOBOA[r][o].x+"|"+t.isoVecsOBOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}mapBAOAtoDATA(e,t){let s=t.IDATA.edgematch[e][2];for(let r=0;r<t.isoVecsBAOA.length;r++){let i=[];for(let o=0;o<3;o++)1===t.vertexTypes[r][o]?i.push(e+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y):i.push(s+"|"+t.isoVecsBAOA[r][o].x+"|"+t.isoVecsBAOA[r][o].y);this.face.push([t.vecToidx[i[0]],t.vecToidx[i[1]],t.vecToidx[i[2]]])}}orderData(e){let t=[];for(let e=0;e<13;e++)t[e]=[];let s=e.closestTo;for(let e=0;e<s.length;e++)s[e][0]>-1?s[e][1]>0&&t[s[e][0]].push([e,s[e][1]]):t[12].push([e,s[e][0]]);let r=[];for(let e=0;e<12;e++)r[e]=e;let i=12;for(let e=0;e<12;e++){t[e].sort((e,t)=>e[1]-t[1]);for(let s=0;s<t[e].length;s++)r[t[e][s][0]]=i++}for(let e=0;e<t[12].length;e++)r[t[12][e][0]]=i++;for(let e=0;e<this.vertex.length;e++)this.vertex[e].push(r[e]);this.vertex.sort((e,t)=>e[3]-t[3]);for(let e=0;e<this.vertex.length;e++)this.vertex[e].pop();for(let e=0;e<this.face.length;e++)for(let t=0;t<this.face[e].length;t++)this.face[e][t]=r[this.face[e][t]];this.sharedNodes=t[12].length,this.poleNodes=this.vertex.length-this.sharedNodes}setOrder(e,t){let s=[],r=[],i=t.pop();r.push(i);let o=this.face[i].indexOf(e);o=(o+2)%3;let a=this.face[i][o];s.push(a);let n=0;for(;t.length>0;)i=t[n],this.face[i].indexOf(a)>-1?(o=(this.face[i].indexOf(a)+1)%3,a=this.face[i][o],s.push(a),r.push(i),t.splice(n,1),n=0):n++;return this.adjacentFaces.push(s),r}toGoldbergPolyhedronData(){let e,t,s,r,i,o=new er("GeoDual","Goldberg",[],[]);o.name="GD dual";let a=this.vertex.length,n=Array(a);for(let e=0;e<a;e++)n[e]=[];for(let e=0;e<this.face.length;e++)for(let t=0;t<3;t++)n[this.face[e][t]].push(e);this.adjacentFaces=[];for(let a=0;a<n.length;a++)for(let h of(o.face[a]=this.setOrder(a,n[a].concat([])),n[a])){e=0,t=0,s=0,r=this.face[h];for(let o=0;o<3;o++)e+=(i=this.vertex[r[o]])[0],t+=i[1],s+=i[2];o.vertex[h]=[e/3,t/3,s/3]}return o}static BuildGeodesicData(e){let t=new ei("Geodesic-m-n","Geodesic",[[0,S.PHI,-1],[-S.PHI,1,0],[-1,0,-S.PHI],[1,0,-S.PHI],[S.PHI,1,0],[0,S.PHI,1],[-1,0,S.PHI],[-S.PHI,-1,0],[0,-S.PHI,-1],[S.PHI,-1,0],[1,0,S.PHI],[0,-S.PHI,1]],[]);e.setIndices(),e.calcCoeffs(),e.createInnerFacets(),e.edgeVecsABOB(),e.mapABOBtoOBOA(),e.mapABOBtoBAOA();for(let s=0;s<e.IDATA.face.length;s++)e.MapToFace(s,t),t.innerToData(s,e),"B"===e.IDATA.edgematch[s][1]&&t.mapABOBtoDATA(s,e),"O"===e.IDATA.edgematch[s][1]&&t.mapOBOAtoDATA(s,e),"A"===e.IDATA.edgematch[s][3]&&t.mapBAOAtoDATA(s,e);return t.orderData(e),t.vertex=t.vertex.map(function(e){let t=e[0],s=e[1],r=e[2],i=Math.sqrt(t*t+s*s+r*r);return e[0]*=1/i,e[1]*=1/i,e[2]*=1/i,e}),t}}var eo=i;class ea extends eo.Mesh{constructor(){super(...arguments),this.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]}}relatedGoldbergFace(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(p.Logger.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(p.Logger.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(p.Logger.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)}_changeGoldbergFaceColors(e){for(let t=0;t<e.length;t++){let s=e[t][0],r=e[t][1],i=e[t][2];for(let e=s;e<r+1;e++)this.goldbergData.faceColors[e]=i}let t=[];for(let e=0;e<12;e++)for(let s=0;s<5;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);for(let e=12;e<this.goldbergData.faceColors.length;e++)for(let s=0;s<6;s++)t.push(this.goldbergData.faceColors[e].r,this.goldbergData.faceColors[e].g,this.goldbergData.faceColors[e].b,this.goldbergData.faceColors[e].a);return t}setGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.setVerticesData(o.VertexBuffer.ColorKind,t)}updateGoldbergFaceColors(e){let t=this._changeGoldbergFaceColors(e);this.updateVerticesData(o.VertexBuffer.ColorKind,t)}_changeGoldbergFaceUVs(e){let t=this.getVerticesData(o.VertexBuffer.UVKind);for(let s=0;s<e.length;s++){let r,i,o=e[s][0],a=e[s][1],n=e[s][2],h=e[s][3],l=e[s][4],u=[],c=[];for(let e=0;e<5;e++)r=n.x+h*Math.cos(l+e*Math.PI/2.5),i=n.y+h*Math.sin(l+e*Math.PI/2.5),r<0&&(r=0),r>1&&(r=1),u.push(r,i);for(let e=0;e<6;e++)r=n.x+h*Math.cos(l+e*Math.PI/3),i=n.y+h*Math.sin(l+e*Math.PI/3),r<0&&(r=0),r>1&&(r=1),c.push(r,i);for(let e=o;e<Math.min(12,a+1);e++)for(let s=0;s<5;s++)t[10*e+2*s]=u[2*s],t[10*e+2*s+1]=u[2*s+1];for(let e=Math.max(12,o);e<a+1;e++)for(let s=0;s<6;s++)t[12*e-24+2*s]=c[2*s],t[12*e-23+2*s]=c[2*s+1]}return t}setGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.setVerticesData(o.VertexBuffer.UVKind,t)}updateGoldbergFaceUVs(e){let t=this._changeGoldbergFaceUVs(e);this.updateVerticesData(o.VertexBuffer.UVKind,t)}placeOnGoldbergFaceAt(e,t,s){e.rotation=r.Vector3.RotationFromAxis(this.goldbergData.faceXaxis[t],this.goldbergData.faceYaxis[t],this.goldbergData.faceZaxis[t]),e.position=this.goldbergData.faceCenters[t].add(this.goldbergData.faceXaxis[t].scale(s.x)).add(this.goldbergData.faceYaxis[t].scale(s.y)).add(this.goldbergData.faceZaxis[t].scale(s.z))}serialize(e){super.serialize(e),e.type="GoldbergMesh";let t={};if(t.adjacentFaces=this.goldbergData.adjacentFaces,t.nbSharedFaces=this.goldbergData.nbSharedFaces,t.nbUnsharedFaces=this.goldbergData.nbUnsharedFaces,t.nbFaces=this.goldbergData.nbFaces,t.nbFacesAtPole=this.goldbergData.nbFacesAtPole,this.goldbergData.faceColors)for(let e of(t.faceColors=[],this.goldbergData.faceColors))t.faceColors.push(e.asArray());if(this.goldbergData.faceCenters)for(let e of(t.faceCenters=[],this.goldbergData.faceCenters))t.faceCenters.push(e.asArray());if(this.goldbergData.faceZaxis)for(let e of(t.faceZaxis=[],this.goldbergData.faceZaxis))t.faceZaxis.push(e.asArray());if(this.goldbergData.faceYaxis)for(let e of(t.faceYaxis=[],this.goldbergData.faceYaxis))t.faceYaxis.push(e.asArray());if(this.goldbergData.faceXaxis)for(let e of(t.faceXaxis=[],this.goldbergData.faceXaxis))t.faceXaxis.push(e.asArray());e.goldbergData=t}static Parse(e,t){let s=e.goldbergData;s.faceColors=s.faceColors.map(e=>l.Color4.FromArray(e)),s.faceCenters=s.faceCenters.map(e=>r.Vector3.FromArray(e)),s.faceZaxis=s.faceZaxis.map(e=>r.Vector3.FromArray(e)),s.faceXaxis=s.faceXaxis.map(e=>r.Vector3.FromArray(e)),s.faceYaxis=s.faceYaxis.map(e=>r.Vector3.FromArray(e));let i=new ea(e.name,t);return i.goldbergData=s,i}}class en{constructor(e){this._paths=[],this._tempPaths=[],this._holes=[],this._resolution=e}moveTo(e,t){this._currentPath=new C.Path2(e,t),this._tempPaths.push(this._currentPath)}lineTo(e,t){this._currentPath.addLineTo(e,t)}quadraticCurveTo(e,t,s,r){this._currentPath.addQuadraticCurveTo(e,t,s,r,this._resolution)}bezierCurveTo(e,t,s,r,i,o){this._currentPath.addBezierCurveTo(e,t,s,r,i,o,this._resolution)}extractHoles(){for(let e of this._tempPaths)e.area()>0?this._holes.push(e):this._paths.push(e);if(!this._paths.length&&this._holes.length){let e=this._holes;this._holes=this._paths,this._paths=e}this._tempPaths.length=0}get paths(){return this._paths}get holes(){return this._holes}}e.s(["MeshBuilder",0,{CreateBox:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],s=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],i=[],o=e.width||e.size||1,h=e.height||e.size||1,u=e.depth||e.size||1,c=e.wrap||!1,d=void 0===e.topBaseAt?1:e.topBaseAt,f=void 0===e.bottomBaseAt?0:e.bottomBaseAt;d=(d+4)%4,f=(f+4)%4;let p=[2,0,3,1][d],x=[2,0,1,3][f],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(c){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];let e=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],s=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],r=[17,18,19,16],i=[22,23,20,21];for(;p>0;)e.unshift(e.pop()),r.unshift(r.pop()),p--;for(;x>0;)s.unshift(s.pop()),i.unshift(i.pop()),x--;e=e.flat(),s=s.flat(),g=g.concat(e).concat(s),t.push(r[0],r[2],r[3],r[0],r[1],r[2]),t.push(i[0],i[2],i[3],i[0],i[1],i[2])}let _=[o/2,h/2,u/2],m=g.reduce((e,t,s)=>e.concat(t*_[s%3]),[]),M=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,y=e.faceUV||Array(6),V=e.faceColors,O=[];for(let e=0;e<6;e++)void 0===y[e]&&(y[e]=new r.Vector4(0,0,1,1)),V&&void 0===V[e]&&(V[e]=new l.Color4(1,1,1,1));for(let e=0;e<6;e++)if(i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].w:y[e].w),i.push(y[e].x,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),i.push(y[e].z,n.useOpenGLOrientationForUV?1-y[e].y:y[e].y),V)for(let t=0;t<4;t++)O.push(V[e].r,V[e].g,V[e].b,V[e].a);a.VertexData._ComputeSides(M,m,t,s,i,e.frontUVs,e.backUVs);let A=new a.VertexData;return A.indices=t,A.positions=m,A.normals=s,A.uvs=i,V&&(A.colors=M===a.VertexData.DOUBLESIDE?O.concat(O):O),A})(t).applyToMesh(o,t.updatable),o},CreateTiledBox:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,c(t).applyToMesh(r,t.updatable),r},CreateSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=0|(e.segments||32),s=e.diameterX||e.diameter||1,i=e.diameterY||e.diameter||1,o=e.diameterZ||e.diameter||1,h=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=e.slice&&e.slice<=0?1:e.slice||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,d=new r.Vector3(s/2,i/2,o/2),f=2+t,p=2*f,x=[],g=[],_=[],m=[];for(let e=0;e<=f;e++){let t=e/f,s=t*Math.PI*l;for(let e=0;e<=p;e++){let i=e/p,o=i*Math.PI*2*h,a=r.Matrix.RotationZ(-s),l=r.Matrix.RotationY(o),u=r.Vector3.TransformCoordinates(r.Vector3.Up(),a),c=r.Vector3.TransformCoordinates(u,l),f=c.multiply(d),x=c.divide(d).normalize();g.push(f.x,f.y,f.z),_.push(x.x,x.y,x.z),m.push(i,n.useOpenGLOrientationForUV?1-t:t)}if(e>0){let t=g.length/3;for(let s=t-2*(p+1);s+p+2<t;s++)c?(e>1&&(x.push(s),x.push(s+1),x.push(s+p+1)),(e<f||l<1)&&(x.push(s+p+1),x.push(s+1),x.push(s+p+2))):(x.push(s),x.push(s+1),x.push(s+p+1),x.push(s+p+1),x.push(s+1),x.push(s+p+2))}}a.VertexData._ComputeSides(u,g,x,_,m,e.frontUVs,e.backUVs);let M=new a.VertexData;return M.indices=x,M.positions=g,M.normals=_,M.uvs=m,M})(t).applyToMesh(o,t.updatable),o},CreateDisc:function(e,t={},s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],r=[],i=[],o=e.radius||.5,h=e.tessellation||64,l=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,u=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE;t.push(0,0,0),i.push(.5,.5);let c=2*Math.PI*l,d=1===l?c/h:c/(h-1),f=0;for(let e=0;e<h;e++){let e=Math.cos(f),s=Math.sin(f),r=(e+1)/2,a=(1-s)/2;t.push(o*e,o*s,0),i.push(r,n.useOpenGLOrientationForUV?1-a:a),f+=d}1===l&&(t.push(t[3],t[4],t[5]),i.push(i[2],n.useOpenGLOrientationForUV?1-i[3]:i[3]));let p=t.length/3;for(let e=1;e<p-1;e++)s.push(e+1,0,e);a.VertexData.ComputeNormals(t,s,r),a.VertexData._ComputeSides(u,t,s,r,i,e.frontUVs,e.backUVs);let x=new a.VertexData;return x.indices=s,x.positions=t,x.normals=r,x.uvs=i,x})(t).applyToMesh(r,t.updatable),r},CreateIcoSphere:function(e,t={},s=null){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s=e.sideOrientation||a.VertexData.DEFAULTSIDE,i=e.radius||1,o=void 0===e.flat||e.flat,h=0|(e.subdivisions||4),l=e.radiusX||i,u=e.radiusY||i,c=e.radiusZ||i,d=(1+Math.sqrt(5))/2,f=[-1,d,-0,1,d,0,-1,-d,0,1,-d,0,0,-1,-d,0,1,-d,0,-1,d,0,1,d,d,0,1,d,0,-1,-d,0,1,-d,0,-1],p=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],x=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],g=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],_=138/1024,m=239/1024,M=60/1024,y=26/1024,V=-40/1024,O=20/1024,A=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],v=[],T=[],b=[],I=[],D=0,w=[,,,],P=[,,,];for(t=0;t<3;t++)w[t]=r.Vector3.Zero(),P[t]=r.Vector2.Zero();for(let e=0;e<20;e++){for(t=0;t<3;t++){let s=p[3*e+t];w[t].copyFromFloats(f[3*x[s]],f[3*x[s]+1],f[3*x[s]+2]),w[t].normalize(),P[t].copyFromFloats(g[2*s]*_+M+A[e]*V,g[2*s+1]*m+y+A[e]*O)}let s=(e,t,s,i)=>{let a,d=r.Vector3.Lerp(w[0],w[2],t/h),f=r.Vector3.Lerp(w[1],w[2],t/h),p=h===t?w[2]:r.Vector3.Lerp(d,f,e/(h-t));if(p.normalize(),o){let e=r.Vector3.Lerp(w[0],w[2],i/h),t=r.Vector3.Lerp(w[1],w[2],i/h);a=r.Vector3.Lerp(e,t,s/(h-i))}else a=new r.Vector3(p.x,p.y,p.z);a.x/=l,a.y/=u,a.z/=c,a.normalize();let x=r.Vector2.Lerp(P[0],P[2],t/h),g=r.Vector2.Lerp(P[1],P[2],t/h),_=h===t?P[2]:r.Vector2.Lerp(x,g,e/(h-t));T.push(p.x*l,p.y*u,p.z*c),b.push(a.x,a.y,a.z),I.push(_.x,n.useOpenGLOrientationForUV?1-_.y:_.y),v.push(D),D++};for(let e=0;e<h;e++)for(let t=0;t+e<h;t++)s(t,e,t+1/3,e+1/3),s(t+1,e,t+1/3,e+1/3),s(t,e+1,t+1/3,e+1/3),t+e+1<h&&(s(t+1,e,t+2/3,e+2/3),s(t+1,e+1,t+2/3,e+2/3),s(t,e+1,t+2/3,e+2/3))}a.VertexData._ComputeSides(s,T,v,b,I,e.frontUVs,e.backUVs);let F=new a.VertexData;return F.indices=v,F.positions=T,F.normals=b,F.uvs=I,F})(t).applyToMesh(o,t.updatable),o},CreateRibbon:h,CreateCylinder:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,o,h,u,c,f,p,x,g=e.height||2,_=0===e.diameterTop?0:e.diameterTop||e.diameter||1,m=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;_=_||1e-5,m=m||1e-5;let M=0|(e.tessellation||24),y=0|(e.subdivisions||1),V=!!e.hasRings,O=!!e.enclose,A=0===e.cap?0:e.cap||i.Mesh.CAP_ALL,v=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,T=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,b=e.faceUV||[,,,],I=e.faceColors,D=2+(1+(1!==v&&O?2:0))*(V?y:1);for(t=0;t<D;t++)I&&void 0===I[t]&&(I[t]=new l.Color4(1,1,1,1));for(t=0;t<D;t++)b&&void 0===b[t]&&(b[t]=new r.Vector4(0,0,1,1));let w=[],P=[],F=[],B=[],L=[],E=2*Math.PI*v/M,C=(m-_)/2/g,S=r.Vector3.Zero(),z=r.Vector3.Zero(),R=r.Vector3.Zero(),U=r.Vector3.Zero(),N=r.Vector3.Zero(),W=d.Axis.Y,G=1,k=0;for(u=0;u<=y;u++)for(f=0,h=((o=u/y)*(_-m)+m)/2,p=V&&0!==u&&u!==y?2:1;f<p;f++){for(V&&(G+=f),O&&(G+=2*f),c=0;c<=M;c++)S.x=Math.cos(-(s=c*E))*h,S.y=-g/2+o*g,S.z=Math.sin(-s)*h,0===_&&u===y?(z.x=F[F.length-(M+1)*3],z.y=F[F.length-(M+1)*3+1],z.z=F[F.length-(M+1)*3+2]):(z.x=S.x,z.z=S.z,z.y=Math.sqrt(z.x*z.x+z.z*z.z)*C,z.normalize()),0===c&&(R.copyFrom(S),U.copyFrom(z)),P.push(S.x,S.y,S.z),F.push(z.x,z.y,z.z),x=V?k!==G?b[G].y:b[G].w:b[G].y+(b[G].w-b[G].y)*o,B.push(b[G].x+(b[G].z-b[G].x)*c/M,n.useOpenGLOrientationForUV?1-x:x),I&&L.push(I[G].r,I[G].g,I[G].b,I[G].a);1!==v&&O&&(P.push(S.x,S.y,S.z),P.push(0,S.y,0),P.push(0,S.y,0),P.push(R.x,R.y,R.z),r.Vector3.CrossToRef(W,z,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),r.Vector3.CrossToRef(U,W,N),N.normalize(),F.push(N.x,N.y,N.z,N.x,N.y,N.z),x=V?k!==G?b[G+1].y:b[G+1].w:b[G+1].y+(b[G+1].w-b[G+1].y)*o,B.push(b[G+1].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+1].z,n.useOpenGLOrientationForUV?1-x:x),x=V?k!==G?b[G+2].y:b[G+2].w:b[G+2].y+(b[G+2].w-b[G+2].y)*o,B.push(b[G+2].x,n.useOpenGLOrientationForUV?1-x:x),B.push(b[G+2].z,n.useOpenGLOrientationForUV?1-x:x),I&&(L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+1].r,I[G+1].g,I[G+1].b,I[G+1].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a),L.push(I[G+2].r,I[G+2].g,I[G+2].b,I[G+2].a))),k!==G&&(k=G)}let H=1!==v&&O?M+4:M;for(G=0,u=0;G<y;G++){let e=0,t=0,s=0,r=0;for(c=0;c<M;c++)e=u*(H+1)+c,t=(u+1)*(H+1)+c,s=u*(H+1)+(c+1),r=(u+1)*(H+1)+(c+1),w.push(e,t,s),w.push(r,s,t);1!==v&&O&&(w.push(e+2,t+2,s+2),w.push(r+2,s+2,t+2),w.push(e+4,t+4,s+4),w.push(r+4,s+4,t+4)),u=V?u+2:u+1}let X=e=>{let t,s,i,o=e?_/2:m/2;if(0===o)return;let a=e?b[D-1]:b[0],h=null;I&&(h=e?I[D-1]:I[0]);let l=P.length/3,u=e?g/2:-g/2,c=new r.Vector3(0,u,0);P.push(c.x,c.y,c.z),F.push(0,e?1:-1,0);let d=a.y+(a.w-a.y)*.5;B.push(a.x+(a.z-a.x)*.5,n.useOpenGLOrientationForUV?1-d:d),h&&L.push(h.r,h.g,h.b,h.a);let f=new r.Vector2(.5,.5);for(i=0;i<=M;i++){let l=Math.cos(-(t=2*Math.PI*i*v/M)),c=Math.sin(-t);s=new r.Vector3(l*o,u,c*o);let d=new r.Vector2(l*f.x+.5,c*f.y+.5);P.push(s.x,s.y,s.z),F.push(0,e?1:-1,0);let p=a.y+(a.w-a.y)*d.y;B.push(a.x+(a.z-a.x)*d.x,n.useOpenGLOrientationForUV?1-p:p),h&&L.push(h.r,h.g,h.b,h.a)}for(i=0;i<M;i++)e?(w.push(l),w.push(l+(i+2)),w.push(l+(i+1))):(w.push(l),w.push(l+(i+1)),w.push(l+(i+2)))};(A===i.Mesh.CAP_START||A===i.Mesh.CAP_ALL)&&X(!1),(A===i.Mesh.CAP_END||A===i.Mesh.CAP_ALL)&&X(!0),a.VertexData._ComputeSides(T,P,w,F,B,e.frontUVs,e.backUVs);let Z=new a.VertexData;return Z.indices=w,Z.positions=P,Z.normals=F,Z.uvs=B,I&&(Z.colors=L),Z})(t).applyToMesh(o,t.updatable),o},CreateTorus:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t=[],s=[],i=[],o=[],h=e.diameter||1,l=e.thickness||.5,u=0|(e.tessellation||16),c=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,d=u+1;for(let e=0;e<=u;e++){let a=e/u,c=e*Math.PI*2/u-Math.PI/2,f=r.Matrix.Translation(h/2,0,0).multiply(r.Matrix.RotationY(c));for(let h=0;h<=u;h++){let c=1-h/u,p=h*Math.PI*2/u+Math.PI,x=Math.cos(p),g=Math.sin(p),_=new r.Vector3(x,g,0),m=_.scale(l/2),M=new r.Vector2(a,c);m=r.Vector3.TransformCoordinates(m,f),_=r.Vector3.TransformNormal(_,f),s.push(m.x,m.y,m.z),i.push(_.x,_.y,_.z),o.push(M.x,n.useOpenGLOrientationForUV?1-M.y:M.y);let y=(e+1)%d,V=(h+1)%d;t.push(e*d+h),t.push(e*d+V),t.push(y*d+h),t.push(e*d+V),t.push(y*d+V),t.push(y*d+h)}}a.VertexData._ComputeSides(c,s,t,i,o,e.frontUVs,e.backUVs);let f=new a.VertexData;return f.indices=t,f.positions=s,f.normals=i,f.uvs=o,f})(t).applyToMesh(o,t.updatable),o},CreateTorusKnot:function(e,t={},s){let o=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.radius||2,c=e.tube||.5,d=e.radialSegments||32,f=e.tubularSegments||32,p=e.p||2,x=e.q||3,g=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,_=e=>{let t=Math.cos(e),s=Math.sin(e),i=x/p*e,o=Math.cos(i),a=u*Math.sin(i)*.5;return new r.Vector3(u*(2+o)*.5*t,u*(2+o)*s*.5,a)};for(t=0;t<=d;t++){let e=t%d/d*2*p*Math.PI,i=_(e),a=_(e+.01),h=a.subtract(i),u=a.add(i),x=r.Vector3.Cross(h,u);for(u=r.Vector3.Cross(x,h),x.normalize(),u.normalize(),s=0;s<f;s++){let e=s%f/f*2*Math.PI,r=-c*Math.cos(e),a=c*Math.sin(e);o.push(i.x+r*u.x+a*x.x),o.push(i.y+r*u.y+a*x.y),o.push(i.z+r*u.z+a*x.z),l.push(t/d),l.push(n.useOpenGLOrientationForUV?1-s/f:s/f)}}for(t=0;t<d;t++)for(s=0;s<f;s++){let e=(s+1)%f,r=t*f+s,o=(t+1)*f+s,a=(t+1)*f+e,n=t*f+e;i.push(n),i.push(o),i.push(r),i.push(n),i.push(a),i.push(o)}a.VertexData.ComputeNormals(o,i,h),a.VertexData._ComputeSides(g,o,i,h,l,e.frontUVs,e.backUVs);let m=new a.VertexData;return m.indices=i,m.positions=o,m.normals=h,m.uvs=l,m})(t).applyToMesh(o,t.updatable),o},CreateLineSystem:L,CreateLines:function(e,t,s=null){let r=t.colors?[t.colors]:null;return L(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:r,useVertexAlpha:t.useVertexAlpha,material:t.material},s)},CreateDashedLines:function(e,t,s=null){let o=t.points,n=t.instance,h=t.gapSize||1,l=t.dashSize||3;if(n)return(t.dashNb||t.dashSize||t.gapSize||t.useVertexAlpha||t.material)&&p.Logger.Warn("You have used an option other than points with the instance option. Please be aware that these other options will be ignored."),n.updateMeshPositions(e=>{let t,s,i,a,h=r.Vector3.Zero(),l=e.length/6,u=0,c=0;for(i=0;i<o.length-1;i++)o[i+1].subtractToRef(o[i],h),u+=h.length();let d=u/l,f=n._creationDataStorage.dashSize,p=f*d/(f+n._creationDataStorage.gapSize);for(i=0;i<o.length-1;i++)for(o[i+1].subtractToRef(o[i],h),t=Math.floor(h.length()/d),h.normalize(),a=0;a<t&&c<e.length;)s=d*a,e[c]=o[i].x+s*h.x,e[c+1]=o[i].y+s*h.y,e[c+2]=o[i].z+s*h.z,e[c+3]=o[i].x+(s+p)*h.x,e[c+4]=o[i].y+(s+p)*h.y,e[c+5]=o[i].z+(s+p)*h.z,c+=6,a++;for(;c<e.length;)e[c]=o[i].x,e[c+1]=o[i].y,e[c+2]=o[i].z,c+=3},!1),n;let u=new F(e,s,null,void 0,void 0,void 0,t.useVertexAlpha,t.material);return(function(e){let t,s,i,o=e.dashSize||3,n=e.gapSize||1,h=e.dashNb||200,l=e.points,u=[],c=[],d=r.Vector3.Zero(),f=0,p=0;for(i=0;i<l.length-1;i++)l[i+1].subtractToRef(l[i],d),f+=d.length();let x=f/h,g=o*x/(o+n);for(i=0;i<l.length-1;i++){l[i+1].subtractToRef(l[i],d),t=Math.floor(d.length()/x),d.normalize();for(let e=0;e<t;e++)s=x*e,u.push(l[i].x+s*d.x,l[i].y+s*d.y,l[i].z+s*d.z),u.push(l[i].x+(s+g)*d.x,l[i].y+(s+g)*d.y,l[i].z+(s+g)*d.z),c.push(p,p+1),p+=2}let _=new a.VertexData;return _.positions=u,_.indices=c,_})(t).applyToMesh(u,t.updatable),u._creationDataStorage=new i._CreationDataStorage,u._creationDataStorage.dashSize=l,u._creationDataStorage.gapSize=h,u},ExtrudeShape:function(e,t,s=null){let r=t.path,o=t.shape,a=t.scale||1,n=t.rotation||0,h=0===t.cap?0:t.cap||i.Mesh.NO_CAP,l=t.updatable,u=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),c=t.instance||null,d=t.invertUV||!1,f=t.closeShape||!1,p=t.closePath||!1,x=t.capFunction||null;return G(e,o,r,a,n,null,null,p,f,h,!1,s,!!l,u,c,d,t.frontUVs||null,t.backUVs||null,t.firstNormal||null,!!t.adjustFrame,x)},ExtrudeShapeCustom:function(e,t,s=null){let o=t.path,a=t.shape,n=r.Vector3.Zero(),h=t.rotationFunction||(()=>0),l=t.closePath||t.ribbonCloseArray||!1,u=t.closeShape||t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||i.Mesh.NO_CAP,d=t.updatable,f=t.firstNormal||null,p=t.adjustFrame||!1,x=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g=t.instance,_=t.invertUV||!1,m=t.capFunction||null;return G(e,a,o,null,null,t.scaleVectorFunction??((e,s)=>{let r=t.scaleFunction?.(e,s)??1;return n.copyFromFloats(r,r,r)}),h,l,u,c,!0,s,!!d,x,g||null,_,t.frontUVs||null,t.backUVs||null,f,p,m||null)},CreateLathe:function(e,t,s=null){let o,a,n,l,u=t.arc?t.arc<=0||t.arc>1?1:t.arc:1,c=void 0===t.closed||t.closed,d=t.shape,f=t.radius||1,p=t.tessellation||64,x=t.clip||0,g=t.updatable,_=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m=t.cap||i.Mesh.NO_CAP,M=2*Math.PI,y=[],V=t.invertUV||!1,O=M/p*u;for(o=0;o<=p-x;o++){for(l=[],(m==i.Mesh.CAP_START||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(0,d[0].y,0)),l.push(new r.Vector3(Math.cos(o*O)*d[0].x*f,d[0].y,Math.sin(o*O)*d[0].x*f))),a=0;a<d.length;a++)n=new r.Vector3(Math.cos(o*O)*d[a].x*f,d[a].y,Math.sin(o*O)*d[a].x*f),l.push(n);(m==i.Mesh.CAP_END||m==i.Mesh.CAP_ALL)&&(l.push(new r.Vector3(Math.cos(o*O)*d[d.length-1].x*f,d[d.length-1].y,Math.sin(o*O)*d[d.length-1].x*f)),l.push(new r.Vector3(0,d[d.length-1].y,0))),y.push(l)}return h(e,{pathArray:y,closeArray:c,sideOrientation:_,updatable:g,invertUV:V,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateTiledPlane:function(e,t,s=null){let r=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,u(t).applyToMesh(r,t.updatable),r},CreatePlane:function(e,t={},s=null){let r,o,h,l,u,c,d,f,p,x,g=new i.Mesh(e,s);return t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),g._originalBuilderSideOrientation=t.sideOrientation,(r=[],o=[],h=[],l=[],u=void 0!==t.width?t.width:void 0!==t.size?t.size:1,c=void 0!==t.height?t.height:void 0!==t.size?t.size:1,d=0===t.sideOrientation?0:t.sideOrientation||a.VertexData.DEFAULTSIDE,f=u/2,p=c/2,o.push(-f,-p,0),h.push(0,0,-1),l.push(0,+!!n.useOpenGLOrientationForUV),o.push(f,-p,0),h.push(0,0,-1),l.push(1,+!!n.useOpenGLOrientationForUV),o.push(f,p,0),h.push(0,0,-1),l.push(1,+!n.useOpenGLOrientationForUV),o.push(-f,p,0),h.push(0,0,-1),l.push(0,+!n.useOpenGLOrientationForUV),r.push(0),r.push(1),r.push(2),r.push(0),r.push(2),r.push(3),a.VertexData._ComputeSides(d,o,r,h,l,t.frontUVs,t.backUVs),(x=new a.VertexData).indices=r,x.positions=o,x.normals=h,x.uvs=l,x).applyToMesh(g,t.updatable),t.sourcePlane&&(g.translate(t.sourcePlane.normal,-t.sourcePlane.d),g.setDirection(t.sourcePlane.normal.scale(-1))),g},CreateGround:function(e,t={},s){let i=new H(e,s);return i._setReady(!1),i._subdivisionsX=t.subdivisionsX||t.subdivisions||1,i._subdivisionsY=t.subdivisionsY||t.subdivisions||1,i._width=t.width||1,i._height=t.height||1,i._maxX=i._width/2,i._maxZ=i._height/2,i._minX=-i._maxX,i._minZ=-i._maxZ,(function(e){let t,s,i=[],o=[],h=[],l=[],u=e.width||e.size||1,c=e.height||e.size||1,d=0|(e.subdivisionsX||e.subdivisions||1),f=0|(e.subdivisionsY||e.subdivisions||1);for(t=0;t<=f;t++)for(s=0;s<=d;s++){let e=new r.Vector3(s*u/d-u/2,0,(f-t)*c/f-c/2),i=new r.Vector3(0,1,0);o.push(e.x,e.y,e.z),h.push(i.x,i.y,i.z),l.push(s/d,n.useOpenGLOrientationForUV?t/f:1-t/f)}for(t=0;t<f;t++)for(s=0;s<d;s++)i.push(s+1+(t+1)*(d+1)),i.push(s+1+t*(d+1)),i.push(s+t*(d+1)),i.push(s+(t+1)*(d+1)),i.push(s+1+(t+1)*(d+1)),i.push(s+t*(d+1));let p=new a.VertexData;return p.indices=i,p.positions=o,p.normals=h,p.uvs=l,p})(t).applyToMesh(i,t.updatable),i._setReady(!0),i},CreateTiledGround:function(e,t,s=null){let o=new i.Mesh(e,s);return(function(e){let t,s,i,o,n=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,h=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,l=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,u=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,c=e.subdivisions||{w:1,h:1},d=e.precision||{w:1,h:1},f=[],p=[],x=[],g=[];c.h=c.h<1?1:c.h,c.w=c.w<1?1:c.w,d.w=d.w<1?1:d.w,d.h=d.h<1?1:d.h;let _={w:(l-n)/c.w,h:(u-h)/c.h};for(i=0;i<c.h;i++)for(o=0;o<c.w;o++)!function(e,i,o,a){let n=p.length/3,h=d.w+1;for(t=0;t<d.h;t++)for(s=0;s<d.w;s++){let e=[n+s+t*h,n+(s+1)+t*h,n+(s+1)+(t+1)*h,n+s+(t+1)*h];f.push(e[1]),f.push(e[2]),f.push(e[3]),f.push(e[0]),f.push(e[1]),f.push(e[3])}let l=r.Vector3.Zero(),u=new r.Vector3(0,1,0);for(t=0;t<=d.h;t++)for(s=0,l.z=t*(a-i)/d.h+i;s<=d.w;s++)l.x=s*(o-e)/d.w+e,l.y=0,p.push(l.x,l.y,l.z),x.push(u.x,u.y,u.z),g.push(s/d.w,t/d.h)}(n+o*_.w,h+i*_.h,n+(o+1)*_.w,h+(i+1)*_.h);let m=new a.VertexData;return m.indices=f,m.positions=p,m.normals=x,m.uvs=g,m})(t).applyToMesh(o,t.updatable),o},CreateGroundFromHeightMap:function(e,t,s={},i=null){let o,n=s.width||10,h=s.height||10,u=s.subdivisions||1,c=s.minHeight||0,d=s.maxHeight||1,f=s.colorFilter||new l.Color3(.3,.59,.11),p=s.alphaFilter||0,x=s.updatable,g=s.onReady,_=new H(e,i=i||v.EngineStore.LastCreatedScene);_._subdivisionsX=u,_._subdivisionsY=u,_._width=n,_._height=h,_._maxX=_._width/2,_._maxZ=_._height/2,_._minX=-_._maxX,_._minZ=-_._maxZ,_._setReady(!1),s.passHeightBufferInCallback&&(o=new Float32Array((u+1)*(u+1)));let m=(e,t,s)=>{(function(e){let t,s,i=[],o=[],n=[],h=[],u=e.colorFilter||new l.Color3(.3,.59,.11),c=e.alphaFilter||0,d=!1;if(e.minHeight>e.maxHeight){d=!0;let t=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=t}for(t=0;t<=e.subdivisions;t++)for(s=0;s<=e.subdivisions;s++){let i=new r.Vector3(s*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),a=(((i.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(i.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth)*4,l=e.buffer[a]/255,f=e.buffer[a+1]/255,p=e.buffer[a+2]/255,x=e.buffer[a+3]/255;d&&(l=1-l,f=1-f,p=1-p);let g=l*u.r+f*u.g+p*u.b;x>=c?i.y=e.minHeight+(e.maxHeight-e.minHeight)*g:i.y=e.minHeight-S.Epsilon,e.heightBuffer&&(e.heightBuffer[t*(e.subdivisions+1)+s]=i.y),o.push(i.x,i.y,i.z),n.push(0,0,0),h.push(s/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(s=0;s<e.subdivisions;s++){let r=s+1+(t+1)*(e.subdivisions+1),a=s+1+t*(e.subdivisions+1),n=s+t*(e.subdivisions+1),h=s+(t+1)*(e.subdivisions+1),l=o[3*r+1]>=e.minHeight,u=o[3*a+1]>=e.minHeight,c=o[3*n+1]>=e.minHeight;l&&u&&c&&(i.push(r),i.push(a),i.push(n)),o[3*h+1]>=e.minHeight&&l&&c&&(i.push(h),i.push(r),i.push(n))}a.VertexData.ComputeNormals(o,i,n);let f=new a.VertexData;return f.indices=i,f.positions=o,f.normals=n,f.uvs=h,f})({width:n,height:h,subdivisions:u,minHeight:c,maxHeight:d,colorFilter:f,buffer:e,bufferWidth:t,bufferHeight:s,alphaFilter:p,heightBuffer:o}).applyToMesh(_,x),g&&g(_,o),_._setReady(!0)};return"string"==typeof t?(i.addPendingData(_),X.Tools.LoadImage(t,e=>{let t=e.width,s=e.height;i.isDisposed||m(i?.getEngine().resizeImageBitmap(e,t,s),t,s),i.removePendingData(_)},(e,t)=>{i.removePendingData(_),s.onError&&s.onError(e,t)},i.offlineProvider)):m(t.data,t.width,t.height),_},CreatePolygon:N,ExtrudePolygon:W,CreateTube:function(e,t,s=null){let o,a,n=t.path,l=t.instance,u=1;void 0!==t.radius?u=t.radius:l&&(u=l._creationDataStorage.radius);let c=t.tessellation||64,d=t.radiusFunction||null,f=t.cap||i.Mesh.NO_CAP,p=t.invertUV||!1,x=t.updatable,g=i.Mesh._GetDefaultSideOrientation(t.sideOrientation);t.arc=t.arc&&(t.arc<=0||t.arc>1)?1:t.arc||1;let _=(e,t,s,o,a,n,h,l)=>{let u,c,d,f,p=t.getTangents(),x=t.getNormals(),g=t.getDistances(),_=2*Math.PI/a*l,m=n||(()=>o),M=r.TmpVectors.Matrix[0],y=2*(h!==i.Mesh.NO_CAP&&h!==i.Mesh.CAP_END);for(let t=0;t<e.length;t++){c=m(t,g[t]),u=[],d=x[t];for(let s=0;s<a;s++)r.Matrix.RotationAxisToRef(p[t],_*s,M),f=u[s]?u[s]:r.Vector3.Zero(),r.Vector3.TransformCoordinatesToRef(d,M,f),f.scaleInPlace(c).addInPlace(e[t]),u[s]=f;s[y]=u,y++}let V=(t,s)=>{let r=[];for(let i=0;i<t;i++)r.push(e[s]);return r};switch(h){case i.Mesh.NO_CAP:break;case i.Mesh.CAP_START:s[0]=V(a,0),s[1]=s[2].slice(0);break;case i.Mesh.CAP_END:s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1);break;case i.Mesh.CAP_ALL:s[0]=V(a,0),s[1]=s[2].slice(0),s[y]=s[y-1].slice(0),s[y+1]=V(a,e.length-1)}return s};if(l){let e=l._creationDataStorage,s=t.arc||e.arc;return o=e.path3D.update(n),l=h("",{pathArray:a=_(n,o,e.pathArray,u,e.tessellation,d,e.cap,s),instance:l}),e.path3D=o,e.pathArray=a,e.arc=s,e.radius=u,l}o=new C.Path3D(n);let m=h(e,{pathArray:a=_(n,o,[],u,c,d,f=f<0||f>3?0:f,t.arc),closePath:!0,closeArray:!1,updatable:x,sideOrientation:g,invertUV:p,frontUVs:t.frontUVs,backUVs:t.backUVs},s);return m._creationDataStorage.pathArray=a,m._creationDataStorage.path3D=o,m._creationDataStorage.tessellation=c,m._creationDataStorage.cap=f,m._creationDataStorage.arc=t.arc,m._creationDataStorage.radius=u,m},CreatePolyhedron:Z,CreateGeodesic:function(e,t,s=null){let r=t.m||1;r!==Math.floor(r)&&(r=Math.floor(r),p.Logger.Warn("m not an integer only floor(m) used"));let i=t.n||0;if(i!==Math.floor(i)&&(i=Math.floor(i),p.Logger.Warn("n not an integer only floor(n) used")),i>r){let e=i;i=r,r=e,p.Logger.Warn("n > m therefore m and n swapped")}let o=new es;return o.build(r,i),Z(e,{custom:ei.BuildGeodesicData(o),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},s)},CreateGoldberg:function(e,t,s=null){let o=t.size,h=t.sizeX||o||1,u=t.sizeY||o||1,c=t.sizeZ||o||1,d=t.m||1;d!==Math.floor(d)&&(d=Math.floor(d),p.Logger.Warn("m not an integer only floor(m) used"));let f=t.n||0;if(f!==Math.floor(f)&&(f=Math.floor(f),p.Logger.Warn("n not an integer only floor(n) used")),f>d){let e=f;f=d,d=e,p.Logger.Warn("n > m therefore m and n swapped")}let x=new es;x.build(d,f);let g=ei.BuildGeodesicData(x),_=g.toGoldbergPolyhedronData(),m=new ea(e,s);t.sideOrientation=i.Mesh._GetDefaultSideOrientation(t.sideOrientation),m._originalBuilderSideOrientation=t.sideOrientation,(function(e,t){let s=e.size,i=e.sizeX||s||1,o=e.sizeY||s||1,h=e.sizeZ||s||1,l=0===e.sideOrientation?0:e.sideOrientation||a.VertexData.DEFAULTSIDE,u=[],c=[],d=[],f=[],p=1/0,x=-1/0,g=1/0,_=-1/0;for(let e=0;e<t.vertex.length;e++)p=Math.min(p,t.vertex[e][0]*i),x=Math.max(x,t.vertex[e][0]*i),g=Math.min(g,t.vertex[e][1]*o),_=Math.max(_,t.vertex[e][1]*o);let m=0;for(let e=0;e<t.face.length;e++){let s=t.face[e],a=r.Vector3.FromArray(t.vertex[s[0]]),l=r.Vector3.FromArray(t.vertex[s[2]]),M=r.Vector3.FromArray(t.vertex[s[1]]),y=l.subtract(a),V=M.subtract(a),O=r.Vector3.Cross(V,y).normalize();for(let e=0;e<s.length;e++){d.push(O.x,O.y,O.z);let r=t.vertex[s[e]];u.push(r[0]*i,r[1]*o,r[2]*h);let a=(r[1]*o-g)/(_-g);f.push((r[0]*i-p)/(x-p),n.useOpenGLOrientationForUV?1-a:a)}for(let e=0;e<s.length-2;e++)c.push(m,m+e+2,m+e+1);m+=s.length}a.VertexData._ComputeSides(l,u,c,d,f);let M=new a.VertexData;return M.positions=u,M.indices=c,M.normals=d,M.uvs=f,M})(t,_).applyToMesh(m,t.updatable),m.goldbergData.nbSharedFaces=g.sharedNodes,m.goldbergData.nbUnsharedFaces=g.poleNodes,m.goldbergData.adjacentFaces=g.adjacentFaces,m.goldbergData.nbFaces=m.goldbergData.nbSharedFaces+m.goldbergData.nbUnsharedFaces,m.goldbergData.nbFacesAtPole=(m.goldbergData.nbUnsharedFaces-12)/12;for(let e=0;e<g.vertex.length;e++)m.goldbergData.faceCenters.push(r.Vector3.FromArray(g.vertex[e])),m.goldbergData.faceCenters[e].x*=h,m.goldbergData.faceCenters[e].y*=u,m.goldbergData.faceCenters[e].z*=c,m.goldbergData.faceColors.push(new l.Color4(1,1,1,1));for(let e=0;e<_.face.length;e++){let t=_.face[e],s=r.Vector3.FromArray(_.vertex[t[0]]),i=r.Vector3.FromArray(_.vertex[t[2]]),o=r.Vector3.FromArray(_.vertex[t[1]]),a=i.subtract(s),n=o.subtract(s),h=r.Vector3.Cross(n,a).normalize(),l=r.Vector3.Cross(n,h).normalize();m.goldbergData.faceXaxis.push(n.normalize()),m.goldbergData.faceYaxis.push(h),m.goldbergData.faceZaxis.push(l)}return m},CreateDecal:function(e,t,s){let h=!!t.skeleton,l=!!t.morphTargetManager?.numTargets,u=s.localMode||h,c=t.getIndices(),d=h||l?t.getPositionData(!0,!0):t.getVerticesData(o.VertexBuffer.PositionKind),f=h||l?t.getNormalsData(!0,!0):t.getVerticesData(o.VertexBuffer.NormalKind),p=u?h?t.getVerticesData(o.VertexBuffer.PositionKind):d:null,x=u?h?t.getVerticesData(o.VertexBuffer.NormalKind):f:null,g=t.getVerticesData(o.VertexBuffer.UVKind),_=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesKind):null,m=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsKind):null,M=h?t.getVerticesData(o.VertexBuffer.MatricesIndicesExtraKind):null,y=h?t.getVerticesData(o.VertexBuffer.MatricesWeightsExtraKind):null,V=s.position||r.Vector3.Zero(),O=s.normal||r.Vector3.Up(),A=s.size||r.Vector3.One(),v=s.angle||0;if(!O){let e=new r.Vector3(0,0,1),s=t.getScene().activeCamera,i=r.Vector3.TransformCoordinates(e,s.getWorldMatrix());O=s.globalPosition.subtract(i)}let T=-Math.atan2(O.z,O.x)-Math.PI/2,b=Math.sqrt(O.x*O.x+O.z*O.z),I=Math.atan2(O.y,b),D=new a.VertexData;D.indices=[],D.positions=[],D.normals=[],D.uvs=[],D.matricesIndices=h?[]:null,D.matricesWeights=h?[]:null,D.matricesIndicesExtra=M?[]:null,D.matricesWeightsExtra=y?[]:null;let w=0,P=(e,t)=>{let i=new ee;if(!c||!d||!f)return i;let o=c[e];if(i.vertexIdx=3*o,i.vertexIdxForBones=4*o,i.position=new r.Vector3(d[3*o],d[3*o+1],d[3*o+2]),r.Vector3.TransformCoordinatesToRef(i.position,t,i.position),i.normal=new r.Vector3(f[3*o],f[3*o+1],f[3*o+2]),r.Vector3.TransformNormalToRef(i.normal,t,i.normal),s.captureUVS&&g){let e=g[2*o+1];i.uv=new r.Vector2(g[2*o],n.useOpenGLOrientationForUV?1-e:e)}return i},F=[0,0,0,0],B=(e,t)=>{if(0===e.length)return e;let s=.5*Math.abs(r.Vector3.Dot(A,t)),i=(e,t,s,r)=>{for(let i=0;i<r;++i)if(e[s+i]===t)return s+i;return -1},o=(e,o)=>{let a=r.Vector3.GetClipFactor(e.position,o.position,t,s),n=F,h=F;if(_&&m){let t=e.matrixIndicesOverride?0:e.vertexIdxForBones,s=e.matrixIndicesOverride??_,r=e.matrixWeightsOverride??m,l=o.matrixIndicesOverride?0:o.vertexIdxForBones,u=o.matrixIndicesOverride??_,c=o.matrixWeightsOverride??m;n=[0,0,0,0],h=[0,0,0,0];let d=0;for(let e=0;e<4;++e)if(r[t+e]>0){let o=i(u,s[t+e],l,4);n[d]=s[t+e],h[d]=(0,K.Lerp)(r[t+e],o>=0?c[o]:0,a),d++}for(let e=0;e<4&&d<4;++e){let r=u[l+e];-1===i(s,r,t,4)&&(n[d]=r,h[d]=(0,K.Lerp)(0,c[l+e],a),d++)}let f=h[0]+h[1]+h[2]+h[3];h[0]/=f,h[1]/=f,h[2]/=f,h[3]/=f}let l=e.localPositionOverride?e.localPositionOverride[0]:p?.[e.vertexIdx]??0,u=e.localPositionOverride?e.localPositionOverride[1]:p?.[e.vertexIdx+1]??0,c=e.localPositionOverride?e.localPositionOverride[2]:p?.[e.vertexIdx+2]??0,d=o.localPositionOverride?o.localPositionOverride[0]:p?.[o.vertexIdx]??0,f=o.localPositionOverride?o.localPositionOverride[1]:p?.[o.vertexIdx+1]??0,g=o.localPositionOverride?o.localPositionOverride[2]:p?.[o.vertexIdx+2]??0,M=e.localNormalOverride?e.localNormalOverride[0]:x?.[e.vertexIdx]??0,y=e.localNormalOverride?e.localNormalOverride[1]:x?.[e.vertexIdx+1]??0,V=e.localNormalOverride?e.localNormalOverride[2]:x?.[e.vertexIdx+2]??0,O=o.localNormalOverride?o.localNormalOverride[0]:x?.[o.vertexIdx]??0,A=o.localNormalOverride?o.localNormalOverride[1]:x?.[o.vertexIdx+1]??0,v=o.localNormalOverride?o.localNormalOverride[2]:x?.[o.vertexIdx+2]??0,T=M+(O-M)*a,b=y+(A-y)*a,I=V+(v-V)*a,D=Math.sqrt(T*T+b*b+I*I);return new ee(r.Vector3.Lerp(e.position,o.position,a),r.Vector3.Lerp(e.normal,o.normal,a).normalize(),r.Vector2.Lerp(e.uv,o.uv,a),-1,-1,p?[l+(d-l)*a,u+(f-u)*a,c+(g-c)*a]:null,x?[T/D,b/D,I/D]:null,n,h)},a=null;e.length>3&&(a=[]);for(let i=0;i<e.length;i+=3){let n=null,h=null,l=null,u=null,c=r.Vector3.Dot(e[i].position,t)-s,d=r.Vector3.Dot(e[i+1].position,t)-s,f=r.Vector3.Dot(e[i+2].position,t)-s,p=c>0,x=d>0,g=f>0;switch(+!!p+ +!!x+ +!!g){case 0:e.length>3?(a.push(e[i]),a.push(e[i+1]),a.push(e[i+2])):a=e;break;case 1:if(a=a??[],p&&(n=e[i+1],h=e[i+2],l=o(e[i],n),u=o(e[i],h)),x){n=e[i],h=e[i+2],l=o(e[i+1],n),u=o(e[i+1],h),a.push(l),a.push(h.clone()),a.push(n.clone()),a.push(h.clone()),a.push(l.clone()),a.push(u);break}g&&(n=e[i],h=e[i+1],l=o(e[i+2],n),u=o(e[i+2],h)),n&&h&&l&&u&&(a.push(n.clone()),a.push(h.clone()),a.push(l),a.push(u),a.push(l.clone()),a.push(h.clone()));break;case 2:a=a??[],p||(h=o(n=e[i].clone(),e[i+1]),l=o(n,e[i+2]),a.push(n),a.push(h),a.push(l)),x||(h=o(n=e[i+1].clone(),e[i+2]),l=o(n,e[i]),a.push(n),a.push(h),a.push(l)),g||(h=o(n=e[i+2].clone(),e[i]),l=o(n,e[i+1]),a.push(n),a.push(h),a.push(l))}}return a},L=t instanceof i.Mesh?t:null,E=L?._thinInstanceDataStorage.matrixData,C=L?.thinInstanceCount||1,S=r.TmpVectors.Matrix[0];S.copyFrom(r.Matrix.IdentityReadOnly);for(let e=0;e<C;++e){if(L?.hasThinInstances&&E){let t=16*e;S.setRowFromFloats(0,E[t+0],E[t+1],E[t+2],E[t+3]),S.setRowFromFloats(1,E[t+4],E[t+5],E[t+6],E[t+7]),S.setRowFromFloats(2,E[t+8],E[t+9],E[t+10],E[t+11]),S.setRowFromFloats(3,E[t+12],E[t+13],E[t+14],E[t+15])}let i=r.Matrix.RotationYawPitchRoll(T,I,v).multiply(r.Matrix.Translation(V.x,V.y,V.z)),o=r.Matrix.Invert(i),a=t.getWorldMatrix(),h=S.multiply(a).multiply(o),l=[,,,];for(let e=0;e<c.length;e+=3){let t=l;if((t[0]=P(e,h),t[1]=P(e+1,h),t[2]=P(e+2,h),!(s.cullBackFaces&&0>=-t[0].normal.z&&0>=-t[1].normal.z&&0>=-t[2].normal.z)&&(t=B(t,Y))&&(t=B(t,q))&&(t=B(t,j))&&(t=B(t,Q))&&(t=B(t,$)))&&(t=B(t,J)))for(let e=0;e<t.length;e++){let r=t[e];if(D.indices.push(w),u?(r.localPositionOverride?(D.positions[3*w]=r.localPositionOverride[0],D.positions[3*w+1]=r.localPositionOverride[1],D.positions[3*w+2]=r.localPositionOverride[2]):p&&(D.positions[3*w]=p[r.vertexIdx],D.positions[3*w+1]=p[r.vertexIdx+1],D.positions[3*w+2]=p[r.vertexIdx+2]),r.localNormalOverride?(D.normals[3*w]=r.localNormalOverride[0],D.normals[3*w+1]=r.localNormalOverride[1],D.normals[3*w+2]=r.localNormalOverride[2]):x&&(D.normals[3*w]=x[r.vertexIdx],D.normals[3*w+1]=x[r.vertexIdx+1],D.normals[3*w+2]=x[r.vertexIdx+2])):(r.position.toArray(D.positions,3*w),r.normal.toArray(D.normals,3*w)),D.matricesIndices&&D.matricesWeights&&(r.matrixIndicesOverride?(D.matricesIndices[4*w]=r.matrixIndicesOverride[0],D.matricesIndices[4*w+1]=r.matrixIndicesOverride[1],D.matricesIndices[4*w+2]=r.matrixIndicesOverride[2],D.matricesIndices[4*w+3]=r.matrixIndicesOverride[3]):(_&&(D.matricesIndices[4*w]=_[r.vertexIdxForBones],D.matricesIndices[4*w+1]=_[r.vertexIdxForBones+1],D.matricesIndices[4*w+2]=_[r.vertexIdxForBones+2],D.matricesIndices[4*w+3]=_[r.vertexIdxForBones+3]),M&&D.matricesIndicesExtra&&(D.matricesIndicesExtra[4*w]=M[r.vertexIdxForBones],D.matricesIndicesExtra[4*w+1]=M[r.vertexIdxForBones+1],D.matricesIndicesExtra[4*w+2]=M[r.vertexIdxForBones+2],D.matricesIndicesExtra[4*w+3]=M[r.vertexIdxForBones+3])),r.matrixWeightsOverride?(D.matricesWeights[4*w]=r.matrixWeightsOverride[0],D.matricesWeights[4*w+1]=r.matrixWeightsOverride[1],D.matricesWeights[4*w+2]=r.matrixWeightsOverride[2],D.matricesWeights[4*w+3]=r.matrixWeightsOverride[3]):(m&&(D.matricesWeights[4*w]=m[r.vertexIdxForBones],D.matricesWeights[4*w+1]=m[r.vertexIdxForBones+1],D.matricesWeights[4*w+2]=m[r.vertexIdxForBones+2],D.matricesWeights[4*w+3]=m[r.vertexIdxForBones+3]),y&&D.matricesWeightsExtra&&(D.matricesWeightsExtra[4*w]=y[r.vertexIdxForBones],D.matricesWeightsExtra[4*w+1]=y[r.vertexIdxForBones+1],D.matricesWeightsExtra[4*w+2]=y[r.vertexIdxForBones+2],D.matricesWeightsExtra[4*w+3]=y[r.vertexIdxForBones+3]))),s.captureUVS)r.uv.toArray(D.uvs,2*w);else{D.uvs.push(.5+r.position.x/A.x);let e=.5+r.position.y/A.y;D.uvs.push(n.useOpenGLOrientationForUV?1-e:e)}w++}}}0===D.indices.length&&(D.indices=null),0===D.positions.length&&(D.positions=null),0===D.normals.length&&(D.normals=null),0===D.uvs.length&&(D.uvs=null),D.matricesIndices?.length===0&&(D.matricesIndices=null),D.matricesWeights?.length===0&&(D.matricesWeights=null),D.matricesIndicesExtra?.length===0&&(D.matricesIndicesExtra=null),D.matricesWeightsExtra?.length===0&&(D.matricesWeightsExtra=null);let z=new i.Mesh(e,t.getScene());return D.applyToMesh(z),u?(z.skeleton=t.skeleton,z.parent=t):(z.position=V.clone(),z.rotation=new r.Vector3(I,T,v)),z.computeWorldMatrix(!0),z.refreshBoundingInfo(!0,!0),z},CreateCapsule:function(e,t={orientation:r.Vector3.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6,updatable:!1},s=null){let o=new i.Mesh(e,s);return(function(e={subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){let t,s,i=0|Math.max(e.subdivisions?e.subdivisions:2,1),o=0|Math.max(e.tessellation?e.tessellation:16,3),h=Math.max(e.height?e.height:1,0),l=Math.max(e.radius?e.radius:.25,0),u=0|Math.max(e.capSubdivisions?e.capSubdivisions:6,1),c=Math.max(e.radiusTop?e.radiusTop:l,0),d=Math.max(e.radiusBottom?e.radiusBottom:l,0),f=2*Math.PI,p=Math.max(e.topCapSubdivisions?e.topCapSubdivisions:u,1),x=Math.max(e.bottomCapSubdivisions?e.bottomCapSubdivisions:u,1),g=Math.acos((d-c)/h),_=[],m=[],M=[],y=[],V=0,O=[],A=.5*(h-(c+d)),v=.5*Math.PI,T=r.Vector3.Zero(),b=r.Vector3.Zero(),I=Math.cos(g),D=Math.sin(g),w=new r.Vector2(c*D,A+c*I).subtract(new r.Vector2(d*D,-A+d*I)).length(),P=c*g+w+d*(v-g),F=0;for(s=0;s<=p;s++){let e=[],r=v-s/p*g;F+=c*g/p;let i=Math.cos(r),a=Math.sin(r),h=i*c;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=A+a*c,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}let B=h-c-d+I*c-I*d,L=D*(d-c)/B;for(s=1;s<=i;s++){let e=[];F+=w/i;let r=D*(s*(d-c)/i+c);for(t=0;t<=o;t++){let a=t/o,h=a*f+0,l=Math.sin(h),u=Math.cos(h);b.x=r*l,b.y=A+I*c-s*B/i,b.z=r*u,m.push(b.x,b.y,b.z),T.set(l,L,u).normalize(),M.push(T.x,T.y,T.z),y.push(a,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(s=1;s<=x;s++){let e=[],r=v-g-s/x*(Math.PI-g);F+=d*g/x;let i=Math.cos(r),a=Math.sin(r),h=i*d;for(t=0;t<=o;t++){let s=t/o,r=s*f+0,l=Math.sin(r),u=Math.cos(r);b.x=h*l,b.y=-A+a*d,b.z=h*u,m.push(b.x,b.y,b.z),T.set(i*l,a,i*u),M.push(T.x,T.y,T.z),y.push(s,n.useOpenGLOrientationForUV?F/P:1-F/P),e.push(V),V++}O.push(e)}for(t=0;t<o;t++)for(s=0;s<p+i+x;s++){let e=O[s][t],r=O[s+1][t],i=O[s+1][t+1],o=O[s][t+1];_.push(e),_.push(r),_.push(o),_.push(r),_.push(i),_.push(o)}if(_=_.reverse(),e.orientation&&!e.orientation.equals(r.Vector3.Up())){let t=new r.Matrix;e.orientation.clone().scale(.5*Math.PI).cross(r.Vector3.Up()).toQuaternion().toRotationMatrix(t);let s=r.Vector3.Zero();for(let e=0;e<m.length;e+=3)s.set(m[e],m[e+1],m[e+2]),r.Vector3.TransformCoordinatesToRef(s.clone(),t,s),m[e]=s.x,m[e+1]=s.y,m[e+2]=s.z}let E=new a.VertexData;return E.positions=m,E.normals=M,E.uvs=y,E.indices=_,E})(t).applyToMesh(o,t.updatable),o},CreateText:function(e,t,s,o={size:50,resolution:8,depth:1},a=null,n=earcut){let h=function(e,t,s,r){let i=Array.from(e),o=t/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*o,n=[],h=0,l=0;for(let e=0;e<i.length;e++){let t=i[e];if("\n"===t)h=0,l-=a;else{let e=function(e,t,s,r,i,o){let a=o.glyphs[e]||o.glyphs["?"];if(!a)return null;let n=new en(i);if(a.o){let e=a.o.split(" ");for(let i=0,o=e.length;i<o;)switch(e[i++]){case"m":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.moveTo(o,a);break}case"l":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r;n.lineTo(o,a);break}case"q":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r;n.quadraticCurveTo(h,l,o,a);break}case"b":{let o=parseInt(e[i++])*t+s,a=parseInt(e[i++])*t+r,h=parseInt(e[i++])*t+s,l=parseInt(e[i++])*t+r,u=parseInt(e[i++])*t+s,c=parseInt(e[i++])*t+r;n.bezierCurveTo(h,l,u,c,o,a)}}}return n.extractHoles(),{offsetX:a.ha*t,shapePath:n}}(t,o,h,l,s,r);e&&(h+=e.offsetX,n.push(e.shapePath))}}return n}(t,o.size||50,o.resolution||8,s),l=[],u=0;for(let t of h){if(!t.paths.length)continue;let s=t.holes.slice();for(let h of t.paths){let t=[],c=[];for(let e of h.getPoints())c.push(new r.Vector3(e.x,0,e.y));for(let e of s.slice()){let i=e.getPoints(),o=!1;for(let e of i)if(h.isPointInside(e)){o=!0;break}if(!o)continue;let a=[];for(let e of i)a.push(new r.Vector3(e.x,0,e.y));t.push(a),s.splice(s.indexOf(e),1)}if(!t.length&&s.length)for(let e of s){let s=e.getPoints(),i=[];for(let e of s)i.push(new r.Vector3(e.x,0,e.y));t.push(i)}let d=W(e,{shape:c,holes:t.length?t:void 0,depth:o.depth||1,faceUV:o.faceUV||o.perLetterFaceUV?.(u),faceColors:o.faceColors||o.perLetterFaceColors?.(u),sideOrientation:i.Mesh._GetDefaultSideOrientation(o.sideOrientation||i.Mesh.DOUBLESIDE)},a,n);l.push(d),u++}}let c=i.Mesh.MergeMeshes(l,!0,!0);if(c){let t=c.getBoundingInfo().boundingBox;c.position.x+=-(t.minimumWorld.x+t.maximumWorld.x)/2,c.position.y+=-(t.minimumWorld.y+t.maximumWorld.y)/2,c.position.z+=-(t.minimumWorld.z+t.maximumWorld.z)/2+t.extendSize.z,c.name=e;let s=new _.TransformNode("pivot",a);s.rotation.x=-Math.PI/2,c.parent=s,c.bakeCurrentTransformIntoVertices(),c.parent=null,s.dispose()}return c}}],97998)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12423,e=>{"use strict";class t{static GetShadersRepository(e=0){return 0===e?t.ShadersRepository:t.ShadersRepositoryWGSL}static GetShadersStore(e=0){return 0===e?t.ShadersStore:t.ShadersStoreWGSL}static GetIncludesShadersStore(e=0){return 0===e?t.IncludesShadersStore:t.IncludesShadersStoreWGSL}}t.ShadersRepository="src/Shaders/",t.ShadersStore={},t.IncludesShadersStore={},t.ShadersRepositoryWGSL="src/ShadersWGSL/",t.ShadersStoreWGSL={},t.IncludesShadersStoreWGSL={},e.s(["ShaderStore",0,t])},69938,e=>{"use strict";var t=e.i(76535);let s=!1;e.s(["RegisterAbstractEngineRenderPass",0,function(){s||(s=!0,t.AbstractEngine.prototype.getRenderPassNames=function(){return this._renderPassNames},t.AbstractEngine.prototype.getCurrentRenderPassName=function(){return this._renderPassNames[this.currentRenderPassId]},t.AbstractEngine.prototype.createRenderPassId=function(e){let s=++t.AbstractEngine._RenderPassIdCounter;return this._renderPassNames[s]=e??"NONAME",s},t.AbstractEngine.prototype.releaseRenderPassId=function(e){this._renderPassNames[e]=void 0;for(let t=0;t<this.scenes.length;++t){let s=this.scenes[t];for(let t=0;t<s.meshes.length;++t){let i=s.meshes[t];if(i._releaseRenderPassId(e),i.subMeshes)for(let t=0;t<i.subMeshes.length;++t)i.subMeshes[t]._removeDrawWrapper(e)}}})}])},84201,e=>{"use strict";var t,s,i=e.i(99267);class r{get wrapU(){return this._cachedWrapU}set wrapU(e){this._cachedWrapU=e}get wrapV(){return this._cachedWrapV}set wrapV(e){this._cachedWrapV=e}get wrapR(){return this._cachedWrapR}set wrapR(e){this._cachedWrapR=e}get anisotropicFilteringLevel(){return this._cachedAnisotropicFilteringLevel}set anisotropicFilteringLevel(e){this._cachedAnisotropicFilteringLevel=e}get comparisonFunction(){return this._comparisonFunction}set comparisonFunction(e){this._comparisonFunction=e}get useMipMaps(){return this._useMipMaps}set useMipMaps(e){this._useMipMaps=e}constructor(){this.samplingMode=-1,this._useMipMaps=!0,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._comparisonFunction=0}setParameters(e=1,t=1,s=1,i=1,r=2,a=0){return this._cachedWrapU=e,this._cachedWrapV=t,this._cachedWrapR=s,this._cachedAnisotropicFilteringLevel=i,this.samplingMode=r,this._comparisonFunction=a,this}compareSampler(e){return this._cachedWrapU===e._cachedWrapU&&this._cachedWrapV===e._cachedWrapV&&this._cachedWrapR===e._cachedWrapR&&this._cachedAnisotropicFilteringLevel===e._cachedAnisotropicFilteringLevel&&this.samplingMode===e.samplingMode&&this._comparisonFunction===e._comparisonFunction&&this._useMipMaps===e._useMipMaps}}(t=s||(s={}))[t.Unknown=0]="Unknown",t[t.Url=1]="Url",t[t.Temp=2]="Temp",t[t.Raw=3]="Raw",t[t.Dynamic=4]="Dynamic",t[t.RenderTarget=5]="RenderTarget",t[t.MultiRenderTarget=6]="MultiRenderTarget",t[t.Cube=7]="Cube",t[t.CubeRaw=8]="CubeRaw",t[t.CubePrefiltered=9]="CubePrefiltered",t[t.Raw3D=10]="Raw3D",t[t.Raw2DArray=11]="Raw2DArray",t[t.DepthStencil=12]="DepthStencil",t[t.CubeRawRGBD=13]="CubeRawRGBD",t[t.Depth=14]="Depth",t[t.External=15]="External";class a extends r{get useMipMaps(){return null===this._useMipMaps?this.generateMipMaps:this._useMipMaps}set useMipMaps(e){this._useMipMaps=e}get uniqueId(){return this._uniqueId}_setUniqueId(e){this._uniqueId=e}getEngine(){return this._engine}get source(){return this._source}constructor(e,t,s=!1){super(),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.generateMipMaps=!1,this._useMipMaps=null,this.mipLevelCount=1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new i.Observable,this.onErrorObservable=new i.Observable,this.onRebuildCallback=null,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=0,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._cachedCoordinatesMode=null,this._isDisabled=!1,this._compression=null,this._sphericalPolynomial=null,this._sphericalPolynomialPromise=null,this._sphericalPolynomialComputed=!1,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._useSRGBBuffer=!1,this._creationFlags=0,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._hardwareTexture=null,this._maxLodLevel=null,this._references=1,this._gammaSpace=null,this._premulAlpha=!1,this._dynamicTextureSource=null,this._autoMSAAManagement=!1,this._engine=e,this._source=t,this._uniqueId=a._Counter++,s||(this._hardwareTexture=e._createHardwareTexture())}incrementReferences(){this._references++}updateSize(e,t,s=1){this._engine.updateTextureDimensions(this,e,t,s),this.width=e,this.height=t,this.depth=s,this.baseWidth=e,this.baseHeight=t,this.baseDepth=s,this._size=e*t*s}_rebuild(){let e;if(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this.onRebuildCallback){let e=this.onRebuildCallback(this),t=t=>{t._swapAndDie(this,!1),this.isReady=e.isReady};e.isAsync?e.proxy.then(t):t(e.proxy);return}switch(this.source){case 2:case 12:case 14:break;case 1:e=this._engine.createTexture(this._originalUrl??this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,e=>{e._swapAndDie(this,!1),this.isReady=!0},null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer);return;case 3:if((e=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this._useSRGBBuffer,this.mipLevelCount))._swapAndDie(this,!1),this._bufferViewArray)for(let e=0;e<this._bufferViewArray.length;e++){let t=this._bufferViewArray[e];t&&this._engine.updateRawTexture(this,t,this.format,this.invertY,this._compression,this.type,this._useSRGBBuffer,e)}this.isReady=!0;break;case 10:(e=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case 11:if((e=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this.mipLevelCount))._swapAndDie(this,!1),this._bufferViewArray)for(let e=0;e<this._bufferViewArray.length;e++){let t=this._bufferViewArray[e];t&&this._engine.updateRawTexture2DArray(this,t,this.format,this.invertY,this._compression,this.type,e)}this.isReady=!0;break;case 4:(e=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this,!1),this._dynamicTextureSource&&this._engine.updateDynamicTexture(this,this._dynamicTextureSource,this.invertY,this._premulAlpha,this.format,!0);break;case 7:e=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,()=>{e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer,ArrayBuffer.isView(this._buffer)?this._buffer:null);return;case 8:(e=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this._originalFormat??this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this,!1),this.isReady=!0;break;case 13:return;case 9:(e=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,e=>{e&&e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial;return}}_swapAndDie(e,t=!0){this._hardwareTexture?.setUsage(e._source,this.generateMipMaps,this.is2DArray,this.isCube,this.is3D,this.width,this.height,this.depth),e._hardwareTexture=this._hardwareTexture,e._setUniqueId(a._Counter++),t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);let s=this._engine.getLoadedTexturesCache(),i=s.indexOf(this);-1!==i&&s.splice(i,1),-1===(i=s.indexOf(e))&&s.push(e)}dispose(){this._references--,0===this._references&&(this.onLoadedObservable.clear(),this.onErrorObservable.clear(),this._engine._releaseTexture(this),this._hardwareTexture=null,this._dynamicTextureSource=null)}}a._Counter=0,e.s(["InternalTexture",0,a],84201)},80871,76312,e=>{"use strict";var t=e.i(75405);class s{static Eval(e,t){return"true"===(e=e.match(/\([^()]*\)/g)?e.replace(/\([^()]*\)/g,e=>(e=e.slice(1,e.length-1),s._HandleParenthesisContent(e,t))):s._HandleParenthesisContent(e,t))||"false"!==e&&s.Eval(e,t)}static _HandleParenthesisContent(e,t){let i;t=t||(e=>"true"===e);let r=e.split("||");for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let a=s._SimplifyNegation(r[e].trim()),h=a.split("&&");if(h.length>1)for(let e=0;e<h.length;++e){let r=s._SimplifyNegation(h[e].trim());if(!(i="true"!==r&&"false"!==r?"!"===r[0]?!t(r.substring(1)):t(r):"true"===r)){a="false";break}}if(i||"true"===a){i=!0;break}i="true"!==a&&"false"!==a?"!"===a[0]?!t(a.substring(1)):t(a):"true"===a}return i?"true":"false"}static _SimplifyNegation(e){return"!true"===(e=(e=e.replace(/^[\s!]+/,e=>(e=e.replace(/[\s]/g,()=>"")).length%2?"!":"")).trim())?e="false":"!false"===e&&(e="true"),e}}class i{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>i.HasTags(e),e.addTags=t=>i.AddTagsTo(e,t),e.removeTags=t=>i.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>i.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;let t=e._tags;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(!t)return e._tags;{let t=[];for(let s in e._tags)Object.prototype.hasOwnProperty.call(e._tags,s)&&!0===e._tags[s]&&t.push(s);return t.join(" ")}}static AddTagsTo(e,t){if(t&&"string"==typeof t)for(let s of t.split(" "))i._AddTagTo(e,s)}static _AddTagTo(e,t){""===(t=t.trim())||"true"===t||"false"===t||t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(i.EnableFor(e),e._tags[t]=!0)}static RemoveTagsFrom(e,t){if(!i.HasTags(e))return;let s=t.split(" ");for(let t in s)i._RemoveTagFrom(e,s[t])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return void 0===t||(""===t?i.HasTags(e):s.Eval(t,t=>i.HasTags(e)&&e._tags[t]))}}e.s(["Tags",0,i],76312);var r=e.i(70653),a=e.i(96265),h=e.i(94047);let n=function(e,t,s,r={}){let a=e();i&&i.HasTags(t)&&i.AddTagsTo(a,i.GetTags(t,!0));let n=(0,h.GetMergedStore)(a),o={};for(let e in n){let i=n[e],h=t[e],c=i.type;if(null!=h&&("uniqueId"!==e||l.AllowLoadingUniqueId))switch(c){case 0:case 6:case 9:case 11:"function"==typeof h.slice?a[e]=h.slice():a[e]=h;break;case 1:r.cloneTexturesOnlyOnce&&o[h.uniqueId]?a[e]=o[h.uniqueId]:(a[e]=s||h.isRenderTarget?h:h.clone(),o[h.uniqueId]=a[e]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:a[e]=s?h:h.clone()}}return a};class l{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let s=0;s<e.animations.length;s++){let i=e.animations[s];t.animations.push(i.serialize())}}}static Serialize(e,t){t||(t={}),i&&(t.tags=i.GetTags(e));let s=(0,h.GetMergedStore)(e);for(let i in s){let r=s[i],a=r.sourceName||i,h=r.type,n=e[i];if(null!=n&&("uniqueId"!==i||l.AllowLoadingUniqueId))switch(h){case 0:Array.isArray(n)?t[a]=n.slice():t[a]=n;break;case 1:case 3:case 7:case 9:t[a]=n.serialize();break;case 2:case 4:case 5:case 8:case 10:case 12:t[a]=n.asArray();break;case 6:case 11:t[a]=n.id}}return t}static ParseProperties(e,t,s,i){i||(i="");let n=(0,h.GetMergedStore)(t);for(let h in n){let o=n[h],c=e[o.sourceName||h],u=o.type;if(null!=c&&("uniqueId"!==h||l.AllowLoadingUniqueId))switch(u){case 0:t[h]=c;break;case 1:s&&(t[h]=l._TextureParser(c,s,i));break;case 2:t[h]=r.Color3.FromArray(c);break;case 3:t[h]=l._FresnelParametersParser(c);break;case 4:t[h]=a.Vector2.FromArray(c);break;case 5:t[h]=a.Vector3.FromArray(c);break;case 6:s&&(t[h]=s.getLastMeshById(c));break;case 7:t[h]=l._ColorCurvesParser(c);break;case 8:t[h]=r.Color4.FromArray(c);break;case 9:t[h]=l._ImageProcessingConfigurationParser(c);break;case 10:t[h]=a.Quaternion.FromArray(c);break;case 11:s&&(t[h]=s.getCameraById(c));break;case 12:t[h]=a.Matrix.FromArray(c)}}}static Parse(e,t,s,r=null){let a=e();return i&&i.AddTagsTo(a,t.tags),l.ParseProperties(t,a,s,r),a}static Clone(e,t,s={}){return n(e,t,!1,s)}static Instanciate(e,t){return n(e,t,!0)}}l.AllowLoadingUniqueId=!1,l._ImageProcessingConfigurationParser=e=>{throw(0,t._WarnImport)("ImageProcessingConfiguration")},l._FresnelParametersParser=e=>{throw(0,t._WarnImport)("FresnelParameters")},l._ColorCurvesParser=e=>{throw(0,t._WarnImport)("ColorCurves")},l._TextureParser=(e,s,i)=>{throw(0,t._WarnImport)("Texture")},e.s(["SerializationHelper",0,l],80871)},55069,e=>{"use strict";var t=e.i(71379);let s=!1;e.s(["RegisterEngineDynamicBuffer",0,function(){s||(s=!0,t.ThinEngine.prototype.updateDynamicIndexBuffer=function(e,t,s=0){let i;this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),i=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},t.ThinEngine.prototype.updateDynamicVertexBuffer=function(e,t,s,i){this.bindArrayBuffer(e),void 0===s&&(s=0);let r=t.byteLength||t.length;void 0===i||i>=r&&0===s?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,new Float32Array(t).subarray(0,i/4)):(t=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,i):new Uint8Array(t,0,i),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,s,t)),this._resetVertexBufferBinding()})}])},67359,e=>{"use strict";var t=e.i(36395);class s{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(e,t){s.Enabled&&(this._current+=e,t&&this._fetchResult())}beginMonitoring(){s.Enabled&&(this._startMonitoringTime=t.PrecisionDate.Now)}endMonitoring(e=!0){if(!s.Enabled)return;e&&this.fetchNewFrame();let i=t.PrecisionDate.Now;this._current=i-this._startMonitoringTime,e&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;let e=t.PrecisionDate.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}s.Enabled=!0,e.s(["PerfCounter",0,s])},54361,e=>{"use strict";class t{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=0|this.width;return 397*e^this.height}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,s){return new t(this.width*e,this.height*s)}clone(){return new t(this.width,this.height)}equals(e){return!!e&&this.width===e.width&&this.height===e.height}get surface(){return this.width*this.height}static Zero(){return new t(0,0)}add(e){return new t(this.width+e.width,this.height+e.height)}subtract(e){return new t(this.width-e.width,this.height-e.height)}scale(e){return new t(this.width*e,this.height*e)}static Lerp(e,s,i){return new t(e.width+(s.width-e.width)*i,e.height+(s.height-e.height)*i)}}e.s(["Size",0,t])},52153,e=>{"use strict";var t,s=e.i(10272),i=e.i(37143),r=e.i(99267),a=e.i(96265),h=e.i(81623),n=e.i(84768),l=e.i(54361);class o{get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get coordinatesMode(){return 0}get isCube(){return!!this._texture&&this._texture.isCube}set isCube(e){this._texture&&(this._texture.isCube=e)}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}getClassName(){return"ThinTexture"}static _IsRenderTargetWrapper(e){return e?.shareDepth!==void 0}constructor(e){this._wrapU=1,this._wrapV=1,this.wrapR=1,this.anisotropicFilteringLevel=4,this.delayLoadState=0,this._texture=null,this._engine=null,this._cachedSize=l.Size.Zero(),this._cachedBaseSize=l.Size.Zero(),this._initialSamplingMode=2,this._texture=o._IsRenderTargetWrapper(e)?e.texture:e,this._texture&&(this._engine=this._texture.getEngine(),this.wrapU=this._texture._cachedWrapU??this.wrapU,this.wrapV=this._texture._cachedWrapV??this.wrapV,this.wrapR=this._texture._cachedWrapR??this.wrapR)}isReady(){return 4===this.delayLoadState?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady}delayLoad(){}getInternalTexture(){return this._texture}getSize(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;this._texture._size&&(this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size)}return this._cachedSize}getBaseSize(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0),this._cachedBaseSize}get samplingMode(){return this._texture?this._texture.samplingMode:this._initialSamplingMode}updateSamplingMode(e,t=!1){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture,this._texture.generateMipMaps&&t)}releaseInternalTexture(){this._texture&&(this._texture.dispose(),this._texture=null)}dispose(){this._texture&&(this.releaseInternalTexture(),this._engine=null)}}var c=e.i(80871),u=e.i(75405);class _ extends o{set hasAlpha(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace}set gammaSpace(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this))}get isRGBD(){return null!=this._texture&&this._texture._isRGBD}set isRGBD(e){e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),this.getScene()?.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)))}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return!!this._texture&&this._texture._linearSpecularLOD}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=(0,n.RandomGUID)()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=_.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this._dominantDirection=null,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=[],this.onDisposeObservable=new r.Observable,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?_._IsScene(e)?this._scene=e:this._engine=e:this._scene=h.EngineStore.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}getScene(){return this._scene}_getEngine(){return this._engine}getTextureMatrix(){return a.Matrix.IdentityReadOnly}getReflectionTextureMatrix(){return a.Matrix.IdentityReadOnly}getRefractionTextureMatrix(){return this.getReflectionTextureMatrix()}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,s,i,r,a){let h=this._getEngine();if(!h)return null;let n=h._getUseSRGBBuffer(!!r,t),l=h.getLoadedTexturesCache();for(let h=0;h<l.length;h++){let o=l[h];if((void 0===r||n===o._useSRGBBuffer)&&(void 0===i||i===o.invertY)&&o.url===e&&!t===o.generateMipMaps&&(!s||s===o.samplingMode)&&(void 0===a||a===o.isCube))return o.incrementReferences(),o}return null}_rebuild(e=!1){}clone(){return null}get textureType(){return this._texture&&void 0!==this._texture.type?this._texture.type:0}get textureFormat(){return this._texture&&void 0!==this._texture.format?this._texture.format:5}_markAllSubMeshesAsTexturesDirty(){let e=this.getScene();e&&e.markAllMaterialsAsDirty(1)}readPixels(e=0,t=0,s=null,i=!0,r=!1,a=0,h=0,n=Number.MAX_VALUE,l=Number.MAX_VALUE){if(!this._texture)return null;let o=this._getEngine();if(!o)return null;let c=this.getSize(),u=c.width,_=c.height;0!==t&&(u/=Math.pow(2,t),_/=Math.pow(2,t),u=Math.round(u),_=Math.round(_)),n=Math.min(u,n),l=Math.min(_,l);try{if(this._texture.isCube||this._texture.is2DArray)return o._readTexturePixels(this._texture,n,l,e,t,s,i,r,a,h);return o._readTexturePixels(this._texture,n,l,-1,t,s,i,r,a,h)}catch(e){return null}}_readPixelsSync(e=0,t=0,s=null,i=!0,r=!1){if(!this._texture)return null;let a=this.getSize(),h=a.width,n=a.height,l=this._getEngine();if(!l)return null;0!=t&&(h/=Math.pow(2,t),n/=Math.pow(2,t),h=Math.round(h),n=Math.round(n));try{if(this._texture.isCube)return l._readTexturePixelsSync(this._texture,h,n,e,t,s,i,r);return l._readTexturePixelsSync(this._texture,h,n,-1,t,s,i,r)}catch(e){return null}}get _lodTextureHigh(){return this._texture?this._texture._lodTextureHigh:null}get _lodTextureMid(){return this._texture?this._texture._lodTextureMid:null}get _lodTextureLow(){return this._texture?this._texture._lodTextureLow:null}dispose(){if(this._scene){this._scene.stopAnimation&&this._scene.stopAnimation(this),this._scene.removePendingData(this);let e=this._scene.textures.indexOf(this);if(e>=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){let e=this._parentContainer.textures.indexOf(this);e>-1&&this._parentContainer.textures.splice(e,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(e=!1){if(!this.name&&!e)return null;let t=c.SerializationHelper.Serialize(this);return c.SerializationHelper.AppendSerializedAnimations(this,t),t}static WhenAllReady(e,t){let s=e.length;if(0===s)return void t();for(let i=0;i<e.length;i++){let r=e[i];if(r.isReady())0==--s&&t();else{let e=r.onLoadObservable;e?e.addOnce(()=>{0==--s&&t()}):0==--s&&t()}}}static _IsScene(e){return"Scene"===e.getClassName()}}_.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,(0,s.__decorate)([(0,i.serialize)()],_.prototype,"uniqueId",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"name",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"displayName",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"metadata",void 0),(0,s.__decorate)([(0,i.serialize)("hasAlpha")],_.prototype,"_hasAlpha",void 0),(0,s.__decorate)([(0,i.serialize)("getAlphaFromRGB")],_.prototype,"_getAlphaFromRGB",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"level",void 0),(0,s.__decorate)([(0,i.serialize)("coordinatesIndex")],_.prototype,"_coordinatesIndex",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"optimizeUVAllocation",void 0),(0,s.__decorate)([(0,i.serialize)("coordinatesMode")],_.prototype,"_coordinatesMode",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapU",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapV",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"wrapR",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"anisotropicFilteringLevel",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"isCube",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"is3D",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"is2DArray",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"gammaSpace",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"invertZ",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodLevelInAlpha",void 0),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodGenerationOffset",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"lodGenerationScale",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"linearSpecularLOD",null),(0,s.__decorate)([(0,i.serializeAsTexture)()],_.prototype,"irradianceTexture",null),(0,s.__decorate)([(0,i.serialize)()],_.prototype,"isRenderTarget",void 0),(t=_.prototype).forceSphericalPolynomialsRecompute??(t.forceSphericalPolynomialsRecompute=(0,u._MissingSideEffect)("BaseTexture","forceSphericalPolynomialsRecompute")),Object.getOwnPropertyDescriptor(_.prototype,"sphericalPolynomial")||Object.defineProperty(_.prototype,"sphericalPolynomial",(0,u._MissingSideEffectProperty)("BaseTexture","sphericalPolynomial")),e.s(["BaseTexture",0,_],52153)},14953,e=>{"use strict";var t=e.i(96265);let s=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],i=[()=>1,e=>e.y,e=>e.z,e=>e.x,e=>e.x*e.y,e=>e.y*e.z,e=>3*e.z*e.z-1,e=>e.x*e.z,e=>e.x*e.x-e.y*e.y],r=(e,t)=>s[e]*i[e](t),a=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4];class h{constructor(){this.preScaled=!1,this.l00=t.Vector3.Zero(),this.l1_1=t.Vector3.Zero(),this.l10=t.Vector3.Zero(),this.l11=t.Vector3.Zero(),this.l2_2=t.Vector3.Zero(),this.l2_1=t.Vector3.Zero(),this.l20=t.Vector3.Zero(),this.l21=t.Vector3.Zero(),this.l22=t.Vector3.Zero()}addLight(e,s,i){t.TmpVectors.Vector3[0].set(s.r,s.g,s.b);let a=t.TmpVectors.Vector3[0],h=t.TmpVectors.Vector3[1];a.scaleToRef(i,h),h.scaleToRef(r(0,e),t.TmpVectors.Vector3[2]),this.l00.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(1,e),t.TmpVectors.Vector3[2]),this.l1_1.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(2,e),t.TmpVectors.Vector3[2]),this.l10.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(3,e),t.TmpVectors.Vector3[2]),this.l11.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(4,e),t.TmpVectors.Vector3[2]),this.l2_2.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(5,e),t.TmpVectors.Vector3[2]),this.l2_1.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(6,e),t.TmpVectors.Vector3[2]),this.l20.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(7,e),t.TmpVectors.Vector3[2]),this.l21.addInPlace(t.TmpVectors.Vector3[2]),h.scaleToRef(r(8,e),t.TmpVectors.Vector3[2]),this.l22.addInPlace(t.TmpVectors.Vector3[2])}scaleInPlace(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)}convertIncidentRadianceToIrradiance(){this.l00.scaleInPlace(a[0]),this.l1_1.scaleInPlace(a[1]),this.l10.scaleInPlace(a[2]),this.l11.scaleInPlace(a[3]),this.l2_2.scaleInPlace(a[4]),this.l2_1.scaleInPlace(a[5]),this.l20.scaleInPlace(a[6]),this.l21.scaleInPlace(a[7]),this.l22.scaleInPlace(a[8])}convertIrradianceToLambertianRadiance(){this.scaleInPlace(1/Math.PI)}preScaleForRendering(){this.preScaled=!0,this.l00.scaleInPlace(s[0]),this.l1_1.scaleInPlace(s[1]),this.l10.scaleInPlace(s[2]),this.l11.scaleInPlace(s[3]),this.l2_2.scaleInPlace(s[4]),this.l2_1.scaleInPlace(s[5]),this.l20.scaleInPlace(s[6]),this.l21.scaleInPlace(s[7]),this.l22.scaleInPlace(s[8])}updateFromArray(e){return t.Vector3.FromArrayToRef(e[0],0,this.l00),t.Vector3.FromArrayToRef(e[1],0,this.l1_1),t.Vector3.FromArrayToRef(e[2],0,this.l10),t.Vector3.FromArrayToRef(e[3],0,this.l11),t.Vector3.FromArrayToRef(e[4],0,this.l2_2),t.Vector3.FromArrayToRef(e[5],0,this.l2_1),t.Vector3.FromArrayToRef(e[6],0,this.l20),t.Vector3.FromArrayToRef(e[7],0,this.l21),t.Vector3.FromArrayToRef(e[8],0,this.l22),this}updateFromFloatsArray(e){return t.Vector3.FromFloatsToRef(e[0],e[1],e[2],this.l00),t.Vector3.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),t.Vector3.FromFloatsToRef(e[6],e[7],e[8],this.l10),t.Vector3.FromFloatsToRef(e[9],e[10],e[11],this.l11),t.Vector3.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),t.Vector3.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),t.Vector3.FromFloatsToRef(e[18],e[19],e[20],this.l20),t.Vector3.FromFloatsToRef(e[21],e[22],e[23],this.l21),t.Vector3.FromFloatsToRef(e[24],e[25],e[26],this.l22),this}static FromArray(e){return new h().updateFromArray(e)}static FromPolynomial(e){let t=new h;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t}}class n{constructor(){this.x=t.Vector3.Zero(),this.y=t.Vector3.Zero(),this.z=t.Vector3.Zero(),this.xx=t.Vector3.Zero(),this.yy=t.Vector3.Zero(),this.zz=t.Vector3.Zero(),this.xy=t.Vector3.Zero(),this.yz=t.Vector3.Zero(),this.zx=t.Vector3.Zero()}get preScaledHarmonics(){return this._harmonics||(this._harmonics=h.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics}addAmbient(e){t.TmpVectors.Vector3[0].copyFromFloats(e.r,e.g,e.b);let s=t.TmpVectors.Vector3[0];this.xx.addInPlace(s),this.yy.addInPlace(s),this.zz.addInPlace(s)}scaleInPlace(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)}updateFromHarmonics(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),t.TmpVectors.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),t.TmpVectors.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(t.TmpVectors.Vector3[0]).addInPlace(t.TmpVectors.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(t.TmpVectors.Vector3[0]).subtractInPlace(t.TmpVectors.Vector3[1]),this.zz.copyFrom(e.l00),t.TmpVectors.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(t.TmpVectors.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this}static FromHarmonics(e){return new n().updateFromHarmonics(e)}static FromArray(e){let s=new n;return t.Vector3.FromArrayToRef(e[0],0,s.x),t.Vector3.FromArrayToRef(e[1],0,s.y),t.Vector3.FromArrayToRef(e[2],0,s.z),t.Vector3.FromArrayToRef(e[3],0,s.xx),t.Vector3.FromArrayToRef(e[4],0,s.yy),t.Vector3.FromArrayToRef(e[5],0,s.zz),t.Vector3.FromArrayToRef(e[6],0,s.yz),t.Vector3.FromArrayToRef(e[7],0,s.zx),t.Vector3.FromArrayToRef(e[8],0,s.xy),s}}e.s(["SphericalHarmonics",0,h,"SphericalPolynomial",0,n])},53730,e=>{"use strict";var t=e.i(13379);let s=new Map;function i(e,i){var r;r=e,s.delete(r)&&t.Logger.Warn(`Extension with the name '${e}' already exists`),s.set(e,i)}e.s(["_GetCompatibleTextureLoader",0,function(t,r){("image/ktx"===r||"image/ktx2"===r)&&(t=".ktx"),!s.has(t)&&(t.endsWith(".ies")&&i(".ies",async()=>await e.A(99491).then(e=>new e._IESTextureLoader)),t.endsWith(".dds")&&i(".dds",async()=>await e.A(74577).then(e=>new e._DDSTextureLoader)),t.endsWith(".basis")&&i(".basis",async()=>await e.A(90083).then(e=>new e._BasisTextureLoader)),t.endsWith(".env")&&i(".env",async()=>await e.A(30057).then(e=>new e._ENVTextureLoader)),t.endsWith(".hdr")&&i(".hdr",async()=>await e.A(31746).then(e=>new e._HDRTextureLoader)),(t.endsWith(".ktx")||t.endsWith(".ktx2"))&&(i(".ktx",async()=>await e.A(18798).then(e=>new e._KTXTextureLoader)),i(".ktx2",async()=>await e.A(18798).then(e=>new e._KTXTextureLoader))),t.endsWith(".tga")&&i(".tga",async()=>await e.A(28368).then(e=>new e._TGATextureLoader)),t.endsWith(".exr")&&i(".exr",async()=>await e.A(1671).then(e=>new e._ExrTextureLoader)));let a=s.get(t);return a?Promise.resolve(a(r)):null}])},98673,e=>{e.v(t=>Promise.all(["static/chunks/3218lp8l0a5g_.js"].map(t=>e.l(t))).then(()=>t(27054)))},99491,e=>{e.v(t=>Promise.all(["static/chunks/0o6ayai0s01js.js"].map(t=>e.l(t))).then(()=>t(14849)))},74577,e=>{e.v(t=>Promise.all(["static/chunks/2yph6f7khgqii.js"].map(t=>e.l(t))).then(()=>t(97991)))},90083,e=>{e.v(t=>Promise.all(["static/chunks/0cu-q5q3a7uf3.js","static/chunks/1zvc1tv--w8nn.js"].map(t=>e.l(t))).then(()=>t(26660)))},30057,e=>{e.v(t=>Promise.all(["static/chunks/0cu-q5q3a7uf3.js","static/chunks/2g5gecypj0rqe.js","static/chunks/123xxske5c9na.js","static/chunks/3nz-dh9d7cehk.js","static/chunks/3zskk1hxu3-_o.js"].map(t=>e.l(t))).then(()=>t(41342)))},31746,e=>{e.v(t=>Promise.all(["static/chunks/3be6s4_kn9q-o.js"].map(t=>e.l(t))).then(()=>t(85821)))},18798,e=>{e.v(t=>Promise.all(["static/chunks/0fskcfh9vbhtv.js","static/chunks/0cu-q5q3a7uf3.js"].map(t=>e.l(t))).then(()=>t(58046)))},28368,e=>{e.v(t=>Promise.all(["static/chunks/023axeoslq39i.js"].map(t=>e.l(t))).then(()=>t(75174)))},1671,e=>{e.v(t=>Promise.all(["static/chunks/1pdep2_c530sg.js","static/chunks/0cu-q5q3a7uf3.js"].map(t=>e.l(t))).then(()=>t(35851)))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65002,e=>{"use strict";var t=e.i(96265);class i{constructor(e,i,r,a){this.normal=new t.Vector3(e,i,r),this.d=a}asArray(){return[this.normal.x,this.normal.y,this.normal.z,this.d]}clone(){return new i(this.normal.x,this.normal.y,this.normal.z,this.d)}getClassName(){return"Plane"}getHashCode(){let e=this.normal.getHashCode();return 397*e^this.d}normalize(){let e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this}transform(e){let t=i._TmpMatrix;e.invertToRef(t);let r=t.m,a=this.normal.x,s=this.normal.y,n=this.normal.z,o=this.d;return new i(a*r[0]+s*r[1]+n*r[2]+o*r[3],a*r[4]+s*r[5]+n*r[6]+o*r[7],a*r[8]+s*r[9]+n*r[10]+o*r[11],a*r[12]+s*r[13]+n*r[14]+o*r[15])}dotCoordinate(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d}copyFromPoints(e,t,i){let r,a=t.x-e.x,s=t.y-e.y,n=t.z-e.z,o=i.x-e.x,l=i.y-e.y,h=i.z-e.z,c=s*h-n*l,d=n*o-a*h,u=a*l-s*o,_=Math.sqrt(c*c+d*d+u*u);return r=0!==_?1/_:0,this.normal.x=c*r,this.normal.y=d*r,this.normal.z=u*r,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this}isFrontFacingTo(e,i){return t.Vector3.Dot(this.normal,e)<=i}signedDistanceTo(e){return t.Vector3.Dot(e,this.normal)+this.d}static FromArray(e){return new i(e[0],e[1],e[2],e[3])}static FromPoints(e,t,r){let a=new i(0,0,0,0);return a.copyFromPoints(e,t,r),a}static FromPositionAndNormal(e,t){let r=new i(0,0,0,0);return this.FromPositionAndNormalToRef(e,t,r)}static FromPositionAndNormalToRef(e,t,i){return i.normal.copyFrom(t),i.normal.normalize(),i.d=-e.dot(i.normal),i}static SignedDistanceToPlaneFromPositionAndNormal(e,i,r){let a=-(i.x*e.x+i.y*e.y+i.z*e.z);return t.Vector3.Dot(r,i)+a}}i._TmpMatrix=t.Matrix.Identity(),e.s(["Plane",0,i])},1773,e=>{"use strict";e.s(["useOpenGLOrientationForUV",()=>!1])},58720,e=>{"use strict";var t=e.i(10272),i=e.i(37143),r=e.i(99267),a=e.i(96265),s=e.i(52153),n=e.i(77052),o=e.i(75405),l=e.i(23240),h=e.i(98105),c=e.i(65002),d=e.i(49311);function u(e,t,i=!1){let r=t.width,a=t.height;if(e instanceof Float32Array){let t=e.byteLength/e.BYTES_PER_ELEMENT,i=new Uint8Array(t);for(;--t>=0;){let r=e[t];r<0?r=0:r>1&&(r=1),i[t]=255*r}e=i}let s=document.createElement("canvas");s.width=r,s.height=a;let n=s.getContext("2d");if(!n)return null;let o=n.createImageData(r,a);if(o.data.set(e),n.putImageData(o,0,0),i){let e=document.createElement("canvas");e.width=r,e.height=a;let t=e.getContext("2d");return t?(t.translate(0,a),t.scale(1,-1),t.drawImage(s,0,0),e.toDataURL("image/png")):null}return s.toDataURL("image/png")}async function _(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let a=await e.readPixels(t,i);return a?u(a,e.getSize(),r.invertY):null}var f=e.i(1773),m=e.i(80871);class T extends s.BaseTexture{static _CreateVideoTexture(e,t,i,r=!1,a=!1,s=T.TRILINEAR_SAMPLINGMODE,n={},l,h=5){throw(0,o._WarnImport)("VideoTexture")}get noMipmap(){return this._noMipmap}get mimeType(){return this._mimeType}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}get invertY(){return this._invertY}constructor(e,t,i,a,s=T.TRILINEAR_SAMPLINGMODE,n=null,o=null,h=null,c=!1,d,u,_,m,p){let g;super(t),this.url=null,this.uOffset=0,this.vOffset=0,this.uScale=1,this.vScale=1,this.uAng=0,this.vAng=0,this.wAng=0,this.uRotationCenter=.5,this.vRotationCenter=.5,this.wRotationCenter=.5,this.homogeneousRotationInUVTransform=!1,this.inspectableCustomProperties=null,this._noMipmap=!1,this._invertY=!1,this._rowGenerationMatrix=null,this._cachedTextureMatrix=null,this._projectionModeMatrix=null,this._t0=null,this._t1=null,this._t2=null,this._cachedUOffset=-1,this._cachedVOffset=-1,this._cachedUScale=0,this._cachedVScale=0,this._cachedUAng=-1,this._cachedVAng=-1,this._cachedWAng=-1,this._cachedReflectionProjectionMatrixId=-1,this._cachedURotationCenter=-1,this._cachedVRotationCenter=-1,this._cachedWRotationCenter=-1,this._cachedHomogeneousRotationInUVTransform=!1,this._cachedIdentity3x2=!0,this._cachedReflectionTextureMatrix=null,this._cachedReflectionUOffset=-1,this._cachedReflectionVOffset=-1,this._cachedReflectionUScale=0,this._cachedReflectionVScale=0,this._cachedReflectionCoordinatesMode=-1,this._buffer=null,this._deleteBuffer=!1,this._format=null,this._delayedOnLoad=null,this._delayedOnError=null,this.onLoadObservable=new r.Observable,this._isBlocking=!0,this.name=e||"",this.url=e;let R=!1,x=null,M=!0;"object"==typeof i&&null!==i?(g=i.noMipmap??!1,a=i.invertY??!f.useOpenGLOrientationForUV,s=i.samplingMode??T.TRILINEAR_SAMPLINGMODE,n=i.onLoad??null,o=i.onError??null,h=i.buffer??null,c=i.deleteBuffer??!1,d=i.format,u=i.mimeType,_=i.loaderOptions,m=i.creationFlags,R=i.useSRGBBuffer??!1,x=i.internalTexture??null,M=i.gammaSpace??M,p=i.forcedExtension??p):g=!!i,this._gammaSpace=M,this._noMipmap=g,this._invertY=void 0===a?!f.useOpenGLOrientationForUV:a,this._initialSamplingMode=s,this._buffer=h,this._deleteBuffer=c,this._mimeType=u,this._loaderOptions=_,this._creationFlags=m,this._useSRGBBuffer=R,this._forcedExtension=p,void 0!==d&&(this._format=d);const A=this.getScene(),S=this._getEngine();if(!S)return;S.onBeforeTextureInitObservable.notifyObservers(this);const E=()=>{this._texture&&(this._texture._invertVScale&&(this.vScale*=-1,this.vOffset+=1),null!==this._texture._cachedWrapU&&(this.wrapU=this._texture._cachedWrapU,this._texture._cachedWrapU=null),null!==this._texture._cachedWrapV&&(this.wrapV=this._texture._cachedWrapV,this._texture._cachedWrapV=null),null!==this._texture._cachedWrapR&&(this.wrapR=this._texture._cachedWrapR,this._texture._cachedWrapR=null)),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),n&&n(),!this.isBlocking&&A&&A.resetCachedMaterial()},y=(e,t)=>{this._loadingError=!0,this._errorObject={message:e,exception:t},o&&o(e,t),T.OnTextureLoadErrorObservable.notifyObservers(this)};if(!this.url&&!x){this._delayedOnLoad=E,this._delayedOnError=y;return}if(this._texture=x??this._getFromCache(this.url,g,s,this._invertY,R,this.isCube),this._texture)if(this._texture.isReady)l.TimingTools.SetImmediate(()=>E());else{const e=this._texture.onLoadedObservable.add(E);this._texture.onErrorObservable.add(t=>{y(t.message,t.exception),this._texture?.onLoadedObservable.remove(e)})}else if(A&&A.useDelayedTextureLoading)this.delayLoadState=4,this._delayedOnLoad=E,this._delayedOnError=y;else{try{this._texture=S.createTexture(this.url,g,this._invertY,A,s,E,y,this._buffer,void 0,this._format,this._forcedExtension,u,_,m,R)}catch(e){throw y("error loading",e),e}c&&(this._buffer=null)}}updateURL(e,t=null,i,r){this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1,e=>e.hasTexture(this))),(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=r,this.delayLoadState=4;let a=this._delayedOnLoad,s=()=>{a?a():this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),i&&i()};this._delayedOnLoad=s,this.delayLoad()}delayLoad(){if(4!==this.delayLoadState)return;let e=this.getScene();if(!e)return;let t=this.url;!t&&(this.name.indexOf("://")>0||this.name.startsWith("data:"))&&(t=this.name),this.delayLoadState=1,this._texture=this._getFromCache(t,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer,this.isCube),this._texture?this._delayedOnLoad&&(this._texture.isReady?l.TimingTools.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(t,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null}_prepareRowForTextureGeneration(e,t,i,r){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,a.Vector3.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,r),r.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,r.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,r.z+=this.wRotationCenter}getTextureMatrix(e=1){if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=a.Matrix.Zero(),this._rowGenerationMatrix=new a.Matrix,this._t0=a.Vector3.Zero(),this._t1=a.Vector3.Zero(),this._t2=a.Vector3.Zero()),a.Matrix.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(a.Matrix.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,a.TmpVectors.Matrix[0]),a.Matrix.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,a.TmpVectors.Matrix[1]),a.Matrix.ScalingToRef(this._cachedUScale,this._cachedVScale,0,a.TmpVectors.Matrix[2]),a.Matrix.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,a.TmpVectors.Matrix[3]),a.TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.TmpVectors.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.TmpVectors.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(a.TmpVectors.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),a.Matrix.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));let t=this.getScene();if(!t)return this._cachedTextureMatrix;let i=this._cachedIdentity3x2;return this._cachedIdentity3x2=this._cachedTextureMatrix.isIdentityAs3x2(),this.optimizeUVAllocation&&i!==this._cachedIdentity3x2&&t.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedTextureMatrix}getReflectionTextureMatrix(){let e=this.getScene();if(!e)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode){if(this.coordinatesMode!==T.PROJECTION_MODE)return this._cachedReflectionTextureMatrix;else if(this._cachedReflectionProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=a.Matrix.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=a.Matrix.Zero());let t=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case T.PLANAR_MODE:a.Matrix.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case T.PROJECTION_MODE:{a.Matrix.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);let t=e.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=t.updateFlag,t.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break}default:a.Matrix.IdentityToRef(this._cachedReflectionTextureMatrix)}return t&&e.markAllMaterialsAsDirty(1,e=>e.hasTexture(this)),this._cachedReflectionTextureMatrix}clone(){let e={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return m.SerializationHelper.Clone(()=>new T(this._texture?this._texture.url:null,this.getScene(),e),this)}serialize(){let e=this.name;!T.SerializeBuffers&&this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");let t=super.serialize(T._SerializeInternalTextureUniqueId);if(!t)return null;if(T.SerializeBuffers||T.ForceSerializeBuffers)if("string"==typeof this._buffer&&this._buffer.startsWith("data:"))t.base64String=this._buffer,t.name=t.name.replace("data:","");else if(this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array){let e=this.mimeType||"image/png";t.base64String=`data:${e};base64,${(0,d.EncodeArrayBufferToBase64)(this._buffer)}`}else(T.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(t.base64String=!this._engine||this._engine._features.supportSyncTextureRead?function(e,t=0,i=0){let r=e.getInternalTexture();if(!r)return null;let a=e._readPixelsSync(t,i);return a?u(a,e.getSize(),r.invertY):null}(this):_(this));return t.invertY=this._invertY,t.samplingMode=this.samplingMode,t._creationFlags=this._creationFlags,t._useSRGBBuffer=this._useSRGBBuffer,T._SerializeInternalTextureUniqueId&&(t.internalTextureUniqueId=this._texture?.uniqueId),t.internalTextureLabel=this._texture?.label,t.noMipmap=this._noMipmap,this.name=e,t}getClassName(){return"Texture"}dispose(){super.dispose(),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null}static Parse(e,t,i){let r;if(e.customType){let r=h.InstantiationTools.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&r.updateSamplingMode&&r._samplingMode&&r._samplingMode!==e.samplingMode&&r.updateSamplingMode(e.samplingMode),r}if(e.isCube&&!e.isRenderTarget)return T._CubeTextureParser(e,t,i);let a=void 0!==e.internalTextureUniqueId;if(!e.name&&!e.isRenderTarget&&!a)return null;if(a){for(let i of t.getEngine().getLoadedTexturesCache())if(i.uniqueId===e.internalTextureUniqueId){r=i;break}}let s=t=>{if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode){let i=e.samplingMode;t&&t.samplingMode!==i&&t.updateSamplingMode(i)}if(t&&e.animations)for(let i=0;i<e.animations.length;i++){let r=e.animations[i],a=(0,n.GetClass)("BABYLON.Animation");a&&t.animations.push(a.Parse(r))}t&&t._texture&&(a&&!r&&t._texture._setUniqueId(e.internalTextureUniqueId),t._texture.label=e.internalTextureLabel)};return m.SerializationHelper.Parse(()=>{let a=!0;if(e.noMipmap&&(a=!1),e.mirrorPlane){let i=T._CreateMirror(e.name,e.renderTargetSize,t,a);return i._waitingRenderList=e.renderList,i.mirrorPlane=c.Plane.FromArray(e.mirrorPlane),s(i),i}if(e.isRenderTarget&&!e.base64String){let i=null;if(e.isCube){if(t.reflectionProbes)for(let i=0;i<t.reflectionProbes.length;i++){let r=t.reflectionProbes[i];if(r.name===e.name)return r.cubeTexture}}else(i=T._CreateRenderTargetTexture(e.name,e.renderTargetSize,t,a,e._creationFlags??0))._waitingRenderList=e.renderList;return s(i),i}if(e.isVideo){let r=T._CreateVideoTexture(i+(e.url||e.name),i+(e.src||e.url),t,a,e.invertY,e.samplingMode,e.settings||{});return s(r),r}{let n;if("string"==typeof e.base64String&&e.base64String&&!r){let i={buffer:e.base64String,noMipmap:!a,invertY:e.invertY,samplingMode:e.samplingMode,useSRGBBuffer:e._useSRGBBuffer??!1,creationFlags:e._creationFlags??0,onLoad:()=>{s(n)}},r=e.base64String,o=r.startsWith("data:")?r.substring(5):r;(n=T.CreateFromBase64String("",o,t,i)).name=e.name}else{let o;o=e.name&&(e.name.indexOf("://")>0||e.name.startsWith("data:"))?e.name:i+e.name,e.url&&(e.url.startsWith("data:")||T.UseSerializedUrlIfAny)&&(o=e.url),n=new T(o,t,{noMipmap:!a,invertY:e.invertY,samplingMode:e.samplingMode,useSRGBBuffer:e._useSRGBBuffer??!1,creationFlags:e._creationFlags??0,onLoad:()=>{s(n)},internalTexture:r})}return n}},e,t)}static CreateFromBase64String(e,t,i,r,a,s=T.TRILINEAR_SAMPLINGMODE,n=null,o=null,l=5,h,c){return new T("data:"+t,i,r,a,s,n,o,e,!1,l,void 0,void 0,h,c)}static LoadFromDataString(e,t,i,r=!1,a,s=!0,n=T.TRILINEAR_SAMPLINGMODE,o=null,l=null,h=5,c,d){return"data:"!==e.substring(0,5)&&(e="data:"+e),new T(e,i,a,s,n,o,l,t,r,h,void 0,void 0,c,d)}}T.SerializeBuffers=!0,T.ForceSerializeBuffers=!1,T.OnTextureLoadErrorObservable=new r.Observable,T._SerializeInternalTextureUniqueId=!1,T._CubeTextureParser=(e,t,i)=>{throw(0,o._WarnImport)("CubeTexture")},T._CreateMirror=(e,t,i,r)=>{throw(0,o._WarnImport)("MirrorTexture")},T._CreateRenderTargetTexture=(e,t,i,r,a)=>{throw(0,o._WarnImport)("RenderTargetTexture")},T.NEAREST_SAMPLINGMODE=1,T.NEAREST_NEAREST_MIPLINEAR=8,T.BILINEAR_SAMPLINGMODE=2,T.LINEAR_LINEAR_MIPNEAREST=11,T.TRILINEAR_SAMPLINGMODE=3,T.LINEAR_LINEAR_MIPLINEAR=3,T.NEAREST_NEAREST_MIPNEAREST=4,T.NEAREST_LINEAR_MIPNEAREST=5,T.NEAREST_LINEAR_MIPLINEAR=6,T.NEAREST_LINEAR=7,T.NEAREST_NEAREST=1,T.LINEAR_NEAREST_MIPNEAREST=9,T.LINEAR_NEAREST_MIPLINEAR=10,T.LINEAR_LINEAR=2,T.LINEAR_NEAREST=12,T.EXPLICIT_MODE=0,T.SPHERICAL_MODE=1,T.PLANAR_MODE=2,T.CUBIC_MODE=3,T.PROJECTION_MODE=4,T.SKYBOX_MODE=5,T.INVCUBIC_MODE=6,T.EQUIRECTANGULAR_MODE=7,T.FIXED_EQUIRECTANGULAR_MODE=8,T.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,T.CLAMP_ADDRESSMODE=0,T.WRAP_ADDRESSMODE=1,T.MIRROR_ADDRESSMODE=2,T.UseSerializedUrlIfAny=!1,(0,t.__decorate)([(0,i.serialize)()],T.prototype,"url",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"uOffset",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"vOffset",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"uScale",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"vScale",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"uAng",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"vAng",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"wAng",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"uRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"vRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"wRotationCenter",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"homogeneousRotationInUVTransform",void 0),(0,t.__decorate)([(0,i.serialize)()],T.prototype,"isBlocking",null),e.s(["Texture",0,T],58720)},26660,e=>{"use strict";var t,i,r=e.i(65740),a=e.i(13379),s=e.i(58720),n=e.i(84201);function o(){let e=null;onmessage=t=>{if("init"===t.data.action){if(t.data.url)try{importScripts(t.data.url)}catch(e){postMessage({action:"error",error:e})}e||(e=BASIS({wasmBinary:t.data.wasmBinary})),null!==e&&e.then(e=>{BASIS=e,e.initializeBasis(),postMessage({action:"init"})})}else if("transcode"===t.data.action){var i,r;let e,a=t.data.config,s=t.data.imageData,n=new BASIS.BasisFile(s),o=function(e){let t=e.getHasAlpha(),i=e.getNumImages(),r=[];for(let t=0;t<i;t++){let i={levels:[]},a=e.getNumLevels(t);for(let r=0;r<a;r++){let a={width:e.getImageWidth(t,r),height:e.getImageHeight(t,r)};i.levels.push(a)}r.push(i)}return{hasAlpha:t,images:r}}(n),l=t.data.ignoreSupportedFormats?null:(i=t.data.config,r=o,e=null,i.supportedCompressionFormats&&(e=i.supportedCompressionFormats.astc?10:i.supportedCompressionFormats.bc7?6:i.supportedCompressionFormats.s3tc?r.hasAlpha?3:2:i.supportedCompressionFormats.pvrtc?r.hasAlpha?9:8:i.supportedCompressionFormats.etc2?1:14*!i.supportedCompressionFormats.etc1),e),h=!1;null===l&&(h=!0,l=o.hasAlpha?3:2);let c=!0;n.startTranscoding()||(c=!1);let d=[];for(let e=0;e<o.images.length&&c;e++){let t=o.images[e];if(void 0===a.loadSingleImage||a.loadSingleImage===e){let i=t.levels.length;!1===a.loadMipmapLevels&&(i=1);for(let r=0;r<i;r++){let i=t.levels[r],a=function(e,t,i,r,a){let s=new Uint8Array(e.getImageTranscodedSizeInBytes(t,i,r));return e.transcodeImage(s,t,i,r,1,0)?(a&&(s=function(e,t,i){let r=new Uint16Array(4),a=new Uint16Array(t*i),s=t/4,n=i/4;for(let i=0;i<n;i++)for(let n=0;n<s;n++){let o=0+8*(i*s+n);r[0]=e[o]|e[o+1]<<8,r[1]=e[o+2]|e[o+3]<<8,r[2]=(2*(31&r[0])+ +(31&r[1]))/3|(2*(2016&r[0])+ +(2016&r[1]))/3&2016|(2*(63488&r[0])+ +(63488&r[1]))/3&63488,r[3]=(2*(31&r[1])+ +(31&r[0]))/3|(2*(2016&r[1])+ +(2016&r[0]))/3&2016|(2*(63488&r[1])+ +(63488&r[0]))/3&63488;for(let s=0;s<4;s++){let l=e[o+4+s],h=(4*i+s)*t+4*n;a[h++]=r[3&l],a[h++]=r[l>>2&3],a[h++]=r[l>>4&3],a[h]=r[l>>6&3]}}return a}(s,e.getImageWidth(t,i)+3&-4,e.getImageHeight(t,i)+3&-4)),s):null}(n,e,r,l,h);if(!a){c=!1;break}i.transcodedPixels=a,d.push(i.transcodedPixels.buffer)}}}n.close(),n.delete(),h&&(l=-1),c?postMessage({action:"transcode",success:c,id:t.data.id,fileInfo:o,format:l},d):postMessage({action:"transcode",success:c,id:t.data.id})}}}async function l(e,t,i){return await new Promise((a,s)=>{let n=t=>{"init"===t.data.action?(e.removeEventListener("message",n),a(e)):"error"===t.data.action&&s(t.data.error||"error initializing worker")};e.addEventListener("message",n),e.postMessage({action:"init",url:i?r.Tools.GetBabylonScriptURL(i):void 0,wasmBinary:t},[t])})}(t=i||(i={}))[t.cTFETC1=0]="cTFETC1",t[t.cTFETC2=1]="cTFETC2",t[t.cTFBC1=2]="cTFBC1",t[t.cTFBC3=3]="cTFBC3",t[t.cTFBC4=4]="cTFBC4",t[t.cTFBC5=5]="cTFBC5",t[t.cTFBC7=6]="cTFBC7",t[t.cTFPVRTC1_4_RGB=8]="cTFPVRTC1_4_RGB",t[t.cTFPVRTC1_4_RGBA=9]="cTFPVRTC1_4_RGBA",t[t.cTFASTC_4x4=10]="cTFASTC_4x4",t[t.cTFATC_RGB=11]="cTFATC_RGB",t[t.cTFATC_RGBA_INTERPOLATED_ALPHA=12]="cTFATC_RGBA_INTERPOLATED_ALPHA",t[t.cTFRGBA32=13]="cTFRGBA32",t[t.cTFRGB565=14]="cTFRGB565",t[t.cTFBGR565=15]="cTFBGR565",t[t.cTFRGBA4444=16]="cTFRGBA4444",t[t.cTFFXT1_RGB=17]="cTFFXT1_RGB",t[t.cTFPVRTC2_4_RGB=18]="cTFPVRTC2_4_RGB",t[t.cTFPVRTC2_4_RGBA=19]="cTFPVRTC2_4_RGBA",t[t.cTFETC2_EAC_R11=20]="cTFETC2_EAC_R11",t[t.cTFETC2_EAC_RG11=21]="cTFETC2_EAC_RG11";let h={JSModuleURL:`${r.Tools._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.js`,WasmModuleURL:`${r.Tools._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.wasm`},c=null,d=null,u=0,_=async()=>(c||(c=new Promise((e,t)=>{d?e(d):r.Tools.LoadFileAsync(r.Tools.GetBabylonScriptURL(h.WasmModuleURL)).then(i=>{if("function"!=typeof URL)return t("Basis transcoder requires an environment with a URL constructor");l(d=new Worker(URL.createObjectURL(new Blob([`(${o})()`],{type:"application/javascript"}))),i,h.JSModuleURL).then(e,t)}).catch(t)})),await c),f=async(e,t)=>{let i=e instanceof ArrayBuffer?new Uint8Array(e):e;return await new Promise((e,r)=>{_().then(()=>{let a=u++,s=t=>{"transcode"===t.data.action&&t.data.id===a&&(d.removeEventListener("message",s),t.data.success?e(t.data):r("Transcode is not supported on this device"))};d.addEventListener("message",s);let n=new Uint8Array(i.byteLength);n.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)),d.postMessage({action:"transcode",id:a,imageData:n,config:t,ignoreSupportedFormats:!1},[n.buffer])},e=>{r(e)})})},m=(e,t)=>{let i=t._gl?.TEXTURE_2D;e.isCube&&(i=t._gl?.TEXTURE_CUBE_MAP),t._bindTextureDirectly(i,e,!0)},T=(e,t)=>{let r=e.getEngine();for(let o=0;o<t.fileInfo.images.length;o++){let l=t.fileInfo.images[o].levels[0];if(e._invertVScale=e.invertY,-1===t.format||t.format===i.cTFRGB565)if(e.type=10,e.format=4,r._features.basisNeedsPOT&&(Math.log2(l.width)%1!=0||Math.log2(l.height)%1!=0)){let t=new n.InternalTexture(r,2);e._invertVScale=e.invertY,t.type=10,t.format=4,t.width=l.width+3&-4,t.height=l.height+3&-4,m(t,r),r._uploadDataToTextureDirectly(t,new Uint16Array(l.transcodedPixels.buffer),o,0,4,!0),r._rescaleTexture(t,e,r.scenes[0],r._getInternalFormat(4),()=>{r._releaseTexture(t),m(e,r)})}else e._invertVScale=!e.invertY,e.width=l.width+3&-4,e.height=l.height+3&-4,e.samplingMode=2,m(e,r),r._uploadDataToTextureDirectly(e,new Uint16Array(l.transcodedPixels.buffer),o,0,4,!0);else{e.width=l.width,e.height=l.height,e.generateMipMaps=t.fileInfo.images[o].levels.length>1;let i=p.GetInternalFormatFromBasisFormat(t.format,r);e.format=i,m(e,r);let n=t.fileInfo.images[o].levels;for(let t=0;t<n.length;t++){let a=n[t];r._uploadCompressedDataToTextureDirectly(e,i,a.width,a.height,a.transcodedPixels,o,t)}r._features.basisNeedsPOT&&(Math.log2(e.width)%1!=0||Math.log2(e.height)%1!=0)&&(a.Logger.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),e._cachedWrapU=s.Texture.CLAMP_ADDRESSMODE,e._cachedWrapV=s.Texture.CLAMP_ADDRESSMODE)}}},p={JSModuleURL:h.JSModuleURL,WasmModuleURL:h.WasmModuleURL,GetInternalFormatFromBasisFormat:(e,t)=>{let r;switch(e){case i.cTFETC1:r=36196;break;case i.cTFBC1:r=33776;break;case i.cTFBC4:r=33779;break;case i.cTFASTC_4x4:r=37808;break;case i.cTFETC2:r=37496;break;case i.cTFBC7:r=36492}if(void 0===r)throw"The chosen Basis transcoder format is not currently supported";return r},TranscodeAsync:f,LoadTextureFromTranscodeResult:T};e.s(["_BasisTextureLoader",0,class{constructor(){this.supportCascades=!1}loadCubeData(e,t,i,a,s){if(Array.isArray(e))return;let n=t.getEngine().getCaps();f(e,{supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2,astc:!!n.astc,bc7:!!n.bptc}}).then(e=>{let i=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;T(t,e),t.getEngine()._setCubeMapTextureParams(t,i),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),a&&a()}).catch(e=>{r.Tools.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0,s&&s(e)})}loadData(e,t,i){let a=t.getEngine().getCaps();f(e,{supportedCompressionFormats:{etc1:!!a.etc1,s3tc:!!a.s3tc,pvrtc:!!a.pvrtc,etc2:!!a.etc2,astc:!!a.astc,bc7:!!a.bptc}}).then(e=>{let r=e.fileInfo.images[0].levels[0],a=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;i(r.width,r.height,a,-1!==e.format,()=>{T(t,e)})}).catch(e=>{r.Tools.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),r.Tools.Warn(`Failed to transcode Basis file: ${e}`),i(0,0,!1,!1,()=>{},!0)})}}],26660)}]);
|